[go: up one dir, main page]

CN119254709A - Data slicing method, electronic device and computer storage medium based on DPU - Google Patents

Data slicing method, electronic device and computer storage medium based on DPU Download PDF

Info

Publication number
CN119254709A
CN119254709A CN202411369956.9A CN202411369956A CN119254709A CN 119254709 A CN119254709 A CN 119254709A CN 202411369956 A CN202411369956 A CN 202411369956A CN 119254709 A CN119254709 A CN 119254709A
Authority
CN
China
Prior art keywords
data message
header
protocol
data
capacity value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202411369956.9A
Other languages
Chinese (zh)
Inventor
刘壮
袁晓飞
张昊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Yusur Technology Co ltd
Original Assignee
Yusur Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Yusur Technology Co ltd filed Critical Yusur Technology Co ltd
Priority to CN202411369956.9A priority Critical patent/CN119254709A/en
Publication of CN119254709A publication Critical patent/CN119254709A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/36Flow control; Congestion control by determining packet size, e.g. maximum transfer unit [MTU]
    • H04L47/365Dynamic adaptation of the packet size
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本申请实施例提供一种基于DPU的数据分片方法、电子设备和存储介质,应用于DPU网卡,包括:获取数据报文待经过的数据传输单元设置的最大数据报文容量值;若数据报文使用第一协议版本且符合分片条件,则根据最大数据报文容量值和数据报文的互联网协议IP头部长度确定目标数据报文容量值;并基于目标数据报文容量值对数据报文进行分片,得到分片后的数据报文;若数据报文使用第二协议版本且数据报文的包头解析出来的协议头为第一预设协议,则根据包头解析出来的扩展头总长度和最大数据报文容量值确定目标数据报文容量值,并基于目标数据报文容量值对数据报文进行分片,得到分片后的数据报文。在本申请中,降低了CPU资源利用率。

The embodiment of the present application provides a data fragmentation method, electronic device and storage medium based on DPU, which is applied to DPU network card, including: obtaining the maximum data message capacity value set by the data transmission unit through which the data message is to pass; if the data message uses the first protocol version and meets the fragmentation condition, the target data message capacity value is determined according to the maximum data message capacity value and the Internet Protocol IP header length of the data message; and the data message is fragmented based on the target data message capacity value to obtain the fragmented data message; if the data message uses the second protocol version and the protocol header parsed from the packet header of the data message is the first preset protocol, the target data message capacity value is determined according to the total length of the extended header parsed from the packet header and the maximum data message capacity value, and the data message is fragmented based on the target data message capacity value to obtain the fragmented data message. In the present application, the CPU resource utilization is reduced.

Description

