Data forwarding method and device and storage medium

By setting up two processing units and a ring buffer queue in VPP, data transmission in zero-copy mode is achieved, which solves the problem of long data forwarding paths and improves data forwarding efficiency and accuracy.

CN119071257APending Publication Date: 2024-12-03LENOVO (BEIJING) LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411046228.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-31
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

When using vpp for data forwarding, the data forwarding path is long, resulting in multiple copies of data, which is inefficient.

Method used

By setting two processing units in the first container, receiving data from one data port and performing zero-copy mode data transmission through the shared memory area, the data forwarding path is shortened, and the data forwarding accuracy is ensured through the ring buffer queue and flag bits. Sex and efficiency.

Benefits of technology

It improves data forwarding efficiency, shortens data forwarding path, reduces data copying times, and improves the accuracy and efficiency of data forwarding.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119071257A_ABST
    Figure CN119071257A_ABST
Patent Text Reader

Abstract

The invention discloses a data forwarding method which comprises the steps that a first container comprises a first processing unit and a second processing unit, and the first processing unit and the second processing unit receive data through a corresponding first data port and a corresponding second data port respectively and store the data into corresponding shared memory areas respectively; the second container accesses the shared memory area of the first container, processes the data in the shared memory area, and stores the processed data in the shared memory area; wherein the first data port and the second data port correspond to a first network and a second network respectively, the processed data obtained by accessing the shared memory area by the first processing unit is forwarded through the second data port, and the processed data obtained by accessing the shared memory area by the second processing unit is forwarded through the first data port.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a data forwarding method, device and storage medium. Background Art

[0002] vpp (Vector Packet Processing) is a fast and scalable 2-4 layer multi-platform network protocol stack. memif is a common and efficient communication method between multiple instances of vpp. The master and slave of memif pass control messages through sockets. The master and slave have a one-to-one correspondence and both have the same id.

[0003] At present, when using vpp for data forwarding, such as Figure 2 As shown, vpp2 first receives data packets from the network port eth0 through DPDK (Data Plane Development Kit), and forwards them to vpp1 through a group of memif shared memory region interfaces. After receiving the memif data packet on the vpp1 side, the data packet header is modified according to the rules configured by NAT (Network Address Translation), and forwarded to vpp2 through another group of memif shared memory regions. vpp2 then sends the data packet received from the memif shared memory region through another network port eth1. It can be seen that the data forwarding path of this solution is long, and the data is copied multiple times, resulting in low data forwarding efficiency. Summary of the invention

[0004] An embodiment of the present application provides a data forwarding method, including: a first container includes a first processing unit and a second processing unit, the first processing unit and the second processing unit respectively receive data through corresponding first data ports and second data ports and store the data in corresponding shared memory areas respectively; the second container accesses the shared memory area of ​​the first container, processes the data in the shared memory area, and stores the processed data in the shared memory area; wherein the first data port and the second data port correspond to a first network and a second network respectively, the processed data obtained by the first processing unit after accessing the shared memory area is forwarded through the second data port, and the processed data obtained by the second processing unit after accessing the shared memory area is forwarded through the first data port.

[0005] In some embodiments, the shared memory areas corresponding to the first processing unit and the second processing unit are respectively provided with circular buffer queues, and a first flag is set in the circular buffer queues, and the first flag is used to record the first associated information of the data packet after the latest data processing in the circular buffer queue; the first processing unit forwards the data packet corresponding to the first associated information through the second data port based on the first flag, and the second processing unit forwards the data packet corresponding to the first associated information through the first data port based on the first flag.

[0006] In some embodiments, the ring buffer queue further includes a second flag bit, the second flag bit is used to record second associated information of the data packet most recently received in the first container, the second container accesses the shared memory area of ​​the first container, and processing the data in the shared memory area specifically includes: the first processing unit and the second processing unit respectively send the second associated information to the second container; the second container accesses the shared memory area, and processes the data packet corresponding to the second associated information.

[0007] In some embodiments, the second container includes a third processing unit corresponding to the first processing unit and the second processing unit respectively, and processing the data packet corresponding to the second association information includes: the third processing unit processes the data packet corresponding to the second association information according to an address conversion rule to obtain a processed first data packet.

