Message processing method, network card, gateway device, storage medium and program

By using a programmable chip in the gateway device to distinguish the processor core load according to the message type, the problem of excessive load and delay caused by data-type packets is solved, ensuring the smooth transmission of control packets and avoiding packet loss , improves the efficiency and reliability of message processing.

CN119276658APending Publication Date: 2025-01-07ALIBABA CLOUD COMPUTING CO LTD

Patent Information

Application Number
CN202411773633.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-04
Publication Date
2025-01-07

AI Technical Summary

Technical Problem

When forwarding packets using the receiver scaling mode, data-type packets can easily lead to excessive load on the processor core and large delay in message processing, affecting the transmission of control packets and causing packet loss in control packets.

Method used

The programmable chip determines its type based on the characteristic information of the target message and sends it to the corresponding network card receiving queue, and then sends the target message to the processor core with the mapping relationship with the queue for processing, ensuring different types of Messages are processed in independent queues to avoid mutual interference.

Benefits of technology

It effectively avoids the processor core load and delay problems caused by data-type packets, ensures the smooth transmission of control-type packets, avoids packet loss, and improves the efficiency and reliability of message processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119276658A_ABST
    Figure CN119276658A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a message processing method, a network card, gateway equipment, a storage medium and a program, and relates to the technical field of networks. A gateway device comprises a network card and a plurality of processor cores used for processing messages, the network card comprises a programmable chip, and the method comprises the following steps: responding to a target message sent by a source end device, and the programmable chip determines a message type of the target message according to feature information of the target message; the programmable chip determines a target network card receiving queue from a network card receiving queue set corresponding to the message type of the target message, and sends the target message to a target processor core having a mapping relationship with the target network card receiving queue based on the target network card receiving queue, and the target processor core is one of a plurality of processor cores. According to the scheme, under the condition that the processor core corresponding to the data message is heightened by the data message, the subsequent control message can be ensured to be smoothly sent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of network technology, and in particular to a message processing method, a network card, a gateway device, a storage medium and a program. Background Art

[0002] Gateway devices play a vital role in network communications based on their routing function (ability to transfer data between different networks). In scenarios such as data centers, there is often a need to forward large-volume messages. For example, a gateway device in a data center forwards large-volume messages received from a switch to the corresponding cloud server. Therefore, gateway devices that can handle large-volume message forwarding have become an important development trend.

[0003] At present, a gateway device is usually equipped with multiple network cards, which usually use the network card multi-queue technology. The so-called network card multi-queue, as the name implies, means that the high-speed network card has multiple direct memory access (Direct Memory Access, referred to as DMA) queues. The network card has an allocation mechanism based on multiple DMA queues. A DMA queue can be bound to a processor core (usually a CPU core) in the gateway device. At present, the network card generally adopts the receive side scaling (receive sidescaling, referred to as RSS) mode to distribute the received message to the CPU core.

[0004] In actual applications, for a service, its corresponding messages generally include control messages and data messages, among which control messages are generally sent by the network card to the kernel protocol stack in the CPU core for processing, while data messages are generally sent by the network card to the service program in the CPU core for processing. After processing the control message or data message, the processed message is fed back to the network card to complete the message forwarding work through the network card. However, when using the RSS mode for message forwarding, data messages can easily cause excessive load on the processor core and large message processing delays, which ultimately affects the sending of subsequent control messages to the processor core, thereby causing control message packet loss. Summary of the invention

[0005] The embodiments of the present invention provide a message processing method, a network card, a gateway device, a storage medium and a program, which are used to ensure that subsequent control messages can be sent smoothly when a data message increases the processing power of the corresponding processor core, resulting in excessive load on the processor core and large message processing delay.

[0006] In a first aspect, an embodiment of the present invention provides a message processing method, the method is applied to a gateway device, the gateway device includes a network card and multiple processor cores for processing messages, the network card includes a programmable chip, and the method includes: In response to a target message sent by a source device, the programmable chip determines a message type of the target message according to characteristic information of the target message; The programmable chip determines a target network card receive queue from a set of network card receive queues corresponding to the message type of the target message, and sends the target message to a target processor core having a mapping relationship with the target network card receive queue based on the target network card receive queue, wherein the target processor core is one of the multiple processor cores.

[0007] In a second aspect, an embodiment of the present invention provides a message processing device, which is applied to a gateway device, wherein the gateway device includes a network card and multiple processor cores for processing messages, wherein the network card includes a programmable chip, and the device includes: A determination module, configured to respond to a target message sent by a source device and determine a message type of the target message according to characteristic information of the target message; A sending module is used for the programmable chip to determine a target network card receiving queue from a set of network card receiving queues corresponding to the message type of the target message, and send the target message to a target processor core having a mapping relationship with the target network card receiving queue based on the target network card receiving queue, wherein the target processor core is one of the multiple processor cores.