DPU-based data slicing method, electronic equipment and computer storage medium
Technical Field
The embodiment of the application relates to the technical field of computers, in particular to a data slicing method based on a DPU, electronic equipment and a computer storage medium.
Background
Protocol (Internet Protocol, IP) fragmentation of the interconnection between networks is a technique used in network transmission to fragment larger packets into smaller fragments. The method is mainly used for adapting to the difference of MTUs (Maximum Transmission Unit, maximum transmission units) among different networks and ensuring that data can be smoothly transmitted to a destination.
In the related art, a network transmission technology (Generic Segmentation Offload, GSO) is used to perform fragmentation processing on a non-transmission control protocol (Transmission Control Protocol, TCP) message according to the MTU. By doing so, the data packet can be effectively received by the opposite protocol stack, and the opposite protocol stack of the ultra-long message can directly discard the data packet. However, because GSO technology is protocol stack processing, it occupies a lot of resources of the central processing unit (Central Processing Unit, CPU), and for some weaker CPU processors, it will be disaster-level events, and the CPU will be in the process of large packet segmentation or fragmentation and checksum calculation for a long time, and cannot separate out resources to process other events.
Therefore, how to reduce the CPU resource utilization is a problem to be solved.
Disclosure of Invention
In view of the above, embodiments of the present application provide a data slicing method, an electronic device and a storage medium based on a DPU to at least partially solve the above-mentioned problems.
According to a first aspect of an embodiment of the present application, there is provided a data slicing method based on a DPU, applied to a DPU network card, including:
obtaining the maximum data message capacity value set by a data transmission unit through which the data message is to pass;
if the data message uses a first protocol version and meets the slicing condition, determining a target data message capacity value according to the maximum data message capacity value and the IP header length of the data message;
If the data message uses the second protocol version and the protocol header resolved by the packet header of the data message is the first preset protocol, determining a target data message capacity value according to the total length of the extension header resolved by the packet header and the maximum data message capacity value, and slicing the data message based on the target data message capacity value to obtain the sliced data message.
According to a second aspect of the embodiment of the present application, there is provided an electronic device, including a processor, a memory, a communication interface, and a communication bus, where the processor, the memory, and the communication interface complete communication with each other through the communication bus, and the memory is configured to store at least one executable instruction, where the executable instruction causes the processor to perform an operation corresponding to the method according to the first aspect.
According to a third aspect of embodiments of the present application, there is provided a computer storage medium having stored thereon a computer program which, when executed by a processor, implements the method according to the first aspect.
According to the scheme provided by the embodiment of the application, a maximum data message capacity value set by a data transmission unit through which a data message passes is obtained through a DPU network card, if the data message uses a first protocol version and accords with a slicing condition, a target data message capacity value is determined according to the maximum data message capacity value and the IP header length of the data message, the data message is sliced based on the target data message capacity value to obtain the sliced data message, and if the data message uses a second protocol version and the protocol header resolved by the packet header of the data message is a first preset protocol, the target data message capacity value is determined according to the total length of the extension header resolved by the packet header and the maximum data message capacity value, and the data message is sliced based on the target data message capacity value to obtain the sliced data message. In the process, by judging the protocol version used by the data message and judging whether the data message is fragmented or not, if the two conditions are not met, different fragmentation measures are carried out according to different protocol versions, so that CPU resources are released, and the fragmentation technology is optimized.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments described in the embodiments of the present application, and other drawings may be obtained according to these drawings for a person having ordinary skill in the art.
Fig. 1 is a schematic flow chart of a data slicing method based on a DPU according to an embodiment of the present application;
FIG. 2 is a system block diagram of IP fragment offloading according to an embodiment of the present application;
Fig. 3 is a schematic diagram of an IP fragment offload status jump provided in an embodiment of the present application;
Fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to better understand the technical solutions in the embodiments of the present application, the following description will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the accompanying drawings in the embodiments of the present application, and it is obvious that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which are derived by a person skilled in the art based on the embodiments of the present application, shall fall within the scope of protection of the embodiments of the present application.
Fig. 1 is a schematic flow chart of a data slicing method based on a DPU according to an embodiment of the present application. The data slicing method based on the DPU provided by the embodiment of the application can be applied to a standard network card, an intelligent network card, a DPU (Data Processing Unit, data processor) chip and the like for executing slicing operation by supporting hardware. When the hardware supports IP fragmentation unloading, the software can directly send the ultralong packet to the hardware for processing, because of pipelining processing of the hardware, processing delay can be greatly reduced, CPU resources are released, meanwhile, because the hardware has a filtering function, all data messages can be sent through the hardware, the CPU processes the messages which cannot be processed by the hardware, and the CPU which can be processed by the hardware directly transfers the big packet to hardware processing.
The DPU-based data slicing method comprises the following steps:
S101, obtaining a maximum data message capacity value set by a data transmission unit through which the data message is to pass.
In the embodiment of the present application, the maximum transmission unit MTU (Maximum Transmission Unit, MTU) refers to the maximum packet size that can be transmitted by the network, and is in bytes. The size of the MTU determines the maximum number of bytes that the sender can send a message at a time. If the MTU exceeds the maximum value that can be borne by the receiving end, or exceeds the maximum value that can be borne by a certain device routed on the transmission path, the message fragments and even drops. The value of the data transmission unit, namely the value of the MTU, can be set, and the maximum data message capacity value set by the data transmission unit through which the data message passes is obtained, so that a reference is provided for the subsequent judgment of the fragmentation of the data packet.
S102, if the data message uses the first protocol version and the data message accords with the slicing condition, determining a target data message capacity according to the maximum data message capacity value and the IP header length of the Internet protocol corresponding to the data message, and slicing the data message based on the target data message capacity value to obtain the sliced data message.
In the embodiment of the present application, the protocol version used by the data packet may be internet protocol version 4 (Internet Protocol version, IPV 4) and internet protocol version 6 (Internet Protocol version, IPV 6), and the protocol version used by the data packet is determined, and when the protocol version is the first protocol version, i.e., IPV4 international protocol version, whether the data packet meets the data slicing condition is further determined. If the data message is a slicing message, a message which does not allow slicing to be executed or the message length is insufficient for MTU, the data message does not accord with the slicing condition, otherwise, the data message accords with the slicing condition. Because the payload content of the fragmented message is to be rounded in eight bytes when the data message is fragmented, the MTU value for unloading, i.e. the target data message capacity value, is determined according to the maximum data message capacity and the IP header length which are currently set.
If the data message uses the first protocol version, that is, if the data message is an IPV4 message, the IP fragment offset flag, the IP layer header information length, the four-layer protocol type, the total message length, etc. corresponding to the IPV4 message are parsed, and whether the data message meets the fragment condition is determined according to the parsing result.
In the embodiment of the application, the type of the transport layer protocol corresponding to the data message is judged, if the type is a first preset protocol, namely a transmission control protocol (Transmission Control Protocol, TCP)/user datagram protocol (User Datagram Protocol, UDP), the number of fragments of the data message is determined according to the capacity value of the target data message, and the fragmented data message is obtained.
If the transport layer protocol type corresponding to the data message is not the first preset protocol, the data message is directly fragmented based on the target data message capacity value, and the fragmented data message is obtained.
In an embodiment of the present application, when IP fragment offload is turned on, the default is to turn on checksum offload.
And S103, if the data message uses the second protocol version and the protocol header resolved from the header of the data message is the first preset protocol, determining a target data message capacity value according to the total length of the extension header resolved from the header and the maximum data message capacity, and slicing the data message based on the target data message capacity value to obtain the sliced data message.
In the embodiment of the application, the protocol version used by the data message is judged, when the protocol version is the second protocol version, namely the IPV6 international protocol version, the protocol type carried by the packet header of the data message is analyzed, when the carried protocol type is a protocol header, such as a four-layer protocol header, is a first preset protocol, such as a TCP/UDP protocol, the total length of all the extension headers carried by the packet header is obtained, the target data message capacity value is determined according to the total length of the extension headers and the maximum data message capacity, and finally the number of fragments of the data message is determined according to the target data message capacity value, so that the fragmented data message is obtained.
When the packet head of the data message carries the protocol type, if the protocol type is an extension head, continuing to analyze until four layers of protocol heads are analyzed, obtaining all extension heads before analyzing the four layers of protocol heads, and summing the obtained extension heads to obtain the total length of the extension heads. If the fragmentation extension header is resolved in the process of resolving the protocol type carried by the packet header, the data message is characterized to be fragmented before the message fragmentation can not be performed any more, and the resolution is not performed any more.
In the embodiment of the present application, as shown in fig. 2, fig. 2 is a system block diagram of IP fragmentation offloading provided in the embodiment of the present application. In fig. 2, the method includes a checksum calculation module (packet_checksum), a generation descriptor module (packet_packet), a buffer pool storage module (packet_memory), and a data burst module (packet_fragment), and after a data packet is transmitted through a data stream interface, the checksum calculation is performed, and at the same time, the generation descriptor module generates a corresponding descriptor, including supporting hardware unloading function, checksum unloading, a maximum data transmission unit, an extended header length, and a TCP/UDP result. When the MTU value for unloading is determined based on the maximum transmission unit in the descriptor, the data message is stored in a buffer pool storage module, after unloading capacity is confirmed and TCP/UDP checksum is calculated, the data packet is read from the buffer pool, data slicing is carried out in a data slicing module according to the unloading capacity, sliced data is obtained, checksum calculation is carried out on the sliced data again, the calculation can be carried out on IP layer checksum, the IP layer checksum and the TCP/UDP checksum are filled in the data message after slicing, and finally the data message filled with the checksum is transmitted through a data flow interface.
It can be understood that in the embodiment of the application, the maximum data message capacity value set by the output unit of the data message is obtained, if the data message uses the first protocol version and accords with the slicing condition, the target data message capacity value is determined according to the maximum data message capacity value and the IP header length of the data message, the sliced data message is obtained based on the target data message capacity value, and if the data message uses the second protocol version and the protocol header resolved by the packet header of the data message is the first preset protocol, the target data message capacity value is determined according to the total length of the resolved extension header and the maximum data message capacity value, and the sliced data message is obtained based on the target data message capacity value. In the process, on one hand, aiming at the problem of weak capability of a plurality of CPUs, the CPU is replaced to judge the protocol version used by the data message, whether the data message is fragmented or not is judged, if the two conditions are not met, different fragmentation measures are carried out according to different protocol versions, CPU resources are released, and the fragmentation technology is optimized. On the other hand, if the CPU capability of the user is strong, the message processing delay can be reduced by turning off the hardware function.
In some embodiments of the present application, S102 may be implemented through S1021 to S103, which are described by the following steps.
S1021, when the data message uses the first protocol version, acquiring key fields of the data message in the transmission process.
In some embodiments of the present application, the key fields may be an IP fragment offset flag, an IP layer header information length, a four layer protocol type, and a total message length. The four-layer protocol type mainly comprises an application layer, a transmission layer, a network layer and a network interface layer or a data link layer, and the four layers work together to ensure the integrity and the correctness of data, so that various application programs can communicate and exchange data through a network. The total length of the message refers to the total length of the message, including the sum of the length of the header and the payload. The IP layer header information length generally refers to the length of the IPv4 or IPv6 packet header. The header structures of IPv4 and IPv6 are different, and thus their header lengths are also different.
And S1022, when the data message accords with the slicing condition through the key field, determining a target data message capacity value according to the maximum data message capacity and the IP header length corresponding to the data message.
In some embodiments of the present application, whether the data packet is a fragmented packet, a packet that does not allow fragmentation to be performed, or a packet with a packet length less than the MTU is determined according to key fields of the data packet, such as an IP fragment offset flag, an IP layer header information length, a four layer protocol type, and a packet total length. When the data message accords with the slicing condition through the key word, the target data message capacity value is further determined according to the maximum data message capacity and the IP header length corresponding to the data message.
S1023, when the key field judges that the data message does not accord with the slicing condition, the slicing processing is not carried out on the data message.
In some embodiments of the present application, when it is determined by the key field that the data packet does not meet the fragmentation condition, the data packet is a fragmented packet, a packet that is not allowed to be fragmented, or a packet with a packet length less than the MTU, the fragmentation process is not performed on the data packet. If the data message is a slicing message or a message which does not allow slicing to be executed and the data message length is larger than the MTU, discarding the packet and returning an ICMP error message.
It can be understood that in some embodiments of the present application, when the data packet uses the first protocol version, a key field of the data packet in the transmission process is obtained, and when the data packet meets the fragmentation condition through the key field, a target data packet capacity value is determined according to the maximum data packet capacity and the IP header length corresponding to the data packet. And when judging that the data message does not accord with the slicing condition through the key field, not carrying out slicing processing on the data message. Judging whether the data message can be fragmented or not through the keywords corresponding to the data message, and improving the accuracy of data fragmentation.
In some embodiments of the present application, S10 is further included before S102, which is specifically described by the following steps.
S10, analyzing the Ethernet type value corresponding to the data message to obtain a protocol version used by the data message.
In some embodiments of the present application, the data message transmitted by the bus is parsed, the ethernet type is parsed first, and the international protocol version used by the data message is determined by reading the ethernet frame, extracting the type field, and checking the value of the type field. The protocol version used by the data message can be an IPV4 version and an IPV6 version, and whether the protocol version used by the data message is the IPV4 version or the IPV6 version is determined.
It can be understood that in some embodiments of the present application, when the data packet is fragmented, whether the data packet is IPv4 or IPv6 is determined according to the ethernet type, and different protocol versions are suitable for different network environments and requirements, so that accuracy, efficiency and compatibility of network communication are improved.
In some embodiments of the present application, S20 to S22 are further included before S104, which is specifically described by the following steps.
And S20, if the data message uses the second protocol version, analyzing the protocol type carried by the packet header to obtain an analysis result.
In some embodiments of the present application, if the second protocol version, i.e. the IPV6 protocol version, is used for the data packet, the protocol type carried by the packet header is parsed, and it is determined whether the protocol type is an extension header or a preset protocol header, i.e. a four-layer protocol header.
S21, if the analysis result represents that the protocol type is an extension header, acquiring the protocol type indicated by the next header field of the extension header.
And S22, if the protocol type indicated by the next header field is an extension header, continuing to analyze the extension header until a preset protocol header is obtained.
In some embodiments of the present application, when the field of the IPV6 header is read, the "next header" field will show the next header type, if the "next header" field value corresponds to a certain extension header type, then the next header will be the extension header, when the analysis result indicates that the protocol type is the extension header, the extension header is continuously read and analyzed, and the "next header" field in the extension header is checked to determine the type of the next header until the preset protocol header, that is, the four-layer protocol header, is analyzed.
It can be understood that in some embodiments of the present application, if the data packet uses the second protocol version, the protocol type carried by the header corresponding to the data packet is parsed to obtain a parsing result, if the parsing result characterizes the protocol type as an extension header, the protocol type indicated by the next header field of the extension header is obtained, and if the protocol type indicated by the next header field is an extension header, the parsing of the extension header is continued until a preset protocol header is obtained. By analyzing the protocol type of the packet header of the data message, judging whether the packet header is an extension header or a preset protocol header, improving the processing efficiency, ensuring the data integrity, supporting the realization of network functions and enhancing the network security, and by the steps, the IPV4 header option field and the IPV6 extension header field can be correctly identified according to the processing modes of the IPV4 header carrying option and the IPV6 extension header carrying option and the non-carrying.
In some embodiments of the present application, S201 to S202 are further included after S104, and are described by the following steps.
S201, analyzing the fragmented data message to obtain respective corresponding hop-by-hop extension heads or route extension heads.
In some embodiments of the present application, hop-by-Hop Extensions (Hop-by-Hop Extensions) are an important component of the IPv6 protocol that allows additional processing of data packets at the IP layer without affecting upper layer protocols. The hop-by-hop extension header immediately follows the IPv6 base header, allowing the intermediate node to perform the necessary processing on the data packet without having to pass it to a higher network layer. The route extension header is an optional extension header defined in the IPv6 protocol, and uses routing addresses arranged in sequence to identify the entire route, so that the user can configure the header to achieve the purpose of allowing packets to travel along the same path.
In some embodiments of the present application, a plurality of fragmented data messages are obtained after the data message is fragmented, and the fragmented data messages are continuously parsed to obtain a piece-by-piece extension header or a route extension header corresponding to each fragmented data message.
S202, adding the fragmented extension header corresponding to the fragmented data message to the hop-by-hop extension header or the route extension header.
In some embodiments of the present application, the fragmented extension header corresponding to each fragmented data packet is added behind the hop-by-hop extension header or behind the route extension header, and if these two extension headers are not present, the fragmented extension header follows the IPV6 basic packet header.
It can be understood that in some embodiments of the present application, the fragmented data packet is parsed to obtain a corresponding hop-by-hop extension header or a route extension header, and the fragmented extension header corresponding to the fragmented data packet is added to the hop-by-hop extension header or the route extension header. By adding the fragmentation expansion header behind the hop-by-hop expansion header or the route expansion header, whether the fragmented data message is a fragmentation message or not is determined, and in the process of transmitting the subsequent data message, the accuracy of whether the data message is the fragmentation message or not is improved.
In some embodiments of the present application, if the data packet uses the first protocol version and meets the fragmentation condition in S103, S301 to S304 are further included after determining the target data packet capacity value according to the maximum data packet capacity value and the internet protocol IP header length of the data packet, and if the data packet uses the second protocol version and the protocol header resolved by the packet header of the data packet in S104 is the first preset protocol, the following steps are described.
S301, if the transmission layer protocol of the data message is a first preset protocol, calculating a first checksum, and obtaining the calculated first checksum.
In some embodiments of the present application, if the transport layer protocol of the data packet is a first preset protocol, i.e. a TCP/UDP protocol, a TCP/UDP checksum is calculated, i.e. a first checksum is calculated, so as to obtain a calculated first checksum. If the transmission layer protocol of the data message is not TCP/UDP protocol, the checksum calculation is not carried out, and the data slicing is directly carried out.
S302, performing checksum calculation based on a first preset protocol to obtain a calculated first checksum.
In some embodiments of the present application, if the data packet uses the second protocol version and the header of the data packet is a first preset protocol (i.e., a TCP/UDP protocol), the checksum is calculated, so as to obtain the calculated first checksum, and if the parsed header is not the first preset protocol, i.e., is not the TCP/UDP protocol, the fragmentation of the data is directly performed.
It can be understood that in some embodiments of the present application, whether to perform checksum calculation is determined by determining whether a transport layer protocol of a data packet is a first preset protocol or a protocol header parsed by a packet header of the data packet is the first preset protocol, so that integrity in a data transmission process is ensured. And the application covers the checksum offloading of TCP messages and UDP messages of IPV4 and IPV 6.
In some embodiments of the present application, in S102, the data message is fragmented based on the target data message capacity value, so as to obtain a fragmented data message, and in S103, the data message is fragmented based on the target data message capacity value, so that the fragmented data message may be implemented in S401 to S403, and the following steps are specifically described.
S401, respectively recalculating the network layer checksums of the fragmented data messages to obtain second checksums corresponding to the fragmented data messages.
In some embodiments of the present application, the network layer checksum, i.e., the IP layer checksum, is a field of the IP packet header that is used to detect any corruption or alteration of the IP packet header during transmission. And respectively recalculating the network layer checksums of the fragmented data messages to obtain second checksums, namely IP layer checksums, corresponding to the fragmented data messages.
S402, filling the first checksums of the second checksums into the corresponding first data messages respectively to obtain filled first data messages.
S403, respectively filling the second checksums into the corresponding second data messages to obtain filled second data messages.
In some embodiments of the present application, after slicing a data packet to obtain a sliced data packet, a first checksum, i.e. a TCP/UDP checksum, and a second checksum, i.e. an IP layer checksum, are filled into a first piece of data packet, i.e. a first data packet, in the sliced data packet, so as to obtain a filled first data packet. And respectively filling the second checksum into other data messages except the first data message to obtain a filled second data message.
Illustratively, the IPV4 packet is fragmented, resulting in a first packet, a second packet, a third packet, and so on. The TCP/UDP checksum and the IP layer checksum are filled into the first data packet, and the IP layer checksum is filled into the second data packet, the third data packet and other data packets except the first data packet.
S304, transmitting the filled first data message and the filled second data message through a data transmission unit.
In some embodiments of the present application, if the message length of the first data message after filling and the second data message after filling is less than the set MTU, the first data message after filling and the second data message after filling are transmitted through the data transmission unit.
It can be appreciated that in some embodiments of the present application, the first checksum and the second checksum obtained by calculation are filled into the first data packet, and the second checksum is filled into other data packets, so that the integrity and accuracy of the fragmented data packet in the subsequent transmission process are ensured.
In some embodiments of the present application, S101 further includes S401, which will be specifically described by the following steps.
S401, when calculating the target data message capacity value, storing the data message in a cache pool.
In some embodiments of the present application, when calculating the MTU value, the data packet is stored in the buffer pool for waiting, and if it is the TCP/UDP protocol, the TCP/UDP checksum is calculated, and the other protocol messages do not calculate any checksum. After confirming the unloading capacity and calculating the TCP/UDP checksum, reading the data packet from the buffer pool and carrying out IP fragmentation according to the unloading capacity.
In combination with the above steps, as shown in fig. 3, fig. 3 is a schematic diagram of an IP fragment unloading state jump according to an embodiment of the present application. In fig. 3, an idle state (state_idle) is included, indicating one state in which the system is in a stationary or waiting state. I.e. the system is not performing any specific task or operation at this time, but rather is waiting for an external event or trigger to change its state, an ethernet Internet Protocol (IP) state (i.e. state_eth_ip) indicating the state of processing an ethernet frame and extracting an IP packet, i.e. the system is parsing the header of the ethernet frame and preparing to process the IP packet contained therein, determining whether to perform IP fragmentation by processing the ethernet frame and extracting the state of the IP packet, jumping to an ignore state when data fragmentation is not needed, and jumping to an Internet Protocol (IP) option state (i.e. state_ip_option) indicating the state of the system parsing an IPv6 extension header or processing an IPv6 option when data fragmentation is needed. I.e., the system is processing an extension header or option field in an IPv6 packet, and a transport layer header state (i.e., state_tp_header) indicating that the system is parsing the state of the transport layer protocol header. I.e. the system is handling header information of TCP (transmission control protocol), UDP (user datagram protocol) or other transport layer protocol, and the payload status (i.e. state_payload) indicates the status that the system is handling the payload. I.e. the system has completed parsing of the packet header and is ready to process the actual data in the packet, an ethernet Internet Protocol (IP) fragmentation state (i.e. state_fragment_eth_ip) indicating the state in which the system is processing the fragmented IP packets contained in an ethernet frame, i.e. the system is processing an ethernet frame containing one or more fragmented IP packets, an IP fragmentation processing option state (i.e. state_fragment_ip_option) indicating the state in which the system is processing fragmented IPv6 packets and the extension header in these fragmented packets is being parsed or processed. The fragmentation load status (i.e., state_frag_payload) is used to describe a particular stage in processing a fragmented packet, indicating that the device is processing the payload portion in the fragment.
It can be appreciated that in some embodiments of the present application, when calculating the target data message capacity value, the data message is stored in the buffer pool, so that the processor can perform the processing of the data slice, thereby reducing the waiting time and improving the performance of the system.
The application also provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method provided by any of the above embodiments when executing the program.
The application also provides a computer readable medium having stored thereon a computer program which when executed by a processor implements the method provided by any of the above embodiments.
Referring to fig. 4, a schematic structural diagram of an electronic device according to an embodiment of the present application is shown, and the specific embodiment of the present application is not limited to the specific implementation of the electronic device.
As shown in FIG. 4, the electronic device may include a processor 1002, a communication interface (Communications Interface) 1004, a memory 1006, and a communication bus 1008.
Wherein:
the processor 1002, communication interface 1004, and memory 1006 communicate with each other via a communication bus 1008.
Communication interface 1004 is used to communicate with other electronic devices or servers.
The processor 1002 is configured to execute the program 1010, and may specifically perform relevant steps in the method embodiments described above.
In particular, program 1010 may include program code including computer operating instructions.
The processor 1002 may be a central processing unit CPU, or an Application-specific integrated Circuit ASIC (Application SPECIFIC INTEGRATED Circuit), or one or more integrated circuits configured to implement embodiments of the present application. The one or more processors included in the smart device may be the same type of processor, such as one or more CPUs, or different types of processors, such as one or more CPUs and one or more ASICs.
Memory 1006 for storing programs 1010. The memory 1006 may include high-speed RAM memory or may further include non-volatile memory (non-volatile memory), such as at least one magnetic disk memory.
The program 1010 may be specifically configured to cause the processor 1002 to perform operations corresponding to the methods described in the above method embodiments.
The specific implementation of each step in the program 1010 may refer to the corresponding steps and corresponding descriptions in the units in the above method embodiments, which are not repeated herein. It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the apparatus and modules described above may refer to corresponding procedure descriptions in the foregoing method embodiments, which are not repeated herein.
It should be noted that, according to implementation requirements, each component/step described in the embodiments of the present application may be split into more components/steps, or two or more components/steps or part of operations of the components/steps may be combined into new components/steps, so as to achieve the objects of the embodiments of the present application.
The above-described methods according to embodiments of the present application may be implemented in hardware, firmware, or as software or computer code storable in a recording medium such as a CD ROM, RAM, floppy disk, hard disk, or magneto-optical disk, or as computer code originally stored in a remote recording medium or a non-transitory machine-readable medium and to be stored in a local recording medium downloaded through a network, so that the methods described herein may be stored on such software processes on a recording medium using a general purpose computer, special purpose processor, or programmable or special purpose hardware such as an ASIC or FPGA. It is understood that a computer, processor, microprocessor controller, or programmable hardware includes a storage component (e.g., RAM, ROM, flash memory, etc.) that can store or receive software or computer code that, when accessed and executed by a computer, processor, or hardware, performs the methods described herein. Furthermore, when a general purpose computer accesses code for implementing the methods illustrated herein, execution of the code converts the general purpose computer into a special purpose computer for performing the methods illustrated herein.
Those of ordinary skill in the art will appreciate that the elements and method steps of the examples described in connection with the embodiments disclosed herein can be implemented as electronic hardware, or as a combination of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the embodiments of the present application.
The above embodiments are only for illustrating the embodiments of the present application, but not for limiting the embodiments of the present application, and various changes and modifications may be made by one skilled in the relevant art without departing from the spirit and scope of the embodiments of the present application, so that all equivalent technical solutions also fall within the scope of the embodiments of the present application, and the scope of the embodiments of the present application should be defined by the claims.