[0008] In some embodiments, the ring buffer queue also includes a third flag bit, which is used to record third association information of the latest forwarded data packet in the first container. After forwarding the data packet, the first processing unit and the second processing unit respectively update the third flag bit of the corresponding ring buffer queue.

[0009] In some embodiments, the data forwarding method further includes: after processing the data packet, the third processing unit updates the first flag bit of the corresponding ring buffer queue.

[0010] In some embodiments, the first association information represents address information of the processed data packet stored in the shared memory area.

[0011] An embodiment of the present application also proposes a data forwarding device, which includes a first container and a second container, the first container includes a first processing unit and a second processing unit, the first processing unit and the second processing unit respectively receive data through the corresponding first data port and the second data port and store them in the corresponding shared memory area respectively; the second container accesses the shared memory area of ​​the first container, processes the data in the shared memory area, and stores the processed data in the shared memory area; wherein the first data port and the second data port correspond to the first network and the second network respectively, the processed data obtained by the first processing unit after accessing the shared memory area is forwarded through the second data port, and the processed data obtained by the second processing unit after accessing the shared memory area is forwarded through the first data port.

[0012] In some embodiments, the shared memory areas corresponding to the first processing unit and the second processing unit are respectively provided with circular buffer queues, and a first flag is set in the circular buffer queues, and the first flag is used to record the first associated information of the data packet after the latest data processing in the circular buffer queue; the first processing unit forwards the data packet corresponding to the first associated information through the second data port based on the first flag, and the second processing unit forwards the data packet corresponding to the first associated information through the first data port based on the first flag.

[0013] An embodiment of the present application further proposes a computer-readable storage medium having instructions stored thereon. When executed by a processor, the instructions execute the steps of the data forwarding method as described above. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0015] Figure 1 This is a flow chart of a data forwarding method according to an embodiment of the present application;

[0016] Figure 2 It is a schematic diagram of the current vpp data forwarding process;

[0017] Figure 3 The process of processing the data in the shared memory area in the embodiment of the present application is as follows Figure 1 ;

[0018] Figure 4 The process of processing the data in the shared memory area in the embodiment of the present application is as follows Figure 2 ;

[0019] Figure 5 A schematic diagram of the principle of the data forwarding method according to an embodiment of the present application;

[0020] Figure 6 A schematic diagram of three flag bits in a ring buffer queue in an embodiment of the present application;

[0021] Figure 7 This is a structural block diagram of a data forwarding device according to an embodiment of the present application. DETAILED DESCRIPTION

[0022] Various aspects and features of the present application are described herein with reference to the accompanying drawings.

[0023] It should be understood that various modifications may be made to the embodiments of the present application. Therefore, the above description should not be considered as limiting, but only as an example of an embodiment. Other modifications within the scope and spirit of the present application will occur to those skilled in the art.

[0024] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the present application and, together with the general description of the present application given above and the detailed description of the embodiments given below, serve to explain the principles of the present application.

[0025] These and other characteristics of the present application will become apparent from the following description of a preferred form of embodiment given as a non-limiting example with reference to the accompanying drawings.

[0026] It should also be understood that although the present application has been described with reference to some specific examples, those skilled in the art will be able to readily implement many other equivalent forms of the present application.

[0027] The above and other aspects, features and advantages of the present application will become more apparent in view of the following detailed description when taken in conjunction with the accompanying drawings.

[0028] Specific embodiments of the present application are described hereinafter with reference to the accompanying drawings; however, it should be understood that the embodiments applied for are merely examples of the present application, which may be implemented in a variety of ways. Well-known and / or repeated functions and structures are not described in detail to avoid unnecessary or redundant details that obscure the present application. Therefore, the specific structural and functional details applied for herein are not intended to be limiting, but merely serve as a basis and representative basis for the claims to teach those skilled in the art to use the present application in a variety of ways with substantially any suitable detailed structure.

[0029] This specification may use the phrases "in one embodiment," "in another embodiment," "in yet another embodiment," or "in other embodiments," all of which may refer to one or more of the same or different embodiments according to the present application.

[0030] A data forwarding method in an embodiment of the present application arranges two processing units in a first container, and enables each processing unit to receive data from one data port, and after being processed by a second container, forwards the processed data through another data port, thereby shortening the data forwarding path and improving data forwarding efficiency.

[0031] like Figure 1 As shown, the following steps are included:

[0032] Step S101: The first container includes a first processing unit and a second processing unit. The first processing unit and the second processing unit receive data through corresponding first data ports and second data ports respectively and store the data in corresponding shared memory areas respectively.

[0033] A container is a standardized unit used to encapsulate an application and all its dependencies. In this embodiment, data forwarding is achieved through a first container and a second container. The first container and the second container can communicate through a memif interface, and the first container includes a first processing unit and a second processing unit. There is a shared memory area in the first processing unit and the second processing unit, respectively. Through the shared memory area, data is transmitted between the first container and the second container in a zero-copy mode. The first processing unit receives data from a first data port corresponding to the first network and stores it in a corresponding shared memory area. The second processing unit receives data from a second data port corresponding to the second network and stores it in a corresponding shared memory area. For example, one of the first network and the second network may be a wide area network (WAN), and the other may be a local area network (LAN).

[0034] In some embodiments of the present application, the first container may be used as a virtual switch (vswitch), and the second container may be used as a virtual client (vcpe).

[0035] Step S102: the second container accesses the shared memory area of ​​the first container, processes the data in the shared memory area, and stores the processed data in the shared memory area.

[0036] The second container accesses the shared memory area corresponding to the first processing unit, processes the data in the shared memory area corresponding to the first processing unit, and stores the processed data in the shared memory area corresponding to the first processing unit. Then, the first processing unit accesses the corresponding shared memory area and forwards the processed data through the second data port. The second container accesses the shared memory area corresponding to the second processing unit, processes the data in the shared memory area corresponding to the second processing unit, and stores the processed data in the shared memory area corresponding to the second processing unit. Then, the second processing unit accesses the corresponding shared memory area and forwards the processed data through the first data port.

[0037] In some embodiments of the present application, the first processing unit receives data from the first data port via DPDK, and sends the processed data to the second data port for forwarding via DPDK; the second processing unit receives data from the second data port via DPDK, and sends the processed data to the first data port for forwarding via DPDK.

[0038] In the data forwarding method of the embodiment of the present application, the first processing unit of the first container receives data through the first data port corresponding to the first network, and after writing the data into the shared memory area, the data is processed by the second container, and the processed data is forwarded through the second data port corresponding to the second network; the second processing unit of the first container receives data through the second data port, and after writing the data into the shared memory area, the data is processed by the second container, and the processed data is forwarded through the first data port. By setting two processing units in the first container, and making each processing unit receive data from one data port, and after being processed by the second container, the processed data is forwarded by another data port, the data forwarding path is shortened and the data forwarding efficiency is improved.

[0039] In some embodiments of the present application, the first processing unit and the second processing unit respectively access the shared memory area through the corresponding proxy modules to obtain processed data and forward them, and the shared memory area corresponding to the first processing unit, the proxy module corresponding to the first processing unit, the shared memory area corresponding to the second processing unit, and the proxy module corresponding to the second processing unit are respectively bound to different processing cores.

[0040] In this embodiment, the first processing unit accesses the shared memory area through the corresponding proxy module to obtain processed data, and forwards it through the second data port. The second processing unit accesses the shared memory area through the corresponding proxy module to obtain processed data, and forwards it through the first data port.

[0041] The processing core is a basic processing unit in the processor that can independently execute computing tasks. Different parts of the first processing unit and the second processing unit are respectively bound to different processing cores. For example, the shared memory area corresponding to the first processing unit is bound to the first processing core, the proxy module corresponding to the first processing unit is bound to the second processing core, the shared memory area corresponding to the second processing unit is bound to the third processing core, and the proxy module corresponding to the second processing unit is bound to the fourth processing core. This allows data forwarding to be performed concurrently through different processing cores, further improving data forwarding efficiency.

