Method and apparatus for processing stateful services

By preprocessing and aggregating packets in the intelligent network card, the problem of low stateful service processing performance is solved, and more efficient processing performance and CPU load reduction is achieved.

CN115349247BActive Publication Date: 2025-07-04HUAWEI TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202080099178.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-04-17
Publication Date
2025-07-04
Estimated Expiration
2040-04-17

AI Technical Summary

Technical Problem

In the prior art, when intelligent network cards handle stateful service offloading, the processing performance of a single service is low, mainly because the processing of each message depends on the context update of the previous message, resulting in a performance bottleneck.

Method used

By preprocessing received messages in the network card, aggregation information is obtained and the messages are aggregated into the queue, and after meeting the preset conditions, multiple messages are processed according to the context, forming an aggregated second message is sent to the host, reducing the number of context processing times.

Benefits of technology

Improves the processing performance of a single stateful service, reduces the host CPU load, and improves processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115349247B_ABST
    Figure CN115349247B_ABST
Patent Text Reader

Abstract

A method and apparatus for processing stateful services, which relate to the field of communication technologies and are used to improve the processing performance of a single service when a network card processes stateful service offloading. The method is applied to a network card, and the network card is connected to a host, and includes: preprocessing a received first packet to obtain aggregation information of the first packet; aggregating the first packet into a first queue according to the first packet aggregation information, where the first queue is used to aggregate packets of a first connection to which the first packet belongs, and the first connection is a connection where a stateful service is located; when a preset condition is satisfied, processing multiple packets aggregated in the first queue according to the context of the first connection to obtain a second packet, where the context of the first connection is an updated context after obtaining the previous second packet of the first connection; and sending the second packet to the host.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communication technologies, and in particular, to a method and apparatus for processing stateful services. Background Art

[0002] With the continuous increase in service types and data volume in cloud networks, the execution of network protocols or storage protocols has become a computationally intensive operation. When a host executes a network protocol or a storage protocol, it will occupy a large amount of central processing unit (CPU) resources, thus bringing a large CPU load to the host. As a high-performance network access card with a network processor at its core, a smart network interface card (smart NIC) has a multi-core and multi-threaded network processor architecture and can be used to process various network protocols or storage protocols separated from the host, which can greatly reduce the CPU load of the host. This way of separating the processing of relevant protocols in the host and executing them by the smart NIC can be called offload.

[0003] In the prior art, for the offload of stateful services, the process from when the smart NIC receives a packet from the network side to when it sends the packet to the host generally includes three stages. Stage 1 is the processing of the L2 and L3 layers of the packet, which is a stateless stage at this time; Stage 2 is the processing of the L4 and L4+ layers of the packet, and at this time, the packet needs to be processed according to the context of the connection to which the packet belongs; Stage 3 is the editing of the packet and the construction of the DMA command.

[0004] Among them, the above-mentioned Stage 2 is a stateful stage, that is, the processing of the packet is strictly dependent on the context of the same connection. Only after the core or thread corresponding to the previous packet updates the context, the core or thread corresponding to the next packet can start processing according to the updated context, and the size of each packet is only the maximum transmission unit (MTU). Therefore, the processing performance of a single service is relatively low. Summary of the Invention

[0005] This application provides a method and apparatus for processing stateful services, which are used to improve the relatively low processing performance of a single service when the network card processes the offload of stateful services.

[0006] To achieve the above object, this application adopts the following technical solutions:

[0007] In a first aspect, a method for processing stateful services is provided, which is applied to a network card. The network card is connected to a host. For example, the network card is a smart network card and is connected to the host through a PCIe bus. The method includes: preprocessing a received first packet to obtain aggregation information of the first packet. For example, parsing the packet header of the first packet to obtain an identifier of a first connection to which the first packet belongs; aggregating the first packet into a first queue according to the aggregation information of the first packet. The first queue is used to aggregate packets of the first connection to which the first packet belongs. For example, the first queue is used to aggregate multiple packets of the first connection or multiple packets of the same information type of the first connection. The first connection is a connection where a stateful service is located; when a preset condition is satisfied (for example, the aggregation duration reaches a specified duration, the number of aggregated packets reaches a preset threshold, etc.), processing multiple packets aggregated in the first queue according to the context of the first connection to obtain a second packet. The context of the first connection is an updated context after obtaining the previous second packet of the first connection; sending the second packet to the host.

[0008] In the above technical solution, the network card can preprocess the received first packet to obtain the aggregation information of the first packet, and aggregate the first packet into the first queue for aggregating packets of the first connection according to the aggregation information, so that when the preset condition is satisfied, multiple packets aggregated in the first queue are processed according to the context of the first connection to obtain a second packet. In this way, the network card can obtain the context of the first connection only once and process multiple packets of the first connection based on this context. Before the network card uploads to the host, it will complete the editing of multiple fragments in the aggregated packet according to the host requirements, such as deleting the header of each packet, etc. In this way, the final effect is similar to that the host receives an aggregated packet from the network side, thus greatly reducing the requirements for context processing performance and improving the processing performance of a single stateful service.

