Patent Publication Number: US-6341129-B1

Title: TCP resegmentation

Description:
BACKGROUND OF THE INVENTION 
     1. Technical Field 
     The invention relates to electronic networks. More particularly, the invention relates to establishing and maintaining efficient communication between two IP hosts that have differing MTUs and that primarily use TCP as their transport protocol. 
     2. Description of the Prior Art 
     When an IP (Internet Protocol) routing entity has interfaces with differing MTUs (Maximum Transmission Unit) and a large IP packet containing a TCP (Transmission Control Protocol) segment must be forwarded from an interface having a smaller MTU, the routing entity typically does one of two things: 
     Fragment the packet using IP fragmentation; or 
     Drop the packet and send an ICMP (Internet Control Message Protocol) DESTINATION UNREACHABLE; FRAGMENTATION NEEDED message back to the sending host. 
     IP fragmentation breaks the large IP packet into several smaller IP fragments which require reassembly by the receiving host. Dropping the packet causes the data to be lost, and sending an ICMP DESTINATION UNREACHABLE; FRAGMENTATION NEEDED message back to the host causes the host to reduce its path MTU and use smaller IP packets. 
     IP fragmentation places the burden of reassembling the IP fragments onto the receiving host. When a host receives IP fragments, it must fully reassemble all of the fragments to form a complete IP packet before it can deliver the payload to TCP. This requires additional buffer and CPU resources at the receiving host and increases the latency of receiving a TCP segment. Additionally, if any of the fragments are dropped or otherwise lost during transit, the entire original TCP segment must be retransmitted. 
     Dropping the IP packet and sending an ICMP DESTINATION UNREACHABLE—FRAGMENTATION NEEDED message back to the sending host causes the host&#39;s path MTU discovery algorithm to choose a smaller MTU for the path and use that smaller MTU for future transmissions. When this occurs, it forces a host that is capable of using a larger MTU to use a smaller MTU, reducing the host&#39;s efficiency. It also requires the entire TCP segment to be retransmitted. 
     It would be advantageous to allow a host that is capable of sending large IP packets to do so, even when it is communicating over a path that is not capable of carrying large IP packets. It would also be advantageous not to burden the receiving host with the task of reassembling the IP packet from the various IP fragments. Finally, it would be advantageous to enable this ability without requiring all of the connected stations in the network to use the smallest MTU of any interface along the path that a packet takes as it traverses the network. 
     SUMMARY OF THE INVENTION 
     The invention provides a resegmentation entity that implements a TCP resegmentation technique wherein a receiving host receives packets that appear as if it they have been transmitted specifically for the receiving host&#39;s MTU. The receiving host does not require the buffering and CPU utilization necessary for IP reassembly. Also, the receiving host has a lower latency when receiving IP datagrams that contain resegmented TCP segments than it would if it needed to re-assemble an IP datagram from fragments before it could process the TCP segment. Further, the sending host transmits TCP segments at its largest MTU, without regard to the receiving station&#39;s MTU, knowing that the intermediate routing entity insures that TCP resegmentation occurs. In the event that an IP datagram containing a re-segmented TCP segment is lost, the sending host only has to retransmit the actual TCP data that was lost, and not the complete TCP segment. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a block schematic diagram showing a host protocol stack; 
     FIG. 2 is a block schematic diagram showing a resegmenting entity according to the invention; 
     FIG. 3 is a block schematic diagram showing host communications according to the invention; 
     FIG. 4 is a schematic representation of a TCP/IP packet; 
     FIG. 5 is a schematic representation of a resegmented packet according to the invention; and 
     FIG. 6 is a block schematic diagram showing resegmentation in an electronic network according to the invention. 
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
     The invention provides a resegmentation entity that implements a novel TCP resegmentation technique wherein a receiving host receives packets that appear as if it they have been transmitted specifically for the receiving host&#39;s MTU. The receiving host does not require the buffering and CPU utilization necessary for IP reassembly. Also, the receiving host has a lower latency when receiving IP datagram that contain resegmented TCP segments than it would if it needed to reassemble an IP datagram from fragments before it could process the TCP segment. Further, the sending host transmits TCP segments at its local MTU, without regard to the receiving station&#39;s MTU. In the event that an IP datagram containing a resegmented TCP segment is lost, the sending host only has to retransmit the actual TCP data that was lost, and not the complete TCP segment. 
     FIG. 1 is a block schematic diagram showing a system that provides a host protocol stack. As shown in FIG. 1, a system  10  includes one or more applications  12 , an operating system  13 , a TCP protocol entity  14 , a UDP (User Datagram Protocol) protocol entity  15 , an IP protocol entity  16 , and one or more network device drivers  17 ,  18 ,  19 . The invention is readily applied to any system, such as that shown in FIG.  1 . The host may be either a receiving host or a transmitting host. A unique aspect of the invention is that the MTU size of the host is irrelevant for both transmitting and receiving purposes. Therefore, a heterogeneous enterprise having many disparate systems and networks may be provided without degrading system performance or encumbering a host with special adaptations to allow enterprise wide communication. 
     FIG. 2 is a block schematic diagram showing a resegmenting entity, in the form of a router  21 , according to the invention. The resegmenting entity also includes a forwarding engine  20 , a TCP resegmenter  22 , an IP protocol entity  16 , and one or more network interfaces  27 ,  28 ,  29 . The resegmenting entity is shown herein within a router for purposes of example only. Such entity may be included in any network elements, e.g. a router, bridge, switch, or a sending host&#39;s driver or network interface. 
     FIG. 3 is a block schematic diagram showing host communications according to the invention. In FIG. 3, a first system  30  resides on a small MTU network  34  and a second system  32  resides on a large MTU network  35 . Systems located on the two networks are able to exchange information via a router  21  which comprises the resegmenting entity of FIG.  2 . 
     FIG. 4 is a schematic representation of an TCP/IP packet  44  which includes an IP header  45 , a TCP header  46 , and TCP data  47 . Instead of relying only on IP fragmentation, or the avoidance of IP fragmentation as in the prior art, the invention provides a system that uses a combination of IP fragmentation and TCP resegmentation. This allows IP and TCP protocol entities to take advantage of the increase in efficiency that results from using larger MTUs, without requiring that all connected networks and hosts support large MTUs. 
     Thus, the invention provides a mechanism referred to as TCP resegmentation, (which takes a single TCP segment and breaks it into multiple TCP segments) called subsegments. This resegmentation occurs at an intermediate hop by a network element (router, bridge, switch) or in the sending host&#39;s driver or network interface. 
     FIG. 5 is a schematic representation of a resegmented packet according to the invention. Thus, the original segment  47  in the original IP datagram  44  (shown in FIG. 4) is broken up in multiple subsegments  52 ,  53 ,  54 , each of which is contained in a complete IP datagram  61 ,  63 ,  65 , each including an IP header  45   a ,  45   b ,  45   c  and a resegmented TCP header  51   a ,  51   b ,  51   c . The resegmentation is actually performed in accordance with the TCP resegmentation. 
     FIG. 6 is a block schematic diagram showing resegmentation in an electronic network according to the invention. In the preferred embodiment of the invention, TCP resegmentation operates as follows: 
     When an IP routing, bridging, switching entity  21  has network interfaces  27 ,  28 ,  29  with differing MTUs and a large IP datagram  44  from a transmitting station  62  must be forwarded out an interface  27  having a smaller MTU, where the IP datagram contains a complete TCP segment, the packet is resegmented into multiple, smaller TCP subsegments  61 ,  63 ,  65  in accordance with the TCP resegmenting algorithm. This allows the receiving station  60  to process each of the TCP subsegments independently, without consuming additional buffer or CPU resources on the receiving station for IP reassembly. 
     If a TCP subsegment is lost, the sending host  62  needs to only retransmit the TCP data that was lost, not the complete TCP segment, because all bytes in a TCP stream are numbered and acknowledged individually. 
     TCP resegmentation ignores and may change the setting of the IP DON&#39;T FRAGMENT bit. Accordingly, MTU discovery algorithms may fail by reporting that the largest MTU that works is the MTU of the local interface, and not necessarily the smallest MTU that can be used by every link in the path. 
     TCP resegmentation requires that the resegmenting entity perform IP fragmentation on packets which contain transport protocols other than TCP and on TCP packets that do not meet the criteria for resegmentation. 
     TCP resegmentation is a processor intensive operation because it requires the generation of a new TCP checksum on each new segment. Because of this, it is preferred, but not required that TCP resegmentation be performed with hardware assistance whenever possible. 
     The originator of the segmented packet may receive partial ACKs of the segment as it is received in pieces. Although this is permissible in the TCP protocol definition, some TCP protocol implementations may not deal with this correctly. 
     The following is a pseudocode example of an algorithm that resegments TCP segments that have not been fragmented and that do not contain any IP or TCP options. It does not decrement the IP TTL field and it ignores the IP DON&#39;T FRAGMENT bit. It also turns off the IP DON&#39;T FRAGMENT bit for any packets on which it is unable to perform TCP resegmentation, and it turns on the IP DON&#39;T FRAGMENT bit for all resegmented packets. 
     ALGORITHM 
     IF the received packet is IP AND 
     the IP length exceeds the MTU AND 
     no IP options are present AND 
     the IP datagram has not already been fragmented AND 
     the protocol is TCP AND 
     no TCP options are present THEN 
     set the remaining data length to the original data length 
     set the current data pointer to the original data pointer 
     set the new urgent pointer to the original urgent pointer 
     set the current sequence number to the original sequence number 
     WHILE the remaining data length is non-zero DO 
     allocate a new transmit buffer for the new segment 
     set the new segment length to the minimum of the length of the remaining data and the egress MSS 
     copy the original IP and TCP headers to the new transmit buffer 
     IF the TCP SYN bit is set AND 
     this is not the first subsegment THEN 
     turn off the TCP SYN bit 
     IF the TCP FIN bit is set AND 
     this is not the last subsegment THEN 
     turn off the TCP FIN bit 
     IF the TCP PUSH bit is set AND 
     this is not the last subsegment THEN 
     turn off the TCP PUSH bit 
     IF the TCP URG bit is set AND 
     the new urgent pointer is non-zero THEN 
     set the urgent pointer to the new urgent pointer 
     IF the new urgent pointer points to within the subsegment THEN 
     set the new urgent pointer to zero 
     ELSE 
     decrement the new urgent pointer by the subsegment length 
     ELSE 
     turn off the TCP URG bit 
     set the urgent pointer to zero 
     set the TCP sequence number to the current sequence number 
     increment the current sequence number by the subsegment length 
     set the IP datagram length to the new IP datagram length 
     turn on the IP DONT FRAGMENT bit 
     decrement the remaining data length by the subsegment length 
     copy the data from the current data pointer to the data portion of the new transmit buffer for the length of the subsegment 
     increment the current data pointer by the subsegment length 
     recalculate the TCP checksum 
     recalculate the IP checksum 
     send the new segment 
     ENDWHILE 
     free the original data buffer 
     ELSE 
     turn off the IP DONT FRAGMENT bit 
     Although the invention is described herein with reference to the preferred embodiment, one skilled in the art will readily appreciate that other applications may be substituted for those set forth herein without departing from the spirit and scope of the present invention. Accordingly, the invention should only be limited by the claims included below.