Message processing device and method, electronic equipment and network equipment
By introducing the interaction between the queue module and the functional module in the message processing device, and integrating layer 2 and layer 3 processing, the problems of insufficient resource reuse and processing complexity are solved, and efficient resource utilization and complexity are achieved.
Patent Information
- Application Number
- CN202310796950.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-30
- Publication Date
- 2025-01-07
AI Technical Summary
In Ethernet message exchange, processing of layer 2, layer 3 and above is usually carried out in different devices, resulting in insufficient reuse of resources and increased processing complexity, and packet transfer is required, increasing the design area and power consumption.
By introducing queue modules and multiple functional modules into the message processing device, each functional module interacts through the queue, integrates processing modules of layer 2 and layer 3 and above, shares resources, and reduces the complexity of message processing and design area.
It improves resource utilization, reduces hardware design area and power consumption, reduces message processing complexity, and avoids complete message migration.
Smart Images

Figure CN119276954A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of communication technology, and in particular to a message processing device, a message processing method, an electronic device, and a network device. Background Art
[0002] When exchanging Ethernet packets, Layer 2 and Layer 3 switching, Network Address Translator (NAT), encryption and decryption, and fragment reassembly are usually performed in different devices. When Layer 2 and Layer 3 and above processing are performed in different devices, there will be a large number of duplicate resources in different devices; during the interaction between different devices, operations such as packet movement are also required, which increases the processing complexity. Summary of the invention
[0003] The embodiments of the present disclosure provide a message processing device, a message processing method, an electronic device, and a network device.
[0004] In a first aspect, an embodiment of the present disclosure provides a message processing device, comprising a queue module and multiple functional modules, wherein the queue module comprises multiple queues corresponding to different functional modules, and the multiple functional modules are communicatively connected with the queue module; the queue module is used to determine a target queue corresponding to a second functional module according to first enqueue request information obtained by the first functional module for processing a message to be processed; add identification information of the message to be processed to the target queue; dequeue the identification information from the target queue to the second functional module; and the second functional module is used to process the message to be processed.
[0005] In a second aspect, an embodiment of the present disclosure provides a message processing method, comprising: determining a target queue corresponding to a second functional module based on first enqueue request information obtained by processing a message to be processed by a first functional module, wherein different functional modules correspond to different queues; adding identification information of the message to be processed to the target queue; dequeuing the identification information from the target queue to the second functional module; and processing the message to be processed by the second functional module.
[0006] In a third aspect, an embodiment of the present disclosure provides an electronic device, comprising: one or more processors; a memory on which one or more programs are stored, and when the one or more programs are executed by the one or more processors, the one or more processors implement the message processing method described in the second aspect of the embodiment of the present disclosure.
[0007] In a fourth aspect, an embodiment of the present disclosure provides a network device, including the message processing device described in the first aspect of the embodiment of the present disclosure.
[0008] In the disclosed embodiments, a plurality of functional modules can interact in message processing through queues, so that the functional modules responsible for Layer 2 switching and processing and the functional modules responsible for Layer 3 and above switching and processing can be integrated into one message switching device. The various functional modules can share resources when performing processing such as message storage and management, message parsing, forwarding table lookup, and message modification, thereby improving resource utilization; when performing hardware design, it is beneficial to reduce the design area and power consumption; in the process of Layer 2 switching and processing and Layer 3 and above switching and processing, there is no need to perform a complete migration of messages, thereby reducing the complexity of message processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] Figure 1 is a schematic diagram of an Ethernet message switching scheme;
[0010] Figure 2 It is a schematic diagram of the composition of a message processing device in an embodiment of the present disclosure;
[0011] Figure 3 It is a schematic diagram of the composition of another message processing device in an embodiment of the present disclosure;
[0012] Figure 4 is a flow chart of a message processing method in an embodiment of the present disclosure;
[0013] Figure 5 is a flow chart of another message processing method in an embodiment of the present disclosure;
[0014] Figure 6 is a schematic diagram of the composition of an electronic device in an embodiment of the present disclosure;
[0015] Figure 7 It is a schematic diagram of the composition of a network device in an embodiment of the present disclosure;
[0016] Figure 8 It is a flow chart of message exchange and processing in this embodiment. DETAILED DESCRIPTION
[0017] In order to enable those skilled in the art to better understand the technical solution of the present disclosure, the message processing device, message processing method, electronic device, and network device provided by the present disclosure are described in detail below in conjunction with the accompanying drawings.
[0018] Example embodiments will be described more fully below with reference to the accompanying drawings, but the example embodiments may be embodied in different forms and should not be construed as limited to the embodiments set forth herein. On the contrary, the purpose of providing these embodiments is to make the present disclosure thorough and complete and to enable those skilled in the art to fully understand the scope of the present disclosure.
[0019] In the absence of conflict, the various embodiments of the present disclosure and the various features therein may be combined with each other.
[0020] As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.
[0021] The terms used herein are only used to describe specific embodiments and are not intended to limit the present disclosure. As used herein, the singular forms "a", "an" and "the" are also intended to include the plural forms, unless the context clearly indicates otherwise. It will also be understood that when the terms "comprising" and / or "made of" are used in this specification, the presence of the features, wholes, steps, operations, elements and / or components is specified, but the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or groups thereof is not excluded.
[0022] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by those of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and the present disclosure, and will not be interpreted as having an idealized or overly formal meaning unless explicitly defined as such herein.
[0023] Figure 1 The present invention is a design scheme for Ethernet message exchange in some related technologies. A layer 2 switching device is used to complete the layer 2 exchange and related processing. A message processing device is used to process messages at layer 3 and above, such as layer 3 switching, NAT, encryption and decryption, fragmentation and reassembly, etc. The two devices transmit messages through the internal network port, and the central processing unit (CPU) and the message processing device transmit descriptor information through the queue. In the above design scheme, when the layer 2 switching device realizes its function, it will store and manage network port messages, parse messages, forward table lookup, modify messages, etc.; when the message processing module realizes its function, it will also store and manage messages, parse messages, forward table lookup, modify messages, etc.; and the interaction between the two devices also requires complete message transfer.
[0024] In view of this, an embodiment of the present disclosure provides a message processing device. The message processing device is applied to scenarios such as Ethernet message switching and processing, and can be implemented as a switching chip, a modem chip, etc. The message processing device can be included in a network device such as a wireless terminal and a switching device. An embodiment of the present disclosure also provides a message processing method, which can be executed by hardware such as a switching chip and a modem chip, or a network device such as a wireless terminal and a switching device.
[0025] First, refer to Figure 2 , the embodiment of the present disclosure provides a message processing device, including a queue module 110 and a plurality of function modules 120, the queue module 110 includes a plurality of queues corresponding to different function modules 120, and the plurality of function modules 120 are communicatively connected with the queue module 110;
[0026] The queue module 110 is used to determine the target queue corresponding to the second functional module according to the first queue request information obtained by the first functional module processing the message to be processed; add the identification information of the message to be processed to the target queue; and dequeue the identification information from the target queue to the second functional module;
[0027] The second functional module is used to process the message to be processed.
[0028] In some embodiments, the identification information of the message may include message descriptor information and address values of the message and the message descriptor information in storage, so that the functional module can obtain the message and the message descriptor information from the storage according to the identification information of the message. The message identification information may be in the form of a pointer or an ID, which is not specifically limited in the embodiments of the present disclosure.
[0029] In the embodiment of the present disclosure, the first functional module is a functional module that performs the previous step processing on the message to be processed, and the second functional module is a functional module that performs the next step processing on the message to be processed. The embodiment of the present disclosure does not specifically limit which functional module is the first functional module or the second functional module.
[0030] The embodiments of the present disclosure do not specifically limit the functional modules. For example, the functional modules may be functional modules responsible for layer 2 switching and processing, or functional modules responsible for layer 3 switching and processing or above.
[0031] In the disclosed embodiment, the functional module responsible for Layer 2 switching and processing and the functional module responsible for Layer 3 and above switching and processing are integrated into a message switching device, and multiple functional modules can interact in message processing through queues. Each functional module can share resources when performing processing such as message storage and management, message parsing, forwarding table lookup, and message modification, thereby improving the resource utilization of the message processing device; it is beneficial to reduce the design area of the message processing device and reduce power consumption; in the process of Layer 2 switching and processing and Layer 3 and above switching and processing, there is no need to perform complete migration of messages, thereby reducing the complexity of message processing.
[0032] In the embodiment of the present disclosure, in the queue module 110, the functional modules correspond to the queues one by one, and the queue module 110 can determine the target queue by looking up a table.
[0033] In some embodiments, the queue module is used to query a queue table according to the first enqueue request information to determine the target queue.
[0034] In some embodiments, the queue table is queried according to the key value information of the message, and the queue number of the target queue can be determined. According to the queue number of the target queue, the identification information of the message can be queued into the target queue.
[0035] In some embodiments, the message processing device further includes a message storage module, and the second functional module is used to obtain the message to be processed from the message storage module according to the identification information; and process the message to be processed.
[0036] In some embodiments, the second functional module is further configured to generate second enqueue request information after the to-be-processed message is processed by the second functional module.
[0037] In some embodiments, the second functional module includes a network port module;
[0038] The second functional module is used to process the message to be processed according to the identification information to obtain a target message; and send the target message.
[0039] In some embodiments, the second functional module includes a switching module;
[0040] The second functional module is used to query a layer 2 forwarding table entry or a layer 3 forwarding table entry according to the identification information to obtain table entry information; and process the message to be processed according to the table entry information.
[0041] In some embodiments, the second functional module includes a hardware accelerator module;
[0042] The second functional module is used to perform an offload function process on the message to be processed.
[0043] In some embodiments, the first functional module is used to process the message to be processed; and generate the first enqueue request information.
[0044] In some embodiments, reference Figure 3 The functional module includes at least one of a network port module 121 , a switching module 122 , a hardware accelerator module 123 , and a processor interface module 124 .
[0045] In the embodiments of the present disclosure, there may be multiple hardware accelerator modules with different functions corresponding to different functions. In the embodiments of the present disclosure, there may be multiple network port modules, such as USB interface, PCI E interface, Ethernet interface, etc. In the embodiments of the present disclosure, the switching module may include a layer 2 switching module, a layer 3 and above switching module, etc. In the embodiments of the present disclosure, there may be multiple processor interface modules corresponding to multiple processing cores of the CPU.
[0046] In some embodiments, the identification information includes message descriptor information of the message to be processed.
[0047] In the disclosed embodiment, functional modules interact with each other through message descriptor information.
[0048] Second, refer to Figure 4 , the present disclosure provides a message processing method, including:
[0049] S1. Determine a target queue corresponding to a second functional module according to first queue entry request information obtained by processing a message to be processed by a first functional module, wherein different functional modules correspond to different queues;
[0050] S2, adding the identification information of the message to be processed to the target queue;
[0051] S3, dequeueing the identification information from the target queue to the second functional module;
[0052] S4. Process the message to be processed through the second functional module.
[0053] In the embodiment of the present disclosure, the first functional module is a functional module that performs the previous step processing on the message to be processed, and the second functional module is a functional module that performs the next step processing on the message to be processed. The embodiment of the present disclosure does not specifically limit which functional module is the first functional module or the second functional module.
[0054] The embodiments of the present disclosure do not specifically limit the functional modules. For example, the functional modules may be functional modules responsible for layer 2 switching and processing, or functional modules responsible for layer 3 switching and processing or above.
[0055] When exchanging messages, multiple functional modules may be required to process the messages to be processed, and any two functional modules interact with each other in message processing through queues based on steps S1 to S4.
[0056] In some embodiments, the message to be processed is an Ethernet message or a message that is an Ethernet message after encapsulation / decapsulation.
[0057] In the disclosed embodiments, a plurality of functional modules can interact in message processing through queues, so that the functional modules responsible for Layer 2 switching and processing and the functional modules responsible for Layer 3 and above switching and processing can be integrated into one message switching device. The various functional modules can share resources when performing processing such as message storage and management, message parsing, forwarding table lookup, and message modification, thereby improving resource utilization; when performing hardware design, it is beneficial to reduce the design area and power consumption; in the process of Layer 2 switching and processing and Layer 3 and above switching and processing, there is no need to perform a complete migration of messages, thereby reducing the complexity of message processing.
[0058] In the disclosed embodiment, a corresponding queue is set corresponding to each functional module, and a corresponding relationship between the functional module and the queue is established; the target queue can be determined by querying the corresponding relationship.
[0059] Accordingly, in some embodiments, reference Figure 5 , determining a target queue corresponding to the second functional module according to the first queue entry request information obtained by the first functional module processing the message to be processed, including:
[0060] S11. Query a queue table according to the first enqueue request information to determine the target queue.
[0061] In some embodiments, the message to be processed is stored in a shared message storage module. When the functional module processes the message to be processed, it obtains the message to be processed from the message storage module. After the processing is completed, the processed message to be processed is stored in the message storage module again.
[0062] Accordingly, in some embodiments, reference Figure 5 , processing the to-be-processed message by the second functional module, including:
[0063] S41, obtaining the message to be processed according to the identification information;
[0064] S42: Process the message to be processed.
[0065] When exchanging messages, multiple functional modules may be required to process the messages to be processed. In some embodiments, if other functional modules are required to continue processing the messages to be processed after the current second functional module processes the messages to be processed, a second queue request message is generated, so that the processed messages to be processed are queued into the queue corresponding to the subsequent functional modules, and steps S1 to S2 are executed.
[0066] Accordingly, in some embodiments, reference Figure 5 , after the to-be-processed message is processed by the second functional module, it also includes:
[0067] S43: Generate second queue entry request information.
[0068] In the embodiment of the present disclosure, different functional modules perform different processing on the messages to be processed.
[0069] In some embodiments, the second functional module includes a network port module; processing the message to be processed includes:
[0070] Processing the message to be processed according to the identification information to obtain a target message;
[0071] Send the target message.
[0072] In the embodiments of the present disclosure, the network port module may be an Ethernet interface, a Universal Serial Bus (USB) interface, a bus and interface standard (PCIE, Peripheral Component Interface Express) interface, etc., and the embodiments of the present disclosure do not make any special limitations on this.
[0073] In some embodiments, the second functional module includes a switching module; processing the message to be processed includes:
[0074] According to the identification information, query the layer 2 forwarding table entry or the layer 3 forwarding table entry to obtain the table entry information;
[0075] The to-be-processed message is processed according to the table entry information.
[0076] In some embodiments, layer 2 (L2) forwarding table entries and layer 3 (L3) forwarding table entries share storage, for example, L2 table entries and L3 table entries use the same hash table.
[0077] In some embodiments, the second functional module includes a hardware accelerator module; processing the message to be processed includes:
[0078] Performing an offloading function process on the message to be processed.
[0079] The disclosed embodiments do not specifically limit the hardware acceleration processor module. The hardware accelerator module can perform function offloading processing, thereby reducing CPU overhead. For example, the hardware accelerator module is a parsing module, which is used to parse the message and obtain the message descriptor information of the message.
[0080] In some embodiments, before determining the target queue corresponding to the second functional module according to the first enqueue request information obtained by the first functional module from processing the message to be processed, the message processing method further includes:
[0081] Processing the message to be processed by the first functional module;
[0082] Generate the first enqueue request information.
[0083] In some embodiments, the first functional module is a network port module; and processing the to-be-processed message by the first functional module includes:
[0084] Receiving an initial message through the first functional module;
[0085] In the case that the initial message is not an Ethernet message, the initial message is unpacked to obtain the message to be processed.
[0086] For example, the network port module is a USB network port module. When an initial message is received, the initial message of the corresponding protocol is unpacked to obtain an Ethernet message.
[0087] In some embodiments, the functional module includes at least one of a network port module, a switching module, a hardware accelerator module, and a processor interface module.
[0088] It should be noted that, in the embodiments of the present disclosure, there may be multiple hardware accelerator modules with different functions corresponding to different functions. In the embodiments of the present disclosure, there may be multiple network port modules, such as USB interface, PCI E interface, Ethernet interface, etc. In the embodiments of the present disclosure, the switching module may include a layer 2 switching module, a layer 3 and above switching module, etc. In the embodiments of the present disclosure, there may be multiple processor interface modules corresponding to multiple processing cores of the CPU.
[0089] In some embodiments, the identification information includes message descriptor information of the message to be processed.
[0090] In the disclosed embodiment, functional modules interact with each other through message descriptor information.
[0091] Thirdly, refer to Figure 6 , an embodiment of the present disclosure provides an electronic device, comprising:
[0092] One or more processors 201;
[0093] A memory 202, on which one or more programs are stored. When the one or more programs are executed by one or more processors, the one or more processors implement the message processing method described in the first aspect of the embodiment of the present disclosure;
[0094] One or more I / O interfaces 203 are connected between the processor and the memory and are configured to implement information exchange between the processor and the memory.
[0095] Among them, the processor 201 is a device with data processing capabilities, including but not limited to a central processing unit (CPU) and the like; the memory 202 is a device with data storage capabilities, including but not limited to random access memory (RAM, more specifically SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory (FLASH); the I / O interface (read-write interface) 203 is connected between the processor 201 and the memory 202, and can realize information interaction between the processor 201 and the memory 202, including but not limited to a data bus (Bus) and the like.
[0096] In some embodiments, the processor 201 , the memory 202 , and the I / O interface 203 are connected to each other via a bus 204 , and further connected to other components of the computing device.
[0097] Fourthly, refer to Figure 7 An embodiment of the present disclosure provides a network device, including the message processing device described in the first aspect of the embodiment of the present disclosure.
[0098] In a fifth aspect, an embodiment of the present disclosure provides a computer-readable medium having a computer program stored thereon, and when the program is executed by a processor, the message processing method described in the first aspect of the embodiment of the present disclosure is implemented.
[0099] In order to enable those skilled in the art to more clearly understand the technical solutions provided by the embodiments of the present disclosure, the technical solutions provided by the embodiments of the present disclosure are described in detail below through specific embodiments:
[0100] Embodiment 1
[0101] The message processing device in this embodiment is as follows Figure 3 As shown, the message processing device includes a queue module 110 , a network port module 121 , a switching module 122 , a hardware accelerator module 123 , and a processor interface module 124 .
[0102] The queue module 110 supports the management of hardware queues and software queues, and is responsible for the scheduling of data packet processing of the hardware accelerator module and the CPU; the hardware accelerator module, the CPU and the queue module interact through message descriptor information.
[0103] The network port module can correspond to a variety of different network ports, such as Ethernet interface, USB interface, PCI E interface, etc. Different network ports require corresponding message processing modules. After processing, the Ethernet message is obtained and then queued to the parsing module for subsequent exchange and message processing.
[0104] The hardware accelerator module is a functional module that performs hardware unloading. Different projects require different hardware unloading functions. Different hardware accelerator modules can interact through the queues in the queue module. After each hardware accelerator module completes its message processing function, it will initiate a queue request. The queue module will make a judgment based on the queue request and queue the message identification information into the corresponding queue.
[0105] The switching module can perform layer 2 and layer 3 switching and related processing. According to different message descriptor information, different key values can be used for switching table lookup, and different switching processing can be performed according to the table lookup results.
[0106] The processor interface module supports multiple CPU cores. The hardware accelerator module interacts with the CPU through the queue corresponding to the CPU in the queue module. The CPU queue is uniformly allocated by the software, and the CPU can be directly queued into a software queue or hardware queue.
[0107] Embodiment 2
[0108] This embodiment is based on the message processing device of the first embodiment.
[0109] When using a message processing device, it is necessary to initialize the switching strategy and message processing function of the message switching device, including:
[0110] (1) Initialize the configuration of each functional module
[0111] (2) Initialize the forwarding table. The Layer 2 forwarding table and Layer 3 forwarding table entries use the same hash table. Different table entries are configured according to different service flows. The table entries can statically configure the queue-related information and message processing information that need to be exchanged.
[0112] (3) Initialize the queue decision table entries according to the business flow, that is, the correspondence between the queue and the functional module;
[0113] After initialization, the message can be sent and received. Using the queue to determine the next processing module can achieve a flexible message exchange processing flow. The hardware accelerator module can also be flexibly allocated to different business flows. Different business flows can use or share the hardware accelerator module.
[0114] The message exchange and processing process in this embodiment is as follows: Figure 8 As shown, based on Figure 8 The process shown in the figure can realize a variety of different message processing and switching strategies. Figure 8 Examples of several message exchanges and processing.
[0115] Embodiment 3
[0116] This embodiment takes the message exchange between L2 network ports, for example, the message exchange from a USB interface port to an Ethernet interface as an example.
[0117] (1) The network port receives the message. If the network port is a USB, the hardware accelerator module needs to support the message depacketization function. When the network port receives the message, the message in the corresponding protocol format is depacketized to obtain the Ethernet message. Then, a queue entry request is initiated to the queue module.
[0118] (2) The queue module looks up the table according to the queue entry request information and determines that the target queue to be entered is the queue corresponding to the parsing module;
[0119] (3) The queue corresponding to the parsing module is dequeued, the message is obtained according to the message descriptor information, and the message is parsed. After parsing, an entry request is initiated;
[0120] (4) The queue module looks up the table according to the queue entry request information and determines that the queue to be entered is the queue corresponding to the switching module;
[0121] (5) The queue corresponding to the switching module is dequeued, and the L2 information needs to be used to look up the hash table according to the message descriptor information. If there is no other business, all forwarding table items can be configured as L2 forwarding table items. After the table lookup is successful, the L2 forwarding table item information is obtained, and then corresponding processing is performed according to the L2 forwarding table item information, such as L2 message header modification, etc., and an enqueue request is initiated according to the message descriptor information and the L2 forwarding table item information.
[0122] (6) The queue module performs a table lookup based on the queue entry request information and determines that the queue to be entered is the queue corresponding to the Ethernet interface module;
[0123] (7) The Ethernet interface module obtains the message according to the message descriptor information and performs corresponding processing on the message, and then sends the message from the network port.
[0124] Embodiment 4
[0125] This embodiment takes the message exchange from the network port to the CPU, for example, the message exchange from the USB interface to the CPU as an example.
[0126] (1) The network port receives the message. If the network port is a USB, the hardware accelerator needs to support the message depacketization function. When the network port receives the message, it will depacketize the message in the corresponding protocol format and obtain the Ethernet message after depacketization; then initiate a queue entry request to the queue module;
[0127] (2) The queue module looks up the table according to the queue entry request information and determines that the queue to be entered is the queue corresponding to the parsing module;
[0128] (3) The queue corresponding to the parsing module is dequeued, and the message is obtained according to the message descriptor information to parse the network port message, and after parsing, an entry request is initiated;
[0129] (4) The queue module looks up the table according to the queue entry request information and determines that the queue to be entered is the queue corresponding to the switching module;
[0130] (5) The queue corresponding to the switching module is dequeued, and the L2 information is judged to be needed to look up the hash table (L2 forwarding table items and L3 forwarding table items are stored in a shared manner) according to the message descriptor information; after the table lookup is successful, the L2 forwarding table item information is obtained, and then corresponding processing is performed according to the L2 forwarding table item information, and an enqueue request is initiated according to the message descriptor information and the L2 forwarding table item information;
[0131] (6) The queue module looks up the table according to the queue entry request information and determines that the queue to be entered is the queue corresponding to the switching module;
[0132] (7) The queue corresponding to the switching module is dequeued, and the L3 information is used to check the hash table (L2 forwarding table and L3 forwarding table share storage) according to the message descriptor information; after the table check is successful, the L3 forwarding table information is obtained, and corresponding processing is performed according to the L3 forwarding table information, such as NAT modification of the message; an enqueue request is initiated according to the message descriptor information and the L3 forwarding table information
[0133] (8) The queue module performs a table lookup based on the queue entry request information and determines that the queue to be entered is the queue corresponding to the hardware accelerator module required by the CPU;
[0134] (9) The queue corresponding to the hardware accelerator module is dequeued, and the corresponding CPU function processing that needs to be offloaded by hardware is performed to reduce CPU overhead; after the offload function processing is completed, an entry request is initiated
[0135] (10) The queue module performs a table lookup based on the queue entry request information and determines that the queue to be entered is the CPU queue;
[0136] (11) The message is dequeued from the CPU queue and the subsequent business processing of the message is carried out. In the subsequent business processing, the message can also be directly queued to the queue corresponding to the hardware accelerator module to unload some functions. After the hardware processing, the message is queued again in the CPU queue and returned to the CPU.
[0137] Embodiment 5
[0138] This embodiment takes the message exchange from the CPU to the network port as an example, for example, the message exchange from the CPU to the Ethernet port.
[0139] (1) After the message data of the previous level is processed by the CPU, it needs to be exchanged out from the network port. The CPU directly enters the queue corresponding to the parsing module;
[0140] (2) The queue corresponding to the parsing module is dequeued, and the message is obtained according to the message descriptor information for CPU message parsing. After parsing, an entry request is initiated;
[0141] (3) The queue module looks up the table according to the queue entry request information and determines that the queue to be entered is the queue corresponding to the switching module;
[0142] (4) The queue corresponding to the switching module is dequeued, and the L2 information is used to check the hash table according to the message descriptor information; after the table check is successful, the L2 forwarding table information is obtained, and corresponding processing is performed according to the L2 forwarding table information; an enqueue request is initiated according to the message descriptor information and the L2 forwarding table information;
[0143] (5) The queue module looks up the table according to the queue entry request information and determines that the queue to be entered is the queue corresponding to the switching module;
[0144] (6) The queue corresponding to the switching module is dequeued, and the L3 information is used to check the hash table according to the message descriptor information; after the table check is successful, the L3 forwarding table information is obtained, and corresponding processing is performed according to the information of the L3 forwarding table item, such as NAT modification of the message; and an enqueue request is initiated according to the message descriptor information and the L3 forwarding table item information;
[0145] (7) The queue module performs a table lookup based on the queue entry request information and determines that the queue to be entered is the queue corresponding to the Ethernet interface module;
[0146] (8) The Ethernet interface module obtains the message according to the message descriptor information and performs corresponding processing on the message, and then sends the message from the network port.
[0147] In the embodiments of the present disclosure, the business scenarios described in Embodiments 3, 4, and 5 and other business scenarios may exist at the same time, and different business flows may share message parsing processing, message storage space and management, table lookups for forwarding at different network levels, message modification control processing, and other hardware acceleration processing; when a business flow uses only one scenario, the configuration may be changed so that the business flow exclusively uses the processing resources of the hardware accelerator module, thereby allowing a single business to support larger indicators.
[0148] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those skilled in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0149] Example embodiments have been disclosed herein, and although specific terms are employed, they are used and should be interpreted only in a general illustrative sense and not for limiting purposes. In some instances, it will be apparent to those skilled in the art that, unless otherwise expressly noted, features, characteristics, and / or elements described in conjunction with a particular embodiment may be used alone or in combination with features, characteristics, and / or elements described in conjunction with other embodiments. Therefore, those skilled in the art will appreciate that various changes in form and detail may be made without departing from the scope of the present disclosure as set forth in the appended claims.
Claims
1. A message processing device, comprising a queue module and a plurality of function modules, wherein the queue module comprises a plurality of queues corresponding to different function modules, and the plurality of function modules are communicatively connected with the queue module; The queue module is used to determine the target queue corresponding to the second functional module according to the first queue request information obtained by the first functional module processing the message to be processed; and add the identification information of the message to be processed to the target queue; Dequeue the identification information from the target queue to the second functional module; The second functional module is used to process the message to be processed.
2. The message processing device according to claim 1, wherein: The queue module is used to query the queue table according to the first enqueue request information to determine the target queue.
3. The message processing device according to claim 1, wherein: The message processing device also includes a message storage module; The second functional module is used to obtain the message to be processed from the message storage module according to the identification information; Process the message to be processed.
4. The message processing device according to claim 3, wherein: The second functional module is further configured to generate second enqueue request information after the to-be-processed message is processed by the second functional module.
5. The message processing device according to claim 3, wherein: The second functional module includes a network port module; The second functional module is used to process the message to be processed according to the identification information to obtain a target message; and send the target message.
6. The message processing device according to claim 3, wherein: The second functional module includes a switching module; The second functional module is used to query a layer 2 forwarding table entry or a layer 3 forwarding table entry according to the identification information to obtain table entry information; and process the message to be processed according to the table entry information.
7. The message processing device according to claim 3, wherein: The second functional module includes a hardware accelerator module; The second functional module is used to perform an offload function process on the message to be processed.
8. The message processing device according to any one of claims 1 to 7, wherein: The first functional module is used to process the message to be processed; and generate the first enqueue request information.
9. The message processing device according to any one of claims 1 to 7, wherein: The functional module includes at least one of a network port module, a switching module, a hardware accelerator module, and a processor interface module.
10. The message processing device according to any one of claims 1 to 7, wherein: The identification information includes the message descriptor information of the message to be processed.
11. A message processing method, comprising: Determine a target queue corresponding to the second functional module according to first queue entry request information obtained by the first functional module through processing the message to be processed, wherein different functional modules correspond to different queues; Adding the identification information of the message to be processed to the target queue; Dequeue the identification information from the target queue to the second functional module; The message to be processed is processed by the second functional module.
12. The message processing method according to claim 11, wherein: Determining a target queue corresponding to the second functional module according to first queue entry request information obtained by the first functional module processing the message to be processed, including: The queue table is queried according to the first enqueue request information to determine the target queue.
13. The message processing method according to claim 11, wherein: Processing the message to be processed by the second functional module includes: Acquire the message to be processed according to the identification information; Process the message to be processed.
14. The message processing method according to claim 13, wherein: After the to-be-processed message is processed by the second functional module, the method further includes: Generates second enqueue request information.
15. The message processing method according to claim 13, wherein: The second functional module includes a network port module; Processing the message to be processed includes: Processing the message to be processed according to the identification information to obtain a target message; Send the target message.
16. The message processing method according to claim 13, wherein: The second functional module includes a switching module; Processing the message to be processed includes: According to the identification information, query the layer 2 forwarding table entry or the layer 3 forwarding table entry to obtain the table entry information; The to-be-processed message is processed according to the table entry information.
17. The message processing method according to claim 13, wherein: The second functional module includes a hardware accelerator module; Processing the message to be processed includes: Performing an offloading function process on the message to be processed.
18. The message processing method according to any one of claims 11 to 17, wherein: Before determining the target queue corresponding to the second functional module according to the first queue entry request information obtained by the first functional module from processing the message to be processed, the message processing method further includes: Processing the message to be processed by the first functional module; Generate the first enqueue request information.
19. The message processing method according to claim 18, wherein: The first functional module is a network port module; Processing the message to be processed by the first functional module includes: Receiving an initial message through the first functional module; In the case that the initial message is not an Ethernet message, the initial message is unpacked to obtain the message to be processed.
20. The message processing method according to any one of claims 11 to 17, wherein: The functional module includes at least one of a network port module, a switching module, a hardware accelerator module, and a processor interface module.
21. The message processing method according to any one of claims 11 to 17, wherein: The identification information includes the message descriptor information of the message to be processed.
22. An electronic device, comprising: one or more processors; A memory having one or more programs stored thereon, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the message processing method according to any one of claims 11 to 21.
23. A network device, comprising the message processing apparatus according to any one of claims 1 to 10.