Method, apparatus, electronic device and storage medium for transmitting packet

By separating the epoll node into worker threads in VPP and using the epoll-worker node to handle data packet reception and transmission, the problem of the main thread being busy affecting the transmission rate is solved, and efficient packet transmission between the forwarding plane and the control plane is achieved.

CN118827652BActive Publication Date: 2025-11-04CHINA MOBILEHANGZHOUINFORMATION TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311665705.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-06
Publication Date
2025-11-04
Estimated Expiration
2043-12-06

AI Technical Summary

Technical Problem

In computing networks, when the main thread of the VPP processes data packets and control message events simultaneously, it becomes busy, affecting the data packet transmission rate and the packet transmission rate between the forwarding plane and the control plane channel.

Method used

The epoll node is separated from the main thread and moved to the worker thread by adding a new epoll-worker node and registering the tap-inject-rx node to it. The worker thread is used to schedule the reception and transmission of data packets, separating the packet forwarding business of the main thread and allowing it to focus on control plane related business.

Benefits of technology

This improved the message transmission rate between the forwarding plane and the control plane channels, alleviated congestion on the main thread, and ensured the efficiency and stability of data packet transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118827652B_ABST
    Figure CN118827652B_ABST
Patent Text Reader

Abstract

The application discloses a message transmission method and device, electronic equipment and storage medium. The method comprises the following steps: when a data message is received by a VPP, the data message is sent to a system kernel by a first working thread, so that the system kernel processes the data message, and / or the data message is forwarded to a control plane device to process the data message, and a target data message is obtained; in the case that the listening mode is determined to be a first listening mode, a second working thread is used to call a first event trigger node to monitor the system kernel; in the case that the first event trigger node monitors the target data message, a message receiving node registered in the first event trigger node is called to extract the target data message from the system kernel; and a data forwarding node is called by the second working thread, and the target data message is forwarded to a device corresponding to a target network port by the data forwarding node. The scheme provided by the application can improve the message transmission rate between the forwarding plane and the control plane channel.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the field of message processing, and particularly relates to a message transmission method and device, electronic equipment and storage medium. BACKGROUND

[0002] Under the background of the new concept of the current computing power network, the computing power is the center, the network is the foundation, and the computing network base is crucial. The computing network base not only needs to have forwarding capability, but also needs to have high-performance routing interaction capability. In the computing network, VPP (Vector Packet Processing) can be used as the forwarding face of the LINUX kernel to realize the forwarding of messages. The VPP only has the function of the forwarding face and does not have the control face function such as the routing protocol, and the control face routing protocol is determined by the open source routing protocol stack FRR (Fast Reroute). The VPPSB (VPP SandBox) component is usually used to realize the docking between the VPP and the FRR, so as to realize the receiving and processing of the data messages of the forwarding face and the control face channel.

[0003] In the message forwarding process, the main thread of the VPP schedules the command line processing process and the process of scheduling the control messages such as the routing distribution at the same time, and the multiple working threads of the VPP are used to process the receiving and sending packet process of the network interface. However, the main thread is only one, which needs to process not only the forwarding of the data messages, but also the events of various control messages. Therefore, when the main thread simultaneously processes a large number of events of the control messages, the main thread is busy or even congested, which will inevitably affect the data message receiving and sending rate of the main thread and reduce the message transmission rate between the forwarding face and the control face channel. SUMMARY

[0004] The embodiments of the present application provide a message transmission method and device, electronic equipment and storage medium, which can improve the message transmission rate between the forwarding face and the control face channel.

[0005] In a first aspect, an embodiment of the present application provides a method for transmitting a packet, applied to a vector packet processing engine (VPP), the method comprising: when a data packet is received by the VPP, sending the data packet to a system kernel through a first worker thread, so that the system kernel processes the data packet, and / or forwards the data packet to a control plane device, so that the control plane device processes the data packet to obtain a target data packet; in a case where it is determined that a listening manner for listening to the target data packet is a first listening manner, invoking a first event trigger node through a second worker thread, so that the first event trigger node monitors the system kernel; in a case where the first event trigger node monitors the target data packet in the system kernel, invoking a packet receiving node registered in the first event trigger node, so that the packet receiving node extracts the target data packet from the system kernel; invoking at least one data forwarding node through the second worker thread, and forwarding the target data packet to a device corresponding to a target network interface through the at least one data forwarding node, wherein the target network interface is determined by a routing rule issued by a routing issuing node invoked by a main thread, the routing issuing node is a node registered in a second event trigger node corresponding to the main thread, and the second event trigger node is used for listening to a routing issuing request.

[0006] In a second aspect, an embodiment of the present application provides a device for transmitting a packet, applied to a vector packet processing engine (VPP), the device comprising: a first packet processing module, configured to, when a data packet is received by the VPP, send the data packet to a system kernel through a first worker thread, so that the system kernel processes the data packet, and / or forwards the data packet to a control plane device, so that the control plane device processes the data packet to obtain a target data packet; a first node invoking module, configured to, in a case where it is determined that a listening manner for listening to the target data packet is a first listening manner, invoke a first event trigger node through a second worker thread, so that the first event trigger node monitors the system kernel; a second node invoking module, configured to, in a case where the first event trigger node monitors the target data packet in the system kernel, invoke a packet receiving node registered in the first event trigger node, so that the packet receiving node extracts the target data packet from the system kernel; and a packet forwarding module, configured to invoke at least one data forwarding node through the second worker thread, and forward the target data packet to a device corresponding to a target network interface through the at least one data forwarding node, wherein the target network interface is determined by a routing rule issued by a routing issuing node invoked by a main thread, the routing issuing node is a node registered in a second event trigger node corresponding to the main thread, and the second event trigger node is used for listening to a routing issuing request.

[0007] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory storing computer program instructions, and the processor implements the method for transmitting a packet as described in the first aspect when executing the computer program instructions.

[0008] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, and the computer readable storage medium stores computer program instructions. The computer program instructions are executed by a processor to implement the method for transmitting a packet according to the first aspect.

[0009] In a fifth aspect, an embodiment of the present application provides a computer program product. Instructions in the computer program product are executed by a processor of an electronic device to cause the electronic device to perform the method for transmitting a packet according to the first aspect.