[0008] In a third aspect, an embodiment of the present invention provides a network card, wherein the network card includes a programmable chip, and the network card is respectively communicatively connected to a plurality of processor cores in a gateway device; The programmable chip is used to respond to a target message sent by a source device, determine the message type of the target message according to the characteristic information of the target message, and determine a target network card receive queue from a set of network card receive queues corresponding to the message type of the target message, and send the target message to a target processor core having a mapping relationship with the target network card receive queue based on the target network card receive queue, wherein the target processor core is one of the multiple processor cores.

[0009] In a fourth aspect, an embodiment of the present invention provides a gateway device, the gateway device comprising: Multiple processor cores; A network card, wherein the network card includes a programmable chip; The programmable chip is used to respond to a target message sent by a source device, determine the message type of the target message according to characteristic information of the target message, and determine a target network card receive queue from a set of network card receive queues corresponding to the message type of the target message, and send the target message to a target processor core having a mapping relationship with the target network card receive queue based on the target network card receive queue, wherein the target processor core is one of the multiple processor cores.

[0010] In a fifth aspect, an embodiment of the present invention provides a non-temporary machine-readable storage medium, on which executable code is stored. When the executable code is executed by a gateway device, the gateway device executes the message processing method described in the first aspect.

[0011] In a sixth aspect, an embodiment of the present invention provides a computer program product, which includes: a computer program, which, when executed by a gateway device, enables the gateway device to execute the message processing method described in the first aspect.

[0012] The message processing method provided by the embodiment of the present invention determines the message type of the target message according to the characteristic information of the target message through a programmable chip after receiving the target message sent by the source device, so as to distinguish and process messages of different message types later. Specifically, the programmable chip determines the target network card receiving queue from the network card receiving queue set corresponding to the message type of the target message, and then sends the target message to the target processor core having a mapping relationship with the target network card receiving queue based on the target network card receiving queue.

[0013] It should be noted that the network card receiving queue sets corresponding to different message types are independent of each other, which means that different types of target messages will be sent to different processor cores for processing based on their corresponding network card receiving queues, and will not interfere with each other during the processing process. Even if data messages increase the load of the corresponding processor core, causing the processor core to be overloaded and message processing to be delayed, it will not affect the processing of subsequent control messages. Subsequent control messages can still send the target message to the corresponding processor core for processing through its corresponding network card receiving queue, avoiding the loss of control messages. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0015] Figure 1 A flowchart of a message processing method provided by an embodiment of the present invention; Figure 2 A schematic diagram of an application of a matching rule provided by an embodiment of the present invention; Figure 3 A flowchart of the mapping relationship configuration between multiple network card receiving queues and processor cores provided by an embodiment of the present invention; Figure 4 Another flow chart for configuring the mapping relationship between multiple network card receiving queues and processor cores provided by an embodiment of the present invention; Figure 5 A schematic diagram of an application of a gateway device provided by an embodiment of the present invention; Figure 6 A schematic diagram of an application of a message processing method provided by an embodiment of the present invention; Figure 7 A schematic diagram of an application for determining a network card receiving queue provided by an embodiment of the present invention; Figure 8 A schematic diagram of the structure of a message processing device provided by an embodiment of the present invention. DETAILED DESCRIPTION

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

[0017] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in the embodiments of the present invention are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0018] Some embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the case where there is no conflict between the embodiments, the following embodiments and the features in the embodiments can be combined with each other. In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.

[0019] First, the terms or concepts involved in the embodiments of the present invention are explained: Gateway device: can be a gateway-type forwarding node in application scenarios such as data centers, and is a traffic convergence point. The gateway device in the embodiment of the present invention can also be a network device such as a switch, a router, etc. that can forward messages.

[0020] Field-Programmable Gate Array (FPGA) is a programmable chip, an integrated circuit that can be reconfigured at the hardware level.

[0021] Data Plane Development Kit (DPDK): is a network card driver that runs in user mode and can accelerate message forwarding.

[0022] For a service, its corresponding messages generally include control messages and data messages. In actual applications, since the traffic of data messages is generally much larger than that of control messages, when using the receive side scaling (RSS) mode for message forwarding, data messages can easily cause excessive processor core load and large message processing delays, ultimately affecting the sending of subsequent control messages to the processor core, thereby causing control message packet loss.

[0023] In view of this, an embodiment of the present invention provides a message processing method, which solves the above problem through the following ideas: after receiving the target message sent by the source device, the programmable chip determines the message type of the target message, and determines the target network card receiving queue from the network card receiving queue set corresponding to the message type of the target message, and sends the target message to the target processor core that has a mapping relationship with the target network card receiving queue based on the target network card receiving queue. In actual applications, the network card receiving queue sets corresponding to different message types are independent of each other, which means that different types of target messages will be sent to different processor cores for processing based on their respective corresponding network card receiving queues, and will not interfere with each other during the processing process. Even if the data class message increases the corresponding processor core, resulting in excessive load on the processor core and large message processing delay, it will not affect the processing of subsequent control class messages, effectively avoiding the loss of control class messages.

[0024] Figure 1 The present invention provides a flowchart of a message processing method, which is applied to a gateway device, wherein the gateway device includes a network card and multiple processor cores for processing messages, and the network card includes a programmable chip. Figure 1 As shown, the method comprises the following steps: 101. In response to a target message sent by a source device, the programmable chip determines a message type of the target message according to feature information of the target message.

[0025] 102. The programmable chip determines a target network card receiving queue from a set of network card receiving queues corresponding to a message type of the target message, and sends the target message to a target processor core having a mapping relationship with the target network card receiving queue based on the target network card receiving queue, wherein the target processor core is one of the multiple processor cores.

[0026] It should be noted that the target message sent by the source device will be forwarded to the destination device after being processed by the target processor core. Among them, the source device and the destination device refer to two devices that need to communicate through the gateway device, such as a terminal device using the target service and a cloud server providing the target service. The target service corresponds to the target message and can be a live application service, a game application service, etc. Multiple processor cores can usually be multiple CPU cores, and the programmable chip can be an FPGA chip, but it is not limited to this, and other dedicated integrated chips can also be used. The following text takes the processor core as a CPU core and the programmable chip as an FPGA chip as an example for explanation.

[0027] In actual applications, the source device sends a target message to the network card. After the programmable chip in the network card receives the target message sent by the source device, it determines the message type of the target message based on the characteristic information of the target message. The specific process is as follows: the programmable chip obtains the matching rule corresponding to the control message. If the characteristic information of the target message matches the matching rule, the programmable chip determines that the message type of the target message is a control message. If the characteristic information of the target message does not match the matching rule, the programmable chip determines that the message type of the target message is a data message.

[0028] The matching rule includes a valid bit field and a reference value of at least one tuple field. If the actual value of at least one tuple field of the target message is the same as the reference value of at least one tuple field, the programmable chip determines that the message type of the target message is a control message.

[0029] In specific implementation, the matching rule may be expressed in the form of a rule entry (the entry specification may be determined according to actual requirements, such as 64 bytes, 128 bytes, 256 bytes, etc., which is not limited here). The application diagram may be found in Figure 2 .exist Figure 2In the specification, "vld" represents a valid bit field, "proto", "dip", "sip", "sport" and "dport" represent at least one tuple field, where "proto" represents the protocol type, "dip" represents the destination IP address, "sip" represents the source IP address, "sport" represents the source port number, and "dport" represents the destination port number.

[0030] To facilitate understanding, the following example is used to illustrate the specific fields in the above rule table: In actual application, the validity of the matching rule can be determined by the value of "vld". For example, if the value of "vld" is 0, the matching rule is determined to be invalid, and there is no need to perform rule matching on the target message based on the tuple field. If the value of "vld" is 1, the matching rule is determined to be valid. At this time, the target message can be matched based on the tuple field. The specific rule matching process is as follows: As an implementation method, assume that at least one tuple field set in the current matching rule includes "proto" and "dip", wherein the reference value of "proto" is A and the reference value of "dip" is B. Then, if the actual value of "proto" of the target message is A, and the actual value of "dip" is B, it means that the characteristic information of the target message matches the matching rule, and the message type of the target message is determined to be a control message. If the actual value of "proto" of the target message is C, and the actual value of "dip" is D, it means that the characteristic information of the target message does not match the matching rule, and the message type of the target message is determined to be a data message.

[0031] As another implementation, assume that at least one tuple field set in the current matching rule includes "proto", "dip", "sip", "sport" and "dport", wherein the reference value of "proto" is A, the reference value of "dip" is B, the reference value of "sip", the reference value of "sport" is D, and the reference value of "dport" is E. Then, if the actual value of "proto" of the target message is A, and the actual value of "dip" is B, the actual value of "sip", the actual value of "sport", the actual value of "dport" is E, it means that the characteristic information of the target message matches the matching rule, and the message type of the target message is determined to be a control message. If the actual value of "proto" of the target message is A, and the actual value of "dip" is B, the actual value of "sip", the actual value of "sport", the actual value of "sport", and the actual value of "dport" is Z, it means that the characteristic information of the target message does not match the matching rule, and the message type of the target message is determined to be a data message.

[0032] In summary, one or more tuple fields can be set in the current matching rule as the basis for judging the message type, and the above two implementation methods are only specific examples for ease of understanding and are not limited thereto. However, no matter how many tuple fields are set in the current matching rule as the basis for judging the message type, as long as the actual value of at least one tuple field of the target message is exactly the same as the reference value of at least one tuple field in the matching rule, it can be determined that the characteristic information of the target message matches the matching rule, and then the message type of the target message is determined to be a control message.

[0033] Based on the above, by judging whether the characteristic information of the target message matches the matching rules, the message type of the target message can be judged, so that the programmable chip can subsequently accurately distinguish and process the corresponding target message according to different message types, avoiding mutual influence between two different types of messages during the processing process.

