Flow table management method, device, equipment, storage medium and program product
Patent Information
- Application Number
- CN202411703392.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2044-11-26
AI Technical Summary
若报文没有命中硬件流表时,则需要将报文上送至CPU处理,再将该报文对应的处理规则下发到底层硬件,每条流条目中处理规则的报文命中情况定期由底层硬件同步到CPU,由CPU中的软件根据自身的老化逻辑判断是否存在老化流表,而后向底层硬件下发删除指令,软硬件同步报文命中计数过于频繁,极大地浪费了软硬件资源,导致主机的处理性能较差
[0038]上述流表管理方法、装置、设备、存储介质和程序产品,网卡接收数据报文,并对数据报文的报文头部进行解析,获得数据报文的报文头部信息;将报文头部信息与网卡中的硬件流表进行匹配;若硬件流表中存在与报文头部信息匹配的硬件流条目,且硬件流条目的采样计数满足预设采样条件,则将报文头部信息发送至主机;接收主机在基于报文头部信息判断出硬件流条目已老化后下发的流表删除指令;基于流表删除指令删除硬件流表中的硬件流条目。相较于传统的流表管理方式,本申请通过报文采样机制,在网卡侧将报文采样上送至主机,使得流表老化优化交由主机软件进行,从而实现流表老化逻辑的软件化处理,可以减轻软硬件报文计数频繁同步的压力,有效缓解了网卡硬件与主机软件之间因频繁同步流表命中情况而产生的性能瓶颈,提升主机的处理性能。
Smart Images

