A method and system for dynamically adjusting TCP maximum transmission unit based on programmable data plane

By identifying and adjusting the Maximum Transmission Unit (MTU) option of TCPSYN packets through a programmable data plane, the problem of MTU exceeding limits during virtual machine migration is solved, achieving efficient tunnel encapsulation optimization and network expansion.

CN119211153BActive Publication Date: 2025-10-24QUAN CHENG LABORATORY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411494782.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-24
Publication Date
2025-10-24
Estimated Expiration
2044-10-24

AI Technical Summary

Technical Problem

In large-scale data centers, the limitations of traditional Layer 2 networks make it difficult to achieve seamless migration of IP addresses and MAC addresses during virtual machine migration. The MTU exceeding problem introduced by tunneling technologies such as VXLAN needs to be optimized.

Method used

By identifying the packet encapsulation structure through a programmable data plane, dynamically adjusting the maximum transmission unit option of TCPSYN packets, and using a parsing and verification module, MSS update module, and residual calculation module to dynamically correct the TCP checksum, the data packets are ensured to conform to the MTU size, thus avoiding packet loss at intermediate devices.

Benefits of technology

It enables dynamic adjustment of the TCP maximum transmission unit under different tunnel encapsulation structures, improving link efficiency, is transparent to terminal devices, does not require modification of existing infrastructure, and has line-speed forwarding capability and high scalability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119211153B_ABST
    Figure CN119211153B_ABST
Patent Text Reader

Abstract

The application relates to a TCP maximum transmission unit dynamic adjustment method and system based on a programmable data plane, and belongs to the technical field of computer networks. Whether the length exceeds the port MTU size is judged by identifying the data packet encapsulation structure, the TCP SYN message maximum transmission unit option is dynamically corrected to inform the opposite end device to adjust the data packet size, different tunnel encapsulation structures are dynamically adapted, and the link efficiency is maximized; according to different tunnel encapsulation structures, the TCP maximum transmission unit size is dynamically adjusted, higher flexibility can be supported to be extended to other types of tunnels, the terminal device and the intermediate device are transparent, the existing infrastructure does not need to be modified, compared with software implementation, linear speed forwarding can be realized, the method has the characteristics of good expansibility and high flexibility, and the MSS size can be adjusted according to the traffic of different network states.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application relates to a TCP maximum transmission unit dynamic adjustment method and system based on a programmable data plane and belongs to the technical field of computer networks. BACKGROUND

[0002] With the application and development of cloud computing technology, the use of resources needs to be dynamically expanded and reduced according to the change of user demand, and the migration of virtual machines between different physical servers becomes the norm. In order to shorten the opening time and reduce the influence on the existing business, the migration needs to realize the invariability of IP addresses and MAC addresses to ensure seamless migration. This requires cloud computing providers to realize the seamless migration of virtual machines within a data center or even between multiple data centers. However, the limitation of traditional Layer 2 networks when crossing multiple networks makes it difficult to support large-scale virtualization environments. In addition, based on the 12-bit field length of VLAN, only 4096 tenants can be supported at most, which seriously restricts the expansion ability of the network. How to realize the interconnection and intercommunication of virtual machines in large-scale data centers and tenant isolation has become a problem to be solved in network virtualization.

[0003] Under this background, tunnel technologies such as virtual local area network extension (VXLAN, Virtual eXtensible Local-Area Network) and general routing encapsulation (GRE, Genetic Routing Encapsulation) emerged as the times require. Through the above tunnels, the interconnection and intercommunication of devices between the same tenants across Layer 3 networks can be realized, and the isolation between different tenants can be realized. Cooperating with protocols such as Ethernet Virtual Private Network (EVPN), the automatic opening and maintenance of tunnels between devices of the same tenant can be realized. Tunnel technologies such as VXLAN enable the network to have the ability to cross multiple physical networks by encapsulating Layer 2 frames in Layer 3 packets. This encapsulation technology enables data centers to create large-scale virtual networks, breaking through the limit of the number of VLANs and greatly improving the scalability of the network. At the same time, tunnel technologies provide better network isolation and security. Through Layer 3 tunnels, the traffic of each tenant can be transmitted through different tunnels, thereby avoiding the interference of traffic 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, while fully utilizing the efficiency and scalability of Layer 3 routing.