[0042] In some embodiments of the present application, the shared memory areas corresponding to the first processing unit and the second processing unit are respectively provided with circular buffer queues, and a first flag is set in the circular buffer queues, and the first flag is used to record the first associated information of the data packet after the latest data processing in the circular buffer queue; the first processing unit forwards the data packet corresponding to the first associated information through the second data port based on the first flag, and the second processing unit forwards the data packet corresponding to the first associated information through the first data port based on the first flag.

[0043] In this embodiment, the shared memory area corresponding to the first processing unit and the second processing unit is provided with a circular buffer queue, and a first flag is set in the circular buffer queue. When the first processing unit accesses the corresponding shared memory area, the first associated information of the data packet after the latest data processing in the circular buffer queue is determined by the first flag, and the data packet corresponding to the first associated information is obtained from the corresponding shared memory area, and the obtained data packet is forwarded through the second data port. Correspondingly, when the second processing unit accesses the corresponding shared memory area, the first associated information of the data packet after the latest data processing in the circular buffer queue is determined by the first flag, and the data packet corresponding to the first associated information is obtained from the shared memory area, and the obtained data packet is forwarded through the first data port.

[0044] By setting the first flag bit in the ring buffer queue of the shared memory area, the first processing unit and the second processing unit can accurately determine the data processed by the second container from the corresponding ring buffer queue, thereby improving the accuracy of data forwarding.

[0045] In some embodiments of the present application, the ring buffer queue further includes a second flag bit, which is used to record second associated information of the latest received data packet in the first container, and the second container accesses the shared memory area of ​​the first container to process the data in the shared memory area, such as Figure 3 As shown, the specific steps include:

[0046] Step S1021: The first processing unit and the second processing unit respectively send second association information to the second container.

[0047] In this embodiment, the ring buffer queue also includes a second flag bit. The first processing unit and the second processing unit access the corresponding shared memory area and determine the second associated information of the latest received data packet in the first container according to the second flag bit, and send the second associated information to the second container.

[0048] Step S1022: the second container accesses the shared memory area to process the data packet corresponding to the second association information.

[0049] The second container obtains the second association information by accessing the shared memory area, and processes the data packet corresponding to the second association information.

[0050] The second associated information can be determined by the second flag of the ring buffer queue, so that the second container can accurately determine the latest received data packet in the first container according to the second associated information and process it, thereby ensuring the accuracy of data forwarding.

[0051] In some embodiments of the present application, the second container includes a third processing unit corresponding to the first processing unit and the second processing unit, respectively, to process the data packet corresponding to the second association information, such as Figure 4 As shown, the following steps are included:

[0052] Step S10221: the third processing unit processes the data packet corresponding to the second association information according to the address conversion rule to obtain a processed first data packet.

[0053] In this embodiment, the third processing unit performs network address translation on the header of the data packet corresponding to the second association information according to the address translation rule, so that the first processing unit can reliably forward the processed data through the second data port, and the second processing unit can reliably forward the processed data through the first data port.

[0054] In some embodiments of the present application, the ring buffer queue also includes a third flag bit, which is used to record third association information of the latest forwarded data packet in the first container. After forwarding the data packet, the first processing unit and the second processing unit respectively update the third flag bit of the corresponding ring buffer queue.

[0055] In this embodiment, the circular buffer queue also includes a third flag bit. The first processing unit and the second processing unit determine the third association information of the latest forwarded data packet in the first container according to the third flag bit by accessing the corresponding shared memory area. After the first processing unit forwards the data packet through the second data port, the third flag bit of the corresponding circular buffer queue is updated. After the second processing unit forwards the data packet through the first data port, the third flag bit of the corresponding circular buffer queue is updated.

[0056] After forwarding a data packet, the third flag of the corresponding ring buffer queue is updated so that the updated third flag accurately records the latest forwarded data packet in the subsequent first container, thereby ensuring the accuracy of data forwarding.

[0057] In some embodiments of the present application, the data forwarding method further includes: after processing the data packet, the third processing unit updates the first flag bit of the corresponding ring buffer queue.

[0058] In this embodiment, by updating the first flag bit after processing the data packet, the first flag bit can accurately record the first associated information of the latest data packet processed in the subsequent ring buffer queue, thereby ensuring the accuracy of data forwarding.

