A virtual network card implementation method for configuring and managing three-layer switch ports
By integrating PCIE RC, DDR, PCIE EP, DMA into the virtual network card driver in the Linux system, the problem of layer three switch port configuration management is solved, and efficient interaction between layer three switch chips and network protocol stack is achieved, which simplifies the management process and improves system flexibility.
Patent Information
- Application Number
- CN202310081114.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-06
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2043-02-06
AI Technical Summary
In existing network communication systems, it is difficult to effectively configure and manage Layer 3 switch ports, resulting in inconvenient interaction between Layer 3 switch chip and network protocol stack, and the interaction between different drivers increases management complexity.
By integrating PCIE RC, DDR, PCIE EP, and DMA into the driver of the same virtual network card in the Linux system, it supports the creation of multiple virtual network cards and differentiating ports through message header information to realize the interaction between the three-layer switching chip and network protocol stacks such as SONiC.
It realizes efficient configuration management of layer three switch ports, reduces interaction between different drivers, simplifies the management process, and supports multi-port management, improving system flexibility and management convenience.
Smart Images

Figure CN116094918B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of network communication, and in particular to a method for implementing a virtual network card for configuring and managing a three-layer switch port. Background Art
[0002] A network card is a device used to process the communication between a computer or embedded device and an external network. It is the second layer in the seven-layer structure of the traditional OSI (Open System Interconnect) model. The main function of a network card is to receive and send message data. The received data packets need to be passed to the network protocol stack, and the sent message data needs to be passed to the optical fiber or cable through the network card.
[0003] A layer 3 switch is a switch with some router functions, located in the third layer of the seven-layer structure of the traditional OS I model, namely the network layer. Unlike traditional layer 2 switches, layer 3 switches can speed up data message exchange in a local area network with a large network topology, and can route and forward multiple times at a time. Regular data messages are realized at high speed through chip hardware, but software intervention is required for routing table information maintenance and calculation.
[0004] The Linux kernel network subsystem is mainly responsible for managing various network devices and implementing various network protocol stacks, and ultimately realizing the function of connecting other systems through the network. In the Linux kernel, the network subsystem is almost a self-contained system, which includes 5 submodules, and their functions are as follows:
[0005] 1. Network Device Drivers, the drivers of network devices are the same as the device drivers in the Virtual File System (VFS) subsystem;
[0006] 2.Device Independent Interface, device-independent interface, which is the same as that in the VFS subsystem;
[0007] 3. Network Protocols, network protocols, implement various network transmission protocols, such as IP, TCP, UDP, etc.;
[0008] 4. Protocol Independent Interface, a protocol-independent interface that shields different hardware devices and network protocols and provides an interface (socket) in the same format;
[0009] 5. System Call interface, system call interface, provides a unified interface for user space to access network devices.
[0010] Based on the above structure, if the three-layer switch needs to send a message, it needs to receive data through the network card and transmit it to the kernel network protocol stack. When sending configuration, the network card needs to receive data from the kernel network protocol stack and forward it to the optical fiber or cable.
[0011] The virtual network card of the present invention is targeted at the three-layer switching chip, and can configure and manage each port of the switching chip. It can be used for the upper-layer network protocol stack SONiC (Software for Open Networking in the Cloud) that needs to manage the ports of the switching chip, thereby building a "communication" bridge between the network protocol stack and the switching chip.
[0012] In order to solve the above technical problems, the present invention provides a virtual network card implementation method for configuring and managing three-layer switch ports. Based on the Linux system, PCIERC, DDR, PCIE EP, and DMA are integrated into the driver of the same virtual network card, and support the creation of multiple virtual network cards at the same time. The header information in the sent / uploaded messages is used to distinguish whether the messages are from / to the corresponding ports. Functionally, it can meet the interaction between the three-layer switching chip and the network protocol stack such as SONiC, solve the need for configuring and managing the three-layer switch ports, and the same driver reduces the interaction between different drivers, which is easy to manage. Summary of the invention
[0013] In order to solve the above technical problems, the present invention provides a virtual network card implementation method for configuring and managing three-layer switch ports. Based on the Linux system, PCIERC, DDR, PCIE EP, and DMA are integrated into the driver of the same virtual network card, and support the creation of multiple virtual network cards at the same time. The header information in the sent / uploaded messages is used to distinguish whether the messages are from / to the corresponding ports. Functionally, it can meet the interaction between the three-layer switching chip and the network protocol stack such as SONiC, solve the need for configuring and managing the three-layer switch ports, and the same driver reduces the interaction between different drivers, which is easy to manage.
[0014] To achieve the above object, the present invention adopts the following technical solution.
[0015] In an embodiment of the present invention, a method for implementing a virtual network card for configuring and managing a layer 3 switch port is proposed, the method comprising the following steps:
[0016] S1 integrates PCIE RC, DDR, PCIE EP, and DMA into the driver of the same virtual network card;
[0017] The PRO on the S2 switching chip side will send the message that needs to be sent to the CPU, and write the message data to the sending space opened by DDR through PCIE EP and RC through DMA, and a PCIE MSI interrupt will be generated at the same time; the MSI interrupt will be reported to the main control side CPU, and the CPU will enter the MSI interrupt service function at this time; the interrupt service function will call the Linux network protocol stack API to pass the message to the Linux kernel network protocol stack or other network protocol stacks;
[0018] S3 When the main control CPU has configuration to be sent, the CPU writes the message data carrying the configuration information to the sending space in the DDR through the sending API of the virtual network card, and the DMA takes out the message data and transmits it to the PRO module on the switching chip side. When the message transmission is completed, a PCIE MSI interrupt will be generated to tell the CPU that the message processing is completed.
[0019] Furthermore, when managing multiple ports of a three-layer switch, a private header is added before the message sent up / down. The private header contains the port information from / to which the message is sent. The port information is parsed in the network card driver and the message is sent up / down to the corresponding processing function.
[0020] Furthermore, when the main control CPU is powered on, the PCIE RC root node scans each branch of the bus by using a depth-first rule, and enumerates and finds the PCIE terminal node EP.
[0021] Furthermore, the virtual network card includes a main control and a switching chip, wherein the main control side includes: PCIE RC end and DDR; the switching chip side includes: PCIE EP end, DMA and PRO, the PCIE EP end realizes the transmission channel of the message and communicates with the main control RC end, the DMA isolates the CPU to realize high-speed data transmission, and PRO is a business message processing module.
[0022] Furthermore, the DMA puts the message that the switch chip needs to send to the CPU on the DDR of the master control, and takes the configuration message of the master control CPU from the DDR and sends it to the switch chip.
[0023] Furthermore, the virtual network card driver includes a switching chip DMA, EP and DDR (DMA Buffer) part, and its main function is to send / upload messages and interact with the Linux kernel network protocol stack or other network protocol stacks.
[0024] The beneficial effect of the present invention lies in that, in view of the problems existing in the existing network communication system, a virtual network card implementation method for configuring and managing three-layer switch ports is proposed. Based on the Linux system, PCIE RC, DDR, PCIEEP, and DMA are integrated into the driver of the same virtual network card, and it supports the creation of multiple virtual network cards at the same time. The header information in the messages sent up / down is used to distinguish whether the messages are from / to the corresponding ports; functionally, it can meet the interaction between the three-layer switching chip and the network protocol stack such as SONiC, solve the need for configuring and managing the three-layer switch ports, and the same driver reduces the interaction between different drivers, which is easy to manage. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0026] Figure 1 It is a schematic diagram of the process flow of the present invention;
[0027] Figure 2 This is a schematic diagram of the system structure of the first embodiment of the present invention;
[0028] Figure 3 The figure is a schematic diagram of the implementation process of the first embodiment of the present invention. DETAILED DESCRIPTION
[0029] In order to make the purpose, technical solution and advantages of the embodiment of the present invention more clear, the embodiment of the present invention is further described in detail below with reference to the accompanying drawings. The following implementation examples are only used to more clearly illustrate the system method and technical solution of the present invention, and cannot be used to limit the scope of protection of this application.
[0030] According to the implementation mode of the present invention, a virtual network card implementation method for configuring and managing a three-layer switch port is proposed. Based on the Linux system, PCIERC, DDR, PCIE EP, and DMA are integrated into the driver of the same virtual network card, and support is provided for creating multiple virtual network cards at the same time. The header information in the messages sent up / down is used to distinguish the messages coming from / sent to the corresponding ports. Functionally, the interaction between the three-layer switching chip and the network protocol stack such as SONiC can be satisfied, and the requirements for configuring and managing the three-layer switch port can be solved. The same driver reduces the interaction between different drivers, which is convenient for management.
[0031] The principle and spirit of the present invention are explained in detail below with reference to several representative embodiments of the present invention.
[0032] Figure 1 The present invention is a process flow diagram of a method for implementing a virtual network card for configuring and managing a layer 3 switch port. Figure 1 As shown, the method comprises the following steps:
[0033] S1 integrates PCIE RC, DDR, PCIE EP, and DMA into the driver of the same virtual network card;
[0034] The PRO on the S2 switching chip side will send the message that needs to be sent to the CPU, and write the message data to the sending space opened by DDR through PCIE EP and RC through DMA, and a PCIE MSI interrupt will be generated at the same time; the MSI interrupt will be reported to the main control side CPU, and the CPU will enter the MSI interrupt service function at this time; the interrupt service function will call the Linux network protocol stack API to pass the message to the Linux kernel network protocol stack or other network protocol stacks;
[0035] S3 When the main control CPU has configuration to be sent, the CPU writes the message data carrying the configuration information to the sending space in the DDR through the sending API of the virtual network card, and the DMA takes out the message data and transmits it to the PRO module on the switching chip side. When the message transmission is completed, a PCIE MSI interrupt will be generated to tell the CPU that the message processing is completed.
[0036] In specific implementation, when managing multiple ports of a three-layer switch, a private header is added before the messages sent up and down, and the private header contains the port information from / to which the message comes, and the port information is parsed in the network card driver and the message is sent up / down to the corresponding processing function.
[0037] In a specific implementation, when the main control CPU is powered on, the PCIE RC root node scans each branch of the bus through a depth-first rule, and enumerates and finds the PCIE terminal node EP.
[0038] During specific implementation, the virtual network card includes a main control and a switching chip, wherein the main control side includes: PCIE RC end, DDR; the switching chip side includes: PCIE EP end, DMA, PRO, PCIE EP implements the message transmission channel and communicates with the main control PCIE RC end; DMA isolates the CPU to realize high-speed data transmission; PRO is a business message processing module.
[0039] During specific implementation, DMA puts the message that the switch chip needs to send to the CPU on the DDR of the master control, and takes the configuration message of the master control CPU from the DDR and sends it to the switch chip.
[0040] In specific implementation, the virtual network card driver includes a switching chip DMA, EP and DDR (DMA Buffer) part, and its main function is to send and receive messages to interact with the Linux kernel or other network protocol stacks.
[0041] It should be noted that, although the operations of the method of the present invention are described in a specific order in the above embodiments and the accompanying drawings, this does not require or imply that the operations must be performed in the specific order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.
[0042] In order to explain more clearly the above-mentioned virtual network card implementation method for configuring and managing three-layer switch ports, a specific embodiment is used for illustration below. However, it is worth noting that this embodiment is only for better illustrating the present invention and does not constitute an improper limitation to the present invention.
[0043] Embodiment 1:
[0044] The invention discloses a method for realizing a virtual network card for configuring and managing a three-layer switch port. The virtual network card can realize the configuration and management of the three-layer switch port by a service protocol stack. The method integrates PCIE, DMA and a virtual network card driver, has high integration and is easy to manage.
[0045] The virtual network card is Figure 2 The dotted box diagram includes: main control PCIE (high-speed serial computer expansion bus standard, Peripheral Component Interconnect Express) RC (Root Complex), main control DDR, switch chip PCIE EP (Endpoint) end driver, switch chip DMA driver, main control DDR access program and virtual network card driver.
[0046] The virtual network card includes the main control and switching chip:
[0047] Main control side: RC is PCIE RC end, DDR;
[0048] On the switching chip side: EP is the PCIE EP end, which realizes the message transmission channel and communicates with the main control RC end; DMA isolates the CPU to realize high-speed data transmission; PRO is the business message processing module.
[0049] The specific implementation process is driven by three parts:
[0050] 1. Write the PCIE EP driver. When the main control CPU is powered on, the PCIE RC root node scans each branch of the bus through the depth-first rule and enumerates and finds the PCIE terminal node EP;
[0051] When writing the PCIE EP driver, when the main control CPU is powered on, the CPU is not clear about what devices are connected below; therefore, the terminal node EP is detected and discovered by scanning each branch of the bus.
[0052] 2. Write the DMA driver for the switching chip;
[0053] The main function of this part is to put the message that the switching chip needs to send to the CPU on the DDR of the master control and to take the configuration message of the master control CPU from the DDR and send it to the switching chip.
[0054] 3. Write a virtual network card driver, which includes the switch chip DMA, EP and DMA Buffer. Its main function is to send and receive messages and the Linux kernel network protocol stack channel.
[0055] The entire process of message reception can be summarized as follows:
[0056] When the PRO on the switching chip side has a message that needs to be sent to the CPU, the message data is written to the sending space opened by DDR through PCIE EP and RC through DMA, and a PCIE MSI (Message Signaled Interrupts) interrupt is generated at the same time. The interrupt will be reported to the main control side CPU, and the CPU will enter the MSI interrupt service function. The interrupt service function will call the Linux network protocol stack API to pass the message to the Linux kernel or other network protocol stacks (such as SONiC, Quagga, etc.).
[0057] The configuration delivery process is as follows:
[0058] When the main control CPU has configuration to be sent, the CPU writes the message data to the sending space in the DDR through the sending API of the virtual network card, and the DMA takes out the message data and transmits it to the PRO module. When the message transmission is completed, a PCIE MSI interrupt will be generated to tell the CPU that the message processing is completed. The present invention integrates the configuration management of the switching chip into a driver, which is convenient for future maintenance.
[0059] When implementing it, Figure 3 Take ARP packets as an example:
[0060] When a protocol message needs to be sent up, the switch chip transmits it to DMA through the uplink message scheduling module ISCH. DMA writes the message directly to the configured uplink message DDR (DMA Buffer) space through PCIE, that is, the DDR of the master. At this time, the PCIE MSI interrupt will be triggered. The CPU responds to the interrupt service function in the virtual network card virt_net and sends the DDR uplink space ( Figure 3 The UP part of the packet is taken away, and then the data is passed to the Linux kernel network protocol stack through the Linux kernel API (netif_rx or netif_receive_skb) in the agreed format;
[0061] When the Linux protocol stack feedbacks or sends down the configuration, it will eventually call the xmit function of the virtual network card registered with the Linux kernel. This function will write the data sent by the kernel into the sending space in DDR. The DMA controller always polls this sending space. When it finds valid data in the BD (Buffer Descriptor) table space, it automatically sends it from the DDR sending space ( Figure 3 The DOWN part in the SPI obtains data and transmits it to the downlink message scheduling module OSCH. After completion, a PCIE MSI interrupt is generated and reported to the CPU to decide on subsequent actions.
[0062] In specific implementation, when managing multiple ports of a three-layer switch, a private header is added before the messages sent up and down. The private header contains the port number from / to which the message comes. The port information is parsed in the network card driver and the message is sent up / down to the corresponding processing function.
[0063] The beneficial effect of the present invention lies in that, in view of the problems existing in the existing network communication system, a virtual network card implementation method for configuring and managing three-layer switch ports is proposed. Based on the Linux system, PCIE RC, DDR, PCIEEP, and DMA are integrated into the driver of the same virtual network card, and it supports the creation of multiple virtual network cards at the same time. The header information in the messages sent up / down is used to distinguish whether the messages are from / to the corresponding ports; functionally, it can meet the interaction between the three-layer switching chip and the network protocol stack such as SONiC, solve the need for configuring and managing the three-layer switch ports, and the same driver reduces the interaction between different drivers, which is easy to manage.
[0064] The applicant of the present invention has made a detailed explanation and description of the implementation examples of the present invention in conjunction with the drawings in the specification. The above implementation examples are only preferred implementation schemes of the present invention. The detailed description is only to help readers better understand the spirit of the present invention, and it is not a limitation on the protection scope of the present invention. On the contrary, any improvements or modifications based on the inventive spirit of the present invention should fall within the protection scope of the present invention.
Claims
1. A method for implementing a virtual network card for configuring and managing a layer 3 switch port, characterized in that: The method comprises the following steps: Step S1: Integrate PCIE RC, DDR, PCIE EP, and DMA into the driver of the same virtual network card; Step S2: The PRO on the switching chip side writes the message that needs to be sent to the CPU through DMA to the sending space opened by DDR through PCIE EP and RC, and generates a PCIE MSI interrupt at the same time; the MSI interrupt is reported to the main control CPU, and the CPU enters the MSI interrupt service function; the interrupt service function calls the Linux network protocol stack API to pass the message to the Linux kernel network protocol stack or other network protocol stacks; Step S3: When the main control CPU has configuration to be sent, the CPU writes the message data carrying the configuration information to the sending space in the DDR through the sending API of the virtual network card, and the DMA takes out the message data and transmits it to the PRO module on the switching chip side. When the message transmission is completed, a PCIE MSI interrupt will be generated to tell the CPU that the message processing is completed.
2. A method for implementing a virtual network card for configuring and managing a layer 3 switch port according to claim 1, characterized in that: When managing multiple ports of a three-layer switch, a private header is added before the message to be sent up / down. The private header contains the port information from / to which the message is sent. The port information is parsed in the network card driver and the message is sent up / down to the corresponding processing function.
3. The method for implementing a virtual network card for configuring and managing a layer 3 switch port according to claim 1, wherein: When the main control CPU is powered on, the PCIE RC root node scans each branch of the bus by depth-first rule and enumerates and finds the PCIE EP.
4. The method for implementing a virtual network card for configuring and managing a layer 3 switch port according to claim 1, wherein: The virtual network card includes a main control and a switching chip, wherein the main control side includes: PCIE RC end and DDR; the switching chip side includes: PCIE EP end, DMA and PRO, the PCIE EP end realizes the transmission channel of the message and communicates with the main control RC end, the DMA isolates the CPU to realize high-speed data transmission, and the PRO is a business message processing module.
5. The method for implementing a virtual network card for configuring and managing a layer 3 switch port according to claim 1, characterized in that: DMA puts the message that the switch chip needs to send to the CPU on the DDR of the master control, and takes the configuration message of the master control CPU from the DDR and sends it to the switch chip.
6. The method for implementing a virtual network card for configuring and managing a layer 3 switch port according to claim 1, characterized in that: The driver of the virtual network card includes the switching chip DMA, EP and DDR parts, and its main function is to send / upload messages and interact with the Linux kernel network protocol stack or other network protocol stacks.
Citation Information
Patent Citations
Construction set for climatised roofs or facades and its use as evaporator
EP0000543A2
High-speed isolation network method and terminal based on PCIE
CN106789099A
RTOS network sharing method based on virtual machine monitor
CN115599502A