[0004] Although tunnel technologies such as VXLAN, GRE and the like solve many problems of traditional networks, they also bring new challenges. For example, tunnel encapsulation introduces additional header overhead, which can cause the data packet to exceed the maximum transmission unit (MTU), thereby requiring fragmentation. In order to solve this problem, the MTU in the network must be reasonably configured, and the TCP maximum segment size (MSS) option is optimized. SUMMARY

[0005] In view of the deficiencies of the prior art, the present application provides a TCP maximum transmission unit dynamic adjustment method and system based on a programmable data plane, which judges whether the length exceeds the port MTU size by identifying the data packet encapsulation structure, dynamically corrects the TCP SYN message maximum transmission unit option to inform the peer device to adjust the data packet size, dynamically adapts to different tunnel encapsulation structures, and maximizes the link efficiency.

[0006] Specifically, the present application includes a parsing verification module, an MSS update module, a residual calculation module, and a routing module, which identifies and analyzes the TCP SYN message using a programmable data plane, reads the maximum transmission unit field in the TCP option, determines the value of the MSS and modifies it according to the current data packet tunnel encapsulation structure, and uses the residual to calculate the TCP checksum, and then determines the sending port according to the routing information, which can adapt to the size reduction of the MTU caused by adding the tunnel header to cause the intermediate device to drop packets.

[0007] The technical scheme of the present application is as follows:

[0008] A TCP maximum transmission unit dynamic adjustment system based on a programmable data plane, comprising a parsing verification module, an MSS update module, a residual calculation module, and a routing module;

[0009] The parsing verification module is used to parse the packet header of the data packet and calculate the TCP checksum residual of the data packet with the parsed MSS option; the packet header parsing is to extract the data packet information according to the pre-defined packet header and parsing rules, and fill it into the pre-defined packet header; the calculation of the checksum residual is to use the algorithm of RFC 1624 to incrementally update the partial fields of the checksum field of the TCP message, specifically, to set the value of the TCP message checksum and MSS to 0 and incrementally update it, and record the new TCP checksum to the current TCP checksum residual of the metadata;

[0010] The MSS updating module is used for updating the Value value in the TCP MSS option, the residual calculation module is used for calculating a new TCP checksum according to the Value value of the new MSS and updating the TCP checksum field, and the routing module is used for routing and forwarding the packet according to the table entry.

[0011] A TCP maximum transmission unit dynamic adjustment method based on a programmable data plane, comprising the following steps:

[0012] (1) The data packet enters the analysis and verification module, filters out the IPv6 TCP SYN data packet satisfying the data packet, calculates the TCP option length according to the TCP header length, analyzes the TCP option, and calculates the TCP checksum residual when the MSS option is analyzed. The data packet which is not analyzed to the MSS option does not calculate the TCP checksum residual;

[0013] (2) The data packet enters the MSS updating module, filters out the data packet which is analyzed to the MSS option and encapsulated into the tunnel, updates the MSS value according to the length of the tunnel and the size of the MTU, and sets the metadata TCP checksum update flag bit;

[0014] (3) The data packet enters the residual calculation module, judges whether the metadata TCP checksum update flag bit is set, if yes, calculates the new TCP checksum using the current TCP checksum residual and the current MSS value, and updates the TCP checksum; if not, exits the residual calculation module;

[0015] (4) The data packet enters the routing module for routing and forwarding.