[0034] The message processing method provided by the embodiment of the present invention can distinguish and process different types of target messages. The network card receiving queue sets corresponding to different message types are independent of each other, which means that different types of target messages will be sent to different processor cores for processing based on their corresponding network card receiving queues, and will not interfere with each other during the processing. Even if a data-type message increases the processing power of its corresponding processor core, causing the processor core to be overloaded and the message processing delay to be large, it will not affect the processing of subsequent control-type messages. Subsequent control-type messages can still send the target message to its corresponding processor core for processing through its corresponding network card receiving queue, thus avoiding the loss of control-type messages.

[0035] In an embodiment of the present invention, the multiple processor cores include a first processor core and a second processor core; the programmable chip determines a target network card receive queue from a set of network card receive queues corresponding to a message type of the target message, and sends the target message to a target processor core having a mapping relationship with the target network card receive queue based on the target network card receive queue, including: if the message type is a control message, the programmable chip determines a first network card receive queue from a set of first network card receive queues corresponding to the control message, and sends the target message to the first processor core having a mapping relationship with the first network card receive queue based on the first network card receive queue; if the message type is a data message, the programmable chip determines a second network card receive queue from a set of second network card receive queues corresponding to the data message based on a receiver scaling mode, and sends the target message to the second processor core through the second network card receive queue, wherein the second network card receive queue has a mapping relationship with the second processor core.

[0036] Continuing with the above embodiment, the matching rule also includes a network card receive queue identifier (represented as a qid field). When the programmable chip determines through the matching rule that the message type of the target message is a control message, the programmable chip can determine the first network card receive queue corresponding to the target message from the first network card receive queue set corresponding to the control message according to the network card receive queue identifier, that is, assuming that the value of the qid field at this time is consistent with the identifier of the first network card receive queue.

[0037] At this time, the first network card receive queue corresponding to the target message can be determined in the first network card receive queue set through the above-mentioned "qid" field, and each network card receive queue in the first network card receive queue set has its own identifier. Therefore, by using the actual value of the "qid" field to search in the first network card receive queue set, the first network card receive queue corresponding to the target message can be found.

[0038] It should be noted here that, as an optional method, when configuring the matching rules, the "qid" field can correspond not only to the first network card receive queue set, but also to the second network card receive queue set. In summary, control messages can not only use the network card receive queues in the first network card receive queue set, but also use the network card receive queues in the second network card receive queue set, ensuring that control messages are more flexible in the use of network card receive queues.

[0039] After finding the first network card receiving queue corresponding to the target message, the target message is sent to the first processor core having a mapping relationship with the first network card receiving queue for processing based on the first network card receiving queue. It should be noted that the first processor core is a processor core exclusively for control messages, that is, the first processor core is only used to process control messages, and does not process data messages.

[0040] On the other hand, if the actual value of any tuple field of the target message is different from the reference value of at least one tuple field in the matching rule, it can be determined that the characteristic information of the target message does not match the matching rule, and then the message type of the target message is determined to be a data class message. At this time, the programmable chip determines the second network card receiving queue from the second network card receiving queue set corresponding to the data class message based on the receiver scaling mode, and sends the target message to the second processor core through the second network card receiving queue. Among them, the specific steps of determining the second network card receiving queue are as follows: the programmable chip determines the hash value corresponding to the tuple information of the target message, and determines the network card receiving queue identifier of the second network card receiving queue corresponding to the hash value from the forwarding table.

[0041] In the specific implementation, it is assumed that the tuple information of the target message includes the source IP address, source port number, destination IP address, destination port number and protocol type. Then, a hash value A can be calculated based on the tuple information, and the lowest n bits of the hash value A are used as an index (wherein the value of n can be determined according to the actual situation) to find the entry in the forwarding table, in which the network card receiving queue identifier of the second network card receiving queue corresponding to the hash value A is stored. Among them, the specific description of the forwarding table can be found in the following embodiment, which will not be introduced in detail here.

[0042] Based on the above, in the embodiment of the present invention, the first network card receiving queue and the second network card receiving queue are independent of each other, and the first processor core and the second processor core are independent of each other, so that the data class messages and the control class messages will not affect each other during the processing. Even if the data class message increases the corresponding second processor core, resulting in an excessive load on the second processor core and a large message processing delay, it will not affect the subsequent processing of the control class messages, effectively avoiding the loss of the control class messages.

[0043] In an embodiment of the present invention, the gateway device further includes a third processor core running a DPDK program, and the third processor core is used to configure a mapping relationship between multiple network card receiving queues and processor cores before actually processing the target message. The specific process of configuring the mapping relationship between multiple network card receiving queues and processor cores for control messages and data messages is described below: For control messages, such as Figure 3 As shown, the mapping relationship configuration process between multiple network card receive queues and processor cores is as follows: 301. In response to the configuration of the total number of network card receive queues and the number of network card receive queues corresponding to data packets, the third processor core determines at least one network card receive queue identifier included in the first network card receive queue set, and displays the at least one network card receive queue identifier.

[0044] 302. In response to a matching rule input based on at least one network card receiving queue identifier, the third processor core configures the matching rule into a programmable chip and establishes a mapping relationship between at least one network card receiving queue corresponding to at least one network card receiving queue identifier and the processor core.

[0045] In actual applications, the programmable chip stores the total number of network card receive queues and the number of network card receive queues corresponding to data class messages in advance through registers. In specific implementation, the third processor reads the register through the DPDK program to obtain the total number of network card receive queues and the number of network card receive queues corresponding to data class messages. At this time, by subtracting the number of network card receive queues corresponding to data class messages from the total number of network card receive queues, the number of network card receive queues corresponding to control class messages can be obtained, and then at least one network card receive queue identifier contained in the first network card receive queue set corresponding to the control class message can be determined. It can be understood that the network card receive queues are sequential. When the total number of network card receive queues and the number of network card receive queues corresponding to data class messages are known, the number and identifier of the remaining network card receive queues corresponding to the control class messages can be obtained by performing a difference operation on the two.

[0046] For ease of understanding, for example, assuming that the total number of network card receive queues is 8, and the number of network card receive queues corresponding to data class messages is 5, then the network card receive queue identifiers corresponding to the data class messages can be 1, 2, 3, 4, 5. By performing a difference operation on the total number of network card receive queues and the number of network card receive queues corresponding to data class messages, it can be obtained that the number of network card receive queues corresponding to control class messages is 3, and the corresponding network card receive queue identifiers can be 6, 7, 8. They can also be reordered according to their own message types. For example, the corresponding network card receive queue identifiers can also be 1, 2, 3, which are not limited here.

[0047] Afterwards, the third processor core configures the matching rule input based on at least one network card receiving queue identifier into the programmable chip, and establishes a mapping relationship between at least one network card receiving queue corresponding to at least one network card receiving queue identifier and the processor core. In subsequent applications, if the target type is determined to be a control message based on the characteristic information of the target message and the matching rule, the first network card receiving queue corresponding to the target message can be directly determined based on the network card receiving queue identifier in the matching rule, and then the first processor core corresponding to the first network card receiving queue can be determined based on the mapping relationship between at least one network card receiving queue and the processor core.

[0048] By obtaining the total number of pre-configured network card receive queues and the number of network card receive queues corresponding to data class messages, the number and identification of network card receive queues corresponding to control class messages can be accurately obtained, which is convenient for the subsequent configuration of matching rules and the mapping relationship between at least one network card receive queue and the processor core, laying the foundation for the subsequent smooth completion of the processing of control class target messages.

[0049] For data packets, such as Figure 4 As shown, the mapping relationship configuration process between multiple network card receive queues and processor cores is as follows: 401. In response to configuration of the total number of network card receive queues and the number of network card receive queues corresponding to data packets, a third processor core determines multiple network card receive queue identifiers included in a second network card receive queue set.

[0050] 402. The third processor core configures the second network card receiving queue set into a forwarding table corresponding to the receiver scaling mode in the programmable chip, and establishes a mapping relationship between multiple network card receiving queues corresponding to multiple network card receiving queue identifiers and the processor core.

[0051] In actual applications, the programmable chip stores the total number of network card receive queues and the number of network card receive queues corresponding to data class messages in advance through registers. In specific implementation, the third processor reads the register through the DPDK program to obtain the number of network card receive queues corresponding to the data class messages, and then determines the multiple network card receive queue identifiers contained in the second network card receive queue set corresponding to the data class messages. For ease of understanding, for example, assuming that the total number of network card receive queues is 8, and the number of network card receive queues corresponding to data class messages is 5, then the network card receive queue identifiers corresponding to the data class messages can be 1, 2, 3, 4, 5.

[0052] Afterwards, the third processor core configures the second network card receiving queue set into the forwarding table corresponding to the receiver scaling mode in the programmable chip, and establishes a mapping relationship between multiple network card receiving queues corresponding to multiple network card receiving queue identifiers and the processor core. Among them, the specific manifestation of the forwarding table can be a redirection table (RedirectionTable, referred to as RETA) in the network card. It should be noted that in actual applications, the mapping relationship between multiple network card receiving queues and the processor core is not stored in the forwarding table, but is bound to the multiple network card receiving queues included in the second network card receiving queue set in an associated form.

[0053] By obtaining the total number of pre-configured network card receive queues and the number of network card receive queues corresponding to data class messages, the network card receive queue identifier corresponding to the data class message can be accurately obtained, which is convenient for completing the configuration of the forwarding table corresponding to the receiver's scaling mode and laying the foundation for the subsequent smooth processing of the data class target message.

[0054] In order to facilitate the understanding of this scheme, the following Figure 5-Figure 7 Let's give a specific example: Figure 5 A schematic diagram of an application of a gateway device provided by an embodiment of the present invention. Figure 5 In the example, the gateway device includes multiple processor cores (i.e. Figure 5CPU core 1, CPU core 2, CPU core 3...CPU core n) and network cards, which are connected to multiple processor cores. The network card includes a programmable chip (i.e. Figure 5 FPGA chip in the FPGA chip), multiple network card receiving queues (including at least a first network card receiving queue set and a second network card receiving queue set, Figure 5 In the figure, "1" in the network card receiving queue represents the first network card receiving queue in the first network card receiving queue set, and "2" in the network card receiving queue represents the second network card receiving queue in the second network card receiving queue set) and multiple network card sending queues.

[0055] In practical applications, the third processor core (i.e. Figure 5 The CPU core 3) determines at least one network card receive queue identifier included in the first network card receive queue set based on the total number of pre-configured network card receive queues and the number of network card receive queues corresponding to the data class messages, and configures the matching rule input based on the at least one network card receive queue identifier into the programmable chip, and establishes a mapping relationship between the corresponding at least one network card receive queue and the processor core, wherein the third processor core runs a DPDK program.

[0056] The third processor core determines the multiple network card receive queue identifiers included in the second network card receive queue set based on the pre-configured total number of network card receive queues and the number of network card receive queues corresponding to the data class messages, configures the second network card receive queue set into the forwarding table corresponding to the receiver scaling mode in the programmable chip, and establishes a corresponding mapping relationship between the multiple network card receive queues and the processor core.

[0057] When implementing it, Figure 6 As shown: S1. The programmable chip receives the target message sent by the source device.

[0058] S2. The programmable chip determines whether the characteristic information of the target message matches the matching rule.

[0059] S3. If a match is found, the programmable chip determines that the message type of the target message is a control message, and jumps to S4.

[0060] S4. The programmable chip determines the first network card receiving queue corresponding to the target message from the first network card receiving queue set corresponding to the control message according to the network card receiving queue identifier, and sends the target message to the first processor core (i.e., the processor core) having a mapping relationship with the first network card receiving queue based on the first network card receiving queue. Figure 5 CPU core 1).

[0061] S5. If there is no match, the programmable chip determines that the message type of the target message is a data message, and jumps to S6.

[0062] S6: The programmable chip determines the second network card receiving queue from the second network card receiving queue set corresponding to the data class message based on the receiver scaling mode, and sends the target message to the second processor core (i.e., Figure 5 CPU core 2).

[0063] S7. Send the target message processed by S4 or S6 to the programmable chip based on the corresponding network card sending queue, and send it to the destination device through the programmable chip.

[0064] In this process, for the specific schematic diagram of determining the network card receiving queue according to the matching rules in the above S2-S6, please refer to Figure 7 .

[0065] Based on the above, the message processing method provided by the embodiment of the present invention can distinguish between data messages and control messages, and the two types of messages will not interfere with each other during the processing. Even if the data message increases the corresponding second processor core, resulting in excessive load on the second processor core and large message processing delay, it will not affect the processing of the control message, thereby avoiding the loss of the control message. It is understandable that if the data message increases the corresponding second processor core, resulting in the loss of the control message, jitter of routing or other communication messages will occur (because if the control message is lost, it will cause the source device and the gateway device to communicate with each other, such as disconnection, connection, and disconnection, and thus the data message will be lost, reducing the user's actual application experience such as video calls and online games, and this solution successfully solves this problem.

[0066] The message processing device of one or more embodiments of the present invention will be described in detail below. Those skilled in the art will appreciate that these devices can be configured using commercially available hardware components through the steps taught in this solution.

[0067] Figure 8 A schematic diagram of the structure of a message processing device provided by an embodiment of the present invention, such as Figure 8 As shown, the device is applied to a gateway device, which includes a network card and multiple processor cores for processing messages, and the network card includes a programmable chip. Figure 8 As shown, the device includes: a determination module 11 and a sending module 12.

[0068] The determination module 11 is used to determine the message type of the target message according to the characteristic information of the target message in response to the target message sent by the source device.

[0069] The sending module 12 is used to enable the programmable chip to determine a target network card receive queue from a set of network card receive queues corresponding to the message type of the target message, and send the target message to a target processor core having a mapping relationship with the target network card receive queue based on the target network card receive queue, wherein the target processor core is one of the multiple processor cores.

[0070] Among them, optionally, the multiple processor cores include a first processor core and a second processor core, and the sending module 12 is specifically used for: if the message type is a control class message, the programmable chip determines the first network card receive queue from the first network card receive queue set corresponding to the control class message, and sends the target message to the first processor core having a mapping relationship with the first network card receive queue based on the first network card receive queue; and if the message type is a data class message, the programmable chip determines the second network card receive queue from the second network card receive queue set corresponding to the data class message based on the receiver scaling mode, and sends the target message to the second processor core through the second network card receive queue, wherein the second network card receive queue has a mapping relationship with the second processor core.

[0071] Among them, optionally, the determination module 11 is specifically used to: obtain a matching rule corresponding to the control class message; if the characteristic information of the target message matches the matching rule, determine that the message type of the target message is a control class message; if the characteristic information of the target message does not match the matching rule, determine that the message type of the target message is a data class message.

[0072] Among them, optionally, the matching rule includes a reference value of at least one tuple field and a network card receive queue identifier; the sending module 12 is specifically used to: if the actual value of the at least one tuple field of the target message is the same as the reference value of the at least one tuple field, then determine that the message type of the target message is a control class message, and according to the network card receive queue identifier, determine the first network card receive queue corresponding to the target message from the first network card receive queue set corresponding to the control class message, and determine the hash value corresponding to the tuple information of the target message, and determine the network card receive queue identifier of the second network card receive queue corresponding to the hash value from the forwarding table.

[0073] Among them, optionally, the gateway device also includes a third processor core running the DPDK program; the device also includes: a configuration module, which is used to respond to the configuration of the total number of network card receive queues and the number of network card receive queues corresponding to the data class message, determine at least one network card receive queue identifier included in the first network card receive queue set through the third processor core, and display the at least one network card receive queue identifier, and respond to the matching rule input based on the at least one network card receive queue identifier, configure the matching rule into the programmable chip through the third processor core, and establish a mapping relationship between at least one network card receive queue corresponding to the at least one network card receive queue identifier and the processor core.

[0074] The configuration module is also used for: in response to the configuration of the total number of network card receive queues and the number of network card receive queues corresponding to the data class messages, determining, through the third processor core, a plurality of network card receive queue identifiers included in the second network card receive queue set, and configuring, through the third processor core, the second network card receive queue set to the forwarding table corresponding to the receiver scaling mode in the programmable chip, and establishing a mapping relationship between a plurality of network card receive queues corresponding to the plurality of network card receive queue identifiers and the processor core.

[0075] Figure 8 The device shown can execute the steps provided in the aforementioned embodiments. For detailed execution process and technical effects, please refer to the description in the aforementioned embodiments, which will not be repeated here.

[0076] In addition, an embodiment of the present invention provides a network card, wherein the network card includes a programmable chip, and the network card is respectively connected to multiple processor cores in the gateway device. The programmable chip may be a field programmable gate array (FPGA), a complex programmable logic device (CPLD), a system on chip (SoC), etc.

[0077] The programmable chip is used to respond to a target message sent by a source device, determine the message type of the target message according to the characteristic information of the target message, and determine a target network card receive queue from a set of network card receive queues corresponding to the message type of the target message, and send the target message to a target processor core having a mapping relationship with the target network card receive queue based on the target network card receive queue, wherein the target processor core is one of the multiple processor cores.

[0078] The network card can execute the steps provided in the aforementioned embodiments. For detailed execution process and technical effects, please refer to the description in the aforementioned embodiments, which will not be repeated here.

[0079] In addition, an embodiment of the present invention provides a gateway device, the gateway device comprising: a plurality of processor cores; A network card, wherein the network card includes a programmable chip; The programmable chip is used to respond to a target message sent by a source device, determine the message type of the target message according to characteristic information of the target message, and determine a target network card receive queue from a set of network card receive queues corresponding to the message type of the target message, and send the target message to a target processor core having a mapping relationship with the target network card receive queue based on the target network card receive queue, wherein the target processor core is one of the multiple processor cores.

[0080] The gateway device can execute the steps provided in the aforementioned embodiments. For detailed execution process and technical effects, please refer to the description in the aforementioned embodiments, which will not be repeated here.

[0081] In addition, an embodiment of the present invention provides a non-temporary machine-readable storage medium, on which executable code is stored. When the executable code is executed by a gateway device, the gateway device can at least implement the message processing method provided in the aforementioned embodiment.

[0082] In addition, an embodiment of the present invention provides a computer program product, which includes: a computer program, when the computer program is executed by a gateway device, the gateway device can at least implement the message processing method provided in the above embodiment.

[0083] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. Those of ordinary skill in the art may understand and implement the present invention without creative effort.

[0084] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by adding a necessary general hardware platform, and of course can also be implemented by combining hardware and application programs. Based on such an understanding, the above technical solution can essentially or in other words be embodied in the form of a computer product, and the present invention can be implemented in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0085] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A message processing method, characterized in that: Applied to a gateway device, the gateway device includes a network card and multiple processor cores for processing messages, the network card includes a programmable chip, and the method includes: In response to a target message sent by a source device, the programmable chip determines a message type of the target message according to characteristic information of the target message; The programmable chip determines a target network card receive queue from a set of network card receive queues corresponding to the message type of the target message, and sends the target message to a target processor core having a mapping relationship with the target network card receive queue based on the target network card receive queue, wherein the target processor core is one of the multiple processor cores.

2. The method according to claim 1, characterized in that The multiple processor cores include a first processor core and a second processor core; the programmable chip determines a target network card receiving queue from a set of network card receiving queues corresponding to the message type of the target message, and sends the target message to a target processor core having a mapping relationship with the target network card receiving queue based on the target network card receiving queue, including: If the message type is a control message, the programmable chip determines a first network card receiving queue from a set of first network card receiving queues corresponding to the control message, and sends the target message to the first processor core having a mapping relationship with the first network card receiving queue based on the first network card receiving queue; If the message type is a data class message, the programmable chip determines the second network card receive queue from the second network card receive queue set corresponding to the data class message based on the receiver scaling mode, and sends the target message to the second processor core through the second network card receive queue, wherein the second network card receive queue and the second processor core have a mapping relationship.

3. The method according to claim 2, characterized in that The programmable chip determines the message type of the target message according to the characteristic information of the target message, including: The programmable chip obtains a matching rule corresponding to the control message; If the characteristic information of the target message matches the matching rule, the programmable chip determines that the message type of the target message is a control message; If the characteristic information of the target message does not match the matching rule, the programmable chip determines that the message type of the target message is a data message.

4. The method according to claim 3, characterized in that The matching rule includes a reference value of at least one tuple field; if the characteristic information of the target message matches the matching rule, the programmable chip determines that the message type of the target message is a control message, including: If the actual value of the at least one tuple field of the target message is the same as the reference value of the at least one tuple field, the programmable chip determines that the message type of the target message is a control message.

5. The method according to claim 3, characterized in that: The matching rule includes a network card receiving queue identifier; The programmable chip determines the first network card receiving queue from the first network card receiving queue set corresponding to the control class message, including: The programmable chip determines, according to the network card receiving queue identifier, the first network card receiving queue corresponding to the target message from the first network card receiving queue set corresponding to the control class message.

6. The method according to claim 5, characterized in that The plurality of processor cores also include a third processor core running a DPDK program; the method further includes: In response to the configuration of the total number of network card receive queues and the number of network card receive queues corresponding to the data class message, the third processor core determines at least one network card receive queue identifier included in the first network card receive queue set, and displays the at least one network card receive queue identifier; In response to the matching rule input based on the at least one network card receiving queue identifier, the third processor core configures the matching rule into the programmable chip and establishes a mapping relationship between at least one network card receiving queue corresponding to the at least one network card receiving queue identifier and the processor core.

7. The method according to any one of claims 2 to 5, characterized in that: The gateway device also includes a third processor core running a DPDK program; the method also includes: In response to the configuration of the total number of network card receive queues and the number of network card receive queues corresponding to the data class message, the third processor core determines a plurality of network card receive queue identifiers included in the second network card receive queue set; The third processor core configures the second network card receiving queue set into the forwarding table corresponding to the receiver scaling mode in the programmable chip, and establishes a mapping relationship between the multiple network card receiving queues corresponding to the multiple network card receiving queue identifiers and the processor core.

8. The method according to claim 7, characterized in that The programmable chip determines the second network card receiving queue from the second network card receiving queue set corresponding to the data class message based on the receiver scaling mode, including: The programmable chip determines a hash value corresponding to the multi-tuple information of the target message, and determines a network card receiving queue identifier of the second network card receiving queue corresponding to the hash value from the forwarding table.

9. A network card, characterized in that: The network card includes a programmable chip, and the network card is respectively connected to multiple processor cores in the gateway device; The programmable chip is used to respond to a target message sent by a source device, determine the message type of the target message according to the characteristic information of the target message, and determine a target network card receive queue from a set of network card receive queues corresponding to the message type of the target message, and send the target message to a target processor core having a mapping relationship with the target network card receive queue based on the target network card receive queue, wherein the target processor core is one of the multiple processor cores.

10. A gateway device, characterized in that: include: Multiple processor cores; A network card, wherein the network card includes a programmable chip; The programmable chip is used to respond to a target message sent by a source device, determine the message type of the target message according to characteristic information of the target message, and determine a target network card receive queue from a set of network card receive queues corresponding to the message type of the target message, and send the target message to a target processor core having a mapping relationship with the target network card receive queue based on the target network card receive queue, wherein the target processor core is one of the multiple processor cores.

11. A non-transitory machine-readable storage medium, characterized in that: The non-transitory machine-readable storage medium stores executable code, and when the executable code is executed by a gateway device, the gateway device executes the message processing method according to any one of claims 1 to 8.

12. A computer program product, characterized in that include: A computer program, when the computer program is executed by a gateway device, causes the gateway device to execute the message processing method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Message processing method, device and system

    CN112152940A

  • Message transmission method and device

    CN115242711A

  • Message processing method and device, electronic equipment and storage medium

    CN115499387A

  • Message shunting method and device, network equipment and storage medium

    CN116668375A

  • Systems and methods for receive and transmission queue processing in a multi-core architecture

    US20100322265A1

Cited By

  • Message shunting method and device and network equipment

    CN121239627A

  • Artificial intelligence processor, electronic device and data transmission method

    CN121364935A