A communication message transmission method, message processing hardware and storage medium

By introducing message processing hardware and message forwarding engines into the message server, multi-module asynchronous message communication with software and hardware is realized, which solves the problem of low usage and communication performance of the message server processor and improves the overall performance of the system.

CN114500417BActive Publication Date: 2025-01-14SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111676393.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-31
Publication Date
2025-01-14
Estimated Expiration
2041-12-31

AI Technical Summary

Technical Problem

In the prior art, the processor usage rate and message communication performance of the message server are low, mainly because the message communication protocol is completely implemented by software, resulting in high processor resource utilization, which limits system performance.

Method used

Adopt a multi-module asynchronous message communication scheme with software and hardware collaboration. By introducing message processing hardware into the message server, using the message forwarding engine to read the target message from the module message publishing queue and transmit it to the corresponding module message subscription queue, combined with interruption Signal and DMA operations improve message transmission efficiency.

Benefits of technology

It significantly improves the processor usage and message communication performance of the message server, reduces processor occupation, improves the overall performance of the system, and avoids the need to develop a separate communication protocol for the hardware module.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114500417B_ABST
    Figure CN114500417B_ABST
Patent Text Reader

Abstract

The present application discloses a communication message transmission method, which is applied to a message server, wherein the message server includes message processing software and message processing hardware, wherein the message processing hardware includes multiple address registers and multiple message forwarding engines, and the method includes: using the message processing software to initialize a data structure in a memory; using the message processing software to configure the address of the data structure to the corresponding address register in the message processing hardware; using the message forwarding engine to read a target message from a module message publishing queue, and transmitting the target message to a corresponding module message subscription queue. The present application can improve the processor utilization rate and message communication performance of a message server. The present application also discloses a message forwarding engine and a storage medium, which have the above beneficial effects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] With the aging of the population, low enterprise production efficiency, and rising labor costs, as well as the development of information technologies such as big data, cloud computing, and artificial intelligence, various information systems used for enterprise production automation or to improve life convenience are showing an explosive growth trend. Information systems are becoming more and more complex, with more and more functional modules, and the interaction and collaboration between modules is becoming more and more frequent, making the ability of module interaction and collaboration a key factor in improving system performance.

[0003] In the related technology, the system module interaction scheme is: build a message service cluster, run a specific message communication protocol (such as publish-subscribe protocol, etc.) middleware on the message server, and each module of the system sets the subscribed message type in the initialization phase. When a module needs to send a message during the system operation phase, it first sends the message to the message server, and then the message server forwards the message to all target modules that have subscribed to the message. The target module receives the message and executes the corresponding processing flow. However, the message communication protocol in the above process is all implemented by software, resulting in low processor utilization and message communication performance.

[0004] Therefore, how to improve the processor utilization rate and message communication performance of the message server is a technical problem that those skilled in the art currently need to solve. Summary of the invention

[0005] The purpose of this application is to provide a communication message transmission method, message processing hardware and storage medium, which can improve the processor utilization rate and message communication performance of the message server.

[0006] In order to solve the above technical problems, the present application provides a communication message transmission method, which is applied to a message server, wherein the message server includes message processing software and message processing hardware, wherein the message processing hardware includes multiple address registers and multiple message forwarding engines, and the method includes:

[0007] Initializing a data structure in a memory using the message processing software; wherein the data structure includes a publisher descriptor table, a message descriptor table and a module descriptor table, the publisher descriptor table is used to describe a publisher module set, the message descriptor table includes a plurality of subscriber descriptor tables, each of the subscriber descriptor tables is used to describe a subscriber module set of a corresponding message, and the module descriptor table is used to describe addresses of a message publishing queue descriptor table and a message subscription queue descriptor table;

[0008] The address of the data structure is configured into a corresponding address register in the message processing hardware using the message processing software; wherein the address register includes a publisher descriptor table address register, a subscriber descriptor table address register and a module descriptor table address register;

[0009] The message forwarding engine is used to read the target message from the module message publishing queue and transmit the target message to the corresponding module message subscription queue.

[0010] Optionally, after using the message forwarding engine to read the target message from the module message publishing queue and transmitting the target message to the corresponding module message subscription queue, the method further includes:

[0011] The message forwarding engine notifies the message processing software of message forwarding completion through an interrupt signal;

[0012] The message processing software notifies other service processes of message forwarding completion in the form of processor core-to-core interruption.

[0013] Optionally, the using the message forwarding engine to read the target message from the module message publishing queue and transmitting the target message to the corresponding module message subscription queue includes:

[0014] polling a plurality of the publisher descriptor tables using a plurality of the message forwarding engines to determine a publisher module identifier;

[0015] Determine the corresponding module message publishing queue descriptor table address in the module descriptor table based on the publisher module identifier, determine the message publishing queue address from the corresponding module message publishing queue descriptor table based on the module message publishing queue descriptor table address, and read the target message from the message publishing queue corresponding to the message publishing queue address;

[0016] Determine a subscriber descriptor table corresponding to the target message based on the message identifier of the target message, and determine a subscriber module identifier in the subscriber descriptor table;

