Multi-network-port forwarding method and device for network message, medium and product

By building a structure copy and configuring the network port identifier, zero-copy multi-network port forwarding is achieved, solving the problem of heavy memory burden in traditional network devices and improving forwarding efficiency and reliability.

CN120711028APending Publication Date: 2025-09-26EVERSEC BEIJING TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511023662.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-24
Publication Date
2025-09-26

AI Technical Summary

Technical Problem

Traditional network devices need to frequently copy messages when forwarding messages across multiple network ports, which results in a heavy memory burden and affects processing performance.

Method used

By obtaining the original network message, parsing the target network port, building a structure copy and configuring the network port identifier, zero-copy multi-target forwarding is achieved.

Benefits of technology

Significantly improves message forwarding efficiency, reduces memory overhead, and ensures that network traffic is efficiently and reliably distributed to the designated target network port.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120711028A_ABST
    Figure CN120711028A_ABST
Patent Text Reader

Abstract

The invention discloses a network message multi-network-port forwarding method and device, a medium and a product, and the method comprises the steps: obtaining an original network message sent by a convergence shunt, caching the original network message, analyzing the original network message, and determining a target network port needing to be forwarded; when the number of the target network ports is multiple, determining a target copy number according to the number of the target network ports; according to the message key information structural body, constructing a target copy number of structural body copies to form a target structural body set; configuring each target structural body in the target structural body set by using the network port identifier of each target network port; according to the technical scheme of the embodiment of the invention, the processing efficiency of network message forwarding is remarkably improved, the consumption of system resources is reduced, and the network message forwarding efficiency is improved by optimizing a message copying and forwarding mechanism. And efficient distribution and management of network traffic are realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of network communication technology, and in particular to a multi-network port forwarding method, equipment, medium and product for network messages. Background Art

[0002] With the explosive growth of network traffic and the rapid popularization of cloud computing, the message processing capabilities of traditional network equipment have become a key bottleneck restricting the improvement of network performance.

[0003] In the existing technology, multi-network port message forwarding mainly adopts memory copying of the original network message to generate multiple identical copy data packets, then individually modify the target network port identification information for each copy, and finally send the processed data packets one by one to the corresponding network interface.

[0004] During the research and development process, the inventors discovered that although the traditional message copying method is simple to implement, when a message needs to be forwarded to multiple network ports, the general processor often needs to copy multiple messages and attach a different network port ID (Identifier) ​​to each message. Frequent copying of message content will bring a heavy memory burden and greatly affect processing performance. Summary of the Invention

[0005] The embodiments of the present invention provide a multi-network port forwarding method, device, medium and product for network messages, which can realize multi-target forwarding of messages in a zero-copy situation.

[0006] According to one aspect of an embodiment of the present invention, a method for forwarding network packets through multiple network ports is provided, the method comprising:

[0007] Obtain the original network message sent by the convergence and splitter for buffering, and parse the original network message to determine at least one target network port to which the original network message needs to be forwarded;

[0008] When there are multiple target network ports, the target replication quantity is determined based on the number of target network ports;

[0009] According to the message key information structure of the original network message, a target number of structure copies are constructed, and the message key information structure and the structure copies are combined into a target structure set;

[0010] Use the network port identifier of each target network port to configure each target structure in the target structure set;

[0011] Target network messages of the same number as the target network ports are constructed according to the configured target structures and the cached original network messages, and are returned to the convergence and splitter so that the convergence and splitter can forward each target network message to the matching target network port respectively.

[0012] According to another aspect of an embodiment of the present invention, a multi-network port forwarding device for network messages is provided, the device comprising:

[0013] The data receiving module is used to obtain the original network message sent by the convergence and splitter for buffering, and to parse the original network message to determine at least one target network port to which the original network message needs to be forwarded;

[0014] A replication decision module, configured to determine a target replication quantity based on the number of target network ports when there are multiple target network ports;

[0015] A copy generation module is used to construct a target number of structure copies based on the message key information structure of the original network message, and to form a target structure set with the message key information structure and the structure copies;

[0016] A configuration module, configured to configure each target structure in the target structure set using the network port identifier of each target network port;

[0017] The forwarding module is used to construct target network messages of the number of target network ports according to the configured target structures and the cached original network messages, and return them to the convergence and splitter so that the convergence and splitter can forward each target network message to the matching target network port respectively.

[0018] According to another aspect of an embodiment of the present invention, an electronic device is provided, the electronic device comprising:

[0019] at least one processor; and

[0020] a memory communicatively connected to the at least one processor; wherein,

[0021] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the multi-network port forwarding method of a network message described in any embodiment of the present invention.

[0022] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement a multi-network port forwarding method for network messages described in any embodiment of the present invention when executed.

[0023] According to another aspect of an embodiment of the present invention, a computer program product is provided, comprising computer instructions, which implement the steps of the method according to any embodiment of the present invention when executed by a processor.

[0024] The technical solution of the embodiment of the present invention first obtains and caches the original network message, parses and determines its target network port, and when there are multiple target network ports, determines the number of copies based on the number, constructs a corresponding number of structure copies based on the message key information structure and forms a target structure set, then uses each target network port identifier to configure the structure, and finally generates a corresponding number of target network messages based on the configured structure and the original message, and transmits them back to the convergence splitter to forward them according to the target network port. This new multi-network port forwarding method for network messages can significantly improve the message forwarding efficiency and effectively reduce memory overhead through the structure copy reuse mechanism. At the same time, this method realizes accurate network port identifier matching and forwarding, ensuring that network traffic can be efficiently and reliably distributed to the designated target network port.

[0025] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present invention, nor is it intended to limit the scope of the present invention. Other features of the present invention will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0027] Figure 1 This is a flowchart of a multi-network port forwarding method for network messages provided in accordance with the first embodiment of the present invention;

[0028] Figure 2 This is a flowchart of another multi-network port forwarding method for network messages provided in accordance with the second embodiment of the present invention;

[0029] Figure 3 This is a flowchart of another multi-network port forwarding method for network messages provided in accordance with the third embodiment of the present invention;

[0030] Figure 4 This is a schematic structural diagram of a multi-network port forwarding device for network messages provided in accordance with a fourth embodiment of the present invention;

[0031] Figure 5 The present invention is a schematic structural diagram of an electronic device for implementing a multi-network port forwarding method for network messages according to an embodiment of the present invention. DETAILED DESCRIPTION

[0032] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.

[0033] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0034] Example 1

[0035] Figure 1 A flowchart of a multi-port forwarding method for network messages provided in embodiment 1 of the present invention. This embodiment is applicable to situations where network messages need to be forwarded through multiple network ports. The method can be executed by a multi-port forwarding device for network messages. The device can be implemented in the form of hardware and / or software, and can generally be configured in a general-purpose processor in an electronic device and used in conjunction with a convergence splitter. The electronic device can be understood as various types of switching devices in the network. Network card hardware is configured in the electronic device, and the network card hardware is used to realize message interaction between the general-purpose processor and the convergence splitter.

[0036] Correspondingly, such as Figure 1 As shown, the method includes:

[0037] S110: Obtain the original network message sent by the convergence splitter, cache it, and parse the original network message to determine at least one target network port to which the original network message needs to be forwarded.

[0038] The convergence and splitter is a key network device. Its core function is to be installed between the production network mirroring port and the analysis equipment cluster. It aggregates the traffic mirrored or split from one or more production network devices and distributes it to one or more data analysis devices without affecting the original network operation. It can achieve network connection aggregation and centralized management, and at the same time, it can split the aggregated network traffic according to specific rules to optimize network performance and resource utilization.

[0039] It is worth noting that, as a physical layer device, the convergence and splitter can efficiently achieve traffic convergence and basic traffic splitting, but lacks the ability to deeply analyze network messages. To this end, this solution introduces a general-purpose processor as an intelligent processing unit to complement the convergence and splitter. Among them, the convergence and splitter is mainly responsible for the physical layer convergence and forwarding of the original message, while the general-purpose processor undertakes the core computing and control functions, including tasks such as deep message parsing, rule matching, and forwarding decision-making. Through software programming, the general-purpose processor can deeply process network messages, determine the optimal forwarding path according to preset strategies, and coordinate various components to complete traffic scheduling, with the characteristics of both processing flexibility and functional scalability.

