TCP maximum transmission unit dynamic adjustment method and system based on programmable data plane
By identifying and adjusting the maximum transmission unit of TCP on the programmable data plane, the problem of virtual machine migration and tenant isolation in a traditional network in a large-scale virtualization environment is solved, and dynamic adjustment of data packets and maximum link efficiency is achieved. , supports seamless migration and tenant isolation of large-scale virtualized environments.
Patent Information
- Application Number
- CN202411494782.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-24
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2044-10-24
AI Technical Summary
Traditional Layer 2 networks are difficult to support large-scale virtualization environments when spanning multiple networks, resulting in the invariance of IP addresses and MAC addresses during virtual machine migration. The 12-bit field length of VLAN limits network expansion capabilities and cannot effectively implement large sizes. Interconnection and tenant isolation of virtual machines in large-scale data centers.
Through programmable data plane identification of the data packet encapsulation structure, dynamically adjust the maximum transmission unit (MTU) size of TCP, and use MSS options and checksum calculation modules to adapt to different tunnel encapsulation structures to ensure that the data packet does not exceed the port MTU and avoid sharding , and transparently adjust the TCP checksum to achieve seamless migration and isolation of data packets.
Dynamic adjustment of different tunnel packaging structures is achieved, link efficiency is maximized, scalable, and flexible, it can transparently adapt to different network states, avoid packet loss between intermediate devices, and support seamless migration of large-scale virtualization environments and Tenant isolation.
Smart Images

Figure CN119211153A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a method and system for dynamically adjusting a TCP maximum transmission unit based on a programmable data plane, and belongs to the technical field of computer networks. Background Art
[0002] With the application and development of cloud computing technology, the use of its resources needs to be dynamically expanded and reduced according to changes in user needs. The migration of virtual machines between different physical servers has become the norm. In order to shorten the opening time and reduce the impact on existing services, this migration needs to achieve the invariance of IP addresses and MAC addresses to ensure seamless migration. This requires cloud computing providers to be able to achieve seamless migration of virtual machines within the data center or even between multiple data centers. The limitations of traditional Layer 2 networks when spanning multiple networks make it difficult to support large-scale virtualization environments. In addition, based on the 12-bit field length of VLAN, it can only support a maximum of 4096 tenants. This limitation seriously restricts the expansion capacity of the network. How to achieve the interconnection and interoperability of virtual machines in large-scale data centers and tenant isolation has become an urgent problem to be solved in network virtualization.
[0003] In this context, tunnel technologies such as Virtual eXtensible Local-Area Network (VXLAN) and Genetic Routing Encapsulation (GRE) have emerged. Through the above tunnels, the devices of the same tenants can be interconnected across the three-layer network, and the isolation between different tenants can be achieved. With protocols such as EVPN (Ethernet Virtual Private Network), the tunnels between the devices of the same tenants can be automatically opened and maintained. Tunnel technologies such as VXLAN encapsulate the second-layer frame in the third-layer message, so that the network has the ability to span multiple physical networks. This encapsulation technology enables data centers to create large-scale virtual networks, breaking the limit on the number of VLANs and greatly improving the scalability of the network. At the same time, tunnel technology provides better network isolation and security. Through the three-layer tunnel, the traffic of each tenant can be transmitted through different tunnels, thereby avoiding traffic interference between different tenants and improving the security of the network. In addition, these tunnel technologies can also protect the security of data transmission through network layer encryption technology, and can give full play to the efficiency and scalability of three-layer routing.
[0004] Although tunnel technologies such as VXLAN and GRE solve many problems of traditional networks, they also bring new challenges. For example, tunnel encapsulation introduces additional header overhead, which may cause the data packet to exceed the maximum transmission unit (MTU), thus requiring fragmentation. To solve this problem, the MTU in the network must be properly configured and optimized using the TCP maximum segment size (MSS) option. Summary of the invention
[0005] In view of the deficiencies in the prior art, the present invention provides a method and system for dynamically adjusting the TCP maximum transmission unit based on a programmable data plane. By identifying the data packet encapsulation structure to determine whether the length exceeds the port MTU size, the TCPSYN message maximum transmission unit option is dynamically corrected to notify the opposite device to adjust the data packet size, dynamically adapt to different tunnel encapsulation structures, and maximize link efficiency.
[0006] Specifically, the present invention includes a parsing and inspection module, an MSS update module, a residual calculation module, and a routing module. It uses a programmable data plane to identify and analyze TCPSYN messages, reads the maximum transmission unit field in the TCP option, determines and modifies the value of the MSS according to the current data packet tunnel encapsulation structure, uses the residual to calculate the TCP checksum, and then determines the sending port of the data packet according to the routing information. It can adapt to the size of the MTU and reduce the packet loss of the intermediate device caused by the excessive message length due to the addition of the tunnel header.
[0007] The technical solution of the present invention is as follows:
[0008] A TCP maximum transmission unit dynamic adjustment system based on a programmable data plane, comprising a parsing and verification module, an MSS update module, a residual calculation module, and a routing module;
[0009] The parsing and checking module is used to parse the packet header of the data packet and calculate the TCP checksum residual for the data packet from which the MSS option is parsed; the packet header parsing is to extract the packet information according to the predefined packet header and parsing rules, and fill it into the predefined packet header; the calculation of the checksum residual is to incrementally update the checksum field of the TCP message using the RFC 1624 algorithm, specifically, to set the Value of the TCP message checksum MSS to 0 and perform an incremental update, and record the new TCP checksum to the metadata current TCP checksum residual;
[0010] The MSS update module is used to update the Value value in the TCPMSS option. The residual calculation module is used to calculate a new TCP checksum according to the Value value of the new MSS and update it to the TCP checksum field. The routing module is used to route and forward the message according to the table entry.
[0011] A method for dynamically adjusting a TCP maximum transmission unit based on a programmable data plane comprises the following steps:
[0012] (1) The data packet enters the parsing and verification module, which selects the data packet that meets the IPv6 TCPSYN requirement, calculates the TCP option length based on the TCP header length, parses the TCP option, and calculates the TCP checksum residual when the MSS option is parsed. The TCP checksum residual is not calculated for the data packet that does not parse the MSS option.
[0013] (2) The data packet enters the MSS update module, which filters out the data packets that have been parsed and encapsulated into the tunnel. The MSS value is updated according to the tunnel length and MTU size, and the metadata TCP checksum update flag is set.
[0014] (3) The data packet enters the residual calculation module and determines whether the metadata TCP checksum update flag is set. If so, a new TCP checksum is calculated using the current TCP checksum residual and the current MSS value, and the TCP checksum is updated. If not, exit the residual calculation module.
[0015] (4) The data packet enters the routing module for routing forwarding.
[0016] Preferably, according to the present invention, in step (1), screening out packets satisfying the requirement of being IPv6 TCPSYN packets refers to extracting the Ethernet frame type, determining whether it is the IPv6 Ethernet frame type ETH_TYPE_IP6, and if so, determining the next header type in the IPv6 header, and if not, entering the routing module for forwarding; further, determining the next header type in the IPv6 header refers to determining whether the Next_Header field in the IPv6 header is a TCP message type TCP_TYPE, and if so, determining whether the TCP flag SYN is set, and if not, entering the routing module for forwarding; further, determining whether the TCP flag is set refers to extracting the Flags field in the TCP header, determining whether the SYN flag is set to 1, and if so, using count to calculate the TCP option length, and if not, entering the routing module for forwarding; further, using count to calculate the TCP option length refers to extracting the TCP header length field, and using the metadata count to store it, and the TCP option length = 4*TCP header length field value - 20 bytes. The value stored in the header length field is multiplied by 4 to obtain the entire TCP header length (in bytes, including TCP options). To obtain the TCP option field length, the fixed length of the TCP header, 20 bytes, needs to be subtracted.
[0017] Preferably, in step (1), parsing the TCP option refers to cyclically parsing the TCP option until the metadata count is 0; wherein the parsing step is to use different types of headers to read after reading the option type one byte after the current pointer, and modify the value of the metadata count according to the option length. Specifically, if the option type is 0, the EOL header is used for reading, and the value of the metadata count is reduced by 1; if the option type is 1, the NOP header is used for reading, and the value of the metadata count is reduced by 1; if the option type is 2, the MSS header is used for reading, the checksum residual minus the MSS value is calculated, and the value of the metadata count is reduced by 4; if the option type is 3, then use the WSOPT header to read, and reduce the value of the metadata count by 3; if the option type is 4, use the SACK_P header to read, and reduce the value of the metadata count by 2; if the option type is 5, use the SACK header to read, and reduce the value of the metadata count by the length of the SACK header; if the option type is 8, use the TSOPT header to read, and reduce the value of the metadata count by 10; if the option type is other, use the variable length header to read, and reduce the value of the metadata count by the pointer shifted back two bytes, where the pointer represents the current data packet parsing position; further, if the MSS option is parsed, it is necessary to calculate the checksum residual and exit the parsing check module. The calculation of the checksum residual is to use the RFC 1624 algorithm to incrementally update some fields of the checksum field of the TCP message, specifically, to set the Value value of the TCP message checksum MSS to 0 and perform incremental updates, and record the new TCP checksum to the metadata current TCP checksum residual.
[0018] Further preferably, the algorithm of RFC1624 is a commonly used checksum update algorithm in current Internet devices, and is often used in devices such as NAT. The specific description is:
[0019] It is divided into three steps: Ⅰ. Get the original field value and the new field value: determine the field that has been modified in the data packet, such as the MSS field in the TCP header in this application; Ⅱ. Negate operation: Negate the original checksum, the old value and the new value; Ⅲ. Update the checksum: calculate the new checksum according to the formula, and update the result to the TCP header;
[0020] The formula is:
[0021] HC - old checksum in the packet
[0022] HC' - new checksum in the data packet
[0023] m--The value of a field (16-bit word) in the data packet before modification
[0024] m'--The modified value of a field (16-bit word) in the data packet
[0025] The relationship between the checksum HC' after modifying a certain field and HC,m and m' is: HC'=HC-~m-m',
[0026] Among them, ~ represents the bitwise inversion operation.
[0027] Preferably, according to the present invention, in step (2), filtering out the parsed MSS option refers to selecting data packets whose MSS header is in a valid state, and filtering data packets encapsulated into the tunnel refers to selecting data packets whose tunnel flag is in the metadata. Specifically, metadata refers to sideband data customized during the processing of the data packet.
[0028] Preferably, according to the present invention, in step (2), updating the MSS value according to the length of the tunnel and the size of the MTU refers to obtaining the maximum transmission unit MTU of the interface, determining the specific encapsulation type according to the metadata tunnel flag, and calculating the specific MSS value. Specifically, if the metadata tunnel flag is a VXLAN tunnel, the MSS is updated to: MTU-VXLAN_MAX; if the metadata tunnel flag is a GRE tunnel, the MSS is updated to: MTU-GRE_MAX; wherein the above VXLAN_MAX represents the maximum overhead byte length increased by the VXLAN tunnel, and GRE_MAX represents the maximum overhead byte length increased by the GRE tunnel.
[0029] Preferably, according to the present invention, in step (2), setting the metadata TCP checksum update flag bit refers to setting the TCP checksum update flag bit in the metadata, and the default value is not set.
[0030] Preferably, according to the present invention, in step (3), calculating a new TCP checksum using the current TCP checksum residual and the current MSS value means incrementally updating the MSS Value and the current TCP checksum residual using the RFC 1624 algorithm and calculating a new TCP checksum.
[0031] The beneficial effects of the present invention are:
[0032] 1. Dynamically adjust the TCP maximum transmission unit size according to different tunnel encapsulation structures, and use the programmable data plane to expand to other types of tunnels;
[0033] 2. It is transparent to terminal devices and intermediate devices, and does not require modification of existing infrastructure;
[0034] 3. Modify the data packet granularity to achieve line-speed forwarding compared to software implementation;
[0035] 4. Good scalability, high flexibility, and the ability to adjust the MSS size for traffic in different network states. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 This is a schematic diagram of the interaction of the data plane modules of the present invention;
[0037] Figure 2 It is a schematic diagram of the analysis and verification module flow of the present invention;
[0038] Figure 3 It is a schematic diagram of the TCP option parsing process of the present invention;
[0039] Figure 4 It is a schematic diagram of the MSS update module flow of the present invention;
[0040] Figure 5 It is a schematic diagram of the residual calculation process of the present invention. DETAILED DESCRIPTION
[0041] The present invention will be further described below by way of embodiments in conjunction with the accompanying drawings, but is not limited thereto.
[0042] Embodiment 1:
[0043] This embodiment provides a TCP maximum transmission unit dynamic adjustment system based on a programmable data plane. The data plane module interaction diagram is shown in FIG. Figure 1 As shown, it includes parsing and verification module, MSS updating module, residual calculation module and routing module.
[0044] The parsing and verification module is used to parse the packet header of the data packet and calculate the TCP checksum residual for the data packet with the MSS option parsed out; the packet header parsing is to extract the data packet information according to the predefined packet header and parsing rules, and fill it into the predefined packet header; the calculation of the checksum residual is to use the RFC 1624 algorithm to incrementally update some fields of the checksum field of the TCP message, specifically, to set the Value of the TCP message checksum MSS to 0 and perform an incremental update, and record the new TCP checksum to the metadata current TCP checksum residual.
[0045] The MSS update module is used to update the Value value in the TCPMSS option. The residual calculation module is used to calculate a new TCP checksum according to the Value value of the new MSS and update it to the TCP checksum field. The routing module is used to route and forward the message according to the table entry.
[0046] Embodiment 2:
[0047] A method for dynamically adjusting the TCP maximum transmission unit based on a programmable data plane, such as Figure 2-5 As shown, the following steps are included:
[0048] (1) The data packet enters the parsing and verification module, which selects the data packet that meets the IPv6 TCPSYN requirement, calculates the TCP option length based on the TCP header length, parses the TCP option, and calculates the TCP checksum residual when the MSS option is parsed. The TCP checksum residual is not calculated for the data packet that does not parse the MSS option.
[0049] Filtering out packets that meet the requirement of being IPv6 TCPSYN packets refers to extracting the Ethernet frame type, determining whether it is the IPv6 Ethernet frame type ETH_TYPE_IP6, and if so, determining the next header type in the IPv6 header, and if not, entering the routing module for forwarding; further, determining the next header type in the IPv6 header refers to determining whether the Next_Header field in the IPv6 header is a TCP message type TCP_TYPE, and if so, determining whether the TCP flag SYN is set, and if not, entering the routing module for forwarding; further, determining whether the TCP flag is set refers to extracting the Flags field in the TCP header, determining whether the SYN flag is set to 1, and if it is set to 1, using count to calculate the TCP option length, and if not, entering the routing module for forwarding; further, using count to calculate the TCP option length refers to extracting the TCP header length field, and using metadata count to store, 4*TCP header length field-20.
[0050] Parsing the TCP option means parsing the TCP option in a loop until the metadata count is 0; wherein the parsing step is to use different types of headers to read after reading the option type one byte after the current pointer, and modify the value of the metadata count according to the option length. Specifically, if the option type is 0, the EOL header is used for reading, and the value of the metadata count is reduced by 1; if the option type is 1, the NOP header is used for reading, and the value of the metadata count is reduced by 1; if the option type is 2, the MSS header is used for reading, and the value of the metadata count is reduced by 4; if the option type is 3, the WSOPT header is used for reading. , and subtract 3 from the value of metadata count. If the option type is 4, read it using the SACK_P header and subtract 2 from the value of metadata count. If the option type is 5, read it using the SACK header and subtract the value of metadata count from the length of the SACK header. If the option type is 8, read it using the TSOPT header and subtract 10 from the value of metadata count. If the option type is other, read it using the variable-length header and subtract the value of metadata count from the pointer by two bytes, where the pointer represents the current data packet parsing position. Further, if the MSS option is parsed, it is necessary to calculate the checksum residual and exit the parsing check module. The calculation of the checksum residual is to incrementally update some fields of the checksum field of the TCP message using the RFC 1624 algorithm. Specifically, the Value value of the TCP message checksum MSS is set to 0 and incrementally updated, and the new TCP checksum is recorded to the metadata current TCP checksum residual.
[0051] The algorithm of RFC1624 is a commonly used checksum update algorithm in current Internet devices, and is often used in devices such as NAT. The specific description is as follows: It is divided into three steps: I. Get the original field value and the new field value: determine the field that has been modified in the data packet, such as the MSS field in the TCP header in this application; II. Negate operation: Negate the original checksum, the old value, and the new value; III. Update the checksum: Calculate the new checksum according to the formula, and update the result to the TCP header;
[0052] The formula is:
[0053] HC - old checksum in the packet
[0054] HC' - new checksum in the data packet
[0055] m--The value of a field (16-bit word) in the data packet before modification
[0056] m'--The modified value of a field (16-bit word) in the data packet
[0057] The relationship between the checksum HC' after modifying a certain field and HC,m and m' is: HC'=HC-~m-m', where ~ represents a bitwise inversion operation.
[0058] (2) The data packet enters the MSS update module, which filters out the data packet that parses the MSS option and encapsulates it into the tunnel. The MSS value is updated according to the tunnel length and MTU size, and the metadata TCP checksum update flag is set.
[0059] Filtering out the parsed MSS option refers to selecting data packets with a valid MSS header, and filtering data packets encapsulated into the tunnel refers to selecting data packets with a tunnel flag bit in the metadata. Specifically, metadata refers to the sideband data customized during the processing of the data packet.
[0060] Updating the MSS value according to the tunnel length and MTU size refers to obtaining the maximum transmission unit MTU of the interface, determining the specific encapsulation type according to the metadata tunnel flag, and calculating the specific MSS value. Specifically, if the metadata tunnel flag is a VXLAN tunnel, the MSS is updated to: MTU-VXLAN_MAX; if the metadata tunnel flag is a GRE tunnel, the MSS is updated to: MTU-GRE_MAX; wherein the above VXLAN_MAX represents the maximum overhead byte length added to the VXLAN tunnel, and GRE_MAX represents the maximum overhead byte length added to the GRE tunnel.
[0061] Setting the metadata TCP checksum update flag bit refers to setting the TCP checksum update flag bit in the metadata, and the default value is not set.
[0062] (3) The data packet enters the residual calculation module, determines whether the metadata TCP checksum update flag is set, calculates a new TCP checksum using the current TCP checksum residual and the current MSS value, and updates the TCP checksum.
[0063] Calculating a new TCP checksum using the current TCP checksum residual and the current MSS value means incrementally updating the MSS Value and the current TCP checksum residual using the RFC 1624 algorithm and calculating a new TCP checksum.
[0064] (4) The data packet enters the routing module for routing forwarding.
[0065] Compared with the existing solutions, this embodiment is implemented by using a programmable data plane, can dynamically adjust the TCP maximum transmission unit size according to different tunnel encapsulation structures, has high flexibility and can support expansion to other types of tunnels, is transparent to terminal devices and intermediate devices, does not require modification of existing infrastructure, can achieve line-speed forwarding compared to software implementation, has good scalability and high flexibility, and can adjust the MSS size for traffic in different network states.
[0066] Embodiment 3:
[0067] This embodiment provides a method for dynamically adjusting the TCP maximum transmission unit based on a programmable data plane. The steps are as described in Example 2, and the flowchart of the parsing and verification module is as follows: Figure 2 As shown, the TCP option parsing process diagram is as follows Figure 3 As shown, the MSS update module flow chart is as follows Figure 4 As shown, the residual calculation process diagram is as follows Figure 5 shown.
[0068] The method comprises the following steps:
[0069] An IPv6 TCP SYN packet is received, which carries the TCPMSS attribute with a value of 1440 and enters the parsing and verification module.
[0070] The parsing and verification module determines that the Ethernet frame type is ETH_TYPE_IP6, the next header is TCP_TYPE, and the TCPflags SYN flag is in position. The metadata count is used to calculate and store (4*TCP header length field-20), and it is determined that count is greater than 0, and TCP option parsing is entered.
[0071] After reading the option type byte after the current pointer, it is 2. Use the MSS header to read the MSS option, change count to count-4, and calculate the TCP checksum residual minus the MSS value (1440) and the current TCP checksum, and exit the parsing and verification module.
[0072] The data packet enters the MSS update module, and if it is determined that the data packet has been parsed into the MSS header and needs to be encapsulated into the VXLAN tunnel, the MSS Value is modified to (MTU-VXLAN_MAX), and the metadata is updated to the TCP checksum flag position, and the MSS update module is exited.
[0073] The data packet enters the residual calculation module, determines that the TCP checksum of the data packet needs to be updated, uses the TCP checksum residual and the current MSS Value (MTU-VXLAN_MAX) to calculate the new TCP checksum and updates it in the TCP header checksum field, and then exits the residual calculation module.
[0074] Enter the routing module for forwarding.
[0075] Embodiment 4:
[0076] This embodiment provides a method for dynamically adjusting the TCP maximum transmission unit based on a programmable data plane. The steps are as described in Example 2, and the flowchart of the parsing and verification module is as follows: Figure 2 As shown, the TCP option parsing process diagram is as follows Figure 3 As shown, the MSS update module flow chart is as follows Figure 4 As shown, the residual calculation process diagram is as follows Figure 5 shown.
[0077] The method comprises the following steps:
[0078] An IPv6 TCP SYN packet is received, which carries the TCPMSS attribute with a value of 1440 and enters the parsing and verification module.
[0079] The parsing and verification module determines that the Ethernet frame type is ETH_TYPE_IP6, the next header is TCP_TYPE, and the TCPflags SYN flag is in position. The metadata count is used to calculate and store (4*TCP header length field-20), and it is determined that count is greater than 0, and TCP option parsing is entered.
[0080] After reading the option type byte after the current pointer, it is 2. Use the MSS header to read the MSS option, change count to count-4, and calculate the TCP checksum residual minus the MSS value (1440) and the current TCP checksum, and exit the parsing and verification module.
[0081] The data packet enters the MSS update module, determines that the data packet has been parsed into the MSS header, and needs to be encapsulated into the GRE tunnel, then modifies the MSS Value to (MTU-GRE_MAX), updates the metadata TCP checksum flag, and exits the MSS update module.
[0082] The data packet enters the residual calculation module, determines that the data packet needs to update the TCP checksum, uses the TCP checksum residual and the current MSS Value (MTU-GRE_MAX) to calculate the new TCP checksum and update it in the TCP header checksum field, and exits the residual calculation module.
[0083] Enter the routing module for forwarding.
[0084] Embodiment 5:
[0085] This embodiment provides a method for dynamically adjusting the TCP maximum transmission unit based on a programmable data plane. The steps are as described in Example 2, and the flowchart of the parsing and verification module is as follows: Figure 2 As shown, the TCP option parsing process diagram is as follows Figure 3 As shown, the MSS update module flow chart is as follows Figure 4 As shown, the residual calculation process diagram is as follows Figure 5 shown.
[0086] The method comprises the following steps:
[0087] After receiving an IPv6 TCP SYNECNCWR packet carrying the TCPMSS attribute with a value of 1440, the packet enters the parsing and verification module.
[0088] The parsing and verification module determines that the Ethernet frame type is ETH_TYPE_IP6, the next header is TCP_TYPE, and the TCPflags SYN flag is in position. The metadata count is used to calculate and store (4*TCP header length field-20), and it is determined that count is greater than 0, and TCP option parsing is entered.
[0089] After reading the option type byte after the current pointer, it is 2. Use the MSS header to read the MSS option, change count to count-4, and calculate the TCP checksum residual minus the MSS value (1440) and the current TCP checksum, and exit the parsing and verification module.
[0090] The data packet enters the MSS update module, determines that the data packet has been parsed into the MSS header, and needs to be encapsulated into the GRE tunnel, then modifies the MSS Value to (MTU-GRE_MAX), updates the metadata TCP checksum flag, and exits the MSS update module.
[0091] The data packet enters the residual calculation module, determines that the data packet needs to update the TCP checksum, uses the TCP checksum residual and the current MSS Value (MTU-GRE_MAX) to calculate the new TCP checksum and update it in the TCP header checksum field, and exits the residual calculation module.
[0092] Enter the routing module for forwarding.
[0093] Embodiment 6:
[0094] This embodiment provides a method for dynamically adjusting the TCP maximum transmission unit based on a programmable data plane. The steps are as described in Example 2, and the flowchart of the parsing and verification module is as follows: Figure 2 As shown, the TCP option parsing process diagram is as follows Figure 3 As shown, the MSS update module flow chart is as follows Figure 4 As shown, the residual calculation process diagram is as follows Figure 5 shown.
[0095] The method comprises the following steps:
[0096] After receiving the IPv6 TCP ACK message, the parsing and verification module is entered.
[0097] The parsing and verification module determines that the Ethernet frame type is ETH_TYPE_IP6, the next header is TCP_TYPE, and the TCPflags SYN flag is not set, and then exits the parsing and verification module.
[0098] Enter the routing module for forwarding.
Claims
1. A TCP maximum transmission unit dynamic adjustment system based on a programmable data plane, characterized in that: It includes parsing and verification module, MSS update module, residual calculation module and routing module; The parsing and checking module is used to parse the packet header of the data packet and calculate the TCP checksum residual for the data packet from which the MSS option is parsed; the packet header parsing is to extract the data packet information according to the predefined packet header and parsing rules, and fill it into the predefined packet header; the calculation of the checksum residual is to incrementally update the checksum field of the TCP message using the RFC 1624 algorithm, set the Value of the TCP message checksum MSS to 0 and perform incremental updates, and record the new TCP checksum to the metadata current TCP checksum residual; The MSS update module is used to update the Value value in the TCPMSS option. The residual calculation module is used to calculate a new TCP checksum according to the Value value of the new MSS and update it to the TCP checksum field. The routing module is used to route and forward the message according to the table entry.
2. A method for dynamically adjusting TCP maximum transmission unit based on a programmable data plane, characterized in that: The following steps are involved: (1) The data packet enters the parsing and verification module, which selects the data packet that meets the IPv6 TCPSYN requirement, calculates the TCP option length based on the TCP header length, parses the TCP option, and calculates the TCP checksum residual when the MSS option is parsed. The TCP checksum residual is not calculated for the data packet that does not parse the MSS option. (2) The data packet enters the MSS update module, which filters out the data packets that have been parsed and encapsulated into the tunnel. The MSS value is updated according to the tunnel length and MTU size, and the metadata TCP checksum update flag is set. (3) The data packet enters the residual calculation module and determines whether the metadata TCP checksum update flag is set. If so, a new TCP checksum is calculated using the current TCP checksum residual and the current MSS value, and the TCP checksum is updated. If not, exit the residual calculation module. (4) The data packet enters the routing module for routing forwarding.
3. The method for dynamically adjusting the TCP maximum transmission unit based on a programmable data plane according to claim 2, characterized in that: In step (1), filtering out the data packet that satisfies the IPv6 TCPSYN data packet refers to extracting the Ethernet frame type, determining whether it is the IPv6 Ethernet frame type ETH_TYPE_IP6, and if so, determining the next header type in the IPv6 header, and if not, entering the routing module for forwarding; determining the next header type in the IPv6 header refers to determining whether the Next_Header field in the IPv6 header is a TCP message type TCP_TYPE, and if so, determining whether the TCP flag SYN is set, and if not, entering the routing module for forwarding; determining whether the TCP flag is set refers to extracting the Flags field in the TCP header, determining whether the SYN flag is set to 1, and if it is set to 1, using count to calculate the TCP option length, and if not, entering the routing module for forwarding; using count to calculate the TCP option length refers to extracting the TCP header length field, and using the metadata count to store it, and the TCP option length = 4*TCP header length field value-20 bytes.
4. The method for dynamically adjusting the TCP maximum transmission unit based on a programmable data plane according to claim 2, characterized in that: In step (1), parsing the TCP option means parsing the TCP option in a loop until the metadata count reaches 0; The parsing step is to use different types of headers to read after reading the option type one byte after the current pointer, and modify the value of metadata count according to the option length. If the option type is 0, the EOL header is used for reading, and the value of metadata count is reduced by 1; if the option type is 1, the NOP header is used for reading, and the value of metadata count is reduced by 1; if the option type is 2, the MSS header is used for reading, the checksum residual minus the MSS value is calculated, and the value of metadata count is reduced by 4; if the option type is 3, the WSOPT header is used for reading, and the value of metadata count is reduced by 3; if the option type is 4, the WSOPT header is used for reading, and the value of metadata count is reduced by 3; If the option type is 4, the SACK_P header is used for reading, and the value of the metadata count is reduced by 2; if the option type is 5, the SACK header is used for reading, and the metadata count is reduced by the length of the SACK header; if the option type is 8, the TSOPT header is used for reading, and the metadata count is reduced by 10; if the option type is other, the variable-length header is used for reading, and the metadata count is reduced by the pointer and moved back by two bytes, where the pointer represents the current data packet parsing position; if the MSS option is parsed, the checksum residual needs to be calculated and the parsing check module is exited; the calculation of the checksum residual is to use the RFC 1624 algorithm to incrementally update some fields of the checksum field of the TCP message, specifically, the Value value of the TCP message checksum MSS is set to 0 and incrementally updated, and the new TCP checksum is recorded to the metadata current TCP checksum residual.
5. The method for dynamically adjusting the TCP maximum transmission unit based on a programmable data plane according to claim 2, characterized in that: In step (2), filtering out the MSS option for parsing refers to selecting data packets with a valid MSS header, and filtering data packets encapsulated into the tunnel refers to selecting data packets with a tunnel flag position in the metadata. Specifically, metadata refers to sideband data customized during the processing of the data packet.
6. The method for dynamically adjusting the TCP maximum transmission unit based on a programmable data plane according to claim 2, characterized in that: In step (2), updating the MSS value according to the length of the tunnel and the size of the MTU refers to obtaining the maximum transmission unit MTU of the interface, determining the specific encapsulation type according to the metadata tunnel flag, and calculating the specific MSS value. Specifically, if the metadata tunnel flag is a VXLAN tunnel, the MSS is updated to: MTU-VXLAN_MAX; if the metadata tunnel flag is a GRE tunnel, the MSS is updated to: MTU-GRE_MAX; wherein the above VXLAN_MAX represents the maximum overhead byte length increased by the VXLAN tunnel, and GRE_MAX represents the maximum overhead byte length increased by the GRE tunnel.
7. The method for dynamically adjusting TCP maximum transmission unit based on programmable data plane according to claim 2, characterized in that: In step (2), setting the metadata TCP checksum update flag means setting the TCP checksum update flag in the metadata, and its default value is not set.
8. The method for dynamically adjusting TCP maximum transmission unit based on programmable data plane according to claim 2, characterized in that: In step (3), calculating a new TCP checksum using the current TCP checksum residual and the current MSS value means incrementally updating the MSS Value and the current TCP checksum residual using the RFC1624 algorithm and calculating a new TCP checksum.
Citation Information
Patent Citations
Method and device for incrementally calculating network message check sum
CN102404210A
Message processing method and device, storage medium and electronic device
CN116418752A
Method and device for adaptively modifying maximum segment size, equipment and storage medium
CN116418854A
Message data processing method and device, electronic equipment and storage medium
CN117896451A
Method for reducing data IP fragmentation quantity in PS network
CN1863165A