[0059] In some embodiments of the present application, the first association information represents address information of the processed data packet stored in the shared memory.

[0060] In this embodiment, the address information of the processed data packet stored in the shared memory area is the position of the processed data packet in the ring buffer queue. The first processing unit and the second processing unit can determine the address information of the processed data packet based on the first association information, and based on the address information, the processed data packet can be accurately obtained from the corresponding ring buffer queue and forwarded.

[0061] In some embodiments of the present application, the second association information represents the position information of the latest received data packet in the first container in the ring buffer queue, and the third association information is the same as the first association information.

[0062] In some embodiments of the present application, the second flag is the head of the circular buffer queue, the third flag is the tail of the circular buffer queue, the first association information is determined by the tail and the first flag, and the second association information is determined by the head and the first flag.

[0063] In order to further explain the technical idea of ​​the present application, the technical solution of the present application is now described in combination with specific application scenarios.

[0064] The present application embodiment provides a data forwarding method, such as Figure 5 As shown, the following process is included:

[0065] Step S1, obtaining a first container and a second container, wherein the first container runs a virtual switch (vpp2), and the second container runs a virtual client (vpp1), wherein the virtual switch is vswitch, and the virtual client is vcpe.

[0066] The first container includes a first processing unit and a second processing unit, wherein the first processing unit includes a shared memory region (region memseg) corresponding to the first processing core (core 1) and a proxy module (proxy) corresponding to the second processing core (core 2); the second processing unit includes a shared memory region (region memseg) corresponding to the fourth processing core (core4) and a proxy module (proxy) corresponding to the third processing core (core 3). Among them, memseg is an underlying data structure in DPDK, which represents a continuous physical memory composed of large pages, and these continuous large pages of physical memory are managed by a memseg structure.

[0067] The first processing unit receives data (queue 1) from the first data port (eth0) via DPDK, and sends the processed data to the second data port (eth1) for forwarding via DPDK; the second processing unit receives data (queue 2) from the second data port (eth1) via DPDK, and sends the processed data to the first data port (eth0) for forwarding via DPDK. The first data port corresponds to the wide area network (wan), and the second data port corresponds to the local area network (lan). RX pooling in DPDK means receiving pool, which is used to receive data from the data port, and TX means data sending.

[0068] The second container includes a third processing unit (APP), and the third processing unit is used to modify the header of the data packet and set a flag bit according to the address conversion rule.

[0069] Step S2, modifying the VPP code, adding a fixed mark field (ie, the first flag bit) in the memif_ring_t data structure, for recording the first associated information of the latest processed data packet in the ring buffer queue (ring buffer).

[0070] The ring buffer data structure is as follows:

[0071]

[0072]

[0073] There is a MEMIF_DESC_FLAG_NEXT flag in the descriptor. If this flag is set, it means that the current message length is greater than the buffer length. The message will be divided into multiple buffers for storage, and the buffers may not be continuous.

[0074] like Figure 6The diagram shows three flags in the ring buffer queue of the embodiment of the present application, where the flags are head (i.e., the second flag), fixed (i.e., the first flag), and tail (i.e., the third flag). The data between head and fixed is the latest received data message, and the data between tail and fixed is the latest processed data message.

[0075] Step S3, through the APP in the second container, create a task and bind a CPU core, poll the data received by the ring buffer of the vpp memif shared memory area, that is, the data between the head and the fixed, configure the corresponding header of the data packet according to the NAT rule, replace the corresponding field of the header with the target content, and update the fixed position at the same time.

[0076] Step S4, create a task through the proxy module in the first container, bind it to a CPU core, poll and check the data between the tail and fixed of the ring buffer of the vpp memif shared memory area, send the data packets between the tail and fixed through the corresponding data port, and update the tail position of the ring buffer of the shared memory at the same time.

[0077] The following Figure 5 The data forwarding process is described by taking queue 1 and queue 2 in FIG.