[0010] From the above, the present application separates the packet forwarding related service from the service of the main thread, and the packet forwarding related service is completed by the worker thread. Therefore, the main thread can only process the service related to the control plane, for example, the service of issuing a routing rule. Therefore, even if the main thread is busy, the packet transmission of the worker thread is not affected, and the packet transmission rate is improved. In addition, since the packet forwarding service of the main thread is completed by the worker thread, the main thread can focus on processing the service related to the control plane, and the congestion of the main thread can be relieved. BRIEF DESCRIPTION OF DRAWINGS

[0011] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the embodiments of the present application will be briefly introduced. For those skilled in the art, other drawings can also be obtained without creative labor on the basis of these drawings.

[0012] Figure 1 is a data packet forwarding flowchart in the related art;

[0013] Figure 2 is an architecture schematic diagram of the method for transmitting a packet provided by an embodiment of the present application;

[0014] Figure 3 is a flowchart of the method for transmitting a packet provided by an embodiment of the present application;

[0015] Figure 4 is a packet processing flowchart between the forwarding plane and the control plane provided by an embodiment of the present application;

[0016] Figure 5 is a flowchart of the worker thread calling a node in the VPP provided by an embodiment of the present application;

[0017] Figure 6 is a structure schematic diagram of the device for transmitting a packet provided by another embodiment of the present application;

[0018] Figure 7 is a structure schematic diagram of the electronic device provided by still another embodiment of the present application. DETAILED DESCRIPTION

[0019] The features and exemplary embodiments of the various aspects of the present application will be described in detail below with reference to the drawings. The following detailed description is merely intended to explain the present application, and is not intended to limit the present application. The present application can be implemented without some of the specific details, which are described below. The following description of the embodiments is merely provided to give a better understanding of the present application by showing examples of the present application.

[0020] It should be noted that the terms such as first and second, etc., are merely intended to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between such entities or operations. Also, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that processes, methods, articles or devices including a series of elements not only include those elements, but also include other elements not explicitly listed or inherent to such processes, methods, articles or devices. Without more limitations, the elements defined by the statement "include" do not exclude the presence of other identical elements in the processes, methods, articles or devices including the elements.

[0021] For the sake of understanding, before the scheme provided by the present application is explained, the professional terms that can be used in the embodiments of the present application are first explained.

[0022] (1) VPP (Vector Packet Processing) is an extensible framework that can provide out-of-the-box production quality switch / router functionality.

[0023] (2) FRR (Fast Reroute) is a routing suite that implements all standard routing protocols, such as BGP (Border Gateway Protocol), RIP (Routing Information Protocol), OSPF (Open Shortest Path First), IS-IS (Intermediate System to Intermediate System) and their extensions.

[0024] (3) tap-inject, tap is a tap port in the Linux kernel, inject is injection, the message and route interaction between the forwarding plane and the control plane in the VPP open source framework is implemented in the user mode by injecting the traffic into the tap port to realize the interaction between the user mode and the kernel mode, and in the VPP framework, the functional nodes on each pipeline are implemented in the form of nodes, and the traffic injection into the tap port is completed by the node related to tap-inject.

[0025] (4) IPv4 (Internet Protocol version 4), also known as Internet Communication Protocol version 4, is the fourth revised version in the development process of the Internet Protocol.

[0026] (5) Linux kernel, Linux is an open source computer operating system kernel, which is written in C language and conforms to the POSIX (Portable Operating System Interface) standard Unix-like operating system.

[0027] The scheme concept of the scheme provided in the application is explained as follows.

[0028] In the related art, when the transmission of data messages is implemented by using the existing node scheduling framework of VPP, the main thread is used to simultaneously schedule the command line processing process and the process of control messages such as route issuing, and multiple worker threads are used to process the receiving and sending packet process of the interface or network port. In the node scheduling framework of VPP, there is only one main thread, which is used to implement the control plane process, that is, to process the command line, route and the like; and there are multiple worker threads, which are used to process the data plane process, for example, the message processing process (such as the forwarding of data messages). The main thread and the worker thread work respectively and do not affect each other.

[0029] In the node scheduling framework of VPP, the forwarding of data messages is implemented by scheduling nodes, that is, the message forwarding pipeline can be decomposed into a process of pipeline operation by multiple nodes, for example, the data message enters the dpdk-input node from the network card first, then enters the ethernet-input node for link layer message processing, then enters the IP layer processing through the ip-input type node, and finally enters the xxx-output and xxx-tx nodes and is sent out from the network port.

[0030] Furthermore, as described above, VPP is a scheduling framework where a main thread and multiple worker threads operate in parallel. The main thread handles control message processing and node scheduling, while the worker threads handle data plane pipeline packet sending and receiving and node scheduling. It's important to note that there are four main types of nodes in VPP: internal, input, pre-input, and process. Internal nodes process data packets; input nodes (e.g., the dpdk-input node) receive data packets; and pre-input nodes monitor trigger events. For example, the epoll node is invoked by the main thread. Various nodes (e.g., nodes that receive data packets) register in the epoll node. When VPP receives messages from the command line or other control messages, epoll is awakened, and each node registered in epoll can execute its corresponding event, such as reading data packets from the system kernel.

[0031] Building a complete system with router functionality requires control plane software that can implement routing protocols (e.g., FRR software). VPPSB can act as a bridge between the two, enabling VPP and the Linux kernel to interface. At the same time, FRR also directly operates on the kernel. Therefore, routing protocol packets can be sent to the Linux kernel protocol stack through FRR, and the Linux kernel protocol stack can be sent to VPP through VPPSB.

[0032] Therefore, it can be seen that the tap-inject-rx node used in VPPSB to facilitate the exchange of packets between the forwarding plane and the control plane is an input type node, similar in nature to the dpdk-input node. While the dpdk-input node receives data packets from the network interface, the tap-inject-rx node receives data packets from the system kernel. The tap-inject-rx node is registered on the epoll node, which is scheduled by the main thread. Therefore, the process of the tap-inject-rx node receiving data packets is also scheduled by the main thread. In the VPP forwarding pipeline, packet processing is performed in worker threads, while the tap-inject-rx node receives data packets from the system kernel or control plane through the scheduling of the main thread.