[0017] Based on the subscriber module identifier, the corresponding module message subscription queue descriptor table address is determined in the module descriptor table; based on the module message subscription queue descriptor table address, the message subscription queue address is determined from the corresponding module message subscription queue descriptor table; and the target message is transmitted to the message subscription queue corresponding to the message subscription queue address.

[0018] Optionally, reading the target message from the message publishing queue corresponding to the message publishing queue address includes:

[0019] Obtain the message identifier and message source address of the target message from the message publishing queue corresponding to the message publishing queue address, and read the target message from the message source address;

[0020] Correspondingly, transmitting the target message to the message subscription queue corresponding to the message subscription queue address includes:

[0021] The write pointer of the message subscription queue corresponding to the message subscription queue address is determined as the message target address, and a DMA operation is performed from the message source address to the message target address.

[0022] Optionally, before determining the corresponding module message publishing queue descriptor table address in the module descriptor table based on the publisher module identifier, the method further includes:

[0023] Querying whether there is a first cache item corresponding to the publisher module identifier in the message publishing queue cache;

[0024] If it exists, obtaining the message publishing queue address and the message identifier of the target message from the first cache item, and determining the read pointer of the message publishing queue corresponding to the message publishing queue address as the message source address;

[0025] If not, the step of determining the corresponding module message publishing queue descriptor table address in the module descriptor table based on the publisher module identifier is entered.

[0026] Optionally, before determining the subscriber descriptor table corresponding to the target message based on the message identifier of the target message and determining the subscriber module identifier in the subscriber descriptor table, the method further includes:

[0027] Querying whether there is a second cache item corresponding to the message identifier of the target message in the message subscription queue cache;

[0028] If it exists, obtaining the message subscription queue address from the second cache item, and determining the write pointer of the message subscription queue corresponding to the message subscription queue address as the message target address;

[0029] If not, the process proceeds to the step of determining the subscriber descriptor table corresponding to the target message based on the message identifier of the target message, and determining the subscriber module identifier in the subscriber descriptor table.

[0030] Optionally, before determining the write pointer of the message subscription queue corresponding to the message subscription queue address as the message target address, the method further includes:

[0031] Obtaining a message identifier to be verified from a message subscription queue corresponding to the message subscription queue address, and determining whether the message identifier to be verified is consistent with the message identifier of the target message;

[0032] If so, the process proceeds to the step of determining the write pointer of the message subscription queue corresponding to the message subscription queue address as the message target address.

[0033] Optionally, also include:

[0034] When the message processing software modifies the data structure, the message publishing queue cache and the message subscription queue cache are controlled to be invalid.

[0035] The present application also provides a message processing hardware, the message processing hardware comprising a plurality of address registers and a plurality of message forwarding engines;

[0036] The address register is used to store the address of the data structure configured by the message processing software; wherein the address register includes a publisher descriptor table address register, a subscriber descriptor table address register and a module descriptor table address register;

[0037] The message forwarding engine is used to read the target message from the module message publishing queue and transmit the target message to the corresponding module message subscription queue;

[0038] Among them, the message processing hardware is the hardware in the message server, the message processing software is the software in the message server, and the message processing software is used to initialize the data structure in the memory; the data structure includes a publisher descriptor table, a message descriptor table and a module descriptor table, the publisher descriptor table is used to describe a publisher module set, the message descriptor table includes multiple subscriber descriptor tables, each of the subscriber descriptor tables is used to describe a corresponding message subscriber module set, and the module descriptor table is used to describe the address of the message publishing queue descriptor table and the message subscription queue descriptor table.

[0039] The present application also provides a storage medium, in which computer executable instructions are stored. When the computer executable instructions are loaded and executed by a processor, at least the following are achieved: initializing a data structure in a memory; wherein the data structure includes a publisher descriptor table, a message descriptor table, and a module descriptor table, wherein the publisher descriptor table is used to describe a publisher module set, wherein the message descriptor table includes multiple subscriber descriptor tables, each of which is used to describe a subscriber module set of a corresponding message, and wherein the module descriptor table is used to describe the address of a message publishing queue descriptor table and a message subscription queue descriptor table; configuring the address of the data structure to a corresponding address register in the message processing hardware; wherein the address register includes a publisher descriptor table address register, a subscriber descriptor table address register, and a module descriptor table address register.

[0040] The present application provides a communication message transmission method, which is applied to a message server, wherein the message server includes message processing software and message processing hardware, wherein the message processing hardware includes multiple address registers and multiple message forwarding engines, and the method includes: using the message processing software to initialize a data structure in a memory; wherein the data structure includes a publisher descriptor table, a message descriptor table and a module descriptor table, wherein the publisher descriptor table is used to describe a publisher module set, wherein the message descriptor table includes multiple subscriber descriptor tables, wherein each subscriber descriptor table is used to describe a corresponding message subscriber module set, and wherein the module descriptor table is used to describe the address of a message publishing queue descriptor table and a message subscription queue descriptor table; using the message processing software to configure the address of the data structure to the corresponding address register in the message processing hardware; wherein the address register includes a publisher descriptor table address register, a subscriber descriptor table address register and a module descriptor table address register; using the message forwarding engine to read a target message from a module message publishing queue, and transmit the target message to a corresponding module message subscription queue.