Figure CN119520449B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a flow table management method, apparatus, device, storage medium, and program product. Background Technology
[0002] In traditional flow table management, the host (CPU) sends the processing rules for matched data packets to the underlying hardware (NIC), which records them in the flow entries of the hardware flow table. During data packet processing, if a packet matches a processing rule recorded in the hardware flow table, it is directly processed and forwarded by the hardware without being sent to the CPU. If a packet does not match the hardware flow table, it needs to be sent to the CPU for processing, and then the corresponding processing rule is sent back to the underlying hardware. The packet match status of the processing rules in each flow entry is periodically synchronized from the underlying hardware to the CPU. The software in the CPU determines whether an aging flow table exists based on its own aging logic, and then issues a deletion command to the underlying hardware. This frequent synchronization of packet match counts between the software and hardware wastes a lot of hardware and software resources, resulting in poor host processing performance. Summary of the Invention
[0003] Therefore, it is necessary to provide a flow table management method, apparatus, device, storage medium, and program product that can alleviate the pressure of frequent synchronization of software and hardware message counting and improve the processing performance of the host, in order to address the above-mentioned technical problems.
[0004] Firstly, this application provides a flow table management method applied to a network interface card (NIC); the method includes:
[0005] Receive data packets and parse the header of the data packets to obtain the header information of the data packets;
[0006] The packet header information is matched with the hardware flow table in the network card;
[0007] If there is a hardware flow entry in the hardware flow table that matches the packet header information, and the sampling count of the hardware flow entry meets the preset sampling conditions, then the packet header information is sent to the host.
[0008] Receive a flow table deletion command issued by the host after determining that the hardware flow entry has aged based on the message header information;
[0009] The hardware flow entry in the hardware flow table is deleted based on the flow table deletion instruction.
[0010] In one embodiment, the method further includes:
[0011] If the sampling time interval counted by the sampling counter corresponding to the hardware stream entry meets the preset time interval, then the sampling count of the hardware stream entry is determined to meet the preset sampling condition; or,
[0012] If the number of sampled packets counted by the sampling counter corresponding to the hardware flow entry meets the preset number of packets, then it is determined that the sampling count of the hardware flow entry meets the preset sampling condition.
[0013] Secondly, this application provides a flow table management method applied to a host; the method includes:
[0014] The network interface card (NIC) receives the header information of a data packet sent by the network interface card (NIC). The header information is obtained by the NIC after parsing the header of the received data packet, determining that there is a hardware flow entry in the hardware flow table of the NIC that matches the header information, and that the sampling count of the hardware flow entry meets the preset sampling conditions.
[0015] Determine whether the hardware stream entry has aged based on the message header information;
[0016] If it is determined that the hardware flow entry has aged, a flow table deletion instruction is generated for the hardware flow entry, and the flow table deletion instruction is sent to the network interface card (NIC) so that the NIC deletes the hardware flow entry in the hardware flow table based on the flow table deletion instruction.
[0017] In one embodiment, the host includes a network interface card (NIC) driver and a data processing software program; the header information of the data packet received from the NIC includes:
[0018] The network card driver receives the header information of the data packets sent by the network card and sends the header information to the data processing software program.
[0019] The step of determining whether the hardware stream entry has aged based on the message header information includes:
[0020] The data processing software program determines whether the hardware stream entry has aged based on the message header information.
[0021] In one embodiment, the host stores a software flow table corresponding to the hardware flow table; the step of determining whether the hardware flow entry has aged based on the packet header information using the data processing software program includes:
[0022] The data processing software program matches the message header information with the software flow table in the host.
[0023] If a software flow entry matching the packet header information exists in the software flow table, then the hardware flow entry is determined not to be old.
[0024] If there is no software flow entry in the software flow table that matches the message header information, then the hardware flow entry is determined to be outdated.
[0025] Thirdly, this application provides a flow table management device applied to a network interface card (NIC); the device includes:
[0026] The parsing module is used to receive data packets and parse the header of the data packets to obtain the header information of the data packets.
[0027] The matching module is used to match the packet header information with the hardware flow table in the network interface card;
[0028] The first sending module is configured to send the message header information to the host if there is a hardware flow entry in the hardware flow table that matches the message header information and the sampling count of the hardware flow entry meets a preset sampling condition.
[0029] The first receiving module is used to receive the flow table deletion command issued by the host after determining that the hardware flow entry has aged based on the message header information;
[0030] The deletion module is used to delete the hardware flow entry in the hardware flow table based on the flow table deletion instruction.
[0031] Fourthly, this application provides a flow table management device applied to a host computer; the device includes:
[0032] The second receiving module is used to receive the header information of the data packet sent by the network card; the header information is obtained by the network card after parsing the header information of the received data packet, determining that there is a hardware flow entry in the hardware flow table of the network card that matches the header information, and the sampling count of the hardware flow entry meets the preset sampling conditions.
[0033] The judgment module is used to determine whether the hardware stream entry has aged based on the message header information;
[0034] The second sending module is used to generate a flow table deletion instruction for the hardware flow entry if it is determined that the hardware flow entry has aged, and send the flow table deletion instruction to the network card so that the network card deletes the hardware flow entry in the hardware flow table based on the flow table deletion instruction.
[0035] Fifthly, this application provides a computer device including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the various method embodiments of this application.
[0036] In a sixth aspect, this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps in the various method embodiments of this application.
[0037] In a seventh aspect, this application provides a computer program product, including a computer program that, when executed by a processor, implements the steps in the various method embodiments of this application.
[0038] The aforementioned flow table management method, apparatus, device, storage medium, and program product involve a network interface card (NIC) receiving data packets and parsing the packet header to obtain header information. The header information is then matched against the hardware flow table in the NIC. If a hardware flow entry matching the header information exists in the hardware flow table, and the sampling count of the hardware flow entry meets preset sampling conditions, the header information is sent to the host. The system receives a flow table deletion command issued by the host after determining that the hardware flow entry has aged based on the header information. The hardware flow entry is then deleted from the hardware flow table based on the deletion command. Compared to traditional flow table management methods, this application uses a packet sampling mechanism to send packet samples to the host on the NIC side, allowing flow table aging optimization to be handled by the host software. This software-based processing of the flow table aging logic reduces the pressure of frequent synchronization of hardware and software packet counts, effectively alleviating the performance bottleneck caused by frequent synchronization of flow table hits between the NIC hardware and host software, and improving the host's processing performance. Attached Figure Description
[0039] Figure 1 This is a diagram illustrating the application environment of the flow table management method in one embodiment;
[0040] Figure 2 This is a flowchart illustrating a flow table management method in one embodiment;
[0041] Figure 3 This is a flowchart illustrating the flow table management method in another embodiment;
[0042] Figure 4 This is a diagram illustrating the application environment of the flow table management method in another embodiment;
[0043] Figure 5 This is a structural block diagram of a flow table management device in one embodiment;
[0044] Figure 6 This is a structural block diagram of the flow table management device in another embodiment;
[0045] Figure 7 This is an internal structural diagram of a computer device in one embodiment;
[0046] Figure 8 This is a diagram of the internal structure of a computer device in another embodiment. Detailed Implementation
[0047] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0048] The flow table management method provided in this application can be applied to, for example... Figure 1 In the application environment shown, specifically, the network interface card 102 can receive data packets and parse the packet header to obtain the packet header information. The network interface card 102 can match the packet header information with the hardware flow table in the network interface card 102; if a hardware flow entry matching the packet header information exists in the hardware flow table, and the sampling count of the hardware flow entry meets the preset sampling conditions, then the packet header information is sent to the host 104. The network interface card 102 can receive a flow table deletion command issued by the host 104 after determining that the hardware flow entry has aged based on the packet header information, and delete the hardware flow entry in the hardware flow table based on the flow table deletion command.
[0049] It is understood that this embodiment does not limit this aspect. Figure 1 The application scenarios shown are for illustrative purposes only and are not limited to these.
[0050] In one embodiment, such as Figure 2 As shown, a flow table management method is provided, applied to network interface cards (NICs); it includes the following steps:
[0051] Step 202: Receive the data packet and parse the header of the data packet to obtain the header information of the data packet.
[0052] Specifically, the business system can send data packets to the network interface card (NIC), and the NIC can receive data packets. The NIC is a type of hardware logic device. The NIC can activate its built-in hardware logic to parse the header of the data packet and obtain the header information.
[0053] Step 204: Match the packet header information with the hardware flow table in the network card.
[0054] Specifically, the network interface card (NIC) contains a hardware flow table, which includes multiple hardware flow entries. Each hardware flow entry is mapped to a corresponding packet header. After parsing and obtaining the packet header information of a data packet, the NIC can match the packet header information with the header information corresponding to each hardware flow entry in the hardware flow table to determine whether there is a hardware flow entry in the hardware flow table that matches the packet header information.
[0055] Step 206: If there is a hardware flow entry in the hardware flow table that matches the message header information, and the sampling count of the hardware flow entry meets the preset sampling conditions, then the message header information is sent to the host.
[0056] In one embodiment, if a hardware flow entry matching the packet header information exists in the hardware flow table, and the sampling count of the hardware flow entry meets a preset sampling condition, the network interface card (NIC) can send the packet header information to the host. The NIC can notify the host of new packet header information uploads via interrupt or event notification mechanisms to remind the host to process it promptly. Simultaneously, the NIC can perform corresponding data processing on the data packet, such as forwarding it to a third-party device.
[0057] Step 208: Receive the flow table deletion command issued by the host after determining that the hardware flow entry has aged based on the message header information.
[0058] Specifically, after receiving the packet header information, the host can determine whether the hardware flow entry has aged based on the packet header information. If the host determines that the hardware flow entry has aged based on the packet header information, the host can send a flow table deletion command to the network card, and the network card can receive the flow table deletion command sent by the host.
[0059] Step 210: Delete the hardware flow entry in the hardware flow table based on the flow table deletion instruction.
[0060] Specifically, after receiving a flow table deletion command from the host, the network card can find the hardware flow entry in the hardware flow table and delete the hardware flow entry in the hardware flow table based on the flow table deletion command.
[0061] In the aforementioned flow table management method, the network interface card (NIC) receives data packets and parses the packet header to obtain the packet header information. The packet header information is then matched against the hardware flow table in the NIC. If a hardware flow entry matching the packet header information exists in the hardware flow table, and the sampling count of the hardware flow entry meets a preset sampling condition, the packet header information is sent to the host. The host then receives a flow table deletion command issued after determining that the hardware flow entry has aged based on the packet header information. The hardware flow entry in the hardware flow table is deleted based on the flow table deletion command. Compared to traditional flow table management methods, this application uses a packet sampling mechanism to send packet samples to the host on the NIC side, allowing flow table aging optimization to be handled by the host software. This software-based processing of the flow table aging logic reduces the pressure of frequent synchronization of hardware and software packet counts, effectively alleviating the performance bottleneck caused by frequent synchronization of flow table hits between the NIC hardware and host software, and improving the host's processing performance.
[0062] In one embodiment, the method further includes: if the sampling time interval counted by the sampling counter corresponding to the hardware flow entry meets the preset time interval, then it is determined that the sampling count of the hardware flow entry meets the preset sampling condition; or, if the number of sampled packets counted by the sampling counter corresponding to the hardware flow entry meets the preset number of packets, then it is determined that the sampling count of the hardware flow entry meets the preset sampling condition.
[0063] In the above embodiments, by setting a preset time interval or a preset number of packets in the sampling counter, the setting for the network card to trigger the sending of packet header information to the host is made more flexible.
[0064] In one embodiment, such as Figure 3 As shown, a flow table management method is provided, applied to network interface cards (NICs); it includes the following steps:
[0065] Step 302: Receive the header information of the data packet sent by the network card; the header information is obtained by the network card after parsing the header of the received data packet, determining that there is a hardware flow entry in the hardware flow table that matches the header information, and that the sampling count of the hardware flow entry meets the preset sampling conditions.
[0066] Step 304: Determine whether the hardware stream entry has aged based on the message header information.
[0067] Step 306: If it is determined that the hardware flow entry has aged, a flow table deletion instruction for the hardware flow entry is generated and sent to the network card so that the network card deletes the hardware flow entry in the hardware flow table based on the flow table deletion instruction.
[0068] Specifically, the business system can send data packets to the network interface card (NIC), and the NIC can receive data packets. The NIC is a type of hardware logic device. The NIC can activate its built-in hardware logic to parse the header of the data packet, obtaining the header information. The NIC contains a hardware flow table with multiple hardware flow entries. Each hardware flow entry has a mapping relationship with the corresponding header information. After parsing and obtaining the header information of the data packet, the NIC can match the header information with the header information corresponding to each hardware flow entry in the hardware flow table to determine if a matching hardware flow entry exists. If a matching hardware flow entry exists in the hardware flow table, and the sampling count of the hardware flow entry meets a preset sampling condition, the NIC can send the header information to the host. The NIC can notify the host of new header information uploads via interrupt or event notification mechanisms to remind the host to process it promptly. Simultaneously, the NIC can perform corresponding data processing on the data packet, such as forwarding it to a third-party device. After receiving the packet header information, the host can determine whether the hardware flow entry is outdated based on the header information. If the host determines that the hardware flow entry is outdated based on the packet header information, the host can send a flow table deletion command to the network interface card (NIC). The NIC can receive the flow table deletion command from the host. After receiving the flow table deletion command from the host, the NIC can find the hardware flow entry in the hardware flow table and delete the hardware flow entry from the hardware flow table based on the flow table deletion command.
[0069] In the above embodiments, the host receives the header information of the data packets sent by the network interface card (NIC). The header information is obtained by the NIC after parsing the header of the received data packets, determining that there is a hardware flow entry in the NIC's hardware flow table that matches the header information, and that the sampling count of the hardware flow entry meets a preset sampling condition. Based on the header information, the host determines whether the hardware flow entry has aged. If it is determined that the hardware flow entry has aged, a flow table deletion instruction is generated for the hardware flow entry and sent to the NIC, so that the NIC deletes the hardware flow entry in the hardware flow table based on the flow table deletion instruction. Compared to traditional flow table management methods, this application uses a packet sampling mechanism to send packet samples to the host on the NIC side, allowing the flow table aging optimization to be handled by the host software. This achieves software-based processing of the flow table aging logic, reducing the pressure of frequent synchronization of hardware and software packet counts, effectively alleviating the performance bottleneck caused by frequent synchronization of flow table hits between the NIC hardware and host software, and improving the host's processing performance.
[0070] In one embodiment, the host includes a network interface card (NIC) driver and a data processing software program; receiving the header information of a data packet sent by the NIC includes: receiving the header information of the data packet sent by the NIC through the NIC driver and sending the header information to the data processing software program; determining whether a hardware flow entry has aged based on the header information includes: determining whether a hardware flow entry has aged based on the header information through the data processing software program.
[0071] In one embodiment, the data processing software program can be a DPDK (Data Plane Development Kit) application. The DPDK runs on a Linux system and is a collection of function libraries and drivers for fast packet processing, which can greatly improve data processing performance and throughput, and improve the working efficiency of data plane applications.
[0072] In the above embodiments, by setting up network card drivers and data processing software programs in the host, the host can separate the interaction process with the network card from the data processing process, thereby improving the host's data processing performance and efficiency.
[0073] In one embodiment, the host stores a software flow table corresponding to the hardware flow table; determining whether a hardware flow entry has aged based on packet header information using a data processing software program includes: matching the packet header information with the software flow table in the host using the data processing software program; if a software flow entry matching the packet header information exists in the software flow table, the hardware flow entry is determined not to be aged; if no software flow entry matching the packet header information exists in the software flow table, the hardware flow entry is determined to be aged.
[0074] In the above embodiments, the data processing software program matches the packet header information with the software flow table in the host to determine whether the hardware flow entries in the network card have aged, which can improve the accuracy of hardware flow entry aging judgment.
[0075] In one embodiment, such as Figure 4As shown, the business system can send data packets to the network interface card (NIC). The NIC can receive data packets and activate its built-in hardware logic to parse the packet header, obtaining the header information. The NIC contains a hardware flow table with multiple hardware flow entries. Each hardware flow entry is mapped to a corresponding packet header. After parsing the packet header, the NIC matches it with the headers of the corresponding hardware flow entries in the hardware flow table to determine if a matching hardware flow entry exists. If a matching hardware flow entry exists and its sampling count meets a preset sampling condition, the NIC sends the header information to the host's NIC driver. The host can receive the packet header from the NIC via the NIC driver and forward it to the data processing software. The data processing software can then determine whether a hardware flow entry is old based on the header information. If the hardware flow entry is determined to be outdated based on the packet header information, the host can send a flow table deletion command to the network card via the network card driver. The network card can receive the flow table deletion command from the host. After receiving the flow table deletion command from the host, the network card can find the hardware flow entry in the hardware flow table and delete the hardware flow entry from the hardware flow table based on the flow table deletion command.
[0076] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially, these steps are not necessarily executed in that order. Unless otherwise expressly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some of the steps in the above embodiments may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least a portion of the sub-steps or stages of other steps.
[0077] In one embodiment, such as Figure 5 As shown, a flow table management device 500 is provided, applied to a network interface card (NIC); the device specifically includes:
[0078] The parsing module 502 is used to receive data packets and parse the header of the data packets to obtain the header information of the data packets.
[0079] Matching module 504 is used to match packet header information with the hardware flow table in the network card;
[0080] The first sending module 506 is used to send the message header information to the host if there is a hardware flow entry in the hardware flow table that matches the message header information and the sampling count of the hardware flow entry meets the preset sampling conditions.
[0081] The first receiving module 508 is used to receive the flow table deletion command issued by the host after determining that the hardware flow entry has aged based on the message header information.
[0082] The deletion module 510 is used to delete hardware flow entries in the hardware flow table based on the flow table deletion instruction.
[0083] In one embodiment, the first sending module 508 is further configured to determine that the sampling count of the hardware flow entry meets the preset sampling condition if the sampling time interval counted by the sampling counter corresponding to the hardware flow entry meets the preset time interval; or, determine that the sampling count of the hardware flow entry meets the preset sampling condition if the number of sampled packets counted by the sampling counter corresponding to the hardware flow entry meets the preset number of packets.
[0084] The aforementioned flow table management device involves the network interface card (NIC) receiving data packets and parsing the packet headers to obtain header information. This header information is then matched against the hardware flow table in the NIC. If a hardware flow entry matching the header information exists in the hardware flow table, and the sampling count of the hardware flow entry meets preset sampling conditions, the header information is sent to the host. The device also receives a flow table deletion command issued by the host after determining that the hardware flow entry has aged based on the header information. The hardware flow entry is then deleted from the hardware flow table based on the deletion command. Compared to traditional flow table management methods, this application uses a packet sampling mechanism to send packet samples to the host on the NIC side, allowing flow table aging optimization to be handled by the host software. This software-based processing of the flow table aging logic reduces the pressure of frequent synchronization of hardware and software packet counts, effectively alleviating the performance bottleneck caused by frequent synchronization of flow table hits between the NIC hardware and host software, and improving the host's processing performance.
[0085] In one embodiment, such as Figure 6 As shown, a flow table management device 600 is provided, applied to a host computer; the device specifically includes:
[0086] The second receiving module 602 is used to receive the header information of the data packet sent by the network card. The header information is obtained by the network card after parsing the header of the received data packet, determining that there is a hardware flow entry in the hardware flow table of the network card that matches the header information, and that the sampling count of the hardware flow entry meets the preset sampling conditions.
[0087] The judgment module 604 is used to determine whether a hardware stream entry has aged based on the message header information.
[0088] The second sending module 606 is used to generate a flow table deletion instruction for the hardware flow entry if it is determined that the hardware flow entry has aged, and send the flow table deletion instruction to the network card so that the network card deletes the hardware flow entry in the hardware flow table based on the flow table deletion instruction.
[0089] In one embodiment, the host includes a network card driver and a data processing software program; the second receiving module 602 is further configured to receive the header information of the data packet sent by the network card through the network card driver, and send the header information to the data processing software program; the judging module 604 is further configured to judge whether the hardware stream entry has aged based on the header information through the data processing software program.
[0090] In one embodiment, the host stores a software flow table corresponding to the hardware flow table; the judgment module 604 is further configured to match the packet header information with the software flow table in the host through a data processing software program; if there is a software flow entry in the software flow table that matches the packet header information, it is determined that the hardware flow entry has not aged; if there is no software flow entry in the software flow table that matches the packet header information, it is determined that the hardware flow entry has aged.
[0091] The aforementioned flow table management device involves the host receiving the header information of data packets sent by the network interface card (NIC). This header information is obtained by the NIC after parsing the header of the received data packets, determining that a hardware flow entry matching the header information exists in the NIC's hardware flow table, and confirming that the sampling count of the hardware flow entry meets preset sampling conditions. Based on the header information, the device determines whether the hardware flow entry has aged. If it is determined that the hardware flow entry has aged, a flow table deletion command is generated for the hardware flow entry and sent to the NIC, enabling the NIC to delete the hardware flow entry from the hardware flow table based on the command. Compared to traditional flow table management methods, this application uses a packet sampling mechanism to send packet samples from the NIC side to the host, allowing flow table aging optimization to be handled by the host software. This software-based processing of the flow table aging logic reduces the pressure of frequent synchronization of hardware and software packet counts, effectively alleviating the performance bottleneck caused by frequent synchronization of flow table hits between the NIC hardware and host software, and improving the host's processing performance.
[0092] Each module in the aforementioned flow table management device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the corresponding operations of each module.
[0093] In one embodiment, a computer device is provided, which may be a host computer, and its internal structure diagram may be as follows: Figure 7 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and databases. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media to run. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a flow table management method.
[0094] In one embodiment, a computer device is provided, which may be a network interface card (NIC), and its internal structure diagram may be as follows: Figure 8 As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When executed by the processor, the computer program implements a flow table management method. The display unit of the computer device is used to form a visually visible image. It can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.
[0095] Those skilled in the art will understand that Figure 7 and Figure 8The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0096] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0097] In one embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0098] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0099] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0100] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical storage, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0101] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0102] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A flow table management method, characterized in that, Applied to network interface cards; the method includes: Receive data packets and parse the header of the data packets to obtain the header information of the data packets; The packet header information is matched with the hardware flow table in the network card; If a hardware flow entry matching the packet header information exists in the hardware flow table, and the sampling count of the hardware flow entry meets a preset sampling condition, then the packet header information is sent to the host, so that the host receives the packet header information through the network card driver included in the host, sends the packet header information to the data processing software program included in the host, and notifies the host that new packet header information has been uploaded through an interrupt or event notification mechanism; the host stores a software flow table corresponding to the hardware flow table. The system receives a flow table deletion command issued by the host after determining that the hardware flow entry has aged based on the packet header information. The host's determination of whether the hardware flow entry has aged based on the packet header information includes: matching the packet header information with the software flow table in the host using the data processing software program; if a software flow entry matching the packet header information exists in the software flow table, the hardware flow entry is determined not to be aged; if no software flow entry matching the packet header information exists in the software flow table, the hardware flow entry is determined to be aged. The hardware flow entry in the hardware flow table is deleted based on the flow table deletion instruction.
2. The method according to claim 1, characterized in that, The method further includes: If the sampling time interval counted by the sampling counter corresponding to the hardware stream entry meets the preset time interval, then the sampling count of the hardware stream entry is determined to meet the preset sampling condition; or, If the number of sampled packets counted by the sampling counter corresponding to the hardware flow entry meets the preset number of packets, then it is determined that the sampling count of the hardware flow entry meets the preset sampling condition.
3. A flow table management method, characterized in that, The method is applied to a host computer; the host computer includes a network card driver and a data processing software program; the host computer stores a software flow table corresponding to a hardware flow table; the method includes: The network interface card (NIC) receives information sent by the NIC via an interrupt or event notification mechanism to notify the host that new packet header information has been uploaded. The NIC driver receives the packet header information of the data packets sent by the NIC and sends the packet header information to the data processing software program. The packet header information is obtained by the NIC after parsing the header of the received data packets, determining that a hardware flow entry matching the packet header information exists in the NIC's hardware flow table, and that the sampling count of the hardware flow entry meets a preset sampling condition. The data processing software program matches the message header information with the software flow table in the host. If a software flow entry matching the packet header information exists in the software flow table, then the hardware flow entry is determined not to be old. If there is no software flow entry in the software flow table that matches the message header information, then the hardware flow entry is determined to be outdated. If it is determined that the hardware flow entry has aged, a flow table deletion instruction is generated for the hardware flow entry, and the flow table deletion instruction is sent to the network interface card (NIC) so that the NIC deletes the hardware flow entry in the hardware flow table based on the flow table deletion instruction.
4. A flow meter management device, characterized in that, Applied to a network interface card; the device includes: The parsing module is used to receive data packets and parse the header of the data packets to obtain the header information of the data packets. The matching module is used to match the packet header information with the hardware flow table in the network interface card; The first sending module is configured to send the packet header information to the host if a hardware flow entry matching the packet header information exists in the hardware flow table and the sampling count of the hardware flow entry meets a preset sampling condition. This allows the host to receive the packet header information via a network card driver included in the host, send the packet header information to a data processing software program included in the host, and notify the host of new packet header information upload via an interrupt or event notification mechanism. The host stores a software flow table corresponding to the hardware flow table. The first receiving module is configured to receive a flow table deletion instruction issued by the host after determining that the hardware flow entry has aged based on the packet header information; wherein, the host determines whether the hardware flow entry has aged based on the packet header information by: matching the packet header information with the software flow table in the host through the data processing software program; if there is a software flow entry in the software flow table that matches the packet header information, then the hardware flow entry is determined not to be aged; if there is no software flow entry in the software flow table that matches the packet header information, then the hardware flow entry is determined to be aged. The deletion module is used to delete the hardware flow entry in the hardware flow table based on the flow table deletion instruction.
5. The apparatus according to claim 4, characterized in that, The first sending module is further configured to determine that the sampling count of the hardware stream entry meets the preset sampling condition if the sampling time interval counted by the sampling counter corresponding to the hardware stream entry meets the preset time interval; or, if the number of sampled packets counted by the sampling counter corresponding to the hardware stream entry meets the preset number of packets, determine that the sampling count of the hardware stream entry meets the preset sampling condition.
6. A flow table management device, characterized in that, Applied to a host; the host includes a network card driver and a data processing software program; the host stores a software flow table corresponding to the hardware flow table; the device includes: The second receiving module is used to receive information sent by the network card through an interrupt or event notification mechanism, which is used to notify the host that new packet header information has been uploaded. It also receives the packet header information of the data packets sent by the network card through the network card driver and sends the packet header information to the data processing software program. The packet header information is obtained by the network card after parsing the packet header of the received data packet, determining that there is a hardware flow entry in the network card's hardware flow table that matches the packet header information, and that the sampling count of the hardware flow entry meets a preset sampling condition. The judgment module is used to match the packet header information with the software flow table in the host through the data processing software program; if there is a software flow entry in the software flow table that matches the packet header information, it is determined that the hardware flow entry has not aged; if there is no software flow entry in the software flow table that matches the packet header information, it is determined that the hardware flow entry has aged. The second sending module is used to generate a flow table deletion instruction for the hardware flow entry if it is determined that the hardware flow entry has aged, and send the flow table deletion instruction to the network card so that the network card deletes the hardware flow entry in the hardware flow table based on the flow table deletion instruction.
7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 3.
8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 3.
9. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Network card detection method and device, electronic equipment and storage medium
CN116016258A