[0033] Specifically, such as Figure 1 The data packet forwarding process shown in the related technologies is as follows: Figure 1In the middle, after the data packet comes in from the network port, the processing flow of the data packet in the VPP is as follows: first, the working thread 1 calls the dpdk-input node to process the data packet, after a series of processing, if the internal logic judges that the data packet needs to be sent to the control plane or the Linux kernel, the ip4-local node is entered, and then the tap-inject-tx node is entered, the tap-inject-tx node sends the data packet in the VPP pipeline to the Linux kernel, and then the data packet is processed by the Linux kernel, sent to the control plane, and processed by the control plane. After the data packet is processed in the control plane, the system kernel sends the data packet to the VPP through the tap port, the main thread receives the data packet from the Linux kernel by calling the tap-inject-rx node, and then the data packet enters the VPP pipeline, passes through the xxx-output node and the xxx-tx node, and finally is sent out from a network port.

[0034] It is easy to note that, by Figure 1 It can be known that the tap-inject-rx node and a series of subsequent nodes in the VPP pipeline are scheduled by the main thread, wherein the tap-inject-rx node is registered in the epoll node, and the epoll node is only scheduled by the main thread, and the working thread (such as the working thread 1 in the VPP) only transmits and receives data packets, and is not responsible for the processing work of the control layer. Moreover, the epoll node not only responds to the trigger event corresponding to the tap-inject-rx node, but also needs to respond to the processing time of various control command lines registered in the epoll node, and also needs to process the route distribution task, so when the epoll node in the main thread continuously responds to the events related to the control message, the main thread will be busy, thereby affecting the performance of the tap-inject-rx node in processing the data packet. Figure 1

[0035] To solve the above problems and improve the processing performance of the data packet, an embodiment of the present application provides a scheme for separating the epoll node from the main thread to the working thread, which adds an epoll node, calls the added epoll node through the working thread, and registers the tap-inject-rx node in the added epoll node, so that the work of the tap-inject-rx node in receiving the data packet can be separated to a clean working thread, the main thread only responds to the control message event, the division of labor between the main thread and the working thread is clear, and the high availability of the VPP overall architecture is improved.

[0036] Figure 2 An architecture diagram corresponding to the method for transmitting a packet provided by the embodiment of the present application is shown, which is Figure 2 It can be known that in the embodiment of the present application, a working thread (such as​Figure 2 the work thread 2) in the main thread, a new epoll-worker node (as shown in Figure 2 the epoll-worker node in the main thread) is started on the work thread 2), and the tap-inject-rx node is registered on the epoll-worker, so that the epoll-worker node can be scheduled by the work thread 1 during the transmission of the data packet, and each time there is a data packet from the control plane, the epoll-worker node is triggered, and the packet receiving callback function corresponding to the tap-inject-rx node registered on the epoll-worker node is triggered, so that the tap-inject-rx node can extract the data packet from the system kernel and then perform subsequent processing.

[0037] As shown in Figure 2 , after the epoll-worker node is separated from the main thread, the epoll-worker node, the tap-inject-rx node, and the subsequent xxx-output, xxx-tx, etc. nodes are all scheduled and processed by the work thread 2, and are completely separated from the main thread, so that even if the main thread is busy, it will not affect the work thread 2, and thus the interaction performance of the channel flow between the forwarding plane and the control plane will not be affected.

[0038] Figure 3 A flowchart of a method for transmitting a packet provided by an embodiment of the application is shown. The method can be applied in a vector packet processing engine (VPP). As shown in Figure 3 , the method includes the following steps:

[0039] Step S301: When the VPP receives a data packet, the data packet is sent to the system kernel by a first work thread, so that the system kernel processes the data packet, and / or the data packet is forwarded to a control plane device, and the control plane device processes the data packet to obtain a target data packet.

[0040] As an example, in Figure 2 , when the data packet enters the VPP from the network port, the work thread 1 forwards the data packet to the Linux kernel by calling the dpdk-input node, the ip-local node, the tap-inject-tx node, etc., so that the Linux kernel can process the data packet, for example, to parse the data packet. In addition, the Linux kernel can also forward the data packet to the corresponding device (i.e., the control plane device) of the control plane, and the control plane device processes the data packet accordingly.

[0041] Step S302, in a case where it is determined that the listening manner of the listening target data packet is the first listening manner, a first event triggering node is invoked by a second working thread, so that the first event triggering node monitors the system kernel.

[0042] In step S302, the second working thread is different from the first working thread, and in the embodiment of the present application, the second working thread is used to extract the data packet from the system kernel and forward the data packet to the target network interface, that is, the second working thread is used to process the packet transmission work originally completed by the main thread, that is, in the embodiment of the present application, the main thread does not need to process the work related to the packet transmission, but only needs to process the work related to the control information.

[0043] In addition, in step S302, the first listening manner is a manner of processing the packet transmission work by the second working thread, and in the first listening manner, the second working thread can monitor the system kernel by invoking the first event triggering node, and when the target data packet is generated or forwarded by the system kernel, the first event triggering node can wake up other nodes related to the packet transmission, and the packet transmission is completed by the other nodes.

[0044] As an example, when the VPP is initially started, the VPP can read its corresponding configuration file, and determine the specific listening manner by detecting whether the target field exists in the configuration file. In a case where it is determined that the listening manner is the first listening manner, as shown in Figure 2 , the working thread invoking the first event triggering node can be determined by the configuration file, and the working thread (i.e., the second working thread) is started, as shown in Figure 2 , the working thread 2, and then the working thread 2 invokes the first event triggering node (epoll-worker node) to monitor the system kernel.

[0045] Step S303, in a case where the target data packet in the system kernel is monitored by the first event triggering node, a packet receiving node registered in the first event triggering node is invoked, so that the packet receiving node extracts the target data packet from the system kernel.

[0046] In step S303, after the packet receiving node is registered in the first event triggering node, that is, the file descriptor of the packet receiving event corresponding to the packet receiving node is added to the first event triggering node, the first event triggering node will monitor the packet receiving event, so that after the first event triggering node monitors that the target data packet is generated by the system kernel, the first event triggering node will wake up the packet receiving node, and then the packet receiving node will obtain the target data packet from the system kernel. For example, in Figure 2In the process, when the epoll-worker node detects that the system kernel has generated a target data packet, the epoll-worker node wakes up the packet receiving node, namely the tap-inject-rx node, so that the tap-inject-rx node can receive the target data packet in the system kernel.

