Test method and device of intelligent network card, electronic equipment and readable storage medium

By allocating server system resources and setting limit thresholds, diverse test scenarios are constructed, solving the comprehensiveness problem of smart network card testing and achieving more accurate and efficient testing.

CN116760746BActive Publication Date: 2026-02-24INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310778955.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-28
Publication Date
2026-02-24
Estimated Expiration
2043-06-28

AI Technical Summary

Technical Problem

In existing technologies, the testing methods for smart network interface cards (NICs) cannot accurately simulate test scenarios under different load modes, resulting in poor comprehensiveness of NIC testing.

Method used

By dividing the server's system resources, system resource groups corresponding to multiple virtual network interface card ports are obtained, and resource limit thresholds are set. Based on preset test commands, traffic of the virtual network interface card ports is tested to build diverse test scenarios.

Benefits of technology

It improves the comprehensiveness of network card testing, meets diverse testing needs, shortens the testing cycle, reduces the resource load on virtual network card ports, and improves the accuracy and efficiency of testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116760746B_ABST
    Figure CN116760746B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a kind of intelligent network card test method, device, electronic equipment and readable storage medium, the method is by dividing the system resource of server, obtains multiple system resource groups corresponding to multiple virtual network card ports;Multiple system resource groups correspond to multiple resource limit thresholds, the resource limit threshold corresponding to each system resource group is used to limit the resource usage of system resource in each system resource group, multiple virtual network card ports are obtained based on the virtualization of intelligent network card in server, multiple system resource groups and multiple virtual network card ports one-to-one correspond;Based on preset test command, the traffic of multiple virtual terminals corresponding to multiple virtual network card ports is tested, and the test result corresponding to intelligent network card is obtained.In the case of testing the traffic of multiple virtual terminals corresponding to multiple virtual network card ports, diversified testing needs can be met, and the comprehensiveness of network card testing is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of network, in particular to a test method and device of smart network card, electronic equipment and readable storage medium. BACKGROUND

[0002] Smart NIC (Smart NIC) is also called smart network adapter. In addition to the network transmission function of standard network card, it also provides built-in programmable and configurable hardware acceleration engine to improve the performance of application and greatly reduce the consumption of CPU in communication, and provides more CPU resources for application.

[0003] In related technologies, the method for testing the smart network card is to use the test software to directly test the performance of the smart network card. However, starting multiple threads directly through the test software for load testing cannot accurately simulate the test scene under different load modes, and the comprehensiveness of the network card test is poor. SUMMARY

[0004] The present application provides a test method and device of smart network card, electronic equipment and readable storage medium, in order to solve the problem of poor comprehensiveness of network card test of smart network card.

[0005] In order to solve the above technical problems, the present application is realized as follows:

[0006] In a first aspect, the present application provides a test method of smart network card, applied to a server, the method comprising:

[0007] The system resources of the server are divided to obtain a plurality of system resource groups corresponding to a plurality of virtual network card ports; the plurality of system resource groups correspond to a plurality of resource limit thresholds, and the resource limit threshold corresponding to each system resource group is used to limit the resource usage of the system resource in each system resource group, the plurality of virtual network card ports are obtained based on the virtualization of the smart network card in the server, and the plurality of system resource groups correspond one by one to the plurality of virtual network card ports;

[0008] Based on a preset test command, the traffic of a plurality of virtual terminals corresponding to the plurality of virtual network card ports is tested to obtain a test result corresponding to the smart network card.

[0009] Optionally, the method comprises:

[0010] Based on a target processing instruction, the smart network card is virtualized to obtain the plurality of virtual network card ports;

[0011] The division of the system resources of the server comprises:

[0012] For any virtual network card port in the plurality of virtual network card ports, system resources used by a virtual terminal corresponding to the virtual network card port in the system resources of the server are divided into the same system resource group.

[0013] Optionally, the resource limit threshold includes a first threshold and a second threshold; and the dividing of the system resources used by the virtual terminal corresponding to the virtual network card port in the system resources of the server into the same system resource group includes:

[0014] a control resource pool is created for the virtual network card port, and processes in the virtual terminal corresponding to the virtual network card port are allocated to the control resource pool;

[0015] the first threshold and the second threshold are set for the control resource pool, and system resources used by the processes allocated to the control resource pool when running are divided into the same system resource group; the first threshold is used to limit processor resources used by the processes, and the second threshold is used to limit memory resources used by the processes.

[0016] Optionally, the system resource group includes network resources used by the processes allocated to the control resource pool when running; and the method further includes:

[0017] a corresponding network namespace is created for the virtual network card port; different virtual network card ports correspond to different network namespaces, and different network namespaces are isolated from each other;

[0018] network resources in the system resource group divided for the virtual network card port are allocated to the network namespace.

[0019] Optionally, the method further includes:

[0020] the plurality of virtual network card ports are set in the same network segment, and communication connections are established between the plurality of virtual network card ports based on a virtual switch in the server;

[0021] the testing of the traffic of the plurality of virtual terminals corresponding to the plurality of virtual network card ports based on the preset test command to obtain the test result corresponding to the intelligent network card includes:

[0022] based on the preset test command, the plurality of virtual terminals corresponding to the plurality of virtual network card ports having established the communication connections are controlled to continuously perform data transmission and reception to obtain the test result corresponding to the intelligent network card.

[0023] Optionally, the preset test command comprises a first test command and a second test command; and based on the preset test command, the multiple virtual terminals corresponding to the multiple virtual network card ports of which the communication connection is established are controlled to continuously perform data transmission and reception, so as to obtain the test result corresponding to the intelligent network card.

[0024] Based on the first test command and the first test model indicated by the first test command, the multiple virtual network card ports are controlled to continuously perform data transmission and reception, and bandwidth data in the data transmission and reception process is obtained as the network bandwidth test result corresponding to the intelligent network card.