[0041] The message server provided by the present application includes message processing software and message processing hardware. The message processing software is used to initialize the data structure in the memory and configure the address of the data structure to the corresponding address register in the message processing hardware. The message processing hardware uses a message forwarding engine to read the target message from the module message publishing queue and transmit the target message to the corresponding module message subscription queue to complete the message publishing and subscription process. The communication message transmission process of this embodiment is based on the collaborative processing of the message processing software and the message processing hardware. The message processing software only participates in the operation of initializing the data structure in the memory and configuring the address of the data structure for the address register. The specific message transmission process is performed by the message processing hardware. Therefore, the present application can improve the processor utilization rate and message communication performance of the message server. The present application also provides a message processing hardware and a storage medium, which have the above-mentioned beneficial effects and are not repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0043] Figure 1 A flow chart of a communication message transmission method provided in an embodiment of the present application;

[0044] Figure 2 A flowchart of software and hardware interaction provided in an embodiment of the present application;

[0045] Figure 3 A schematic diagram of the implementation principle of the software and hardware modules of a message communication protocol provided in an embodiment of the present application;

[0046] Figure 4 A workflow diagram of a hardware message forwarding engine provided in an embodiment of the present application. DETAILED DESCRIPTION

[0047] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0048] See below Figure 1 , Figure 1 A flowchart of a communication message transmission method provided in an embodiment of the present application.

[0049] Specific steps may include:

[0050] S101: Initializing a data structure in a memory using the message processing software;

[0051] This embodiment may be applied to a message server, wherein the message server includes message processing software and message processing hardware, and the message processing hardware includes multiple address registers and multiple message forwarding engines.

[0052] The above data structure includes a publisher descriptor table, a message descriptor table and a module descriptor table. The publisher descriptor table is used to describe a publisher module set. The message descriptor table includes multiple subscriber descriptor tables. Each subscriber descriptor table is used to describe a corresponding message subscriber module set. The module descriptor table is used to describe the address of the message publishing queue descriptor table and the message subscription queue descriptor table. The descriptor table is a linear storage data structure similar to an array, which is used to continuously store multiple configuration items of the same type. A configuration item can be quickly located through the configuration item index. The data query efficiency is high when the index value is clear. Messages are a method for modules to communicate with each other. The sender sends a message to the receiver, and the receiver receives the message and performs special processing. Similar to the interrupt service program, the message mechanism is used in virtualization technology to simulate virtual machine interrupts.

[0053] S102: using the message processing software to configure the address of the data structure into a corresponding address register in the message processing hardware;

[0054] The address register of the message processing hardware may include a publisher descriptor table address register, a subscriber descriptor table address register and a module descriptor table address register. The publisher descriptor table address register is used to store the address of the publisher descriptor table; the subscriber descriptor table address register is used to store the address of the subscriber descriptor table; and the module descriptor table address register is used to store the address of the module descriptor table.

[0055] As a feasible implementation, when the message processing software modifies the data structure, the implementation can also control the message publishing queue cache and the message subscription queue cache to be invalid, so that the cache and memory data are consistent. A queue is a data storage structure with read-write separation, which works on the producer-consumer principle. The writer continuously writes data to the queue as a producer, and the reader continuously reads data from the queue as a consumer, and reading and writing can be performed simultaneously.

[0056] S103: Utilize the message forwarding engine to read the target message from the module message publishing queue, and transmit the target message to the corresponding module message subscription queue.

[0057] Specifically, this embodiment can utilize multiple message forwarding engines to poll multiple publisher descriptor tables to determine the publisher module identifier; determine the corresponding module message publishing queue descriptor table address in the module descriptor table based on the publisher module identifier, determine the message publishing queue address from the corresponding module message publishing queue descriptor table based on the module message publishing queue descriptor table address, and read the target message from the message publishing queue corresponding to the message publishing queue address; determine the subscriber descriptor table corresponding to the target message based on the message identifier of the target message, and determine the subscriber module identifier in the subscriber descriptor table; determine the corresponding module message subscription queue descriptor table address in the module descriptor table based on the subscriber module identifier, determine the message subscription queue address from the corresponding module message subscription queue descriptor table based on the module message subscription queue descriptor table address, and transmit the target message to the message subscription queue corresponding to the message subscription queue address.

[0058] As a feasible implementation method, after reading and transmitting the target message, the message forwarding engine can also notify the message processing software of the message forwarding completion through an interrupt signal; the message processing software notifies other business processes of the message forwarding completion through an inter-processor core interrupt.

[0059] The message server provided in this embodiment includes message processing software and message processing hardware. The message processing software is used to initialize the data structure in the memory and configure the address of the data structure to the corresponding address register in the message processing hardware. The message processing hardware uses the message forwarding engine to read the target message from the module message publishing queue and transmit the target message to the corresponding module message subscription queue to complete the message publishing and subscription process. The communication message transmission process of this embodiment is based on the collaborative processing of the message processing software and the message processing hardware. The message processing software only participates in the operation of initializing the data structure in the memory and configuring the address of the data structure for the address register. The specific message transmission process is performed by the message processing hardware. Therefore, this embodiment can improve the processor utilization rate and message communication performance of the message server.

[0060] As for Figure 1Further introduction to the corresponding embodiment, S103 can read the target message from the message publishing queue corresponding to the message publishing queue address in the following manner: obtain the message identifier and message source address of the target message from the message publishing queue corresponding to the message publishing queue address, and read the target message from the message source address. Correspondingly, S103 can transfer the target message to the message subscription queue corresponding to the message subscription queue address in the following manner: determine the write pointer of the message subscription queue corresponding to the message subscription queue address as the message target address, and perform a DMA operation from the message source address to the message target address.

[0061] Furthermore, before determining the corresponding module message publishing queue descriptor table address in the module descriptor table based on the publisher module identifier, it is also possible to query whether there is a first cache item corresponding to the publisher module identifier in the message publishing queue cache; if so, obtain the message publishing queue address and the message identifier of the target message from the first cache item, and determine the read pointer of the message publishing queue corresponding to the message publishing queue address as the message source address; if not, enter the step of determining the corresponding module message publishing queue descriptor table address in the module descriptor table based on the publisher module identifier.

[0062] Furthermore, before determining the subscriber descriptor table corresponding to the target message based on the message identifier of the target message and determining the subscriber module identifier in the subscriber descriptor table, it is also possible to query whether there is a second cache item corresponding to the message identifier of the target message in the message subscription queue cache; if so, obtain the message subscription queue address from the second cache item, and determine the write pointer of the message subscription queue corresponding to the message subscription queue address as the message target address; if not, enter the step of determining the subscriber descriptor table corresponding to the target message based on the message identifier of the target message, and determining the subscriber module identifier in the subscriber descriptor table.

[0063] Furthermore, before determining the write pointer of the message subscription queue corresponding to the message subscription queue address as the message target address, the message identifier to be verified can be obtained from the message subscription queue corresponding to the message subscription queue address to determine whether the message identifier to be verified is consistent with the message identifier of the target message; if so, enter the step of determining the write pointer of the message subscription queue corresponding to the message subscription queue address as the message target address.

[0064] The process described in the above embodiment is explained below through an embodiment in actual application.

[0065] In the related art, the message server completely uses software to complete the message publishing and subscription between modules. However, this message communication interaction has the following problems: (1) Since the message communication protocol is entirely implemented by software, when the message communication interaction between modules is too frequent, it will occupy a large amount of processor resources of the message server, resulting in a high processor utilization rate. (2) The increase in processor utilization rate further limits the data transmission performance of the message communication middleware, and may cause other modules that require processor resources, such as network communication or memory read and write performance to decline. (3) The message communication protocol can only be used for software module communication. When the system contains more hardware modules, it is necessary to develop another set of hardware communication protocols for hardware module communication, such as request response queue mechanism.

[0066] In order to solve the defects existing in the above-mentioned related technologies, the embodiment of the present application provides a multi-module asynchronous message communication solution with software and hardware collaboration. Software and hardware collaboration is a system design method that comprehensively considers the functional characteristics of software and hardware. By reasonably dividing the software and hardware functional modules, the system modules that are basically irrelevant to the business or have fixed execution processes are handed over to hardware implementation, and the system modules with large differences in execution processes under different user demand scenarios are handed over to software implementation, so as to fully utilize the parallel execution characteristics of hardware digital logic circuits and the flexibility of software codes, and improve system performance and flexibility by combining the advantages of software and hardware.

[0067] See also Figure 2 , Figure 2 A flowchart of software and hardware interaction provided in an embodiment of the present application is shown in FIG. Figure 2 As shown, the present application divides the message communication protocol into two parts, software and hardware, for joint implementation. The function of the software (i.e., message processing software) part is to set each software and hardware module as a message publisher or subscriber respectively by initializing memory data structures such as a message publisher descriptor table (also known as a publisher descriptor table), a message subscriber descriptor table (also known as a subscriber descriptor table), etc., and configure the descriptor table address to the hardware address register. The message publisher descriptor table includes a software and hardware module message queue, and the message subscriber descriptor table includes a software and hardware module message queue. The function of the hardware (i.e., message processing hardware) part is to execute the message publish-subscribe protocol, poll the message published by the publisher in its message queue according to the memory descriptor table configuration, and forward the message to all target software and hardware module message queues that have subscribed to the message. The hardware part also includes a publisher descriptor table address register and a subscriber descriptor table address register.

[0068] See also Figure 3 , Figure 3A schematic diagram of the implementation principle of the software and hardware modules of a message communication protocol provided in an embodiment of the present application, wherein the software includes a management process and a software publishing and subscriber set, the software publishing and subscriber set includes business processes 1 to n, the memory includes a module descriptor table, a publisher descriptor table, and a message descriptor table, the module descriptor table includes a message publishing queue descriptor table and a message subscription queue descriptor table, and the message descriptor table includes a subscriber descriptor table. The hardware includes a message forwarding engine, a hardware publishing and subscriber set, the hardware publishing and subscriber set includes business engines 1 to n, and the hardware also includes an interrupt flag, a status flag, a publisher descriptor table address register, a module descriptor table address register, and a message descriptor table address register. Figure 3 The execution process of each module is as follows:

[0069] Step A1): The software management process initializes the memory message forwarding data structure and configures the addresses of each data structure into the hardware register, including the following data structures: ① a publisher descriptor table representing a message publisher module set; ② a message descriptor table representing a subscriber module set (subscriber descriptor table) for each message; ③ a module descriptor table representing other module information such as a module message publishing queue (for module publishing messages) descriptor table and a module message subscription queue (for module receiving messages) descriptor table.

[0070] Step A2): The software service process or hardware service engine writes the message to be published by this module into the module message publishing queue pointed to by the module descriptor table entry, that is, Figure 3 Step A2)a and step A2)b in.

[0071] Step A3): The message forwarding engine performs the following descriptor table positioning process: multiple hardware message forwarding engines poll multiple publisher descriptor tables according to a certain load balancing algorithm (such as a consistent hashing algorithm), that is, each message forwarding engine polls and forwards a group of messages published by publishers, thereby realizing parallel polling and forwarding of messages to be published by multiple groups of publishers; locate the module descriptor table item according to the publisher module identifier to find the message publishing queue descriptor table, and then take out the message data from the module message publishing queue; locate the message descriptor table item according to the message identifier to find the subscriber descriptor table; locate the module descriptor table item according to the subscriber module identifier to find the message subscription queue descriptor table, and then transfer the message data to the message subscriber's message subscription queue, that is Figure 3 Step A3)a, step A3)b, step A3)c, step A3)d in.

[0072] Step A4): The hardware notifies the software management process or other service engines through an interrupt signal that the message has been forwarded, and provides the status of this message transmission through the interrupt and status flag register;

[0073] Step A5): the software management process notifies other service processes that the message has been forwarded by interrupting the processor cores;

[0074] Step A6): The software and hardware module as the subscriber locates the module descriptor table entry according to the module identifier to find the message subscription queue descriptor table, and then takes out the forwarded message from the message subscription queue. Figure 3 Step A6)a and step A6)b in .

[0075] See also Figure 4 , Figure 4 A flowchart of a hardware message forwarding engine provided in an embodiment of the present application is shown in FIG. Figure 4 As shown, the message forwarding engine continuously polls all publishers to see if they have any message data to be published. Each time a message to be published is polled, the message data is forwarded to all target modules that have subscribed to the message. The entire forwarding process includes two parts: the message publishing process and the message subscription process.

[0076] The execution flow of the message publishing process is as follows:

[0077] Step B1): The "publisher descriptor table query" module searches for a valid publisher module identifier through the publisher descriptor table.

[0078] Step B 2): The "message publishing queue cache query" module queries whether there is a cache item consistent with the publisher module identifier in the message publishing queue cache. If the cache item exists, the module message queue address is obtained from the cache item and the read pointer of the message queue is used as the message source address, and then the message subscription process is executed, otherwise step B3 is executed.

[0079] Step B 3): Execute the following multi-level descriptor table search process related to the message publishing process, and save the search results to the message publishing queue cache through the "message publishing queue cache generation" module at each stage of the search: Step B 3)a: The "module message publishing descriptor table address query" module locates the module descriptor table item through the publisher module identifier and extracts the module message publishing queue descriptor table address therefrom; Step B 3)b): The "module message publishing queue descriptor table query" and "module message publishing queue query" modules obtain the module all message publishing queue addresses from the module message publishing queue descriptor table and obtain the to-be-published message identifier and message source address from the queue, and execute the message subscription process once each message data is obtained.

[0080] The execution flow of the message subscription process is as follows:

[0081] Step B4): The "message subscription queue cache query" module queries whether there is a cache item in the message subscription queue cache that is consistent with the identifier of the message to be published. If the cache item exists, the module message subscription queue address is obtained from the cache item and the write pointer of the queue is used as the message target address. Then, after performing a DMA operation from the message source address to the message target address, the message subscription process is completed. Otherwise, step B5 is executed;

[0082] Step B 5): Execute the following multi-level descriptor table search process related to the message subscription process, and save the search results to the message subscription queue cache through the "message subscription queue cache generation" module at each stage of the search. Step B 5)a: The "message descriptor table query" module locates the message descriptor table entry through the message identifier and extracts the message subscriber descriptor table address from it;

[0083] Step B 5) b: the "subscriber descriptor table query" module searches the subscriber descriptor table for the module identifiers of all subscriber modules that have subscribed to the message;

[0084] Step B 5) c: the "module message subscription queue descriptor table address query" module locates the module descriptor table entry through the module identifier and retrieves the module message subscription queue descriptor table address therefrom;

[0085] Step B 5) d: The "module message subscription queue descriptor table query" and "module message subscription queue query" modules obtain all module message subscription queue addresses from the module message subscription queue descriptor table and check whether the queue message identifier is consistent with the message identifier to be published. If they are consistent, the queue write pointer is used as the message target address and a DMA operation from the message source address to the message target address is performed to complete the message subscription process;