[0047] As an example, Figure 4 The flowchart illustrating the message processing between the forwarding plane and the control plane is shown, such as... Figure 4 As shown, in VPPSB, the tap-inject node is used to generate data related to data packets, and the rtnl node is used to generate data related to routing packets. VPPSB generates socket messages, i.e., packets, based on these two types of data. The packet reception event `split fd` is triggered based on the socket message. In VPP, when VPP starts, the main thread `vlib-main` starts, and simultaneously controls the dispatch node `dispatch_node` to start, scheduling the `splited_epoll_unix_input` node (i.e., the first event triggering node) to monitor the packet reception event `split fd`. When the `splited_epoll_unix_input` node detects the packet reception event `split fd`, it can schedule the packet reception node `tap-inject-rx` through the dispatch node `dispatch_node`, so that the `tap-inject-rx` node can receive the socket message.

[0048] In the above process, the tap-inject-rx node registers its corresponding message reception event split fd to the splitted_epoll_unix_input node, and then schedules the tap-inject-rx node through the core scheduling process corresponding to dispatch_node to receive data packet messages (i.e., the socket messages mentioned above) from the system kernel.

[0049] As an example, the structure of the above event split file descriptor can be extern clib_file_main_tsplit_file_main;

[0050] The following code can be used to register a split file descriptor:

[0051] clib_file_del(&split_file_main, split_file_main.file_pool + clib_file_index); / / Disable registration

[0052] clib_file_add(&split_file_main, &template); / / register

[0053] The split_file_main is a split fd registered by tap-inject-rx.

[0054] In step S304, the target data packet is forwarded to the device corresponding to the target network port through at least one data forwarding node called by the second worker thread.

[0055] In step S304, the target network port is determined by the routing rule issued by the routing issuing node called by the main thread. The routing issuing node is a node registered in the second event triggering node corresponding to the main thread, and the second event triggering node is used to listen to the routing issuing request. As an example, the second event triggering node can be Figure 2 The epoll node in the main thread, that is, in the embodiment, the task of triggering the message event originally processed by the epoll node in the main thread is implemented by the newly added epoll-worker node scheduled by the worker thread, and the epoll node in the main thread is only used to implement the control-related task (for example, the routing issuing task), that is, the work of the control plane is separated from the message transmission work, which is processed by different epoll nodes, so that when the epoll node in the main thread is busy, the transmission rate of the data packet will not be affected.

[0056] In addition, in step S304, the at least one data forwarding node called by the second worker thread is a node registered in the first event triggering node, for example, in Figure 2 In the embodiment, the at least one data forwarding node can include xxx-output node and xxx-tx node, which are all registered in the epoll-worker node, so that the epoll-worker node monitors the events corresponding to the xxx-output node and the xxx-tx node. When the event corresponding to the xxx-output node and the xxx-tx node is detected, the epoll-worker node can wake up the xxx-output node and the xxx-tx node, so that the xxx-output node and the xxx-tx node complete the corresponding task.

[0057] Based on the scheme defined in the steps S301 to S304, it can be known that the application separates the message forwarding related service from the service of the main thread, and the service is completed by the worker thread, so that the main thread can only process the service related to the control plane, for example, the issuing of routing rules, and thus even if the main thread is busy, the message transmission of the worker thread will not be affected, thereby improving the message transmission rate. In addition, since the message forwarding service of the main thread is completed by the worker thread, the main thread can focus on processing the service related to the control plane, thereby alleviating the congestion of the main thread.

[0058] It should be noted that based on the scheme defined in the steps S301 to S304, it can be known that when the monitoring manner of the target data message is the first monitoring manner, the transmission of the data message is implemented by calling the first event trigger node by the second worker thread; when the monitoring manner of the target data message is the first monitoring manner, the transmission of the data message can be implemented by calling the second event trigger node by the main thread.

[0059] Specifically, the main thread calls the second event trigger node to enable the event trigger node to monitor the system kernel; and when the second event trigger node monitors the target data message in the system kernel, the target message receiving node registered in the second event trigger node is called to extract the target data message from the system kernel; and then at least one target data forwarding node registered in the second event trigger node is called by the main thread to forward the target data message to the device corresponding to the target network port through the at least one target data forwarding node.

[0060] From the above, after the monitoring manner of the target data message is determined, the corresponding monitoring manner can be used to monitor the target data message. In actual application, the user can select a specific monitoring manner according to the busy degree of the forwarding-control channel between the forwarding plane and the control plane, for example, when the forwarding-control channel between the forwarding plane and the control plane is busy, the first monitoring manner can be used to monitor the target data message in the system kernel; and when the forwarding-control channel is idle, the second monitoring manner can be used to monitor the target data message in the system kernel.

[0061] As an example, the busy degree of the forwarding-control channel can be determined according to the ratio of the number of routing messages and control plane messages in the forwarding-control channel to the total number of messages in the forwarding-control channel, for example, when the ratio of the number of routing messages and control plane messages to the total number of messages in the forwarding-control channel is greater than a preset ratio, it is determined that the forwarding-control channel is in a busy state, otherwise, it is determined that the forwarding-control channel is in an idle state.

[0062] Further, in actual application, the VPP can determine the monitoring manner of the target data packet by detecting whether the target field exists in the configuration file. Specifically, when the target field exists in the configuration file, it is determined that the monitoring manner is the first monitoring manner; and when the target field does not exist in the configuration file, it is determined that the monitoring manner is the second monitoring manner. The first monitoring manner is a manner of monitoring the system kernel through the first event trigger node, and the second monitoring manner is a manner of monitoring the system kernel through the second event trigger node.

[0063] It should be noted that, in order to increase flexibility, the required monitoring manner is selected from the above two monitoring manners, and the embodiment of the present application adds an epoll-worker field (i.e., a target field) in the unix field of the configuration file (startup.conf). The configuration file can be as follows:

[0064]

[0065]