[0025] Based on the second test command and the second test model indicated by the second test command, the multiple virtual network card ports are controlled to continuously perform data transmission and reception, and packet throughput, packet loss rate and transmission delay jitter time in the data transmission and reception process are obtained as the data loss test result corresponding to the intelligent network card.

[0026] Optionally, the method further comprises:

[0027] Based on the network bandwidth test result and the data loss test result, the performance of the intelligent network card is evaluated.

[0028] In a second aspect, the present application provides a test device of an intelligent network card, applied to a server, the device comprising:

[0029] A first division module is configured to divide system resources of the server to obtain multiple system resource groups corresponding to multiple virtual network card ports; the multiple system resource groups correspond to multiple resource limitation thresholds, the resource limitation threshold corresponding to each system resource group is used to limit the resource usage of the system resource in each system resource group, the multiple virtual network card ports are obtained based on the virtualization of an intelligent network card in the server, and the multiple system resource groups and the multiple virtual network card ports correspond to each other in a one-to-one manner.

[0030] A first test module is configured to test the traffic of multiple virtual terminals corresponding to the multiple virtual network card ports based on a preset test command, so as to obtain a test result corresponding to the intelligent network card.

[0031] Optionally, the device can further comprise:

[0032] A first processing module is configured to virtualize the intelligent network card based on a target processing instruction, so as to obtain the multiple virtual network card ports.

[0033] The first division module can comprise:

[0034] The first division submodule is configured to divide, for any virtual network card port in the plurality of virtual network card ports, system resources used by a virtual terminal corresponding to the virtual network card port in the system resources of the server into the same system resource group.

[0035] Optionally, the resource limit threshold includes a first threshold and a second threshold; and the first division submodule can include:

[0036] The first creation module is configured to create a control resource pool for the virtual network card port and assign a process in the virtual terminal corresponding to the virtual network card port to the control resource pool.

[0037] The first setting module is configured to set the first threshold and the second threshold for the control resource pool and divide system resources used by the process assigned to the control resource pool into the same system resource group; the first threshold is used to limit processor resources used by the process, and the second threshold is used to limit memory resources used by the process.

[0038] Optionally, the system resource group includes network resources used by the process assigned to the control resource pool; and the apparatus can further include:

[0039] The second creation module is configured to create a corresponding network namespace for the virtual network card port; different virtual network card ports correspond to different network namespaces, and different network namespaces are isolated from each other.

[0040] The first assignment module is configured to assign network resources in the system resource group divided for the virtual network card port to the network namespace.

[0041] Optionally, the apparatus can further include:

[0042] The second setting module is configured to set the plurality of virtual network card ports in the same network segment and establish a communication connection between the plurality of virtual network card ports based on a virtual switch in the server.

[0043] The first test module can include:

[0044] The first control module is configured to control the plurality of virtual terminals corresponding to the plurality of virtual network card ports having established the communication connection to continuously perform data transmission and reception based on the preset test command, to obtain a test result corresponding to the intelligent network card.

[0045] Optionally, the preset test command includes a first test command and a second test command; and the first control module can include:

[0046] a first control submodule, configured to control the multiple virtual network card ports to continuously perform data transceiving based on the first test command and a first test model indicated by the first test command, and acquire bandwidth data in the data transceiving process as a network bandwidth test result corresponding to the intelligent network card;

[0047] a second control submodule, configured to control the multiple virtual network card ports to continuously perform data transceiving based on the second test command and a second test model indicated by the second test command, and acquire a data packet throughput, a packet loss rate and a transmission delay jitter time in the data transceiving process as a data loss test result corresponding to the intelligent network card.

[0048] Optionally, the apparatus can further include:

[0049] a first evaluation module, configured to evaluate the performance of the intelligent network card based on the network bandwidth test result and the data loss test result.

[0050] In a third aspect, the present application provides an electronic device, comprising a processor, a memory and a computer program stored in the memory and executable on the processor, wherein the processor implements the test method of the intelligent network card when executing the program.

[0051] In a fourth aspect, the present application provides a readable storage medium, when the instructions in the storage medium are executed by the processor of an electronic device, the electronic device can execute the test method of the intelligent network card

[0052] In the embodiment of the present application, by dividing the system resources of the server, a plurality of system resource groups corresponding to a plurality of virtual network card ports are obtained; the plurality of system resource groups correspond to a plurality of resource limit thresholds, the resource limit threshold corresponding to each system resource group is used to limit the resource usage of the system resources in each system resource group, the plurality of virtual network card ports are obtained based on the virtualization of the intelligent network card in the server, and the plurality of system resource groups and the plurality of virtual network card ports correspond one by one; based on a preset test command, the traffic of a plurality of virtual terminals corresponding to the plurality of virtual network card ports is tested to obtain a test result corresponding to the intelligent network card. In this way, by dividing the system resources of the server, a plurality of system resource groups corresponding to a plurality of virtual network card ports are obtained, and in the case of testing the traffic of a plurality of virtual terminals corresponding to the plurality of virtual network card ports, the system resources corresponding to each virtual network card port are independent and do not interfere with each other. Further, the resource usage of the system resources of the system resource group corresponding to the virtual network card port reflects the resource load corresponding to the virtual network card port, that is, by limiting the resource usage of the system resources, the resource load corresponding to the virtual network card port can be reduced to a certain extent. In this way, by setting the resource limit threshold to limit the resource usage of the system resources of the system resource group, the system resource load corresponding to each virtual network card port can also be limited to a certain extent, and then a diversified test scene for testing different system resource loads can be constructed to meet diversified test requirements, and the comprehensiveness of the network card test is improved to a certain extent. BRIEF DESCRIPTION OF DRAWINGS

[0053] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor.

[0054] Figure 1 is a step flow chart of a test method of an intelligent network card provided by an embodiment of the present application;

[0055] Figure 2 is a specific flow chart of a test method of an intelligent network card provided by an embodiment of the present application;