[0078] For queue 1, the first processing unit in vswitch receives queue 1 from eth0 through DPDK and stores it in the ring buffer in regionmemseg. vcpe accesses the ring buffer in the first processing unit through the memif interface, modifies the header of the data between the head and fixed of the ringbuffer according to the NAT rule, and updates the position of fixed in the ring buffer. Then vcpe stores the processed queue 1 in the ring buffer in the first processing unit through the memif interface. The proxy in the first processing unit accesses the ring buffer in the first processing unit, and forwards the data from the tail to fixed of the ring buffer from eth1 through DPDK, and updates the position of the tail in the ring buffer. At this point, the forwarding of queue 1 is completed.

[0079] For queue 2, the second processing unit in the vswitch receives queue 2 from eth1 through DPDK and stores it in the ring buffer in regionmemseg. vcpe accesses the ring buffer in the second processing unit through the memif interface, modifies the header of the data between the head and fixed of the ringbuffer according to NAT rules, and updates the position of fixed in the ring buffer. Then vcpe stores the processed queue 2 in the ring buffer in the second processing unit through the memif interface. The proxy in the second processing unit accesses the ring buffer in the second processing unit, and forwards the data from the tail to fixed of the ring buffer from eth0 through DPDK, and updates the position of the tail in the ring buffer. At this point, the forwarding of queue 2 is completed.

[0080] The present application also proposes a data forwarding device, such as Figure 7 As shown, the data forwarding device includes a first container and a second container, the first container includes a first processing unit and a second processing unit, the first processing unit and the second processing unit respectively receive data through the corresponding first data port and the second data port and store them in the corresponding shared memory area respectively; the second container accesses the shared memory area of ​​the first container, processes the data in the shared memory area, and stores the processed data in the shared memory area; wherein the first data port and the second data port correspond to the first network and the second network respectively, the processed data obtained by the first processing unit after accessing the shared memory area is forwarded through the second data port, and the processed data obtained by the second processing unit after accessing the shared memory area is forwarded through the first data port.

[0081] In the data forwarding device of the embodiment of the present application, the first processing unit of the first container receives data through the first data port corresponding to the first network, and after writing the data into the shared memory area, the data is processed by the second container, and the processed data is forwarded through the second data port corresponding to the second network; the second processing unit of the first container receives data through the second data port, and after writing the data into the shared memory area, the data is processed by the second container, and the processed data is forwarded through the first data port. By setting two processing units in the first container, and making each processing unit receive data from one data port, and after being processed by the second container, the processed data is forwarded by another data port, the data forwarding path is shortened and the data forwarding efficiency is improved.

[0082] In a specific application scenario, the shared memory areas corresponding to the first processing unit and the second processing unit are respectively provided with circular buffer queues, and a first flag is set in the circular buffer queue, and the first flag is used to record the first associated information of the data packet after the latest data processing in the circular buffer queue; the first processing unit forwards the data packet corresponding to the first associated information through the second data port based on the first flag, and the second processing unit forwards the data packet corresponding to the first associated information through the first data port based on the first flag.

[0083] In a specific application scenario, the ring buffer queue further includes a second flag bit, and the second flag bit is used to record second associated information of a data packet most recently received in the first container. The second container accesses the shared memory area of ​​the first container, and processing the data in the shared memory area specifically includes: the first processing unit and the second processing unit respectively send the second associated information to the second container; and the second container accesses the shared memory area to process the data packet corresponding to the second associated information.

[0084] In a specific application scenario, the second container includes a third processing unit corresponding to the first processing unit and the second processing unit respectively, and processing the data packet corresponding to the second association information includes: the third processing unit processes the data packet corresponding to the second association information according to an address conversion rule to obtain a processed first data packet.

[0085] In a specific application scenario, the ring buffer queue also includes a third flag bit, which is used to record the third association information of the latest forwarded data packet in the first container. After forwarding the data packet, the first processing unit and the second processing unit respectively update the third flag bit of the corresponding ring buffer queue.

[0086] In a specific application scenario, the data forwarding method further includes: after processing the data packet, the third processing unit updates the first flag bit of the corresponding ring buffer queue.

[0087] In a specific application scenario, the first association information represents address information of the processed data packet stored in the shared memory area.

[0088] The embodiments of the present application also provide a computer-readable storage medium on which instructions are stored. When executed by a processor, the instructions execute the data forwarding method of each embodiment of the present application.

[0089] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integration. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk), etc.

[0090] The above embodiments are only exemplary embodiments of the present application and are not intended to limit the present application. The protection scope of the present application is defined by the claims. Those skilled in the art may make various modifications or equivalent substitutions to the present application within the essence and protection scope of the present application, and such modifications or equivalent substitutions shall also be deemed to fall within the protection scope of the present application.

Claims

1. A data forwarding method, comprising: The first container includes a first processing unit and a second processing unit, wherein the first processing unit and the second processing unit receive data through corresponding first data ports and second data ports respectively and store the data in corresponding shared memory areas respectively; The second container accesses the shared memory area of ​​the first container, processes the data in the shared memory area, and stores the processed data in the shared memory area; Among them, the first data port and the second data port correspond to the first network and the second network respectively, the processed data obtained by the first processing unit accessing the shared memory area is forwarded through the second data port, and the processed data obtained by the second processing unit accessing the shared memory area is forwarded through the first data port.

2. The data forwarding method according to claim 1, characterized in that: The shared memory areas corresponding to the first processing unit and the second processing unit are respectively provided with circular buffer queues, and a first flag is set in the circular buffer queue, and the first flag is used to record the first associated information of the data packet after the latest data processing in the circular buffer queue; the first processing unit forwards the data packet corresponding to the first associated information through the second data port based on the first flag, and the second processing unit forwards the data packet corresponding to the first associated information through the first data port based on the first flag.

3. The data forwarding method according to claim 2, characterized in that: The ring buffer queue further includes a second flag, which is used to record second associated information of the data packet most recently received in the first container. The second container accesses the shared memory area of ​​the first container, and the processing of the data in the shared memory area specifically includes: The first processing unit and the second processing unit respectively send the second association information to the second container; The second container accesses the shared memory area to process the data packet corresponding to the second association information.

4. The data forwarding method according to claim 3, characterized in that: The second container includes a third processing unit corresponding to the first processing unit and the second processing unit respectively, and processing the data packet corresponding to the second association information includes: The third processing unit processes the data packet corresponding to the second association information according to the address conversion rule to obtain a processed first data packet.

5. The data forwarding method according to claim 2, characterized in that: The ring buffer queue also includes a third flag bit, which is used to record third association information of the latest forwarded data packet in the first container. After forwarding the data packet, the first processing unit and the second processing unit respectively update the third flag bit of the corresponding ring buffer queue.

6. The data forwarding method according to claim 2, characterized in that: The data forwarding method further includes: after processing the data packet, the third processing unit updates the first flag bit of the corresponding ring buffer queue.

7. The data forwarding method according to claim 2, characterized in that: The first association information represents address information of the processed data packet stored in the shared memory area.

8. A data forwarding device, characterized in that: The data forwarding device comprises a first container and a second container, the first container comprises a first processing unit and a second processing unit, the first processing unit and the second processing unit respectively receive data through corresponding first data ports and second data ports and respectively store the data in corresponding shared memory areas; The second container accesses the shared memory area of ​​the first container, processes the data in the shared memory area, and stores the processed data in the shared memory area; Among them, the first data port and the second data port correspond to the first network and the second network respectively, the processed data obtained by the first processing unit accessing the shared memory area is forwarded through the second data port, and the processed data obtained by the second processing unit accessing the shared memory area is forwarded through the first data port.

9. The data forwarding device according to claim 8, characterized in that: The shared memory areas corresponding to the first processing unit and the second processing unit are respectively provided with circular buffer queues, and a first flag is set in the circular buffer queue, and the first flag is used to record the first associated information of the data packet after the latest data processing in the circular buffer queue; the first processing unit forwards the data packet corresponding to the first associated information through the second data port based on the first flag, and the second processing unit forwards the data packet corresponding to the first associated information through the first data port based on the first flag.

10. A computer-readable storage medium having instructions stored thereon, and when executed by a processor, the instructions execute the steps of the data forwarding method according to any one of claims 1 to 7.