[0066] It should be noted that the epoll-worker field in the configuration file is used to indicate the specific manner of socket communication between the tap-inject node and the VPP, i.e., whether the manner of transmitting a packet by the main thread or the manner of transmitting a packet by the worker thread. A global variable int tap_inject_epoll_worker can be added in the program script corresponding to the VPP. When the VPP detects the epoll-worker field from the configuration file, the global variable tap_inject_epoll_worker is set to 1, and at the same time, the tap-inject node (for example, the tap-inject-rx node) is registered in the epoll-worker node in the socket interaction of the tap-inject and the rtnl node. In this way, it can be determined by the configuration file whether to use the scheme of separating the monitoring task of the packet trigger event corresponding to the epoll node to the worker thread, and the packet transmission is completed by the worker thread. This manner does not affect the original process.

[0067] In another example, the configuration file further includes an association relationship between a plurality of thread indexes corresponding to the worker threads and a plurality of event trigger nodes. Different worker threads process different packet events, and the packet events can include a routing packet event and a control plane packet event. The routing packet event is the event corresponding to the transmission packet, and the control plane packet event is a related event of processing the control plane packet.

[0068] Specifically, in the process of configuring the configuration file corresponding to the VPP, first, the association relationship between the thread indexes corresponding to the plurality of worker threads and the plurality of event trigger nodes is constructed, a target field is added in the configuration file, and the configuration file is configured based on the association relationship between the thread indexes corresponding to the plurality of worker threads and the plurality of event trigger nodes.

[0069] It should be noted that in the configuration file, only the association relationship between one thread index and one event trigger node can be configured, for example, in the configuration file, the thread index corresponding to the routing message event is configured as 0, when the VPP reads the configuration file, and the target field epoll-worker is detected in the configuration file, the epoll-worker node is automatically called by the worker thread; or since there is only one message event, the node corresponding to the message event is scheduled by the corresponding worker thread by default, therefore, in this scenario, the event trigger node and the worker thread can also be not associated.

[0070] In addition, by Figure 2 It can be known that in the worker thread 2, the tap-inject-rx node is used to process the routing message, and subsequently, there will be other control plane messages, for example, L2TP (Layer 2 Tunneling Protocol), IPSEC (Internet Protocol Security) control plane messages, each control plane message corresponds to a control plane message event, and each control plane message event can be connected by an epoll-worker, that is, in the embodiment of the present application, the work related to the control plane message completed by the epoll node scheduled by the main thread can be separated from the epoll node, and the new epoll-worker is used to complete, wherein different worker threads can process different control plane message events by scheduling different epoll-worker nodes. When the number of worker threads (determined by the number of CPU cores) is sufficient, an epoll-worker node can be added for each worker thread to facilitate subsequent expansion, thereby the workload of the epoll node in the main thread can be greatly reduced.

[0071] As an example, for each worker thread, when naming the event triggering node corresponding to the worker thread, the name can be corresponded to the thread_index (core num), for example, epoll_worker_0, epoll_worker_1, so that the worker can determine which worker thread schedules the event triggering node through the name of the event triggering node, for example, epoll_worker_0 indicates that the worker thread 0 schedules. The correspondence between each event triggering node and the worker thread is as follows:

[0072]

[0073]

[0074] However, the definition of the node is a static process, and the definition of the node cannot be determined by dynamically reading the configuration file. In the embodiment of the present application, the number of epoll-worker nodes is determined during the VPP initialization process, for example, in the above configuration file, there are four event corresponding epoll-worker nodes, such as router, L2TP, IPSEC, and XXX; then N (for example, 4) nodes are statically defined, and the information obtained from the configuration file is used to determine how many nodes to register during node registration. Since the reading of the configuration file is earlier than the processing of node registration, the above method can make the registration of each control plane business node corresponding to the epoll-worker more simple and efficient.

[0075] In actual application, after the VPP is started, the configuration file is read to determine the number of event triggering nodes to be configured, and then the event triggering nodes need to be created and the packet events are registered in the created event triggering nodes to realize the registration of the nodes related to the packet events in the event triggering nodes.

[0076] Specifically, first, the association relationship between the thread index corresponding to the plurality of worker threads and the plurality of event triggering nodes is read from the configuration file, then based on the association relationship between the thread index corresponding to the plurality of worker threads and the plurality of event triggering nodes, the plurality of event triggering nodes are created, and the packet events corresponding to each event triggering node are registered in each event triggering node, so that the event triggering node can monitor the corresponding packet events.

[0077] It should be noted that each worker thread described above is used to call and execute the node corresponding to the packet event, and the packet events corresponding to the plurality of worker threads at least include the routing packet event and the control plane packet event.

[0078] Specifically, in the process of registering the packet event in the corresponding event trigger node, the target memory is allocated for the packet event node corresponding to the target packet event in the target event trigger node through the node initialization function; then, the target packet event is created for the packet event node in the target memory, and the file descriptor corresponding to the target packet event is obtained; finally, the file descriptor corresponding to the target packet event is added to the listening list corresponding to the target event trigger node, so that the target event trigger node can listen to the events in the listening list after the VPP is started, and the packet event node processing the event is woken up when the event in the listening list is listened to.

[0079] It should be noted that the target event trigger node is any one of the plurality of event trigger nodes, and the packet event node is a node for executing the target packet event through the worker thread.

[0080] As an example, the memory allocation and the callback of the event listening function split_linux_epoll_file_update can be implemented through the node initialization function split_linux_epoll_input_init. After the memory is allocated for the target packet event through the node initialization function, the split_linux_epoll_file_update function is called to create the target packet event epoll_fd through the epoll_create function, and the file descriptor file_descriptor corresponding to the target packet event is added to the listening list corresponding to the target event trigger node epoll-worker through the epoll_ctl function, so that the packet receiving event tap-inject-rx (i.e., the target packet event) calls the clib_file_add function, and then triggers the callback function of split_linux_epoll_file_update to add the file_descriptor to the listening list. The split_linux_epoll_file_update function can be implemented through the following code:

[0081]

[0082]

[0083] The epoll-worker node can be implemented through the following code:

[0084] The clib_file_add function can be implemented through the following code:

[0085] After calling the clib_file_add function, the registration of tap-inject can be implemented by the following code:

[0086] template.file_descriptor = tap_fd;

[0087] u32 clib_file_index = clib_file_add(&split_file_main, &template);

[0088] tap_inject_insert_tap(sw->sw_if_index, tap_fd, ifr.ifr_ifindex, trubotap_fd, sock_fd, clib_file_index);

[0089] return 0;