[0016] According to the application, preferably, in step (1), the screening of the IPv6 TCP SYN data packet is to extract the Ethernet frame type, judge whether it is the IPv6 Ethernet frame type ETH TYPE IP6, if yes, judge the next header type in the IPv6 header, if not, enter the routing module for forwarding; further, the judgment of the next header type in the IPv6 header is to judge whether the Next Header field in the IPv6 header is the TCP message type TCP TYPE, if yes, judge whether the TCP flag bit SYN is set, if not, enter the routing module for forwarding; further, the judgment of whether the TCP flag bit is set is to extract the Flags field in the TCP header, judge whether the SYN flag bit is set to 1, if yes, use count to calculate the TCP option length, if not, enter the routing module for forwarding; further, the use of count to calculate the TCP option length is to extract the TCP header length field, and use the metadata count to store, the TCP option length = 4*TCP header length field value-20 bytes. The value stored in the header length field*4 obtains the entire TCP header length (in bytes, including TCP option), and the TCP option field length needs to be further subtracted by the TCP header fixed length 20 bytes.

[0017] According to the application, preferably, the parsing of the TCP option in step (1) means that the TCP option is parsed in a loop until the metadata count is 0; wherein the parsing step is to read the option type of the next byte after the current pointer is read, and the value of the metadata count is modified according to the option length, specifically, wherein 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 is calculated by subtracting the MSS value, 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 the value of the 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 value of 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 value of the metadata count is reduced by 10; if the option type is other, the variable-length header is used for reading, and the value of the metadata count is reduced by the value of the length of the two bytes after the pointer is moved; wherein the pointer represents the current packet parsing position; further, if the MSS option is parsed, the checksum residual needs to be calculated and the parsing and checking module is exited. The calculation of the checksum residual is to use the algorithm of RFC 1624 to perform incremental update on the partial fields of the checksum field of the TCP message, specifically, the value of the TCP message checksum MSS is set to 0 and incremental update is performed, and the new TCP checksum is recorded to the current TCP checksum residual of the metadata.

[0018] Further preferably, the algorithm of RFC 1624 is a commonly used checksum update algorithm in the current Internet equipment, which is commonly used in devices such as NAT, and the specific description is as follows:

[0019] It is divided into three steps: I, obtaining the original field value and the new field value: determining the field in the packet that has been modified, for example, the MSS field in the TCP header in the present application; II, the NOT operation: performing the NOT operation on the original checksum, the old value and the new value; III, updating the checksum: calculating the new checksum according to the formula, and updating the result to the TCP header;

[0020] The formula is:

[0021] ·HC--the old checksum in the packet

[0022] ·HC'--the new checksum in the packet

[0023] • m - value of a certain field (16-bit word) in the packet before modification

[0024] • m' - value of a certain field (16-bit word) in the packet after modification

[0025] • relationship between the checksum HC' after modification of a certain field and HC, m and m': HC' = HC - ~m - m',

[0026] where ~ denotes the bitwise NOT operation.

[0027] According to the application, preferably, in step (2), the parsing of the MSS option refers to selecting the data packet with the valid MSS header, and the selection of the data packet encapsulated into the tunnel refers to selecting the data packet with the tunnel flag in the metadata, and specifically, the metadata refers to the sideband data defined by the data packet in the processing process.

[0028] According to the application, preferably, in step (2), the updating of 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, judging the specific encapsulation type according to the metadata tunnel flag, and calculating the specific MSS value, and specifically, if the metadata tunnel flag is a VXLAN tunnel, the MSS is updated as: MTU-VXLAN_MAX; and if the metadata tunnel flag is a GRE tunnel, the MSS is updated as: MTU-GRE_MAX; wherein VXLAN_MAX represents the maximum overhead byte length added by the VXLAN tunnel, and GRE_MAX represents the maximum overhead byte length added by the GRE tunnel.

[0029] According to the application, preferably, in step (2), the setting of the metadata TCP checksum update flag refers to setting the TCP checksum update flag in the metadata, and the default value is not set.

[0030] According to the application, preferably, in step (3), the calculation of the new TCP checksum using the current TCP checksum residual and the current MSS value refers to using the algorithm of RFC 1624 to incrementally update the MSS value and the current TCP checksum residual, and calculating the new TCP checksum.

[0031] The application has the following beneficial effects:

[0032] 1. The maximum transmission unit size of TCP is dynamically adjusted according to different tunnel encapsulation structures, and the programmable data plane can be extended to other types of tunnels.

[0033] 2. The terminal device and the intermediate device are transparent, and the existing infrastructure does not need to be modified.

[0034] 3. The modification is performed at the packet granularity, and compared with the software implementation, the line speed forwarding can be realized.

[0035] 4. Good expansibility, high flexibility, capable of adjusting the MSS size for different network state traffic. BRIEF DESCRIPTION OF DRAWINGS

[0036] Figure 1 The data plane module interaction schematic diagram of the application;

[0037] Figure 2 The analysis and verification module flowchart of the application;

[0038] Figure 3 The TCP option analysis flowchart of the application;

[0039] Figure 4 The MSS update module flowchart of the application;

[0040] Figure 5 The residual calculation flowchart of the application. DETAILED DESCRIPTION

[0041] The application will be further described below by way of examples and in conjunction with the drawings, but is not limited thereto.

[0042] Example 1:

[0043] The embodiment provides a TCP maximum transmission unit dynamic adjustment system based on a programmable data plane, and a data plane module interaction schematic diagram is shown in FIG. 1. The system comprises an analysis and verification module, an MSS update module, a residual calculation module and a routing module. Figure 1

[0044] The analysis and verification module is used for performing packet header analysis on a data packet and calculating a TCP checksum residual of the data packet with the MSS option analyzed; the packet header analysis is to extract data packet information according to a pre-defined packet header and analysis rules and fill the information into the pre-defined packet header; and the calculation of the checksum residual is to use the algorithm of RFC 1624 to perform incremental updating on part of fields of the checksum field of the TCP message, specifically, to set the Value value of the TCP message checksum to 0 and perform incremental updating, and record the new TCP checksum to the current TCP checksum residual of the metadata.

[0045] The MSS update module is used for updating the Value value in the TCP MSS option, the residual calculation module is used for calculating a new TCP checksum according to the Value value of the new MSS and updating the TCP checksum field, and the routing module is used for routing and forwarding the message according to the table item.

[0046] Example 2:

[0047] ​A TCP maximum transmission unit dynamic adjustment method based on a programmable data plane, as shown in Figures 2-5 comprises the following steps:

[0048] (1) The data packet enters the analysis and verification module, filters out the IPv6 TCP SYN data packet, calculates the TCP option length according to the TCP header length, analyzes the TCP option, and calculates the TCP checksum residual when the MSS option is analyzed. The data packet without analyzing the MSS option does not calculate the TCP checksum residual.

[0049] Filtering out the IPv6 TCP SYN data packet means extracting the Ethernet frame type, judging whether it is an IPv6 Ethernet frame type ETH_TYPE_IP6, if it is, judging the next header type in the IPv6 header, if it is not, forwarding to the routing module; further, judging whether the next header type in the IPv6 header is a TCP message type TCP_TYPE means judging whether the Next_Header field in the IPv6 header is a TCP message type, if it is, judging whether the TCP flag bit SYN is set, if it is not, forwarding to the routing module; further, judging whether the TCP flag bit is set means extracting the Flags field in the TCP header, judging whether the SYN flag bit is set to 1, if it is set to 1, using count to calculate the TCP option length, if it is not set to 1, forwarding to the routing module; further, using count to calculate the TCP option length means extracting the TCP header length field and storing it using metadata count, 4*TCP header length field-20.

[0050] Parsing the TCP option refers to circularly parsing the TCP option until the metadata count is 0; wherein the parsing step is to read the option type of the next byte after the current pointer, and then read using different types of headers, and modify the value of the metadata count according to the option length, specifically, wherein if the option type is 0, read using the EOL header, and reduce the value of the metadata count by 1, if the option type is 1, read using the NOP header, and reduce the value of the metadata count by 1, if the option type is 2, read using the MSS header, and reduce the value of the metadata count by 4, if the option type is 3, read using the WSOPT header, and reduce the value of the metadata count by 3, if the option type is 4, read using the SACK_P header, and reduce the value of the metadata count by 2, if the option type is 5, read using the SACK header, and reduce the value of the metadata count by the length of the SACK header, if the option type is 8, read using the TSOPT header, and reduce the value of the metadata count by 10, if the option type is other, read using the variable-length header, and reduce the value of the metadata count by the value of the length of the two bytes after the pointer, wherein the pointer represents the current packet parsing position; further, if the MSS option is parsed, the checksum residual needs to be calculated and the parsing and checking module is exited. The calculation of the checksum residual is to use the algorithm of RFC 1624 to incrementally update the partial field of the checksum field of the TCP message, specifically, the value of the TCP message checksum MSS is set to 0 and incrementally updated, and the new TCP checksum is recorded to the current TCP checksum residual of the metadata.

[0051] The algorithm of RFC 1624 is a commonly used checksum update algorithm in the current Internet device, commonly used in devices such as NAT, and the specific description is: divided into three steps: I, obtain the original field value and the new field value: determine the field in the packet that has been modified, for example, the MSS field in the TCP header in the present application; II, negation operation: perform negation operation on 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 packet

[0055] ·m--value of a certain field (16-bit word) in the packet before modification

[0056] ·m'--value of a certain field (16-bit word) in the packet after modification

[0057] • The relationship between the checksum HC' after modifying a certain field and HC, m and m' is: HC' = HC ~ m - m', where ~ represents the bitwise NOT operation.

[0058] (2) The data packet enters the MSS updating module, the data packet that is parsed to encapsulate the MSS option in the tunnel is screened out, the MSS value is updated according to the length of the tunnel and the size of the MTU, and the metadata TCP checksum update flag bit is set.

[0059] Screening out the parsed MSS option means selecting the data packet with the effective state of the MSS header, and screening out the data packet encapsulated in the tunnel means selecting the data packet with the tunnel flag bit set in the metadata. Specifically, the metadata refers to the sideband data defined by the data packet in the processing process.

[0060] Updating the MSS value according to the length of the tunnel and the size of the MTU means obtaining the maximum transmission unit MTU of the interface, judging the specific encapsulation type according to the metadata tunnel flag bit, and calculating the specific MSS value. Specifically, if the metadata tunnel flag bit is a VXLAN tunnel, the MSS is updated to: MTU-VXLAN_MAX; if the metadata tunnel flag bit is a GRE tunnel, the MSS is updated to: MTU-GRE_MAX; wherein VXLAN_MAX represents the maximum overhead byte length added by the VXLAN tunnel, and GRE_MAX represents the maximum overhead byte length added by the GRE tunnel.

[0061] Setting the metadata TCP checksum update flag bit means setting the TCP checksum update flag bit in the metadata, and its default value is not set.

[0062] (3) The data packet enters the residual calculation module, judges whether the metadata TCP checksum update flag bit is set, uses the current TCP checksum residual and the current MSS value to calculate the new TCP checksum, and updates the TCP checksum.

[0063] Using the current TCP checksum residual and the current MSS value to calculate the new TCP checksum means using the algorithm of RFC 1624 to incrementally update the MSS value and the current TCP checksum residual, and calculate the new TCP checksum.

[0064] (4) The data packet enters the routing module for routing forwarding.

[0065] Compared with the prior art, the 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, can support expansion to other types of tunnels, is transparent to terminal equipment and intermediate equipment, does not need to modify the existing infrastructure, can realize line-speed forwarding compared with software implementation, has the characteristics of good expansibility and high flexibility, and can adjust the MSS size according to the traffic of different network states.

