WO2021073473A1 - Data packet processing method and apparatus, communication device, and storage medium - Google Patents

Data packet processing method and apparatus, communication device, and storage medium Download PDF

Info

Publication number
WO2021073473A1
WO2021073473A1 PCT/CN2020/120353 CN2020120353W WO2021073473A1 WO 2021073473 A1 WO2021073473 A1 WO 2021073473A1 CN 2020120353 W CN2020120353 W CN 2020120353W WO 2021073473 A1 WO2021073473 A1 WO 2021073473A1
Authority
WO
WIPO (PCT)
Prior art keywords
data packet
cpu core
core
processed
cpu
Prior art date
Application number
PCT/CN2020/120353
Other languages
French (fr)
Chinese (zh)
Inventor
刘学彬
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2021073473A1 publication Critical patent/WO2021073473A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F15/00Digital computers in general; Data processing equipment in general
    • G06F15/16Combinations of two or more digital computers each having at least an arithmetic unit, a program unit and a register, e.g. for a simultaneous processing of several programs
    • G06F15/163Interprocessor communication

Definitions

  • multi-core CPU central processing unit, central processing unit
  • multi-core CPU central processing unit, central processing unit
  • the data receiving hardware device can only send the data packet to one CPU core in the multi-core CPU (or the number of CPU cores sent is less than the total number of CPU cores), resulting in other CPU cores being idle Status, unable to make full use of all CPU cores, reducing the data processing performance of communication equipment.
  • the data packet processing method, device, communication device, and storage medium provided by the embodiments of the present invention mainly aim to solve the technical problem at least to a certain extent that the data receiving hardware device can only send the data packet to one CPU core in the multi-core CPU ( Or the number of CPU cores sent is less than the total number of CPU cores), it is impossible to make full use of all the CPU cores, and the data processing performance of the communication equipment is low.
  • embodiments of the present invention provide a data packet processing method, which is applied to a communication device including a multi-core CPU central processing unit, and the multi-core CPU includes at least two CPU cores.
  • the method includes: receiving a data packet to be processed and determining a target CPU core for the data packet to be processed from all CPU cores included in the multi-core CPU; and tagging the data packet to be processed based on the target CPU core Information, the tag information includes the target CPU core; the data packet to be processed with the tag information is sent to a designated CPU core; the designated CPU core sends the data packet to the designated CPU core based on the label information of the data packet to be processed The data packet to be processed is sent to the target CPU core for processing.
  • the embodiment of the present invention also provides a data packet processing device, the data packet processing device includes a multi-core CPU and a hardware data receiving module, one of the CPU cores in the multi-core CPU is a designated CPU core; the hardware data receiving module, For receiving a data packet to be processed and determining a target CPU core for the data packet to be processed from at least two CPU cores included in the multi-core CPU, and adding label information to the data packet to be processed based on the target CPU core, Send the to-be-processed data packet with tag information to the designated CPU core, the tag information includes the target CPU core; the designated CPU core includes a sub-core module, used for processing based on the to-be-processed data packet The label information sends the data packet to be processed to the target CPU core; the target CPU core includes a processing module for processing the data packet to be processed.
  • the embodiment of the present invention further provides a storage medium, the readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the above-mentioned data packet processing method. step.
  • FIG. 1 is a flowchart of a data packet processing method according to Embodiment 1 of the present invention
  • FIG. 2 is a flowchart of determining a target CPU core for a data packet to be processed by specifying a CPU core according to Embodiment 1 of the present invention
  • FIG. 5 is a schematic structural diagram of a data packet processing device according to the third embodiment of the present invention.
  • FIG. 7 is a schematic diagram of a detailed structure of a data packet processing device according to the fourth embodiment of the present invention.
  • FIG. 8 is a schematic structural diagram of a communication device according to Embodiment 5 of the present invention.
  • the data receiving hardware device can only send the data packet to one CPU core in the multi-core CPU or the number of CPU cores sent to is less than the total number of CPU cores, and cannot make full use of all the CPU cores, thus Leading to the problem of low data processing performance of communication devices, embodiments of the present invention provide a data packet processing method, which is applied to a communication device including a multi-core CPU. It should be understood that a multi-core CPU includes at least two CPUs. The core CPU. As shown in Figure 1, the data packet processing method includes:
  • S101 Receive a to-be-processed data packet and determine a target CPU core from all CPU cores included in the multi-core CPU for the to-be-processed data packet.
  • the communication device receives the data packet sent by the external device. At this time, the data packet has not been processed, so it is regarded as the data packet to be processed. After receiving the data packet to be processed, the communication device determines the target CPU core from all the CPU cores included in the multi-core CPU for the data packet to be processed, that is, selects a CPU core from all the CPU cores included in the multi-core CPU for the data packet to be processed As the target CPU core.
  • the communication device determines the target CPU core from all the CPU cores included in the multi-core CPU for the data packet to be processed, which may be: selecting a CPU core from all the CPU cores included in the multi-core CPU based on a preset algorithm as the target CPU core , Where the preset algorithm includes at least one of the following algorithms: round robin, hash (hash) method, and least idle method.
  • the target CPU core is selected in turn. For example, suppose a multi-core CPU includes CPU core 1, CPU core 2, and CPU core 3. After receiving the data packet to be processed, select CPU core 1 as the target CPU core After receiving the to-be-processed data packet again, select CPU core 2 as the target CPU core.
  • select CPU core 3 After receiving the to-be-processed data packet again, select CPU core 3 as the target CPU core. After receiving the to-be-processed data packet again, select CPU core 1 is used as the target CPU core and loops.
  • select CPU core 1 For the hash method, by calculating certain fields in the data packet to be processed (such as 5-TUPLE, which is a five-tuple, it should be noted that the 5-TUPLE of the data packet is the source IP (Internet Protocol, The protocol for interconnection between networks) address, destination IP address, source port, destination port, protocol parameters consisting of 5 fields) hash value, and the selection of the target CPU core is determined by a few bits in the hash value.
  • the most idle method according to the load status of each CPU core, the CPU core with the least load (that is, the most idle) is selected as the target CPU core.
  • the preset algorithm may also be other algorithms.
  • the communication device determines the target CPU core from all the CPU cores included in the multi-core CPU for the data packet to be processed, or it may be: find the CPU core corresponding to the 5 TUPLE of the data packet to be processed from the CPU core information look-up table As the target CPU core.
  • the CPU core information look-up table includes 5 TUPLE and the CPU core mapping relationship. It should be understood that the CPU core included in the CPU core information look-up table is the CPU core in the multi-core CPU of the communication device. See Table 1, which is An optional lookup table for CPU core information. Assuming that the 5 TUPLE of the data packet to be processed matches the first 5 TUPLE data, see Table 1. The corresponding CPU core is the first CPU core, so the first CPU core As the target CPU core of the packet to be processed.
  • the mapping relationship between the 5 TUPLE and the CPU core in the CPU core information lookup table can be preset by the developer, or the 5 TUPLE of the to-be-processed data packet received in history, and the CPU core that processes the data packet To determine, that is, after receiving the to-be-processed data packet and sending the to-be-processed data packet to the corresponding CPU core for processing, save the 5 TUPLE of the to-be-processed data packet and the corresponding CPU core update to the CPU core information Lookup table.
  • the data packet to be processed can also be directly sent to the designated CPU core.
  • tag information is added to the data packet to be processed based on the target CPU core, where the tag information includes the target CPU core.
  • the label information can be inserted into the data packet to be processed, and can also be inserted into other fields associated with the data packet to be processed.
  • S103 Send the to-be-processed data packet with tag information added to the designated CPU core.
  • the designated CPU core is the CPU core in the multi-core CPU, which can be flexibly set according to actual needs.
  • S101-S103 can be executed by the data receiving hardware device in the communication device.
  • the data receiving hardware device it can be an Ethernet card, PON MAC (hardware for receiving optical fiber downlink data in a passive optical network device) Wait.
  • the CPU core information look-up table may be stored in the data receiving hardware device.
  • the CPU core information look-up table may also be stored in other hardware devices.
  • the CPU core reachable by the data receiving hardware device that is, the data hardware receiving device can send the data packet to be processed to the CPU core
  • S104 The designated CPU core sends the to-be-processed data packet to the target CPU core for processing based on the label information of the to-be-processed data packet.
  • the target CPU core processing the data packet to be processed includes forwarding the data packet to be processed.
  • the data packet to be processed needs to be sent to an external device, and the target CPU core will wait The processed data packet is sent to the corresponding external device, among which the to-be-processed data packet can be sent to the corresponding external device through the egress network card; another case is that the to-be-processed data packet needs to be terminated locally, and the target CPU core will be processed The data packet is sent to the corresponding local data packet processing process for processing.
  • the target CPU core when the target CPU core performs forwarding processing on the data packet to be processed, it may also perform ordinary forwarding processing on the data packet to be processed.
  • S201 Specify a CPU core to select a CPU core from all CPU cores included in the multi-core CPU according to a preset algorithm as a target CPU core for the data packet to be processed.
  • the designated CPU core may also determine the target CPU core for the to-be-processed data packet according to the CPU core information look-up table.
  • the designated CPU core can first determine the target CPU core for the data packet to be processed according to the CPU core information look-up table. If there is no 5 TUPLE of the data packet to be processed in the CPU core information look-up table, the designated CPU core can be based on a preset algorithm A CPU core is selected from all the CPU cores included in the multi-core CPU as the target CPU core of the data packet to be processed, or the designated CPU core can directly use itself as the target CPU core.
  • the data packet processing method provided by the embodiment of the present invention determines the target CPU core from all the CPU cores included in the multi-core CPU by receiving the to-be-processed data packet and determines the target CPU core for the to-be-processed data packet, and adds label information to the to-be-processed data packet based on the target CPU core,
  • the tag information includes the target CPU core
  • the data packet to be processed with the tag information is sent to the designated CPU core
  • the designated CPU core sends the data packet to be processed to the target CPU core for processing based on the label information of the data packet to be processed.
  • the target CPU core is selected from all the CPU cores of the multi-core CPU to process the data packet to be processed, so that each CPU core of the multi-core CPU can be fully utilized and the data processing performance of the communication device is improved.
  • FIG. 3 is a flowchart of a data packet processing method provided by an embodiment of the present invention.
  • the data packet processing method is applied to a communication device including a multi-core CPU. It should be understood that a multi-core CPU includes at least two CPUs.
  • the core CPU, the data packet processing method includes:
  • the data receiving hardware device in the communication device receives data packets sent by other external devices.
  • S302 Determine whether there are 5 TUPLEs of the data packet to be processed in the CPU core information look-up table.
  • the CPU core information lookup table includes 5 TUPLE and the CPU core mapping relationship. It should be understood that the CPU core included in the CPU core information lookup table is the CPU core in the multi-core CPU of the communication device.
  • the data receiving hardware device judges whether there is 5TUPLE of the data packet to be processed in the CPU core information lookup table based on the CPU core information lookup table stored in the data receiving hardware device. , Go to S303; if not, go to S304.
  • the data receiving hardware device finds the mapping relationship between the corresponding 5 TUPLE and the CPU core from the CPU core information table based on the 5 TUPLE of the data packet to be processed, and uses the CPU core as the target CPU core.
  • the data receiving hardware device adds tag information to the data packet to be processed based on the target CPU core.
  • the tag information includes the target CPU core, where the tag information can be inserted into the data packet to be processed.
  • the data receiving hardware device sends the to-be-processed data packet with the tag information added to the designated CPU core, and the designated CPU core can be flexibly set according to actual needs.
  • S306 Send the to-be-processed data packet directly to the designated CPU core.
  • S307 The designated CPU core judges whether there is label information in the data packet to be processed.
  • the designated CPU core determines whether there is label information in the data packet to be processed, if yes, go to S308; if not, go to S309.
  • S308 The designated CPU core sends the to-be-processed data packet to the target CPU core according to the label information of the to-be-processed data packet.
  • the method of specifying the CPU core as the data packet to be processed and determining the target CPU core includes:
  • S401 The designated CPU core judges whether there are 5 TUPLEs of the data packet to be processed in the CPU core information look-up table.
  • the designated CPU core searches the CPU core information lookup table for the CPU core corresponding to the 5 TUPLE of the to-be-processed data packet as the target CPU core.
  • the designated CPU core selects a CPU core from all the CPU cores included in the multi-core CPU according to a preset algorithm as the target CPU core of the data packet to be processed.
  • the preset algorithm is the most idle method, that is, according to the load status of each CPU core, the CPU core with the least load (that is, the most idle) is selected as the target CPU core.
  • the preset algorithm may also be a round robin method or a hash method.
  • the designated CPU core sends the to-be-processed data packet to the target CPU core.
  • S311 The target CPU core forwards the data packet to be processed.
  • the target CPU core sends the to-be-processed data packet to the corresponding external device; if the to-be-processed data packet needs to be terminated locally, the target CPU core sends the to-be-processed data packet to The local packet processing process performs processing.
  • the target CPU core can quickly forward the data packet to be processed based on the fast forwarding table; or, the target CPU core can also perform ordinary forwarding processing on the data packet to be processed.
  • the data packet processing method provided by the embodiment of the present invention determines the target CPU core from all the CPU cores included in the multi-core CPU by receiving the to-be-processed data packet and determines the target CPU core for the to-be-processed data packet, and adds label information to the to-be-processed data packet based on the target CPU core,
  • the tag information includes the target CPU core
  • the data packet to be processed with the tag information is sent to the designated CPU core
  • the designated CPU core sends the data packet to be processed to the target CPU core for processing based on the label information of the data packet to be processed.
  • the target CPU core is selected from all the CPU cores of the multi-core CPU to process the data packet to be processed, so that each CPU core of the multi-core CPU can be fully utilized and the data processing performance of the communication device is improved.
  • the embodiment of the present invention provides a data packet processing device on the basis of the first and second embodiments. As shown in FIG. 5, it includes a multi-core CPU 51 and a hardware data receiving module 52.
  • the multi-core CPU 51 includes N CPU cores, and N is greater than An integer equal to 2, one of the CPU cores in the multi-core CPU 51 is a designated CPU core.
  • Each CPU core includes a processing module, and a designated CPU core also includes a sub-core module.
  • the CPU core 1 is the designated CPU core 511.
  • each CPU core includes a processing module 512, and the designated CPU core also includes a sub-core module 513.
  • the hardware data receiving module 52 is used to receive the to-be-processed data packet and determine the target CPU core from all the CPU cores included in the multi-core CPU 51 for the to-be-processed data packet, and add a tag to the to-be-processed data packet based on the target CPU core Information, the data packet to be processed with tag information is sent to the designated CPU core 511, and the tag information includes the target CPU core.
  • the hardware data receiving module 52 determines the target CPU core from all the CPU cores included in the multi-core CPU 51 for the data packet to be processed, which may be: selecting a CPU core from all the CPU cores included in the multi-core CPU 51 as the target CPU core based on a preset algorithm,
  • the preset algorithm may include at least one of the following algorithms: round robin method, hash method, and least idle method.
  • round robin method that is to say, the target CPU core is selected in turn.
  • the hash method the hash value of certain fields (such as 5-TUPLE) in the data packet to be processed is calculated, and the target CPU core is determined by certain bits in the hash value.
  • the most idle method that is, according to the load status of each CPU core, the CPU core with the least load (that is, the most idle) is selected as the target CPU core.
  • the preset algorithm may also be other algorithms.
  • the hardware data receiving module 52 determines the target CPU core from all the CPU cores included in the multi-core CPU 51 for the data packet to be processed. It can also be: look up the 5 TUPLE (five tuple) corresponding to the data packet to be processed from the CPU core information lookup table.
  • the CPU core serves as the target CPU core.
  • the 5 TUPLE of the data packet is a parameter composed of 5 fields of the data packet's source IP (Internet Protocol, interconnection protocol between networks) address, destination IP address, source port, destination port, and protocol.
  • the CPU core information lookup table includes the mapping relationship between 5 TUPLE and the CPU core. It should be understood that the CPU core included in the CPU core information lookup table is the CPU core in the multi-core CPU51 of the communication device.
  • Table 1 is An optional lookup table for CPU core information. Assuming that the 5 TUPLE of the data packet to be processed matches the third 5 TUPLE data, see Table 1. The corresponding CPU core is the second CPU core, so the second CPU core As the target CPU core of the packet to be processed.
  • mapping relationship between 5 TUPLE and CPU core in the CPU core information lookup table can be preset by the developer, or based on the 5 TUPLE of the pending data packet received in history and the CPU core that processes the data packet.
  • OK that is to say, after receiving the to-be-processed data packet and sending the to-be-processed data packet to the corresponding CPU core for processing, save the 5 TUPLE of the to-be-processed data packet and the corresponding CPU core update to the CPU core information search table.
  • the above-mentioned two hardware data receiving modules 52 can also be combined to determine the target CPU core for the data packet to be processed.
  • the CPU core information look-up table can be first searched for the 5 TUPLE corresponding to the data packet to be processed.
  • one CPU core can be selected from all the CPU cores included in the multi-core CPU 51 as the target CPU core based on a preset algorithm.
  • the hardware data receiving module 52 After the hardware data receiving module 52 determines the target CPU core for the data packet to be processed, it adds tag information to the data packet to be processed based on the target CPU core and sends it to the designated CPU core 511.
  • the tag information includes the target CPU core and tag information. It can be inserted into the to-be-processed data packet or into other fields associated with the to-be-processed data packet.
  • the processing module 512 of the target CPU core is configured to process the data packet to be processed after receiving the data packet to be processed.
  • the processing module 512 processes the to-be-processed data packet including forwarding the to-be-processed data packet. There are two cases.
  • the to-be-processed data packet needs to be sent to an external device, and the processing module 512 sends the to-be-processed data packet to the corresponding In the external device, the to-be-processed data packet can be sent to the corresponding external device through the egress network card; in another case, the to-be-processed data packet needs to be terminated locally, and the processing module 512 sends the to-be-processed data packet to the corresponding The local packet processing process performs processing.
  • the processing module 512 may include a fast forwarding module 5121 and a normal forwarding module 5122.
  • the data packet to be processed can be quickly forwarded by the fast forwarding module 5121.
  • the data packet to be processed can be quickly forwarded based on the fast forwarding table.
  • the fast forwarding table is established based on the 5-TUPLE of the data packet, which includes the egress of the data packet and the fields that need to be modified.
  • the fast forwarding process is performed on the data packet to be processed, it is based on the 5-TUPLE of the data packet to be processed.
  • the ordinary forwarding module 5122 may also perform ordinary forwarding processing on the data packet to be processed.
  • the to-be-processed data packet received by the sub-core module 513 from the hardware data receiving module 52 may not include tag information or the target CPU core may not be included in the tag information. Therefore, as shown in FIG. 6, the designated CPU core 511 also A decision module 514 is included, which is used to determine a target CPU core from all the CPU cores included in the multi-core CPU 51 for a data packet to be processed that does not include tag information or does not include the target CPU core in the tag information.
  • the decision module 514 can directly use the CPU core (that is, the designated CPU core 511) as the target CPU core, or the decision module 514 can also select a CPU core from all the CPU cores included in the multi-core CPU 51 based on a preset algorithm.
  • a learning module (not shown in FIG. 6) may also be included for obtaining 5 TUPLE and corresponding processing of the data packet to be processed after the decision module 514 selects the target CPU core for the data packet to be processed
  • the CPU core information of the data packet to be processed is sent to the hardware data receiving module 52, and the hardware data receiving module 52 adds it to the CPU core information look-up table based on the received 5 TUPLE and corresponding CPU core information.
  • the learning module can be set in the designated CPU core 511 and/or the target CPU core.
  • the learning module can obtain the 5 TUPLE of the data packet to be processed and the corresponding CPU core information for processing the data packet from the decision module 514, or obtain the 5 TUPLE of the data packet to be processed and the corresponding processing from the processing module 512
  • the CPU core information of the data packet to be processed is obtained, for example, from a fast forwarding module or a common forwarding module.
  • the hardware data receiving module 52 may be implemented by a data receiving hardware device, and the data receiving hardware device may be an Ethernet card, or a PON MAC or other hardware devices.
  • the data packet processing device determines the target CPU core from all the CPU cores included in the multi-core CPU by receiving the to-be-processed data packet and determines the target CPU core for the to-be-processed data packet, and adds label information to the to-be-processed data packet based on the target CPU core,
  • the tag information includes the target CPU core
  • the data packet to be processed with the tag information is sent to the designated CPU core
  • the designated CPU core sends the data packet to be processed to the target CPU core for processing based on the label information of the data packet to be processed.
  • the target CPU core is selected from all the CPU cores of the multi-core CPU to process the data packet to be processed, so that each CPU core of the multi-core CPU can be fully utilized and the data processing performance of the communication device is improved.
  • the data packet processing device includes a multi-core CPU 51 and a hardware data receiving module 52.
  • the multi-core CPU 51 includes N CPU cores, where N is an integer greater than or equal to 2, and the CPU core 1 in the multi-core CPU is the designated CPU core 511.
  • each CPU core includes a processing module 512 and a learning module 515.
  • the processing module 512 includes a fast forwarding module 5121 and a normal forwarding module 5122; the designated CPU core 511 also includes a sub-core module 513 and a decision module 514.
  • the hardware data receiving module 52 is used to find the CPU core corresponding to 5 TUPLE of the to-be-processed data packet from the CPU core information look-up table as the target CPU core after receiving the to-be-processed data packet, and based on the target CPU core in the to-be-processed
  • the tag information is inserted into the field of the data packet, and the to-be-processed data packet with the tag information inserted is sent to the sub-core module 513 of the designated CPU core 511.
  • the tag information includes the target CPU core.
  • the CPU core information lookup table includes 5 TUPLE and CPU core mapping relationships. If there is no 5TUPLE of the data packet to be processed in the CPU core information look-up table, the hardware data receiving module 52 directly sends the data packet to be processed to the sub-core module 513.
  • the sub-core module 513 is configured to, after receiving the to-be-processed data packet sent by the hardware data receiving module 52, determine whether the to-be-processed data packet has tag information and whether there is a target CPU core in the tag information, and if the to-be-processed data packet has tag information , And the tag information includes the target CPU core. In order to improve the forwarding speed, the sub-core module 513 can directly send the to-be-processed data packet to the fast forwarding module 5121 in the target CPU core; if the tag information does not exist, or the tag information does not If the target CPU core exists, the to-be-divided core module 513 sends the to-be-processed data packet to the decision module 514.
  • the decision module 514 After receiving the data packet to be processed, the decision module 514 searches the CPU core information look-up table for the CPU core corresponding to 5 TUPLE of the data packet to be processed as the target CPU core. If there is no data packet to be processed in the CPU core information look-up table 5 TUPLE, the decision module 514 selects a CPU core from all the CPU cores included in the multi-core CPU 51 as the target CPU core of the data packet to be processed according to the preset algorithm, and sends it to the normal forwarding module 5122 of the target CPU core.
  • the preset algorithm may be at least one of a round robin method, a hash method, and a least idle method.
  • the fast forwarding module 5121 is configured to fast forward the to-be-processed data packet based on the fast-forwarding table after receiving the to-be-processed data packet sent by the sub-core module 513.
  • the specific process can be referred to the foregoing record and will not be repeated here.
  • the normal forwarding module 5122 is configured to perform normal forwarding processing on the to-be-processed data packet sent by the decision module 514.
  • the data packet processing device determines the target CPU core from all the CPU cores included in the multi-core CPU for the data packet to be processed through the hardware data receiving module, adds tag information based on the target CPU core, and adds the tag information to be processed
  • the data packet is sent to the designated CPU core, so that the designated CPU core can directly send the to-be-processed data packet to the fast forwarding module of the target CPU core for fast forwarding according to the label information, so that the forwarding module of the device can be executed in parallel on multiple cores, which improves Data processing performance of communication equipment.
  • This embodiment also provides a communication device. As shown in FIG. 8, it includes a processor 801, a memory 802, and a communication bus 803.
  • the processor 801 includes at least one multi-core CPU, and the multi-core CPU includes at least two CPU cores, wherein:
  • the communication bus 803 is used to implement connection and communication between the processor 801 and the memory 802;
  • the processor 801 is configured to execute one or more computer programs stored in the memory 802 to implement at least one step in the data packet processing method in the first embodiment and the second embodiment.
  • This embodiment also provides a storage medium that includes volatile or non-volatile memory implemented in any method or technology for storing information (such as computer-readable instructions, data structures, computer program modules, or other data). Volatile, removable or non-removable media.
  • Computer-readable storage media include but are not limited to RAM (Random Access Memory), ROM (Read-Only Memory, read-only memory), EEPROM (Electrically Erasable Programmable Read-Only Memory, charged erasable programmable read-only memory) Storage), flash memory or other storage technologies, CD-ROM (Compact Disc Read-Only Memory), digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices Or any other medium that can be used to store desired information and can be accessed by a computer.
  • the storage medium in this embodiment can be used to store one or more computer programs, and the stored one or more computer programs can be executed by a processor to implement the data packet processing methods in the first embodiment and the second embodiment. At least one step.
  • the data packet processing method, device, communication device and storage medium determine the target CPU core from all the CPU cores included in the multi-core CPU by receiving the to-be-processed data packet and determine the target CPU core for the to-be-processed data packet, based on the target CPU core being Add label information to the data packet to be processed, where the label information includes the target CPU core, and send the data packet to be processed after adding the label information to the designated CPU core, and the designated CPU core sends the data packet to be processed based on the label information of the data packet to be processed Send to the target CPU core for processing.
  • the target CPU core is selected from all the CPU cores of the multi-core CPU to process the data packets to be processed, so that each CPU core of the multi-core CPU can be fully utilized and the communication equipment's performance is improved. Data processing performance.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