[0090] After the registration of the target packet event in the target event trigger node is completed, for example, after the registration of the routing packet event in the first event trigger node is completed, the registration of the packet receiving event in the first event trigger node can be implemented. After that, the target event trigger node can listen to the target event by calling the event listening function split_linux_epoll_input_inline.

[0091] As an example, the event listening function split_linux_epoll_input_inline takes out the registration information of the target event trigger node from the split_linux_epoll_mains global variable in the split_linux_epoll_file_update function, and then listens to whether the event is received, and then calls the previously registered read or write function to call back the listened event.

[0092] After the packet receiving node is registered in the first event trigger node, during the data packet transmission process, VPP can listen to the target data packet in the system kernel by calling the first event trigger node. Specifically, VPP obtains the thread index corresponding to the second worker thread, determines the event trigger node corresponding to the thread index from the configuration file according to the thread index, obtains the first event trigger node, and then calls the first event trigger node.

[0093] It should be noted that, as described in the foregoing, in the related art, the epoll node is scheduled in the main thread, and all socket events are registered in the epoll node, which needs to listen to all socket events, including command line events, etc. Once there are a large number of epoll event interactions, for example, a large number of command lines are issued, or a large number of static routes and ARP (Address Resolution Protocol) are issued, the main thread is busy, and the tap-inject-rx node transmits and receives packets is greatly affected.

[0094] To avoid the influence of the tap-inject-rx node transmitting and receiving packets by other events, the embodiment of the present application adds an epoll node and calls it in the specified worker thread. The flowchart of the worker thread calling node in VPP is shown in Figure 5 As shown in Figure 5 When VPP starts, the main thread vlib_main starts, and the main thread vlib_main enters the main thread loop vlib_main_loop. In the process of running the main thread vlib_main loop, the worker thread vlib_main_worker needs to be called, and at the same time, the worker thread vlib_main_worker also enters the worker thread loop vlib_main_worker_loop. In the execution of each worker thread vlib_main_worker_loop, various nodes need to be scheduled, that is, the corresponding node is called according to the task of each worker thread through dispatch_node.

[0095] As Figure 5 can be seen, each worker thread will call the node it needs to use, and in the embodiment of the present application, the added epoll node can be specified to be scheduled in the specified worker thread, which can be implemented through the following code:

[0096]

[0097] In actual application, the thread index corresponding to the worker thread can be checked, for example, whether the thread index corresponding to a certain worker thread matches the epoll-worker node it calls, to ensure that the epoll-worker node is only scheduled in the specified worker thread. If the scheduled worker thread is worker[worker_index], the epoll-worker node is scheduled; if other worker threads schedule the epoll-worker node, the function returns, and the epoll-worker node is released before it is called again.

[0098] From the above, the embodiment of the application provides a method for improving the traffic interaction performance of a control forwarding channel on a VPP, which sets a switch in a configuration file to determine whether to use a work thread to call an epoll node, and registers other nodes related to a message transmission event required by the work thread in the epoll node required by the work thread to be called, so that the epoll node called by the work thread listens to the message transmission event. The scheme provided by the embodiment of the application has the following advantages:

[0099] (1) In the related art, the main thread processes the sending and receiving messages of the control forwarding channel, and the main thread also processes other control messages. When a large number of control messages are issued, the main thread is busy, which affects the sending and receiving messages, and the performance of the control forwarding channel is greatly lost. In the application, the message processing work of the control forwarding channel is separated from the main thread, and is completed by the idle work thread, so that the message forwarding work is no longer affected by the control message of the main thread, and the performance of the message transmission of the control forwarding channel can be greatly improved.

[0100] (2) In the embodiment of the application, the target field in the configuration file is used to realize the start or stop of the separation of the main thread and the epoll node, and the work thread calling the epoll-worker can be specified by the configuration file, which can be flexibly allocated and is convenient for future expansion.

[0101] (3) The scheme provided by the application not only realizes the routing message interaction between the VPPSB and the VPP, but also can be infinitely extended to other control plane services, such as L2TP services. Each control plane service can create an epoll-worker node, and multiple control plane services do not affect each other. The more the number of control plane services is, the higher the performance of the control forwarding channel provided by the scheme provided by the application is compared with the prior art.

[0102] The embodiment of the application also provides a device for transmitting messages, which is applied to a vector packet processing engine VPP, as shown in Figure 6 The device 600 includes a first message processing module 601, a first node calling module 602, a second node calling module 603, and a message forwarding module 604.

[0103] The first message processing module 601 is configured to send a data message to a system kernel through a first work thread when the VPP receives the data message, so that the system kernel processes the data message, and / or forwards the data message to a control plane device, and the control plane device processes the data message to obtain a target data message.

[0104] The first node calling module 602 is configured to, in a case where it is determined that the listening manner of the target data packet is a first listening manner, call a first event trigger node through a second worker thread, so that the first event trigger node monitors a system kernel;

[0105] The second node calling module 603 is configured to, in a case where the first event trigger node monitors the target data packet in the system kernel, call a packet receiving node that is registered in the first event trigger node, so that the packet receiving node extracts the target data packet from the system kernel;

[0106] The packet forwarding module 604 is configured to call at least one data forwarding node through the second worker thread, and forward the target data packet to a device corresponding to a target network port through the at least one data forwarding node, wherein the target network port is determined by a routing rule issued by a routing issuing node called by the main thread, the routing issuing node is a node registered in a second event trigger node corresponding to the main thread, and the second event trigger node is configured to listen to a routing issuing request.

[0107] In one example, the apparatus for transmitting a packet further includes a second packet processing module configured to, in a case where it is determined that the listening manner of the target data packet is a second listening manner, call a second event trigger node through a main thread, so that the event trigger node monitors a system kernel; in a case where the second event trigger node monitors the target data packet in the system kernel, call a target packet receiving node that is registered in the second event trigger node, so that the target packet receiving node extracts the target data packet from the system kernel; and call at least one target data forwarding node that is registered in the second event trigger node through the main thread, and forward the target data packet to a device corresponding to a target network port through the at least one target data forwarding node.

[0108] In one example, the apparatus for transmitting a packet further includes a packet listening module configured to determine a listening manner of a target data packet. The packet listening module is specifically configured to detect whether a target field exists in a configuration file corresponding to VPP; in a case where the target field exists in the configuration file, determine that the listening manner is a first listening manner, wherein the first listening manner is a manner of monitoring a system kernel through a first event trigger node; and in a case where the target field does not exist in the configuration file, determine that the listening manner is a second listening manner, wherein the second listening manner is a manner of monitoring the system kernel through a second event trigger node.

[0109] In one example, the configuration file further includes an association between the thread indexes corresponding to the plurality of worker threads and the plurality of event trigger nodes, and the configuration file corresponding to the VPP is configured by: constructing the association between the thread indexes corresponding to the plurality of worker threads and the plurality of event trigger nodes; adding a target field in the configuration file, and configuring the configuration file based on the association between the thread indexes corresponding to the plurality of worker threads and the plurality of event trigger nodes.

[0110] In one example, the apparatus for transmitting a packet further includes a reading module and a node registration module. The reading module is configured to read, from the configuration file, an association between thread indexes corresponding to a plurality of worker threads and a plurality of event trigger nodes, wherein each worker thread is configured to call a node for executing a corresponding packet event, and the packet events corresponding to the plurality of worker threads at least include a routing packet event and a control plane packet event. The node registration module is configured to create the plurality of event trigger nodes based on the association between the thread indexes corresponding to the plurality of worker threads and the plurality of event trigger nodes, and register, in each event trigger node, a packet event corresponding to each event trigger node.

[0111] In one example, the node registration module is specifically configured to allocate, by a node initialization function, a target memory for a packet event node corresponding to a target packet event in a target event trigger node, wherein the target event trigger node is any one of the plurality of event trigger nodes, and the packet event node is a node for executing the target packet event by a worker thread; create the target packet event for the packet event node in the target memory to obtain a file descriptor corresponding to the target packet event; and add the file descriptor corresponding to the target packet event to a listening list corresponding to the target event trigger node.

[0112] In one example, the first node calling module is specifically configured to obtain a thread index corresponding to a second worker thread; determine, from the configuration file, an event trigger node corresponding to the thread index according to the thread index to obtain a first event trigger node; and call the first event trigger node.

[0113] The apparatus for transmitting a packet provided by the embodiments of the present application can implement each process implemented by the foregoing method embodiments, and thus details are not repeated here.

[0114] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above functional units and modules is taken as an example, and in actual application, the above functions can be completed by different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the above described functions. Each functional unit and module in the embodiment can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of software functional unit. In addition, the specific names of each functional unit and module are only for convenient distinction, and do not limit the protection scope of the present application. The specific working process of the unit and module in the above system can refer to the corresponding process in the foregoing method embodiment, and will not be repeated here.

[0115] Figure 7 A hardware structure schematic diagram of an electronic device provided by an embodiment of the present application is shown.

[0116] The electronic device can include a processor 701 and a memory 702 storing computer program instructions.

[0117] Specifically, the processor 701 can include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or can be configured as one or more integrated circuits that implement one or more embodiments of the present application.

[0118] The memory 702 can include a mass storage for data or instructions. By way of example and not limitation, the memory 702 can include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. Where appropriate, the memory 702 can include removable or non-removable (or fixed) media. Where appropriate, the memory 702 can be internal or external to the integrated gateway disaster recovery device. In a particular embodiment, the memory 702 is a non-volatile solid-state memory.

[0119] The memory can include read-only memory (ROM), random-access memory (RAM), magnetic disk storage mediums devices, optical storage mediums devices, flash memory devices, electrical, optical, or other physical / tangible memory storage devices. Thus, generally, the memory includes one or more tangible (non-transitory) computer-readable storage mediums (e.g., a memory device) encoded with software that, when executed (e.g., by one or more processors), is operable to perform the operations described with reference to the methods according to an aspect of the present disclosure.

[0120] The processor 701 implements the method of any of the above embodiments of transmitting a packet by reading and executing computer program instructions stored in the memory 702.

[0121] In one example, the electronic device can further include a communication interface 703 and a bus 710. As shown, the processor 701, the memory 702, and the communication interface 703 are connected through the bus 710 and complete communication with each other. Figure 7

[0122] The communication interface 703 is mainly used to realize the communication between various modules, devices, units and / or equipment in the embodiments of the present application.

[0123] The bus 710 includes hardware, software, or both, that couples components of the electronic device to each other. By way of example, and not limitation, the bus can include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand (IB) interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or another suitable bus or combination of two or more of these. Where appropriate, the bus 710 can include one or more buses. Although the present application describes and illustrates a particular bus, the present application contemplates any suitable bus or interconnect.

[0124] In addition, in combination with the method of transmitting a packet in the above embodiments, the present application can provide a computer-readable storage medium to implement. The computer-readable storage medium has computer program instructions stored thereon; the computer program instructions are executed by the processor to implement the method of transmitting a packet in any of the above embodiments.

[0125] ​In addition, in combination with the method for transmitting a packet in the above-described embodiments, an embodiment of the present application can provide a computer program product for implementation. Instructions in the computer program product are executed by a processor of an electronic device, so that the electronic device executes the method for transmitting a packet as described in any of the above-described embodiments.

[0126] It should be noted that the present application is not limited to the specific configurations and processes described above and illustrated in the drawings. For the sake of brevity, detailed descriptions of well-known methods are omitted. In the above-described embodiments, several specific steps are described and illustrated as examples. However, the method processes of the present application are not limited to the specific steps described and illustrated, and one of ordinary skill in the art can make various changes, modifications, and additions, or change the order of the steps, after understanding the spirit of the present application.

[0127] The functional modules shown in the structural block diagrams described above can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application specific integrated circuits (ASICs), appropriate firmware, plug-ins, functional cards, and the like. When implemented in software, the elements of the present application are program or code segments used to perform the required tasks. The program or code segments can be stored in a machine-readable medium or transmitted through a data signal carried in a carrier wave over a transmission medium or communication link. The "machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, and the like. The code segments can be downloaded via a computer network such as the Internet, an intranet, and the like.

[0128] It should also be noted that the exemplary embodiments mentioned in the present application describe some methods or systems based on a series of steps or devices. However, the present application is not limited to the order of the above steps, that is, the steps can be executed in the order mentioned in the embodiments, or in an order different from the embodiments, or several steps can be executed simultaneously.