[0056] Figure 3 is a system topology diagram inside a server provided by an embodiment of the present application;

[0057] Figure 4 is a structure diagram of a test device of an intelligent network card provided by an embodiment of the present application;

[0058] Figure 5 is a structure diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0059] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all the other embodiments obtained by a person of ordinary skill in the art without creative work are within the protection scope of the present application.

[0060] Figure 1 is a step flow chart of a test method of an intelligent network card provided by an embodiment of the present application, applied to a server, the server is deployed with an intelligent network card, and the intelligent network card is a network interface card that can process tasks by a system processor. The intelligent network card can complete combinations of encryption / decryption, firewall, TCP / IP, HTTP and any processing task by using the processor on the board.

[0061] As shown in Figure 1 , the method can include:

[0062] Step 101, dividing system resources of the server to obtain a plurality of system resource groups corresponding to a plurality of virtual network card ports; the plurality of system resource groups correspond to a plurality of resource limit thresholds, and the resource limit threshold corresponding to each system resource group is used to limit the resource usage of the system resources in each system resource group, the plurality of virtual network card ports are obtained based on virtualization of an intelligent network card in the server, and the plurality of system resource groups and the plurality of virtual network card ports correspond one by one.

[0063] In the embodiment of the present application, by setting the intelligent network card to be virtualized, a plurality of virtual network card ports (VF) can be obtained. For example, by enabling the single root I / O virtualization (SR-IOV) under the server basic input output system (BIOS) and the virtualization function of the network card, a plurality of virtual network card ports can be obtained based on the virtualization of the intelligent network card. The single root I / O virtualization interface is an extension of the peripheral component interconnect express (PCIE). The SR-IOV allows a device (such as a network card) to separate the access of its resources among various PCIe hardware functions. Based on a preset tool in the server, the system resources of the server are divided according to a preset division rule, so that the obtained system resource groups after division are one-to-one corresponding to the virtual network card ports. The preset division rule can be to allocate the system resources according to a preset ratio or a preset corresponding relationship to obtain a plurality of system resource groups. For example, based on the system resources corresponding to the plurality of virtual network card ports, the system resources of the server can be divided, that is, for any virtual network card port, the system resources corresponding to the virtual network card port can be divided into a system resource group, and the system resource group corresponds to the virtual network card port. It can be understood that the system resources corresponding to the virtual network card port refer to the system resources required by the processes running in the virtual terminal corresponding to the virtual network card port. Dividing the system resources corresponding to the virtual network card port into a system resource group means that the system resources required by the processes running in the virtual terminal corresponding to the virtual network card port are included in the same system resource group. Each system resource group corresponds to a resource limit threshold, which is used to limit the resource usage of the system resources in the system resource group. The system resource group corresponding to each virtual network card port corresponds to a resource limit threshold, that is, the system resources required by the processes running in the virtual terminal corresponding to each virtual network card port correspond to a resource limit threshold.

[0064] Among them, different system resource groups can correspond to different resource limit thresholds, or a plurality of system resource groups can correspond to the same resource limit threshold. It can be understood that the setting of the resource limit threshold can be set according to the test requirements, and the embodiment of the present application does not limit this. The system resources can include processor resources, memory resources, network resources, etc. The preset tool can be a tool for limiting, controlling and separating the resources of a process group, for example: the preset tool can be cgroup software, and accordingly, the system resource group can be a control group (cgroup).

[0065] In step 102, based on the preset test command, the traffic of the multiple virtual terminals corresponding to the multiple virtual network card ports is tested to obtain the test result corresponding to the intelligent network card.

[0066] In the embodiment of the present application, the preset test command can be used to instruct the server to run the network card test program to test the traffic of the multiple virtual terminals corresponding to the multiple virtual network card ports of the server. The test type can include performance test, stress test, packet loss rate test, etc. The network card test program can be deployed in the server. In response to the preset test command, the network card test program is run to test the traffic of the multiple virtual terminals corresponding to the multiple virtual network card ports based on the preset network card test script file. The network card test program can include network card performance test program, network card stress test program, etc. The corresponding network card test script file can include network card performance test script file, network card stress test script file, etc. Since the multiple virtual network card ports are obtained based on the virtualization of the intelligent network card, testing the traffic of the multiple virtual terminals corresponding to the multiple virtual network card ports can realize the test of the intelligent network card, and further obtain the test result corresponding to the intelligent network card. For example, in the case of performance test instructed by the preset test command, the corresponding parameters of the network card performance test script file are set according to actual needs, the test task is generated and the network card performance test script file is run to perform the network card performance test. Through the network automatic packet sending tool, different size data packets can be continuously sent to the multiple virtual terminals corresponding to the multiple virtual network card ports for testing. When the test is completed, the network card performance test parameters of the multiple virtual terminals corresponding to the intelligent network card are generated and saved. It can be understood that based on the network card performance test parameters of the multiple virtual terminals corresponding to all the virtual network card ports, the network card performance test result corresponding to the intelligent network card can be obtained.

[0067] In summary, in the embodiment of the present application, by dividing the system resources of the server, a plurality of system resource groups corresponding to a plurality of virtual network card ports are obtained; the plurality of system resource groups correspond to a plurality of resource limit thresholds, the resource limit threshold corresponding to each system resource group is used to limit the resource usage of the system resources in each system resource group, the plurality of virtual network card ports are obtained based on the virtualization of the intelligent network card in the server, and the plurality of system resource groups and the plurality of virtual network card ports correspond one by one; based on a preset test command, the traffic of a plurality of virtual terminals corresponding to the plurality of virtual network card ports is tested, and a test result corresponding to the intelligent network card is obtained. In this way, by dividing the system resources of the server, a plurality of system resource groups corresponding to a plurality of virtual network card ports are obtained, and in the case of testing the traffic of a plurality of virtual terminals corresponding to the plurality of virtual network card ports, the system resources corresponding to each virtual network card port are independent and do not interfere with each other. Further, the resource usage of the system resources of the system resource group corresponding to the virtual network card port reflects the resource load corresponding to the virtual network card port, that is, by limiting the resource usage of the system resources, the resource load corresponding to the virtual network card port can be reduced to a certain extent. In this way, by setting the resource limit threshold to limit the resource usage of the system resources of the system resource group, the system resource load corresponding to each virtual network card port can also be limited to a certain extent, and then a diversified test scene for testing different system resource loads can be constructed to meet diversified test requirements, and the comprehensiveness of the network card test is improved to a certain extent.