[0009] In a possible implementation manner of the first aspect, the aggregation information of the first packet includes at least one of the following: an identifier of the first connection, a function identifier, and metadata; the function identifier may be an identifier of a virtual function in the host for receiving packets of the first connection; the metadata may include the information type of the packet or an operation code for indicating the information type of the packet, etc. The above possible implementation manner can enable the network card to aggregate the first packet into a queue corresponding to the first connection or a queue corresponding to the same information type in the first connection according to requirements, thereby improving the accuracy of aggregated packets.

[0010] In a possible implementation of the first aspect, aggregating the first packet into the first queue according to the aggregation information of the first packet includes: when the aggregation information of the first packet meets the aggregation context of the first queue (for example, the identifier of the first connection, the information type of the packet, and the expected packet number in the aggregation information are the same as the identifier of the first connection, the information type of the packet, and the expected packet number in the aggregation context), aggregating the first packet as an aggregation node onto the X chain of the first queue. The aggregation context of the first queue is used to indicate the aggregation information of the first queue. For example, the aggregation context of the first queue may include the identifier of the first connection, the information type of the aggregated packets, the number of aggregated packets, etc. It should be noted that if the first queue is empty, the first packet can be aggregated onto the Y chain of the first queue, and the aggregation information of the first queue is generated according to the aggregation information of the first packet. For example, the identifier of the first connection and the information type of the packet in the aggregation information of the first packet are extracted as the identifier of the connection and the information type of the aggregated packets in the aggregation context of the first queue. The above possible implementation can enable the smart network card to aggregate multiple packets belonging to the same connection or the same information type of the same connection together, thereby improving the processing performance of a single service.

[0011] In a possible implementation of the first aspect, aggregating the first packet into the first queue according to the aggregation information of the first packet includes: when the aggregation information of the first packet does not meet the aggregation context of the first queue, aggregating the first packet as a basic node onto the Y chain of the first queue, and updating the aggregation context of the first queue according to the aggregation information of the first packet. For example, the identifier of the first connection and the information type of the packet in the aggregation information of the first packet are extracted as the identifier of the connection and the information type of the aggregated packets in the aggregation context of the first queue. The above possible implementation can enable the network card to aggregate multiple packets belonging to the same connection or the same information type of the same connection together, thereby improving the processing performance of a single service.

[0012] In a possible implementation of the first aspect, processing multiple packets in the first queue includes: editing and chaining multiple packets belonging to the same X chain in the first queue. In the above possible implementation, the network card can process and send multiple packets as one packet to the host through chaining, thereby improving the processing performance of a single service.

[0013] In a possible implementation of the first aspect, the preset conditions include any one of the following: the aggregation duration reaches a specified duration, the number of aggregated packets reaches a preset threshold, and the amount of aggregated data reaches a preset data volume. The above possible implementation can improve the flexibility and diversity of packet aggregation.

[0014] In a possible implementation of the first aspect, the method further includes: allocating receive bandwidth for a first queue from available bus bandwidth (for example, the available bus bandwidth corresponding to the PCIe bus); correspondingly, sending a second packet to the host includes: sending the second packet to the host using the receive bandwidth. In the above possible implementation, the network card can send the second packet formed by chaining multiple packets to the host as one packet.

[0015] In a second aspect, there is provided a processing apparatus for stateful services, which is applied to a network card. The network card is connected to a host. For example, the network card is a smart network card and is connected to the host through a PCIe bus. The apparatus includes: a preprocessor unit configured to preprocess a received first packet to obtain aggregation information of the first packet; an aggregation unit configured to aggregate the first packet into a first queue according to the aggregation information of the first packet. The first queue is used to aggregate packets of a first connection to which the first packet belongs, and the first connection is a connection where the stateful service is located; a processing unit configured to, when a preset condition is satisfied, process multiple packets aggregated in the first queue according to the context of the first connection to obtain a second packet, and the context of the first connection is the context updated after obtaining the previous second packet of the first connection; a sending unit configured to send the second packet to the host.

[0016] In a possible implementation of the second aspect, the aggregation information of the first packet includes at least one of the following: an identifier of the first connection, a function identifier, and metadata.

[0017] In a possible implementation of the second aspect, the aggregation unit is further configured to: when the aggregation information of the first packet satisfies the aggregation context of the first queue, aggregate the first packet as an aggregation node onto the X chain of the first queue, and the aggregation context of the first queue is used to indicate the aggregation information of the first queue.

[0018] In a possible implementation of the second aspect, the aggregation unit is further configured to: when the aggregation information of the first packet does not satisfy the aggregation context of the first queue, aggregate the first packet as a basic node onto the Y chain of the first queue and update the aggregation context of the first queue according to the aggregation information of the first packet.