Claims (10)

1. The DPU-based data slicing method is characterized by being applied to a DPU network card and comprising the following steps of:
obtaining the maximum data message capacity value set by a data transmission unit through which the data message is to pass;
if the data message uses a first protocol version and meets the slicing condition, determining a target data message capacity value according to the maximum data message capacity value and the Internet Protocol (IP) header length of the data message;
If the data message uses the second protocol version and the protocol header resolved by the packet header of the data message is the first preset protocol, determining a target data message capacity value according to the total length of the extension header resolved by the packet header and the maximum data message capacity value, and slicing the data message based on the target data message capacity value to obtain the sliced data message.
2. The method according to claim 1, wherein determining a target data message capacity value based on the maximum data message capacity value and an internet protocol, IP, header length of the data message if the data message uses a first protocol version and meets a fragmentation condition, comprises:
When the data message uses the first protocol version, acquiring a key field of the data message in the transmission process;
When judging that the data message accords with the slicing condition through the key field, determining the target data message capacity value according to the maximum data message capacity and the IP header length corresponding to the data message;
And when judging that the data message does not accord with the slicing condition through the key field, not carrying out slicing processing on the data message.
3. The method according to claim 1, wherein if the data message uses a first protocol version and meets a fragmentation condition, before determining a target data message capacity value according to the maximum data message capacity value and an internet protocol, IP, header length of the data message, the method further comprises:
And analyzing the Ethernet type value corresponding to the data message to obtain a protocol version used by the data message.
4. The method of claim 1, wherein, before the data message uses the second protocol version and the header of the data message is the first predetermined protocol, the method further comprises:
if the data message uses the second protocol version, resolving the protocol type carried by the packet header corresponding to the data message to obtain a resolving result;
If the analysis result represents that the protocol type is an extension head, acquiring the protocol type indicated by the next head field of the extension head;
if the protocol type indicated by the next header field is an extension header, continuing to analyze the extension header until the preset protocol header is obtained.
5. The method of claim 1, wherein if the data packet uses a second protocol version and a header of the data packet is a first preset protocol, determining a target data packet capacity value according to a total length of an extension header and the maximum data packet capacity value, and slicing the data packet based on the target data packet capacity value, so as to obtain a sliced data packet, the method further comprises:
analyzing the fragmented data message to obtain respective corresponding hop-by-hop extension heads or route extension heads;
and adding the fragmented extension header corresponding to the fragmented data message to the hop-by-hop extension header or the route extension header.
6. A method according to claim 1 or 2, characterized in that,
If the data message uses the first protocol version and meets the fragmentation condition, after determining the target data message capacity value according to the maximum data message capacity value and the Internet Protocol (IP) header length of the data message, the method further includes:
if the transmission layer protocol of the data message is the first preset protocol, calculating a first checksum to obtain a calculated first checksum;
After the data message uses the second protocol version and the protocol header parsed by the packet header of the data message is the first preset protocol, the method further includes:
and performing checksum calculation based on the first preset protocol to obtain a calculated first checksum.
7. The method according to claim 1 or 6, wherein the fragmenting the data message based on the target data message capacity value, after obtaining the fragmented data message, the method further comprises:
Respectively recalculating the network layer checksums of the fragmented data messages to obtain second checksums corresponding to the fragmented data messages;
filling the second checksum and the first checksum into a first data message to obtain a filled first data message;
Filling the second checksums into the corresponding second data messages respectively to obtain filled second data messages;
And transmitting the first data message after filling and the second data message after filling through the data transmission unit, wherein the first data message is a first piece of data message in the data message after slicing, and the second data message is other data messages except the first piece of data message in the data message after slicing.
8. The method according to any one of claims 1-7, wherein after the obtaining the maximum data message capacity value set by the data transmission unit through which the data message is to pass, the method further comprises:
And when the target data message capacity value is calculated, storing the data message in a cache pool.
9. An electronic device comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete communication with each other through the communication bus;
the memory is configured to store at least one executable instruction that causes the processor to perform operations corresponding to the method according to any one of claims 1-8.
10. A computer storage medium having stored thereon a computer program which, when executed by a processor, implements the method of any of claims 1-8.
CN202411369956.9A 2024-09-29 2024-09-29 Data slicing method, electronic device and computer storage medium based on DPU Pending CN119254709A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202411369956.9A CN119254709A (en) 2024-09-29 2024-09-29 Data slicing method, electronic device and computer storage medium based on DPU

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202411369956.9A CN119254709A (en) 2024-09-29 2024-09-29 Data slicing method, electronic device and computer storage medium based on DPU