[0068] Further, in the case of testing a plurality of virtual terminals corresponding to a plurality of virtual network card ports, it is not necessary to deploy upper virtualization software such as kvm, xen, vmware and the like, and by dividing the system resources of the server and setting the resource limit threshold, a test environment can be quickly deployed, the test period is shortened to a certain extent, and the time spent for the network card test is reduced.

[0069] Optionally, the embodiment of the present application can further include the following steps:

[0070] Step 201, based on a target processing instruction, the intelligent network card is virtualized to obtain the plurality of virtual network card ports.

[0071] In the embodiment of the present application, the target processing instruction can be used to instruct the virtualization of the intelligent network card. In response to the target processing instruction, the intelligent network card is configured for virtualization through the intelligent network card driver to obtain a plurality of virtual network card ports. The intelligent network card driver is a driver corresponding to the intelligent network card, which is generally provided by the manufacturer of the intelligent network card and is not limited here. For example, the SR-IOV technology supported by the network card can be used to allow the intelligent network card to map the physical port to a plurality of virtual network card ports, so that each virtual network card port can be bound to a virtual machine, thereby saving processor resources and improving network latency and overall performance. It can be understood that the creation method of the virtual network card port is different for network cards produced by different manufacturers, and the number of virtual network card ports that can be created may also be different. The number of virtual network card ports can be set according to the test requirements in combination with the characteristics of the network card, for example, the number of virtual network card ports can be set to the maximum number of ports supported by the intelligent network card, such as 8.

[0072] Correspondingly, step 101 can include the following steps:

[0073] Step 202, for any virtual network card port in the plurality of virtual network card ports, the system resources used by the virtual terminal corresponding to the virtual network card port in the system resources of the server are divided into the same system resource group.

[0074] In the embodiment of the present application, in the case of obtaining a plurality of virtual network card ports, the processes running in the virtual terminal corresponding to each virtual network card port will occupy a part of the system resources in the server, therefore, the system resources used by the virtual terminal corresponding to the virtual network card port can be used as the basis for dividing the system resource group, that is, the system resource group contains the system resources used by the virtual terminal corresponding to the same virtual network card port, such as processor resources, memory resources, network resources, etc.

[0075] In the embodiment of the present application, by virtualizing the intelligent network card to obtain a plurality of virtual network card ports, and dividing the system resources used by the virtual terminal corresponding to the virtual network card port into the same system resource group, the system resources used by the virtual terminal corresponding to the virtual network card port can be isolated and split to a certain extent, which facilitates different resource load settings for the system resources used by the virtual terminal corresponding to different virtual network card ports, and further constructs different load test scenarios.

[0076] Optionally, the resource limit threshold includes a first threshold and a second threshold.

[0077] Step 202 can include the following steps:

[0078] Step 2021, create a control resource pool for the virtual network card port, and assign the processes in the virtual terminal corresponding to the virtual network card port to the control resource pool.

[0079] In the embodiment of the present application, for any virtual network card port in the plurality of virtual network card ports, a control resource pool is created for the virtual network card port. Resource pool is considered as a design pattern, and the resources here mainly refer to system resources, which are not exclusively owned by a process or internal resources. A client requests resources from the pool and uses the returned resources for specified operations. When the client finishes using the resources, the resources are put back into the pool instead of being released or discarded. Illustratively, the creation of the control resource pool can be achieved by the following steps: mkdir / sys / fs / cgroup / cpuset / disk_resources_cpu. Each virtual terminal corresponding to a virtual network card port runs a process, and the processes in the virtual terminal corresponding to the virtual network card port can be assigned to the control resource pool. The processes in the virtual terminal can include the processes currently running on the virtual terminal and the processes to be subsequently run on the virtual terminal. Illustratively, the assignment of the processes in the virtual terminal to the control resource pool can be achieved by the following steps: echo$$> / sys / fs / cgroup / cpuset / disk_resources_cpu / tasks.

[0080] Step 2022, set the first threshold and the second threshold for the control resource pool, and divide the system resources used by the processes assigned to the control resource pool into the same system resource group; the first threshold is used to limit the processor resources used by the processes, and the second threshold is used to limit the memory resources used by the processes.

[0081] In this embodiment of the invention, a first threshold is set for the control resource pool to limit the processor resource usage of processes in the virtual terminal corresponding to the virtual network interface card port within the control resource pool. The first threshold includes at least a threshold for limiting the amount of processor resources used, a threshold for limiting the number of processor cores used, and a threshold for limiting processor utilization. The first threshold is used to limit the amount of processor resources used, the number of processor cores, and the processor utilization of processes in the virtual terminal corresponding to the virtual network interface card port within the control resource pool. By setting the first threshold, the processor resource usage, such as the amount of processor resources used, the number of processor cores, and the processor utilization of processes in the virtual terminal corresponding to the virtual network interface card port within the control resource pool, can be controlled within the first threshold range. A second threshold is set for the control resource pool to limit the memory resource usage of processes in the virtual terminal corresponding to the virtual network interface card port within the control resource pool. The second threshold may include a threshold for limiting the amount of memory resources used. The second threshold is used to limit the amount of memory resources used by processes in the virtual terminal corresponding to the virtual network interface card port within the control resource pool. By setting the second threshold, the memory resource usage, such as the amount of memory resources used by processes in the virtual terminal corresponding to the virtual network interface card port within the control resource pool, can be controlled within the first threshold range.