[0040] A target network port can be understood as the destination port to which the original network message is forwarded after parsing. Each target network port corresponds to a specific network transmission path or downstream processing device. These network ports may connect to different network areas, devices, or analysis systems to achieve precise message routing and load distribution.

[0041] In this embodiment, the general processor obtains and caches the original network message sent by the convergence and splitter, parses the original message, extracts its key information, and matches it according to pre-set rules to determine the target network port (at least one) to which the original network message needs to be forwarded. S120: When there are multiple target network ports, determine the target number of replications based on the number of target network ports.

[0042] In this embodiment, the number of message key information structure copies that need to be generated is calculated based on the determined number of target network ports. This number directly corresponds to the number of target network ports. For example, if the number of target network ports is N, the target number of copies is N-1.

[0043] S130 . Construct a target number of structure copies based on the message key information structure of the original network message, and form a target structure set with the message key information structure and the structure copies.

[0044] The message key information structure can be understood as a standardized data structure that stores the core metadata of the original network message. It contains key characteristic information such as message length, protocol type, and storage address, and serves as the basic data unit for message processing. The structure replica can be understood as an identical copy instance generated based on the message key information structure, retaining all field values ​​and pointer relationships of the original structure.

[0045] In this embodiment, after determining the target number of copies, a corresponding number of structure copies are generated based on the message key information structure of the original network message, and each copy completely copies all metadata fields of the original structure (referring to the standardized data unit in the message key information structure that describes the message attributes and control parameters), including but not limited to: message length, timestamp, protocol type, and storage address and other key information; these structure copies are combined with the original message key information structure into a target structure set, and each member in the set maintains an association with the original message data, providing independent and operable structured data units for subsequent differentiated configurations for different target network ports.

[0046] That is, the number of target structures in the target structure set is consistent with the number of target network ports.

[0047] S140: Use the network port identifier of each target network port to configure each target structure in the target structure set.

[0048] The network port identifier is the coded information that uniquely identifies a network port, typically including a physical port number, a logical port ID, or a VLAN (Virtual Local Area Network) tag. In this solution, this identifier serves as the addressing basis for target network packets. By configuring specific fields in the structure replica, it ensures that packets are accurately routed to the designated physical or virtual network interface.

[0049] In this embodiment, after obtaining the target structure set, the unique identification parameters of each target network port are extracted, and independent configuration operations are performed on each structure copy in the set. These identification information are written into specific fields of the structure to complete the binding of the forwarding path and the physical port.

[0050] S150: construct target network messages of the same number as the target network ports according to the configured target structures and the cached original network messages, and return them to the convergence and splitter so that the convergence and splitter can forward each target network message to the matching target network port.

[0051] In this embodiment, each configured structure copy and its associated original message data together constitute a complete forwarding message unit, and these units establish an accurate matching relationship with the physical network port through the network port identification parameters preset in the structure (such as VLAN ID or port number). Specifically, this solution uses a pointer reference mechanism to ensure that all forwarding message instances share the same original message data, and realizes multi-target forwarding only through differentiated configuration of structure metadata. After the message instance construction is completed, these instances are uniformly submitted to the forwarding queue of the convergence splitter, which performs the final distribution operation based on the network port identification carried by each message instance, and accurately delivers the message to each designated target network port.

[0052] The technical solution of the embodiment of the present invention first obtains and caches the original network message, parses and determines its target network port, and when there are multiple target network ports, determines the number of copies based on the number, constructs a corresponding number of structure copies based on the message key information structure and forms a target structure set, then uses each target network port identifier to configure the structure, and finally generates a corresponding number of target network messages based on the configured structure and the original message, and transmits them back to the convergence splitter to forward them according to the target network port. This new multi-network port forwarding method for network messages can significantly improve the message forwarding efficiency and effectively reduce memory overhead through the structure copy reuse mechanism. At the same time, this method realizes accurate network port identifier matching and forwarding, ensuring that network traffic can be efficiently and reliably distributed to the designated target network port.

[0053] Example 2

[0054] Figure 2 This is a flowchart of another multi-network port forwarding method for network messages provided in Example 2 of the present invention. This example is optimized based on the above examples. It specifically details the operations of "obtaining and caching the original network message sent by the convergence and splitter, parsing the original network message, and determining at least one target network port to which the original network message is to be forwarded."

