home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / rfc / 800s / rfc893.txt < prev    next >
Text File  |  1992-09-22  |  13KB  |  343 lines

  1.  
  2.  
  3. Network Working Group                                  Samuel J. Leffler
  4. Request for Comments: 893                              Michael J. Karels
  5.                                     University of California at Berkeley
  6.                                                               April 1984
  7.  
  8.                          Trailer Encapsulations
  9.  
  10.  
  11. Status of this Memo
  12.  
  13.    This RFC discusses the motivation for use of "trailer encapsulations"
  14.    on local-area networks and describes the implementation of such an
  15.    encapsulation on various media.  This document is for information
  16.    only.  This is NOT an official protocol for the ARPA Internet
  17.    community.
  18.  
  19. Introduction
  20.  
  21.    A trailer encapsulation is a link level packet format employed by
  22.    4.2BSD UNIX (among others).  A trailer encapsulation, or "trailer",
  23.    may be generated by a system under certain conditions in an effort to
  24.    minimize the number and size of memory-to-memory copy operations
  25.    performed by a receiving host when processing a data packet.
  26.    Trailers are strictly a link level packet format and are not visible
  27.    (when properly implemented) in any higher level protocol processing.
  28.    This note cites the motivation behind the trailer encapsulation and
  29.    describes the trailer encapsulation packet formats currently in use
  30.    on 3 Mb/s Experimental Ethernet, 10 Mb/s Ethernet, and 10 Mb/s V2LNI
  31.    ring networks [1].
  32.  
  33.    The use of a trailer encapsulation was suggested by Greg Chesson, and
  34.    the encapsulation described here was designed by Bill Joy.
  35.  
  36. Motivation
  37.  
  38.    Trailers are motivated by the overhead which may be incurred during
  39.    protocol processing when one or more memory to memory copies must be
  40.    performed.  Copying can be required at many levels of processing,
  41.    from moving data between the network medium and the host's memory, to
  42.    passing data between the operating system and user address spaces.
  43.    An optimal network implementation would expect to incur zero copy
  44.    operations between delivery of a data packet into host memory and
  45.    presentation of the appropriate data to the receiving process.  While
  46.    many packets may not be processed without some copying operations,
  47.    when the host computer provides suitable memory management support it
  48.    may often be possible to avoid copying simply by manipulating the
  49.    appropriate virtual memory hardware.
  50.  
  51.    In a page mapped virtual memory environment, two prerequisites are
  52.    usually required to achieve the goal of zero copy operations during
  53.    packet processing.  Data destined for a receiving agent must be
  54.  
  55.  
  56. Leffler & Karels                                                [Page 1]
  57.  
  58.  
  59.  
  60. RFC 893                                                       April 1984
  61.  
  62.  
  63.    aligned on a page boundary and must have a size which is a multiple
  64.    of the hardware page size (or filled to a page boundary).  The latter
  65.    restriction assumes virtual memory protection is maintained at the
  66.    page level; different architectures may alter these prerequisites.
  67.  
  68.    Data to be transmitted across a network may easily be segmented in
  69.    the appropriate size, but unless the encapsulating protocol header
  70.    information is fixed in size, alignment to a page boundary is
  71.    virtually impossible.  Protocol header information may vary in size
  72.    due to the use of multiple protocols (each with a different header),
  73.    or it may vary in size by agreement (for example, when optional
  74.    information is included in the header).  To insure page alignment the
  75.    header information which prefixes data destined for the receiver must
  76.    be reduced to a fixed size; this is normally the case at the link
  77.    level of a network.  By taking all (possibly) variable length header
  78.    information and moving it after the data segment a sending host may
  79.    "do its best" in allowing the receiving host the opportunity to
  80.    receive data on a page aligned boundary.  This rearrangement of data
  81.    at the link level to force variable length header information to
  82.    "trail" the data is the substance of the trailer encapsulation.
  83.  
  84.    There are several implicit assumptions in the above argument.
  85.  
  86.       1. The receiving host must be willing to accept trailers.  As this
  87.       is a link level encapsulation, unless a host to host negotiation
  88.       is performed (preferably at the link level to avoid violating
  89.       layering principles), only certain hosts will be able to converse,
  90.       or their communication may be significantly impaired if trailer
  91.       packets are mixed with non-trailer packets.
  92.  
  93.       2. The cost of receiving data on a page aligned boundary should be
  94.       comparable to receiving data on a non-page aligned boundary.  If
  95.       the overhead of insuring proper alignment is too high, the savings
  96.       in avoiding copy operations may not be cost effective.
  97.  
  98.       3. The size of the variable length header information should be
  99.       significantly less than that of the data segment being
  100.       transmitted. It is possible to move trailing information without
  101.       physically copying it, but often implementation constraints and
  102.       the characteristics of the underlying network hardware preclude
  103.       merely remapping the header(s).
  104.  
  105.       4. The memory to memory copying overhead which is expected to be
  106.       performed by the receiver must be significant enough to warrant
  107.       the added complexity in the both the sending and receiving host
  108.       software.
  109.  
  110.    The first point is well known and the motivation for this note.
  111.  
  112.  
  113. Leffler & Karels                                                [Page 2]
  114.  
  115.  
  116.  
  117. RFC 893                                                       April 1984
  118.  
  119.  
  120.    Thought has been given to negotiating the user of trailers on a per
  121.    host basis using a variant of the Address Resolution Protocol [2]
  122.    (actually augmenting the protocol), but at present all systems using
  123.    trailers require hosts sharing a network medium to uniformly accept
  124.    trailers or never transmit them.  (The latter is easily carried out
  125.    at boot time in 4.2BSD without modifying the operating system source
  126.    code.)
  127.  
  128.    The second point is (to our knowledge) insignificant.  While a host
  129.    may not be able to take advantage of the alignment and size
  130.    properties of a trailer packet, it should nonetheless never hamper
  131.    it.
  132.  
  133.    Regarding the third point, let us assume the trailing header
  134.    information is copied and not remapped, and consider the header
  135.    overhead in the TCP/IP protocols as a representative example [3].  If
  136.    we assume both the TCP and IP protocol headers are part of the
  137.    variable length header information, then the smallest trailer packet
  138.    (generated by a VAX) would have 512 bytes of data and 40+ bytes of
  139.    header information (plus the trailer header described later).  While
  140.    the trailing header could have IP and/or TCP options included this
  141.    would normally be rare (one would expect most TCP options, for
  142.    example, to be included in the initial connection setup exchange) and
  143.    certainly much smaller than 512 bytes.  If the data segment is
  144.    larger, the ratio decreases and the expected gain due to fewer copies
  145.    on the receiving end increases.  Given the relative overheads of a
  146.    memory to memory copy operation and that of a page map manipulation
  147.    (including translation buffer invalidation), the advantage is
  148.    obvious.
  149.  
  150.    The fourth issue, we believe, is actually a non-issue.  In our
  151.    implementation the additional code required to support the trailer
  152.    encapsulation amounts to about a dozen lines of code in each link
  153.    level "network interface driver".  The resulting performance
  154.    improvement more than warrants this minor investment in software.
  155.  
  156.    It should be recognized that modifying the network (and normal link)
  157.    level format of a packet in the manner described forces the receiving
  158.    host to buffer the entire packet before processing.  Clever
  159.    implementations may parse protocol headers as the packet arrives to
  160.    find out the actual size (or network level packet type) of an
  161.    incoming message.  This allows these implementations to avoid
  162.    preallocating maximum sized buffers to incoming packets which it can
  163.    recognize as unacceptable.  Implementations which parses the network
  164.    level format on the fly are violating layering principles which have
  165.    been extolled in design for some time (but often violated in
  166.    implementation).  The problem of postponing link level type
  167.  
  168.  
  169.  
  170. Leffler & Karels                                                [Page 3]
  171.  
  172.  
  173.  
  174. RFC 893                                                       April 1984
  175.  
  176.  
  177.    recognition is a valid criticism.  In the case of network hardware
  178.    which supports DMA, however, the entire packet is always received
  179.    before processing begins.
  180.  
  181. Trailer Encapsulation Packet Formats
  182.  
  183.    In this section we describe the link level packet formats used on the
  184.    3 Mb/s Experimental Ethernet, and 10 Mb/s Ethernet networks as well
  185.    as the 10 Mb/s V2LNI ring network.  The formats used in each case
  186.    differ only in the format and type field values used in each of the
  187.    local area network headers.
  188.  
  189.    The format of a trailer packet is shown in the following diagram.
  190.  
  191.       +----+-------------------------------------------------+----+
  192.       | LH |                     data                        | TH |
  193.       +----+-------------------------------------------------+----+
  194.            ^                    (  ^  )                      ^
  195.  
  196.       LH:
  197.  
  198.          The fixed-size local network header.  For 10 a Mb/s Ethernet,
  199.          the 16-byte Ethernet header.  The type field in the header
  200.          indicates that both the packet type (trailer) and the length of
  201.          the data segment.
  202.  
  203.          For the 10 Mb/s Ethernet, the types are between 1001 and 1010
  204.          hexadecimal (4096 and  4112 decimal). The type is calculated as
  205.          1000 (hex) plus the number of 512-byte pages of data.  A
  206.          maximum  of 16 pages of data may be transmitted in a single
  207.          trailer packet (8192 bytes).
  208.  
  209.       data:
  210.  
  211.          The "data" portion of the packet.  This is normally only data
  212.          to be delivered to the receiving processes (i.e. it contains no
  213.          TCP or IP header information).  Data size is always a multiple
  214.          of 512 bytes.
  215.  
  216.       TH:
  217.  
  218.          The "trailer".  This is actually a composition of the original
  219.          protocol headers and a fixed size trailer prefix which defines
  220.          the type and size
  221.          of the trailing data.  The format of a trailer is shown below.
  222.  
  223.    The carats (^) indicate the page boundaries on which the receiving
  224.    host would place its input buffer for optimal alignment when
  225.  
  226.  
  227. Leffler & Karels                                                [Page 4]
  228.  
  229.  
  230.  
  231. RFC 893                                                       April 1984
  232.  
  233.  
  234.    receiving a trailer packet.  The link level receiving routine is able
  235.    to locate the trailer using the size indicated in the link level
  236.    header's type field.  The receiving routine is expected to discard
  237.    the link level header and trailer prefix, and remap the trailing data
  238.    segment to the front of the packet to regenerate the original network
  239.    level packet format.
  240.  
  241. Trailer Format
  242.  
  243.    +----------------+----------------+------~...~----------+
  244.    |      TYPE      |  HEADER LENGTH |  ORIGINAL HEADER(S) |
  245.    +----------------+----------------+------~...~----------+
  246.  
  247.    Type:        16 bits
  248.  
  249.       The type field encodes the original link level type of the
  250.       transmitted packet.  This is the value which would normally be
  251.       placed in the link level header if a trailer were not generated.
  252.  
  253.    Header length:       16 bits
  254.  
  255.       The header length field of the trailer data segment.  This
  256.       specifies the length in bytes of the following header data.
  257.  
  258.    Original headers: <variable length>
  259.  
  260.       The header information which logically belongs before the data
  261.       segment.  This is normally the network and transport level
  262.       protocol headers.
  263.  
  264. Summary
  265.  
  266.    A link level encapsulation which promotes alignment properties
  267.    necessary for the efficient use of virtual memory hardware facilities
  268.    has been described.  This encapsulation format is in use on many
  269.    systems and is a standard facility in 4.2BSD UNIX.  The encapsulation
  270.    provides an efficient mechanism by which cooperating hosts on a local
  271.    network may obtain significant performance improvements.  The use of
  272.    this encapsulation technique currently requires uniform cooperation
  273.    from all hosts on a network; hopefully a per host negotiation
  274.    mechanism may be added to allow consenting hosts to utilize the
  275.    encapsulation in a non-uniform environment.
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284. Leffler & Karels                                                [Page 5]
  285.  
  286.  
  287.  
  288. RFC 893                                                       April 1984
  289.  
  290.  
  291. References
  292.  
  293.    [1]  "The Ethernet - A Local Area Network", Version 1.0, Digital
  294.    Equipment Corporation, Intel Corporation, Xerox Corporation,
  295.    September 1980.
  296.  
  297.    [2]  Plummer, David C., "An Ethernet Address Resolution Protocol",
  298.    RFC-826,  Symbolics Cambridge Research Center, November 1982.
  299.  
  300.    [3]  Postel, J., "Internet Protocol", RFC-791, USC/Information
  301.    Sciences Institute, September 1981.
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341. Leffler & Karels                                                [Page 6]
  342.  
  343.