[0082] Binding a control resource pool to a system resource group (cgroup) enables resource management. System resources used by processes allocated to the control resource pool are grouped into the same system resource group. These system resources can include processor resources, memory resources, and network resources used by processes in the virtual terminal corresponding to the virtual network interface port.

[0083] In this embodiment of the invention, by allocating the processes in the virtual terminal corresponding to the virtual network interface card port to the control resource pool, and setting a first threshold to limit the processor resources used by the processes and a second threshold to limit the memory resources used by the processes in the control resource pool, the resource quota used by the processes in the virtual terminal corresponding to the virtual network interface card port can be controlled, thus preventing a certain process from occupying too many system resources and balancing the occupation of system resources.

[0084] Optionally, the system resource group includes network resources used by processes running in the control resource pool.

[0085] Embodiments of the present invention may further include the following steps:

[0086] Step 301: Create a corresponding network namespace for the virtual network interface card (NIC) port; different virtual NIC ports correspond to different network namespaces, and different network namespaces are isolated from each other.

[0087] In this embodiment of the invention, a corresponding network namespace is created for each virtual network interface card (NIC) port. A network namespace (ns) is a code organization method used in many programming languages. Namespaces are used to categorize and distinguish different code functions, preventing conflicts caused by identical variable names when different code snippets (typically used by different people collaborating or calling existing code snippets) are used simultaneously. For each virtual NIC port, a corresponding network namespace is created. Different network namespaces are isolated from each other; that is, the network resources used by processes running in virtual terminals corresponding to different virtual NIC ports are isolated and do not interfere with each other.

[0088] Step 302: Allocate the network resources in the system resource group allocated to the virtual network card port to the network namespace.

[0089] In this embodiment of the invention, the network resources used by the processes running in the virtual terminal corresponding to the virtual network interface card (NIC) port in the system resource group are allocated to the network namespace created for that NIC port. Further, a target virtual interface corresponding to the NIC port can be created within the network namespace to assign the NIC port to the network namespace. For example, a blank virtual interface can be created within the network namespace and connected to the NIC port to be assigned (i.e., the NIC port corresponding to the network namespace), using this blank virtual interface as the target virtual interface. An Internet Protocol Address (IP address) is configured for the current network namespace, and a virtual LAN name is configured for the NIC port. After configuration, the NIC port is marked as assigned.

[0090] In this embodiment of the invention, by allocating network resources to network namespaces, each network namespace has its own independent network resources. Therefore, different processes running in different virtual terminals corresponding to different virtual network card ports do not interfere with each other's use of the same resource in their respective network namespaces, thus avoiding a process occupying too many network resources and affecting the test results of the network card.

[0091] Optionally, embodiments of the present invention may further include the following steps:

[0092] Step 401: Set the multiple virtual network interface card ports to the same network segment, and establish a communication connection between the multiple virtual network interface card ports based on the virtual switch in the server.

[0093] In this embodiment of the invention, a virtual switch (openvswitch, OVS) can be deployed in the server. The mapped ports of multiple virtual network interface cards (NICs) are added to the bridge of the virtual switch configured in the smart NIC. By setting the IP addresses of multiple virtual NICs in the same network segment, communication between the multiple virtual NICs can be ensured.

[0094] For example, allocating network resources used by processes running in a virtual terminal corresponding to a virtual network interface card port in a system resource group to the network namespace can be achieved through the following steps:

[0095] Taking virtual network interface cards (NICs) as vf1 and vf2 as examples, network namespace 1 (ns1) is created for vf1 and network namespace 2 (ns2) is created for vf2 respectively:

[0096] 1) Create a network namespace 1

[0097] 1. Create a netns application named ns1

[0098] #ip netns add ns1

[0099] 2. Start the loopback interface in the namespace.

[0100] #ip netns exec ns1 ip link set lo up

[0101] 2) Add vf1 to namespace 1

[0102] 1. Add virtual interface 1 to the created network namespace.

[0103] #ip link set eth1 netns ns1

[0104] 2. Enable namespace ns1

[0105] &&ip netns exec ns1 ip link set eth1 up

[0106] 3. Configure IP addresses for the current namespace.

[0107] ip netns exec ns1 ip addr add 1.1.1.10 / 24dev eth1

[0108] 3) Create a network namespace 2

[0109] 1. Create a netns application named ns2

[0110] #ip netns add ns2

[0111] 2. Start the loopback interface in the namespace.

[0112] #ip netns exec ns2 ip link set lo up

[0113] 4) Add network port 2 to namespace 2

[0114] 1. Add virtual interface 2 to the created network namespace.

[0115] #ip link set eth2 netns ns2

[0116] 2. Enable namespace ns2

[0117] &&ip netns exec ns2 ip link set eth2 up

[0118] 3. Configure IP addresses for the current namespace.

[0119] #ip netns exec ns2 ip addr add 1.1.1.20 / 24dev eth2

[0120] Accordingly, embodiments of the present invention may further include the following steps:

[0121] For example, Figure 2 This illustrates a system topology diagram of the server's internal structure, such as... Figure 2 As shown, different system resource groups correspond to different virtual network interface card (NIC) terminals, and correspondingly, different network namespaces. In the diagram, VF1, VF2, VF3, and VF4 represent different virtual NIC terminals, while netns1, netns2, netns3, and netns4 represent different network namespaces. Different IP addresses are configured for these different network namespaces: 1.1.1.10 / 24, 1.1.1.20 / 24, 1.1.1.30 / 24, and 1.1.1.40 / 24. Communication connections are established between the different virtual NIC ports through a virtual switch (openvswitch in the diagram).

[0122] Step 402: Based on the preset test command, control the multiple virtual terminals corresponding to the multiple virtual network card ports that have established communication connections to continuously send and receive data, and obtain the test results corresponding to the smart network card.

[0123] In this embodiment of the invention, a test network card script file is pre-set according to testing needs. Based on a preset test command, the network card test script file in the network card test program is run. A sending virtual network card port and a receiving virtual network card port are selected from multiple virtual network card ports. The network card test script file is used to make the sending virtual network card port send the test file to the receiving virtual network card port in a loop, and the sending time and receiving time are recorded. The consistency between the file received by the receiving virtual network card port and the test file is verified. Based on the data during the data transmission and reception process, the performance of the smart network card is obtained, so as to realize the testing of the smart network card and obtain the corresponding test results.

[0124] In this embodiment of the invention, a virtual switch is used to establish communication connections between different virtual network interface card (NIC) ports. NIC testing is then performed based on preset test commands. This allows for functional performance testing of multiple virtual NICs on a single server, eliminating the need for multiple servers to test multiple virtual NICs and reducing hardware investment. Furthermore, by automatically testing multiple virtual NIC ports connected to the virtual switch, the workload of testing personnel is reduced, saving testing time.

[0125] Optionally, step 402 may include the following steps:

[0126] Step 4021: Based on the first test command and the first test model indicated by the first test command, control the multiple virtual network card ports to continuously send and receive data, and obtain the bandwidth data during the data sending and receiving process as the network bandwidth test result corresponding to the smart network card.

[0127] In this embodiment of the invention, the test operation can be performed using software for traffic testing, such as iperf software. A first test command is used to instruct the network bandwidth of multiple virtual network interface card (NIC) ports to be tested. The first test command can be a TCP-based test command, such as: iperf -c 100.14.4.253 -t 60. Correspondingly, the first test model indicated by the first test command can be a TCP model. Based on the first test model indicated by the first test command, multiple virtual NIC ports are controlled to continuously send and receive data, and bandwidth data during the data transmission and reception process is obtained as the network bandwidth test result corresponding to the smart NIC.

[0128] Step 4022: Based on the second test command and the second test model indicated by the second test command, control the multiple virtual network interface card ports to continuously send and receive data, and obtain the data packet throughput, packet loss rate and transmission delay jitter time during the data sending and receiving process as the data loss test results corresponding to the smart network interface card.

[0129] In this embodiment of the invention, the second test command is used to instruct tests on the packet throughput, packet loss, and transmission delay jitter of multiple virtual network interface card (NIC) ports. The first test command can be a UDP-based test command, such as `iperf -c 100.14.4.253-t60 –u`. Correspondingly, the second test command indicates a UDP-based test model. Based on the second test command, multiple virtual NIC ports are controlled to continuously send and receive data, and the packet throughput, packet loss rate, and transmission delay jitter time during the data transmission and reception process are obtained as the data loss test results corresponding to the smart NIC. The data loss test results may include packet throughput, packet loss rate, and latency metrics.

[0130] In this embodiment of the invention, different types of tests can be performed on the smart network card based on different test commands, thereby improving the diversity of test types.

[0131] Optionally, embodiments of the present invention may further include the following steps:

[0132] Step 501: Evaluate the performance of the smart network card based on the network bandwidth test results and the data loss test results.

[0133] In this embodiment of the invention, based on network bandwidth test results and data loss test results, if the network bandwidth test results and data loss test results meet the expected results, the performance of the smart network card is evaluated as good; if the network bandwidth test results and data loss test results do not meet the expected results, the performance of the smart network card is evaluated as poor. For example, a packet loss rate of less than 1% can be considered as good performance of the smart network card. It is understood that the expected results can be set according to the test requirements, and this embodiment of the invention does not impose any limitations on this.

[0134] In one possible implementation, multiple virtual network interface card (NIC) ports can be controlled to continuously send and receive data, perform stress tests and load tests on the smart NIC, and other tests are not limited in this embodiment of the present invention.

[0135] For example, Figure 3 A flowchart illustrating a testing method for a smart network interface card is shown, such as... Figure 3As shown, the server hardware environment is initialized, enabling Single Root I / O Virtualization (SR-IOV) and network interface card (NIC) virtualization in the server's Basic Input Output System (BIOS). Multiple virtual NIC ports are obtained based on the virtualization of the smart NIC. The server's system resources are partitioned based on the system resources used by the processes in the virtual terminals corresponding to each virtual NIC port, resulting in system resource groups corresponding to the multiple virtual NIC terminals. Using a virtual switch, the network resources used by the processes in the virtual terminals corresponding to each virtual NIC port are allocated to different network namespaces to isolate them. Traffic tests are conducted on the virtual terminals corresponding to different virtual NIC ports to obtain the test results for the smart NIC.

[0136] Figure 4 This is a structural diagram of a testing device for a smart network interface card (NIC) provided in an embodiment of the present invention. The device may include:

[0137] The first partitioning module 601 is used to partition the system resources of the server to obtain multiple system resource groups corresponding to multiple virtual network interface card ports; the multiple system resource groups correspond to multiple resource limit thresholds, and the resource limit thresholds corresponding to each system resource group are used to limit the resource usage of the system resources in each system resource group; the multiple virtual network interface card ports are obtained based on the virtualization of the smart network interface cards in the server; and the multiple system resource groups correspond one-to-one with the multiple virtual network interface card ports.

[0138] The first test module 602 is used to test the traffic of multiple virtual terminals corresponding to the multiple virtual network card ports based on preset test commands, and obtain the test results corresponding to the smart network card.

[0139] Optionally, the device may further include:

[0140] The first processing module is used to virtualize the smart network card based on the target processing instructions to obtain the multiple virtual network card ports;

[0141] The first partitioning module 601 may include:

[0142] The first partitioning submodule is used to partition the system resources of the server's system resources used by the virtual terminal corresponding to the virtual network interface port into the same system resource group for any one of the plurality of virtual network interface ports.

[0143] Optionally, the resource restriction threshold includes a first threshold and a second threshold; the first partitioning submodule may include:

[0144] The first creation module is used to create a control resource pool for the virtual network interface port and allocate the processes in the virtual terminal corresponding to the virtual network interface port to the control resource pool.

[0145] The first setting module is used to set the first threshold and the second threshold for the control resource pool, and to divide the system resources used by the processes allocated to the control resource pool into the same system resource group; the first threshold is used to limit the processor resources used by the process, and the second threshold is used to limit the memory resources used by the process.

[0146] Optionally, the system resource group includes network resources used by processes running in the control resource pool; the device may further include:

[0147] The second creation module is used to create a corresponding network namespace for the virtual network interface port; different virtual network interface ports correspond to different network namespaces, and different network namespaces are isolated from each other.

[0148] The first allocation module is used to allocate network resources in the system resource group allocated for the virtual network card port to the network namespace.

[0149] Optionally, the device may further include:

[0150] The second setting module is used to set the multiple virtual network interface card ports to the same network segment, and to establish a communication connection between the multiple virtual network interface card ports based on the virtual switch in the server.

[0151] The first test module 602 may include:

[0152] The first control module is used to control multiple virtual terminals corresponding to the multiple virtual network card ports that have established communication connections to continuously send and receive data based on the preset test command, so as to obtain the test results corresponding to the smart network card.

[0153] Optionally, the preset test command includes a first test command and a second test command; the first control module may include:

[0154] The first control submodule is used to control the multiple virtual network interface card ports to continuously send and receive data based on the first test command and the first test model indicated by the first test command, and to obtain bandwidth data during the data sending and receiving process as the network bandwidth test result corresponding to the smart network interface card.

[0155] The second control submodule is used to control the multiple virtual network interface card ports to continuously send and receive data based on the second test command and the second test model indicated by the second test command, and to obtain the data packet throughput, packet loss rate and transmission delay jitter time during the data sending and receiving process as the data loss test results corresponding to the smart network interface card.

[0156] Optionally, the device may further include:

[0157] The first evaluation module is used to evaluate the performance of the smart network card based on the network bandwidth test results and the data loss test results.

[0158] In summary, the smart network interface card (NIC) testing device provided in this embodiment of the invention divides the server's system resources to obtain multiple system resource groups corresponding to multiple virtual NIC ports. These multiple system resource groups correspond to multiple resource limitation thresholds, which are used to limit the resource usage of system resources within each group. The multiple virtual NIC ports are obtained based on the virtualization of the smart NICs in the server, and each system resource group corresponds one-to-one with a virtual NIC port. Based on preset test commands, the traffic of multiple virtual terminals corresponding to the multiple virtual NIC ports is tested, yielding test results for the smart NICs. Thus, by dividing the server's system resources to obtain multiple system resource groups corresponding to multiple virtual NIC ports, the system resources corresponding to each virtual NIC port are independent and do not interfere with each other when testing the traffic of multiple virtual terminals corresponding to multiple virtual NIC ports. Furthermore, the resource usage of the system resources in the system resource groups corresponding to the virtual NIC ports reflects the resource load of the virtual NIC ports; that is, by limiting the resource usage of system resources, the resource load of the virtual NIC ports can be reduced to a certain extent. In this way, by setting resource limit thresholds to restrict the resource usage of system resources in system resource groups, the system resource load corresponding to each virtual network card port can also be limited to a certain extent. This allows for the construction of diverse test scenarios for testing different system resource loads, meeting diverse testing needs and improving the comprehensiveness of network card testing to a certain extent.

[0159] The present invention also provides an electronic device, see [link to relevant documentation]. Figure 5 The system includes: a processor 701, a memory 702, and a computer program 7021 stored in the memory and executable on the processor. When the processor executes the program, it implements the testing method for the smart network card of the aforementioned embodiment.

[0160] The present invention also provides a readable storage medium, wherein when the instructions in the storage medium are executed by the processor of an electronic device, the electronic device is able to perform the testing method of the smart network card of the foregoing embodiments.

[0161] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.

[0162] The algorithms and displays provided herein are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used in conjunction with the teachings herein. The required structure for constructing such systems is apparent from the above description. Furthermore, this invention is not directed to any particular programming language. It should be understood that the contents of the invention described herein can be implemented using various programming languages, and the above description of specific languages ​​is for the purpose of disclosing the best mode of implementation of the invention.

[0163] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.

[0164] Similarly, it should be understood that, in order to simplify the invention and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof. However, this disclosure should not be construed as reflecting an intention that the claimed invention requires more features than expressly recited in each claim. Rather, as reflected in the following claims, inventive aspects lie in fewer than all features of the single embodiment disclosed above. Therefore, the claims following the detailed description are hereby expressly incorporated into this detailed description, wherein each claim itself is a separate embodiment of the invention.

[0165] Those skilled in the art will understand that modules in the device of the embodiments can be adaptively changed and placed in one or more devices different from that embodiment. Modules, units, or components in the embodiments can be combined into a single module, unit, or component, and further, they can be divided into multiple sub-modules, sub-units, or sub-components. Except where at least some of such features and / or processes or units are mutually exclusive, any combination can be used to combine all features disclosed in this specification (including the accompanying claims, abstract, and drawings) and all processes or units of any method or device so disclosed. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstract, and drawings) may be replaced by an alternative feature that serves the same, equivalent, or similar purpose.

[0166] The various component embodiments of the present invention can be implemented in hardware, or as software modules running on one or more processors, or a combination thereof. Those skilled in the art will understand that microprocessors or digital signal processors (DSPs) can be used in practice to implement some or all of the functions of some or all of the components in the sorting device according to the present invention. The present invention can also be implemented as a device or apparatus program for performing part or all of the methods described herein. Such a program implementing the present invention can be stored on a computer-readable medium, or can be in the form of one or more signals. Such signals can be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.