[0055] Correspondingly, such as Figure 2 As shown, the method includes:

[0056] S210: Obtain the original network message sent by the convergence splitter.

[0057] S220 : Strip the VLAN tag of the source network port from the original network message, and write the VLAN tag into the target field in the message key information structure of the original network message.

[0058] The VLAN tag can be understood as a logical identifier embedded in the Ethernet frame. It adds a special 4-byte tag to the message header according to the IEEE802.1Q standard, which contains a 12-bit VLAN ID to distinguish different virtual networks. In this solution, this tag is pre-added by the aggregation and splitter to identify the specific physical port from which the message originated (for example, mapping network port 1 to VLAN 1). This digital approach enables accurate identification and classification management of multi-port traffic. The destination field can be understood as a metadata area specifically used to store key network information during message processing.

[0059] In this embodiment, the original network message sent by the convergence and splitter carries a VLAN tag added by hardware (typically, including the input network port ID information). When this message arrives at the electronic device equipped with the general-purpose processor, the VLAN receive stripping function of the network card is enabled by configuring the DPDK (Data Plane Development Kit) in the electronic device. The network card hardware automatically strips the VLAN tag header. At the same time, the DPDK's mbuf management mechanism stores the stripped VLAN tag content in the vlan_tci field (i.e., the target field) of the message key information structure (i.e., the mbuf structure). The network card hardware, as a co-processing unit of the general-purpose processor, is specifically responsible for physical layer message processing, complementing the general-purpose processor's logic layer functions.

[0060] The mbuf structure is the core data structure used in DPDK to manage network packets. Essentially, it is a metadata container, linked to the actual packet data memory area through a pointer. It also stores control information such as the packet length, port number, and checksum, enabling the separation of packet data and description information. The vlan_tci field is a member variable in the mbuf structure dedicated to storing VLAN tag information, fully recording the stripped tag content.

[0061] S230: Cache the original network message after the VLAN tag is stripped, and parse the original network message in combination with the message key information structure to determine the at least one target network port.

[0062] In this embodiment, a cache operation is performed on the original network message after the VLAN tag has been stripped. At the same time, a joint analysis is performed based on the source network port identifier (typically, the vlan_tci field value) recorded in the message key information structure and the message content characteristics. The preset rule matching logic is used to determine the identifiers of one or more target network ports to which the message needs to be forwarded. This process establishes a complete forwarding path mapping relationship from the input network port to the output network port.

[0063] S240: When there are multiple target network ports, determine the target number of replications based on the target network ports. S250: Construct a target number of replication structure copies based on the message key information structure of the original network message, and form a target structure set with the message key information structure and the structure copies.

[0064] S260: Use the network port identifier of each target network port to configure each target structure in the target structure set.

[0065] S270: construct target network messages equal to the number of target network ports according to the configured target structures and the cached original network messages, and return them to the convergence and splitter so that the convergence and splitter can forward each target network message to the matching target network port.

[0066] The technical solution of the embodiment of the present invention first obtains the original network message sent by the convergence splitter, strips the VLAN tag of the source network port from the message and writes it into the target field of the message key information structure, then caches the message and parses to determine the target network port. When there are multiple target network ports, the number of copies is determined according to the number, and a corresponding number of structure copies are constructed based on the message key information structure to form a target structure set. The structure copies are configured using the identifiers of each target network port, and finally, the target number of network messages is generated based on the configured structure and the original message, and the packets are sent back to the convergence splitter for forwarding according to the target network port. This new multi-network port forwarding method for network messages significantly reduces the processing overhead of the computing core through the hardware unloaded VLAN tag stripping mechanism, while ensuring the complete retention of the source network port information; the intelligent caching and parsing based on the structure realizes the deep extraction of message features and the accurate decision of the forwarding path, ensuring that network traffic can be efficiently and reliably distributed to the designated target network port.

[0067] Optionally, based on the above embodiments, when there are multiple target network ports, determining the target replication quantity according to the target network ports may include:

[0068] When there are multiple target network ports, the result obtained by subtracting one from the target network port number is used as the target replication quantity.

