Method and device for determining flow table offloading speed, storage medium and electronic equipment
Patent Information
- Application Number
- CN202311294467.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-08
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2043-10-08
AI Technical Summary
[0005]本申请实施例提供了一种流表卸载速度的确定方法、装置、存储介质及电子设备,以至少解决相关技术中存在的只能查看流表信息,无法监控流表总数的变化趋势的问题
[0010]通过本申请,确定通过目标进程间通信向智能网卡发送待卸载流表的流表数量,其中,目标进程间通信为预先在ovs-vswitchd与智能网卡的OVS-datapath之间的建立的netlink通信,目标进程间通信用于向智能网卡发送待卸载流表;根据流表数量确定智能网卡的流表卸载速度。由于可以通过检测通过目标进程间通信发送的待卸载流表的流表数量确定流表卸载速度,实现了监控流表总数的变化趋势,因此,可以解决相关技术中存在的只能查看流表信息,无法监控流表总数的变化趋势的问题,达到了监控流表总数的变化趋势的效果。
Smart Images

Figure CN117278459B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computers, and more specifically, to a method, apparatus, storage medium, and electronic device for determining the flow table unloading speed. Background Technology
[0002] In related technologies, when a large influx of new traffic suddenly enters a smart network interface card (NIC) over a period of time, such as during a DDoS attack, most flow tables will follow the Slow Path. This also means that a large number of new flow tables will be distributed to the smart NIC via netlink. The currently known monitoring method is to directly display the flow tables within the smart NIC using the command `ovs-dpctl dump-flows type=offloaded`. However, this method only allows viewing specific flow table information.
[0003] Therefore, it can be seen that the relevant technologies have the problem of only being able to view flow table information, but not being able to monitor the changing trend of the total number of flow tables.
[0004] There is currently no effective solution to the aforementioned problems in the relevant technologies. Summary of the Invention
[0005] This application provides a method, apparatus, storage medium, and electronic device for determining the flow table unloading speed, so as to at least solve the problem in the related art that only flow table information can be viewed, but the trend of the total number of flow tables cannot be monitored.
[0006] According to one embodiment of this application, a method for determining the flow table unloading speed is provided, comprising: determining the number of flow tables to be unloaded sent to a smart network interface card (NIC) via a target inter-process communication (IPC), wherein the target IPC is a netlink communication pre-established between ovs-vswitchd and the OVS-datapath of the smart NIC, and the target IPC is used to send the flow tables to be unloaded to the smart NIC; and determining the flow table unloading speed of the smart NIC based on the number of flow tables.
[0007] According to another embodiment of this application, a device for determining the flow table offloading speed is provided, comprising: a first determining module, configured to determine the number of flow tables to be offloaded sent to a smart network interface card (NIC) via a target inter-process communication (IPC), wherein the target IPC is a netlink communication pre-established between ovs-vswitchd and the OVS-datapath of the smart NIC, and the target IPC is used to send the flow tables to be offloaded to the smart NIC; and a second determining module, configured to determine the flow table offloading speed of the smart NIC based on the number of flow tables.
[0008] According to yet another embodiment of this application, a computer-readable storage medium is also provided, wherein a computer program is stored therein, and the computer program is configured to perform the steps in any of the above method embodiments when it is run.
[0009] According to yet another embodiment of this application, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0010] This application determines the number of flow tables to be offloaded sent to a smart network interface card (NIC) via target inter-process communication (IPC). The target IPC is a pre-established netlink communication between ovs-vswitchd and the smart NIC's OVS-datapath, used to send the flow tables to be offloaded to the smart NIC. The flow table offloading speed of the smart NIC is determined based on the number of flow tables. Since the flow table offloading speed can be determined by detecting the number of flow tables to be offloaded sent via target IPC, the trend of the total number of flow tables can be monitored. Therefore, this solves the problem in related technologies where only flow table information can be viewed, but the trend of the total number of flow tables cannot be monitored, achieving the effect of monitoring the trend of the total number of flow tables. Attached Figure Description
[0011] Figure 1 This is a schematic diagram of a cloud computing host with a standard network interface card (NIC).
[0012] Figure 2 This is a schematic diagram of a cloud computing host for an intelligent network;
[0013] Figure 3 This is a diagram illustrating the original traffic flow through the smart network interface card;
[0014] Figure 4 This is a hardware structure block diagram of a mobile terminal for a method of determining flow table unloading speed according to an embodiment of this application.
[0015] Figure 5 This is a flowchart of a method for determining the flow table unloading speed according to an embodiment of this application;
[0016] Figure 6 This is a flowchart (I) of a method for determining the flow table unloading speed according to a specific embodiment of the present invention;
[0017] Figure 7 This is a flowchart (II) of a method for determining the flow table unloading speed according to a specific embodiment of the present invention;
[0018] Figure 8 This is a structural block diagram of a device for determining the flow table unloading speed according to an embodiment of this application. Detailed Implementation
[0019] The embodiments of this application will be described in detail below with reference to the accompanying drawings and examples.
[0020] It should be noted that the terms "first," "second," etc., in the specification, claims, and drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0021] With the increasing prevalence of virtualized networks and their application in cloud computing, more and more enterprises and organizations are migrating their businesses to virtualized or hyperconverged systems. Some virtualized or hyperconverged systems are based on OVS and OpenFlow. OpenFlow is a network communication protocol that belongs to the data link layer and can control the forwarding plane of network switches or routers, thereby changing the network path taken by network packets.
[0022] Virtual networks differ significantly from traditional physical networks. Traditional physical networks are typically composed of specialized network equipment, such as switches, routers, and gateways. They are called "specialized routers" because their hardware is specifically designed for their specific functions. For example, a switch's purpose is to forward packets, so its chips can perform hardware forwarding to improve performance. In contrast, to achieve the same functionality as physical devices and to ensure network scalability, virtualized network functions in cloud computing are implemented through general-purpose chips on the host machine—a software forwarding method. Hardware forwarding offers significantly better performance than software forwarding.
[0023] Since virtualized network functions in cloud computing are implemented through general-purpose chips on the host machine, this means that during operation, a portion of the chips on the cloud computing host machine is used by the virtualized network, and only the remainder can be considered usable computing power. It is foreseeable that when the traffic in the virtual network is large, the computing power required for traffic forwarding will increase accordingly, eventually leading to all computing power being used for virtualized network forwarding, leaving no other usable computing power. For cloud computing, computing power is the most important resource, so this problem must be addressed and solved. Smart network interface cards (NICs) can typically be used. Smart NICs are NICs with their own forwarding chips. By using smart NICs, the virtual network forwarding function in the cloud computing machine can be offloaded to the smart NIC, allowing the chips on the cloud computing host machine to focus on computing operations, while also improving network performance. So how can the virtual network forwarding function in traditional cloud computing be offloaded to smart NICs? For virtual networks based on OVS and OpenFlow, one method is through hardware offloading.
[0024] Figure 1 This is a diagram of a cloud computing host with a standard network card, such as... Figure 1As shown, OVS mainly consists of the ovsdb-server and ovs-vswitchd processes located in user space, and the OVS datapath located in kernel space. In the entire OVS architecture, the controller converts various network topologies and functions into OVS data and OpenFlow rules, which are then distributed to the ovsdb-server and ovs-vswitchd processes respectively. The ovsdb-server process is specifically responsible for database functions, including data from the OVS control plane and data plane. It provides data to the ovs-vswitchd process, which matches network packets with the data provided by ovsdb-server and its own OpenFlow rules. After matching the corresponding rules, ovs-vswitchd writes one (or more) forwarding rules (specifically, flow tables, which differ from OpenFlow rules but are closer to MAC address tables or similar forwarding rules in a real network) to the OVS datapath via netlink. Thus, when the first network packet arrives at the OVS datapath, if there is no corresponding rule in the OVS datapath, the matching process described above will be followed. Subsequent network packets from the same network data stream arriving at the OVS datapath can be forwarded directly without needing to query ovs-vswitchd, because forwarding rules already exist. Therefore, the path that uses ovs-vswitchd to find OpenFlow for forwarding is called the slow path, while the path that forwards directly through the OVS datapath is called the fast path, which inevitably consumes some computing power.
[0025] Figure 2 This is a schematic diagram of a cloud computing host in an intelligent network, such as... Figure 2As shown, the principle of hardware offloading is to implement the fastpath function in OVS (Optical Visual System) in the smart network interface card (NIC) instead of the cloud computing host. Of course, the smart NIC is generally required to support OVS hardware offloading as well. This means that the OVS datapath function can be implemented on the smart NIC (more precisely, the fastpath function of the OVS datapath, since the flowpath function is still implemented on the host). In reality, both the cloud computing host and the smart NIC support OVS. However, the cloud computing host only handles the ovsdb-server and ovs-vswitchd functions, while the smart NIC only handles the ovs-datapath function. Together, they form a complete OVS function. They simply allocate tasks according to their respective strengths to achieve efficient resource utilization. Therefore, the smart NIC also supports some OVS commands to view flow tables that have been offloaded to the smart NIC. For example, `ovs-dpctl dump-flows type=offloaded` can view flow tables that have been offloaded to the NIC. In this way, during packet forwarding, traffic with existing flow tables is forwarded directly at the smart network interface card (NIC), significantly reducing the computing power consumed by the cloud host CPU in forwarding traffic in the virtual network. However, after OVS fastpath is uninstalled, the first packet of the data stream is still forwarded in software, meaning the first packet is still processed on the cloud host. During forwarding, a Fastpath forwarding flow table is generated and configured on the hardware NIC using the netlink protocol through the TC-Flower's TC interface.
[0026] Continue to refer to the appendix Figure 2 , Figure 2There are two main types of traffic: 1. Traffic following the Slow Path. 2. Traffic following the Fast Path. Traffic following the Slow Path is typically the first packet of traffic, meaning the flow containing the five-tuple (source IP, destination IP, source port, destination port, protocol) passes through the network interface card (NIC) for the first time. At this point, the smart NIC doesn't have a corresponding flow table; the traffic needs to be sent to the host's ovs-vsitchd module to generate a flow table, and then the traffic is offloaded to the smart NIC's datapath via hardware offloading. Hardware offloading is implemented using netlink. Traffic following the Fast Path is typically non-first packet traffic, meaning traffic with the same five-tuple has already passed through. Because there has been previous traffic, the smart NIC's ovs-datapath already has a corresponding flow table, so when traffic arrives, it can be directly matched against rules in the smart NIC's flow table for forwarding, thus completing the offloading. When a large amount of new traffic suddenly floods into the smart NIC, such as during a DDoS attack, most of the traffic will definitely follow the Slow Path. This also means that a large number of new flow tables will be distributed to smart network interface cards via netlink.
[0027] The currently known monitoring method is to directly use the `ovs-dpctl dump-flows type=offloaded` command within the smart network interface card (NIC) to display flow tables. However, this method has a drawback: it can only view specific flow table information, but cannot reflect the changing trend of the total number of flow tables. A diagram illustrating the original traffic flowing through the smart NIC can be found in the appendix. Figure 3 ,like Figure 3 As shown, the process includes: receiving a data packet, matching the data packet with the flow rules offloaded on the smart network interface card (NIC) in the ovs-datapath, and forwarding the packet according to the matched flow rule if a match is successful. If a match fails, a new flow rule, i.e., the target flow rule, is generated by reporting to ovs-vsitchd on the host. ovs-vsitchd then performs hardware offloading, i.e., sends the flow table to the ovs-datapath of the smart NIC via netlink. To address the methodological issues, the following implementation method is proposed.
[0028] The methods and embodiments provided in this application can be executed on a mobile terminal, computer terminal, or similar computing device. Taking running on a mobile terminal as an example, Figure 4 This is a hardware structure block diagram of a mobile terminal for a method of determining flow table unloading speed according to an embodiment of this application. Figure 4 As shown, a mobile terminal may include one or more ( Figure 4Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The mobile terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 4 The structure shown is for illustrative purposes only and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 4 The more or fewer components shown, or having the same Figure 4 The different configurations shown.
[0029] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the method for determining the flow table unloading speed in this embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thus implementing the above-described method. The memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0030] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the mobile terminal's communication provider. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.
[0031] This embodiment provides a method for determining the flow table unloading speed. Figure 5 This is a flowchart of a method for determining the flow table unloading speed according to an embodiment of this application, such as... Figure 5 As shown, the process includes the following steps:
[0032] Step S502: Determine the number of flow tables to be offloaded sent to the smart network card via target inter-process communication, wherein the target inter-process communication is a netlink communication pre-established between ovs-vswitchd and the OVS-datapath of the smart network card, and the target inter-process communication is used to send the flow tables to be offloaded to the smart network card.
[0033] Step S504: Determine the flow table offloading speed of the smart network card based on the number of flow tables.
[0034] In the above embodiments, the target inter-process communication can be netlink. When a large number of new data flows in, and most of them flow through the Slow Path, a large number of flow tables will be distributed from the cloud computing host to the smart NIC via netlink. This means that when the number of new flows increases, the traffic through netlink also increases, and when the number of new flows decreases, the traffic through netlink also decreases. This implies that the purpose of monitoring the hardware offloading of the smart NIC can be achieved by monitoring the netlink traffic of hardware offloading. The target inter-process communication can be netlink communication between the cloud computing host's ovs-vswitchd and the smart NIC's OVS-datapath. A function to monitor smart NIC offloading can be added to the netlink communication between the cloud computing host's ovs-vswitchd and the smart NIC's OVS-datapath to monitor the netlink traffic of hardware offloading. The flow table offloading speed of the smart NIC can be determined based on the number of detected flow tables.
[0035] The entity performing the above steps can be a cloud computing host, but is not limited to this.
[0036] This application determines the number of flow tables to be offloaded sent to a smart network interface card (NIC) via target inter-process communication (IPC). The target IPC is a pre-established netlink communication between ovs-vswitchd and the smart NIC's OVS-datapath, used to send the flow tables to be offloaded to the smart NIC. The flow table offloading speed of the smart NIC is determined based on the number of flow tables. Since the flow table offloading speed can be determined by detecting the number of flow tables to be offloaded sent via target IPC, the trend of the total number of flow tables can be monitored. Therefore, this solves the problem in related technologies where only flow table information can be viewed, but the trend of the total number of flow tables cannot be monitored, achieving the effect of monitoring the trend of the total number of flow tables.
[0037] In an exemplary embodiment, determining the number of flow tables to be sent to the smart network interface card (NIC) via inter-process communication (IPC) includes: controlling the target process to acquire flow table information from a target file at a predetermined period, wherein the target file is a pre-set file used to store flow table information of traffic to be offloaded to the smart NIC; and determining the number of flow table information as the number of flow tables. In this embodiment, a target file can be pre-set to store the flow table information of the flow tables to be offloaded. The number of flow tables is then determined based on the flow table information in the target file. When acquiring flow table information, the target process can be controlled to acquire flow table information at a predetermined period. The flow table offloading speed is determined based on the predetermined period and the acquired flow table information. The target process can be a monitor process. The predetermined period can be a predefined period, such as 10s, 20s, 1min, 10min, etc., and this invention does not limit this.
[0038] In the above embodiments, the flow table information to be uninstalled is stored in a pre-set target file, and the target process is controlled to obtain the flow table information in the target file according to a predetermined period. Based on the flow table information, the number of flow tables to be uninstalled within the predetermined period can be accurately determined, thereby achieving the effect of accurately monitoring the number of flow tables to be uninstalled.
[0039] In an exemplary embodiment, before controlling the target process to obtain flow table information from the target file according to a predetermined period, the method further includes: determining the target flow table information of the target flow table when sending the target flow table to be unloaded to the smart network interface card; and writing the target flow table information of the target flow table into the target file. In this embodiment, the target flow table information of the target flow table to be unloaded can be written into the target file in advance. That is, the target file can be preset, and when the target flow table to be unloaded is detected, the target flow table information of the target flow table is written into the target file to facilitate the target process to obtain the flow table information in the target file, thereby determining the flow table unloading speed.
[0040] In the above embodiment, a file can be set up externally to store data. Traffic data is written to a specific file, and then a simple reading program is set up to read this specific file at regular intervals (N seconds), thereby obtaining a traffic data graph every N seconds. Writing traffic can be implemented using the kernel's `kernel_write` function. Similarly, reading traffic can be easily implemented using `kernel_read`.
[0041] In the above embodiment, during the netlink communication between the OVS-vswitchd of the cloud computing host and the OVS-datapath of the smart network interface card, data is written to this file whenever one (or more) flow tables to be unloaded are issued via netlink on the cloud computing host to record the number of unloaded flow tables. A separate monitoring process periodically retrieves data from this file and calculates the average number of unloaded flow tables based on the time difference. This reflects the netlink traffic related to flow table unloading. By writing the target flow table information to be unloaded into the target file, the target process can easily obtain the flow table information from the target file, shortening the time required to determine the flow table unloading speed and improving the efficiency of determining the flow table unloading speed.
[0042] In one exemplary embodiment, traffic counts can also be performed by sending traffic data to a specific monitoring program. For example, a counter can be set in a specific monitoring program to count the number of flow tables to be offloaded to the smart network interface card (NIC) via inter-process communication within a target duration. The ratio of this number to the target duration is determined as the flow table offloading rate.
[0043] In an exemplary embodiment, determining the flow table offloading speed of the smart network interface card (NIC) based on the number of flow tables includes: determining a predetermined period, wherein the predetermined period is a time period for determining the number of flow tables; and determining the ratio of the number of flow tables to the time period as the flow table offloading speed. In this embodiment, the number of flow tables generated within the predetermined period can be determined, and the ratio of the number of flow tables to the predetermined period can be determined as the flow table offloading speed.
[0044] In the above embodiments, the target process, such as the monitor process, can obtain flow table information from the target file according to a predetermined period, and then determine the number of flow tables based on the flow table information. When determining the flow table unloading speed, the flow table unloading speed can be determined based on the time period during which the target process obtains flow table information from the target file and the number of flow tables obtained within this time period. The ratio of the number of flow tables to this time period, such as the predetermined period, determines the flow table unloading speed. The flow table unloading speed reflects the traffic trend and speed of the smart network card unloading flow tables, achieving the effect of intuitively reflecting the traffic trend and speed of the smart network card unloading flow tables.
[0045] In the above embodiments, when the data flow is relatively stable, there are not a large number of newly created flows, so large-scale smart NIC flow table offloading is not required. Monitoring netlink traffic only detects a small amount of traffic or no traffic at all. When a large number of new data flows suddenly flood in, there will be a large number of newly created flows, so large-scale smart NIC flow table offloading is required. Monitoring netlink traffic can detect a large amount of traffic. For example, when the average flow table offloading count is 20 entries / second, it means that the flow table offloading rate to the smart NIC is 20 entries / second, that is, the rate of newly created flows is 20 entries / second. This correspondence allows for a precise understanding of the smart NIC flow table offloading situation.
[0046] In an exemplary embodiment, before determining the number of flow tables to be unloaded and sent to the smart network interface card (NIC) via target inter-process communication (IPC), the method further includes: establishing netlink communication between OVS-vswitchd and the OVS-datapath of the smart NIC, in the presence of unloaded data, to obtain the target IPC; encapsulating the unloaded data into unloaded data packets to obtain the unloaded flow tables; and sending the unloaded flow tables to the smart NIC via the target IPC. In this embodiment, the target IPC can be netlink, which can be netlink communication between OVS-vswitchd (virtual machine) of the cloud computing host and the OVS-datapath (kernel module) of the smart NIC. In netlink communication, whenever one (or more) flow tables to be unloaded are issued on the cloud computing host using netlink, data is written to a target file to record the number of unloaded flow tables. Before determining the number of flow tables to be unloaded and sent to the smart NIC via target IPC, netlink can be established to prepare for sending data packets. It is determined whether flow tables are being issued, i.e., whether data packets need to be sent. If the judgment result is yes, prepare packet encapsulation. Encapsulate the packet and send it via netlink. After sending the packet via netlink, the data can be written to a feature count file (text file), i.e., the target file. The monitoring program reads this file to determine the flow table offloading status and speed. By statistically analyzing the netlink traffic used for smart NIC hardware offloading, the system can monitor smart NIC hardware offloading. This provides a direct view of the traffic trend and speed of smart NIC flow table offloading without adding any additional hardware, saving the cost of determining the traffic trend and speed of smart NIC flow table offloading.
[0047] In an exemplary embodiment, after determining the flow table offloading speed of the smart network interface card (NIC) based on the number of flow tables, the method further includes: reducing the traffic sent to the smart NIC via the target inter-process communication when the flow table offloading speed exceeds a predetermined threshold. In this embodiment, the flow table offloading speed of the smart NIC can play a more significant role by focusing on its data characteristics, such as the flow table offloading speed, for example, in detecting flooding attacks. The monitoring data characteristics of this monitoring method are very obvious during a flooding attack, and a threshold can be set to determine whether a flooding attack has occurred. Limiting netlink traffic can restrict the smart NIC's flow table offloading, for example, to defend against flooding attacks. When a flooding attack occurs, the number of flow tables can be limited, and this can be achieved by limiting the netlink traffic speed to restrict the creation of new flow tables.
[0048] In the above embodiments, the flow table offloading speed can accurately determine whether the system is under a network attack. When under a network attack, if the flow table offloading speed exceeds a predetermined threshold, the traffic sent to the smart network card via target inter-process communication can be reduced, thereby improving system security.
[0049] In an exemplary embodiment, before determining the number of flow tables to be offloaded and sent to the smart network interface card (NIC) via target inter-process communication, the method further includes: matching the received flow tables to be offloaded with the flow rules stored in the smart NIC to obtain a matching result; generating a target flow rule corresponding to the flow tables to be offloaded if the matching result indicates a matching failure; and forwarding the flow tables to be offloaded to the smart NIC based on the target flow rule. In this embodiment, after receiving a data packet, the data packet and the flow rules offloaded on the smart NIC can be matched in the ovs-datapath of the smart NIC. If the match is successful, the packet is forwarded according to the successfully matched flow rule. If the match fails, a new flow rule, i.e., the target flow rule, is generated by reporting to ovs-vsitchd on the host. ovs-vsitchd performs hardware offloading, i.e., sends the flow tables to the ovs-datapath of the smart NIC via netlink. The number of offloaded flow tables is monitored via netlink, and the flow table offloading speed is determined using a monitor.
[0050] In the above embodiments, if a match fails, it is determined that the smart network interface card has not unloaded the flow table to be unloaded. Therefore, a new target flow rule can be created, and the traffic to be unloaded can be unloaded using the target flow rule. That is, different flow rules can be applied to different flow tables for unloading, improving the unloading efficiency of flow tables.
[0051] In an exemplary embodiment, before determining the number of flow tables to be offloaded and sent to the smart network interface card (NIC) via target inter-process communication (IPC), the method further includes: determining the size of the received flow tables; if the flow table size is greater than a set size, the flow table can be sent to the smart NIC via target IPC; if the flow table size is less than the set size, the flow table is stored. In this embodiment, upon receiving a flow table, the size of the flow table can be determined first. If the flow table is too large, it may consume a large amount of computing power and processor utilization. Therefore, flow tables with a flow size greater than the set size can be offloaded to the smart NIC for processing. If the flow table size is less than the set size, even if the target host stores and processes the flow table, it will not cause system lag or other issues. Therefore, flow tables with a flow table size less than the set size can be stored and processed. By offloading flow tables with a flow size greater than the set size to the smart NIC, the utilization rate of the system's computing power can be maximized, ensuring the system's operating speed. By storing flow tables with a flow table size less than the set size, the processing speed of the flow tables can be guaranteed.
[0052] Figure 6 This is a flowchart (I) of a method for determining the flow table unloading speed according to a specific embodiment of the present invention, as follows: Figure 6 As shown, the process includes:
[0053] Step S602: Data packet received.
[0054] Step S604: Match the data packets with the flow rules offloaded on the smart network card in the ovs-datapath.
[0055] In step S606, if a match is successful, the flow is forwarded according to the matching flow rules.
[0056] In step S608, if the matching fails, the host ovs-vsitchd is notified to generate a new flow rule, i.e., the target flow rule.
[0057] In step S610, ovs-vsitchd performs hardware offloading, that is, it sends the flow table to the ovs-datapath of the smart network card through netlink.
[0058] Step S612: Monitor the number of unloaded flow tables using netlink.
[0059] Step S614: Determine the flow table unloading speed using the monitor.
[0060] Figure 7 This is a flowchart (II) of a method for determining the flow table unloading speed according to a specific embodiment of the present invention. Figure 7 As shown, the process includes:
[0061] Step S702: Establish a netlink to prepare for sending data packets.
[0062] Step S704: Determine whether a flow table has been issued, i.e., whether a data packet needs to be sent. If the determination result is yes, proceed to step S706; if the determination result is no, proceed to step S702.
[0063] Step S706: Prepare data packet encapsulation.
[0064] Step S708: Calculate the size of the data packet to be encapsulated.
[0065] Step S710: Encapsulate the data packet.
[0066] Step S712: Send data packets.
[0067] Step S714: The data is written to the feature count file (text).
[0068] Step S716: The monitoring program reads the program.
[0069] In the aforementioned embodiments, the hardware offloading of the smart network interface card (NIC) is monitored by statistically analyzing the netlink traffic used for hardware offloading. Compared to previous monitoring methods that typically display flow tables showing specific offloading events, this proposes a novel host-side monitoring method that reflects changes in hardware offloading. Even when the smart NIC is undergoing significant hardware offloading activities, network traffic can remain relatively stable.
[0070] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0071] This embodiment also provides a device for determining the flow table unloading speed. This device is used to implement the above embodiments and preferred embodiments, and details already described will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0072] Figure 8 This is a structural block diagram of a flow table unloading speed determination device according to an embodiment of this application, such as... Figure 8 As shown, the device includes:
[0073] The first determining module 82 is used to determine the number of flow tables to be offloaded sent to the smart network card through the target inter-process communication, wherein the target inter-process communication is a netlink communication pre-established between ovs-vswitchd and the OVS-datapath of the smart network card, and the target inter-process communication is used to send the flow tables to be offloaded to the smart network card.
[0074] The second determining module 84 is used to determine the flow table unloading speed of the smart network card based on the number of flow tables.
[0075] In an exemplary embodiment, the first determining module 82 can determine the number of flow tables to be sent to the smart network card via target inter-process communication in the following manner: controlling the target process to obtain flow table information from a target file according to a predetermined period, wherein the target file is a pre-set file used to store flow table information of traffic to be offloaded to the smart network card; and determining the number of flow table information as the number of flow tables.
[0076] In an exemplary embodiment, the apparatus can be used to determine the target flow table information of the target flow table before the target process obtains flow table information from the target file according to a predetermined period, and to write the target flow table information of the target flow table into the target file.
[0077] In an exemplary embodiment, the second determining module 84 can determine the flow table offloading speed of the smart network card based on the number of flow tables by: determining a predetermined period, wherein the predetermined period is the time period for determining the number of flow tables; and determining the ratio of the number of flow tables to the time period as the flow table offloading speed.
[0078] In one exemplary embodiment, the apparatus can further be used to, before determining the number of flow tables to be offloaded and sent to the smart network interface card via target inter-process communication, establish netlink communication between OVS-vswitchd and the OVS-datapath of the smart network interface card, in the presence of data to be offloaded, to obtain the target inter-process communication; encapsulate the data to be offloaded into data packets to be offloaded, to obtain the flow tables to be offloaded; and send the flow tables to be offloaded to the smart network interface card via the target inter-process communication.
[0079] In one exemplary embodiment, the apparatus can also be used to reduce the traffic sent to the smart network interface card via the target inter-process communication after determining the flow table offloading speed of the smart network interface card based on the number of flow tables, provided that the flow table offloading speed is greater than a predetermined threshold.
[0080] In an exemplary embodiment, the apparatus may further be configured to, before determining the number of flow tables to be offloaded sent to the smart network interface card via target inter-process communication, match the received flow tables to be offloaded with the flow rules stored in the smart network interface card to obtain a matching result; if the matching result indicates a matching failure, generate a target flow rule corresponding to the flow tables to be offloaded; and forward the flow tables to be offloaded to the smart network interface card based on the target flow rule.
[0081] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.
[0082] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above method embodiments when run.
[0083] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0084] Embodiments of this application also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0085] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0086] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.
[0087] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.
[0088] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.
Claims
1. A method for determining the unloading speed of a flow table, characterized in that, include: The number of flow tables to be offloaded is determined by sending them to the smart network card via target inter-process communication, wherein the target inter-process communication is a netlink communication pre-established between ovs-vswitchd and the OVS-datapath of the smart network card, and the target inter-process communication is used to send the flow tables to be offloaded to the smart network card. The flow table offloading speed of the smart network interface card is determined based on the number of flow tables. Determining the number of flow tables to be sent to the smart network card via inter-process communication includes: controlling the target process to obtain flow table information from a target file at a predetermined period, wherein the target file is a pre-set file used to store flow table information of traffic to be offloaded to the smart network card; and determining the number of flow table information as the number of flow tables. Determining the flow table offloading speed of the smart network interface card based on the number of flow tables includes: determining a predetermined period, wherein the predetermined period is the time period for determining the number of flow tables; and determining the ratio of the number of flow tables to the time period as the flow table offloading speed.
2. The method according to claim 1, characterized in that, Before controlling the target process to obtain flow table information from the target file at a predetermined period, the method further includes: When sending the target flow table to be unloaded to the smart network card, the target flow table information of the target flow table is determined; Write the target flow table information of the target flow table into the target file.
3. The method according to claim 1, characterized in that, Before determining the number of flow tables to be offloaded sent to the smart network interface card via target inter-process communication, the method further includes: In the presence of data to be unloaded, a netlink communication is established between OVS-vswitchd and the OVS-datapath of the smart network card to obtain the target inter-process communication; The data to be uninstalled is encapsulated into a data packet to be uninstalled to obtain the flow table to be uninstalled; The flow table to be unloaded is sent to the smart network card through the target inter-process communication.
4. The method according to claim 1, characterized in that, After determining the flow table offloading speed of the smart network interface card based on the number of flow tables, the method further includes: If the flow table unloading speed is greater than a predetermined threshold, the traffic sent to the smart network card through the target inter-process communication is reduced.
5. The method according to claim 1, characterized in that, Before determining the number of flow tables to be offloaded sent to the smart network interface card via target inter-process communication, the method further includes: The received flow table to be unloaded is matched with the flow rules stored in the smart network card to obtain the matching result; If the matching result indicates a matching failure, a target flow rule corresponding to the flow table to be unloaded is generated. Based on the target flow rules, the flow table to be unloaded is forwarded to the smart network interface card.
6. A device for determining the unloading speed of a flow meter, characterized in that, include: The first determining module is used to determine the number of flow tables to be offloaded sent to the smart network card via target inter-process communication, wherein the target inter-process communication is a netlink communication pre-established between ovs-vswitchd and the OVS-datapath of the smart network card, and the target inter-process communication is used to send the flow tables to be offloaded to the smart network card. The second determining module is used to determine the flow table unloading speed of the smart network card based on the number of flow tables; The first determining module determines the number of flow tables to be sent to the smart network card via inter-process communication in the following way: controlling the target process to obtain flow table information from a target file at a predetermined period, wherein the target file is a pre-set file used to store flow table information of traffic to be offloaded to the smart network card; and determining the number of flow table information as the number of flow tables. The second determining module determines the flow table offloading speed of the smart network card based on the number of flow tables in the following way: determining a predetermined period, wherein the predetermined period is the time period for determining the number of flow tables; and determining the ratio of the number of flow tables to the time period as the flow table offloading speed.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the method described in any one of claims 1 to 5.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method described in any one of claims 1 to 5.
Citation Information
Patent Citations
Message forwarding method and device thereof
CN111988238A
Flow table rule statistical method and device for data packet of network card
CN116366521A