[0019] In a possible implementation of the second aspect, the processing unit is further configured to: edit and chain multiple packets belonging to the same X chain in the first queue.

[0020] In a possible implementation of the second aspect, the preset condition includes any one of the following: the aggregation duration reaches a specified duration, the number of aggregated packets reaches a preset threshold, and the amount of aggregated data reaches a preset data volume.

[0021] In a possible implementation of the second aspect, the apparatus further includes: a bandwidth allocation unit, configured to allocate a receiving bandwidth for a first queue from available bus bandwidths; correspondingly, a sending unit is further configured to: send a second message to a host using the receiving bandwidth.

[0022] In yet another aspect of the present application, there is provided a processing apparatus for stateful services. The apparatus is a network card or a chip built in the network card. The apparatus includes: a memory, and a processor coupled to the memory. Codes and data are stored in the memory, and the processor runs the codes in the memory so that the apparatus executes the stateful service processing method provided in the above first aspect or any possible implementation of the first aspect.

[0023] In yet another aspect of the present application, there is provided a communication system, which includes a network card and a host. The network card is connected to the host through a bus; wherein, the network card is the network card provided in any of the above aspects, and is configured to execute the stateful service processing method provided in the above first aspect or any possible implementation of the first aspect.

[0024] In yet another aspect of the present application, there is provided a computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instructions are run on a computer, the computer is caused to execute the stateful service processing method provided in the above first aspect or any possible implementation of the first aspect.

[0025] In yet another aspect of the present application, there is provided a computer program product, which includes computer-executable instructions. The computer-executable instructions are stored in a computer-readable storage medium; at least one processor of a device can read the computer-executable instructions from the computer-readable storage medium, and at least one processor executes the computer-executable instructions so that the device executes the stateful service processing method provided in the above first aspect or any possible implementation of the first aspect.

[0026] It can be understood that any of the above-provided apparatuses for processing stateful services, computer storage media, or computer program products are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 It is a schematic structural diagram of a communication system provided by an embodiment of the present application;

[0028] Figure 2 It is a schematic flowchart of a method for processing stateful services provided by an embodiment of the present application;

[0029] Figure 3A schematic diagram of packet aggregation provided by an embodiment of the present application;

[0030] Figure 4 A schematic structural diagram of an intelligent network card provided by an embodiment of the present application;

[0031] Figure 5 A schematic diagram of multi-packet processing provided by an embodiment of the present application;

[0032] Figure 6 A schematic structural diagram of a processing device for stateful services provided by an embodiment of the present application;

[0033] Figure 7 A schematic structural diagram of another processing device for stateful services provided by an embodiment of the present application. Detailed implementation manners

[0034] In the present application, "at least one" means one or more, and "a plurality" means two or more. "And / or" describes the association relationship of associated objects and indicates that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone, where A and B can be singular or plural. The character " / " generally represents an "or" relationship between the associated objects before and after. "At least one (item)" or its similar expression refers to any combination of these items, including any combination of single item (item) or plural items (items). For example, at least one (item) of a, b, or c can represent: a, b, c, a - b, a - c, b - c, or a - b - c, where a, b, c can be single or multiple. In addition, the embodiments of the present application use terms such as "first" and "second" to distinguish the same items or similar items with basically the same functions and roles. For example, the first threshold and the second threshold are only used to distinguish different thresholds and do not limit their sequence. Those skilled in the art can understand that terms such as "first" and "second" do not limit the quantity and execution order.

[0035] It should be noted that in the present application, words such as "exemplary" or "for example" are used to represent examples, illustrations, or explanations. Any embodiment or design solution described as "exemplary" or "for example" in the present application should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Exactly speaking, using words such as "exemplary" or "for example" is intended to present relevant concepts in a specific manner.

[0036] Figure 1A structural schematic diagram of a communication system provided by an embodiment of the present application. The communication system includes a host and a network card, and the host is connected to the network card through a bus. For example, the network card is a smart network interface card (smart NIC), and the smart NIC is connected to the host through a peripheral component interconnect express (PCIe) bus. Optionally, the communication system may include one or more hosts, and each of the one or more hosts can be connected to the smart NIC. In the following, the embodiment of the present application will be described by taking the network card as a smart NIC as an example.

[0037] Among them, multiple virtual machines (VMs) are set in the host, and one or more virtual functions (VFs) can run in each VM. These one or more VFs can correspond to different functions. Each VF can correspond to one or more queues, and the input or output mechanism of the VF is implemented through these one or more queues. These multiple queues can include a send queue and a receive queue. The intelligent network card can be used to process various network protocols or storage protocols separated from the host, which can also be called protocol offload.For example, network offloading can include virtualization I / O (Virt IO) offloading, single-root I / O virtualization (SR-IOV) offloading, user datagram protocol (UDP) / transmission control protocol (TCP) / Internet Protocol (IP) checksum (CS) offloading, receive side scaling (RSS) offloading / TCP segment offload (TSO) / Large receive offload (LRO), virtual extensible local area network (VxLAN) / generic network virtualization encapsulation (Geneve) offloading, stateful open virtual switch (OVS) offloading, IP security (IPSec) offloading, TCP offload engine (TOE) offloading, RDMA over converged ethernet V2 (RoCEv2) offloading, etc.; storage offloading can include erasure coding (EC) offloading, virtual block service (VBS) offloading, T10 data integrity field (DIF) / data integrity extension (DIX) offloading, fiber channel (FC) offloading, non-volatile memory express (NVMe) offloading, and NVME over fabric (NoF) offloading, etc.

[0038] In addition, when the smart network card receives a packet sent by Ethernet (Eth) to the host, the smart network card can process the packet and send the processed packet to the host. In a possible embodiment, the smart network card may include: a transmit bandwidth provision module, a receive bandwidth provision module, a transmit processing module, a receive processing module, a scheduler, a processor pool including multiple processor cores, a traffic manager, a transmit port for sending packets to Eth, and a receive virtual machine (RX VM) for sending packets to the host. Optionally, the processor pool in the smart network card may be an application specific integrated circuit (ASIC) or a field programmable gate array (FPGA), etc., and the embodiments of the present application do not make specific limitations on this.

[0039] Figure 2 It is a schematic flowchart of a processing method for a stateful service provided by an embodiment of the present application. This method can be applied to Figure 1 the communication system including a host and a smart network card shown in the figure. This method includes the following steps.

[0040] S201: The smart network card preprocesses the received first packet to obtain the aggregation information of the first packet.

[0041] Among them, one or more connections can be established between the host and the network (Eth) through the smart network card. This connection can refer to a logical link established by a session at both ends. For example, this connection can include a TCP connection, a UDP connection, or a ROCE queue pair (QP) connection, etc. The first connection can be any one of these one or more connections. The identifier of the first connection can be used to identify the first connection, and the first connection can be the connection where the stateful service is located. When the network needs to send a packet of the first connection to the host, the network can send the packet of the first connection to the smart network card, and then the smart network card processes the packet of the first connection and sends it to the host.

[0042] In addition, the above stateful services correspond to stateless services. A stateless service may mean that the processing of a single packet of the service can be based on the packet header of the packet itself, and there is no association between packets. A stateful service may mean that a single packet of the service cannot determine how to process the packet, and the processing of the packet needs to depend on the state of the "connection" where the packet is located, as well as the information of the packet itself, etc., in order to determine the processing behavior of the packet. That is to say, there is an association between packets of a stateful service. The state information of the above "connection" includes, but is not limited to: the sequence number of the next expected packet, the sequence number of the acknowledgment (ACK), the receive window update, and statistical information, etc. For ease of understanding, the following takes a firewall as an example to illustrate stateful firewalls and stateless firewalls. The firewall mentioned here may include a firewall, or may also include security groups in OpenStack and other firewalls at different levels. Among them, a stateless firewall means filtering or blocking network packets based on static values, such as based on addresses, ports, and protocols, etc., that is, a stateless firewall itself does not care about the current network connection state. A stateful firewall can distinguish the state of the network connection. For example, a stateful firewall can distinguish a TCP connection and which stage of the TCP connection it is currently in. That is to say, a stateful firewall can, in addition to static values, filter or block network packets through the connection state.

[0043] In an embodiment of the present application, when the intelligent network card receives a first packet from the network, the intelligent network card can preprocess the first packet. For example, the intelligent network card can parse the header of the first packet to obtain the aggregation information of the first packet. The aggregation information may include: the identifier of the first connection to which the first packet belongs, the function identifier corresponding to the first connection, and one or more of the metadata. For example, the function identifier corresponding to the first connection is the identifier of the first VF. The first VF may be a VF for receiving packets of the first connection, and the identifier of the first VF can be used to uniquely identify the first VF among multiple VFs in the host. The metadata may include the five-tuple of the packet, the information type of the packet, or an opcode for indicating the information type of the packet, etc.

[0044] For example, when the first connection is a TCP connection, the aggregation information may include metadata, and the metadata may include a five-tuple and a TCP sequence number (SN), etc. For another example, when the first connection is a remote direct memory access (RDMA) connection, the aggregation information may include metadata, and the metadata may include an opcode for indicating the information type of a packet. For example, the opcode may include sendfirst, send middle, or send last, or the opcode may include write first, write middle, or write last.

[0045] S202: The intelligent network card aggregates the first packet into the first queue according to the aggregation information, and the first queue is used to aggregate the packets of the first connection.

[0046] Among them, multiple queues may be set in the intelligent network card, and each of the multiple queues can be used to aggregate multiple packets from the network. The multiple packets may belong to the same connection, or belong to the same information type of the same connection (for example, the information types of the multiple packets may all be write data), or belong to multiple consecutive packets of the same information type of the same connection (for example, the packet numbers of the multiple packets are consecutive). The first queue may be any one of the multiple queues used to aggregate the packets of the first connection.

[0047] Specifically, when the intelligent network card obtains the aggregation information of the first packet, the intelligent network card can determine whether the aggregation information meets the aggregation context of the first queue. The aggregation context of the first queue is used to indicate the aggregation information of the first queue. For example, the aggregation context of the first queue may include the identifier of the first connection, the identifier of the first VF, the five-tuple of the packet, the information type of the packet, the operation code of the packet, the number of aggregated packets, and the data volume of the aggregated packets. When the aggregation information meets the aggregation context of the first queue, the intelligent network card can aggregate the first packet as an aggregation node to the X chain of the first queue. The first queue is the queue that has aggregated the packets of the first connection. Further, the intelligent network card can also update the aggregation context of the first queue. For example, the number of aggregated packets in the aggregation context of the first queue is increased by 1. When the aggregation information does not meet the aggregation context of the first queue, the intelligent network card can aggregate the first packet as a basic node to the Y chain of the first queue and update the aggregation context of the first queue according to the aggregation information. The updated aggregation context is used to indicate the current aggregation information in the first queue. For example, the information type of the packet in the updated aggregation context is updated to the information type of the first packet, the five-tuple information of the packet is updated to the five-tuple information of the first packet, and the number of aggregated packets is updated to 1.

[0048] It should be noted that if the first queue is empty, the first packet can be aggregated to the Y chain of the first queue, and the aggregation information of the first queue can be generated according to the aggregation information of the first packet. For example, the identifier of the first connection and the information type of the packet in the aggregation information of the first packet are extracted as the identifier of the connection and the information type of the aggregated packet in the aggregation context of the first queue.

[0049] Exemplarily, as Figure 3 shown, it is described by taking the example that the intelligent network card receives multiple packets from the network and these multiple packets belong to multiple different connections. In Figure 3 , these multiple packets include 10 packets. These 10 packets belong to 5 different connections. Among these 10 packets, packet A, packet B, packet C, packet D, and packet E are the first packets corresponding to these 5 connections in sequence. Therefore, packet A, packet B, packet C, packet D, and packet E are respectively located on the Y chain of the first queue as basic nodes. In addition, there are another 3 packets among these 10 packets that have the same connection as the connection corresponding to packet B and are received after packet B and before packet A. Therefore, these 3 packets are aggregated with packet B in an X chain of the first queue. The remaining 2 packets among these 10 packets have the same connection as the connection corresponding to packet E and are received after packet E and before packet D. Therefore, these 2 packets are aggregated with packet E in another X chain of the first queue. In Figure 3 , the unit (cell) chain included in each packet is represented by a small circle with the number 0.

[0050] It should be noted that Figure 3 The message A, message B, message C, message D, and message E shown in Figure 3 can also be messages of different information types of the same connection, or messages of the same connection and the same information type but not the desired message numbers. The above is only illustrated by taking the message A, message B, message C, message D, and message E belonging to multiple different connections as an example, and does not constitute a limitation to the embodiments of the present application.

[0051] It should be noted that there may be different aggregation strategies for different protocol types. For example, for the ROCE protocol, only messages with the same information type will be aggregated. For example, for 4 messages: write first, writemiddle, write middle, and write middle, the operation code of the aggregated message can be write first; for another example, for 4 messages: write middle, write middle, write middle, and write middle, the operation code of the aggregated message can be write middle; for another example, for 4 messages: write middle, write middle, write middle, and write last, the operation code of the aggregated message can be write last.

[0052] S203: When the preset conditions are met, the smart network card processes the multiple aggregated messages in the first queue according to the context of the first connection to obtain a second message.

[0053] Wherein, the preset conditions may include any one of the following: the aggregation duration reaches a specified duration, the number of aggregated messages reaches a preset threshold, and the aggregated data volume reaches a preset data volume. It should be noted that the aggregation duration, the preset threshold, and the preset data volume can be set in advance, and the specific values of the aggregation duration, the preset threshold, and the preset data volume can be fixed or variable. Specifically, those skilled in the art can set them according to experience or actual situations. For example, the preset data volume can be 64KB, and the embodiments of the present application do not make specific limitations thereto.

[0054] Specifically, when the preset conditions are met, the smart network card can process multiple packets aggregated in the first queue according to the context of the first connection. For example, perform L4 and L4+ layer processing on these multiple packets according to the context of the first connection, and edit and chain multiple packets belonging to the same X chain in the first queue to obtain a second packet. The context of the first connection may be stored in the cache of the smart network card or may not be stored. When the context of the first connection is not stored in the smart network card, the smart network card can obtain the context of the first connection from the host according to the identifier of the first connection; when the context of the first connection is stored in the smart network card, the smart network card can obtain the context of the first connection from its own cache. In addition, the context of the first connection is the context updated after obtaining the previous second packet of the first connection.

[0055] S204: The smart network card sends the second packet to the host.

[0056] When the smart network card obtains the second packet, the smart network card can send the second packet to the host through the PCIe bus, so that the host can receive the second packet, that is, receive multiple packets of the first connection. Optionally, when the first VF in the first VM in the host is used to store the packets of the first connection, the host can also store the received second packet in the first VF of the first VM, and the first VM is the VM that runs the first VF among the multiple VMs of the host.

[0057] Furthermore, before the smart network card sends the second packet to the host, it allocates receive bandwidth for the first queue from the available bus bandwidth (for example, the available bus bandwidth corresponding to the PCIe bus), and uses this receive bandwidth to send the second packet to the host. It should be noted that the receive bandwidth can be fixed or variable, and can be specifically set by those skilled in the art according to experience or actual situation. For example, the preset data volume can be 64KB, and the embodiments of the present application do not make specific limitations on this.

[0058] For ease of understanding, the following takes Figure 4 the structure of the smart network card shown as an example to illustrate the solution provided by the embodiments of the present application.

[0059] Among them, the smart network card further includes a pre-classification module and an input coalescing queue (ICQ) engine. The RX bandwidth allocation module may include a queue mapping (QM) module, a bandwidth allocation node ( Figure 4 denoted as vNIC in the figure) and a scheduler for round robin (RR) scheduling (Figure 4 It is represented as RR in Figure 4 Taking the connection between the smart network card and multiple hosts (such as, H0 to H3) as an example for illustration.

[0060] Specifically, when the smart network card receives the first packet, the pre-classification module pre-processes the first packet to obtain the aggregation information of the first packet, such as the identifier of the first connection, VF ID, and information type, etc.; the ICQ engine aggregates the first packet into the first queue according to the aggregation information; when the preset condition is satisfied, the queue mapping module maps the first queue to the corresponding bandwidth allocation node to complete the allocation of the receiving bandwidth; then, RR allocates a processor core or a thread in the processor core for the first queue from the processor pool. The allocated processor core or thread can be referred to as a core / thread hereinafter. The core / thread can obtain the context of the first connection based on the identifier of the first connection, and process multiple packets aggregated in the first queue according to the context of the first connection. The obtained second packet can be stored in the memory of the smart network card. The traffic manager can schedule the second packet from the memory and send it to the host through the PCIe bus.

[0061] Furthermore, the context of the first connection can be decomposed into multiple sub-contexts, so that different processor cores or threads of the smart network card can concurrently process different packets of the same connection according to different sub-contexts, thereby improving the throughput rate of the packets of the first connection. Exemplarily, such as Figure 5As shown in the figure, the context of the first connection can be decomposed into four sub-contexts, which are respectively denoted as S0, S1, S2, and S3. In this way, the intelligent network card can simultaneously process the packets aggregated in the four aggregation queues corresponding to the first connection. The packets aggregated in these 4 aggregation queues can be respectively denoted as pac1, pac2, pac3, and pac4. Suppose the processor cores assigned by the scheduler for the 4 packets are Core1, Core2, Core3, and Core4 respectively. Then when Core1 finishes processing pac1S0, Core1 can continue to process pac1 S1. At this time, Core2 can process pac2 S0. When Core1 finishes processing pac1 S1, Core1 can continue to process pac1 S2. At this time, Core2 finishes processing pac2 S0 and can start to process pac2 S1. At the same time, Core3 can start to process pac3 S0, and so on. Further, if there is also pac5 corresponding to the first connection, then when Core1 finishes processing pac1 S3, Core1 can start to process pac5 S0, Core2 starts to process pac2 S3, Core3 starts to process pac3 S2, and Core4 starts to process pac4 S1. In this way, the 4 cores of the intelligent network card can participate in the context processing of the first connection concurrently. Each core can process a second packet of the first connection, thereby improving the throughput rate of the packets of the first connection.

[0062] In the embodiment of the present application, the intelligent network card can receive a first packet through a pre-processor, obtain the aggregation information of the first packet, and aggregate the first packet into a first queue for aggregating the packets of the first connection according to the aggregation information. Thus, when the preset conditions are met, the intelligent network card processes the multiple packets aggregated in the first queue according to the context of the first connection to obtain a second packet. In this way, the intelligent network card can obtain the context of the first connection only once and process multiple packets of the first connection based on this context, thereby improving the processing performance of a single stateful service.

[0063] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of the interaction between various devices. It can be understood that each device, such as the host and the intelligent network card. In order to implement the above functions, it includes the corresponding hardware structure and / or software module for executing each function. Those skilled in the art should easily realize that, combining the units and algorithm steps of each example described in the embodiments disclosed in this article, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in the way of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but this implementation should not be considered to exceed the scope of the present application.

[0064] Embodiments of the present application can divide the functional modules of the intelligent network card according to the above method examples. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one module. The above integrated module can be implemented in the form of hardware or in the form of a software functional module. It should be noted that the division of modules in the embodiments of the present application is illustrative, only a logical function division, and there can be other division methods in actual implementation. The following takes the example of dividing each functional module corresponding to each function for illustration.

[0065] In the case of adopting an integrated unit, Figure 6 FIG. shows a possible structural schematic diagram of the processing device for stateful services involved in the above embodiments. This device can be an intelligent network card or a chip built into the intelligent network card. The device includes: a preprocessing unit 601, an aggregation unit 602, a processing unit 603, and a sending unit 604. Among them, the preprocessing unit 601 is used to support the device to execute S201 in the above method embodiment; the aggregation unit 602 is used to support the device to execute S202 in the above method embodiment; the processing unit 603 is used to support the device to execute S203 in the above method embodiment; the sending unit 604 is used to support the device to execute S204 in the above method embodiment. Further, the device may further include: a bandwidth allocation unit 605, which is used to support the device to execute the step of allocating the receiving bandwidth in the above method embodiment.

[0066] In practical applications, the preprocessing unit 601 can be the pre-classification module in the intelligent network card described in the above method embodiment, the aggregation unit 602 can be the ICQ engine in the intelligent network card described in the above method embodiment, the processing unit 603 can be the processor pool in the intelligent network card described in the above method embodiment, the sending unit 604 can be the RV VM in the intelligent network card described in the above method embodiment, and the bandwidth allocation unit 605 can be the RX bandwidth allocation module in the intelligent network card described in the above method embodiment.

[0067] It should be noted that all relevant contents of each step involved in the above method embodiment can be cited in the function description of the corresponding functional module. Specifically, reference can be made to the description in the above method embodiment, and the embodiments of the present application will not be elaborated here.

[0068] On the basis of hardware implementation, the preprocessing unit 601, the aggregation unit 602, and the processing unit 603 in the present application can be integrated together as the processor of the device, and the sending unit 604 can be the communication interface of the device.

[0069] Such as Figure 7As shown in the figure, it is a possible schematic diagram of the logical structure of the processing device for stateful services involved in the above embodiments provided by the embodiments of the present application. The device may be a smart network card or a chip built into the smart network card. The device includes: a processor 702 and a communication interface 703. The processor 702 is used to control and manage the operations of the device. For example, the processor 702 is used to support the device to execute S201, S202, and S203 in the above method embodiments, and / or for other processes of the technologies described herein. In addition, the device may further include a memory 701 and a bus 704. The processor 702, the communication interface 703, and the memory 701 are interconnected through the bus 704. The communication interface 703 is used to support the device to communicate. For example, it supports the device to communicate with the host. The memory 701 is used to store the program code and data of the device.

[0070] Among them, the processor 702 may be a central processing unit, a general-purpose processor, a baseband processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array, or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute various exemplary logical blocks, modules, and circuits described in combination with the disclosure of the present application. The processor may also be a combination that realizes computing functions, such as a combination including one or more microprocessors, a combination of a digital signal processor and a microprocessor, etc. The bus 704 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus 704 may be divided into an address bus, a data bus, a control bus, etc. For the sake of simplicity of representation, Figure 7 only a thick line is used to represent it in the figure, but it does not mean that there is only one bus or one type of bus.

[0071] In another aspect of the present application, a communication system is provided. The communication system includes a network card and a host. The network card is connected to the host through a bus. Among them, the network card is any of the network cards provided above and is used to execute the steps of the network card in the above method embodiments.

[0072] In several embodiments provided by the present application, it should be understood that the disclosed device and method can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed.

[0073] The unit described as a separation component may or may not be physically separated. The component shown as a unit may be a single physical unit or multiple physical units, that is, it may be located in one place or distributed to multiple different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0074] In addition, in each embodiment of the present application, each functional unit may be integrated in a processing unit, may exist independently as individual physical units, or two or more units may be integrated in one unit. The above integrated unit may be implemented in the form of hardware or in the form of a software functional unit.

[0075] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. The readable storage medium may include: various media such as USB flash drives, mobile hard disks, read-only memories, random access memories, magnetic disks, or optical discs that can store program codes. Based on such an understanding, the technical solution of the embodiment of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product.

[0076] In another embodiment of the present application, a readable storage medium is further provided. Computer-executable instructions are stored in the readable storage medium. When a device (which can be a single-chip microcomputer, a chip, etc.) or a processor executes the processing method of the stateful service provided by the above method embodiment.

[0077] In another embodiment of the present application, a computer program product is further provided. The computer program product includes computer-executable instructions. The computer-executable instructions are stored in a computer-readable storage medium. At least one processor of the device can read the computer-executable instructions from the computer-readable storage medium, and at least one processor executes the computer-executable instructions to enable the device to execute the processing method of the stateful service provided by the above method embodiment.

[0078] Finally, it should be noted that the above are only specific embodiments of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A method for processing stateful services, characterized in that Applied to a network card, the network card is connected to a host, and the method includes: Preprocess the received first packet to obtain the aggregation information of the first packet; Aggregate the first packet into a first queue according to the aggregation information of the first packet. The first queue is used to aggregate the packets of a first connection to which the first packet belongs, and the first connection is a connection where a stateful service is located. Among them, aggregating the first packet into the first queue according to the aggregation information of the first packet includes: when the aggregation information of the first packet does not meet the aggregation context of the first queue, aggregating the first packet as a basic node onto the Y chain of the first queue, and updating the aggregation context of the first queue according to the aggregation information of the first packet. The aggregation context of the first queue is used to indicate the aggregation information of the first queue; When a preset condition is met, process the multiple packets aggregated in the first queue according to the context of the first connection to obtain a second packet. The context of the first connection is used to indicate the relevant information of the first connection, and the context of the first connection is the context updated after obtaining the previous second packet of the first connection; Send the second packet to the host.

2. The method according to claim 1, wherein The aggregation information of the first packet includes at least one of the following: the identifier of the first connection, the function identifier, and the metadata.

3. The method according to claim 1, characterized in that The aggregating the first packet into the first queue according to the aggregation information of the first packet further includes: When the aggregation information of the first packet meets the aggregation context of the first queue, aggregate the first packet as an aggregation node onto the X chain of the first queue.

4. The method according to claim 3, characterized in that The processing the multiple packets in the first queue includes: Editing and chaining multiple packets belonging to the same X chain in the first queue.

5. The method according to claim 1, characterized in that The preset condition includes any one of the following: the aggregation duration reaches a specified duration, the number of aggregated packets reaches a preset threshold, and the amount of aggregated data reaches a preset data volume.

6. The method according to any one of claims 1-5, characterized in that, The method further includes: Allocating a receive bandwidth for the first queue from the available bus bandwidth; Correspondingly, the sending the second packet to the host includes: sending the second packet to the host using the receive bandwidth.

7. A processing device for stateful services, characterized in that, Applied to a network card, the network card is connected to a host, and the device includes: A preprocessor unit for preprocessing the received first packet to obtain the aggregation information of the first packet; An aggregation unit for aggregating the first packet into a first queue according to the aggregation information of the first packet. The first queue is used to aggregate the packets of a first connection to which the first packet belongs, and the first connection is a connection where a stateful service is located. Among them, the aggregation unit is further used for: when the aggregation information of the first packet does not meet the aggregation context of the first queue, aggregating the first packet as a basic node onto the Y chain of the first queue, and updating the aggregation context of the first queue according to the aggregation information of the first packet. The aggregation context of the first queue is used to indicate the aggregation information of the first queue; A processing unit, configured to process multiple packets aggregated in the first queue according to the context of the first connection to obtain a second packet when a preset condition is met, where the context of the first connection is used to indicate relevant information of the first connection, and the context of the first connection is an updated context after obtaining the previous second packet of the first connection; A sending unit, configured to send the second packet to the host.

8. The device according to claim 7, characterized in that, The aggregation information of the first packet includes at least one of the following: an identifier of the first connection, a function identifier, and metadata.

9. The device according to claim 7, wherein The aggregation unit is further configured to: When the aggregation information of the first packet meets the aggregation context of the first queue, aggregate the first packet as an aggregation node to the X chain of the first queue.

10. The device according to claim 9, characterized in that, The processing unit is further configured to: Edit and concatenate multiple packets belonging to the same X chain in the first queue.

11. The device according to claim 7, characterized in that, The preset condition includes any one of the following: the aggregation duration reaches a specified duration, the number of aggregated packets reaches a preset threshold, and the aggregated data volume reaches a preset data volume.

12. The device according to any one of claims 7-11, characterized in that, The apparatus further includes: A bandwidth allocation unit, configured to allocate receive bandwidth for the first queue from the available bus bandwidth; Correspondingly, the sending unit is further configured to: send the second packet to the host using the receive bandwidth.

13. A processing device for stateful services, characterized in that, The processing apparatus for the stateful service is a network card or a chip built in the network card. The apparatus includes: a memory, and a processor coupled to the memory. Code and data are stored in the memory, and the processor runs the code in the memory so that the apparatus executes the stateful service processing method according to any one of claims 1-6.

14. A computer-readable storage medium, characterized in that, Instructions are stored in the computer-readable storage medium, and when running on a computer, cause the computer to execute the stateful service processing method according to any one of claims 1-6.

15. A computer program product, characterized in that, When the computer program product runs on a device, cause the device to execute the stateful service processing method according to any one of claims 1-6.

Citation Information

Patent Citations

  • Method and system for transparent TCP offload

    CN101253745A