A data packet processing method and apparatus, a communication device, and a storage medium. The method comprises: receiving a data packet to be processed and determining for the data packet a target CPU core from among all CPU cores comprised by a multi-core CPU (S101); on the basis of the target CPU core, adding tag information to the data packet (S102), the tag information comprising the target CPU core; sending to a designated CPU core the data packet to which the tag information has been added (S103); and on the basis of the tag information of the data packet, the designated CPU core sends the data packet to the target CPU core for processing (S104).

Description

数据包处理方法、装置、通信设备及存储介质Data packet processing method, device, communication equipment and storage medium
相关申请的交叉引用Cross-references to related applications
本申请基于申请号为201910984845.1、申请日为2019年10月16日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本申请作为参考。This application is based on a Chinese patent application whose application number is 201910984845.1, and the filing date is October 16, 2019, and claims the priority of the Chinese patent application. The entire content of the Chinese patent application is hereby incorporated into this application by reference.
技术领域Technical field
本发明实施例涉及但不限于通信领域,具体而言,涉及但不限于数据包处理方法、装置、通信设备及存储介质。The embodiments of the present invention relate to, but are not limited to, the field of communications, in particular, to, but are not limited to, data packet processing methods, devices, communication equipment, and storage media.
背景技术Background technique
数据处理性能一直是通信设备的一个重要指标。如今多核CPU(central processing unit,中央处理器)已经越来越普及,从两核,四核到八核,在通信设备中也越来越多的采用多核CPU。但是,在一些情形中,数据接收硬件设备只能将数据包送往多核CPU中的一个CPU核心(或是送往的CPU核心数少于CPU的全部核心数),从而导致其他CPU核心处于空闲状态,无法充分利用所有的CPU核心,降低了通信设备的数据处理性能。Data processing performance has always been an important indicator of communication equipment. Nowadays, multi-core CPU (central processing unit, central processing unit) has become more and more popular, from two-core, four-core to eight-core, and more and more multi-core CPUs are used in communication equipment. However, in some cases, the data receiving hardware device can only send the data packet to one CPU core in the multi-core CPU (or the number of CPU cores sent is less than the total number of CPU cores), resulting in other CPU cores being idle Status, unable to make full use of all CPU cores, reducing the data processing performance of communication equipment.
发明内容Summary of the invention
本发明实施例提供的数据包处理方法、装置、通信设备及存储介质,主要旨在至少一定程度上解决的技术问题是数据接收硬件设备只能将数据包送往多核CPU中的一个CPU核心(或是送往的CPU核心数少于CPU的全部核心数),无法充分利用所有的CPU核心,通信设备的数据处理性能低的问题。The data packet processing method, device, communication device, and storage medium provided by the embodiments of the present invention mainly aim to solve the technical problem at least to a certain extent that the data receiving hardware device can only send the data packet to one CPU core in the multi-core CPU ( Or the number of CPU cores sent is less than the total number of CPU cores), it is impossible to make full use of all the CPU cores, and the data processing performance of the communication equipment is low.
为至少在一定程度上解决在一些情形中的上述技术问题,本发明实施例提供一种数据包处理方法,应用于包括多核CPU中央处理器的通信设备,所述多核CPU包括至少两个CPU核心,所述方法包括:接收待处理数据包并为所述待处理数据包从所述多核CPU包括的所有CPU核心中确定目标CPU核心;基于所述目标CPU核心为所述待处理数据包添加标签信息,所述标签信息中包括所述目标CPU核心;将添加标签信息后的所述待处理数据包发送给指定CPU核心;所述指定CPU核心基于所述待处理数据包的标签信息将所述待处理数据包发送给所述目标CPU核心进行处理。In order to solve the above-mentioned technical problems in some situations at least to a certain extent, embodiments of the present invention provide a data packet processing method, which is applied to a communication device including a multi-core CPU central processing unit, and the multi-core CPU includes at least two CPU cores. , The method includes: receiving a data packet to be processed and determining a target CPU core for the data packet to be processed from all CPU cores included in the multi-core CPU; and tagging the data packet to be processed based on the target CPU core Information, the tag information includes the target CPU core; the data packet to be processed with the tag information is sent to a designated CPU core; the designated CPU core sends the data packet to the designated CPU core based on the label information of the data packet to be processed The data packet to be processed is sent to the target CPU core for processing.
本发明实施例还提供一种数据包处理装置,所述数据包处理装置包括多核CPU和硬件数据接收模块,所述多核CPU中的其中一个CPU核心为指定CPU核心;所述硬件数据接收模块,用于接收待处理数据包并为所述待处理数据包从所述多核CPU包括的至少两个CPU核心中确定目标CPU核心,基于所述目标CPU核心为所述待处理数据包添加标签信息,将添加标签信息后的所述待处理数据包发送给所述指定CPU核心,所述标签信息中包括目标CPU核心;所述指定CPU核心包括分核模块,用于基于所述待处理数据包的标签信息将所 述待处理数据包发送给所述目标CPU核心;所述目标CPU核心包括处理模块,用于对所述待处理数据包进行处理。The embodiment of the present invention also provides a data packet processing device, the data packet processing device includes a multi-core CPU and a hardware data receiving module, one of the CPU cores in the multi-core CPU is a designated CPU core; the hardware data receiving module, For receiving a data packet to be processed and determining a target CPU core for the data packet to be processed from at least two CPU cores included in the multi-core CPU, and adding label information to the data packet to be processed based on the target CPU core, Send the to-be-processed data packet with tag information to the designated CPU core, the tag information includes the target CPU core; the designated CPU core includes a sub-core module, used for processing based on the to-be-processed data packet The label information sends the data packet to be processed to the target CPU core; the target CPU core includes a processing module for processing the data packet to be processed.
本发明实施例还提供一种通信设备,包括处理器、存储器及通信总线,所述处理器包括至少一个多核CPU;所述通信总线用于实现所述处理器和存储器之间的连接通信;所述处理器用于执行存储器中存储的一个或者多个计算机程序,以实现上述数据包处理方法的步骤。An embodiment of the present invention also provides a communication device, including a processor, a memory, and a communication bus. The processor includes at least one multi-core CPU; the communication bus is used to implement connection and communication between the processor and the memory; The processor is used to execute one or more computer programs stored in the memory to implement the steps of the foregoing data packet processing method.
本发明实施例还提供一种存储介质,所述可读存储介质存储有一个或者多个程序,所述一个或者多个程序可被一个或者多个处理器执行,以实现上述数据包处理方法的步骤。The embodiment of the present invention further provides a storage medium, the readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the above-mentioned data packet processing method. step.
本发明其他特征和相应的有益效果在说明书的后面部分进行阐述说明,且应当理解,至少部分有益效果从本发明说明书中的记载变的显而易见。Other features and corresponding beneficial effects of the present invention are described in the latter part of the specification, and it should be understood that at least part of the beneficial effects will become apparent from the description in the specification of the present invention.
附图说明Description of the drawings
图1为本发明实施例一的数据包处理方法流程图;FIG. 1 is a flowchart of a data packet processing method according to Embodiment 1 of the present invention;
图2为本发明实施例一的指定CPU核心为待处理数据包确定目标CPU核心的流程图;2 is a flowchart of determining a target CPU core for a data packet to be processed by specifying a CPU core according to Embodiment 1 of the present invention;
图3为本发明实施例二的数据包处理方法流程图;Fig. 3 is a flowchart of a data packet processing method according to the second embodiment of the present invention;
图4为本发明实施例二的指定CPU核心为待处理数据包确定目标CPU核心的流程图;4 is a flowchart of determining a target CPU core for a designated CPU core as a data packet to be processed according to the second embodiment of the present invention;
图5为本发明实施例三的数据包处理装置结构示意图;FIG. 5 is a schematic structural diagram of a data packet processing device according to the third embodiment of the present invention;
图6为本发明实施例三的数据包处理装置详细结构示意图;FIG. 6 is a schematic diagram of a detailed structure of a data packet processing device according to the third embodiment of the present invention;
图7为本发明实施例四的数据包处理装置详细结构示意图;FIG. 7 is a schematic diagram of a detailed structure of a data packet processing device according to the fourth embodiment of the present invention;
图8为本发明实施例五的通信设备结构示意图。FIG. 8 is a schematic structural diagram of a communication device according to Embodiment 5 of the present invention.
具体实施方式Detailed ways
为了使本发明的目的、技术方案及优点更加清楚明白,下面通过具体实施方式结合附图对本发明实施例作进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。In order to make the objectives, technical solutions, and advantages of the present invention clearer, the following further describes the embodiments of the present invention in detail through specific implementations in conjunction with the accompanying drawings. It should be understood that the specific embodiments described here are only used to explain the present invention, but not to limit the present invention.
实施例一:Example one:
为了至少在一定程度上解决数据接收硬件设备只能将数据包送往多核CPU中的一个CPU核心或是送往的CPU核心数少于CPU的全部核心数,无法充分利用所有的CPU核心,从而导致通信设备的数据处理性能低的问题,本发明实施例提供一种数据包处理方法,该数据包处理方法应用于包括多核CPU的通信设备,应当理解的是,多核CPU为包括至少两个CPU核心的CPU。请参见图1所示,该数据包处理方法包括:In order to solve at least to a certain extent, the data receiving hardware device can only send the data packet to one CPU core in the multi-core CPU or the number of CPU cores sent to is less than the total number of CPU cores, and cannot make full use of all the CPU cores, thus Leading to the problem of low data processing performance of communication devices, embodiments of the present invention provide a data packet processing method, which is applied to a communication device including a multi-core CPU. It should be understood that a multi-core CPU includes at least two CPUs. The core CPU. As shown in Figure 1, the data packet processing method includes:
S101、接收待处理数据包并为待处理数据包从多核CPU包括的所有CPU核心中确定目标CPU核心。S101. Receive a to-be-processed data packet and determine a target CPU core from all CPU cores included in the multi-core CPU for the to-be-processed data packet.
本发明实施例中,通信设备接收外部设备发送的数据包,此时,该数据包还未处理,因此将其作为待处理数据包。通信设备在接收到待处理数据包之后,为待处理数据包从多核CPU包括的所有CPU核心中确定目标CPU核心,也即为待处理数据包从多核CPU包括的 所有CPU核心中选择一个CPU核心作为目标CPU核心。In the embodiment of the present invention, the communication device receives the data packet sent by the external device. At this time, the data packet has not been processed, so it is regarded as the data packet to be processed. After receiving the data packet to be processed, the communication device determines the target CPU core from all the CPU cores included in the multi-core CPU for the data packet to be processed, that is, selects a CPU core from all the CPU cores included in the multi-core CPU for the data packet to be processed As the target CPU core.
本发明实施例中,通信设备为待处理数据包从多核CPU包括的所有CPU核心中确定目标CPU核心可以是:基于预设算法从多核CPU包括的所有CPU核心中选择一个CPU核心作为目标CPU核心,其中,预设算法包括以下算法中的至少一个:轮转法、hash(哈希)法、最空闲法。对于轮转法,即采用轮流的方式来选择目标CPU核心,例如,假设多核CPU包括CPU核心1、CPU核心2、CPU核心3,在接收到待处理数据包后,选择CPU核心1作为目标CPU核心,在又接收到待处理数据包后,选择CPU核心2作为目标CPU核心,在又接收到待处理数据包后,选择CPU核心3作为目标CPU核心,在又接收到待处理数据包后,选择CPU核心1作为目标CPU核心,并以此循环。对于hash法,即通过计算待处理数据包中的某几个字段(比如5-TUPLE,即五元组,需要说明的是,数据包的5-TUPLE为该数据包的源IP(Internet Protocol,网络之间互连的协议)地址、目的IP地址、源端口、目的端口、协议5个字段组成的参数)的hash值,并由hash值中的某几位来决定选择目标CPU核心。对于最空闲法,即根据各CPU核心的负载状态,从中选择负载最小(即最空闲)的CPU核心作为目标CPU核心。当然,本发明实施例中,预设算法还可以是其他算法。In the embodiment of the present invention, the communication device determines the target CPU core from all the CPU cores included in the multi-core CPU for the data packet to be processed, which may be: selecting a CPU core from all the CPU cores included in the multi-core CPU based on a preset algorithm as the target CPU core , Where the preset algorithm includes at least one of the following algorithms: round robin, hash (hash) method, and least idle method. For the round robin method, the target CPU core is selected in turn. For example, suppose a multi-core CPU includes CPU core 1, CPU core 2, and CPU core 3. After receiving the data packet to be processed, select CPU core 1 as the target CPU core After receiving the to-be-processed data packet again, select CPU core 2 as the target CPU core. After receiving the to-be-processed data packet again, select CPU core 3 as the target CPU core. After receiving the to-be-processed data packet again, select CPU core 1 is used as the target CPU core and loops. For the hash method, by calculating certain fields in the data packet to be processed (such as 5-TUPLE, which is a five-tuple, it should be noted that the 5-TUPLE of the data packet is the source IP (Internet Protocol, The protocol for interconnection between networks) address, destination IP address, source port, destination port, protocol parameters consisting of 5 fields) hash value, and the selection of the target CPU core is determined by a few bits in the hash value. For the most idle method, according to the load status of each CPU core, the CPU core with the least load (that is, the most idle) is selected as the target CPU core. Of course, in the embodiment of the present invention, the preset algorithm may also be other algorithms.
本发明实施例中,通信设备为待处理数据包从多核CPU包括的所有CPU核心中确定目标CPU核心也可以是:从CPU核心信息查找表中查找与待处理数据包的5 TUPLE对应的CPU核心作为目标CPU核心。CPU核心信息查找表包括5 TUPLE与CPU核心的映射关系,应当理解的是,CPU核心信息查找表中包括的CPU核心为通信设备的多核CPU中的CPU核心,参见表1所示,表1为一种可选的CPU核心信息查找表,假设待处理数据包的5 TUPLE与第一种5 TUPLE数据匹配,则参见表1,其对应的CPU核心为第一CPU核心,因此将第一CPU核心作为待处理数据包的目标CPU核心。In the embodiment of the present invention, the communication device determines the target CPU core from all the CPU cores included in the multi-core CPU for the data packet to be processed, or it may be: find the CPU core corresponding to the 5 TUPLE of the data packet to be processed from the CPU core information look-up table As the target CPU core. The CPU core information look-up table includes 5 TUPLE and the CPU core mapping relationship. It should be understood that the CPU core included in the CPU core information look-up table is the CPU core in the multi-core CPU of the communication device. See Table 1, which is An optional lookup table for CPU core information. Assuming that the 5 TUPLE of the data packet to be processed matches the first 5 TUPLE data, see Table 1. The corresponding CPU core is the first CPU core, so the first CPU core As the target CPU core of the packet to be processed.
表1Table 1
CPU核心信息查找表CPU core information lookup table
Figure PCTCN2020120353-appb-000001
Figure PCTCN2020120353-appb-000001
本发明实施例中,CPU核心信息查找表中5 TUPLE与CPU核心的映射关系可以由开发人员预先设置,或者,根据历史接收到的待处理数据包的5 TUPLE,以及处理该数据包的CPU核心来确定,也就是说,在接收到待处理数据包并将待处理数据包发送至对应的CPU核心进行处理后,将该待处理数据包的5 TUPLE以及对应的CPU核心更新保存至CPU核心信息查找表。In the embodiment of the present invention, the mapping relationship between the 5 TUPLE and the CPU core in the CPU core information lookup table can be preset by the developer, or the 5 TUPLE of the to-be-processed data packet received in history, and the CPU core that processes the data packet To determine, that is, after receiving the to-be-processed data packet and sending the to-be-processed data packet to the corresponding CPU core for processing, save the 5 TUPLE of the to-be-processed data packet and the corresponding CPU core update to the CPU core information Lookup table.
本发明实施例中,上述两种为待处理数据包确定目标CPU核心的方式还可以结合,例如,可以先从CPU核心信息查找表中查找与待处理数据包的5 TUPLE对应的CPU核心作为 目标CPU核心,在CPU核心信息查找表中不存在待处理数据包的5 TUPLE时,则可以基于预设算法从多核CPU包括的至少两个CPU核心中选择一个CPU核心作为目标CPU核心。In the embodiment of the present invention, the above two methods of determining the target CPU core for the data packet to be processed can also be combined. For example, the CPU core corresponding to the 5 TUPLE of the data packet to be processed can be searched from the CPU core information lookup table as the target. CPU core, when there is no 5 TUPLE of the data packet to be processed in the CPU core information lookup table, one CPU core may be selected as the target CPU core from at least two CPU cores included in the multi-core CPU based on a preset algorithm.
需要说明的是,本发明实施例中,在CPU核心信息查找表中不存在待处理数据包的5TUPLE时,也可以直接将待处理数据包发送给指定CPU核心。It should be noted that, in the embodiment of the present invention, when there is no 5TUPLE of the data packet to be processed in the CPU core information look-up table, the data packet to be processed can also be directly sent to the designated CPU core.
S102、基于目标CPU核心为待处理数据包添加标签信息。S102: Add label information to the data packet to be processed based on the target CPU core.
本发明实施例中,在确定出待处理数据包对应的目标CPU核心后,基于目标CPU核心为待处理数据包添加标签信息,其中,标签信息中包括目标CPU核心。In the embodiment of the present invention, after the target CPU core corresponding to the data packet to be processed is determined, tag information is added to the data packet to be processed based on the target CPU core, where the tag information includes the target CPU core.
本发明实施例中,标签信息可以插入到待处理数据包中,也可以插入到与待处理数据包关联的其他字段。In the embodiment of the present invention, the label information can be inserted into the data packet to be processed, and can also be inserted into other fields associated with the data packet to be processed.
S103、将添加标签信息后的待处理数据包发送给指定CPU核心。S103: Send the to-be-processed data packet with tag information added to the designated CPU core.
本发明实施例中,在为待处理数据包添加标签信息后,将其发送给指定CPU核心,其中,指定CPU核心为多核CPU中的CPU核心,其可以根据实际需要灵活设置哪一CPU核心为指定CPU核心。也就是说,本发明实施例中,在将待处理数据包发送到多核CPU之前,需要为待处理数据包分配一个CPU核心用于处理该待处理数据包。In the embodiment of the present invention, after adding label information to the data packet to be processed, it is sent to the designated CPU core, where the designated CPU core is the CPU core in the multi-core CPU, which can be flexibly set according to actual needs. Specify the CPU core. That is to say, in the embodiment of the present invention, before sending the to-be-processed data packet to the multi-core CPU, a CPU core needs to be allocated to the to-be-processed data packet to process the to-be-processed data packet.
本发明实施例中,可以通过通信设备中的数据接收硬件设备来执行S101-S103,对于数据接收硬件设备,其可以是以太网卡,PON MAC(无源光网络设备中接收光纤下行数据的硬件)等。其中,CPU核心信息查找表可以存储在数据接收硬件设备中,当然,CPU核心信息查找表也可以存储在其他硬件设备中。本发明实施例中,可以将数据接收硬件设备可达的CPU核心(即数据硬件接收设备可以将待处理数据包发送给该CPU核心)设置为指定CPU核心。In the embodiment of the present invention, S101-S103 can be executed by the data receiving hardware device in the communication device. For the data receiving hardware device, it can be an Ethernet card, PON MAC (hardware for receiving optical fiber downlink data in a passive optical network device) Wait. Among them, the CPU core information look-up table may be stored in the data receiving hardware device. Of course, the CPU core information look-up table may also be stored in other hardware devices. In the embodiment of the present invention, the CPU core reachable by the data receiving hardware device (that is, the data hardware receiving device can send the data packet to be processed to the CPU core) can be set as the designated CPU core.
S104、指定CPU核心基于待处理数据包的标签信息将待处理数据包发送给目标CPU核心进行处理。S104: The designated CPU core sends the to-be-processed data packet to the target CPU core for processing based on the label information of the to-be-processed data packet.
本发明实施例中,指定CPU核心在接收到待处理数据包后,基于待处理数据包的标签信息,将待处理数据包发送给目标CPU核心进行处理。若目标CPU核心与指定CPU核心为同一CPU核心,则指定CPU核心直接对该待处理数据包进行处理。In the embodiment of the present invention, after receiving the data packet to be processed, the designated CPU core sends the data packet to be processed to the target CPU core for processing based on the label information of the data packet to be processed. If the target CPU core and the designated CPU core are the same CPU core, the designated CPU core directly processes the data packet to be processed.
本发明实施例中,目标CPU核心对待处理数据包进行处理包括对待处理数据包进行转发处理,包括两种情况,一种情况是,待处理数据包需要发送至外部设备,则目标CPU核心将待处理数据包发送给对应的外部设备,其中,可以通过出口网卡将待处理数据包发送给对应的外部设备;另一种情况是,待处理数据包需要在本地终结,则目标CPU核心将待处理数据包发送至对应的本地数据包处理进程进行处理。In the embodiment of the present invention, the target CPU core processing the data packet to be processed includes forwarding the data packet to be processed. There are two cases. In one case, the data packet to be processed needs to be sent to an external device, and the target CPU core will wait The processed data packet is sent to the corresponding external device, among which the to-be-processed data packet can be sent to the corresponding external device through the egress network card; another case is that the to-be-processed data packet needs to be terminated locally, and the target CPU core will be processed The data packet is sent to the corresponding local data packet processing process for processing.
本发明实施例中,目标CPU核心在对待处理数据包进行转发处理时,可以基于快速转发表对待处理数据包进行快速转发处理。本发明实施例中,快速转发表基于数据包的5-TUPLE建立,其包括数据包的出口和需要修改的字段,在对待处理数据包进行快速转发处理时,基于待处理数据包的5-TUPLE查找到对应的快速转发表,基于快速转发表中需要 修改的字段对待处理数据包进行修改后直接发送给对应的出口(即外部设备或本地数据包处理进程),从而达到数据快速转发的目的。In the embodiment of the present invention, when the target CPU core performs forwarding processing on the data packet to be processed, it may perform fast forwarding processing on the data packet to be processed based on the fast forwarding table. In the embodiment of the present invention, the fast forwarding table is established based on the 5-TUPLE of the data packet, which includes the egress of the data packet and the fields that need to be modified. When the fast forwarding process is performed on the data packet to be processed, it is based on the 5-TUPLE of the data packet to be processed. Find the corresponding fast forwarding table, modify the data packet to be processed based on the fields that need to be modified in the fast forwarding table and send it directly to the corresponding exit (ie, external device or local data packet processing process), so as to achieve the purpose of fast data forwarding.
本发明实施例中,目标CPU核心在对待处理数据包进行转发处理时,也可以对待处理数据包进行普通转发处理。In the embodiment of the present invention, when the target CPU core performs forwarding processing on the data packet to be processed, it may also perform ordinary forwarding processing on the data packet to be processed.
本发明实施例中,在一些情况下,指定CPU核心收到的待处理数据包可能不存在目标CPU(例如,待处理数据包不存在标签信息或标签信息中不存在目标CPU核心),则此时,可以由指定CPU来为待处理数据包从多核CPU包括的所有CPU核心中确定目标CPU核心,并将待处理数据包发送给目标CPU核心进行处理。其中,指定CPU核心可以直接将作为目标CPU核心对待处理数据包进行处理。或者,参见图2所示,指定CPU核心还可以通过以下方式确定目标CPU核心:In the embodiment of the present invention, in some cases, the data packet to be processed received by the designated CPU core may not have the target CPU (for example, the tag information of the data packet to be processed does not exist or the target CPU core does not exist in the tag information). At this time, the designated CPU can determine the target CPU core from all the CPU cores included in the multi-core CPU for the data packet to be processed, and send the data packet to be processed to the target CPU core for processing. Among them, the designated CPU core can directly process the data packet to be processed as the target CPU core. Or, as shown in Figure 2, the designated CPU core can also be used to determine the target CPU core in the following ways:
S201、指定CPU核心根据预设算法从多核CPU包括的所有CPU核心中选择一个CPU核心作为待处理数据包的目标CPU核心。S201: Specify a CPU core to select a CPU core from all CPU cores included in the multi-core CPU according to a preset algorithm as a target CPU core for the data packet to be processed.
其中,预设算法参见前述记载,此处不再赘述。For the preset algorithm, please refer to the aforementioned record, which will not be repeated here.
S202、指定CPU核心将待处理数据包发送给目标CPU核心进行处理。S202: The designated CPU core sends the to-be-processed data packet to the target CPU core for processing.
或者,指定CPU核心还可以根据CPU核心信息查找表为待处理数据包确定目标CPU核心。Alternatively, the designated CPU core may also determine the target CPU core for the to-be-processed data packet according to the CPU core information look-up table.
上述指定CPU核心为待处理数据包确定目标CPU核心的方式还可以结合。例如,指定CPU核心可以先根据CPU核心信息查找表为待处理数据包确定目标CPU核心,若CPU核心信息查找表中不存在待处理数据包的5 TUPLE时,则指定CPU核心可以根据预设算法从多核CPU包括的所有CPU核心中选择一个CPU核心作为待处理数据包的目标CPU核心,或者,指定CPU核心可以直接将自身作为目标CPU核心。The above-mentioned method of specifying the CPU core to determine the target CPU core for the to-be-processed data packet may also be combined. For example, the designated CPU core can first determine the target CPU core for the data packet to be processed according to the CPU core information look-up table. If there is no 5 TUPLE of the data packet to be processed in the CPU core information look-up table, the designated CPU core can be based on a preset algorithm A CPU core is selected from all the CPU cores included in the multi-core CPU as the target CPU core of the data packet to be processed, or the designated CPU core can directly use itself as the target CPU core.
本发明实施例中,指定CPU核心在为待处理数据包选择目标CPU核心后,可以基于待处理数据包的5 TUPLE与处理该待处理数据包的CPU核心更新CPU核心信息查找表,也即将待处理数据包的5 TUPLE与CPU核心的映射关系添加到CPU核心信息查找表中。In the embodiment of the present invention, after the designated CPU core selects the target CPU core for the to-be-processed data packet, it can update the CPU core information look-up table based on the 5 TUPLE of the to-be-processed data packet and the CPU core that processes the to-be-processed data packet. The mapping relationship between the 5 TUPLE and the CPU core that processes the data packet is added to the CPU core information lookup table.
本发明实施例提供的数据包处理方法,通过接收待处理数据包并为待处理数据包从多核CPU包括的所有CPU核心中确定目标CPU核心,基于目标CPU核心为待处理数据包添加标签信息,其中,标签信息中包括目标CPU核心,将添加标签信息后的待处理数据包发送给指定CPU核心,指定CPU核心基于待处理数据包的标签信息将待处理数据包发送给目标CPU核心进行处理,在某些实施过程中,从多核CPU的所有CPU核心中选择目标CPU核心对待处理数据包进行处理,从而可以充分利用多核CPU的各CPU核心,提高了通信设备的数据处理性能。The data packet processing method provided by the embodiment of the present invention determines the target CPU core from all the CPU cores included in the multi-core CPU by receiving the to-be-processed data packet and determines the target CPU core for the to-be-processed data packet, and adds label information to the to-be-processed data packet based on the target CPU core, Wherein, the tag information includes the target CPU core, the data packet to be processed with the tag information is sent to the designated CPU core, and the designated CPU core sends the data packet to be processed to the target CPU core for processing based on the label information of the data packet to be processed. In some implementations, the target CPU core is selected from all the CPU cores of the multi-core CPU to process the data packet to be processed, so that each CPU core of the multi-core CPU can be fully utilized and the data processing performance of the communication device is improved.
实施例二:Embodiment two:
为了更好的理解本发明,本实施例结合更加具体的示例进行说明。参见图3所示,图3为本发明实施例提供的数据包处理方法的流程图,该数据包处理方法应用于包括多核CPU 的通信设备,应当理解的是,多核CPU为包括至少两个CPU核心的CPU,该数据包处理方法包括:In order to better understand the present invention, this embodiment is described in conjunction with more specific examples. Referring to FIG. 3, FIG. 3 is a flowchart of a data packet processing method provided by an embodiment of the present invention. The data packet processing method is applied to a communication device including a multi-core CPU. It should be understood that a multi-core CPU includes at least two CPUs. The core CPU, the data packet processing method includes:
S301、接收待处理数据包。S301. Receive a data packet to be processed.
本发明实施例中,通信设备中的数据接收硬件设备接收其他外部设备发送的数据包。In the embodiment of the present invention, the data receiving hardware device in the communication device receives data packets sent by other external devices.
数据接收硬件设备可以是以太网卡或PON MAC。The data receiving hardware device can be an Ethernet card or a PON MAC.
S302、判断CPU核心信息查找表中是否存在待处理数据包的5 TUPLE。S302: Determine whether there are 5 TUPLEs of the data packet to be processed in the CPU core information look-up table.
若是,转S303;若否,转S306。If yes, go to S303; if not, go to S306.
需要说明的是,CPU核心信息查找表中包括5 TUPLE与CPU核心的映射关系,应当理解的是,CPU核心信息查找表中包括的CPU核心为通信设备的多核CPU中的CPU核心。It should be noted that the CPU core information lookup table includes 5 TUPLE and the CPU core mapping relationship. It should be understood that the CPU core included in the CPU core information lookup table is the CPU core in the multi-core CPU of the communication device.
本发明实施例中,数据接收硬件设备在接收到待处理数据包后,基于数据接收硬件设备中存储的CPU核心信息查找表,判断CPU核心信息查找表中是否存在待处理数据包的5TUPLE,若是,则转S303;若否,转S304。In the embodiment of the present invention, after receiving the data packet to be processed, the data receiving hardware device judges whether there is 5TUPLE of the data packet to be processed in the CPU core information lookup table based on the CPU core information lookup table stored in the data receiving hardware device. , Go to S303; if not, go to S304.
S303、从CPU核心信息查找表中查找与待处理数据包的5 TUPLE对应的CPU核心作为目标CPU核心。S303: Find a CPU core corresponding to 5 TUPLE of the data packet to be processed from the CPU core information look-up table as the target CPU core.
本发明实施例中,数据接收硬件设备基于待处理数据包的5 TUPLE,从CPU核心信息表中查找出对应的5 TUPLE与CPU核心映射关系,将其中的CPU核心作为目标CPU核心。In the embodiment of the present invention, the data receiving hardware device finds the mapping relationship between the corresponding 5 TUPLE and the CPU core from the CPU core information table based on the 5 TUPLE of the data packet to be processed, and uses the CPU core as the target CPU core.
S304、基于目标CPU核心为待处理数据包添加标签信息。S304: Add label information to the data packet to be processed based on the target CPU core.
数据接收硬件设备基于目标CPU核心为待处理数据包添加标签信息,标签信息中包括目标CPU核心,其中,标签信息可以插入到待处理数据包中。The data receiving hardware device adds tag information to the data packet to be processed based on the target CPU core. The tag information includes the target CPU core, where the tag information can be inserted into the data packet to be processed.
S305、将添加标签信息后的待处理数据包发送给指定CPU核心。S305: Send the to-be-processed data packet with the tag information added to the designated CPU core.
数据接收硬件设备将添加标签信息后的待处理数据包发送给指定CPU核心,指定CPU核心可以根据实际需要灵活设置。The data receiving hardware device sends the to-be-processed data packet with the tag information added to the designated CPU core, and the designated CPU core can be flexibly set according to actual needs.
S306、直接将待处理数据包发送给指定CPU核心。S306: Send the to-be-processed data packet directly to the designated CPU core.
S307、指定CPU核心判断待处理数据包中是否存在标签信息。S307: The designated CPU core judges whether there is label information in the data packet to be processed.
若是,转S308;若否,转S309。If yes, go to S308; if not, go to S309.
本发明实施例中,指定CPU核心在接收到待处理数据包后,判断待处理数据包中是否存在标签信息,若是,转S308;若否,转S309。In the embodiment of the present invention, after receiving the data packet to be processed, the designated CPU core determines whether there is label information in the data packet to be processed, if yes, go to S308; if not, go to S309.
S308、指定CPU核心根据待处理数据包的标签信息将待处理数据包发送给目标CPU核心。S308: The designated CPU core sends the to-be-processed data packet to the target CPU core according to the label information of the to-be-processed data packet.
S309、指定CPU核心为待处理数据包从多核CPU包括的所有CPU核心中确定目标CPU核心。S309. Specify the CPU core as the data packet to be processed and determine the target CPU core from all the CPU cores included in the multi-core CPU.
其中,参见图4所示,指定CPU核心为待处理数据包确定目标CPU核心的方式包括:Among them, referring to Figure 4, the method of specifying the CPU core as the data packet to be processed and determining the target CPU core includes:
S401、指定CPU核心判断CPU核心信息查找表中是否存在待处理数据包的5 TUPLE。S401: The designated CPU core judges whether there are 5 TUPLEs of the data packet to be processed in the CPU core information look-up table.
若是,转S402;若否,转S403。If yes, go to S402; if not, go to S403.
S402、指定CPU核心从CPU核心信息查找表中查找与待处理数据包的5 TUPLE对应的CPU核心作为目标CPU核心。S402: The designated CPU core searches the CPU core information lookup table for the CPU core corresponding to the 5 TUPLE of the to-be-processed data packet as the target CPU core.
S403、指定CPU核心根据预设算法从多核CPU包括的所有CPU核心中选择一个CPU核心作为待处理数据包的目标CPU核心。S403: The designated CPU core selects a CPU core from all the CPU cores included in the multi-core CPU according to a preset algorithm as the target CPU core of the data packet to be processed.
其中,预设算法为最空闲法,也即根据各CPU核心的负载状态,从中选择负载最小(即最空闲)的CPU核心作为目标CPU核心。当然,在其他实施例中,预设算法还可以是轮转法、或hash法。Among them, the preset algorithm is the most idle method, that is, according to the load status of each CPU core, the CPU core with the least load (that is, the most idle) is selected as the target CPU core. Of course, in other embodiments, the preset algorithm may also be a round robin method or a hash method.
本发明实施例中,在S403之后,基于待处理数据包的5 TUPLE和为该待处理数据包确定的目标CPU核心,将其更新至CPU核心信息查找表中,也即,将待处理数据包的5 TUPLE和CPU核心的映射关系添加至CPU核心信息查找表中。In the embodiment of the present invention, after S403, based on the 5 TUPLE of the data packet to be processed and the target CPU core determined for the data packet to be processed, it is updated to the CPU core information lookup table, that is, the data packet to be processed is 5 The mapping relationship between TUPLE and CPU core is added to the CPU core information lookup table.
S310、指定CPU核心将待处理数据包发送给目标CPU核心。S310. The designated CPU core sends the to-be-processed data packet to the target CPU core.
S311、目标CPU核心对待处理数据包进行转发处理。S311: The target CPU core forwards the data packet to be processed.
其中,若待处理数据包需要发送给外部设备,则目标CPU核心将待处理数据包发送给对应的外部设备;若待处理数据包需要在本地终结,则目标CPU核心将待处理数据包发送至本地数据包处理进程进行处理。Among them, if the to-be-processed data packet needs to be sent to an external device, the target CPU core sends the to-be-processed data packet to the corresponding external device; if the to-be-processed data packet needs to be terminated locally, the target CPU core sends the to-be-processed data packet to The local packet processing process performs processing.
其中,目标CPU核心可以基于快速转发表对待处理数据包进行快速转发;或者,目标CPU核心也可以对待处理数据包进行普通转发处理。Among them, the target CPU core can quickly forward the data packet to be processed based on the fast forwarding table; or, the target CPU core can also perform ordinary forwarding processing on the data packet to be processed.
本发明实施例提供的数据包处理方法,通过接收待处理数据包并为待处理数据包从多核CPU包括的所有CPU核心中确定目标CPU核心,基于目标CPU核心为待处理数据包添加标签信息,其中,标签信息中包括目标CPU核心,将添加标签信息后的待处理数据包发送给指定CPU核心,指定CPU核心基于待处理数据包的标签信息将待处理数据包发送给目标CPU核心进行处理,在某些实施过程中,从多核CPU的所有CPU核心中选择目标CPU核心对待处理数据包进行处理,从而可以充分利用多核CPU的各CPU核心,提高了通信设备的数据处理性能。The data packet processing method provided by the embodiment of the present invention determines the target CPU core from all the CPU cores included in the multi-core CPU by receiving the to-be-processed data packet and determines the target CPU core for the to-be-processed data packet, and adds label information to the to-be-processed data packet based on the target CPU core, Wherein, the tag information includes the target CPU core, the data packet to be processed with the tag information is sent to the designated CPU core, and the designated CPU core sends the data packet to be processed to the target CPU core for processing based on the label information of the data packet to be processed. In some implementations, the target CPU core is selected from all the CPU cores of the multi-core CPU to process the data packet to be processed, so that each CPU core of the multi-core CPU can be fully utilized and the data processing performance of the communication device is improved.
实施例三:Example three:
本发明实施例在实施例一和实施例二的基础上提供一种数据包处理装置,参见图5所示,包括多核CPU51和硬件数据接收模块52,多核CPU51包括N个CPU核心,N为大于等于2的整数,多核CPU51中的其中一个CPU核心为指定CPU核心。每个CPU核心包括处理模块,指定CPU核心还包括分核模块。本发明实施例中,假设CPU核心1为指定CPU核心511。本发明实施例中,每个CPU核心均包括处理模块512,指定CPU核心还包括分核模块513。The embodiment of the present invention provides a data packet processing device on the basis of the first and second embodiments. As shown in FIG. 5, it includes a multi-core CPU 51 and a hardware data receiving module 52. The multi-core CPU 51 includes N CPU cores, and N is greater than An integer equal to 2, one of the CPU cores in the multi-core CPU 51 is a designated CPU core. Each CPU core includes a processing module, and a designated CPU core also includes a sub-core module. In the embodiment of the present invention, it is assumed that the CPU core 1 is the designated CPU core 511. In the embodiment of the present invention, each CPU core includes a processing module 512, and the designated CPU core also includes a sub-core module 513.
本发明实施例中,硬件数据接收模块52,用于接收待处理数据包并为待处理数据包从多核CPU51包括的所有CPU核心中确定目标CPU核心,基于目标CPU核心为待处理数据包添加标签信息,将添加标签信息后的待处理数据包发送给指定CPU核心511,标签信息中 包括目标CPU核心。In the embodiment of the present invention, the hardware data receiving module 52 is used to receive the to-be-processed data packet and determine the target CPU core from all the CPU cores included in the multi-core CPU 51 for the to-be-processed data packet, and add a tag to the to-be-processed data packet based on the target CPU core Information, the data packet to be processed with tag information is sent to the designated CPU core 511, and the tag information includes the target CPU core.
其中,硬件数据接收模块52为待处理数据包从多核CPU51包括的所有CPU核心中确定目标CPU核心可以是:基于预设算法从多核CPU51包括的所有CPU核心中选择一个CPU核心作为目标CPU核心,其中,预设算法可以包括以下算法中的至少一个:轮转法、hash法、最空闲法。对于轮转法,也就是说,采用轮流的方式来选择目标CPU核心。对于hash法,即通过计算待处理数据包中的某几个字段(比如5-TUPLE)的hash值,并由hash值中的某几位来决定选择目标CPU核心。对于最空闲法,也即根据各CPU核心的负载状态,从中选择负载最小(即最空闲)的CPU核心作为目标CPU核心。当然,本发明实施例中,预设算法还可以是其他算法。Wherein, the hardware data receiving module 52 determines the target CPU core from all the CPU cores included in the multi-core CPU 51 for the data packet to be processed, which may be: selecting a CPU core from all the CPU cores included in the multi-core CPU 51 as the target CPU core based on a preset algorithm, Wherein, the preset algorithm may include at least one of the following algorithms: round robin method, hash method, and least idle method. For the round robin method, that is to say, the target CPU core is selected in turn. For the hash method, the hash value of certain fields (such as 5-TUPLE) in the data packet to be processed is calculated, and the target CPU core is determined by certain bits in the hash value. For the most idle method, that is, according to the load status of each CPU core, the CPU core with the least load (that is, the most idle) is selected as the target CPU core. Of course, in the embodiment of the present invention, the preset algorithm may also be other algorithms.
硬件数据接收模块52为待处理数据包从多核CPU51包括的所有CPU核心中确定目标CPU核心也可以是:从CPU核心信息查找表中查找与待处理数据包的5 TUPLE(五元组)对应的CPU核心作为目标CPU核心。需要说明的是,数据包的5 TUPLE为该数据包的源IP(Internet Protocol,网络之间互连的协议)地址、目的IP地址、源端口、目的端口、协议5个字段组成的参数。CPU核心信息查找表包括5 TUPLE与CPU核心的映射关系,应当理解的是,CPU核心信息查找表中包括的CPU核心为通信设备的多核CPU51中的CPU核心,参见表1所示,表1为一种可选的CPU核心信息查找表,假设待处理数据包的5 TUPLE与第三种5 TUPLE数据匹配,则参见表1,其对应的CPU核心为第二CPU核心,因此将第二CPU核心作为待处理数据包的目标CPU核心。The hardware data receiving module 52 determines the target CPU core from all the CPU cores included in the multi-core CPU 51 for the data packet to be processed. It can also be: look up the 5 TUPLE (five tuple) corresponding to the data packet to be processed from the CPU core information lookup table. The CPU core serves as the target CPU core. It should be noted that the 5 TUPLE of the data packet is a parameter composed of 5 fields of the data packet's source IP (Internet Protocol, interconnection protocol between networks) address, destination IP address, source port, destination port, and protocol. The CPU core information lookup table includes the mapping relationship between 5 TUPLE and the CPU core. It should be understood that the CPU core included in the CPU core information lookup table is the CPU core in the multi-core CPU51 of the communication device. See Table 1, which is An optional lookup table for CPU core information. Assuming that the 5 TUPLE of the data packet to be processed matches the third 5 TUPLE data, see Table 1. The corresponding CPU core is the second CPU core, so the second CPU core As the target CPU core of the packet to be processed.
需要说明的是,CPU核心信息查找表中5 TUPLE与CPU核心的映射关系可以由开发人员预先设置,或者,根据历史接收到的待处理数据包的5 TUPLE,以及处理该数据包的CPU核心来确定,也就是说,在接收到待处理数据包并将待处理数据包发送至对应的CPU核心进行处理后,将该待处理数据包的5 TUPLE以及对应的CPU核心更新保存至CPU核心信息查找表。It should be noted that the mapping relationship between 5 TUPLE and CPU core in the CPU core information lookup table can be preset by the developer, or based on the 5 TUPLE of the pending data packet received in history and the CPU core that processes the data packet. OK, that is to say, after receiving the to-be-processed data packet and sending the to-be-processed data packet to the corresponding CPU core for processing, save the 5 TUPLE of the to-be-processed data packet and the corresponding CPU core update to the CPU core information search table.
本发明实施例中,上述两种硬件数据接收模块52为待处理数据包确定目标CPU核心的方式还可以结合,例如,可以先从CPU核心信息查找表中查找与待处理数据包的5 TUPLE对应的CPU核心作为目标CPU核心,在CPU核心信息查找表中不存在待处理数据包的5 TUPLE时,则可以基于预设算法从多核CPU51包括的所有CPU核心中选择一个CPU核心作为目标CPU核心。In the embodiment of the present invention, the above-mentioned two hardware data receiving modules 52 can also be combined to determine the target CPU core for the data packet to be processed. For example, the CPU core information look-up table can be first searched for the 5 TUPLE corresponding to the data packet to be processed. When there is no 5 TUPLE of the data packet to be processed in the CPU core information look-up table, one CPU core can be selected from all the CPU cores included in the multi-core CPU 51 as the target CPU core based on a preset algorithm.
硬件数据接收模块52为待处理数据包确定目标CPU核心后,基于目标CPU核心为待处理数据包添加标签信息并将其发送给指定CPU核心511,其中,标签信息中包括目标CPU核心,标签信息可以插入到待处理数据包中,也可以插入到与待处理数据包关联的其他字段。After the hardware data receiving module 52 determines the target CPU core for the data packet to be processed, it adds tag information to the data packet to be processed based on the target CPU core and sends it to the designated CPU core 511. The tag information includes the target CPU core and tag information. It can be inserted into the to-be-processed data packet or into other fields associated with the to-be-processed data packet.
指定CPU核心511的分核模块513,用于在接收到硬件数据接收模块52发送的待处理数据包后,基于待处理数据包的标签信息将待处理数据包发送给目标CPU核心。需要说明 的是,在一些情况下,目标CPU核心可能是指定CPU核心511,则此时,指定CPU核心511的处理模块512待待处理数据包进行处理。The sub-core module 513 of the designated CPU core 511 is configured to send the to-be-processed data packet to the target CPU core based on the label information of the to-be-processed data packet after receiving the to-be-processed data packet sent by the hardware data receiving module 52. It should be noted that, in some cases, the target CPU core may be the designated CPU core 511. At this time, the processing module 512 of the designated CPU core 511 is to process the data packet to be processed.
目标CPU核心的处理模块512,用于在接收到待处理数据包后,对待处理数据包进行处理。处理模块512对待处理数据包进行处理包括对待处理数据包进行转发处理,包括两种情况,一种情况是,待处理数据包需要发送至外部设备,则处理模块512将待处理数据包发送给对应的外部设备,其中,可以通过出口网卡将待处理数据包发送给对应的外部设备;另一种情况是,待处理数据包需要在本地终结,则处理模块512将待处理数据包发送至对应的本地数据包处理进程进行处理。The processing module 512 of the target CPU core is configured to process the data packet to be processed after receiving the data packet to be processed. The processing module 512 processes the to-be-processed data packet including forwarding the to-be-processed data packet. There are two cases. In one case, the to-be-processed data packet needs to be sent to an external device, and the processing module 512 sends the to-be-processed data packet to the corresponding In the external device, the to-be-processed data packet can be sent to the corresponding external device through the egress network card; in another case, the to-be-processed data packet needs to be terminated locally, and the processing module 512 sends the to-be-processed data packet to the corresponding The local packet processing process performs processing.
本发明实施例中,参见图6所示,处理模块512可以包括快速转发模块5121,和普通转发模块5122。在对待处理数据包进行转发处理时,可以通过快速转发模块5121对待处理数据包进行快速转发处理。其中,可以基于快速转发表对待处理数据包进行快速转发处理。本发明实施例中,快速转发表基于数据包的5-TUPLE建立,其包括数据包的出口和需要修改的字段,在对待处理数据包进行快速转发处理时,基于待处理数据包的5-TUPLE查找到对应的快速转发表,基于快速转发表中需要修改的字段对待处理数据包进行修改后直接发送给对应的出口(即外部设备或本地数据包处理进程),从而达到数据快速转发的目的。本发明实施例中,也可以通过普通转发模块5122对待处理数据包进行普通转发处理。In the embodiment of the present invention, referring to FIG. 6, the processing module 512 may include a fast forwarding module 5121 and a normal forwarding module 5122. When the data packet to be processed is forwarded, the data packet to be processed can be quickly forwarded by the fast forwarding module 5121. Among them, the data packet to be processed can be quickly forwarded based on the fast forwarding table. In the embodiment of the present invention, the fast forwarding table is established based on the 5-TUPLE of the data packet, which includes the egress of the data packet and the fields that need to be modified. When the fast forwarding process is performed on the data packet to be processed, it is based on the 5-TUPLE of the data packet to be processed. Find the corresponding fast forwarding table, modify the data packet to be processed based on the fields that need to be modified in the fast forwarding table and send it directly to the corresponding exit (ie, external device or local data packet processing process), so as to achieve the purpose of fast data forwarding. In the embodiment of the present invention, the ordinary forwarding module 5122 may also perform ordinary forwarding processing on the data packet to be processed.
在一些情况下,分核模块513从硬件数据接收模块52接收到的待处理数据包可能不包括标签信息或者标签信息中不包括目标CPU核心,因此,参见图6所示,指定CPU核心511还包括决策模块514,用于为不包括标签信息或者标签信息中不包括目标CPU核心的待处理数据包从多核CPU51包括的所有CPU核心中确定目标CPU核心。其中,决策模块514可以直接将自身所在的CPU核心(即指定CPU核心511)作为目标CPU核心,或者,决策模块514也可以基于预设算法从多核CPU51包括的所有CPU核心中选择一个CPU核心作为目标CPU核心,其中,预设算法可以是轮转法、或hash法、或最空闲法。或者,决策模块514也可以从CPU核心信息查找表中查找与待处理数据包的5 TUPLE对应的CPU核心作为目标CPU核心。或者,上述三种方式还可以结合,例如,决策模块514可以先根据CPU核心信息查找表为待处理数据包确定目标CPU核心,若CPU核心信息查找表中不存在待处理数据包的5 TUPLE时,则决策模块514可以根据预设算法从多核CPU51包括的所有CPU核心中选择一个CPU核心作为待处理数据包的目标CPU核心,或者,决策模块514可以直接将自身作为目标CPU核心。决策模块514在选择出目标CPU核心后,将待处理数据包发送给目标CPU核心进行处理。In some cases, the to-be-processed data packet received by the sub-core module 513 from the hardware data receiving module 52 may not include tag information or the target CPU core may not be included in the tag information. Therefore, as shown in FIG. 6, the designated CPU core 511 also A decision module 514 is included, which is used to determine a target CPU core from all the CPU cores included in the multi-core CPU 51 for a data packet to be processed that does not include tag information or does not include the target CPU core in the tag information. Among them, the decision module 514 can directly use the CPU core (that is, the designated CPU core 511) as the target CPU core, or the decision module 514 can also select a CPU core from all the CPU cores included in the multi-core CPU 51 based on a preset algorithm. The target CPU core, where the preset algorithm can be a round robin method, a hash method, or a least idle method. Alternatively, the decision module 514 may also search for the CPU core corresponding to the 5 TUPLE of the data packet to be processed from the CPU core information look-up table as the target CPU core. Alternatively, the above three methods can also be combined. For example, the decision module 514 can first determine the target CPU core for the data packet to be processed according to the CPU core information look-up table. , The decision module 514 can select a CPU core from all the CPU cores included in the multi-core CPU 51 as the target CPU core of the data packet to be processed according to a preset algorithm, or the decision module 514 can directly use itself as the target CPU core. After selecting the target CPU core, the decision module 514 sends the to-be-processed data packet to the target CPU core for processing.
本发明实施例中,还可以包括学习模块(图6中未示出),用于在决策模块514为待处理数据包选择出目标CPU核心后,获取待处理数据包的5 TUPLE和对应的处理该待处理数据包的CPU核心信息,将其发送给硬件数据接收模块52,硬件数据接收模块52基于接收到的5 TUPLE和对应的CPU核心信息,将其添加到CPU核心信息查找表中。其中,学习 模块可以设置在指定CPU核心511和/或目标CPU核心中。学习模块可以从决策模块514去获取获取待处理数据包的5 TUPLE和对应的处理该待处理数据包的CPU核心信息,或者从处理模块512去获取获取待处理数据包的5 TUPLE和对应的处理该待处理数据包的CPU核心信息,例如,从快速转发模块或普通转发模块获取。In the embodiment of the present invention, a learning module (not shown in FIG. 6) may also be included for obtaining 5 TUPLE and corresponding processing of the data packet to be processed after the decision module 514 selects the target CPU core for the data packet to be processed The CPU core information of the data packet to be processed is sent to the hardware data receiving module 52, and the hardware data receiving module 52 adds it to the CPU core information look-up table based on the received 5 TUPLE and corresponding CPU core information. Among them, the learning module can be set in the designated CPU core 511 and/or the target CPU core. The learning module can obtain the 5 TUPLE of the data packet to be processed and the corresponding CPU core information for processing the data packet from the decision module 514, or obtain the 5 TUPLE of the data packet to be processed and the corresponding processing from the processing module 512 The CPU core information of the data packet to be processed is obtained, for example, from a fast forwarding module or a common forwarding module.
本发明实施例中,硬件数据接收模块52可以由数据接收硬件设备来实施,数据接收硬件设备可以是太网卡,或PON MAC或其他硬件设备来实施。In the embodiment of the present invention, the hardware data receiving module 52 may be implemented by a data receiving hardware device, and the data receiving hardware device may be an Ethernet card, or a PON MAC or other hardware devices.
本发明实施例提供的数据包处理装置,通过接收待处理数据包并为待处理数据包从多核CPU包括的所有CPU核心中确定目标CPU核心,基于目标CPU核心为待处理数据包添加标签信息,其中,标签信息中包括目标CPU核心,将添加标签信息后的待处理数据包发送给指定CPU核心,指定CPU核心基于待处理数据包的标签信息将待处理数据包发送给目标CPU核心进行处理,在某些实施过程中,从多核CPU的所有CPU核心中选择目标CPU核心对待处理数据包进行处理,从而可以充分利用多核CPU的各CPU核心,提高了通信设备的数据处理性能。The data packet processing device provided by the embodiment of the present invention determines the target CPU core from all the CPU cores included in the multi-core CPU by receiving the to-be-processed data packet and determines the target CPU core for the to-be-processed data packet, and adds label information to the to-be-processed data packet based on the target CPU core, Wherein, the tag information includes the target CPU core, the data packet to be processed with the tag information is sent to the designated CPU core, and the designated CPU core sends the data packet to be processed to the target CPU core for processing based on the label information of the data packet to be processed. In some implementations, the target CPU core is selected from all the CPU cores of the multi-core CPU to process the data packet to be processed, so that each CPU core of the multi-core CPU can be fully utilized and the data processing performance of the communication device is improved.
实施例四Example four
为了更好的理解本发明,本实施例结合更加具体的示例进行说明。参见图7所示,数据包处理装置包括多核CPU51以及硬件数据接收模块52,多核CPU51包括N个CPU核心,N为大于等于2的整数,多核CPU中的CPU核心1为指定CPU核心511。本发明实施例中,每一个CPU核心均包括处理模块512和学习模块515,处理模块512包括快速转发模块5121和普通转发模块5122;指定CPU核心511还包括分核模块513和决策模块514。In order to better understand the present invention, this embodiment is described in conjunction with more specific examples. As shown in FIG. 7, the data packet processing device includes a multi-core CPU 51 and a hardware data receiving module 52. The multi-core CPU 51 includes N CPU cores, where N is an integer greater than or equal to 2, and the CPU core 1 in the multi-core CPU is the designated CPU core 511. In the embodiment of the present invention, each CPU core includes a processing module 512 and a learning module 515. The processing module 512 includes a fast forwarding module 5121 and a normal forwarding module 5122; the designated CPU core 511 also includes a sub-core module 513 and a decision module 514.
硬件数据接收模块52,用于在接收到待处理数据包后,从CPU核心信息查找表中查找与待处理数据包的5 TUPLE对应的CPU核心作为目标CPU核心,并基于目标CPU核心在待处理数据包的字段中插入标签信息,将插入标签信息的待处理数据包发送给指定CPU核心511的分核模块513。其中,标签信息包括目标CPU核心。CPU核心信息查找表中包括5 TUPLE和CPU核心映射关系。若CPU核心信息查找表中不存在待处理数据包的5 TUPLE,则硬件数据接收模块52直接将待处理数据包发送给分核模块513。The hardware data receiving module 52 is used to find the CPU core corresponding to 5 TUPLE of the to-be-processed data packet from the CPU core information look-up table as the target CPU core after receiving the to-be-processed data packet, and based on the target CPU core in the to-be-processed The tag information is inserted into the field of the data packet, and the to-be-processed data packet with the tag information inserted is sent to the sub-core module 513 of the designated CPU core 511. Among them, the tag information includes the target CPU core. The CPU core information lookup table includes 5 TUPLE and CPU core mapping relationships. If there is no 5TUPLE of the data packet to be processed in the CPU core information look-up table, the hardware data receiving module 52 directly sends the data packet to be processed to the sub-core module 513.
分核模块513用于在接收到硬件数据接收模块52发送的待处理数据包后,判断该待处理数据包是否存在标签信息以及标签信息中是否存在目标CPU核心,若待处理数据包存在标签信息,且并且标签信息中包括目标CPU核心,为了提高转发速度,分核模块513可以直接将待处理数据包发送给目标CPU核心中的快速转发模块5121;若标签信息不存在,或标签信息中不存在目标CPU核心,则待分核模块513将待处理数据包发送给决策模块514。The sub-core module 513 is configured to, after receiving the to-be-processed data packet sent by the hardware data receiving module 52, determine whether the to-be-processed data packet has tag information and whether there is a target CPU core in the tag information, and if the to-be-processed data packet has tag information , And the tag information includes the target CPU core. In order to improve the forwarding speed, the sub-core module 513 can directly send the to-be-processed data packet to the fast forwarding module 5121 in the target CPU core; if the tag information does not exist, or the tag information does not If the target CPU core exists, the to-be-divided core module 513 sends the to-be-processed data packet to the decision module 514.
决策模块514在接收到待处理数据包后,从CPU核心信息查找表中查找与待处理数据包的5 TUPLE对应的CPU核心作为目标CPU核心,若CPU核心信息查找表中不存在待处理数据包的5 TUPLE,则决策模块514根据预设算法从多核CPU51包括的所有CPU核心中选择一个CPU核心作为待处理数据包的目标CPU核心,并将其发送给目标CPU核心的普通转 发模块5122。其中,预设算法可以为轮转法、hash法,最空闲法等中的至少一个。After receiving the data packet to be processed, the decision module 514 searches the CPU core information look-up table for the CPU core corresponding to 5 TUPLE of the data packet to be processed as the target CPU core. If there is no data packet to be processed in the CPU core information look-up table 5 TUPLE, the decision module 514 selects a CPU core from all the CPU cores included in the multi-core CPU 51 as the target CPU core of the data packet to be processed according to the preset algorithm, and sends it to the normal forwarding module 5122 of the target CPU core. Among them, the preset algorithm may be at least one of a round robin method, a hash method, and a least idle method.
快速转发模块5121用于在接收到分核模块513发送的待处理数据包后,基于快速转发表对待处理数据包进行快速转发,具体过程可以参见前述记载,此处不再赘述。The fast forwarding module 5121 is configured to fast forward the to-be-processed data packet based on the fast-forwarding table after receiving the to-be-processed data packet sent by the sub-core module 513. The specific process can be referred to the foregoing record and will not be repeated here.
普通转发模块5122用于在接收到决策模块514发送的待处理数据包后,对其进行普通转发处理。The normal forwarding module 5122 is configured to perform normal forwarding processing on the to-be-processed data packet sent by the decision module 514.
学习模块515用于从其自身所在的CPU核心中的普通转发模块5122中,获取普通转发模块5122中处理的待处理数据包的5 TUPLE和对应的CPU核心信息,将其发送给硬件数据接收模块52,硬件数据接收模块52在接收到5 TUPLE和对应的CPU核心信息后,将其添加到CPU核心信息查找表中。The learning module 515 is used to obtain the 5 TUPLE and corresponding CPU core information of the data packet to be processed in the ordinary forwarding module 5122 from the ordinary forwarding module 5122 in the CPU core where it is located, and send it to the hardware data receiving module 52. After receiving 5 TUPLE and corresponding CPU core information, the hardware data receiving module 52 adds it to the CPU core information look-up table.
本发明实施例提供的数据包处理装置,通过硬件数据接收模块为待处理数据包从多核CPU包括的所有CPU核心中确定目标CPU核心,基于目标CPU核心添加标签信息,将添加标签信息的待处理数据包发送给指定CPU核心,使得指定CPU核心可以直接根据标签信息将待处理数据包发送给目标CPU核心的快速转发模块进行快速转发,从而可以使装置的转发模块在多核上并行执行,提高了通信设备的数据处理性能。The data packet processing device provided by the embodiment of the present invention determines the target CPU core from all the CPU cores included in the multi-core CPU for the data packet to be processed through the hardware data receiving module, adds tag information based on the target CPU core, and adds the tag information to be processed The data packet is sent to the designated CPU core, so that the designated CPU core can directly send the to-be-processed data packet to the fast forwarding module of the target CPU core for fast forwarding according to the label information, so that the forwarding module of the device can be executed in parallel on multiple cores, which improves Data processing performance of communication equipment.
实施例五Example five
本实施例还提供了一种通信设备,参见图8所示,其包括处理器801、存储器802及通信总线803,处理器801包括至少一个多核CPU,多核CPU包括至少两个CPU核心,其中:This embodiment also provides a communication device. As shown in FIG. 8, it includes a processor 801, a memory 802, and a communication bus 803. The processor 801 includes at least one multi-core CPU, and the multi-core CPU includes at least two CPU cores, wherein:
通信总线803用于实现处理器801和存储器802之间的连接通信;The communication bus 803 is used to implement connection and communication between the processor 801 and the memory 802;
处理器801用于执行存储器802中存储的一个或者多个计算机程序,以实现上述实施例一和实施例二中的数据包处理方法中的至少一个步骤。The processor 801 is configured to execute one or more computer programs stored in the memory 802 to implement at least one step in the data packet processing method in the first embodiment and the second embodiment.
本实施例还提供了一种存储介质,该存储介质包括在用于存储信息(诸如计算机可读指令、数据结构、计算机程序模块或其他数据)的任何方法或技术中实施的易失性或非易失性、可移除或不可移除的介质。计算机可读存储介质包括但不限于RAM(Random Access Memory,随机存取存储器),ROM(Read-Only Memory,只读存储器),EEPROM(Electrically Erasable Programmable Read-Only Memory,带电可擦可编程只读存储器)、闪存或其他存储器技术、CD-ROM(Compact Disc Read-Only Memory,光盘只读存储器),数字多功能盘(DVD)或其他光盘存储、磁盒、磁带、磁盘存储或其他磁存储装置、或者可以用于存储期望的信息并且可以被计算机访问的任何其他的介质。This embodiment also provides a storage medium that includes volatile or non-volatile memory implemented in any method or technology for storing information (such as computer-readable instructions, data structures, computer program modules, or other data). Volatile, removable or non-removable media. Computer-readable storage media include but are not limited to RAM (Random Access Memory), ROM (Read-Only Memory, read-only memory), EEPROM (Electrically Erasable Programmable Read-Only Memory, charged erasable programmable read-only memory) Storage), flash memory or other storage technologies, CD-ROM (Compact Disc Read-Only Memory), digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices Or any other medium that can be used to store desired information and can be accessed by a computer.
本实施例中的存储介质可用于存储一个或者多个计算机程序,其存储的一个或者多个计算机程序可被处理器执行,以实现上述实施例一和实施例二中的数据包处理方法中的至少一个步骤。The storage medium in this embodiment can be used to store one or more computer programs, and the stored one or more computer programs can be executed by a processor to implement the data packet processing methods in the first embodiment and the second embodiment. At least one step.
本发明的有益效果是:The beneficial effects of the present invention are:
本发明实施例提供的数据包处理方法、装置、通信设备及存储介质,通过接收待处理 数据包并为待处理数据包从多核CPU包括的所有CPU核心中确定目标CPU核心,基于目标CPU核心为待处理数据包添加标签信息,其中,标签信息中包括目标CPU核心,将添加标签信息后的待处理数据包发送给指定CPU核心,指定CPU核心基于待处理数据包的标签信息将待处理数据包发送给目标CPU核心进行处理,在某些实施过程中,从多核CPU的所有CPU核心中选择目标CPU核心对待处理数据包进行处理,从而可以充分利用多核CPU的各CPU核心,提高了通信设备的数据处理性能。The data packet processing method, device, communication device and storage medium provided by the embodiments of the present invention determine the target CPU core from all the CPU cores included in the multi-core CPU by receiving the to-be-processed data packet and determine the target CPU core for the to-be-processed data packet, based on the target CPU core being Add label information to the data packet to be processed, where the label information includes the target CPU core, and send the data packet to be processed after adding the label information to the designated CPU core, and the designated CPU core sends the data packet to be processed based on the label information of the data packet to be processed Send to the target CPU core for processing. In some implementations, the target CPU core is selected from all the CPU cores of the multi-core CPU to process the data packets to be processed, so that each CPU core of the multi-core CPU can be fully utilized and the communication equipment's performance is improved. Data processing performance.
可见,本领域的技术人员应该明白,上文中所公开方法中的全部或某些步骤、系统、装置中的功能模块/单元可以被实施为软件(可以用计算装置可执行的计算机程序代码来实现)、固件、硬件及其适当的组合。在硬件实施方式中,在以上描述中提及的功能模块/单元之间的划分不一定对应于物理组件的划分;例如,一个物理组件可以具有多个功能,或者一个功能或步骤可以由若干物理组件合作执行。某些物理组件或所有物理组件可以被实施为由处理器,如中央处理器、数字信号处理器或微处理器执行的软件,或者被实施为硬件,或者被实施为集成电路,如专用集成电路。It can be seen that those skilled in the art should understand that all or some of the steps, functional modules/units in the system, and devices in the methods disclosed above can be implemented as software (which can be implemented by computer program code executable by a computing device). ), firmware, hardware and their appropriate combination. In the hardware implementation, the division between functional modules/units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may consist of several physical components. The components are executed cooperatively. Some physical components or all physical components can be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or as hardware, or as an integrated circuit, such as an application specific integrated circuit .
此外,本领域普通技术人员公知的是,通信介质通常包含计算机可读指令、数据结构、计算机程序模块或者诸如载波或其他传输机制之类的调制数据信号中的其他数据,并且可包括任何信息递送介质。所以,本发明不限制于任何特定的硬件和软件结合。In addition, as is well known to those of ordinary skill in the art, communication media usually contain computer-readable instructions, data structures, computer program modules, or other data in a modulated data signal such as carrier waves or other transmission mechanisms, and may include any information delivery medium. Therefore, the present invention is not limited to any specific combination of hardware and software.
以上内容是结合具体的实施方式对本发明实施例所作的进一步详细说明,不能认定本发明的具体实施只局限于这些说明。对于本发明所属技术领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以做出若干简单推演或替换,都应当视为属于本发明的保护范围。The above content is a further detailed description of the embodiments of the present invention in combination with specific implementations, and it cannot be considered that the specific implementations of the present invention are limited to these descriptions. For those of ordinary skill in the technical field to which the present invention belongs, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as belonging to the protection scope of the present invention.