Publications (1)

Publication Number Publication Date
CN119254709A true CN119254709A (en) 2025-01-03

Family

ID=94021999

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202411369956.9A Pending CN119254709A (en) 2024-09-29 2024-09-29 Data slicing method, electronic device and computer storage medium based on DPU

Country Status (1)

Country Link
CN (1) CN119254709A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119363858A (en) * 2024-12-24 2025-01-24 珠海星云智联科技有限公司 Message generation verification method, device, system, equipment, cluster, medium and product

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119363858A (en) * 2024-12-24 2025-01-24 珠海星云智联科技有限公司 Message generation verification method, device, system, equipment, cluster, medium and product

Similar Documents

Publication Publication Date Title
US8009672B2 (en) Apparatus and method of splitting a data stream over multiple transport control protocol/internet protocol (TCP/IP) connections
US9037745B2 (en) Methods and devices for processing incomplete data packets
US8503450B2 (en) TCP receiver acceleration
US8311059B2 (en) Receive coalescing and automatic acknowledge in network interface controller
US20060265517A1 (en) Tcp/ip reception process circuit and semiconductor integrated cirtuit having the same
US7103674B2 (en) Apparatus and method of reducing dataflow distruption when detecting path maximum transmission unit (PMTU)
EP2574000A2 (en) Message acceleration
US8611222B1 (en) Selectively enabling packet concatenation based on a transaction boundary
CN119254709A (en) Data slicing method, electronic device and computer storage medium based on DPU
US9961147B2 (en) Communication apparatus, information processor, communication method, and computer-readable storage medium
CN117579725B (en) Message segment transmission method, device, equipment and medium
CN111404872A (en) Message processing method, device and system
EP2919433A1 (en) Method and device for communication protocol processing
US20060268867A1 (en) TCP/IP reception processing circuit and semiconductor integrated circuit implementing the same
CN117997833A (en) Data forwarding system and control method thereof
CN117768407A (en) Data processing method and server
CN107231269A (en) A kind of cluster accurate speed limit method and apparatus
US20050076287A1 (en) System and method for checksum offloading
US20090285207A1 (en) System and method for routing packets using tags
CN106302364B (en) Agent method, auxiliary agent method and equipment
CN118714107A (en) Communication method, device, electronic device and storage medium
CN113364790B (en) Data transmission method and device
CN114422624A (en) Data receiving method
CN111447046A (en) Service data transmission method, device, equipment and storage medium
CN117938774A (en) Single buffer broken packet splicing algorithm for communication equipment to continuously receive and unpack packets at high speed

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination