Method, system, medium, program and device for simulating data path of network card by software
By using the driver module and the virtual network card module to share memory addresses in the Linux system, the parameter configuration of data path information and packet sending and receiving are solved, and the problem of high verification cost after the network card data path is modified is achieved, and the effect of reducing verification cost is achieved.
Patent Information
- Application Number
- CN202411405698.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-10
- Publication Date
- 2025-03-11
AI Technical Summary
After the network card data path is modified, the existing technology requires high time and capital costs to verify.
By using the driver module and the virtual network card module to share the memory address in the Linux system, the parameter configuration of data path information is carried out, and the packet transmission and reception are sent and received based on the shared memory address to simulate the behavior of the network card hardware.
The verification time and capital cost after the network card data path is modified is reduced, and simulation verification is realized through pure software, avoiding direct path verification of hardware network cards.
Smart Images

Figure CN119597600A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communications, and in particular to a method, system, medium, program and device for software emulation of a network card data path. Background Art
[0002] With the rapid development of computer networks, network performance is constantly improving to meet higher and higher application requirements. As an important component connecting computers and networks, the iterative update of network cards is also an indispensable key link. The core and most basic function of a network card is to send and receive data packets. Its ability to process data packets determines the basic performance parameters of a network card.
[0003] The performance test of the NIC is the test of the NIC data path. When the NIC data path changes, the NIC data path needs to be retested. The existing test of the modified NIC data path is generally to directly use the NIC hardware and driver for testing. Because the driver side is pure software, the modification cost of the driver side is relatively low, but the modification cost of the NIC hardware side varies according to different situations: (1) If the NIC hardware is still in the design verification stage, the NIC hardware design can be modified and rebuilt to generate a new verifiable file, but this method is often very time-consuming and time-costly. (2) If the NIC hardware has been formed and the NIC has a certain degree of programmability, it is necessary to modify the data plane on the NIC side. Similarly, its cost is generally several orders of magnitude higher than that of modifying the host side software, and is limited by the programmable freedom of the NIC. (3) If the hardware has been formed and the NIC is not programmable, it is impossible to verify the new solution on the current NIC. In summary, changes to the data path on the NIC side require a large investment and cost. Therefore, if the network card's behavior in processing sent and received packets can be simulated through software on the host side, the verification time and financial costs required for data path modification will be greatly reduced. Summary of the invention
[0004] In view of the above-mentioned shortcomings of the prior art, the purpose of this application is to provide a method, system, medium, program and device for software emulation of network card data path, which is used to solve the problem of high time cost and financial cost of re-verification after network card path modification.
[0005] To achieve the above-mentioned purpose and other related purposes, the first aspect of the present application provides a software simulation method for a network card data path, which is applied to a Linux system; the Linux system includes a driver module and a virtual network card module; the steps of the software simulation method include: the driver module and the virtual network card module share a memory address to perform parameter configuration on data path information; after the parameter configuration of the data path information is completed, the driver module and the virtual network card module send and receive messages based on the shared memory address; wherein, the driver module is used to manage and control the data path information of the network card, and the virtual network card module is used to simulate the behavior of the network card hardware.
[0006] In an embodiment of the first aspect of the present application, the driver module and the virtual network card module share a memory address, and the step of configuring parameters of the data path information includes: loading the driver module and the virtual network card module; the driver module allocates data path resources to each port according to the number of simulated ports; the virtual network card module allocates a corresponding number of memory spaces for configuring the data path information according to the number of simulated ports, and initializes the allocated memory space; the driver module obtains the memory address of the memory space allocated by the virtual network card module by calling the API interface provided by the virtual network card module, and writes the data path information into the memory space allocated to the virtual network card module; the virtual network card module receives the data path information, and processes the data path information to complete the parameter configuration.
[0007] In an embodiment of the first aspect of the present application, the steps of the driver module and the virtual network card module sending messages based on the shared memory address include: the driver module stores the message content in the corresponding memory space, fills in the message descriptor, and calls the API interface provided by the virtual network card module to send a message ready-to-send notification to the virtual network card module; the virtual network card module accesses the message descriptor and message content in the shared memory space; the virtual network card module processes the message content according to the requirements of the network protocol; the virtual network card module copies the processed message to the corresponding cache area, and sends a message ready notification to the driver module; after the driver module receives the message ready notification sent by the virtual network card module, it sends a confirmation notification to the virtual network card to confirm that the message is ready, and releases the resources occupied by the sent message.
[0008] In an embodiment of the first aspect of the present application, the message descriptor includes: message length, destination address, source address and protocol type.
[0009] In an embodiment of the first aspect of the present application, the steps for the driver module and the virtual network card module to receive messages based on the shared memory address include: the virtual network card module accesses the shared memory space, copies the received message to the cache used for receiving the message, and updates the corresponding packet receiving descriptor; the virtual network card module notifies the driver module to receive the message; and the driver module processes the received message.
[0010] In an embodiment of the first aspect of the present application, the data path information includes: quantity information of the transceiver packet queues, depth information of the transceiver packet queues, DMA address information and interrupt vector information.
[0011] To achieve the above-mentioned purpose and other related purposes, the second aspect of the present application provides a software simulation system for a network card data path, including: a driver module, which is used to configure parameters of data path information and manage and control the data path information of the network card; a virtual network card module, which is used to configure parameters of data path information and simulate the behavior of network card hardware; the driver module and the virtual network card module share a memory address to configure parameters of the data path information; after the parameter configuration of the data path information is completed, the driver module and the virtual network card module send and receive messages based on the shared memory address.
[0012] To achieve the above-mentioned purpose and other related purposes, the third aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, it implements any one of the software simulation methods of the network card data path.
[0013] To achieve the above-mentioned purpose and other related purposes, the fourth aspect of the present application provides a computer program product, which includes a computer program code. When the computer program code runs on a computer, the computer implements any one of the software simulation methods of the network card data path.
[0014] To achieve the above-mentioned purpose and other related purposes, the fifth aspect of the present application provides a computer device, including a memory, a processor and a computer program stored in the memory, and the processor executes the computer program to implement any one of the software simulation methods of the network card data path.
[0015] As described above, the present application has the following beneficial effects:
[0016] The present invention provides a software simulation method, system, medium, program and device for a network card data path, the method is applied to a Linux system; the Linux system includes a driver module and a virtual network card module; the steps of the software simulation method include: the driver module and the virtual network card module share a memory address to configure parameters for data path information; after the parameter configuration of the data path information is completed, the driver module and the virtual network card module send and receive messages based on the shared memory address; wherein the driver module is used to manage and control the data path information of the network card, and the virtual network card module is used to simulate the behavior of the network card hardware. In summary, this method uses a pure software method, with the Linux system on the host side as the main body, and uses the driver module and virtual network card module inside the Linux system to simulate and verify the modified hardware network card path, avoiding direct path verification of the hardware network card, thereby reducing the verification time cost and capital cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 Shown is a flowchart of a software simulation method for a network card data path in an embodiment of the present application.
[0018] Figure 2 It is a schematic diagram comparing the working principles of the prior art and an embodiment of the present invention in the data path information configuration link.
[0019] Figure 3 It shows a schematic diagram comparing the working principles of the prior art and an embodiment of the present invention in the message sending and receiving link.
[0020] Figure 4 Shown is a timing diagram of a software simulation method for a network card data path in an embodiment of the present application.
[0021] Figure 5 Shown is a schematic diagram of the structure of an electronic terminal in one embodiment of the present application. DETAILED DESCRIPTION
[0022] The following describes the embodiments of the present application through specific examples, and those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. The present application can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.
[0023] In the embodiments of the present application, words such as "first" and "second" are used to distinguish the same or similar items with substantially the same functions and effects. For example, the first XX and the second XX are only used to distinguish different XXs, and do not limit their order. Those skilled in the art can understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit them to be different.
[0024] It should be noted that in the embodiments of the present application, words such as "exemplary" or "for example" represent examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0025] In the embodiments of the present application, "at least one" refers to one or more, and "plurality" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can represent: a, b, c, ab, ac, bc or abc, where a, b, c can be single or multiple.
[0026] like Figure 1 and 4 As shown, the first aspect of the present application provides a software simulation method for a network card data path, which is applied to a Linux system; the Linux system includes a driver module and a virtual network card module; the steps of the software simulation method include:
[0027] S1: The driver module and the virtual network card module share a memory address to perform parameter configuration on data path information.
[0028] Specifically, the driver module and the virtual network card module share a memory address to configure parameters of the data path information, including:
[0029] S101: Load the driver module and the virtual network card module.
[0030] It should be understood that the driver module and the virtual network card module are both software modules inside the Linux system. The driver module is a software component in the operating system, which serves as a bridge between the hardware device and the operating system. The main task of the driver module is to control the hardware device and enable it to work according to the instructions of the operating system. The virtual network card module is a network interface implemented by software, which simulates the function of a physical network card, but is not directly connected to the physical hardware. The virtual network card module can create one or more virtual network ports, which behave like real physical network cards in the operating system. It can handle the reception and transmission of network data packets, and process them according to the network protocol stack. In the Linux system, the driver module and the virtual network card module implement the parameter configuration of the data path information through a shared memory address. This shared memory allows the two modules to exchange data in an efficient manner without the need for complex data copy operations through the operating system kernel. This method can reduce the delay of data transmission and improve the performance of network data processing.
[0031] S102: The driver module allocates data path resources to each port according to the number of simulated ports.
[0032] It should be understood that the data path resources refer to a series of resources required by each virtual port in order to enable smooth network communication. These resources together constitute the path for data transmission between network ports, and these resources generally include: memory buffer (a memory area for storing network data packets to be sent or just received), descriptor ring (used to describe the location, size and status of the data packet buffer in the memory), DMA channel (DMA channel allows network hardware to directly access system memory, thereby reducing the CPU load during data transmission), network device control structure (contains configuration information of network device behavior, such as device status, statistics, hardware parameters, etc.), queue (send queue and receive queue are used to manage messages waiting to be processed), virtual network interface (each simulated port requires a virtual network interface to replace the port of the physical hardware network card), software state machine (used to track and manage the network status and activity of each port), statistics and counters (used to collect network performance data, such as the number of messages transmitted and received, error counts, etc.).
[0033] Specifically, the process of allocating data path resources generally includes: the driver module first evaluates the required resources based on the number of simulated ports, and the required resources include memory and DMA channels, etc. Secondly, the driver module allocates a dedicated area for each port in the memory of the operating system, and the allocated memory will be used to store data packets, descriptors and other control information. Thirdly, the driver module initializes these memory areas, sets default values and clears the memory. In addition, the driver module creates a descriptor ring, which is a circular linked list containing pointers to data packet buffers, data length, status and other information. If the hardware supports DMA, the driver module will also configure a DMA channel for each port so that the network hardware can directly access the memory, thereby improving data transmission efficiency. If the hardware supports interrupts, the driver module configures interrupt resources for each port, including interrupt numbers, interrupt handlers, etc. It should be understood that the examples of the aforementioned driver module allocating data path resources to each port are not complete, and do not constitute a limitation on the actual data module to allocate data path resources. The scheme that enables the driver module to allocate data path resources according to the number of simulated ports falls within the protection scope of the present invention.
[0034] S103: The virtual network card module allocates a corresponding amount of memory space to configure data path information according to the number of simulated ports.
[0035] S104: The virtual network card module initializes the allocated memory space.
[0036] Specifically, after the driver module allocates data path resources, the virtual network card module determines the amount of memory required by each port based on the packet buffer, descriptor, and control structure used by each port, and uses the memory allocation API to allocate memory for each port. After the memory allocation is completed, the virtual network card module sets the initial state of the memory space, such as initializing data structures, setting default values, and configuring the size and number of packet buffers. In addition, the virtual network card module also creates a descriptor ring, each descriptor contains metadata of the packet buffer, and initializes it after creating the descriptor ring. The initialization includes setting the physical and virtual addresses of the packet buffer, the packet length, the status flag, etc. If the hardware supports MDA, the virtual network card module configures DMA properties for each port, including the direction and transfer size of DMA transfers. If interrupts are used, the virtual network card module registers an interrupt handler for each port so that it can respond in time when the packet arrives or is sent. In addition, the virtual network card module configures the network protocol stack for each port, initializes the send and receive packet queues for each port, and sets callback functions. It should be understood that the aforementioned virtual network card module allocates a corresponding number of memory spaces to configure data path information, which is not a complete list and does not constitute a limitation on the actual data path information configuration method, links and steps. Solutions that can allocate a corresponding number of memory spaces to configure data path information according to the number of simulated ports fall within the protection scope of the present invention.
[0037] S105: The driver module obtains the memory address of the memory space allocated by the virtual network card module by calling the API interface provided by the virtual network card module, and writes the data path information into the memory space allocated to the virtual network card module.
[0038] Specifically, first, the driver module calls the API interface provided by the virtual network card module. By calling the API interface, the driver module can obtain the memory address of the memory space allocated by the virtual network card module. The memory space is an area for storing data. The memory space allocated by the virtual network card module can be used to store specific data. After the driver module obtains this memory address, it can directly access this memory space. Then, the driver module writes the data path information into the memory space allocated to the virtual network card module. By writing the data path information into the memory space, the virtual network card module can read this information, thereby realizing the correct transmission and processing of data.
[0039] S106: The virtual network card module receives the data path information, and processes the data path information to complete parameter configuration.
[0040] In an embodiment of the first aspect of the present application, the data path information includes: quantity information of the transceiver packet queues, depth information of the transceiver packet queues, DMA address information and interrupt vector information.
[0041] It should be understood that the number information of the packet transceiver queue refers to the number of receiving and sending queues supported by the simulated network card. The queue is used to classify data packets and process them asynchronously, thereby improving the efficiency of data processing. Each queue can process data packets independently, so increasing the number of queues can improve the ability of network devices to handle a large number of concurrent network connections. The depth information of the packet transceiver queue refers to the number of data packet descriptors that can be stored in each queue. The data packet descriptor is a data structure used to describe the characteristics and storage location of data packets. The size of the queue depth directly affects the ability of the network device to process data packets. The greater the depth, the more data packets can be temporarily stored, but more memory resources are also required. The DMA address information refers to the address used by the network device to directly access the host memory. DMA is a hardware feature that allows the network device to directly transfer data packets from the network interface to the system memory, or from the system memory to the network interface without occupying CPU resources. The interrupt vector information refers to the number used by the operating system to identify and respond to hardware interrupts. In the network device, when a specific event (such as the arrival of a message) occurs, the device will send an interrupt signal to the operating system through the interrupt vector, and the operating system will call the corresponding interrupt handler to handle the event according to the interrupt vector. The configuration of the above parameters ensures that the network device can efficiently process network traffic and work correctly with the operating system and driver. In the virtual network card module, the configuration of these parameters is implemented through Linux system simulation to ensure that the virtual network interface can work like a physical network card.
[0042] S2: After the parameter configuration of the data path information is completed, the driver module and the virtual network card module send and receive messages based on the shared memory address; wherein, the driver module is used to manage and control the data path information of the network card, and the virtual network card module is used to simulate the behavior of the network card hardware.
[0043] Specifically, the step of the driver module and the virtual network card module sending a message based on the shared memory address includes:
[0044] S201: The driver module stores the message content into the corresponding memory space and fills the message descriptor.
[0045] S202: The driver module calls the API interface provided by the virtual network card module to send a message sending notification to the virtual network card module.
[0046] Specifically, the driver module first stores the message content to be sent into the shared memory space configured above, and then fills the message descriptor. After the message descriptor is filled, the driver module calls the API interface provided by the virtual network card module to send a message ready to send notification (message ready to send notification) to the virtual network card module, prompting the virtual network card module that there is a message ready to send.
[0047] In an embodiment of the first aspect of the present application, the message descriptor includes: message length, destination address, source address and protocol type.
[0048] S203: The virtual network card module accesses the message descriptor and message content in the shared memory space. That is, after receiving the notification, the virtual network card module accesses the message descriptor and message content in the shared memory space.
[0049] S204: The virtual network card module processes the message content according to the requirements of the network protocol. That is, the virtual network card module processes the message content according to the requirements of the network protocol. The processing process generally includes checksum calculation, setting protocol fields, encryption, compression, etc. It should be understood that the aforementioned processing process is only exemplary and does not constitute a limitation on the processing process of the present invention.
[0050] S205: The virtual network card module copies the processed message to the corresponding buffer area.
[0051] S206: The virtual network card module sends a message readiness notification to the driver module.
[0052] S207: After receiving the message readiness notification sent by the virtual network card module, the driver module sends a confirmation notification to the virtual network card to confirm that the message is ready.
[0053] S208: The driver module releases the resources occupied by the sent message. Specifically, after the sending operation is completed, the driver module releases the resources occupied by the sent message by clearing descriptors, releasing memory space, etc. By releasing these resources, these resources can be used for sending future messages.
[0054] After sending the message, the driver module and the virtual network card module perform the steps of receiving the message based on the shared memory address, including:
[0055] S209: The virtual network card module accesses the shared memory space, copies the received message to the buffer used for receiving the message, and updates the corresponding packet receiving descriptor.
[0056] Specifically, the virtual network card module copies the message data received from the network to the pre-allocated receive buffer in the shared memory. This buffer is specifically used to temporarily store the received message so that the driver module can read and process it. After the copy is completed, the virtual network card module updates the descriptor of the received message. The descriptor is a data structure that contains message information (such as message location, length, etc.). The purpose of updating the descriptor is to notify the driver module of the detailed information of the message and indicate that the message is ready to be processed.
[0057] S210: The virtual network card module notifies the driver module to receive the message.
[0058] S211: The driver module processes the received message.
[0059] like Figure 2 As shown in FIG. 1 , the upper side of the PCIe line is the host side, and the lower side is the device side. It should be understood that the PCIe is a high-speed serial computer expansion bus standard used for connecting hardware devices inside a computer. In the prior art, the method of using hardware network cards and software drivers to configure parameters of data path information is as follows: Figure 2 As shown on the left side of the dotted line, in the prior art, the host includes a driver, and the device includes a hardware network card. The data path information configuration method in the prior art is: the driver module on the host side directly writes the configuration information into the storage space (card configuration storage) of the hardware network card on the device side, and the hardware network card performs configuration response and processing. The data path software simulation method in the present invention is as follows Figure 2 As shown on the right side of the dotted line, the host side includes a driver module and a virtual network card module, both of which are software modules in the Linux system. Since the present invention simulates the data path of the hardware network card through pure software, there is no hardware network card on the device side. The data path information configuration method in the present invention is: after the virtual network card module on the host side allocates a memory space (host memory for configuration), the driver module sends configuration information to the virtual network card module to configure the network card data path information.
[0060] like Figure 3 As shown, the host side is above the PCIe line, and the device side is below. The method of using hardware network card and software driver to verify the sending and receiving packets in the prior art is as follows: Figure 3As shown on the left side of the dotted line, after receiving the message, the hardware network card uses DMA to transfer the data packet from the buffer of the hardware network card directly to the host memory (DMA uses the host memory), and vice versa, when the host side sends data, DMA transfers the data from the host memory to the buffer of the network card. In addition, in the prior art, after the network card receives the message and processes the message to be sent, it is necessary to notify the driver module through an interrupt to perform subsequent processing, that is, when the DMA controller completes the data transmission task, the DMA controller will send an interrupt signal to the CPU to notify the CPU that the data has been transferred from the network card buffer to the host memory or from the host memory to the network card buffer. The method for verifying the reception and transmission of packets in the present invention is: Figure 3 As shown on the right side of the dotted line, the driver module and the virtual network card module in the present invention directly access the message descriptor and message content by sharing the memory address, thereby replacing the DMA operation. In addition, the virtual network card module of the present invention notifies the driver module to send and receive packets by directly calling the API interface, replacing the interrupt mode in the prior art.
[0061] To achieve the above-mentioned purpose and other related purposes, the second aspect of the present application provides a software simulation system for a network card data path, including:
[0062] A driver module, the driver module is used to configure parameters of the data path information, and manage and control the data path information of the network card;
[0063] A virtual network card module, which is used to configure parameters of data path information and simulate the behavior of network card hardware;
[0064] The driver module and the virtual network card module share a memory address to perform parameter configuration on the data path information; after the parameter configuration of the data path information is completed, the driver module and the virtual network card module send and receive messages based on the shared memory address.
[0065] Since the working principles and technical solutions of the driver module and the virtual network card module in the software simulation system of the network card data path are the same as those of the driver module and the virtual network card module described in the aforementioned software simulation method of the network card data path, they are not described in detail here.
[0066] To achieve the above-mentioned purpose and other related purposes, the third aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, it implements any one of the software simulation methods of the network card data path.
[0067] To achieve the above-mentioned purpose and other related purposes, the fourth aspect of the present application provides a computer program product, which includes a computer program code. When the computer program code runs on a computer, the computer implements any one of the software simulation methods of the network card data path.
[0068] To achieve the above-mentioned purpose and other related purposes, the fifth aspect of the present application provides a computer device, including a memory, a processor and a computer program stored in the memory, and the processor executes the computer program to implement any one of the software simulation methods of the network card data path.
[0069] Figure 5 5 is a schematic block diagram of a computer device / equipment / system provided in an embodiment of the present application. The computer device includes: at least one processor 501, a memory 502, at least one network interface 503 and a user interface 505. The various components in the device are coupled together through a bus system 504. It can be understood that the bus system 504 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 504 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, various buses are marked as bus systems in the figure.
[0070] The user interface 505 may include a display, a keyboard, a mouse, a trackball, a click gun, keys, buttons, a touch pad or a touch screen.
[0071] It is understood that the memory 502 can be a volatile memory or a non-volatile memory, and can also include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM). The memory described in the embodiments of the present invention is intended to include but is not limited to these and any other suitable categories of memory.
[0072] The memory 502 in the embodiment of the present invention is used to store various types of data to support the operation of the electronic terminal 500. Examples of these data include: any executable program used to operate on the electronic terminal 500, such as an operating system 5021 and an application 5022; the operating system 5021 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks. The application 5022 can include various applications, such as a media player (Media Player), a browser (Browser), etc., for implementing various application services. The method provided by the embodiment of the present invention can be included in the application 5022.
[0073] The method disclosed in the above embodiment of the present invention can be applied to the processor 501, or implemented by the processor 501. The processor 501 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 501 or the instruction in the form of software. The above processor 501 may be a general processor, a digital signal processor (DSP, Digital Signal Processor), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The processor 501 can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiment of the present invention. The general processor 501 may be a microprocessor or any conventional processor, etc. In combination with the steps of the accessory optimization method provided in the embodiment of the present invention, it can be directly embodied as a hardware decoding processor to execute, or it can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium, which is located in a memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0074] In an exemplary embodiment, the electronic terminal 500 may be implemented by one or more application specific integrated circuits (ASIC), DSP, programmable logic device (PLD), complex programmable logic device (CPLD) to execute the aforementioned method.
[0075] The terms "component", "module", "system", etc. used in this specification are used to represent computer-related entities, hardware, firmware, a combination of hardware and software, software, or software in execution. For example, a component can be, but is not limited to, a process running on a processor, a processor, an object, an executable file, an execution thread, a program and / or a computer. By way of illustration, both applications running on a computing device and a computing device can be components. One or more components may reside in a process and / or an execution thread, and a component may be located on a computer and / or distributed between two or more computers. In addition, these components may be executed from various computer-readable media having various data structures stored thereon. Components may, for example, communicate through local and / or remote processes according to signals having one or more data packets (e.g., data from two components interacting with another component between a local system, a distributed system and / or a network, such as the Internet interacting with other systems through signals).
[0076] Those of ordinary skill in the art will appreciate that the various illustrative logical blocks and steps described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or in a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0077] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0078] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0079] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0080] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0081] In the above embodiments, the functions of each functional unit can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions (programs). When loading and executing computer program instructions (programs) on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. Computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that contains one or more available media integrations. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a high-density digital video disc (DVD), or a semiconductor medium (e.g., a solid state disk (SSD), etc.). If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0082] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0083] In summary, the present application provides a method, system, medium, program and device for software emulation of network card data path, which effectively overcomes various shortcomings in the prior art and has high industrial utilization value.
[0084] The above embodiments are merely illustrative of the principles and effects of the present application and are not intended to limit the present application. Anyone familiar with the technology may modify or change the above embodiments without violating the spirit and scope of the present application. Therefore, all equivalent modifications or changes made by a person of ordinary skill in the art without departing from the spirit and technical ideas disclosed in the present application shall still be covered by the claims of the present application.
Claims
1. A software simulation method for a network card data path, characterized in that: Applicable to Linux system; The Linux system includes a driver module and a virtual network card module; The steps of the software simulation method include: The driver module and the virtual network card module share a memory address to perform parameter configuration on the data path information; After the parameters of the data path information are configured, the driver module and the virtual network card module send and receive messages based on the shared memory address; wherein, the driver module is used to manage and control the data path information of the network card, and the virtual network card module is used to simulate the behavior of the network card hardware.
2. A method for software simulation of a network card data path according to claim 1, characterized in that: The driver module and the virtual network card module share a memory address to configure parameters of the data path information, including: Loading the driver module and the virtual network card module; The driver module allocates data path resources to each port according to the number of simulated ports; The virtual network card module allocates a corresponding amount of memory space for configuring data path information according to the number of simulated ports, and initializes the allocated memory space; The driver module obtains the memory address of the memory space allocated by the virtual network card module by calling the API interface provided by the virtual network card module, and writes the data path information into the memory space allocated by the virtual network card module; The virtual network card module receives the data path information and processes the data path information to complete parameter configuration.
3. The software simulation method of a network card data path according to claim 1, characterized in that: The step of the driver module and the virtual network card module sending a message based on the shared memory address includes: The driver module stores the message content in the corresponding memory space, fills in the message descriptor, and calls the API interface provided by the virtual network card module to send a message approval notification to the virtual network card module; The virtual network card module accesses the message descriptor and message content in the shared memory space; The virtual network card module processes the message content according to the requirements of the network protocol; The virtual network card module copies the processed message to the corresponding buffer area and sends a message readiness notification to the driver module; After receiving the message readiness notification sent by the virtual network card module, the driver module sends a confirmation notification to the virtual network card to confirm that the message is ready, and releases the resources occupied by the sent message.
4. A method for software simulation of a network card data path according to claim 4, characterized in that: The message descriptor includes: message length, destination address, source address and protocol type.
5. The method for software simulation of a network card data path according to claim 1, characterized in that: The step of the driver module and the virtual network card module receiving the message based on the shared memory address includes: The virtual network card module accesses the shared memory space, copies the received message to the buffer used for receiving the message, and updates the corresponding packet receiving descriptor; The virtual network card module notifies the driver module to receive the message; The driver module processes the received message.
6. The method for software simulation of a network card data path according to claim 1, characterized in that: The data path information includes: quantity information of the receiving and sending packet queues, depth information of the receiving and sending packet queues, DMA address information and interrupt vector information.
7. A software simulation system for a network card data path, characterized in that: include: A driver module, the driver module is used to configure parameters of the data path information, and manage and control the data path information of the network card; A virtual network card module, which is used to configure parameters of data path information and simulate the behavior of network card hardware; The driver module and the virtual network card module share a memory address to perform parameter configuration on the data path information; After the parameter configuration of the data path information is completed, the driver module and the virtual network card module send and receive messages based on the shared memory address.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the software simulation method of the network card data path according to any one of claims 1 to 6 is implemented.
9. A computer program product, characterized in that The computer program product includes a computer program code, and when the computer program code is executed on a computer, the computer implements the software simulation method of the network card data path as described in any one of claims 1 to 6.
10. A computer device comprising a memory, a processor and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the software simulation method for the network card data path according to any one of claims 1 to 6.
Citation Information
Cited By
Verification method and device of chip data surface and electronic equipment
CN121189250A
Cross-platform drive-free network card certificate reading method and device and medium
CN121967097A