[0167] It should be noted that the above embodiments are illustrative of the invention and not restrictive, and that those skilled in the art can devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third, etc., does not indicate any order. These words can be interpreted as names.

[0168] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0169] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

[0170] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A testing method for a smart network interface card (NIC), characterized in that, Applied to a server, the method includes: The system resources of the server are divided to obtain multiple system resource groups corresponding to multiple virtual network interface card (NIC) ports; the multiple system resource groups correspond to multiple resource limit thresholds, and the resource limit thresholds corresponding to each system resource group are used to limit the resource usage of the system resources in each system resource group. The multiple virtual NIC ports are obtained based on the virtualization of the smart NICs in the server, and the multiple system resource groups correspond one-to-one with the multiple virtual NIC ports. Based on preset test commands, the traffic of multiple virtual terminals corresponding to the multiple virtual network interface card ports is tested to obtain the test results corresponding to the smart network interface card; The method includes: Based on the target processing instructions, the smart network card is virtualized to obtain the multiple virtual network card ports; The allocation of system resources for the server includes: For any virtual network interface port among the plurality of virtual network interface ports, the system resources of the server's system resources used by the virtual terminal corresponding to the virtual network interface port are divided into the same system resource group; The resource restriction threshold includes a first threshold and a second threshold; the step of dividing the system resources of the server's system resources used by the virtual terminal corresponding to the virtual network card port into the same system resource group includes: A control resource pool is created for the virtual network interface card (NIC) port, and the processes in the virtual terminal corresponding to the virtual NIC port are allocated to the control resource pool; the processes in the virtual terminal include the processes currently running in the virtual terminal and the processes to be run on the virtual terminal in the future. Set a first threshold and a second threshold for the control resource pool, and divide the system resources used by the processes allocated to the control resource pool into the same system resource group; the first threshold is used to limit the processor resources used by the process, and the second threshold is used to limit the memory resources used by the process.

2. The method according to claim 1, characterized in that, The system resource group includes network resources used by processes running in the control resource pool; the method further includes: Create a corresponding network namespace for the virtual network interface port; different virtual network interface ports correspond to different network namespaces, and different network namespaces are isolated from each other; The network resources in the system resource group allocated to the virtual network card port are allocated to the network namespace.

3. The method according to claim 1, characterized in that, The method further includes: Configure the multiple virtual network interface card (NIC) ports on the same network segment, and establish communication connections between the multiple virtual NIC ports based on the virtual switch in the server; The process of testing the traffic of multiple virtual terminals corresponding to the multiple virtual network interface card ports based on preset test commands to obtain the test results corresponding to the smart network interface card includes: Based on the preset test command, the multiple virtual terminals corresponding to the multiple virtual network card ports that have established communication connections are controlled to continuously send and receive data, thereby obtaining the test results corresponding to the smart network card.

4. The method according to claim 3, characterized in that, The preset test commands include a first test command and a second test command; the step of controlling multiple virtual terminals corresponding to the multiple virtual network card ports with established communication connections to continuously send and receive data based on the preset test commands, and obtaining the test results corresponding to the smart network card, includes: Based on the first test command and the first test model indicated by the first test command, the multiple virtual network interface card ports are controlled to continuously send and receive data, and the bandwidth data during the data sending and receiving process is obtained as the network bandwidth test result corresponding to the smart network interface card. Based on the second test command and the second test model indicated by the second test command, the multiple virtual network interface card ports are controlled to continuously send and receive data, and the data packet throughput, packet loss rate and transmission delay jitter time during the data sending and receiving process are obtained as the data loss test results corresponding to the smart network interface card.

5. The method according to claim 4, characterized in that, The method further includes: The performance of the smart network card is evaluated based on the network bandwidth test results and the data loss test results.

6. A testing device for a smart network interface card (NIC), characterized in that, Applied to a server, the device includes: The first partitioning module is used to partition the system resources of the server to obtain multiple system resource groups corresponding to multiple virtual network interface card (NIC) ports; the multiple system resource groups correspond to multiple resource limit thresholds, and the resource limit thresholds corresponding to each system resource group are used to limit the resource usage of the system resources in each system resource group; the multiple virtual NIC ports are obtained based on the virtualization of the smart NICs in the server; and the multiple system resource groups correspond one-to-one with the multiple virtual NIC ports. The first testing module is used to test the traffic of multiple virtual terminals corresponding to the multiple virtual network interface card ports based on preset test commands, and obtain the test results corresponding to the smart network interface card. The device also includes: The first processing module is used to virtualize the smart network card based on the target processing instructions to obtain the multiple virtual network card ports; The first partitioning module includes: The first partitioning submodule is used to partition the system resources of the server's system resources used by the virtual terminal corresponding to the virtual network interface port into the same system resource group for any one of the plurality of virtual network interface ports; The resource restriction threshold includes a first threshold and a second threshold; the first partitioning submodule includes: The first creation module is used to create a control resource pool for the virtual network interface card port and allocate the processes in the virtual terminal corresponding to the virtual network interface card port to the control resource pool; the processes in the virtual terminal include the processes currently running in the virtual terminal and the processes to be run in the virtual terminal in the future; The first setting module is used to set the first threshold and the second threshold for the control resource pool, and to divide the system resources used by the processes allocated to the control resource pool into the same system resource group; the first threshold is used to limit the processor resources used by the process, and the second threshold is used to limit the memory resources used by the process.

7. An electronic device, characterized in that, include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the test method for the smart network interface card as described in any one of claims 1-5.

8. A readable storage medium, characterized in that, When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device is able to perform the test method of one or more of the smart network cards as described in claims 1-5.

Citation Information

Patent Citations

  • Network card test method and system, terminal and storage medium

    CN115102880A

  • Complete machine dynamic pressure test method and system, terminal and storage medium

    CN115114100A