[0066] Embodiment 3

[0067] The embodiment provides a TCP maximum transmission unit dynamic adjustment method based on a programmable data plane, steps of which are as shown in Embodiment 2, a parsing and checking module flowchart is as shown in Figure 2 , a TCP option parsing flowchart is as shown in Figure 3 , a MSS updating module flowchart is as shown in Figure 4 , and a residual error calculation flowchart is as shown in Figure 5 .

[0068] The method comprises the following steps:

[0069] After receiving an IPv6 TCP SYN packet carrying a TCP MSS attribute with a value of 1440, the packet enters the parsing and checking module.

[0070] The parsing and checking module judges that the Ethernet frame type is ETH_TYPE_IP6, the next header is TCP_TYPE, and the TCP flags SYN flag is set. The metadata count is calculated and stored (4*TCP header length field-20), it is judged that the count is greater than 0, and the TCP option parsing is entered.

[0071] After reading the next byte of the current pointer, the option type is 2, the MSS option is read by using the MSS header, the count is modified as count-4, and the value of the MSS (1440) and the TCP checksum residual error of the current TCP checksum are calculated and subtracted. The parsing and checking module is exited.

[0072] The packet enters the MSS updating module, it is judged that the packet has parsed the MSS header and needs to be encapsulated into a VXLAN tunnel, the value of the MSS is modified as (MTU-VXLAN_MAX), and the metadata is updated to set the TCP checksum flag. The MSS updating module is exited.

[0073] The data packet enters the residual calculation module, it is judged that the data packet needs to update the TCP checksum, the new TCP checksum is calculated using the TCP checksum residual and the current MSS Value (MTU-VXLAN_MAX) and is updated in the TCP header checksum field, and the residual calculation module is exited.

[0074] The data packet enters the routing module for forwarding.

[0075] Embodiment 4:

[0076] The embodiment provides a TCP maximum transmission unit dynamic adjustment method based on a programmable data plane, steps of which are described in Embodiment 2, a parsing check module flowchart is shown in Figure 2 , a TCP option parsing flowchart is shown in Figure 3 , a MSS update module flowchart is shown in Figure 4 , and a residual calculation flowchart is shown in Figure 5 .

[0077] The method comprises the following steps:

[0078] After receiving an IPv6 TCP SYN packet carrying a TCP MSS attribute, the Value of which is 1440, the parsing check module is entered.

[0079] The parsing check module judges that the Ethernet frame type is ETH_TYPE_IP6, the next header is TCP_TYPE, and the TCP flag SYN flag is set. The metadata count is calculated and stored (4*TCP header length field-20), it is judged that the count is greater than 0, and the TCP option parsing is entered.

[0080] After reading the next byte of the current pointer, the option type is 2, the MSS option is read using the MSS header, the count is modified as count-4, and the TCP checksum residual of the value (1440) of the MSS and the current TCP checksum is calculated and subtracted, and the parsing check module is exited.

[0081] The data packet enters the MSS update module, it is judged that the data packet has parsed the MSS header and needs to be encapsulated into a GRE tunnel, the Value of the MSS is modified as (MTU-GRE_MAX), and the metadata update TCP checksum flag is set, and the MSS update module is exited.

[0082] The data packet enters the residual calculation module, it is judged that the data packet needs to update the TCP checksum, the new TCP checksum is calculated using the TCP checksum residual and the current MSS Value (MTU-GRE_MAX) and is updated in the TCP header checksum field, and the residual calculation module is exited.

[0083] Enter the routing module for forwarding.

[0084] Embodiment 5:

[0085] The embodiment provides a TCP maximum transmission unit dynamic adjustment method based on a programmable data plane, steps of which are described in Embodiment 2, a parsing and checking module flowchart is shown in Figure 2 , a TCP option parsing flowchart is shown in Figure 3 , a MSS updating module flowchart is shown in Figure 4 , and a residual calculation flowchart is shown in Figure 5 .