[0129] The above described aspects of the present disclosure are described with reference to flowcharts and / or block diagrams of methods, apparatuses, electronic devices, and storage media for transmitting a packet according to embodiments of the present disclosure. It should be understood that each block of the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. Such computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, implement the functions / acts specified in the flowcharts and / or block diagrams one or more blocks. Such a processor can be, but not limited to, a general purpose processor, a special purpose processor, a special purpose application specific processor, or a field programmable logic array. It should also be understood that each block of the flowcharts and / or block diagrams and combinations of blocks in the flowcharts and / or block diagrams can also be implemented by dedicated hardware-based systems which perform the specified functions or acts, or combinations of hardware and computer program instructions.

[0130] The above description merely describes specific implementation of the present application. The skilled in the art can clearly understand that, for the convenience and brevity, the specific working process of the system, module and unit described above can refer to the corresponding process in the foregoing method embodiments, which will not be described herein. It should be understood that the protection scope of the present application is not limited to this. Any skilled in the art can easily think of various equivalent modifications or replacements within the technical range disclosed in the present application, and these modifications or replacements should be covered within the protection scope of the present application.

Claims

1. A method for transmitting messages, characterized in that, Applied to the Vector Packet Processing Engine (VPP), the method includes: When the VPP receives a data packet, it sends the data packet to the system kernel through the first worker thread so that the system kernel can process the data packet, and / or forward the data packet to the control plane device, where the control plane device processes the data packet to obtain the target data packet; If the monitoring method for listening to the target data packet is determined to be the first monitoring method, the first event triggering node is invoked through the second worker thread so that the first event triggering node monitors the system kernel; When the first event triggering node detects a target data packet in the system kernel, the message receiving node that has been registered in the first event triggering node is invoked so that the message receiving node can extract the target data packet from the system kernel. The second worker thread invokes at least one data forwarding node, and the at least one data forwarding node forwards the target data packet to the device corresponding to the target network interface. The target network interface is determined by the routing rules issued by the routing node invoked by the main thread. The routing node is a node registered in the second event triggering node corresponding to the main thread. The second event triggering node is used to listen for routing requests.

2. The method according to claim 1, characterized in that, The method further includes: If it is determined that the monitoring method for listening to the target data packet is the second monitoring method, the main thread calls the second event triggering node so that the event triggering node monitors the system kernel; When the second event triggering node detects a target data packet in the system kernel, it calls the target packet receiving node that has completed registration in the second event triggering node, so that the target packet receiving node can extract the target data packet from the system kernel; The main thread calls at least one target data forwarding node that has completed registration in the second event triggering node, and the target data packet is forwarded to the device corresponding to the target network interface through the at least one target data forwarding node.

3. The method according to claim 1 or 2, characterized in that, Determining the monitoring method for the target data packets includes: Check if the target field exists in the configuration file corresponding to the VPP; When the target field exists in the configuration file, the listening method is determined to be the first listening method, wherein the first listening method is the method of listening to the system kernel through the first event triggering node; If the target field is not present in the configuration file, the listening method is determined to be the second listening method, wherein the second listening method is to listen to the system kernel through the second event triggering node.

4. The method according to claim 3, characterized in that, The configuration file also includes the association between the thread indices of multiple worker threads and multiple event triggering nodes. The configuration file corresponding to the VPP is configured as follows: Construct the association between the thread indexes corresponding to the multiple worker threads and the multiple event triggering nodes; The target field is added to the configuration file, and the configuration file is configured based on the association between the thread indexes corresponding to the multiple worker threads and the multiple event triggering nodes.

5. The method according to claim 4, characterized in that, Before invoking the message receiving node that has completed registration in the first event triggering node, the method further includes: The association between the thread indexes corresponding to the multiple worker threads and the multiple event triggering nodes is read from the configuration file. Each worker thread is used to call and execute the node corresponding to the message event. The message events corresponding to the multiple worker threads include at least routing message events and control plane message events. Based on the association between the thread indexes corresponding to the multiple worker threads and the multiple event triggering nodes, the multiple event triggering nodes are created, and a message event corresponding to each event triggering node is registered in each event triggering node.

6. The method according to claim 5, characterized in that, Registering a message event corresponding to each event triggering node in each event triggering node includes: The target memory is allocated for the message event node corresponding to the target message event in the target event triggering node through the node initialization function, wherein the target event triggering node is any one of the plurality of event triggering nodes, and the message event node is the node that executes the target message event through a worker thread; Create the target packet event for the packet event node in the target memory, and obtain the file descriptor corresponding to the target packet event; Add the file descriptor corresponding to the target message event to the listener list corresponding to the target event triggering node.

7. The method according to claim 4, characterized in that, The first event trigger node is invoked through the second worker thread, including: Obtain the thread index corresponding to the second worker thread; The first event triggering node is obtained by determining the event triggering node corresponding to the thread index from the configuration file based on the thread index. Invoke the first event trigger node.

8. An apparatus for transmitting messages, characterized in that, The apparatus, used in the Vector Packet Processing Engine (VPP), includes: The first message processing module is used to send the data message to the system kernel through a first working thread when the VPP receives the data message, so that the system kernel processes the data message, and / or forward the data message to the control plane device, so that the control plane device processes the data message to obtain the target data message; The first node calling module is used to call the first event triggering node through the second worker thread when it is determined that the listening method for listening to the target data packet is the first listening method, so that the first event triggering node can monitor the system kernel; The second node calling module is used to call the message receiving node that has completed registration in the first event triggering node when the first event triggering node monitors the target data packet in the system kernel, so that the message receiving node can extract the target data packet from the system kernel; The packet forwarding module is used to call at least one data forwarding node through the second worker thread, and forward the target data packet to the device corresponding to the target network interface through the at least one data forwarding node. The target network interface is determined by the routing rules issued by the routing node called by the main thread. The routing node is a node registered in the second event triggering node corresponding to the main thread. The second event triggering node is used to listen for routing requests.

9. An electronic device, characterized in that, Electronic devices include: processors and memory storing computer program instructions; When the processor executes the computer program instructions, it implements the method for transmitting messages as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, A computer-readable storage medium stores computer program instructions that, when executed by a processor, implement the method for transmitting messages as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Data transmission method and data transmission server

    CN112631788A

  • UPF forwarding plane implementation method, device and system based on VPP and related equipment

    CN115499889A