[0086] Step B6): When the software modifies the memory message forwarding data structure, the message publish / subscribe queue cache can be invalidated through the "message publish / subscribe queue cache refresh" module, so that the cache and memory data are consistent, such as Figure 4 Step B6)a and step B6)b in.

[0087] The above-mentioned execution steps can be executed in parallel in a pipeline manner by properly arranging the timing of the digital logic circuit.

[0088] The above embodiment designs a hardware message forwarding process based on the publish-subscribe protocol, and completes the hardware forwarding of message data by introducing a memory multi-level descriptor table, a message queue and an interrupt signal notification method. This embodiment also subdivides the message forwarding engine into multiple submodules to execute in parallel with a pipeline mechanism and introduces a descriptor table cache and cache refresh technology, further improving the execution performance of the hardware message forwarding engine. Since most of the processing processes of the message communication protocol are implemented by hardware, the software only needs to initialize the memory message forwarding data structure, and the subsequent message forwarding process does not require software participation. When the message communication operations between modules are frequent, the system processor utilization rate can be greatly reduced. The reduction in the utilization rate of the message communication processor can further give up more processor resources to other system modules such as network transmission or disk read and write modules to improve the performance of the corresponding modules. At the same time, based on the asynchronous message submission process in the form of a message queue, each module can submit multiple messages at one time. Combined with the hardware digital logic circuit pipeline technology, each stage of the message forwarding process can be executed in parallel, thereby improving the system message communication performance. This embodiment enhances the versatility of the message communication protocol. This solution can be used to forward message data point-to-point, point-to-many, and many-to-many between software modules, between software modules and hardware modules, and between hardware modules, avoiding the need to develop two sets of message communication protocols for software and hardware respectively. The message communication protocol is more versatile and has a wider range of application scenarios.

[0089] The embodiment of the present application also provides a message processing hardware, the message processing hardware comprising a plurality of address registers and a plurality of message forwarding engines;

[0090] The address register is used to store the address of the data structure configured by the message processing software; wherein the address register includes a publisher descriptor table address register, a subscriber descriptor table address register and a module descriptor table address register;

[0091] The message forwarding engine is used to read the target message from the module message publishing queue and transmit the target message to the corresponding module message subscription queue;

[0092] Among them, the message processing hardware is the hardware in the message server, the message processing software is the software in the message server, and the message processing software is used to initialize the data structure in the memory; the data structure includes a publisher descriptor table, a message descriptor table and a module descriptor table, the publisher descriptor table is used to describe a publisher module set, the message descriptor table includes multiple subscriber descriptor tables, each of the subscriber descriptor tables is used to describe a corresponding message subscriber module set, and the module descriptor table is used to describe the address of the message publishing queue descriptor table and the message subscription queue descriptor table.

[0093] The message server provided in this embodiment includes message processing software and message processing hardware. The message processing software is used to initialize the data structure in the memory and configure the address of the data structure to the corresponding address register in the message processing hardware. The message processing hardware uses the message forwarding engine to read the target message from the module message publishing queue and transmit the target message to the corresponding module message subscription queue to complete the message publishing and subscription process. The communication message transmission process of this embodiment is based on the collaborative processing of the message processing software and the message processing hardware. The message processing software only participates in the operation of initializing the data structure in the memory and configuring the address of the data structure for the address register. The specific message transmission process is performed by the message processing hardware. Therefore, this embodiment can improve the processor utilization rate and message communication performance of the message server.

[0094] Furthermore, the message forwarding engine is also used to notify the message processing software of message forwarding completion through an interrupt signal; the message processing software is also used to notify other business processes of message forwarding completion through an inter-processor core interrupt.

[0095] Furthermore, the message forwarding engine is used to forward the engine to poll multiple publisher descriptor tables to determine the publisher module identifier; it is also used to determine the corresponding module message publishing queue descriptor table address in the module descriptor table based on the publisher module identifier, determine the message publishing queue address from the corresponding module message publishing queue descriptor table based on the module message publishing queue descriptor table address, and read the target message from the message publishing queue corresponding to the message publishing queue address; it is also used to determine the subscriber descriptor table corresponding to the target message based on the message identifier of the target message, and determine the subscriber module identifier in the subscriber descriptor table; it is also used to determine the corresponding module message subscription queue descriptor table address in the module descriptor table based on the subscriber module identifier, determine the message subscription queue address from the corresponding module message subscription queue descriptor table based on the module message subscription queue descriptor table address, and transmit the target message to the message subscription queue corresponding to the message subscription queue address.

[0096] Furthermore, the message forwarding engine is used to obtain the message identifier and message source address of the target message from the message publishing queue corresponding to the message publishing queue address, and read the target message from the message source address; it is also used to determine the write pointer of the message subscription queue corresponding to the message subscription queue address as the message target address, and perform a DMA operation from the message source address to the message target address.

[0097] Furthermore, before determining the corresponding module message publishing queue descriptor table address in the module descriptor table based on the publisher module identifier, the message forwarding engine is also used to query whether there is a first cache item corresponding to the publisher module identifier in the message publishing queue cache; if so, obtain the message publishing queue address and the message identifier of the target message from the first cache item, and determine the read pointer of the message publishing queue corresponding to the message publishing queue address as the message source address; if not, enter the step of determining the corresponding module message publishing queue descriptor table address in the module descriptor table based on the publisher module identifier.