[0069] Generally speaking, when a message needs to be forwarded to multiple target network ports, the total number of target network ports is first counted. Then, the number of additional copies of the message key information structure that need to be created is calculated by subtracting one from the total number. For example, if the number of target network ports is N, the target number of copies is N-1. This calculated value directly determines the number of copies that need to be generated subsequently, ensuring that each target network port has an independent forwarding configuration carrier.

[0070] Optionally, based on the above embodiments, constructing a target number of structure copies according to the message key information structure of the original network message may include:

[0071] Call the clone function provided in the data plane development kit to clone the key information structure of the original network message and obtain the target number of structure copies.

[0072] In scenarios where multi-port message forwarding is required, the rte_pktmbuf_clone() function provided in the data plane development kit is called to clone the message key information structure (struct rte_mbuf) corresponding to the original network message. This function creates a specified number of structure copies (i.e., the target number of copies), each of which completely copies the metadata information of the original structure. At the same time, a pointer reference mechanism is used to share the pkt_data pointer pointing to the same copy of the original message data. These generated copies are added to the target structure set as independent structure instances, maintaining a parallel association with the original structure, providing an operational basis for subsequent differentiated configuration for different target network ports. The entire cloning process only copies the structure metadata and does not involve copying the actual message content, thereby ensuring the effectiveness of the zero-copy mechanism.

[0073] Example 3

[0074] Figure 3 This is a flowchart of another multi-network port forwarding method for network messages provided in the third embodiment of the present invention. This embodiment is optimized based on the above embodiments and specifically refines the operation of "using the network port identifier of each target network port to configure each target structure in the target structure set."

[0075] Correspondingly, such as Figure 3 As shown, the method includes:

[0076] S310: Obtain the original network message sent by the convergence splitter and cache it, parse the original network message, and determine at least one target network port to which the original network message needs to be forwarded.

[0077] S320: When there are multiple target network ports, determine the target replication quantity according to the target network ports.

[0078] S330: Construct a target number of structure copies based on the message key information structure of the original network message, and form a target structure set with the message key information structure and the structure copies.

[0079] S340: Obtain a current target network port in sequence, and obtain a current target structure in sequence from the target structure set.

[0080] The current target network port can be understood as the target network port instance being operated during the multi-port forwarding task. In the loop processing process, this network port represents the port selected for configuration in the current iteration. Its unique identifier (such as the physical port number or VLAN ID) is extracted and written into the corresponding current target structure to establish the binding relationship between the message and the specific forwarding path.

[0081] In this embodiment, a single network port is selected in sequence from the determined target network port set as the current processing object, and at the same time, a corresponding structure instance to be configured is obtained from the pre-built target structure set, and a one-to-one correspondence between the current target network port and the current target structure is established, providing a clear processing unit for subsequent network port identification configuration operations.

[0082] S350: Use the network port identifier of the current target network port to configure the target field in the current target structure.

[0083] In this embodiment, by parsing the unique identifiers of the current target network port, such as the physical port number and VLAN tag, these network addressing information is written into predefined fields such as vlan_tci and port_id in the current target structure. This configuration process ensures that the forwarding parameters of each structure copy exactly match those of the target network port. Through precise field-level assignment, a deterministic forwarding relationship between packets and ports is established, providing metadata support for subsequent zero-copy forwarding based on hardware offload.

[0084] S360: Determine whether all target network ports have been processed. If so, execute S370; otherwise, execute S340.

[0085] S370: construct target network messages of the same number as the target network ports according to the configured target structures and the cached original network messages, and return them to the convergence and splitter so that the convergence and splitter can forward each target network message to the matching target network port respectively.

[0086] Furthermore, based on the above embodiments, after configuring the target field in the current target structure using the network port identifier of the current target network port, the following steps may also be included:

[0087] Set the VLAN tag addition indication flag in the current target structure to the target value used to describe the addition of the VLAN tag.

[0088] Generally speaking, the VLAN tag adding function is explicitly activated by setting a specific flag bit in the current target structure to a target value (usually 1). This flag bit acts as a hardware unloading instruction signal and works in conjunction with the configured vlan_tci field in the structure: when this flag bit is set, it indicates that the network card will automatically insert the corresponding VLAN tag in the Ethernet frame header dynamically according to the VLAN ID, priority and other parameter information stored in the vlan_tci field during the message sending phase. The entire process is completed by the general processor calling the network card hardware, without the need for any software-level modification operations on the original message content. Optionally, based on the above embodiments, the target network port number target network messages are constructed according to the configured target structures and the cached original network messages, and the return of the target network messages to the aggregation and splitter can include:

[0089] Obtaining a current target structure in sequence, and locating and obtaining the original network message according to the current target structure;

[0090] Obtaining the network port identifier from the target field of the current target structure according to the target value set for the VLAN tag addition indication flag in the current target structure;

[0091] According to the obtained network port identifier, the VLAN tag of the destination network port is added to the original network message to obtain the target network message, and the target network message is returned to the aggregation and splitter;

[0092] Returns and executes the operation of obtaining one current target structure at a time until all target structures are processed.

[0093] Generally speaking, the current structure instance to be processed is first selected from the target structure set in order. The data pointer recorded in the structure is used to accurately locate the original network message data area cached in memory, and the association between the current processing unit and the original message is established. This step ensures that each structure copy is correctly mapped to its corresponding original message data.

[0094] Generally speaking, by checking the status of the preset VLAN tag addition flag in the current target structure, when determining whether a VLAN tag insertion operation is required, the pre-configured network port identification parameters are extracted from the target field of the structure (such as vlan_tci). The flag status judgment provides a basis for subsequent differentiated processing decisions.

[0095] Generally speaking, based on the acquired network port identification information, the NIC hardware transmission engine inserts the corresponding VLAN tag header in real time before the packet leaves the NIC, while preserving the original packet content. This generates a new packet instance that meets the requirements of the target network port. This dynamic tag insertion mechanism is implemented through hardware offload, ensuring processing efficiency while avoiding data copying. After the tag is added, the packet is immediately submitted to the forwarding queue of the aggregation and splitter.

[0096] Generally speaking, the above process is repeated through a loop control mechanism, processing each member of the target structure set in turn until all packets associated with the structure replicas have completed VLAN tag insertion and forwarding queue registration, thus achieving batch processing of multiple target packets. This iterative process ensures the orderly completion of massive forwarding tasks.

[0097] Further, based on the above embodiments, after constructing the target network port number target network packets according to the configured target structures and the cached original network packets and returning them to the convergence splitter, the following may also be included:

[0098] The original network message is deleted from the cache, and the target structure set is deleted.

[0099] Generally speaking, the resource release process begins only after all target network packets have been successfully forwarded back to the convergence and splitter. This process first releases the cached reference to the original network packet, returning the memory block it occupied to the DPDK memory pool. It then clears all structure instances in the target structure set, including the original structure and its clones. This strict timing control ensures that resources are not reclaimed until the forwarding operation is fully completed, ensuring both reliable data transmission and efficient memory reuse. The entire recycling mechanism tracks packet status through reference counting to avoid any potential resource conflicts or leaks.

[0100] Example 4

[0101] Figure 4 This is a schematic diagram of the structure of a multi-network port forwarding device for network messages provided in the fourth embodiment of the present invention. Figure 4 As shown, the device includes:

[0102] The data receiving module 410 is used to obtain the original network message sent by the convergence and splitter for buffering, and to parse the original network message to determine at least one target network port to which the original network message needs to be forwarded;

[0103] A replication decision module 420 is configured to determine a target replication quantity based on the number of target network ports when there are multiple target network ports;

[0104] The copy generation module 430 is used to construct a target number of structure copies based on the message key information structure of the original network message, and form a target structure set by combining the message key information structure and the structure copies;

[0105] A configuration module 440 is configured to configure each target structure in the target structure set using the network port identifier of each target network port;

[0106] The forwarding module 450 is used to construct target network messages of the same number as the target network ports according to the configured target structures and the cached original network messages, and return them to the convergence splitter so that the convergence splitter can forward each target network message to the matching target network port.

[0107] The technical solution of the embodiment of the present invention first obtains and caches the original network message, parses and determines its target network port, and when there are multiple target network ports, determines the number of copies based on the number, constructs a corresponding number of structure copies based on the message key information structure and forms a target structure set, then uses each target network port identifier to configure the structure, and finally generates a corresponding number of target network messages based on the configured structure and the original message, and transmits them back to the convergence splitter to forward them according to the target network port. This new multi-network port forwarding method for network messages can significantly improve the message forwarding efficiency and effectively reduce memory overhead through the structure copy reuse mechanism. At the same time, this method realizes accurate network port identifier matching and forwarding, ensuring that network traffic can be efficiently and reliably distributed to the designated target network port.