Claims (11)

  1. 一种数据包处理方法,应用于包括多核CPU中央处理器的通信设备,所述多核CPU包括至少两个CPU核心,所述方法包括:A data packet processing method is applied to a communication device including a multi-core CPU central processing unit, the multi-core CPU including at least two CPU cores, and the method includes:
    接收待处理数据包并为所述待处理数据包从所述多核CPU包括的所有CPU核心中确定目标CPU核心;Receiving a data packet to be processed and determining a target CPU core for the data packet to be processed from all CPU cores included in the multi-core CPU;
    基于所述目标CPU核心为所述待处理数据包添加标签信息,所述标签信息中包括所述目标CPU核心;Adding tag information to the data packet to be processed based on the target CPU core, where the tag information includes the target CPU core;
    将添加标签信息后的所述待处理数据包发送给指定CPU核心;Sending the to-be-processed data packet with tag information added to the designated CPU core;
    所述指定CPU核心基于所述待处理数据包的标签信息将所述待处理数据包发送给所述目标CPU核心进行处理。The designated CPU core sends the to-be-processed data packet to the target CPU core for processing based on the label information of the to-be-processed data packet.
  2. 如权利要求1所述的数据包处理方法,其中,所述目标CPU核心对所述待处理数据包进行处理包括:8. The data packet processing method of claim 1, wherein the target CPU core processing the to-be-processed data packet comprises:
    所述目标CPU核心将所述待处理数据包发送给对应的外部设备;The target CPU core sends the to-be-processed data packet to the corresponding external device;
    或,or,
    所述目标CPU核心将所述待处理数据包发送至对应的本地数据包处理进程进行处理。The target CPU core sends the to-be-processed data packet to a corresponding local data packet processing process for processing.
  3. 如权利要求1所述的数据包处理方法,其中,所述目标CPU核心对所述待处理数据包进行处理包括:8. The data packet processing method of claim 1, wherein the target CPU core processing the to-be-processed data packet comprises:
    所述目标CPU核心基于快速转发表对所述待处理数据包进行快速转发。The target CPU core quickly forwards the to-be-processed data packet based on a fast forwarding table.
  4. 如权利要求1-3任一项所述的数据包处理方法,其中,所述为所述待处理数据包从所述多核CPU包括的所有CPU核心中确定目标CPU核心包括:3. The data packet processing method according to any one of claims 1 to 3, wherein the determining the target CPU core for the data packet to be processed from all the CPU cores included in the multi-core CPU comprises:
    基于预设算法从所述多核CPU包括的所有CPU核心中选择一个CPU核心作为目标CPU核心。Based on a preset algorithm, a CPU core is selected from all the CPU cores included in the multi-core CPU as the target CPU core.
  5. 如权利要求1-3任一项所述的数据包处理方法,其中,所述为所述待处理数据包从所述多核CPU包括的所有CPU核心中确定目标CPU核心包括:3. The data packet processing method according to any one of claims 1 to 3, wherein the determining the target CPU core for the data packet to be processed from all the CPU cores included in the multi-core CPU comprises:
    从CPU核心信息查找表中查找与所述待处理数据包的5 TUPLE五元组对应的CPU核心作为目标CPU核心,所述CPU核心信息查找表包括5 TUPLE与CPU核心的映射关系。The CPU core corresponding to the 5-TUPLE quintuple of the data packet to be processed is searched from the CPU core information look-up table as the target CPU core, and the CPU core information look-up table includes the mapping relationship between the 5 TUPLE and the CPU core.
  6. 如权利要求5所述的数据包处理方法,其中,在所述指定CPU核心接收到的待处理数据包不存在对应的目标CPU核心时,还包括The data packet processing method according to claim 5, wherein, when the data packet to be processed received by the designated CPU core does not have a corresponding target CPU core, the method further comprises
    所述指定CPU核心根据预设算法从所述多核CPU包括的所有CPU核心中选择一个CPU核心作为所述待处理数据包的目标CPU核心;The designated CPU core selects one CPU core from all the CPU cores included in the multi-core CPU according to a preset algorithm as the target CPU core of the data packet to be processed;
    所述指定CPU核心将所述待处理数据包发送给所述目标CPU核心进行处理。The designated CPU core sends the to-be-processed data packet to the target CPU core for processing.
  7. 如权利要求6所述的数据包处理方法,其中,所述预设算法以下算法中的至少一个:轮转法、hash法,最空闲法。8. The data packet processing method according to claim 6, wherein the preset algorithm is at least one of the following algorithms: round robin method, hash method, and least idle method.
  8. 如权利要求6所述的数据包处理方法,其中,所述指定CPU核心根据预设算法从 所述多核CPU包括的所有CPU核心中选择一个CPU核心作为所述待处理数据包的目标CPU核心之后,还包括:The data packet processing method according to claim 6, wherein the designated CPU core selects a CPU core from all the CPU cores included in the multi-core CPU as the target CPU core of the data packet to be processed according to a preset algorithm ,Also includes:
    基于所述待选择数据包的5 TUPLE和所述目标CPU核心更新所述CPU核心信息查找表。The CPU core information look-up table is updated based on the 5 TUPLE of the data packet to be selected and the target CPU core.
  9. 一种数据包处理装置,所述数据包处理装置包括多核CPU和硬件数据接收模块,所述多核CPU中的其中一个CPU核心为指定CPU核心;A data packet processing device, the data packet processing device includes a multi-core CPU and a hardware data receiving module, and one of the CPU cores in the multi-core CPU is a designated CPU core;
    所述硬件数据接收模块,用于接收待处理数据包并为所述待处理数据包从所述多核CPU包括的所有CPU核心中确定目标CPU核心,基于所述目标CPU核心为所述待处理数据包添加标签信息,将添加标签信息后的所述待处理数据包发送给所述指定CPU核心,所述标签信息中包括目标CPU核心;The hardware data receiving module is configured to receive a data packet to be processed and determine a target CPU core for the data packet to be processed from all the CPU cores included in the multi-core CPU, based on the target CPU core being the data to be processed Adding tag information to the package, sending the data packet to be processed with tag information added to the designated CPU core, and the tag information includes the target CPU core;
    所述指定CPU核心包括分核模块,用于基于所述待处理数据包的标签信息将所述待处理数据包发送给所述目标CPU核心;The designated CPU core includes a sub-core module, configured to send the to-be-processed data packet to the target CPU core based on the label information of the to-be-processed data packet;
    所述目标CPU核心包括处理模块,用于对所述待处理数据包进行处理。The target CPU core includes a processing module for processing the to-be-processed data packet.
  10. 一种通信设备,包括处理器、存储器及通信总线,所述处理器包括至少一个多核CPU;A communication device includes a processor, a memory, and a communication bus. The processor includes at least one multi-core CPU;
    所述通信总线用于实现所述处理器和存储器之间的连接通信;The communication bus is used to implement connection and communication between the processor and the memory;
    所述处理器用于执行存储器中存储的一个或者多个计算机程序,以实现如权利要求1至8中任一项所述的数据包处理方法的步骤。The processor is configured to execute one or more computer programs stored in the memory to implement the steps of the data packet processing method according to any one of claims 1 to 8.
  11. 一种存储介质,存储有一个或者多个计算机程序,其中,所述一个或者多个计算机程序可被一个或者多个处理器执行,以实现如权利要求1至8中任一项所述的数据包处理方法的步骤。A storage medium storing one or more computer programs, wherein the one or more computer programs can be executed by one or more processors to realize the data according to any one of claims 1 to 8 The steps of the packet processing method.
PCT/CN2020/120353 2019-10-16 2020-10-12 Data packet processing method and apparatus, communication device, and storage medium WO2021073473A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910984845.1A CN112667554A (en) 2019-10-16 2019-10-16 Data packet processing method, device, communication equipment and storage medium
CN201910984845.1 2019-10-16

Publications (1)

Publication Number Publication Date
WO2021073473A1 true WO2021073473A1 (en) 2021-04-22

Family

ID=75400644

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/120353 WO2021073473A1 (en) 2019-10-16 2020-10-12 Data packet processing method and apparatus, communication device, and storage medium

Country Status (2)

Country Link
CN (1) CN112667554A (en)
WO (1) WO2021073473A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114866499B (en) * 2022-04-27 2024-02-23 曙光信息产业(北京)有限公司 Synchronous broadcast communication method, device and storage medium of multi-core system on chip

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100215050A1 (en) * 2009-02-20 2010-08-26 Hitachi, Ltd. Packet processing device by multiple processor cores and packet processing method by the same
CN103532876A (en) * 2013-10-23 2014-01-22 中国科学院声学研究所 Processing method and system of data stream
CN105159779A (en) * 2015-08-17 2015-12-16 深圳中兴网信科技有限公司 Method and system for improving data processing performance of multi-core CPU
CN105630731A (en) * 2015-12-24 2016-06-01 曙光信息产业(北京)有限公司 Network card data processing method and device in multi-CPU (Central Processing Unit) environment
US20170185449A1 (en) * 2014-09-15 2017-06-29 Huawei Technologies Co.,Ltd. Data processing method based on multi-core processor chip, apparatus, and system
CN108259374A (en) * 2017-08-24 2018-07-06 新华三信息安全技术有限公司 A kind of multi-core processor and message processing method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100215050A1 (en) * 2009-02-20 2010-08-26 Hitachi, Ltd. Packet processing device by multiple processor cores and packet processing method by the same
CN103532876A (en) * 2013-10-23 2014-01-22 中国科学院声学研究所 Processing method and system of data stream
US20170185449A1 (en) * 2014-09-15 2017-06-29 Huawei Technologies Co.,Ltd. Data processing method based on multi-core processor chip, apparatus, and system
CN105159779A (en) * 2015-08-17 2015-12-16 深圳中兴网信科技有限公司 Method and system for improving data processing performance of multi-core CPU
CN105630731A (en) * 2015-12-24 2016-06-01 曙光信息产业(北京)有限公司 Network card data processing method and device in multi-CPU (Central Processing Unit) environment
CN108259374A (en) * 2017-08-24 2018-07-06 新华三信息安全技术有限公司 A kind of multi-core processor and message processing method

Also Published As

Publication number Publication date
CN112667554A (en) 2021-04-16

Similar Documents

Publication Publication Date Title
US9866479B2 (en) Technologies for concurrency of cuckoo hashing flow lookup
US10455063B2 (en) Packet flow classification
US9013990B2 (en) Communication apparatus and method of content router to control traffic transmission rate in content-centric network (CCN), and content router
US9602428B2 (en) Method and apparatus for locality sensitive hash-based load balancing
EP3070910B1 (en) Pending interest table behavior
US20140181298A1 (en) Method and apparatus for managing a plurality of sessions in a multi-path routing based network
US10069947B2 (en) Method and apparatus for processing data packet based on parallel protocol stack instances
US10348612B2 (en) Set up of direct mapped routers located across independently managed compute and storage networks
US11757766B2 (en) Reflection route for link local packet processing
US20170031908A1 (en) Efficient parallel insertion into an open hash table
US20160072715A1 (en) Interest keep alives at intermediate routers in a ccn
WO2021057293A1 (en) Message forwarding method and apparatus in evpn, and device and storage medium
US11252078B2 (en) Data transmission method and apparatus
WO2021073473A1 (en) Data packet processing method and apparatus, communication device, and storage medium
US20170012874A1 (en) Software router and methods for looking up routing table and for updating routing entry of the software router
US9537799B2 (en) Phase-based packet prioritization
US9426091B2 (en) Distributed switch with conversational learning
CN111324438B (en) Request scheduling method and device, storage medium and electronic equipment
US11811643B2 (en) System and method for managing computing resources
US10834005B2 (en) Buffer shortage management system
US20230138389A1 (en) Forwarding table validation
US10225176B2 (en) Method, apparatus and non-transitory computer-readable medium for delivering packets
US10187330B2 (en) High-speed packet processing system and control method thereof
US20210099421A1 (en) Networking sub-ranges

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20877658

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20877658

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 270922)

122 Ep: pct application non-entry in european phase

Ref document number: 20877658

Country of ref document: EP

Kind code of ref document: A1