[0098] Furthermore, before determining the subscriber descriptor table corresponding to the target message based on the message identifier of the target message and determining the subscriber module identifier in the subscriber descriptor table, the message forwarding engine is also used to query whether there is a second cache item corresponding to the message identifier of the target message in the message subscription queue cache; if so, obtain the message subscription queue address from the second cache item, and determine the write pointer of the message subscription queue corresponding to the message subscription queue address as the message target address; if not, enter the step of determining the subscriber descriptor table corresponding to the target message based on the message identifier of the target message, and determining the subscriber module identifier in the subscriber descriptor table.

[0099] Furthermore, before determining the write pointer of the message subscription queue corresponding to the message subscription queue address as the message target address, the message forwarding engine is also used to obtain the message identifier to be verified from the message subscription queue corresponding to the message subscription queue address, and determine whether the message identifier to be verified is consistent with the message identifier of the target message; if so, enter the step of determining the write pointer of the message subscription queue corresponding to the message subscription queue address as the message target address.

[0100] Furthermore, the message forwarding engine is also used to control the message publishing queue cache and the message subscription queue cache to be invalid when the message processing software modifies the data structure.

[0101] Since the embodiments of the apparatus part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the apparatus part, which will not be repeated here.

[0102] The present application also provides a storage medium on which a computer program is stored, and when the computer program is executed, the steps provided in the above embodiment can be implemented. The storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.

[0103] Each embodiment in the specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the embodiments can refer to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can refer to the method part description. The technical solution of the present invention proposes a design method for a multi-module asynchronous message communication mechanism with software and hardware collaboration. The method defines a software business process, a hardware business engine, a message forwarding engine, a module descriptor table, a publisher descriptor table, a subscriber descriptor table, etc., which is only for understanding the specific implementation of the present invention, and is not used to limit the present invention. Any optimization made without departing from the spirit and scope of the present invention, especially the optimization of the software and hardware interaction process, the multi-level descriptor table structure definition, the message forwarding engine cache structure design, and the pipeline mechanism, are all within the protection scope of the present invention.

[0104] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises", "comprising" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

Claims

1. A communication message transmission method, characterized in that: Applied to a message server, the message server includes message processing software and message processing hardware, the message processing hardware includes multiple address registers and multiple message forwarding engines, the method includes: Initializing a data structure in a memory using the message processing software; wherein the data structure includes a publisher descriptor table, a message descriptor table and a module descriptor table, the publisher descriptor table is used to describe a publisher module set, the message descriptor table includes a plurality of subscriber descriptor tables, each of the subscriber descriptor tables is used to describe a subscriber module set of a corresponding message, and the module descriptor table is used to describe addresses of a message publishing queue descriptor table and a message subscription queue descriptor table; The address of the data structure is configured into a corresponding address register in the message processing hardware using the message processing software; wherein the address register includes a publisher descriptor table address register, a subscriber descriptor table address register and a module descriptor table address register; Using the message forwarding engine to read the target message from the module message publishing queue, and transmitting the target message to the corresponding module message subscription queue; Wherein, the using of the message forwarding engine to read the target message from the module message publishing queue and transmitting the target message to the corresponding module message subscription queue includes: polling a plurality of the publisher descriptor tables using a plurality of the message forwarding engines to determine a publisher module identifier; Determine the corresponding module message publishing queue descriptor table address in the module descriptor table based on the publisher module identifier, determine the message publishing queue address from the corresponding module message publishing queue descriptor table based on the module message publishing queue descriptor table address, and read the target message from the message publishing queue corresponding to the message publishing queue address; Determine a subscriber descriptor table corresponding to the target message based on the message identifier of the target message, and determine a subscriber module identifier in the subscriber descriptor table; Based on the subscriber module identifier, the corresponding module message subscription queue descriptor table address is determined in the module descriptor table; based on the module message subscription queue descriptor table address, the message subscription queue address is determined from the corresponding module message subscription queue descriptor table; and the target message is transmitted to the message subscription queue corresponding to the message subscription queue address.

2. The communication message transmission method according to claim 1, characterized in that: After the message forwarding engine is used to read the target message from the module message publishing queue and transmit the target message to the corresponding module message subscription queue, the method further includes: The message forwarding engine notifies the message processing software of message forwarding completion through an interrupt signal; The message processing software notifies other service processes of message forwarding completion in the form of processor core-to-core interruption.

3. The communication message transmission method according to claim 1, characterized in that: Reading a target message from a message publishing queue corresponding to the message publishing queue address includes: Obtain the message identifier and message source address of the target message from the message publishing queue corresponding to the message publishing queue address, and read the target message from the message source address; Correspondingly, transmitting the target message to the message subscription queue corresponding to the message subscription queue address includes: The write pointer of the message subscription queue corresponding to the message subscription queue address is determined as the message target address, and a DMA operation is performed from the message source address to the message target address.

4. The communication message transmission method according to claim 3, characterized in that: Before determining the corresponding module message publishing queue descriptor table address in the module descriptor table based on the publisher module identifier, the method further includes: Querying whether there is a first cache item corresponding to the publisher module identifier in the message publishing queue cache; If it exists, obtaining the message publishing queue address and the message identifier of the target message from the first cache item, and determining the read pointer of the message publishing queue corresponding to the message publishing queue address as the message source address; If not, the step of determining the corresponding module message publishing queue descriptor table address in the module descriptor table based on the publisher module identifier is entered.

5. The communication message transmission method according to claim 3, characterized in that: Before determining the subscriber descriptor table corresponding to the target message based on the message identifier of the target message and determining the subscriber module identifier in the subscriber descriptor table, the method further includes: Querying whether there is a second cache item corresponding to the message identifier of the target message in the message subscription queue cache; If it exists, obtaining the message subscription queue address from the second cache item, and determining the write pointer of the message subscription queue corresponding to the message subscription queue address as the message target address; If not, the process proceeds to the step of determining the subscriber descriptor table corresponding to the target message based on the message identifier of the target message, and determining the subscriber module identifier in the subscriber descriptor table.

6. The communication message transmission method according to claim 5, characterized in that: Before determining the write pointer of the message subscription queue corresponding to the message subscription queue address as the message target address, the method further includes: Obtaining a message identifier to be verified from a message subscription queue corresponding to the message subscription queue address, and determining whether the message identifier to be verified is consistent with the message identifier of the target message; If so, the process proceeds to the step of determining the write pointer of the message subscription queue corresponding to the message subscription queue address as the message target address.

7. The communication message transmission method according to claim 1, characterized in that: Also includes: When the message processing software modifies the data structure, the message publishing queue cache and the message subscription queue cache are controlled to be invalid.

8. A message processing hardware, characterized in that: The message processing hardware includes a plurality of address registers and a plurality of message forwarding engines; The address register is used to store the address of the data structure configured by the message processing software; wherein the address register includes a publisher descriptor table address register, a subscriber descriptor table address register and a module descriptor table address register; The message forwarding engine is used to read the target message from the module message publishing queue and transmit the target message to the corresponding module message subscription queue; The message processing hardware is the hardware in the message server, the message processing software is the software in the message server, and the message processing software is used to initialize the data structure in the memory; the data structure includes a publisher descriptor table, a message descriptor table and a module descriptor table, the publisher descriptor table is used to describe the publisher module set, the message descriptor table includes a plurality of subscriber descriptor tables, each of the subscriber descriptor tables is used to describe the subscriber module set of the corresponding message, and the module descriptor table is used to describe the address of the message publishing queue descriptor table and the message subscription queue descriptor table; Among them, multiple message forwarding engines poll multiple publisher descriptor tables to determine the publisher module identifier; determine the corresponding module message publishing queue descriptor table address in the module descriptor table based on the publisher module identifier, determine the message publishing queue address from the corresponding module message publishing queue descriptor table based on the module message publishing queue descriptor table address, and read the target message from the message publishing queue corresponding to the message publishing queue address; determine the subscriber descriptor table corresponding to the target message based on the message identifier of the target message, and determine the subscriber module identifier in the subscriber descriptor table; determine the corresponding module message subscription queue descriptor table address in the module descriptor table based on the subscriber module identifier, determine the message subscription queue address from the corresponding module message subscription queue descriptor table based on the module message subscription queue descriptor table address, and transmit the target message to the message subscription queue corresponding to the message subscription queue address.

9. A storage medium, characterized in that: The storage medium stores computer executable instructions, which, when loaded and executed by the processor, at least implement: initializing a data structure in a memory; wherein the data structure includes a publisher descriptor table, a message descriptor table, and a module descriptor table, wherein the publisher descriptor table is used to describe a publisher module set, the message descriptor table includes a plurality of subscriber descriptor tables, each of which is used to describe a subscriber module set of a corresponding message, and the module descriptor table is used to describe the address of a message publishing queue descriptor table and a message subscription queue descriptor table; configuring the address of the data structure to a corresponding address register in the message processing hardware; wherein the address register includes a publisher descriptor table address register, a subscriber descriptor table address register, and a module descriptor table address register; Among them, multiple message forwarding engines are used to poll multiple publisher descriptor tables to determine the publisher module identifier; the corresponding module message publishing queue descriptor table address is determined in the module descriptor table based on the publisher module identifier, the message publishing queue address is determined from the corresponding module message publishing queue descriptor table based on the module message publishing queue descriptor table address, and the target message is read from the message publishing queue corresponding to the message publishing queue address; the subscriber descriptor table corresponding to the target message is determined based on the message identifier of the target message, and the subscriber module identifier is determined in the subscriber descriptor table; the corresponding module message subscription queue descriptor table address is determined in the module descriptor table based on the subscriber module identifier, the message subscription queue address is determined from the corresponding module message subscription queue descriptor table based on the module message subscription queue descriptor table address, and the target message is transmitted to the message subscription queue corresponding to the message subscription queue address.

Citation Information

Patent Citations

  • Internet of Things gateway supporting multiple sensor networks and implementation method thereof

    CN113572782A

  • Message pushing method and device, computer equipment and storage medium

    CN113596150A