[0108] Based on the above embodiment, the data receiving module 410 is specifically configured to:

[0109] Obtain the original network message sent by the convergence and splitter;

[0110] Stripping the VLAN tag of the source network port from the original network message, and writing the VLAN tag into the target field in the message key information structure of the original network message;

[0111] The original network message after the VLAN tag is stripped is cached, and the original network message is parsed in combination with the message key information structure to determine the at least one target network port.

[0112] Based on the above embodiment, the replication decision module 420 is specifically configured to:

[0113] When there are multiple target network ports, the result obtained by subtracting one from the target network port number is used as the target replication quantity.

[0114] Based on the above embodiment, the replica generation module 430 is specifically configured to:

[0115] Call the clone function provided in the data plane development kit to clone the key information structure of the original network message and obtain the target number of structure copies.

[0116] Furthermore, based on the above embodiments, the configuration module 440 may further include:

[0117] The structure pairing submodule is used to obtain a current target network port in sequence, and obtain a current target structure from the target structure set in sequence;

[0118] The network port identification configuration submodule is used to configure the target field in the current target structure using the network port identification of the current target network port;

[0119] The loop control submodule is used to return to execute the operation of sequentially obtaining a current target network port and sequentially obtaining a current target structure from the target structure set until all target network ports are completely processed.

[0120] Furthermore, based on the above embodiments, the configuration module 440 may further include:

[0121] The tag activation submodule is used to configure the target field in the current target structure using the network port identifier of the current target network port, and then set the VLAN tag addition indication flag in the current target structure to a target value for describing the addition of the VLAN tag;

[0122] Based on the above embodiments, the forwarding module 450 is specifically configured to:

[0123] Obtaining a current target structure in sequence, and locating and obtaining the original network message according to the current target structure;

[0124] Obtaining the network port identifier from the target field of the current target structure according to the target value set for the VLAN tag addition indication flag in the current target structure;

[0125] According to the obtained network port identifier, the VLAN tag of the destination network port is added to the original network message to obtain the target network message, and the target network message is returned to the aggregation and splitter;

[0126] Returns and executes the operation of obtaining one current target structure at a time until all target structures are processed.

[0127] Furthermore, based on the above embodiments, the multi-network port forwarding device for network messages may further include:

[0128] The resource recovery module is used to delete the original network message from the cache and the target structure set after constructing the target network port number target network messages based on the configured target structures and the cached original network messages and returning them to the convergence splitter.

[0129] A multi-network port forwarding device for network messages provided in an embodiment of the present invention can execute a multi-network port forwarding method for network messages provided in any embodiment of the present invention, and has corresponding functional modules and beneficial effects of the execution method.

[0130] In the technical solutions disclosed herein, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0131] Example 5

[0132] Figure 5 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.

[0133] like Figure 5 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., which is communicatively connected to the at least one processor 11. The memory stores a computer program that can be executed by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 into the random access memory (RAM) 13. Various programs and data required for the operation of the electronic device 10 can also be stored in the RAM 13. The processor 11, ROM 12, and RAM 13 are connected to each other via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0134] Multiple components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0135] The processor 11 may be any general-purpose and / or specialized processing component with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a multi-port forwarding method for a network message, namely:

[0136] Obtain the original network message sent by the convergence and splitter for buffering, and parse the original network message to determine at least one target network port to which the original network message needs to be forwarded;

[0137] When there are multiple target network ports, the target replication quantity is determined based on the number of target network ports;

[0138] According to the message key information structure of the original network message, a target number of structure copies are constructed, and the message key information structure and the structure copies are combined into a target structure set;

[0139] Use the network port identifier of each target network port to configure each target structure in the target structure set;

[0140] Target network messages of the same number as the target network ports are constructed according to the configured target structures and the cached original network messages, and are returned to the convergence and splitter so that the convergence and splitter can forward each target network message to the matching target network port respectively.