[0086] The method comprises the following steps:

[0087] After receiving an IPv6 TCP SYNECNCWR packet carrying a TCP MSS attribute with a value of 1440, enter the parsing and checking module.

[0088] The parsing and checking module judges that the Ethernet frame type is ETH_TYPE_IP6, the next header is TCP_TYPE, and the TCP flags SYN flag is set. The metadata count is calculated and stored (4*TCP header length field-20), it is judged that the count is greater than 0, and the TCP option parsing is entered.

[0089] After reading the next byte of the current pointer, the option type is 2, the MSS option is read using the MSS header, the count is modified as count-4, and the TCP checksum residual is calculated by subtracting the value (1440) of the MSS and the current TCP checksum. Exit the parsing and checking module.

[0090] The data packet enters the MSS updating module, it is judged that the data packet has been parsed to the MSS header and needs to be encapsulated into a GRE tunnel, the value of the MSS is modified as (MTU-GRE_MAX), and the metadata is updated to set the TCP checksum flag. Exit the MSS updating module.

[0091] The data packet enters the residual calculation module, it is judged that the data packet needs to update the TCP checksum, the new TCP checksum is calculated using the TCP checksum residual and the value (MTU-GRE_MAX) of the current MSS and is updated in the TCP header checksum field. Exit the residual calculation module.

[0092] Enter the routing module for forwarding.

[0093] Embodiment 6:

[0094] The embodiment provides a TCP maximum transmission unit dynamic adjustment method based on a programmable data plane, steps of which are as shown in the embodiment 2, a flowchart of a parsing and checking module is as shown in Figure 2 , a flowchart of a TCP option parsing module is as shown in Figure 3 , a flowchart of an MSS updating module is as shown in Figure 4 , and a flowchart of a residual error calculation module is as shown in Figure 5 Figure 2 Figure 3 Figure 4 Figure 5 .

[0095] The method comprises the following steps:

[0096] After receiving an IPv6 TCP ACK packet, the parsing and checking module is entered.

[0097] The parsing and checking module judges that the Ethernet frame type is ETH_TYPE_IP6, the next header is TCP_TYPE, and the TCP flags SYN flag bit is not set, and exits the parsing and checking module.

[0098] The routing module is entered for forwarding.

Claims

1. A method for dynamically adjusting TCP maximum transmission unit based on programmable data plane, characterized in that, The adjustment method is based on a TCP maximum transmission unit dynamic adjustment system based on a programmable data plane, and the adjustment system comprises an analysis and verification module, an MSS updating module, a residual calculation module and a routing module; The method comprises the following steps: (1) The data packet enters the analysis and verification module, and data packets satisfying the IPv6 TCP SYN data packet are screened out, and the TCP option length is calculated according to the TCP header length, the TCP option is analyzed, and the TCP checksum residual is calculated when the MSS option is analyzed. The data packet without analyzing the MSS option does not calculate the TCP checksum residual; the calculation of the checksum residual is the use of the algorithm of RFC 1624 to update the partial field of the checksum field of the TCP message in an incremental manner, the value value in the MSS option in the TCP message is set to 0 and is updated in an incremental manner, and the new TCP checksum is recorded to the current TCP checksum residual of the metadata; (2) The data packet enters the MSS updating module, and the data packet in which the MSS option is analyzed and encapsulated into the tunnel is screened out, and the value value in the TCP MSS option is updated according to the length of the tunnel and the size of the MTU, and the metadata TCP checksum update flag bit is set; the MSS header is selected as the data packet in the effective state, and the data packet encapsulated into the tunnel is selected as the data packet in which the tunnel flag bit in the metadata is set. Specifically, the metadata refers to the sideband data defined in the processing process of the data packet; (3) The data packet enters the residual calculation module, and it is judged whether the metadata TCP checksum update flag bit is set, if yes, the new TCP checksum is calculated using the current TCP checksum residual and the value value in the current TCP MSS option, and is updated to the TCP checksum field; if not, exit the residual calculation module; (4) The data packet enters the routing module, and the message is routed and forwarded according to the table item.

