Packet processing method, device and storage medium
By obtaining event notification information from the smart network interface card (NIC) and directly accessing the data queue of packets to be sent, the latency problem caused by polling one by one by the virtual switch is solved, achieving efficient packet processing and resource optimization.
Patent Information
- Application Number
- CN202310097109.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-20
- Publication Date
- 2026-01-16
- Estimated Expiration
- 2043-01-20
AI Technical Summary
In cloud computing, the process of virtual switches polling network interface card queues one by one during network virtualization results in significant packet processing delays, especially when there are a large number of virtual machines and virtual network interfaces on the host, some packets in the queues cannot be processed in a timely manner.
By obtaining event notification information from the smart network interface card, the data queues containing messages to be sent can be identified, and these queues can be accessed directly to obtain and send messages, avoiding polling all queues one by one.
It greatly reduces message processing latency, improves message transmission efficiency, reduces CPU pressure, and optimizes resource consumption.
Smart Images

Figure CN116132382B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of cloud computing, and in particular to a message processing method, device and storage medium. BACKGROUND
[0002] With the development of cloud computing, cloud vendors provide more and more computing virtualization, network virtualization and storage virtualization for cloud hosts (virtual machines). In order to solve the problem of "data center virtualization tax" caused by these virtualization overheads, current cloud vendors generally use an intelligent network card solution to sink related virtualization components such as network virtualization, computing virtualization and storage virtualization to the intelligent network card.
[0003] In some typical scenarios, a virtual switch can be deployed on the intelligent network card to implement network virtualization. In this way, the virtual network card of the virtual machine on the host can deliver messages to the intelligent network card through multiple network card queues, and the virtual switch on the intelligent network card can collect messages of each network card queue in turn through polling, and then send them out through the physical network card of the host. However, the delay caused by the process of collecting and sending messages by the virtual switch is large. Therefore, a new solution is needed. SUMMARY
[0004] Aspects of the present application provide a message processing method, device and storage medium to reduce the message processing delay caused by network virtualization.
[0005] The present application provides a message processing method, comprising: obtaining event notification information from a network device; determining at least one data queue containing a to-be-sent message from data queues on the network device according to the event notification information; accessing the at least one data queue to obtain the to-be-sent message; and sending the to-be-sent message to a destination address through a sending port corresponding to the to-be-sent message.
[0006] Optionally, determining at least one data queue containing a to-be-sent message from data queues of the network device according to the event notification information comprises: obtaining at least one queue identifier from an event queue; any queue identifier is stored in the event queue when a message enqueuing event occurs in the data queue corresponding to the queue identifier; and determining the at least one data queue containing the to-be-sent message from the data queues of the network device according to the at least one queue identifier.
[0007] Optionally, before obtaining the event notification information from the network device, the method further comprises: obtaining any packet and a first queue identifier of a network card queue on a host side from a convergence queue on the network device; storing the packet in a target data queue corresponding to the first queue identifier on the network device; the target data queue is a software data queue; generating a notification event corresponding to the target data queue, and adding the notification event and a second queue identifier of the target queue to the event queue.
[0008] Optionally, the convergence queue of the network device comprises: a hardware convergence queue corresponding to each of a plurality of processors on the network device; and the event queue comprises: a software event queue corresponding to each of the plurality of processors on the network device.
[0009] The embodiments of the present application further provide a packet processing method, comprising: obtaining a to-be-sent packet from a network card queue on a host side; storing the to-be-sent packet in a target data queue corresponding to the network card queue on a network device; and generating event notification information corresponding to the target data queue, so that a virtual switch accesses the target data queue and obtains the to-be-sent packet according to the event notification information.
[0010] Optionally, the storing of the to-be-sent packet in the target data queue on the network device corresponding to the network card queue comprises: determining a hardware data queue corresponding to the network card queue from hardware data queues of the network device as the target data queue, and storing the to-be-sent packet in the target data queue; or storing the to-be-sent packet and a first queue identifier of the network card queue in a convergence queue on the network device, so that the virtual switch accesses the to-be-sent packet through the convergence queue and stores the to-be-sent packet in the target data queue corresponding to the first queue identifier on the network device.
[0011] Optionally, the generating of the event notification information corresponding to the target data queue comprises: generating a notification event of the target data queue; and writing the notification event and a second queue identifier corresponding to the target data queue into an event queue.
[0012] The embodiment of the present application further provides a packet processing method, which is applied to an intelligent network card, and a virtual switch runs on the intelligent network card; the method comprises the following steps: storing a to-be-sent packet obtained by using a network card hardware in at least one data queue, and generating event notification information; determining the at least one data queue containing the to-be-sent packet from the data queue of the intelligent network card according to the event notification information by using the virtual switch; accessing the at least one data queue to obtain the to-be-sent packet by using the virtual switch; and sending the to-be-sent packet to a destination address through a sending port corresponding to the to-be-sent packet by using the virtual switch. The embodiment of the present application further provides a network device, which comprises a memory and a processor; the memory is used for storing one or more computer instructions; and the processor is used for executing the one or more computer instructions to execute the steps in the method provided by the embodiment of the present application.
[0013] The embodiment of the present application further provides a computer readable storage medium storing a computer program, and the computer program can realize the steps in the method provided by the embodiment of the present application when executed by a processor.
[0014] In the packet processing method provided by the embodiment of the present application, the virtual switch in the network device can obtain event notification information from the network device, and determine at least one data queue containing the to-be-sent packet from the data queue of the network device according to the event notification information. Further, the virtual switch can access the at least one data queue to obtain the to-be-sent packet, and send the to-be-sent packet to a destination address. In this implementation, the virtual switch only needs to access the data queue containing the to-be-sent packet, and does not need to access all data queues one by one, which greatly reduces the processing delay of the packet. BRIEF DESCRIPTION OF DRAWINGS
[0015] The accompanying drawings, which are included to provide a further understanding of the present application and constitute a part of this application, illustrate certain illustrative embodiments of the present application and assist in explaining the present application. In the drawings:
[0016] Figure 1 A flowchart of a packet processing method provided by an illustrative embodiment of the present application is shown in the figure;
[0017] Figure 2 A structure diagram of an intelligent network card provided by an illustrative embodiment of the present application is shown in the figure;
[0018] Figure 3 A diagram of a virtual switch in an intelligent network card provided by an illustrative embodiment of the present application receiving and sending packets is shown in the figure;
[0019] Figure 4A process diagram for collecting a packet by an intelligent network card is provided for an exemplary embodiment of the present application;
[0020] Figure 5 A process diagram for collecting a packet by an intelligent network card is provided for another exemplary embodiment of the present application;
[0021] Figure 6 A flow diagram of a packet processing method is provided for another exemplary embodiment of the present application;
[0022] Figure 7 A flow diagram of a packet processing method is provided for another exemplary embodiment of the present application;
[0023] Figure 8 A structure diagram of a network device is provided for an exemplary embodiment of the present application;
[0024] Figure 9 A structure diagram of an intelligent network card is provided for an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0025] In order to make the objects, technical solutions and advantages of the present application clearer, the technical solutions of the present application will be described below in conjunction with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of protection of the present application.
[0026] The terms used in the embodiments of the present application are only for the purpose of describing the specific embodiments, and are not intended to limit the present application. The singular forms "a", "an" and "the" used in the embodiments of the present application and the appended claims are also intended to include the plural forms, unless the context clearly indicates otherwise. "Multiple" generally includes at least two, but does not exclude the case of including at least one.
[0027] It should be understood that the term "and / or" used herein is only to describe the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B, which can represent the three cases of A alone, A and B together, and B alone. In addition, the character " / " in this paper generally represents that the front and rear associated objects are a "or" relationship.
[0028] It is also to be noted that the terms "comprising", "including", and any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises a... " does not, without more constraints, exclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the element.
[0029] In a network virtualization scenario, when a virtual switch is deployed on a smart network card, the virtual network card of a virtual machine on a host can deliver a packet to the smart network card through a plurality of network card queues. The virtual switch on the smart network card can collect the packet of each network card queue in turn through polling, and then send out through the physical network card of the host. When there are too many virtual machines on the host or too many virtual network cards of the virtual machines, the number of network card queues to be polled on the whole host will be large. At this time, when the virtual switch polls the network card queues one by one, the packet in part of the queues cannot be processed in time, thereby causing large delay.
[0030] In view of the technical problem in the prior art that when the virtual switch polls the network card queues one by one, the packet in part of the queues cannot be processed in time, thereby causing large delay, in some embodiments of the present application, a solution is provided, and the technical solution provided by each embodiment of the present application is described in detail below with reference to the drawings.
[0031] Figure 1 is a flowchart of a packet processing method provided by an exemplary embodiment of the present application. The method can include the steps as shown in Figure 1 .
[0032] Step 101, using a network card hardware, storing a to-be-sent packet obtained in at least one data queue, and generating event notification information.
[0033] Step 102, using the virtual switch, determining, according to the event notification information, the at least one data queue containing the to-be-sent packet from the data queue of the smart network card.
[0034] Step 103, using the virtual switch, accessing the at least one data queue to obtain the to-be-sent packet.
[0035] Step 104, using the virtual switch, sending the to-be-sent packet to a destination address through a sending port corresponding to the to-be-sent packet.
[0036] The execution subject of the embodiment can be a smart NIC (Smart NIC, also known as a smart network interface controller). The smart NIC can assist the CPU (central processing unit) in processing network load through a hardware programmable device, and program network interface functions. In a virtualization scenario, the smart NIC can offload part of the operations performed by the CPU on the host (HOST) to the network card hardware for execution. For example, after installing the smart NIC on the host, the traffic forwarding and network processing operations on the host can be offloaded to the network card hardware of the smart NIC to reduce the pressure on the host. In addition to the smart NIC, in some optional embodiments, the execution subject of the embodiment can also be used in a DPU (Data Processing Unit), an IPU (infrastructure Processing Units), a CIPU (Cloud infrastructure Processing Units), or other soft and hard combined devices, and the embodiment does not make any limitation. In the following, the smart NIC will be taken as an example for illustrative description.
[0037] As shown in Figure 2 , the smart NIC generally includes a software part and a hardware part. The software part includes a CPU and a software component running on the CPU. The software component can include at least one of a network virtualization component, a storage virtualization component, and a computing virtualization component to reduce the virtualization overhead of the host. The network virtualization component can include a virtual switch. The hardware part of the smart NIC can include a hardware programmable device, which can include but is not limited to at least one of an FPGA (Field Programmable Gate Array), an ASIC (Application Specific Integrated Circuit), and an NP (Network Processor). The hardware part described above can be used to accelerate or offload the processing logic of the related components on the software part.
[0038] In the smart NIC, the virtual switch is mainly used to connect multiple devices (such as virtual machines on the host and external devices) to the network, and to forward the data sent by the source device to the destination device through packet switching. As Figure 3As shown, the host includes multiple virtual machines (VMs), and the VMs generate packets which are sent to the intelligent network card through queues. The virtual switch can obtain the packets from the queues and send the packets to the destination address through the MAC (Media Access Control Address) queue of the physical network card.
[0039] In this embodiment, the virtual switch can obtain event notification information from the intelligent network card. The event notification information is used to indicate that there is a packet to be sent on the intelligent network card. The event notification information can be cached on the network card hardware or in the memory of the CPU, and the present embodiment does not make any limitation.
[0040] The virtual switch can determine at least one data queue containing the packet to be sent from the data queues of the intelligent network card according to the event notification information, and access the at least one data queue to obtain the packet to be sent. After determining the packet to be sent, the virtual switch can send the packet to be sent to the destination address through the sending port of the packet. The virtual switch can cache the mapping relationship between the source MAC address and the destination MAC address of the data. When sending any packet, the virtual switch can query the mapping relationship to determine the destination MAC address corresponding to the packet, and send the packet according to the port corresponding to the destination MAC address.
[0041] In this embodiment, the virtual switch in the intelligent network card can obtain event notification information from the intelligent network card, and determine at least one data queue containing the packet to be sent from the data queues of the intelligent network card according to the event notification information. Further, the virtual switch can access the at least one data queue to obtain the packet to be sent, and send the packet to the destination address. In this implementation, the virtual switch only needs to access the data queue containing the packet to be sent, without polling and accessing all data queues one by one, which greatly reduces the processing delay of the packet.
[0042] In some exemplary embodiment A, the network card hardware on the intelligent network card can obtain the packet to be sent from the network card queue on the host side in a direct memory access (DMA) manner. The following will be exemplarily described by taking any packet as an example.
[0043] Alternatively, the network card hardware can obtain any packet from any network card queue on the host side in a DMA manner, and store the packet in the target data queue corresponding to the network card queue on the intelligent network card. The target data queue is any data queue in the at least one data queue containing the packet to be sent. The network card hardware can generate event notification information corresponding to the target data queue.
[0044] In some optional embodiments, the target data queue is a hardware queue on the side of the intelligent network card. The intelligent network card can include a plurality of hardware queues, which respectively correspond to the network card queues on the side of the host.
[0045] The hardware queue refers to a queue that is not dependent on the CPU and can be directly accessed by the network card hardware associated with the physical interface. The hardware queue satisfies the FIFO (First Input First Output) queue mechanism.
[0046] The network card hardware can determine the hardware data queue corresponding to the network card queue from the hardware data queues of the intelligent network card as the target data queue, and store the packet in the target data queue.
[0047] In this implementation, the hardware data queue can quickly send data without waiting for the CPU to process the interrupt, which can reduce the pressure on the CPU.
[0048] Optionally, to facilitate the storage of event notification messages, the intelligent network card can create an event queue for each CPU, which can be a hardware queue.
[0049] In some exemplary embodiments, when generating the event notification information corresponding to the target data queue, the network card hardware can generate the event information corresponding to the target data queue, and add the event information and the second queue identifier of the target data queue in the event queue of the CPU corresponding to the target data queue, to obtain the event notification information corresponding to the target data queue.
[0050] That is, on the basis of the above-mentioned implementation A, after the intelligent network card adds the packet to the hardware data queue, the event information of the hardware data queue can be generated, and the event information and the identifier of the hardware data queue can be added in the event queue.
[0051] Correspondingly, in some exemplary embodiments, the virtual switch can poll the event queue on the intelligent network card to obtain the respective queue identifiers of the at least one data queue containing the packets to be sent. The virtual switch can determine the at least one data queue containing the packets to be sent from the data queues of the intelligent network card according to the respective queue identifiers of the at least one data queue.
[0052] The following will be described in conjunction with the accompanying drawings Figure 4 The above-mentioned implementation A will be further described.
[0053] As Figure 4As shown, the host includes a plurality of network card queues, and the messages generated by the virtual machine on the host can be temporarily stored in the network card queues. The network card hardware on the intelligent network card can store the messages in the network card queues into the corresponding hardware data queues on the intelligent network card in a DMA manner. On the intelligent network card, each CPU core can correspond to an event queue. As shown, Figure 4 As shown, the kernel 1 and the kernel 2 of the CPU correspond to an event queue, respectively. After the network card hardware stores the message into the hardware data queue corresponding to the kernel 1, an event information can be generated to the event queue corresponding to the kernel 1. After the network card hardware stores the message into the hardware data queue corresponding to the kernel 2, an event information can be generated to the event queue corresponding to the kernel 2. The event information can include the identifier of the network card queue corresponding to the message on the host side, for example, the qid (queue Identity document, queue number) of the network card queue. The virtual switch on the intelligent network card can poll the event queue of the corresponding CPU. When the event information is found in the event queue, the virtual switch can take out the corresponding event information, and according to the identifier of the network card queue in the event information, the message can be collected from the data queue corresponding to the identifier of the network card queue on the network card hardware.
[0054] Based on the above embodiment, the effect that the delay of the virtual switch is independent of the number of data queues is achieved, and the message processing delay is effectively reduced.
[0055] In some optional embodiments B, the target data queue can be a software queue on the intelligent network card side. The virtual switch can pre-establish a plurality of software queues on the intelligent network card, and the plurality of software queues correspond to the network card queues on the host side, respectively.
[0056] The software queue refers to a processing queue that can be configured by the CPU core, and the software queue can be managed by the user. The software queue and the core of the CPU can be bound, and the message processed by the CPU core can be directly sent to the corresponding software queue. The virtual switch running on the CPU can create one or more software queues.
[0057] When the network card hardware stores the message in the target data queue, the network card hardware can store the message and the first queue identifier of the network card queue corresponding to the message on the host side in the hardware aggregation queue on the intelligent network card. The virtual switch polls and accesses the hardware aggregation queue according to the set period, and obtains the message and the first queue identifier. The virtual switch can store the accessed message in the target data queue corresponding to the first queue identifier on the intelligent network card, and the target data queue is a software data queue.
[0058] In this embodiment, fewer hardware queues need to be created on the intelligent network card side, and the consumption of the hardware resources on the intelligent network card side is reduced.
[0059] In some exemplary embodiments, when generating event notification information corresponding to a target data queue, the network interface card hardware can generate event information corresponding to the target data queue, and add the event information and the second queue identifier of the target data queue to the event queue of the CPU corresponding to the target data queue to obtain the event notification information corresponding to the target data queue.
[0060] That is, based on the above implementation method B, after the smart network card adds the packet to the software's data queue, it can generate event information according to the identifier of the software's data queue, and add the event information and the identifier of the software's data queue to the event queue.
[0061] Accordingly, in some exemplary embodiments, the virtual switch can poll the event queues on the smart network interface card (NIC) to obtain queue identifiers for at least one data queue containing packets to be sent. The virtual switch can then determine the at least one data queue containing the packets to be sent from the data queues of the smart NIC based on the queue identifiers of the at least one data queue.
[0062] The following will be combined with the appendix Figure 5 The above-described implementation method B will be further explained.
[0063] like Figure 5 As shown, the host contains several network interface card (NIC) queues. Packets generated by virtual machines on the host can be temporarily stored in these NIC queues. The smart NIC's NIC hardware can provide a hardware aggregation queue. Each CPU core can correspond to one aggregation queue. Multiple NIC queues on the host side can be mapped to a single hardware aggregation queue on the smart NIC side. The NIC hardware can use DMA (Distributed Memory Access) to temporarily store packets from NIC queues to the corresponding hardware aggregation queues based on the mapping relationship between NIC queues and hardware aggregation queues, and carry the identifier of the host-side NIC queue (e.g., qid) in the packet descriptor. In this implementation, data from multiple NIC queues on multiple host sides can be aggregated into a single hardware aggregation queue on the smart NIC.
[0064] like Figure 5As shown, the virtual switch can create an event queue of software and a plurality of software data queues, wherein the software data queues have one-to-one correspondence with the host-side network card queues. The virtual switch can poll the hardware aggregation queue on the corresponding CPU. If the hardware aggregation queue contains a packet, the packet is taken out from the hardware aggregation queue and enqueued into the corresponding software data queue for temporary storage according to the identification of the network card queue carried by the packet. While the virtual switch puts the packet into the software data queue, an event information is generated and put into the event queue. The event information contains the identification of the software data queue where the packet is put into. The virtual switch can poll the software event queue and, when it is determined that there is an event in the software event queue, take the event out from the software event queue and access the corresponding software data queue according to the identification of the software data queue corresponding to the event to take the packet out from the software data queue.
[0065] In this implementation, each CPU of the virtual switch only needs to poll one aggregation queue and software event queue to determine the data queue containing the packet to be sent, and all the data queues do not need to be polled. In this implementation, the event queue is not dependent on hardware, which reduces resource consumption and further reduces the impact of multi-queue on latency.
[0066] In addition to the foregoing embodiments, the embodiments of the present application also provide a packet processing method, which can be executed by a virtual switch running on a network device. The network device can include but is not limited to a network card, a gateway, a router, a network bridge, etc. The embodiments of the present application do not make any limitation. The following will be exemplarily described with reference to the accompanying drawings.
[0067] Figure 6 The flowchart of the packet processing method provided by another exemplary embodiment of the present application is shown in FIG. 6, which includes the following steps. Figure 6
[0068] Step 601: obtaining event notification information from a network device.
[0069] Step 602: determining at least one data queue containing a packet to be sent from data queues on the network device according to the event notification information.
[0070] Step 603: accessing the at least one data queue to obtain the packet to be sent.
[0071] Step 604: sending the packet to be sent to a destination address through a sending port corresponding to the packet to be sent.
[0072] The event notification information is used to indicate that there is a packet to be sent in part of the data queues on the network device, and the part of the data queues includes one or more data queues.
[0073] The event notification information can be generated by the network device or obtained by the network device from an external device. For example, in some embodiments, the network device can receive a packet from a connected external device, which can be the device that generates the packet. After receiving the packet, the network device can generate an event notification message corresponding to the packet. For another example, in some other embodiments, after the external device generates a packet, the external device can send the packet and an event notification message corresponding to the packet to the network device. The network device can receive the packet and the event notification information corresponding to the packet and save them locally.
[0074] In some example embodiments, a manner of determining, according to the event notification information, at least one data queue containing the packet to be sent from the data queues of the network device can include: obtaining at least one queue identifier from an event queue; any queue identifier is stored in the event queue when a packet enqueue event occurs in the data queue corresponding to the queue identifier; and determining, according to the at least one queue identifier, the at least one data queue containing the packet to be sent from the data queues of the network device.
[0075] The queue identifier in the event queue can be added by other components in the network device. For example, it can be added by a hardware component in the network device when the received packet is enqueued. The queue identifier in the event queue can also be added by a virtual switch. In some example embodiments, before obtaining the event notification information from the network device, the method further includes: obtaining any packet from a host-side network card queue and a first queue identifier of the network card queue from a convergence queue on the network device; storing the packet in a target data queue corresponding to the first queue identifier on the network device; the target data queue is a software data queue; generating a notification event corresponding to the target data queue, and adding the notification event and a second queue identifier of the target queue to the event queue.
[0076] In some example embodiments, the convergence queue of the network device includes: a hardware convergence queue corresponding to each of a plurality of processors on the network device; and the event queue includes: a software event queue corresponding to each of the plurality of processors on the network device.
[0077] In this embodiment, the virtual switch in the network device can obtain event notification information from the network device, and determine at least one data queue containing the to-be-sent packet from the data queues of the network device according to the event notification information. Further, the virtual switch can access the at least one data queue to obtain the to-be-sent packet, and send the to-be-sent packet to the destination address. In this implementation, the virtual switch only needs to access the data queue containing the to-be-sent packet, without polling and accessing all data queues one by one, which greatly reduces the processing delay of the packet.
[0078] In addition to the foregoing embodiments, the present application also provides a packet processing method, which can be executed by a hardware component on a network device. The network device can include but is not limited to a network card, a gateway, a router, a network bridge, and the like, and the present application does not make any limitation. The following will be exemplarily described with reference to the accompanying drawings.
[0079] Figure 7 A flowchart of a packet processing method provided by another exemplary embodiment of the present application is shown in FIG. 7, which includes the following steps. Figure 7
[0080] Step 701: Obtain a to-be-sent packet from a network card queue on a host side.
[0081] Step 702: Store the to-be-sent packet in a target data queue on a network device corresponding to the network card queue.
[0082] Step 703: Generate event notification information corresponding to the target data queue, so that a virtual switch accesses the target data queue and obtains the to-be-sent packet according to the event notification information.
[0083] In some exemplary embodiments, a way of storing the to-be-sent packet in the target data queue on the network device corresponding to the network card queue can include: determining a hardware data queue corresponding to the network card queue from hardware data queues of the network device as the target data queue, and storing the to-be-sent packet in the target data queue. Another way of storing the to-be-sent packet in the target data queue on the network device corresponding to the network card queue can include: storing the to-be-sent packet and a first queue identifier of the network card queue in a convergence queue on the network device, so that the virtual switch obtains the to-be-sent packet through the convergence queue and stores the to-be-sent packet in the target data queue on the network device corresponding to the first queue identifier.
[0084] In some example embodiments, a way of generating the event notification information corresponding to the target data queue can include: generating a notification event of the target data queue; and writing the notification event and the second queue identifier corresponding to the target data queue into an event queue.
[0085] In this embodiment, the network device can store the packet in the data queue when obtaining the packet to be sent, and generate event notification information. Further, the virtual switch can access the data queue containing the packet to be sent from the data queue of the network device according to the event notification information, to obtain the packet to be sent. In this implementation, the virtual switch only needs to access the data queue containing the packet to be sent, without polling and accessing all data queues one by one, which greatly reduces the processing delay of the packet.
[0086] It should be noted that the execution subject of each step of the method provided in the above embodiments can be the same device, or the method can also be executed by different devices as the execution subject. For example, the execution subject of steps 101 to 104 can be device A; for another example, the execution subject of steps 101 and 102 can be device A, and the execution subject of step 103 can be device B; and the like.
[0087] In addition, in some of the processes described in the above embodiments and the accompanying drawings, a plurality of operations appearing in a certain order are included, but it should be clear that these operations can be executed or in parallel without following the order in which they appear in this text. The serial numbers of the operations, such as 101, 102, etc., are only used to distinguish different operations, and the serial numbers themselves do not represent any execution order. In addition, these processes can include more or fewer operations, and the operations can be executed in sequence or in parallel. It should be noted that the "first", "second", etc. in this text are used to distinguish different messages, devices, modules, etc., and do not represent the order of precedence. Also, "first" and "second" are not of different types.
[0088] Figure 8 The structure of the network device provided by an example embodiment of the present application is shown in the structure diagram of the network device. As shown in Figure 8 The network device includes a memory 801, a processor 802, and a communication component 803.
[0089] The memory 801 is used to store computer programs and can be configured to store other various data to support operations on the network device. Examples of these data include instructions for operating any application or method on the network device.
[0090] The processor 802 is coupled with the memory 801 and is configured to execute the computer program in the memory 801 to: acquire event notification information from the network device; determine at least one data queue containing a to-be-sent packet from data queues on the network device according to the event notification information; access the at least one data queue to acquire the to-be-sent packet; and send the to-be-sent packet to a destination address through a sending port corresponding to the to-be-sent packet.
[0091] Optionally, when determining the at least one data queue containing the to-be-sent packet from the data queues on the network device according to the event notification information, the processor 802 is specifically configured to: acquire at least one queue identifier from an event queue; any queue identifier is stored in the event queue when a packet enqueue event occurs in a data queue corresponding to the queue identifier; and determine the at least one data queue containing the to-be-sent packet from the data queues on the network device according to the at least one queue identifier.
[0092] Optionally, before acquiring the event notification information from the network device, the processor 802 is further configured to: acquire any packet from a host-side network card queue and a first queue identifier of the network card queue from a convergence queue on the network device; store the packet in a target data queue corresponding to the first queue identifier on the network device; the target data queue is a software data queue; generate a notification event corresponding to the target data queue, and add the notification event and a second queue identifier of the target queue to the event queue.
[0093] Optionally, the convergence queue of the network device includes: hardware convergence queues corresponding to a plurality of processors on the network device respectively; and the event queue includes: software event queues corresponding to the plurality of processors on the network device respectively.
[0094] Further, as shown in Figure 8 The network device further includes: a power supply component 804 and other components. Figure 8 Some components are only schematically shown in the network device, and it does not mean that the network device only includes Figure 8 the components shown.
[0095] In this implementation, the processor 802 can be implemented as a CPU.
[0096] In this embodiment, the virtual switch in the network device can obtain event notification information from the network device, and determine at least one data queue containing the to-be-sent packet from the data queues of the network device according to the event notification information. Further, the virtual switch can access the at least one data queue to obtain the to-be-sent packet, and send the to-be-sent packet to the destination address. In this implementation, the virtual switch only needs to access the data queue containing the to-be-sent packet, without polling and accessing all data queues one by one, which greatly reduces the processing delay of the packet.
[0097] In addition to the foregoing embodiments, Figure 8 The network device shown can also perform the following packet processing logic:
[0098] The processor 802 is configured to: obtain a to-be-sent packet from a network card queue on the host side; store the to-be-sent packet in a target data queue on the network device corresponding to the network card queue; and generate event notification information corresponding to the target data queue, so that a virtual switch accesses the target data queue and obtains the to-be-sent packet according to the event notification information.
[0099] Optionally, when storing the to-be-sent packet in the target data queue on the network device corresponding to the network card queue, the processor 802 is specifically configured to: determine a hardware data queue corresponding to the network card queue from the hardware data queues of the network device as the target data queue, and store the to-be-sent packet in the target data queue; or store the to-be-sent packet and a first queue identifier of the network card queue in a convergence queue on the network device, so that the virtual switch obtains the to-be-sent packet through the convergence queue and stores the to-be-sent packet in the target data queue on the network device corresponding to the first queue identifier.
[0100] Optionally, when generating the event notification information corresponding to the target data queue, the processor 802 is specifically configured to: generate a notification event of the target data queue; and write the notification event and a second queue identifier corresponding to the target data queue into an event queue.
[0101] In this implementation, the processor 802 can be implemented as an FPGA or an ASIC.
[0102] In this embodiment, the network device can store the message in the data queue when obtaining the message to be sent, and generate event notification information. Further, the virtual switch can access the data queue containing the message to be sent from the data queue of the network device according to the event notification information, to obtain the message to be sent. In this implementation, the virtual switch only needs to access the data queue containing the message to be sent, without polling and accessing all data queues one by one, which greatly reduces the processing delay of the message.
[0103] In addition to the foregoing embodiments, the embodiments of the present application also provide an intelligent network card, as shown in the following figure: Figure 9 As shown in the figure, the intelligent network card comprises:
[0104] The first processor 901, the second processor 902, the memory 903, the communication component 904, and the power supply component 905.
[0105] The memory 903 is configured to store computer programs and can be configured to store other various data to support operations on the intelligent network card. Examples of these data include instructions for any application program or method operating on the intelligent network card.
[0106] The first processor 901 is configured to store the obtained message to be sent in at least one data queue, and generate event notification information.
[0107] The second processor 902 is configured to execute one or more computer instructions in the memory 903, to determine the at least one data queue containing the message to be sent from the data queue of the intelligent network card according to the event notification information, access the at least one data queue to obtain the message to be sent, and use the virtual switch to send the message to be sent to the destination address through the sending port corresponding to the message to be sent.
[0108] Optionally, the first processor 901 can obtain any message from any network card queue on the host side in the form of DMA, and store the message in the target data queue on the intelligent network card corresponding to the network card queue. The target data queue is any data queue in the at least one data queue containing the message to be sent. The first processor 901 can generate event notification information corresponding to the target data queue.
[0109] Optionally, when generating the event notification information corresponding to the target data queue, the first processor 901 is specifically configured to generate a notification event corresponding to the target data queue, add the notification event to an event queue, and add a second queue identifier of the target data queue in the event queue to obtain the event notification information corresponding to the target data queue.
[0110] Optionally, the first processor 901 is configured to store the packet and a first queue identifier of a corresponding network card queue on a host side in a hardware aggregation queue on the intelligent network card when storing the packet in the target data queue. The second processor 902 is configured to access the hardware aggregation queue to obtain the packet and the first queue identifier, and store the obtained packet in the target data queue corresponding to the first queue identifier on the intelligent network card, the target data queue being a software data queue.
[0111] In this embodiment, the first processor in the intelligent network card can store a packet in a data queue and generate event notification information when obtaining the packet to be sent. The second processor in the intelligent network card can obtain the event notification information from the intelligent network card, and determine at least one data queue containing the packet to be sent from the data queue of the intelligent network card according to the event notification information. Further, the virtual switch can access the at least one data queue to obtain the packet to be sent, and send the packet to be sent to a destination address. In this implementation, the virtual switch only needs to access the data queue containing the packet to be sent, without polling and accessing all data queues one by one, which greatly reduces the processing delay of the packet.
[0112] Correspondingly, the embodiment of the present application also provides a computer readable storage medium storing a computer program, which can implement each step that can be executed by the intelligent network card when the computer program is executed.
[0113] In Figure 8 and Figure 9 The memory can be implemented by any type of volatile or nonvolatile storage devices or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.
[0114] In Figure 8 and Figure 9In this embodiment, the communication component is configured to facilitate wired or wireless communication between the device containing the communication component and other devices. The device containing the communication component can access wireless networks based on communication standards, such as WiFi, 2G, 3G, 4G, or 5G, or combinations thereof. In one exemplary embodiment, the communication component receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, the communication component may be implemented based on Near Field Communication (NFC), Radio Frequency Identification (RFID), Infrared Data Association (IrDA), Ultra Wideband (UWB), Bluetooth (BT), and other technologies.
[0115] exist Figure 8 as well as Figure 9 In this context, a power supply component is used to provide power to various components of the device in which it resides. A power supply component may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device in which it resides.
[0116] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0117] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0118] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0119] These computer program instructions can also be loaded into computer or other programmable data processing devices to cause a series of operational steps to be performed on the computer or other programmable devices to produce a computer implemented process such that the instructions which execute on the computer or other programmable devices provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 Figure 1 One or more flowchart or block diagrams can be used to describe embodiments of the present application as can be set forth in the accompanying drawings. It will be understood that each block of the flowchart or block diagram, and combinations of blocks in the flowchart or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable device, implement the functions specified in the flowchart or block diagram block or blocks.
[0120] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0121] The memory can include non-persistent memory and / or persistent memory, such as flash memory, read-only memory (ROM), and / or other types of nonvolatile memory. The memory is an example of computer-readable media.
[0122] Computer-readable media includes permanent and non-permanent, removable and non-removable media, which can be implemented by any method or technology for storage of information such as computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD), or other optical storage, magnetic cassette, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible to a computing device. According to the definition herein, computer-readable media does not include transitory media such as modulated data signals and carriers.
[0123] It should also be noted that the terms "comprising", "containing", or any other variant thereof are intended to cover a non-exclusive inclusion, such that a process, method, article or apparatus that comprises a list of elements does not only include those elements, but can also include other elements not expressly listed or inherent to such process, method, article or apparatus. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of additional identical elements in the process, method, article or apparatus that includes the element.
[0124] The above merely provides an example of the present application, and is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. within the spirit and principle of the present application should be included in the scope of claims of the present application.
Claims
1. A method of processing a packet, the method comprising: The method comprises the following steps: obtaining event notification information from a network device; determining at least one data queue containing a message to be sent from the data queue of the network device according to the event notification information; accessing the at least one data queue to obtain the message to be sent; sending the message to be sent to a destination address through a sending port corresponding to the message to be sent; Before obtaining the event notification information from the network device, the method further comprises the following steps: obtaining any message from a network card queue on a host side and a first queue identifier of the network card queue from a convergence queue on the network device; 2. The method of claim 1, wherein, storing the message in a target data queue corresponding to the first queue identifier on the network device; the target data queue is a software data queue; generating a notification event corresponding to the target data queue, and adding the notification event and a second queue identifier of the target data queue to an event queue. According to the event notification information, determining at least one data queue containing a message to be sent from the data queue of the network device comprises the following steps: obtaining at least one queue identifier from the event queue; any queue identifier is stored in the event queue when a message entry event occurs in the data queue corresponding to the queue identifier; 3. The method of claim 1, wherein, determining the at least one data queue containing the message to be sent from the data queue of the network device according to the at least one queue identifier.
4. A method of processing a packet, the method comprising: The convergence queue of the network device comprises a hardware convergence queue corresponding to a plurality of processors on the network device; and the event queue comprises a software event queue corresponding to the plurality of processors on the network device. The method comprises the following steps: obtaining a message to be sent from a network card queue on a host side; storing the message to be sent in a target data queue corresponding to the network card queue on a network device, comprising: storing the message to be sent and a first queue identifier of the network card queue in a convergence queue on the network device, so that a virtual switch obtains the message to be sent through the convergence queue and stores the message to be sent in the target data queue corresponding to the first queue identifier on the network device; the target data queue is a software data queue; 5. The method of claim 4, wherein, generating event notification information corresponding to the target data queue, so that the virtual switch accesses the target data queue and obtains the message to be sent according to the event notification information; wherein generating the event notification information corresponding to the target data queue comprises: generating a notification event corresponding to the target data queue, and adding the notification event and a second queue identifier of the target data queue to an event queue. Storing the message to be sent in a target data queue corresponding to the network card queue on a network device comprises the following steps:
6. A packet processing method applied to a smart network card, comprising: determining a hardware data queue corresponding to the network card queue from the hardware data queue of the network device as the target data queue, and storing the message to be sent in the target data queue. The intelligent network card runs a virtual switch; the method comprises the following steps: The obtained to-be-sent packet is stored in at least one data queue by using a network card hardware, including: storing any packet obtained from a network card queue on a host side and a first queue identifier of the network card queue in a convergence queue on a network device; The packet and the first queue identifier of the network card queue are obtained from the convergence queue by using a virtual switch; the packet is stored in a target data queue corresponding to the first queue identifier on the network device, the target data queue being a software data queue; and event notification information is generated, including: generating a notification event corresponding to the target data queue, and adding the notification event and a second queue identifier of the target data queue to an event queue; The at least one data queue containing the to-be-sent packet is determined from data queues of the intelligent network card according to the event notification information by using the virtual switch; The to-be-sent packet is obtained by accessing the at least one data queue by using the virtual switch; The to-be-sent packet is sent to a destination address by using a sending port corresponding to the to-be-sent packet by using the virtual switch.
7. A network device, comprising: Comprise: a memory and a processor; the memory is used to store one or more computer instructions; the processor is used to execute the one or more computer instructions to execute the steps in the method of any one of claims 1-6.
8. A computer readable storage medium storing a computer program, characterized in that, The computer program is executed by the processor to implement the packet processing method of any one of claims 1-6.
Citation Information
Patent Citations
Data transmission system and related equipment
CN115080258A