[0141] In some embodiments, a method for forwarding a network message through multiple network ports may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the method for forwarding a network message through multiple network ports described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute a method for forwarding a network message through multiple network ports in any other appropriate manner (for example, by means of firmware).

[0142] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system comprising at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0143] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the computer program is executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0144] In the context of the present invention, computer-readable storage media can be tangible media that can contain or store a computer program for use with an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. Computer-readable storage media can include but are not limited to electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, computer-readable storage media can be machine-readable signal media. More specific examples of machine-readable storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0145] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0146] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0147] A computing system may include clients and servers. The clients and servers are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host. This server is a hosting product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosting and VPS services.

[0148] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in the present invention can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved. This is not limited herein.

[0149] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.

Claims

1. A multi-port forwarding method for network messages, characterized in that: include: Obtain the original network message sent by the convergence and splitter for buffering, and parse the original network message to determine at least one target network port to which the original network message needs to be forwarded; When there are multiple target network ports, the target replication quantity is determined based on the number of target network ports; According to the message key information structure of the original network message, a target number of structure copies are constructed, and the message key information structure and the structure copies are combined into a target structure set; Use the network port identifier of each target network port to configure each target structure in the target structure set; Target network messages of the same number as the target network ports are constructed according to the configured target structures and the cached original network messages, and are returned to the convergence and splitter so that the convergence and splitter can forward each target network message to the matching target network port respectively.

2. The method according to claim 1, characterized in that Obtaining the original network message sent by the convergence splitter for caching, parsing the original network message, and determining at least one target network port to which the original network message needs to be forwarded, including: Obtain the original network message sent by the convergence and splitter; Stripping the source network port's virtual local area network (VLAN) tag from the original network message, and writing the VLAN tag into the target field in the message key information structure of the original network message; The original network message after the VLAN tag is stripped is cached, and the original network message is parsed in combination with the message key information structure to determine the at least one target network port.

3. The method according to claim 1, characterized in that When there are multiple target network ports, the target replication quantity is determined based on the number of target network ports, including: When there are multiple target network ports, the result obtained by subtracting one from the target network port number is used as the target replication quantity.

4. The method according to claim 1, wherein Based on the key information structure of the original network message, a target number of structure copies are constructed, including: Call the clone function provided in the data plane development kit to clone the key information structure of the original network message and obtain the target number of structure copies.

5. The method according to claim 1, wherein Use the network port identifier of each target network port to configure each target structure in the target structure set, including: Obtain a current target network port in sequence, and obtain a current target structure from the target structure set in sequence; Use the network port identifier of the current target network port to configure the target field in the current target structure; Return to execute the operation of obtaining a current target network port in sequence, and obtaining a current target structure in sequence from the target structure set until all target network ports are completely processed.

6. The method according to claim 5, characterized in that After configuring the target field in the current target structure using the network port identifier of the current target network port, the following steps are also included: Set the VLAN tag addition indication flag in the current target structure to the target value used to describe the addition of the VLAN tag; Accordingly, the target network packets of the target network ports are constructed based on the configured target structures and the cached original network packets and are returned to the convergence and splitter, including: Obtaining a current target structure in sequence, and locating and obtaining the original network message according to the current target structure; Obtaining the network port identifier from the target field of the current target structure according to the target value set for the VLAN tag addition indication flag in the current target structure; According to the obtained network port identifier, the VLAN tag of the destination network port is added to the original network message to obtain the target network message, and the target network message is returned to the aggregation and splitter; Returns and executes the operation of obtaining one current target structure at a time until all target structures are processed.

7. The method according to any one of claims 1 to 6, characterized in that After constructing the target network ports and target network packets according to the configured target structures and the cached original network packets and returning them to the convergence and splitter, it also includes: The original network message is deleted from the cache, and the target structure set is deleted.

8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the multi-network port forwarding method for network messages according to any one of claims 1 to 7.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the multi-network port forwarding method for network messages according to any one of claims 1 to 7 when executed.

10. A computer program product, characterized in that The computer program product includes a computer program, and when the computer program is executed by a processor, the computer program implements the multi-network port forwarding method of the network message according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method and apparatus for copying message for multi-broadcast treatment

    CN101227306A

  • Load balancing method, convergence shunt and storage medium

    CN112702278A