2. The method of claim 1, wherein the programmable data plane based dynamic adjustment of TCP maximum transmission unit is performed by a network device. In step (1), the data packet satisfying the IPv6 TCP SYN data packet is screened out, which means that the Ethernet frame type is extracted, it is judged whether it is an IPv6 Ethernet frame type ETH_TYPE_IP6, if it is, it is judged whether the next header type in the IPv6 header, if it is not, it is forwarded to the routing module; it is judged whether the next header type in the IPv6 header is a TCP message type TCP_TYPE, if it is, it is judged whether the SYN flag bit of the TCP flag bit is set, if it is not, it is forwarded to the routing module; it is judged whether the SYN flag bit of the TCP flag bit is set, which means that the Flags field in the TCP header is extracted, and it is judged whether the SYN flag bit is set to 1, if it is set to 1, the TCP option length is calculated using count, if it is not set to 1, it is forwarded to the routing module; the TCP option length is calculated using count, which means that the TCP header length field is extracted, and the metadata count is stored, and the TCP option length = 4*TCP header length field value-20 bytes.

3. The method of claim 1, wherein the programmable data plane based dynamic adjustment of TCP maximum transmission unit is performed by a network device. In step (1), the parsing of the TCP option refers to the cyclic parsing of the TCP option until the metadata count is 0. In the parsing step, after reading the option type of the byte after the current pointer, the reading is performed using different types of headers, and the value of the metadata count is modified according to the option length, wherein if the option type is 0, the reading is performed using the EOL header, and the value of the metadata count is reduced by 1; if the option type is 1, the reading is performed using the NOP header, and the value of the metadata count is reduced by 1; if the option type is 2, the reading is performed using the MSS header, the checksum residual is calculated by subtracting the MSS value, and the value of the metadata count is reduced by 4; if the option type is 3, the reading is performed using the WSOPT header, and the value of the metadata count is reduced by 3; if the option type is 4, the reading is performed using the SACK_P header, and the value of the metadata count is reduced by 2; if the option type is 5, the reading is performed using the SACK header, and the value of the metadata count is reduced by the length of the SACK header; if the option type is 8, the reading is performed using the TSOPT header, and the value of the metadata count is reduced by 10; if the option type is other, the reading is performed using the variable-length header, and the value of the metadata count is reduced by the value of the length of the two bytes after the pointer, wherein the pointer represents the current packet parsing position; if the MSS option is parsed, the checksum residual needs to be calculated and the parsing and checking module is exited.

4. The method of claim 1, wherein the programmable data plane based dynamic adjustment of TCP maximum transmission unit is performed by a network device. 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, judging the specific encapsulation type according to the metadata tunnel flag bit, and calculating the specific MSS value, specifically, if the metadata tunnel flag bit is a VXLAN tunnel, the MSS is updated as: MTU-VXLAN_MAX; if the metadata tunnel flag bit is a GRE tunnel, the MSS is updated as: MTU-GRE_MAX; Wherein VXLAN_MAX represents the maximum overhead byte length added by the VXLAN tunnel, and GRE_MAX represents the maximum overhead byte length added by the GRE tunnel.

5. The method of claim 1, wherein the programmable data plane based dynamic adjustment of TCP maximum transmission unit is performed by a network device. In step (2), setting the metadata TCP checksum update flag refers to setting the TCP checksum update flag in the metadata, and the default value is not set.

Citation Information

Patent Citations

  • Method and device for adaptively modifying maximum segment size, equipment and storage medium

    CN116418854A

  • Method for reducing data IP fragmentation quantity in PS network

    CN1863165A