CN115412502B - Network port expansion and message rapid equalization processing method - Google Patents

Network port expansion and message rapid equalization processing method Download PDF

Info

Publication number
CN115412502B
CN115412502B CN202211359114.6A CN202211359114A CN115412502B CN 115412502 B CN115412502 B CN 115412502B CN 202211359114 A CN202211359114 A CN 202211359114A CN 115412502 B CN115412502 B CN 115412502B
Authority
CN
China
Prior art keywords
dpdk
queue
qdma
module
virtual network
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202211359114.6A
Other languages
Chinese (zh)
Other versions
CN115412502A (en
Inventor
沈文君
周正平
曹建业
叶韬
李合元
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Lab
Original Assignee
Zhejiang Lab
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Lab filed Critical Zhejiang Lab
Priority to CN202211359114.6A priority Critical patent/CN115412502B/en
Publication of CN115412502A publication Critical patent/CN115412502A/en
Application granted granted Critical
Publication of CN115412502B publication Critical patent/CN115412502B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/12Avoiding congestion; Recovering from congestion
    • H04L47/125Avoiding congestion; Recovering from congestion by balancing the load, e.g. traffic engineering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/30Peripheral units, e.g. input or output ports
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/35Switches specially adapted for specific applications
    • H04L49/354Switches specially adapted for specific applications for supporting virtual local area networks [VLAN]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/90Buffering arrangements
    • H04L49/9015Buffering arrangements for supporting a linked list

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a method for expanding a network port and quickly balancing and processing a message, which comprises the following steps: firstly, a virtual network port is established in a virtual network port module of a server end, a physical function queue is established in an FPGA-QDMA module of the FPGA end, the virtual network port module and the FPGA-QDMA module are connected through a DPDK-QDMA module of the server end, the physical function queues are redistributed to be in one-to-one correspondence with the virtual network ports, and the network port of the FPGA end is expanded; secondly, creating a lock-free queue, a memory pool and a thread when the DPDK-QDMA module is started, and guiding the virtual network port module and the FPGA-QDMA module to complete starting resource creation and allocation; and step three, when the network message is received and transmitted between the server side and the FPGA side, the DPDK-QDMA module is used for transmitting the network message to the virtual network port and the physical function queue corresponding to the virtual network port, so that the parallel and rapid processing of the message is realized.

Description

Network port expansion and message rapid equalization processing method
Technical Field
The invention belongs to the field of computer networks, and relates to a network port expansion and message rapid equalization processing method.
Background
A large number of different business programs run simultaneously in the server equipment, each program needs an independent network port to perform network message interaction with external services, and the number of the native network port equipment of the server is generally small, so that the requirements cannot be met. For the application scene, the network port can be expanded through the FPGA with the 100G network port, and the parallel, balanced and rapid processing effects of network messages are achieved by utilizing the QDMA (queue direct memory access) function of the FPGA, the advantages of a multi-core processor of the server and the advantages of DPDK (data plane development kit), so that the design of an effective and practical network port expansion and rapid message balanced processing method based on the DPDK and the QDMA is the key for realizing the resource requirements of the network port of the server.
Disclosure of Invention
In order to solve the technical problems in the prior art, the invention provides a network port expansion and message rapid equalization processing method, which has the following specific technical scheme:
a network port expansion and message rapid equalization processing method comprises the following steps:
firstly, a virtual network port is established in a virtual network port module of a server end, a physical function queue is established in an FPGA-QDMA module of the FPGA end, the virtual network port module and the FPGA-QDMA module are connected through a DPDK-QDMA module of the server end, one physical function queue is redistributed to be in one-to-one correspondence with the virtual network port, and the network port of the FPGA end is expanded;
step two, creating a lock-free queue, a memory pool and a thread when the DPDK-QDMA module is started, and guiding the virtual network port module and the FPGA-QDMA module to complete starting resource creation and allocation;
and step three, when the server side and the FPGA side receive and transmit the network messages, the virtual network port and the physical function queue corresponding to the virtual network port are transmitted to the network messages through the DPDK-QDMA module.
Further, the creating of the lock-free queue, the memory pool and the thread in the step two when the DPDK-QDMA module is started specifically includes the following sub-steps:
(2.1) initializing an environment variable, acquiring the number n of physical functions PF supported by an FPGA-QDMA module, acquiring the number k of virtual network ports to be created according to a user configuration file, and calculating to obtain the number m = k/n of queues PF _ queue allocated to each physical function PF;
(2.2) creating a lock-free queue and a memory pool required by the virtual network port module, which specifically comprises the following steps:
(2.2.1) creating memory pools mbuf _ pool _ tx _ vn [ 1-k ] of k virtual network ports for storing and sending messages, wherein each memory pool comprises p rte _ mbuf memories;
(2.2.2) creating a lock-free queue vn _ port _ tx _ q [ 1-k ] of k virtual network ports for sending messages, wherein the queue depth is p;
(2.2.3) creating a lock-free queue vn _ DPDK _ tx _ q [ 1-k ] of k virtual network ports for sending messages to a DPDK-QDMA module, wherein the depth of the queue is p;
(2.2.4) establishing a lock-free queue vn _ DPDK _ rx _ q [ 1-k ] of k virtual network ports for receiving messages from a DPDK-QDMA module, wherein the queue depth is p;
(2.3) creating a memory pool and a thread required by the DPDK-QDMA module, which specifically comprises the following steps:
(2.3.1) creating n memory pools mbuf _ pool _ rx _ pf [ 1-n ] for storing received messages by the DPDK-QDMA modules, wherein each memory pool comprises (m multiplied by p) rte _ mbuf memories;
(2.3.2) creating n threads QDMA _ ingress _ pthread for forwarding FPGA-QDMA module messages to the virtual network port module, and binding the threads QDMA _ ingress _ pthread to run on the CPU [ 1-n ];
(2.3.3) creating n threads QDMA _ offsets _ pthread for forwarding the virtual network port module message to the FPGA-QDMA module, and binding the threads QDMA _ offsets _ pthread to run on the CPU [ (n + 1) -2 n ];
(2.4) sending a command to the virtual network port module, acquiring information, and then creating a kernel thread for receiving and sending messages, specifically comprising:
(2.4.1) informing a virtual network port module to create k virtual network ports and obtaining the MAC addresses of the virtual network ports and the promiscuous mode;
(2.4.2) sending the physical addresses of the lock-free queues vn _ port _ tx _ q [ 1-k ], vn _ dpdk _ rx _ q [ 1-k ] and the memory pools mbuf _ pool _ tx _ vn [ 1-k ] for storing the sending messages to the virtual network port module;
(2.4.3) informing the virtual network port module to create a kernel thread for receiving messages from the DPDK-QDMA module and a kernel thread for sending messages to the DPDK-QDMA module;
(2.5) sending information to the FPGA-QDMA module, specifically comprising:
(2.5.1) sending the queue PF _ queue distributed by each physical function PF to the FPGA-QDMA module;
(2.5.2) sending the MAC addresses and the promiscuous mode of the k virtual network ports to the FPGA-QDMA module.
Further, the step two of guiding the virtual network port module to complete the creation and allocation of the starting resource specifically includes the following substeps:
(3.1) creating k virtual network ports, distributing MAC addresses for the ports, setting a promiscuous mode, and sending the MAC addresses and the promiscuous mode of all the ports to a DPDK-QDMA module;
(3.2) storing the physical addresses of lock-free queues vn _ port _ tx _ q [ 1-k ], vn _ dpdk _ rx _ q [ 1-k ] and memory pools mbuf _ pool _ tx _ vn [ 1-k ] for storing and sending messages;
(3.3) creating n kernel threads rx _ from _ DPDK _ kthread for receiving messages from the DPDK-QDMA module, and binding the n kernel threads rx _ from _ DPDK _ kthread to the CPU [ (2n + 1) -3 n ] for operation;
(3.4) creating a kernel thread tx _ to _ DPDK _ balance _ kthread for sending a message to the DPDK-QDMA module, and binding the kernel thread to a CPU [3n +1] for running.
Further, the step two of guiding the FPGA-QDMA module to complete the creation and allocation of the start resource specifically includes the following sub-steps:
(4.1) creating k queues PF _ queue [ 1-k ], each physical function PF being assigned m queues;
and (4.2) creating two lists, namely vn _ promisc _ list and vn _ normal _ list, according to whether the virtual network port opens the promiscuous mode, respectively storing the information of the virtual network port with the promiscuous function opened and the information of the virtual network port without the promiscuous function opened, storing the corresponding relation between the MAC address and the virtual network port, and simultaneously storing the corresponding relation between the virtual network port and the physical function queue.
Further, the third step is specifically:
the method comprises the steps that an FPGA-QDMA module receives network messages of a 100G network port, a sending physical function queue corresponding to the network messages is designated according to message types, a promiscuous mode and a target MAC address, a thread QDMA _ entries _ pthread is operated on a DPDK-QDMA module, a thread rx _ from _ DPDK _ kthread is operated on a virtual network port, and the network messages are sent to the virtual network port corresponding to the queue through the sending physical function queue;
the virtual network port receives the network message, runs a thread tx _ to _ DPDK _ balance _ kthread on the virtual network port module, runs a thread QDMA _ equations _ pthread on the DPDK-QDMA module, sends the network message to the FPGA-QDMA module through a physical function queue corresponding to the virtual network port, and finally sends the network message out through a 100G network port;
when the physical function queue corresponding to a certain virtual network port is in congestion, the network message is distributed to the idle physical function queue for transmission through the virtual network port module and the FPGA-QDMA module.
Further, the FPGA-QDMA module receives a network packet of a 100G network port, and specifies a physical transmission function queue corresponding to the network packet according to a packet type, a promiscuous mode, and a destination MAC address, and specifically includes the following sub-steps:
(5.1.1) receiving an external network message by the FPGA terminal through a 100G network port;
(5.1.2) judging whether the network message is a broadcast packet, if so, executing (5.1.3), otherwise, executing (5.1.4);
(5.1.3) duplicating the network messages which are the broadcast packets into k network messages, and sequentially assigning a sending physical function queue pf _ queue _ send corresponding to the messages to the k network messages;
(5.1.4) calculating the number promisc _ nums of the list vn _ promisc _ list, copying promisc _ nums messages, and sequentially assigning a corresponding physical function sending queue pf _ queue _ send to the messages according to the virtual network port number of the list vn _ promisc _ list;
(5.1.5) polling the list vn _ normal _ list, finding out the virtual network port number with the mac address same as the message, and appointing a sending physical function queue pf _ queue _ send corresponding to the message;
(5.1.6) judging whether a physical sending function queue pf _ queue _ send corresponding to the network message is full, if so, executing (5.1.7), otherwise, executing (5.1.10);
(5.1.7) defining temporary variable arrays qdma _ to _ dpdk _ q _ pkgs [ 1-k ] and qdma _ to _ dpdk _ PF _ pkgs [ 1-n ], calculating the number of messages to be read of each queue of PF _ queue [ 1-k ], respectively saving the number of messages to be read of each queue to the arrays qdma _ to _ dpdk _ q _ pkgs, calculating the number of messages to be read of each physical function of PF [ 1-n ] according to the arrays qdma _ to _ dpdk _ q _ pkgs, and respectively saving the number of messages to be read of each physical function of PF [ 1-n ] to the arrays qdma _ to _ dpdk _ PF _ pkgs;
(5.1.8) defining temporary variables a and b, finding a minimum value at qdma _ to _ dpdk _ pf _ pkgs [ 1-n ], recording an index as a, finding a minimum value at qdma _ to _ dpdk _ q _ pkgs [ (32 a-31) -32 a ], recording an index as b, judging whether pf _ queue [ b ] is full, if so, discarding the message, otherwise, executing (5.1.9);
(5.1.9) modifying a network message sending physical function queue pf _ queue _ send = pf _ queue [ b ], adding a vlan field in the message, and filling a corresponding virtual network port number;
(5.1.10) in turn sends the message to the designated corresponding sending physical function queue pf _ queue _ send.
Further, the running of the thread QDMA _ ingrress _ pthread in the DPDK-QDMA module specifically includes the following sub-steps:
(5.2.1) defining temporary variables i, j and c and a linked list pkts _ burst _ rx _ l capable of storing p rte _ mbuf memory addresses, polling a queue set PF _ queue [ ((i-1) m + 1) -im ] of PF [ i ], acquiring a currently polled queue PF _ queue [ j ], reading the message number c of PF _ queue [ j ], judging whether the read message number c is in the range of [ 1-p ], if so, executing (5.2.2), and otherwise, executing (5.2.1);
(5.2.2) applying for c rte _ mbuf memories from an mbuf _ pool _ rx _ pn [ i ] memory pool, acquiring network messages of a queue pf _ queue [ j ], sequentially storing the messages to rte _ mbuf memories, inserting rte _ mbuf memory addresses into a linked list pkts _ burst _ rx _ l, judging whether the array pkts _ burst _ rx is empty, if so, executing (5.2.1), otherwise, executing (5.2.3);
(5.2.3) circularly acquiring the readable element rte _ mbuf memory of the linked list pkts _ burst _ rx _ l, judging whether reading is finished, if so, executing (5.2.1), and if not, executing (5.2.4);
(5.2.4) judging whether the lock-free queue vn _ dpdk _ rx _ q [ j ] is full, if yes, discarding the message in the rte _ mbuf memory, and executing (5.2.3), otherwise, executing (5.2.5);
(5.2.5) obtaining a free element vn _ from _ dpdk _ item of the lock-free queue vn _ dpdk _ rx _ q [ j ], assigning the address of rte _ mbuf memory to the vn _ from _ dpdk _ item, inserting the address into the lock-free queue vn _ dpdk _ rx _ q [ j ], and executing (5.2.3).
Further, the running of the thread rx _ from _ dpdk _ kthread at the virtual network port and the sending of the network packet to the virtual network port corresponding to the queue by sending the physical function queue specifically includes the following sub-steps:
(5.4.1) defining temporary variables i and j, polling a lock-free queue set vn _ dpdk _ rx _ q [ ((i-1) m + 1) -im ], obtaining a currently polled lock-free queue vn _ dpdk _ rx _ q [ j ], judging whether vn _ dpdk _ rx _ q [ j ] is empty, if yes, executing (5.4.1), and if no, executing (5.4.2);
(5.4.2) defining a threshold value of the number of elements of a single queue of single reading vn _ dpdk _ rx _ q, circularly obtaining the readable elements dpdk _ rx _ item of the vn _ dpdk _ rx _ q [ j ], judging whether the reading of the vn _ dpdk _ rx _ q [ j is finished or the number of the read elements reaches the defined threshold value, if so, stopping circularly executing (5.4.1), otherwise, executing (5.4.3);
(5.4.3) defining a temporary variable vn _ port, judging whether a rte _ mbuf memory message of the dpdk _ rx _ item contains a vlan field, if so, acquiring a virtual network port number from the vlan, assigning the virtual network port number to the vn _ port, deleting the vlan field from the message, otherwise, vn _ port = j, and executing (5.4.4);
(5.4.4) applying for an sk _ buff memory, copying a packet of rte _ mbuf memory to the sk _ buff memory, calling a netif _ rx _ ni function to send the sk _ buff memory to a virtual network port vn _ port, releasing rte _ mbuf memory, deleting dpdk _ rx _ item from vn _ dpdk _ rx _ q [ j ], and executing (5.4.2).
Further, the virtual network port receives the network message and inserts the network message into the lock-free queue, and the method specifically includes the following substeps:
(6.1.1) defining a temporary variable i, and applying for a rte _ mbuf memory in a memory pool mbuf _ pool _ tx _ vn [ i ];
(6.1.2) judging whether a lock-free queue vn _ port _ tx _ q [ i ] corresponding to the virtual network port i is full, if so, discarding the network message, otherwise, executing (6.1.3);
(6.1.3) obtaining a free element vn _ tx _ item of a lock-free queue vn _ port _ tx _ q [ i ], copying a network message in the sk _ buff memory to rte _ mbuf memory, assigning a rte _ mbuf memory address to the vn _ tx _ item, inserting the vn _ tx _ item into the vn _ port _ tx _ q [ i ] queue, and releasing the sk _ buff memory.
Further, the running of the thread tx _ to _ DPDK _ balance _ kthread at the virtual network port module, the running of the thread QDMA _ equations _ pthread at the DPDK-QDMA module, the sending of the network packet to the FPGA-QDMA module through the physical function queue corresponding to the virtual network port, and the sending out through the 100G network port specifically include the following substeps:
(6.3.1) defining a temporary variable i, circularly polling a lock-free queue set vn _ port _ tx _ q [ 1-k ], obtaining a currently polled lock-free queue vn _ port _ tx _ q [ i ], judging whether vn _ port _ tx _ q [ i ] is empty, if so, executing (6.3.1), otherwise, executing (6.3.2);
(6.3.2) setting a message lock-free queue sent to the DPDK-QDMA module: vn _ dpdk _ tx _ q _ cur = vn _ dpdk _ tx _ q [ i ];
(6.3.3) defining a threshold value of the number of elements of a single queue of each read vn _ port _ tx _ q, circularly acquiring the readable elements vn _ tx _ item of the vn _ port _ tx _ q [ i ], judging whether the reading of the vn _ port _ tx _ q [ i ] is finished or the number of the read elements reaches the set threshold value, if so, stopping the circular execution (6.3.1), otherwise, executing (6.3.4);
(6.3.4) determining whether vn _ dpdk _ tx _ q _ cur is full, if yes, executing (6.3.5), otherwise executing (6.3.8);
(6.3.5) defining a temporary variable array vn _ to _ dpdk _ q _ single _ pkgs [ 1-k ], calculating the number of messages to be sent of each queue of vn _ dpdk _ tx _ q [ 1-k ], and respectively storing the number of the messages to be sent to the array vn _ to _ dpdk _ q _ single _ pkgs;
(6.3.6) defining a temporary variable array vn _ to _ dpdk _ q _ master _ pkgs [ 1-n ], dividing the vn _ dpdk _ tx _ q [ 1-k ] into 4 groups, wherein each group of queues is respectively vn _ dpdk _ tx _ q [ 1-m ], …, vn _ dpdk _ tx _ q [ ((n-1) m + 1) -nm ], calculating the number of messages to be sent in each group according to the array vn _ to _ dpdk _ q _ single _ pkgs, and storing the number of messages to be sent in the array vn _ to _ dpdk _ q _ master _ pkgs;
(6.3.7) defining temporary variables a and b, finding the minimum value at vn _ to _ dpdk _ q _ master _ pkgs [ 1-n ], marking the index as a, finding the minimum value at vn _ dpdk _ tx _ q [ ((a-1) m + 1) -am ], marking the index as b, judging whether vn _ dpdk _ tx _ q [ b ] is full, if yes, discarding the message, executing (6.3.3), otherwise, vn _ dpdk _ tx _ q _ cur = vn _ dpdk _ tx _ q [ b ], and executing (6.3.8);
(6.3.8) obtaining a vn _ dpdk _ tx _ q _ cur free element dpdk _ tx _ item, assigning rte _ mbuf memory address of the vn _ tx _ item to dpdk _ tx _ item, inserting dpdk _ tx _ item into vn _ dpdk _ tx _ q _ cur, deleting vn _ port _ tx _ q [ i ] of vn _ tx _ item, and executing (6.3.3);
(6.4.1) redefining temporary variables i and j, polling a lock-free queue set vn _ dpdk _ tx _ q [ ((i-1) m + 1) -im ], obtaining a currently polled lock-free queue vn _ dpdk _ tx _ q [ j ], judging whether vn _ dpdk _ tx _ q [ j ] is empty, if yes, executing (6.4.1), and if no, executing (6.4.2);
(6.4.2) defining a temporary variable capable of storing a linked list pkts _ burst _ tx _ l of p rte _ mbuf memory addresses, defining a threshold value of the number of elements of a single read vn _ dpdk _ tx _ q queue as p, circularly obtaining the readable elements dpdk _ tx _ item of vn _ dpdk _ tx _ q [ j ], judging whether the reading of vn _ dpdk _ tx _ q [ j ] is finished or the number of the read elements reaches p, if so, stopping circular execution (6.4.1), otherwise, inserting rte _ mbuf memory addresses of dpdk _ tx _ item into pkts _ burst _ tx _ l, deleting the dpdk _ tx _ item from the vn _ dpdk _ tx _ q [ j ], and executing (6.4.3);
(6.4.3) calling rte _ eth _ tx _ burst function to send the message in the linked list pkts _ burst _ tx _ l to the PF _ queue [ j ] queue of PF [ i ] of the FPGA-QDMA module, and releasing rte _ mbuf memory in the linked list pkts _ burst _ tx _ l by rte _ eth _ tx _ burst function to execute (6.4.1);
and (6.5) polling PF _ queue [ 1-k ] queues of PF [ 1-n ] by the FPGA-QDMA module message sending function, sequentially acquiring messages and sending the messages to a 100G network port.
Compared with the prior art, the invention has the following beneficial effects:
1. according to the invention, a physical function queue of the FPGA-QDMA module corresponds to a virtual network port of the virtual network port module, and a 100G network port of the FPGA is expanded into k network ports, so that the function of network port expansion is realized, and the cost is effectively reduced;
2. the invention realizes the parallel and rapid processing of the message by utilizing the multithreading, lock-free queue, zero-copy and CPU binding technology of the server end and the characteristics of QDMA multi-physical function and multi-queue of the FPGA end;
3. the virtual network ports are distributed with fixed physical function queues to transmit network messages, and when a certain virtual network port is in network congestion, the network messages are distributed to idle queues to be transmitted, so that the rapid balanced transmission of the network messages is realized, and the packet loss rate when the network messages are congested is greatly reduced.
Drawings
FIG. 1 is an overall architecture diagram of the present invention;
FIG. 2 is a main flowchart of a method for processing network port expansion and rapid message balancing according to the present invention;
FIG. 3 is a flow chart of the FPGA-QDMA module receiving an external network message and sending the message to a corresponding physical function queue according to the present invention;
FIG. 4 is a flowchart of forwarding an FPGA-QDMA module message to a virtual network port module at a DPDK-QDMA module according to the present invention;
FIG. 5 is a flowchart illustrating a method for forwarding DPDK-QDMA (digital Pre-distortion-Quadrature direct memory Access) module packet to a virtual network port kernel at a virtual network port module according to the present invention;
FIG. 6 is a flow chart of a virtual network port of the present invention sending a network message and inserting a lock-free queue;
FIG. 7 is a flowchart illustrating forwarding of a virtual network port packet to a DPDK-QDMA module at a virtual network port module according to the present invention;
fig. 8 is a flowchart of forwarding a virtual network port module message to an FPGA-QDMA module at a DPDK-QDMA module according to the present invention.
Detailed Description
In order to make the objects, technical solutions and technical effects of the present invention more apparent, the present invention is further described in detail below with reference to the accompanying drawings and embodiments of the specification.
As shown in fig. 1, the overall architecture of the present invention is formed by connecting a server end and an FPGA end through a PCIe bus, wherein a virtual network port module is run on a kernel layer of the server end, and a DPDK-QDMA module is run on an application layer; and an FPGA-QDMA module is operated at the FPGA end.
And the CPU of the server end is at least a 16-core processor, wherein the cores [1 to 13] of the CPU are set to be in an isolated state to prevent the cores from being used by other service processes or threads of the system.
As shown in fig. 2, the method for processing network port expansion and packet fast equalization based on DPDK and QDMA of the present invention specifically includes the following steps:
step one, k virtual network ports are established in a virtual network port module of a server end, k physical function queues are established in an FPGA-QDMA module of an FPGA end, a DPDK-QDMA module of the server end is connected with the virtual network port module and the FPGA-QDMA module, the physical function queues are redistributed to be in one-to-one correspondence with the virtual network ports, 100G network ports of the FPGA end are expanded into k network ports, network port expansion is realized, in the embodiment, k is 128,
step two, creating a lock-free queue, a memory pool and a thread when the DPDK-QDMA module is started, and guiding the virtual network port module and the FPGA-QDMA module to complete the creation and allocation of starting resources, wherein the specific steps comprise:
the creating of the lock-free queue, the memory pool and the thread when the DPDK-QDMA module is started specifically comprises the following substeps:
(2.1) calling a function rte _ eal _ init to complete initialization of an environment variable, acquiring the number n of physical functions supported by the FPGA-QDMA module, wherein n is 4 in the embodiment, acquiring the number 128 of virtual network ports to be created according to a user configuration file, and calculating to obtain the number m of queues PF _ queue allocated to each PF, wherein m =128/4=32;
(2.2) creating a memory pool and a lock-free queue required by the virtual network port module, which comprises the following specific steps:
(2.2.1) creating memory pools mbuf _ pool _ tx _ vn [ 1-128 ] of 128 virtual network ports for storing and sending messages, wherein each memory pool comprises p =4096 rte _ mbuf memories;
(2.2.2) creating a lock-free queue vn _ port _ tx _ q [ 1-128 ] with a queue depth of p =4096, wherein 128 virtual network ports send messages;
(2.2.3) creating a lock-free queue vn _ DPDK _ tx _ q [ 1-128 ] of 128 virtual network ports for sending messages to the DPDK-QDMA module, wherein the queue depth is p =4096;
(2.2.4) creating a lock-free queue vn _ DPDK _ rx _ q [ 1-128 ] with 128 virtual network ports for receiving messages from the DPDK-QDMA module, wherein the queue depth is p =4096.
(2.3) creating a memory pool and a thread required by the DPDK-QDMA module, which comprises the following specific steps:
(2.3.1) creating memory pools mbuf _ pool _ rx _ pf [ 1-4 ] of 4 DPDK-QDMA modules for storing received messages, wherein each memory pool comprises 131072 (32 x 4096) rte _ mbuf memories;
(2.3.2) creating 4 threads QDMA _ ingress _ pthread for forwarding the FPGA-QDMA module message to the virtual network port module, and binding the threads QDMA _ ingress _ pthread to run on the CPU [ 1-4 ];
(2.3.3) creating 4 threads QDMA _ integers _ pthread for forwarding the virtual network port module message to the FPGA-QDMA module, and binding the threads QDMA _ integers _ pthread to run on the CPUs [ 5-8 ].
(2.4) sending commands and acquiring information to the virtual network port module, which comprises the following steps:
(2.4.1) informing the virtual network port module to create 128 virtual network ports and obtaining the MAC addresses of the virtual network ports and the promiscuous mode;
(2.4.2) sending the physical addresses of the lock-free queues vn _ port _ tx _ q [ 1-128 ], vn _ dpdk _ rx _ q [ 1-128 ] and the memory pools mbuf _ pool _ tx _ vn [ 1-128 ] for storing sent messages to the virtual network port module;
and (2.4.3) informing the virtual network port module to create a message kernel thread for receiving the message from the DPDK-QDMA module and a message kernel thread for sending the message to the DPDK-QDMA module.
(2.5) sending information to the FPGA-QDMA module, and specifically comprising the following steps:
(2.5.1) sending the queue PF _ queue allocated by each physical function PF to the FPGA-QDMA module;
and (2.5.2) sending the MAC addresses of the k virtual network ports and the promiscuous mode to the FPGA-QDMA module.
The specific steps of the virtual network port module in the step (2) for completing the establishment and allocation of the starting resources are as follows:
(3.1) creating 128 virtual network ports, distributing MAC addresses for the ports, setting a promiscuous mode, and sending the MAC addresses and the promiscuous mode of all the ports to a DPDK-QDMA module;
(3.2) storing the physical addresses of lock-free queues vn _ port _ tx _ q [ 1-128 ], vn _ dpdk _ rx _ q [ 1-128 ] and memory pools mbuf _ pool _ tx _ vn [ 1-128 ] for storing sending messages;
(3.3) creating 4 kernel threads rx _ from _ DPDK _ kthread for receiving messages from the DPDK-QDMA module, and binding the kernel threads rx _ from _ DPDK _ kthread to run in a CPU [ 9-12 ];
(3.4) creating a kernel thread tx _ to _ dkdkdkdkdkk _ balance _ kthread for sending a message to the DPDK-QDMA module, and binding the kernel thread to the CPU [13] for operation;
the FPGA-QDMA module in the step (2) completes the specific steps of starting resource creation and allocation as follows:
(4.1) creating 128 queues PF _ queue [ 1-128 ], allocating 32 queues to each physical function PF, and corresponding relation: PF [1] - > PF _ queue [ 1-32 ], PF [2] - > PF _ queue [ 33-64 ], PF [3] - > PF _ queue [ 65-96 ], PF [4] - > PF _ queue [ 97-128 ];
and (4.2) creating two lists, namely vn _ promisc _ list and vn _ normal _ list, according to whether the virtual network port opens the promiscuous mode, respectively storing the information of the virtual network port with the promiscuous function opened and the information of the virtual network port without the promiscuous function opened, storing the corresponding relation between the MAC address and the virtual network port, and simultaneously storing the corresponding relation between the virtual network port and the physical function queue.
And step three, when the server side and the FPGA side receive and send the network messages, the DPDK-QDMA module is used as a bridge for network message transmission, and the virtual network port and the physical function queue corresponding to the virtual network port are transmitted to the network messages through the DPDK-QDMA module.
The method specifically comprises the following steps:
the method comprises the steps that an FPGA-QDMA module receives an external network message input from a 100G network port, a sending physical function queue corresponding to the message is designated according to the message type, the promiscuous mode and a destination MAC address, a thread QDMA _ ingress _ pthread is operated on a DPDK-QDMA module, a thread rx _ from _ DPDK _ ktread is operated on a virtual network port, and the message is sent to the corresponding virtual network port through the queue;
the virtual network port receives the network message, runs a thread tx _ to _ DPDK _ balance _ kthread on the virtual network port module, runs a thread QDMA _ integers _ pthread on the DPDK-QDMA module, sends the network message to the FPGA-QDMA module through a physical function queue corresponding to the virtual network port, and finally sends the network message out through a 100G network port;
when the physical function queue corresponding to a certain virtual network port is in congestion, the virtual network port module and the FPGA-QDMA module distribute network messages to idle physical function queues for transmission, so that rapid balanced transmission of the network messages is realized.
The network message receiving process comprises the following specific steps:
(5.1) the network message receiving function of the FPGA-QDMA module: receiving an external network message and sending the external network message to a corresponding physical function queue, that is, receiving a network message of a 100G network port by an FPGA-QDMA module, and designating a sending physical function queue corresponding to the network message according to a message type, a promiscuous mode and a destination MAC address, as shown in fig. 3, the specific steps are as follows:
(5.1.1) receiving an external network message by the FPGA terminal through a 100G network port;
(5.1.2) judging whether the network message is a broadcast packet, if so, executing (5.1.3), otherwise, executing (5.1.4);
(5.1.3) copying the network messages which are the broadcast packets into 128 network messages, and sequentially assigning a sending physical function queue pf _ queue _ send corresponding to the messages to the 128 network messages;
(5.1.4) calculating the number promisc _ nums of the list vn _ promisc _ list, copying promisc _ nums messages, and sequentially assigning a corresponding physical function sending queue pf _ queue _ send to the messages according to the virtual network port number of the list vn _ promisc _ list;
(5.1.5) polling the list vn _ normal _ list, finding out the virtual network port number with the mac address same as the message, and appointing a sending physical function queue pf _ queue _ send corresponding to the message;
(5.1.6) judging whether a physical sending function queue pf _ queue _ send corresponding to the network message is full, if so, executing (5.1.7), otherwise, executing (5.1.10);
(5.1.7) defining temporary variable arrays qdma _ to _ dpdk _ q _ pkgs [ 1-128 ] and qdma _ to _ dpdk _ PF _ pkgs [ 1-4 ], calculating the number of messages to be read of each queue of PF _ queue [ 1-128 ], respectively saving the number of messages to be read to the arrays qdma _ to _ dpdk _ q _ pkgs, calculating the number of messages to be read of each physical function of PF [ 1-4 ] according to the arrays qdma _ to _ dpdk _ q _ pkgs, and respectively saving the number of messages to be read to the arrays qdma _ to _ dpdk _ PF _ pkgs;
(5.1.8) defining temporary variables a and b, finding the minimum value at qdma _ to _ dpdk _ pf _ pkgs [ 1-4 ], marking the index as a, finding the minimum value at qdma _ to _ dpdk _ q _ pkgs [ (32 a-31) -32 a ], marking the index as b, judging whether pf _ queue [ b ] is full, if so, discarding the message, otherwise, executing (5.1.9);
(5.1.9) modifying a network message sending queue pf _ queue _ send = pf _ queue [ b ], adding a vlan field in the message, and filling a corresponding virtual network port number;
(5.1.10) sequentially sending the message to the designated corresponding sending physical function queue pf _ queue _ send.
(5.2) in the DPDK-QDMA module, running a thread QDMA _ ingrress _ pthread, and forwarding the FPGA-QDMA module message to the virtual network port module, as shown in FIG. 4, the specific steps are as follows:
(5.2.1) defining temporary variables i, j and c and a linked list pkts _ burst _ rx _ l capable of storing 4096 rte _ mbuf memory addresses, polling a queue set PF _ queue [ (32 i-31) -32 i ] of PF [ i ], acquiring the currently polled queue PF _ queue [ j ], reading the message number c of PF _ queue [ j ], judging whether the read message number c is in the range of [ 1-4096 ], if so, executing (5.2.2), otherwise, executing (5.2.1);
(5.2.2) applying c rte _ mbuf memories from the mbuf _ pool _ rx _ pn [ i ] memory pool, calling rte _ eth _ rx _ burst function to obtain network messages of a queue pf _ queue [ j ], sequentially storing the messages to rte _ mbuf memories, inserting rte _ mbuf memory addresses into a linked list pkts _ burst _ rx _ l, judging whether the array pkts _ burst _ rx is empty, if so, executing (5.2.1), and otherwise, executing (5.2.3);
(5.2.3) circularly acquiring the readable element rte _ mbuf memory of the linked list pkts _ burst _ rx _ l, judging whether reading is finished, if so, executing (5.2.1), and if not, executing (5.2.4);
(5.2.4) judging whether the lock-free queue vn _ dpdk _ rx _ q [ j ] is full, if yes, discarding the message in the rte _ mbuf memory, and executing (5.2.3), otherwise, executing (5.2.5);
(5.2.5) obtaining a free element vn _ from _ dpdk _ item of the lock-free queue vn _ dpdk _ rx _ q [ j ], assigning the address of rte _ mbuf memory to the vn _ from _ dpdk _ item, inserting the address into the lock-free queue vn _ dpdk _ rx _ q [ j ], and executing (5.2.3).
(5.3) the DPDK-QDMA module runs 4 functional equivalent QDMA _ ingress _ pthread threads simultaneously;
(5.4) in the virtual network port module, running a thread rx _ from _ DPDK _ kthread, forwarding the DPDK-QDMA module packet to the virtual network port kernel, that is, sending the network packet to the virtual network port corresponding to the queue by sending a physical function queue, as shown in fig. 5, the specific steps are as follows:
(5.4.1) defining temporary variables i and j, polling a lock-free queue set vn _ dpdk _ rx _ q [ (32 i-31) -32 i ], obtaining a currently polled lock-free queue vn _ dpdk _ rx _ q [ j ], judging whether the vn _ dpdk _ rx _ q [ j ] is empty, if yes, executing (5.4.1), and if no, executing (5.4.2);
(5.4.2) defining the threshold value of the number of elements of a single queue of single reading vn _ dpdk _ rx _ q to be 4096, circularly obtaining the readable elements dpdk _ rx _ item of the vn _ dpdk _ rx _ q [ j ], judging whether the reading of the vn _ dpdk _ rx _ q [ j ] is finished or the number of the read elements reaches 4096, if so, stopping circularly executing (5.4.1), otherwise, executing (5.4.3);
(5.4.3) defining a temporary variable vn _ port, judging whether a rte _ mbuf memory message of the dpdk _ rx _ item contains a vlan field, if so, acquiring a virtual network port number from the vlan, assigning the virtual network port number to the vn _ port, deleting the vlan field from the message, otherwise, vn _ port = j, and executing (5.4.4);
(5.4.4) applying for an sk _ buff memory, copying a packet of rte _ mbuf memory to the sk _ buff memory, calling a netif _ rx _ ni function to send the sk _ buff memory to a virtual network port vn _ port, releasing rte _ mbuf memory, deleting dpdk _ rx _ item from vn _ dpdk _ rx _ q [ j ], and executing (5.4.2).
(5.5) the virtual network port module runs 4 functionally equivalent rx _ from _ dpdk _ kthread kernel threads simultaneously.
The network message sending process specifically comprises the following steps:
(6.1) defining a temporary variable i, sending a network message by a virtual network port i, and inserting the network message into a lock-free queue vn _ port _ tx _ q [ i ], as shown in fig. 6, specifically including the following steps:
(6.1.1) applying for a rte _ mbuf memory in a memory pool mbuf _ pool _ tx _ vn [ i ];
(6.1.2) judging whether a lock-free queue vn _ port _ tx _ q [ i ] corresponding to the virtual network port i is full, if so, discarding the network message, otherwise, executing (6.1.3);
(6.1.3) obtaining a free element vn _ tx _ item of a lock-free queue vn _ port _ tx _ q [ i ], copying a network message in the sk _ buff memory to rte _ mbuf memory, assigning a rte _ mbuf memory address to the vn _ tx _ item, inserting the vn _ tx _ item into the vn _ port _ tx _ q [ i ] queue, and releasing the sk _ buff memory.
(6.2) the virtual network port module supports 128 virtual network ports with equivalent functions to simultaneously send messages;
(6.3) in the virtual network port module, running a thread tx _ to _ DPDK _ balance _ kthread, and forwarding the virtual network port packet to the kernel of the DPDK-QDMA module, as shown in fig. 7, the specific steps are as follows:
(6.3.1) defining a temporary variable i, circularly polling a lock-free queue set vn _ port _ tx _ q [ 1-k ], obtaining a currently polled lock-free queue vn _ port _ tx _ q [ i ], judging whether the vn _ port _ tx _ q [ i ] is empty, if so, executing (6.3.1), otherwise, executing (6.3.2);
(6.3.2) setting a message lock-free queue sent to the DPDK-QDMA module: vn _ dpdk _ tx _ q _ cur = vn _ dpdk _ tx _ q [ i ];
(6.3.3) defining the threshold value of the number of elements of a single queue of single reading vn _ port _ tx _ q to be 4096, circularly acquiring the readable elements vn _ tx _ item of vn _ port _ tx _ q [ i ], judging whether the reading of vn _ port _ tx _ q [ i ] is finished or the number of the read elements reaches 4096, if so, stopping circularly executing (6.3.1), otherwise, executing (6.3.4);
(6.3.4) determining whether vn _ dpdk _ tx _ q _ cur is full, if yes, executing (6.3.5), otherwise executing (6.3.8);
(6.3.5) defining temporary variable arrays vn _ to _ dpdk _ q _ single _ pkgs [ 1-128 ], calculating the number of messages to be sent of each queue of vn _ dpdk _ tx _ q [ 1-k ], and respectively saving the number of the messages to be sent to the arrays vn _ to _ dpdk _ q _ single _ pkgs;
(6.3.6) defining a temporary variable array vn _ to _ dpdk _ q _ master _ pkgs [ 1-4 ], dividing vn _ dpdk _ tx _ q [ 1-k ] into 4 groups, wherein each group of queues is respectively vn _ dpdk _ tx _ q [ 1-32 ], vn _ dpdk _ tx _ q [ 33-64 ], vn _ dpdk _ tx _ q [ 65-96 ], vn _ dpdk _ tx _ q [ 97-128 ], calculating the number of messages to be sent of each group according to the array vn _ to _ dpdk _ q _ single _ pkgs, and respectively saving the number of the messages to be sent to the array vn _ to _ dpdk _ q _ master _ pkgs;
(6.3.7) defining temporary variables a and b, finding the minimum value at vn _ to _ dpdk _ q _ master _ pkgs [ 1-4 ], marking the index as a, finding the minimum value at vn _ dpdk _ tx _ q [ (32 a-31) -32 a ], marking the index as b, judging whether vn _ dpdk _ tx _ q [ b ] is full, if yes, discarding the message, executing (6.3.3), otherwise, vn _ dpdk _ tx _ q _ cur = vn _ dpdk _ tx _ q [ b ], and executing (6.3.8);
(6.3.8) obtaining vn _ dpdk _ tx _ q _ cur free element dpdk _ tx _ item, assigning rte _ mbuf memory address of vn _ tx _ item to dpdk _ tx _ item, inserting dpdk _ tx _ item into vn _ dpdk _ tx _ q _ cur, deleting vn _ port _ tx _ q [ i ] for vn _ 3.3.
(6.4) running a thread QDMA _ instances _ pthread on the DPDK-QDMA module, and forwarding the virtual network port module message to the FPGA-QDMA module, as shown in FIG. 8, the specific steps are as follows:
(6.4.1) defining temporary variables i and j, polling a lock-free queue set vn _ dpdk _ tx _ q [ (32 i-31) -32 i ], obtaining a currently polled lock-free queue vn _ dpdk _ tx _ q [ j ], judging whether the vn _ dpdk _ tx _ q [ j ] is empty, if yes, executing (6.4.1), and if not, executing (6.4.2);
(6.4.2) defining a temporary variable to store a linked list pkts _ burst _ tx _ l of 4096 rte _ mbuf memory addresses, defining the threshold value of the number of elements of a single read vn _ dpdk _ tx _ q queue to be 4096, circularly acquiring the readable elements dpdk _ tx _ item of vn _ dpdk _ tx _ q [ j ], judging whether the reading of vn _ dpdk _ tx _ q [ j is finished or the number of the read elements reaches 4096, if so, stopping the circular execution (6.4.1), otherwise, inserting rte _ mbuf memory addresses of dpdk _ tx _ item into pkts _ burst _ tx _ l, deleting the dpdk _ tx _ item from the vn _ dpdk _ tx _ q [ j ], and executing (6.4.3);
(6.4.3) calling rte _ eth _ tx _ burst function to send the message in the linked list pkts _ burst _ tx _ l to the PF _ queue [ j ] queue of PF [ i ] of the FPGA-QDMA module, and releasing rte _ mbuf memory in the linked list pkts _ burst _ tx _ l by rte _ eth _ tx _ burst function to execute (6.4.1).
The DPDK-QDMA module runs 4 functionally equivalent QDMA _ integers _ pthread threads simultaneously.
(6.5) the FPGA-QDMA module message sending function polls PF _ queue [ 1-128 ] queues of PF [ 1-4 ], and sends the obtained messages to the 100G network port after the messages are sequentially obtained.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the present invention in any way. Although the foregoing has described in detail the practice of the invention, it will be appreciated by those skilled in the art that variations may be applied to the embodiments described in the foregoing examples, or equivalents may be substituted for elements thereof. All changes, equivalents and modifications which come within the spirit and scope of the invention are desired to be protected.

Claims (6)

1. A method for expanding network ports and quickly equalizing messages is characterized by comprising the following steps:
firstly, a virtual network port is established in a virtual network port module of a server end, a physical function queue is established in an FPGA-QDMA module of the FPGA end, the virtual network port module and the FPGA-QDMA module are connected through a DPDK-QDMA module of the server end, one physical function queue is redistributed to be in one-to-one correspondence with the virtual network port, and the network port of the FPGA end is expanded;
step two, creating a lock-free queue, a memory pool and a thread when the DPDK-QDMA module is started, and guiding the virtual network port module and the FPGA-QDMA module to complete starting resource creation and allocation;
step three, when the server side and the FPGA side receive and send network messages, the DPDK-QDMA module transmits the network messages to the virtual network ports and the physical function queues corresponding to the virtual network ports and the physical function queues distributed by the virtual network ports;
in the second step, the creating of the lock-free queue, the memory pool and the thread when the DPDK-QDMA module is started specifically includes the following substeps:
(2.1) initializing an environment variable, acquiring the number n of physical functions PF supported by an FPGA-QDMA module, acquiring the number k of virtual network ports to be created according to a user configuration file, and calculating to obtain the number m = k/n of queues PF _ queue allocated to each physical function PF;
(2.2) creating a lock-free queue and a memory pool required by the virtual network port module, which specifically comprises the following steps:
(2.2.1) creating memory pools mbuf _ pool _ tx _ vn [ 1-k ] of k virtual network ports for storing and sending messages, wherein each memory pool comprises p rte _ mbuf memories;
(2.2.2) creating a lock-free queue vn _ port _ tx _ q [ 1-k ] of k virtual network ports for sending messages, wherein the depth of the queue is p;
(2.2.3) creating a lock-free queue vn _ DPDK _ tx _ q [ 1-k ] of k virtual network ports for sending messages to a DPDK-QDMA module, wherein the depth of the queue is p;
(2.2.4) establishing a lock-free queue vn _ DPDK _ rx _ q [ 1-k ] with k virtual network ports for receiving messages from the DPDK-QDMA module, wherein the queue depth is p;
(2.3) creating a memory pool and a thread required by the DPDK-QDMA module, which specifically comprises the following steps:
(2.3.1) creating memory pools mbuf _ pool _ rx _ pf [ 1-n ] of n DPDK-QDMA modules for storing received messages, wherein each memory pool comprises (m multiplied by p) rte _ mbuf memories;
(2.3.2) creating n threads QDMA _ ingress _ pthread for forwarding FPGA-QDMA module messages to the virtual network port module, and binding the threads QDMA _ ingress _ pthread to run on the CPU [ 1-n ];
(2.3.3) creating n threads QDMA _ offsets _ pthread for forwarding the virtual network port module message to the FPGA-QDMA module, and binding the threads QDMA _ offsets _ pthread to run on the CPU [ (n + 1) -2 n ];
(2.4) sending a command to the virtual network port module, acquiring information, and then creating a kernel thread for receiving and sending messages, specifically comprising:
(2.4.1) informing the virtual network port module to create k virtual network ports and obtaining the MAC addresses of the virtual network ports and the promiscuous mode;
(2.4.2) sending the physical addresses of the lock-free queues vn _ port _ tx _ q [ 1-k ], vn _ dpdk _ rx _ q [ 1-k ] and the memory pools mbuf _ pool _ tx _ vn [ 1-k ] for storing the sending messages to the virtual network port module;
(2.4.3) informing the virtual network port module to create a kernel thread for receiving messages from the DPDK-QDMA module and a kernel thread for sending messages to the DPDK-QDMA module;
(2.5) sending information to the FPGA-QDMA module, specifically comprising:
(2.5.1) sending the queue PF _ queue distributed by each physical function PF to the FPGA-QDMA module;
(2.5.2) sending the MAC addresses of the k virtual network ports and the promiscuous mode to the FPGA-QDMA module;
the step two of guiding the virtual network port module to complete the creation and allocation of the starting resource specifically comprises the following substeps:
(3.1) creating k virtual network ports, distributing MAC addresses for the ports, setting a promiscuous mode, and sending the MAC addresses and the promiscuous mode of all the ports to a DPDK-QDMA module;
(3.2) storing the physical addresses of lock-free queues vn _ port _ tx _ q [ 1-k ], vn _ dpdk _ rx _ q [ 1-k ] and memory pools mbuf _ pool _ tx _ vn [ 1-k ] for storing and sending messages;
(3.3) creating n kernel threads rx _ from _ DPDK _ kthread for receiving messages from the DPDK-QDMA module, and binding the n kernel threads rx _ from _ DPDK _ kthread to the CPU [ (2n + 1) -3 n ] for operation;
(3.4) creating a kernel thread tx _ to _ DPDK _ balance _ kthread for sending a message to the DPDK-QDMA module, and binding the kernel thread tx _ to _ dpdkk _ balance _ kthread to the CPU [3n +1] for operation;
and the FPGA-QDMA module in the second step is guided to complete the creation and allocation of the starting resources, and the method specifically comprises the following substeps:
(4.1) creating k queues PF _ queue [ 1-k ], each physical function PF being assigned m queues;
(4.2) creating two lists, namely vn _ promisc _ list and vn _ normal _ list, according to whether the virtual network port opens the promiscuous mode, respectively storing the information of the virtual network port with the promiscuous function opened and the information of the virtual network port without the promiscuous function opened, storing the corresponding relation between the MAC address and the virtual network port, and simultaneously storing the corresponding relation between the virtual network port and the physical function queue;
the third step is specifically as follows:
the method comprises the steps that an FPGA-QDMA module receives a network message of a 100G network port, a sending physical function queue corresponding to the network message is designated according to the message type, the promiscuous mode and a destination MAC address, a thread QDMA _ ingress _ pthread is operated on a DPDK-QDMA module, a thread rx _ from _ DPDK _ ktread is operated on a virtual network port, and the network message is sent to the virtual network port corresponding to the queue through the sending physical function queue;
the virtual network port receives the network message, runs a thread tx _ to _ DPDK _ balance _ kthread on the virtual network port module, runs a thread QDMA _ equations _ pthread on the DPDK-QDMA module, sends the network message to the FPGA-QDMA module through a physical function queue corresponding to the virtual network port, and finally sends the network message out through a 100G network port;
when the physical function queue corresponding to a certain virtual network port is in congestion, the network message is distributed to the idle physical function queue for transmission through the virtual network port module and the FPGA-QDMA module.
2. The method according to claim 1, wherein the FPGA-QDMA module receives a network packet of a 100G network port, and specifies a physical transmission function queue corresponding to the network packet according to a packet type, a hash pattern, and a destination MAC address, and specifically includes the following sub-steps:
(5.1.1) receiving an external network message by the FPGA terminal through a 100G network port;
(5.1.2) judging whether the network message is a broadcast packet, if so, executing (5.1.3), otherwise, executing (5.1.4);
(5.1.3) duplicating the network messages which are the broadcast packets into k network messages, and sequentially assigning a sending physical function queue pf _ queue _ send corresponding to the messages to the k network messages;
(5.1.4) calculating the number promisc _ nums of the list vn _ promisc _ list, copying promisc _ nums messages, and sequentially assigning a corresponding physical function sending queue pf _ queue _ send to the messages according to the virtual network port number of the list vn _ promisc _ list;
(5.1.5) polling the list vn _ normal _ list, finding out the virtual network port number with the mac address same as the message, and appointing a sending physical function queue pf _ queue _ send corresponding to the message;
(5.1.6) judging whether a physical sending function queue pf _ queue _ send corresponding to the network message is full, if so, executing (5.1.7), otherwise, executing (5.1.10);
(5.1.7) defining temporary variable arrays qdma _ to _ dpdk _ q _ pkgs [ 1-k ] and qdma _ to _ dpdk _ PF _ pkgs [ 1-n ], calculating the number of messages to be read of each queue of PF _ queue [ 1-k ], respectively saving the number of messages to be read of each queue to the arrays qdma _ to _ dpdk _ q _ pkgs, calculating the number of messages to be read of each physical function of PF [ 1-n ] according to the arrays qdma _ to _ dpdk _ q _ pkgs, and respectively saving the number of messages to be read of each physical function of PF [ 1-n ] to the arrays qdma _ to _ dpdk _ PF _ pkgs;
(5.1.8) defining temporary variables a and b, finding the minimum value at qdma _ to _ dpdk _ pf _ pkgs [ 1-n ], marking the index as a, finding the minimum value at qdma _ to _ dpdk _ q _ pkgs [ (32 a-31) -32 a ], marking the index as b, judging whether pf _ queue [ b ] is full, if so, discarding the message, otherwise, executing (5.1.9);
(5.1.9) modifying a network message sending physical function queue pf _ queue _ send = pf _ queue [ b ], adding a vlan field in the message, and filling a corresponding virtual network port number;
(5.1.10) sequentially sending the message to the designated corresponding sending physical function queue pf _ queue _ send.
3. The method as claimed in claim 2, wherein the step of running the thread QDMA _ ingress _ pthread in the DPDK-QDMA module specifically includes the following sub-steps:
(5.2.1) defining temporary variables i, j and c and a linked list pkts _ burst _ rx _ l capable of storing p rte _ mbuf memory addresses, polling a queue set PF _ queue [ ((i-1) m + 1) -im ] of PF [ i ], acquiring the currently polled queue PF _ queue [ j ], reading the message number c of PF _ queue [ j ], judging whether the read message number c is in the range of [ 1-p ], if so, executing (5.2.2), otherwise, executing (5.2.1);
(5.2.2) applying for c rte _ mbuf memories from an mbuf _ pool _ rx _ pn [ i ] memory pool, acquiring network messages of a queue pf _ queue [ j ], sequentially storing the messages to rte _ mbuf memories, inserting rte _ mbuf memory addresses into a linked list pkts _ burst _ rx _ l, judging whether the array pkts _ burst _ rx is empty, if so, executing (5.2.1), otherwise, executing (5.2.3);
(5.2.3) circularly acquiring the readable element rte _ mbuf memory of the linked list pkts _ burst _ rx _ l, judging whether reading is finished, if so, executing (5.2.1), and if not, executing (5.2.4);
(5.2.4) judging whether the lock-free queue vn _ dpdk _ rx _ q [ j ] is full, if yes, discarding the message in the rte _ mbuf memory, and executing (5.2.3), otherwise, executing (5.2.5);
(5.2.5) obtaining a free element vn _ from _ dpdk _ item of the lock-free queue vn _ dpdk _ rx _ q [ j ], assigning the address of rte _ mbuf memory to the vn _ from _ dpdk _ item, inserting the address into the lock-free queue vn _ dpdk _ rx _ q [ j ], and executing (5.2.3).
4. The method as claimed in claim 3, wherein the running of the thread rx _ from _ dpdk _ kthread on the virtual network port sends the network packet to the virtual network port corresponding to the queue by sending the physical function queue, and specifically includes the following sub-steps:
(5.4.1) defining temporary variables i and j, polling a lock-free queue set vn _ dpdk _ rx _ q [ ((i-1) m + 1) -im ], obtaining a currently polled lock-free queue vn _ dpdk _ rx _ q [ j ], judging whether vn _ dpdk _ rx _ q [ j ] is empty, if yes, executing (5.4.1), and if no, executing (5.4.2);
(5.4.2) defining a threshold value of the number of elements of a single queue of single reading vn _ dpdk _ rx _ q, circularly obtaining the readable elements dpdk _ rx _ item of the vn _ dpdk _ rx _ q [ j ], judging whether the reading of the vn _ dpdk _ rx _ q [ j is finished or the number of the read elements reaches the defined threshold value, if so, stopping circularly executing (5.4.1), otherwise, executing (5.4.3);
(5.4.3) defining a temporary variable vn _ port, judging whether a message of rte _ mbuf memory of dpdk _ rx _ item contains a vlan field, if so, acquiring a virtual network port number from the vlan, assigning the virtual network port number to the vn _ port, deleting the vlan field from the message, and if not, performing (5.4.4);
(5.4.4) applying for an sk _ buff memory, copying a packet of rte _ mbuf memory to the sk _ buff memory, calling a netif _ rx _ ni function to send the sk _ buff memory to a virtual network port vn _ port, releasing rte _ mbuf memory, deleting dpdk _ rx _ item from vn _ dpdk _ rx _ q [ j ], and executing (5.4.2).
5. The method according to claim 4, wherein the virtual network port receives the network packet and inserts the network packet into the lock-free queue, and the method specifically comprises the following sub-steps:
(6.1.1) defining a temporary variable i, and applying for a rte _ mbuf memory in a memory pool mbuf _ pool _ tx _ vn [ i ];
(6.1.2) judging whether a lock-free queue vn _ port _ tx _ q [ i ] corresponding to the virtual network port i is full, if so, discarding the network message, otherwise, executing (6.1.3);
(6.1.3) obtaining a free element vn _ tx _ item of a lock-free queue vn _ port _ tx _ q [ i ], copying a network message in the sk _ buff memory to rte _ mbuf memory, assigning a rte _ mbuf memory address to the vn _ tx _ item, inserting the vn _ tx _ item into the vn _ port _ tx _ q [ i ] queue, and releasing the sk _ buff memory.
6. The method as claimed in claim 5, wherein the running of the thread tx _ to _ DPDK _ balance _ kthread at the virtual network port module, the running of the thread QDMA _ equations _ pthread at the DPDK-QDMA module, the sending of the network packet to the FPGA-QDMA module through the physical function queue corresponding to the virtual network port, and finally the sending out through the 100G network port specifically includes the following sub-steps:
(6.3.1) defining a temporary variable i, circularly polling a lock-free queue set vn _ port _ tx _ q [ 1-k ], obtaining a currently polled lock-free queue vn _ port _ tx _ q [ i ], judging whether the vn _ port _ tx _ q [ i ] is empty, if so, executing (6.3.1), otherwise, executing (6.3.2);
(6.3.2) setting a message lock-free queue sent to the DPDK-QDMA module: vn _ dpdk _ tx _ q _ cur = vn _ dpdk _ tx _ q [ i ];
(6.3.3) defining a threshold value of the number of elements of a single queue of vn _ port _ tx _ q read once, circularly acquiring the readable elements vn _ tx _ item of vn _ port _ tx _ q [ i ], judging whether vn _ port _ tx _ q [ i ] is read completely or the number of read elements reaches a set threshold value, if so, stopping circularly executing (6.3.1), otherwise, executing (6.3.4);
(6.3.4) determining whether vn _ dpdk _ tx _ q _ cur is full, if yes, executing (6.3.5), otherwise executing (6.3.8);
(6.3.5) defining a temporary variable array vn _ to _ dpdk _ q _ single _ pkgs [ 1-k ], calculating the number of messages to be sent of each queue of vn _ dpdk _ tx _ q [ 1-k ], and respectively saving the number of the messages to be sent to the array vn _ to _ dpdk _ q _ single _ pkgs;
(6.3.6) defining a temporary variable array vn _ to _ dpdk _ q _ master _ pkgs [ 1-n ], dividing the vn _ dpdk _ tx _ q [ 1-k ] into 4 groups, wherein each group of queues is respectively vn _ dpdk _ tx _ q [ 1-m ], …, vn _ dpdk _ tx _ q [ ((n-1) m + 1) -nm ], calculating the number of messages to be sent in each group according to the array vn _ to _ dpdk _ q _ single _ pkgs, and storing the number of messages to be sent in the array vn _ to _ dpdk _ q _ master _ pkgs;
(6.3.7) defining temporary variables a and b, finding the minimum value at vn _ to _ dpdk _ q _ master _ pkgs [ 1-n ], marking the index as a, finding the minimum value at vn _ dpdk _ tx _ q [ ((a-1) m + 1) -am ], marking the index as b, judging whether vn _ dpdk _ tx _ q [ b ] is full, if yes, discarding the message, executing (6.3.3), otherwise, vn _ dpdk _ tx _ q _ cur = vn _ dpdk _ tx _ q [ b ], and executing (6.3.8);
(6.3.8) obtaining vn _ dpdk _ tx _ q _ cur free element dpdk _ tx _ item, assigning rte _ mbuf memory address of vn _ tx _ item to dpdk _ tx _ item, inserting dpdk _ tx _ item into vn _ dpdk _ tx _ q _ cur, deleting vn _ port _ tx _ q [ i ], and executing (6.3.3);
(6.4.1) redefining temporary variables i and j, polling a lock-free queue set vn _ dpdk _ tx _ q [ ((i-1) m + 1) -im ], obtaining a currently polled lock-free queue vn _ dpdk _ tx _ q [ j ], judging whether vn _ dpdk _ tx _ q [ j ] is empty, if yes, executing (6.4.1), and if no, executing (6.4.2);
(6.4.2) defining a temporary variable capable of storing a linked list pkts _ burst _ tx _ l of p rte _ mbuf memory addresses, defining an element quantity threshold value of a single queue for reading vn _ dpdk _ tx _ q once as p, circularly obtaining a readable element dpdk _ tx _ item of vn _ dpdk _ tx _ q [ j ], judging whether the vn _ dpdk _ tx _ q [ j ] is completely read or the read element quantity reaches p, if so, stopping circularly executing (6.4.1), otherwise, inserting a rte _ mbuf memory address of dpdk _ tx _ item into the pkts _ burst _ tx _ l, deleting the dpdk _ tx _ item from the vn _ dpdk _ tx _ q [ j ], and executing (6.4.3);
(6.4.3) calling rte _ eth _ tx _ burst function to send the message in the linked list pkts _ burst _ tx _ l to the PF _ queue [ j ] queue of PF [ i ] of the FPGA-QDMA module, and releasing rte _ mbuf memory in the linked list pkts _ burst _ tx _ l by rte _ eth _ tx _ burst function to execute (6.4.1);
and (6.5) polling PF _ queue [ 1-k ] queues of PF [ 1-n ] by the FPGA-QDMA module message sending function, sequentially acquiring messages and sending the messages to a 100G network port.
CN202211359114.6A 2022-11-02 2022-11-02 Network port expansion and message rapid equalization processing method Active CN115412502B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211359114.6A CN115412502B (en) 2022-11-02 2022-11-02 Network port expansion and message rapid equalization processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211359114.6A CN115412502B (en) 2022-11-02 2022-11-02 Network port expansion and message rapid equalization processing method

Publications (2)

Publication Number Publication Date
CN115412502A CN115412502A (en) 2022-11-29
CN115412502B true CN115412502B (en) 2023-03-24

Family

ID=84169137

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211359114.6A Active CN115412502B (en) 2022-11-02 2022-11-02 Network port expansion and message rapid equalization processing method

Country Status (1)

Country Link
CN (1) CN115412502B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117640546A (en) * 2023-11-28 2024-03-01 北京中科腾越科技发展有限公司 Method and device for expanding network port based on source MAC address and electronic equipment

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108270676A (en) * 2016-12-31 2018-07-10 普天信息技术有限公司 A kind of network data processing method and device based on IntelDPDK
CN108632166A (en) * 2018-04-25 2018-10-09 湖北锐世数字医学影像科技有限公司 A kind of packet receiving L2 cache method and system based on DPDK
CN109634720A (en) * 2018-12-13 2019-04-16 郑州云海信息技术有限公司 A kind of multi-dummy machine shares the method, system and device of FPGA board
CN110719234A (en) * 2019-10-17 2020-01-21 南京中孚信息技术有限公司 DPDK-based data packet processing method and device
CN111522653A (en) * 2020-02-07 2020-08-11 华中科技大学 Container-based network function virtualization platform
EP3796168A1 (en) * 2019-09-19 2021-03-24 Fujitsu Limited Information processing apparatus, information processing method, and virtual machine connection management program
CN114020618A (en) * 2021-10-30 2022-02-08 江苏信而泰智能装备有限公司 High-availability test method and system based on FPGA and DPDK

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10387358B2 (en) * 2017-02-13 2019-08-20 Mellanox Technologies, Ltd. Multi-PCIe socket NIC OS interface
CN112787937A (en) * 2021-01-21 2021-05-11 深圳市中网信安技术有限公司 Message forwarding method, terminal equipment and computer storage medium
CN113051057A (en) * 2021-03-30 2021-06-29 联想(北京)有限公司 Multithreading data lock-free processing method and device and electronic equipment
CN113419780B (en) * 2021-05-08 2023-05-12 中国科学院声学研究所 DPDK driving system based on FPGA acceleration card
CN115277407B (en) * 2022-07-25 2024-01-23 北京天融信网络安全技术有限公司 Internet access configuration processing method and device, electronic equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108270676A (en) * 2016-12-31 2018-07-10 普天信息技术有限公司 A kind of network data processing method and device based on IntelDPDK
CN108632166A (en) * 2018-04-25 2018-10-09 湖北锐世数字医学影像科技有限公司 A kind of packet receiving L2 cache method and system based on DPDK
CN109634720A (en) * 2018-12-13 2019-04-16 郑州云海信息技术有限公司 A kind of multi-dummy machine shares the method, system and device of FPGA board
EP3796168A1 (en) * 2019-09-19 2021-03-24 Fujitsu Limited Information processing apparatus, information processing method, and virtual machine connection management program
CN110719234A (en) * 2019-10-17 2020-01-21 南京中孚信息技术有限公司 DPDK-based data packet processing method and device
CN111522653A (en) * 2020-02-07 2020-08-11 华中科技大学 Container-based network function virtualization platform
CN114020618A (en) * 2021-10-30 2022-02-08 江苏信而泰智能装备有限公司 High-availability test method and system based on FPGA and DPDK

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于FPGA的VGA显示接口的研究与设计;陈姚节等;《交通与计算机》;20050430(第02期);全文 *

Also Published As

Publication number Publication date
CN115412502A (en) 2022-11-29

Similar Documents

Publication Publication Date Title
WO2020052605A1 (en) Network slice selection method and device
WO2020236269A1 (en) System and method for facilitating efficient utilization of an output buffer in a network interface controller (nic)
WO2021254330A1 (en) Memory management method and system, client, server and storage medium
CN107015942B (en) Method and device for multi-core CPU (Central processing Unit) packet sending
US11212590B2 (en) Multiple core software forwarding
US20200167186A1 (en) Container isolation method and apparatus for netlink resource
CN115412502B (en) Network port expansion and message rapid equalization processing method
CN113891396B (en) Data packet processing method and device, computer equipment and storage medium
CN111459690A (en) Data transmitting and receiving control method and device, mobile terminal and storage medium
CN104158764A (en) Message processing method and device
CN111290979B (en) Data transmission method, device and system
US10348651B2 (en) Apparatus and method for virtual switching
CN113553137B (en) DPDK-based access capability network element high-speed data processing method under NFV architecture
US11283723B2 (en) Technologies for managing single-producer and single consumer rings
EP3461085A1 (en) Method and device for queue management
CN112583655B (en) Data transmission method and device, electronic equipment and readable storage medium
CN110737530B (en) Method for improving packet receiving capacity of HANDLE identification analysis system
WO2018057165A1 (en) Technologies for dynamically transitioning network traffic host buffer queues
CN111262771B (en) Virtual private cloud communication system, system configuration method and controller
CN114780228B (en) Hybrid cloud resource creation method and system
CN110868364A (en) Bandwidth isolation device and method
WO2017016300A1 (en) Method and apparatus for processing token application, computer storage medium
CN109257227B (en) Coupling management method, device and system in data transmission
CN112684988A (en) QoS method and system based on distributed storage
JP2022545453A (en) Message processing method, apparatus and computer storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant