A message processing method and device, a network processor, an electronic device and a medium
By separating the management channel and the service channel in the network processor, determining the logical core identifier based on the packet characteristic information, and distributing the packet to the designated logical core for processing, the problems of low packet processing efficiency and resource waste in the prior art are solved, and efficient core-based processing and resource isolation are achieved.
Patent Information
- Application Number
- CN202310275836.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-16
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2043-03-16
AI Technical Summary
In the current technology, network processors based on multi-core MIPS architecture use a polling method to allocate packets to logical cores for processing when processing network packets, which results in low packet processing efficiency and wasted resources.
By acquiring the characteristic information of the target message, the logical core identifier is determined, and the message is distributed to the designated logical core for processing. The management channel and the business channel are separated, and independent message processing resources are allocated to each of them to achieve distributed processing.
It improves message processing efficiency, reduces resource waste, enhances system robustness, and avoids the performance of other channels being affected by the performance problem of one physical channel.
Smart Images

Figure CN116233281B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of communication, and in particular to a message processing method and device, a network processor, an electronic device and a medium. BACKGROUND
[0002] The network processor based on the multi-core MIPS (Microprocessor Without Interlocked Piped Stages) architecture is mainly used for processing network messages.
[0003] At present, the network processor based on the multi-core MIPS has multiple logical cores. After receiving a network message, the network processor does not parse the network message, but distributes the network message to the logical cores for processing in a polling manner.
[0004] However, the message processing efficiency is low and resources are wasted in the related art by using the polling manner to distribute the message to the logical cores for processing. SUMMARY
[0005] The embodiments of the present application provide a message processing method and device, a network processor, an electronic device and a medium, which can reduce the problems of low message processing efficiency and resource waste in the related processing manner.
[0006] According to an aspect of the present application, a message processing method is provided, comprising:
[0007] obtaining a target message to be processed;
[0008] determining a logical core identifier according to feature information of the target message, wherein the logical core identifier is used to represent a logical core for processing the target message;
[0009] determining a target logical core from a target logical core group according to the logical core identifier, and distributing the target message to the target logical core for processing.
[0010] Optionally, the obtaining of the target message to be processed comprises:
[0011] obtaining the target message to be processed through a micro-processing core corresponding to a message processing channel, wherein the message processing channel comprises a service channel and a management channel, the service channel is a physical channel for transmitting and receiving service messages, the management channel is a physical channel for transmitting and receiving management messages, the micro-processing core is a message processing resource allocated to the physical channel, and the message processing resources on each physical channel are independent of each other.
[0012] By configuring the physical channels as management channels and service channels, and allocating independent packet processing resources for the management channels and the service channels, channel separation and resource separation are realized, and the performance problem of one physical channel does not affect the packet transmission performance of other physical channels.
[0013] Optionally, the determining the logical core identifier according to the characteristic information of the target packet comprises:
[0014] In a case where the target packet is a service packet, the packet type field is obtained by parsing the service packet through the micro-processing core corresponding to the service channel;
[0015] The target field of the service packet is obtained according to the packet type field;
[0016] The logical core identifier corresponding to the service packet is determined according to the target field and the number of logical cores in the first logical core group, wherein the target logical core group comprises the first logical core group, and the first logical core group comprises logical cores for processing service packets.
[0017] The target field is obtained through the packet type field, and the logical core identifier is determined based on the target field and the number of logical cores in the first logical core group, so that the service packet is distributed to a specified logical core for processing according to the packet type.
[0018] Optionally, the obtaining the target field of the service packet according to the packet type field comprises:
[0019] The position information of the target field in the service packet is determined according to the packet type field;
[0020] The target field in the service packet is obtained according to the position information.
[0021] The position information of the target field in the service packet is determined through the association between the packet type and the position information of the target field, the target field in the service packet is obtained according to the position information, and the target field is quickly and accurately obtained.
[0022] accurately.
[0023] Optionally, the determining the logical core identifier corresponding to the service packet according to the target field and the number of logical cores in the first logical core group comprises:
[0024] The logical core identifier corresponding to the service packet is determined according to the target field, the service channel identifier, the number of distributed packets, and the number of logical cores in the first logical core group.
[0025] The logical core identifier is determined through the target field, the service channel identifier, the number of distributed packets and the number of logical cores in the first logical core group, so that the logical core identifier is calculated through various information associated with the service packet, and the calculation accuracy is improved.
[0026] Optionally, the determining the logical core identifier according to the characteristic information of the target packet comprises:
[0027] When the target packet is a management packet, the second logical core group is polled through the micro-processing core corresponding to the management channel, and the logical core identifier is determined according to the polling result, wherein the target logical core group comprises the second logical core group, and the second logical core group comprises a logical core for processing a management packet.
[0028] The second logical core for processing a management packet is determined by polling the second logical core group, so that the logical core processing of the management packet is realized.
[0029] According to another aspect of the present application, a packet processing device is provided, which comprises:
[0030] A packet acquisition module is configured to acquire a target packet to be processed.
[0031] An identifier determining module is configured to determine a logical core identifier according to characteristic information of the target packet, wherein the logical core identifier is used to represent a logical core for processing the target packet.
[0032] A packet distribution module is configured to determine a target logical core from a target logical core group according to the logical core identifier, and distribute the target packet to the target logical core for processing.
[0033] Optionally, the packet acquisition module is specifically configured to:
[0034] The target packet to be processed is acquired through a micro-processing core corresponding to a packet processing channel, wherein the packet processing channel comprises a service channel and a management channel, the service channel is a physical channel for transmitting and receiving a service packet, the management channel is a physical channel for transmitting and receiving a management packet, the micro-processing core is a packet processing resource allocated to the physical channel, and the packet processing resources on each physical channel are independent of each other.
[0035] Optionally, the identifier determining module comprises:
[0036] A type determining sub-module is configured to, in a case where the target packet is a service packet, parse the service packet through a micro-processing core corresponding to the service channel to obtain a packet type field.
[0037] A field acquisition sub-module is configured to acquire a target field of the service packet according to the packet type field.
[0038] The identification determining sub-module is configured to determine the logical core identification corresponding to the service message according to the target field and the number of logical cores in the first logical core group, wherein the target logical core group includes the first logical core group, and the first logical core group includes logical cores for processing service messages.
[0039] Optionally, the field obtaining sub-module is specifically configured to:
[0040] determine the position information of the target field in the service message according to the message type field;
[0041] obtain the target field in the service message according to the position information.
[0042] Optionally, the identification determining sub-module is specifically configured to:
[0043] determine the logical core identification corresponding to the service message according to the target field, the service channel identification, the number of distributed service messages, and the number of logical cores in the first logical core group.
[0044] Optionally, the identification determining module is specifically configured to:
[0045] when the target message is a management message, poll the second logical core group through the micro-processing core corresponding to the management channel, and determine the logical core identification according to the polling result, wherein the target logical core group includes the second logical core group, and the second logical core group includes logical cores for processing management messages.
[0046] According to another aspect of the present application, a network processor is provided, which includes a physical channel and a micro-processing core.
[0047] The physical channel includes a service channel and a management channel, and the service channel and the management channel correspond to different micro-processing cores, and the logical cores corresponding to the micro-processing cores are divided into a first logical core group and a second logical core group.
[0048] The service channel is configured to receive and transmit service messages.
[0049] The management channel is configured to receive and transmit management messages.
[0050] The micro-processing core corresponding to the service channel is configured to execute the message processing method provided in the embodiments of the present application.
[0051] The micro-processing core corresponding to the management channel is configured to execute the message processing method provided in the embodiments of the present application.
[0052] The first logical core group is configured to process service messages.
[0053] The second logic core group is configured to process the management message.
[0054] According to another aspect of the present application, there is provided an electronic device comprising:
[0055] at least one network processor; and
[0056] a memory in communication connection with the at least one network processor; wherein
[0057] The memory stores a computer program executable by the at least one network processor, and the computer program is executed by the at least one network processor to enable the at least one network processor to perform the message processing method according to any of the embodiments of the present application.
[0058] According to another aspect of the present application, there is provided a computer readable storage medium storing computer instructions for enabling a processor to implement the message processing method according to any of the embodiments of the present application when executed by the processor.
[0059] The technical solution of the embodiments of the present application determines the logic core identification according to the feature information of the target message, and distributes the target message to the designated logic core for processing according to the logic core identification. The embodiments of the present application realize the distribution of network messages to the designated logic core for processing according to the message features, thereby improving the message processing efficiency and reducing resource waste.
[0060] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present application, nor is it used to limit the scope of the present application. Other features of the present application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0061] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0062] Figure 1 A flowchart of a message processing method is provided for the embodiments of the present application;
[0063] Figure 2 A resource allocation schematic diagram is provided for the embodiments of the present application;
[0064] Figure 3 Another flowchart of a message processing method is provided for the embodiments of the present application;
[0065] Figure 4 A flow chart of another packet processing method provided by an embodiment of the present application is shown in FIG. 3.
[0066] Figure 5 A structure diagram of a packet processing device provided by an embodiment of the present application is shown in FIG. 4.
[0067] Figure 6 A structure diagram of a network processor provided by an embodiment of the present application is shown in FIG. 5.
[0068] Figure 7 A structure diagram of an electronic device provided by an embodiment of the present application is shown in FIG. 6. DETAILED DESCRIPTION
[0069] In order to make the technical personnel in the art better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor should be within the scope of protection of the present application.
[0070] It should be noted that the terms "first", "second" and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in other than the order illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0071] In order to facilitate understanding, the professional terms that may be involved in the embodiments of the present application are first explained.
[0072] XLP processor, a multi-core MIPS processor, is mainly used for processing network traffic. XLP is a SOC (System on Chip) chip, which has 16 physical cores (i.e. microcore), each physical core including 4 logical cores, i.e. the XLP processor has 64 logical cores. The frequency of each core is 800Mhz-1.8GHz. The throughput of processing 64-byte packets can reach 100Gbps.
[0073] The default packet receiving processing mode of the existing XLP processor is to poll the 64 logical cores after receiving the packet, which cannot realize the packet distribution processing and the special core processing. In addition, the micro processing core corresponding to the packet receiving path is shared by the allocation mechanism of all physical channels, which causes the load of a certain physical channel to be too large to affect the packet receiving performance of other channels, and further causes the flow control and other problems.
[0074] To solve the above problems, the embodiment of the present application provides a packet processing method, device, network processor, electronic equipment and medium.
[0075] Figure 1 A flow chart of a packet processing method is provided for the embodiment of the present application, which can be applicable to the case of processing network packets. The method can be executed by a packet processing device, which can be realized in the form of hardware and / or software, and can be configured in a network processor. For example, the network processor can be an XLP (eXtreme Low Power) processor and the like. As shown in the figure, the method comprises the following steps. Figure 1
[0076] S110, obtaining a target packet to be processed.
[0077] The target packet can be a network packet received by the network processor and needing to be processed. For example, the target packet includes management packets and service packets and the like. In the embodiment of the present application, different logical cores are used to process the above-mentioned management packets and service packets. For example, part of the logical cores in the network processor are pre-configured to be used for processing the management packets, and the remaining logical cores are pre-configured to be used for processing the service packets, so as to realize the distribution processing of the management packets and the service packets. Taking the XLP processor as an example, the 64 logical cores are divided into two groups, the first 4 logical cores are a group and are used for processing the management packets, and the last 60 logical cores are a group and are used for processing the service packets.
[0078] Exemplarily, the target packet to be processed is obtained through the micro processing core corresponding to the packet processing channel, wherein the packet processing channel includes a service channel and a management channel, the service channel is a physical channel for transmitting and receiving service packets, the management channel is a physical channel for transmitting and receiving management packets, the micro processing core is a packet processing resource allocated to the physical channel, and the packet processing resources on each physical channel are independent of each other.
[0079] The message processing channel can be a physical channel in the network processor for transmitting and receiving messages. The physical channel can be a channel formed by various interfaces in the network processor. For example, the message processing channel can include a service channel and a management channel. The physical channels in the network processor can be configured to process only service messages and only management messages, respectively. The message processing resources are allocated to different physical channels, so that the management channel and the service channel are physically independent, and the micro processing cores corresponding to the physical channels are also independent.
[0080] The message processing resource can be a resource allocated to the message processing channel. For example, the message processing resource can be a buffer resource, etc. The main buffer resource can include a first-in first-out (FIFO) resource, a receive buffer (rx buffer) resource, a last-in first-out (LIFO) resource, and a micro processing core (i.e., a physical core), etc.
[0081] In the embodiment of the present application, the network processor uses the management channel to transmit and receive management messages, and uses a polling method to determine idle micro processing cores corresponding to the management channel, and distributes the management messages to the idle micro processing cores for processing. In addition, the network processor uses the service channel to transmit and receive service messages, and uses a polling method to determine idle micro processing cores corresponding to the service channel, and distributes the service messages to the idle micro processing cores for processing. This design realizes the separate processing of service messages and management messages.
[0082] In some embodiments, an XLP processor is taken as an example, one micro processing core is allocated to the management channel, and all management messages of the management channel pass through the micro processing core to determine the logical core. The remaining 15 micro processing cores are all allocated to the service channel, and all service messages of the service channel are processed by the 15 micro processing cores in a polling manner. The resource utilization rate of each micro processing core can be polled, and whether the micro processing core is in an idle state is determined according to the resource utilization rate. The micro processing core in the idle state is used to distribute the service messages. For example, if the resource utilization rate of a micro processing core is less than a set threshold, it is determined that the micro processing core is in the idle state. If there are multiple micro processing cores with resource utilization rates less than the set threshold, the micro processing core with the smallest resource utilization rate is used to distribute the service messages.
[0083] Figure 2 A resource allocation diagram is provided for the embodiment of the present application. As shown in FIG. 1, the network processor includes a management channel and a service channel. The management channel is allocated a micro processing core, and the service channel is allocated 15 micro processing cores. The management channel and the service channel are physically independent, and the micro processing cores corresponding to the management channel and the service channel are also independent. Figure 2As shown, the service channel and the management channel involved in the packet receiving path 21 each have independent FIFO resource 22, rx buffer resource 23, LIFO resource 24 and micro-processing core 25, instead of all the physical channels sharing the above resources, realizing channel separation and the effect of independent message processing resources among the physical channels, avoiding the performance problem of a certain physical channel affecting other physical channels, and enhancing the robustness of the system.
[0084] It should be noted that there are many ways to allocate message processing resources on different physical channels, and the embodiments of the present application do not make specific limitations. For example, the message processing resources can be allocated to the management channel and the service channel in proportion according to the number of management channels and service channels in the physical channel. Or, according to the number of management messages and service messages in a period of time, the weights of the management channel and the service channel are determined, and the message processing resources are allocated to the management channel and the service channel according to the weights.
[0085] S120, determining a logical core identifier according to the characteristic information of the target message.
[0086] The target field can be a characteristic field representing a basic hash value of the service message, and the logical core identifier is determined by the basic hash value, which can be determined based on the processing result of the previous processing unit of the service message, and can be a basic hash value. The position of the target field in the service message is related to the message type, and the position of the target field is different in different types of service messages, and the content of the target field is also different.
[0087] The logical core identifier is used to represent the logical core for processing the target message. Since the network processor is pre-configured with micro-processing cores dedicated to processing service messages and micro-processing cores dedicated to processing management messages, and each micro-processing core corresponds to multiple logical processing cores, i.e. pre-configured with logical processing cores dedicated to processing service messages as a first logical core group. The logical core identifier is used to distinguish different logical cores in the first logical core group. In addition, the logical processing cores dedicated to processing management messages are pre-configured as a second logical core group. The logical core identifier is used to distinguish different logical cores in the second logical core group.
[0088] Exemplarily, the determining of the logical core identifier according to the characteristic information of the target message comprises: in the case that the target message is a service message, parsing the service message through the micro-processing core corresponding to the service channel to obtain a message type field; obtaining a target field of the service message according to the message type field; and determining the logical core identifier corresponding to the service message according to the target field and the number of logical cores in the first logical core group, wherein the target logical core group includes the first logical core group, and the first logical core group includes logical cores for processing service messages.
[0089] The message type field can be a characteristic field representing the type of the service message. For example, the message type field in the fragmentation message is "FP". When the message type field is "FP" is obtained by analyzing the service message, it is determined that the service message is a fragmentation message.
[0090] Since the network processor pre-allocates different micro-processing cores for the service channel and the management channel, there is an association between the channel identifier and the micro-processing core identifier. The target message carries the channel identifier. After the network processor obtains the target message, if it is determined that the target message is a service message according to the channel identifier, the micro-processing cores pre-allocated for the service channel are polled to determine an idle micro-processing core to analyze and process the service message, and the message type field of the service message is obtained.
[0091] The message type field is used to determine the field position of the basic hash value in the service message. The basic hash value in the service message is obtained from the field position. The hash value is calculated again by using the set hash algorithm according to the basic hash value and the number of logical cores in the first logical core group, and the logical core identifier is obtained. The logical core identifier obtained by the calculation is the identifier information of the logical core processing the service message.
[0092] S130, determining a target logical core from the target logical core group according to the logical core identifier, and distributing the target message to the target logical core for processing.
[0093] For example, since the logical core identifier is used to distinguish the logical cores in the target logical core group, the target logical core can be selected from the target logical core group based on the logical core identifier, and the target message can be distributed to the target logical core for processing, so that the target message is processed by the specified logical core.
[0094] For example, the first logical core can be selected from the first logical core group based on the logical core identifier when the target message is a service message, and the service message can be distributed to the first logical core for processing, so that the service message is processed by the specified logical core.
[0095] The embodiments of the present disclosure provide a message processing method. The logical core identifier is determined based on the characteristic information of the target message, and the target message is distributed to the specified logical core for processing according to the logical core identifier. According to the embodiments of the present disclosure, the network message is distributed to the specified logical core for processing according to the message characteristics, the message processing efficiency is improved, and the resource waste is reduced.
[0096] Figure 3A flowchart of another packet processing method provided by an embodiment of the present application is shown in FIG. 10. The embodiment is based on the above-mentioned embodiment, and further limits that the target field of the service packet is acquired according to the packet type field; and the logical core identifier corresponding to the service packet is determined according to the target field and the number of logical cores in the first logical core group. As shown in FIG. 10, the method comprises the following steps. Figure 3
[0097] S310, acquiring a target packet to be processed.
[0098] S320, in the case that the target packet is a service packet, parsing the service packet by a micro-processing core corresponding to the service channel to obtain a packet type field.
[0099] S330, determining position information of the target field in the service packet according to the packet type field.
[0100] The position information can be the field position of the target field in the service packet. The target field can be a characteristic field representing a basic hash value of the service packet. The definition of the target field has been described in the above-mentioned embodiment, and will not be repeated here.
[0101] Exemplarily, the position information of the target field in the service packet is determined according to the packet type field according to the association relationship between the packet type and the position information of the target field.
[0102] S340, acquiring the target field in the service packet according to the position information.
[0103] Exemplarily, the target field is acquired from the service packet based on the position information. The target field can be a basic hash value output by a previous processing unit, or the target field can be a basic hash value determined based on the result output by the previous processing unit, etc. After the service packet is processed by the previous processing unit, the service packet carries the basic hash value, and the position of the characteristic field corresponding to the basic hash value in the service packet is different for different types of service packets.
[0104] S350, determining the logical core identifier corresponding to the service packet according to the target field, the service channel identifier, the number of distributed service packets, and the number of logical cores in the first logical core group.
[0105] The service channel identifier can be the identifier information of the physical channel used for processing the service packet. The number of distributed service packets can be the number of service packets distributed by the micro-processing core, which can be recorded by a counter in the micro-processing core. For example, the micro-processing core can increase the count value of the counter by 1 after distributing a service packet to a designated logical core each time.
[0106] Exemplarily, after the micro-processing core acquires the target field in the service packet according to the position information, a set hash algorithm in the micro-processing core code is used to calculate a hash value of the target field, the service channel identifier, and the number of distributed packets to the number of logical cores in the first logical core group, and the hash value is the logical core identifier corresponding to the service packet. The number of distributed packets refers to the number of service packets distributed by the current micro-processing core, which is determined by polling the micro-processing cores corresponding to the service channel.
[0107] Specifically, the micro-processing core can splice the basic hash value, the service channel identifier, and the number of distributed packets of the micro-processing core to obtain a spliced value, calculate a hash value of the spliced value to the number of logical cores in the first logical core group, and distribute the service packet to the specified logical core for processing according to the hash value.
[0108] Alternatively, the micro-processing core can perform mathematical operations based on the basic hash value, the service channel identifier, and the number of distributed packets of the micro-processing core to obtain an operation result, calculate a hash value of the operation result to the number of logical cores in the first logical core group, and distribute the service packet to the specified logical core for processing according to the hash value.
[0109] S360, determining a target logical core from the target logical core group according to the logical core identifier, and distributing the target packet to the target logical core for processing.
[0110] The embodiment of the present disclosure provides another packet processing method. The packet type field is obtained by analyzing the service packet, the position of the basic hash value in the service packet is determined based on the packet type field, the basic hash value is obtained from the service packet, and then the logical core identifier is determined based on the basic hash value, the service channel identifier, and the number of distributed packets, so as to distribute the service packet to the specified logical core, thereby improving the packet processing efficiency. Since the step of distributing the network packet to the logical core for processing by using the polling method is omitted, the resource waste is reduced.
[0111] Figure 4 A flowchart of another packet processing method provided by the embodiment of the present disclosure is provided. The embodiment of the present disclosure adds a processing flow of a management packet to the above-mentioned embodiment. As shown in the figure, Figure 4 the method comprises:
[0112] S410, obtaining a target packet to be processed by a micro-processing core corresponding to a packet processing channel, and in the case that the target packet is a service packet, continuing to perform S420, and in the case that the target packet is a management packet, continuing to perform S470.
[0113] Exemplarily, the management message is acquired through at least one management channel, and the service message is acquired through at least one service channel, wherein the management channel and the service channel are independent physical channels, and the message processing resources allocated to the management channel and the service channel are also independent, that is, each management channel or service channel occupies independent message processing resources, which mainly include FIFO resources, rx buffer resources, LIFO resources, micro-processing cores and the like.
[0114] Taking the XLP processor as an example, one of the 16 micro-processing cores is allocated to the management channel, and the management messages of all the management channels are distributed through the micro-processing core, and the remaining 15 micro-processing cores are allocated to the service channel, and the service messages of all the service channels are processed by the 15 micro-processing cores in turn. Since one micro-processing core corresponds to four logical cores, the four logical cores corresponding to the micro-processing core allocated to the management channel are taken as a second logical core group and are used for processing the management messages. The 60 logical cores corresponding to the 15 micro-processing cores allocated to the service channel are taken as a first logical core group and are used for processing the service messages.
[0115] S420, the message type field is obtained by parsing the service message through the micro-processing core corresponding to the service channel.
[0116] In some embodiments, for the service message, the micro-processing core corresponding to the service channel is polled to determine the micro-processing core used for processing the service message, and after the micro-processing core acquires the service message, the message type field is obtained by parsing the service message.
[0117] S430, the position information of the target field in the service message is determined according to the message type field.
[0118] S440, the target field in the service message is acquired according to the position information.
[0119] S450, the logical core identifier corresponding to the service message is determined according to the target field, the service channel identifier, the number of distributed messages and the number of logical cores in the first logical core group.
[0120] Exemplarily, the target field is a basic hash value obtained after the service packet is processed by a front-stage processing unit of the service packet. The position and value of the basic hash value are different for different types of packets. The basic hash value can be obtained from the service packet through the association between the type of the service packet and the position information of the basic hash value. The service channel identifier is carried in the service packet, and the service channel identifier can be obtained by analyzing the service packet. Since the micro-processing core records the number of distributed packets through a counter, the number of distributed packets can be obtained by querying the counter in the micro-processing core. Then, the hash algorithm in the code of the micro-processing core is used to calculate the hash value of the service packet based on the basic hash value, the service channel identifier, the number of distributed packets, and the number of logical cores in the first logical core group, and the hash value of the service packet is used as the logical core identifier.
[0121] S460, determining a first logical core from the first logical core group according to the logical core identifier, and distributing the service packet to the first logical core for processing.
[0122] S470, polling a second logical core group through a micro-processing core corresponding to the management channel, and determining a logical core identifier according to a polling result.
[0123] The second logical core group includes logical cores for processing management packets, and the second logical core group can be composed of logical cores corresponding to micro-processing cores allocated to the management channel.
[0124] Since the micro-processing cores dedicated to processing management packets are pre-configured, if the number of micro-processing cores is 1, the management packets of all management channels are distributed by the micro-processing core. If the number of micro-processing cores is 2 or more, for management packets, the micro-processing core processing the management packet can be determined by polling at least two micro-processing cores.
[0125] Exemplarily, after the micro-processing core obtains the management packet, the CPU usage of each logical core in the second logical core group is polled, and the idle second logical core is determined according to the CPU usage. For example, the logical core with a CPU usage less than a set threshold in the second logical core group is determined as the idle second logical core. If there are multiple logical cores with a CPU usage less than the set threshold, the logical core with the smallest CPU usage is determined as the second logical core.
[0126] S480, determining a second logical core from the second logical core group according to the logical core identifier, and distributing the management packet to the second logical core for processing.
[0127] Exemplarily, after determining the logical core identifier for processing the management packet, the micro processing core selects a corresponding second logical core from the second logical core group based on the logical core identifier, and distributes the management packet to the corresponding second logical core for processing.
[0128] The embodiment of the present disclosure provides another packet processing method, which distributes service packets and management packets by using different micro processing cores, realizes the logical core processing of the service packets and the management packets, determines the logical core identifier of the service packet, and realizes the distribution of the service packet to the specified logical core, thereby improving the packet processing efficiency through the packet logical core processing and the special core processing. The management channel and the service channel are separated, and the packet processing resources are allocated to the management channel and the service channel respectively, the channel isolation is realized, the performance of the packet transmission and reception of other physical channels is avoided due to the performance problem of a certain physical channel, and the robustness of the system is improved.
[0129] Figure 5 A structural schematic diagram of a packet processing device provided by the embodiment of the present disclosure is provided. The device can execute the packet processing method described in the above embodiment to reduce the problems of low packet processing efficiency and resource waste in the related processing mode. The packet processing device can be realized in the form of hardware and / or software, and the packet processing device can be configured in a network processor. For example, the network processor can be an XLP (eXtreme Low Power, extreme low power) processor and the like. As shown in the figure, the device includes a packet acquisition module 510, an identifier determination module 520, and a packet distribution module 530. Figure 5 The packet acquisition module 510 is configured to acquire a target packet to be processed.
[0130] The packet acquisition module 510 is configured to acquire a target packet to be processed.
[0131] The identifier determination module 520 is configured to determine a logical core identifier according to characteristic information of the target packet, wherein the logical core identifier is used to represent a logical core for processing the target packet.
[0132] The packet distribution module 530 is configured to determine a target logical core from a target logical core group according to the logical core identifier, and distribute the target packet to the target logical core for processing.
[0133] Optionally, the packet acquisition module 510 is specifically configured to:
[0134] The target packet to be processed is acquired by a micro processing core corresponding to a packet processing channel, wherein the packet processing channel includes a service channel and a management channel, the service channel is a physical channel for transmitting and receiving service packets, the management channel is a physical channel for transmitting and receiving management packets, the micro processing core is a packet processing resource allocated to the physical channel, and the packet processing resources on each physical channel are independent of each other.
[0135] Optionally, the identification determining module 520 comprises:
[0136] a type determining submodule, configured to, when the target packet is a service packet, parse the service packet to obtain a packet type field through a micro-processing core corresponding to the service channel;
[0137] a field obtaining submodule, configured to obtain a target field of the service packet according to the packet type field;
[0138] an identification determining submodule, configured to determine a logical core identification corresponding to the service packet according to the target field and a number of logical cores in a first logical core group, wherein the target logical core group comprises the first logical core group, and the first logical core group comprises logical cores for processing service packets.
[0139] Optionally, the field obtaining submodule is specifically configured to:
[0140] determine position information of the target field in the service packet according to the packet type field;
[0141] obtain the target field in the service packet according to the position information.
[0142] Optionally, the identification determining submodule is specifically configured to:
[0143] determine the logical core identification corresponding to the service packet according to the target field, a service channel identification, a number of distributed packets and a number of logical cores in the first logical core group.
[0144] Optionally, the apparatus further comprises:
[0145] a polling module, configured to, when the target packet is a management packet, poll a second logical core group through a micro-processing core corresponding to the management channel, and determine a logical core identification according to a polling result, wherein the target logical core group comprises the second logical core group, and the second logical core group comprises logical cores for processing management packets.
[0146] The packet processing apparatus provided by the embodiments of the present application can execute the packet processing method provided by any of the embodiments of the present application, and has the corresponding function modules and beneficial effects of the execution method.
[0147] Figure 6 A structural schematic diagram of a network processor is provided for the embodiments of the present application. Figure 6As shown, the network processor 600 includes physical lanes 610 and microprocessing cores 620. The physical lanes 610 include service lanes 611 and management lanes 612, which correspond to different microprocessing cores 620, which correspond to logical cores divided into a first logical core group 621 and a second logical core group 622.
[0148] The service lanes 611 are configured to transmit and receive service packets. The management lanes 612 are configured to transmit and receive management packets. The microprocessing core corresponding to the service lanes 611 is configured to execute the packet processing method according to any of the embodiments of the present application. The microprocessing core corresponding to the management lanes 612 is configured to execute the packet processing method according to any of the embodiments of the present application. The first logical core in the first logical core group 621 is configured to process service packets. The second logical core in the second logical core group 622 is configured to process management packets.
[0149] The network processor according to the embodiments of the present application can execute the packet processing method according to any of the embodiments of the present application, and has the corresponding function modules and beneficial effects of the execution method.
[0150] Figure 7 A structural schematic diagram of an electronic device according to an embodiment of the present application is provided. Figure 7 A structural schematic diagram of an electronic device 10 that can be used to implement embodiments of the present application is shown. The electronic device can include a multi-core network device for processing network packets. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or claimed herein.
[0151] As shown, the electronic device 700 includes: Figure 7
[0152] at least one network processor 710; and
[0153] a memory 720 in communication connection with the at least one network processor 710; wherein
[0154] The memory 720 stores a computer program executable by the at least one network processor 710, and the computer program is executed by the at least one network processor 710 to enable the at least one network processor 710 to execute the packet processing method according to any of the embodiments of the present application.
[0155] As shown, the electronic device 700 includes: Figure 7 As shown, the electronic device includes a network processor 710, and a memory 720, such as a read-only memory (ROM) 730, a random access memory (RAM) 750, etc., connected to the network processor 710 in communication. The memory 720 stores computer programs executable by the network processor 710, which can perform various appropriate actions and processes according to the computer programs stored in the read-only memory (ROM) 730 or loaded from the storage unit 760 into the random access memory (RAM) 750. Various programs and data required for the operation of the electronic device 700 can also be stored in the RAM 750. The network processor 710, the ROM 730, and the RAM 750 are connected to each other through a bus 770. An input / output (I / O) interface 780 is also connected to the bus 770.
[0156] A plurality of components in the electronic device 700 are connected to the I / O interface 780, including a communication unit 740, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 740 allows the electronic device 700 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.
[0157] In some embodiments, the packet processing method can be implemented as a computer program tangibly embodied in a computer readable storage medium, such as the memory 720. In some embodiments, part or all of the computer program can be loaded and / or installed onto the network processor 710 via the ROM 730 and / or the communication unit 740. When the computer program is loaded onto the RAM 750 and executed by the network processor 710, one or more steps of the packet processing method described above can be performed. Alternatively, in other embodiments, the network processor 710 can be configured to perform the packet processing method by any other appropriate means, such as by means of firmware.
[0158] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a complex programmable logic device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0159] Computer programs for implementing the methods of the present application can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer program
[0160] In the context of the present application, a computer-readable storage medium can be a tangible medium that can contain or store computer programs for use by or in connection with an instruction execution system, apparatus, or device. Computer-readable storage media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of a machine-readable storage medium will include one or more lines of a program of instructions in a transitory signal, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0161] To provide for interaction with a user, the systems and techniques described here can be implemented on a networked processor with a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the networked processor. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0162] The systems and techniques described herein can be implemented in a computing system that includes a back end component, e.g., as a data server, or that includes a middleware component, e.g., an application server, or that includes a front end component, e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described herein, or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication, e.g., a communication network. Examples of communication networks include a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0163] The computing system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. A server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system, to solve the defects of large management difficulty and weak business scalability in traditional physical host and VPS service.
[0164] It should be understood that the various forms of flow shown above can be re-ordered, added to, or deleted from without departing from the scope of the present disclosure. For example, the steps recited in the present disclosure can be performed in parallel, in series, or in a different order, and the present disclosure is not limited herein as such.
[0165] The specific embodiments described above are not intended to limit the scope of the present disclosure. Those skilled in the art will understand that various modifications, combinations, sub-combinations, and alternatives can be made to the specific embodiments without departing from the spirit and principles of the present disclosure. Any further modifications, equivalents, and / or alternatives come within the scope of the present disclosure as recited by the claims.
Claims
1. A method of processing a packet, the method comprising: The method comprises the following steps: acquiring a target message to be processed; determining a logical core identifier according to characteristic information of the target message, wherein the logical core identifier is used to represent a logical core for processing the target message; determining a target logical core from a target logical core group according to the logical core identifier, and distributing the target message to the target logical core for processing; wherein the step of determining the logical core identifier according to the characteristic information of the target message comprises the following steps: in the case that the target message is a service message, analyzing the service message by a micro-processing core corresponding to the service channel to obtain a message type field; acquiring a target field of the service message according to the message type field, wherein the target field is a characteristic field representing a basic hash value of the service message, and the basic hash value is determined based on a processing result of a previous processing unit of the service message; determining a logical core identifier corresponding to the service message according to the target field and a number of logical cores in a first logical core group, wherein the target logical core group comprises the first logical core group, and the first logical core group comprises logical cores for processing service messages.
2. The method of claim 1, wherein, The step of acquiring the target message to be processed comprises the following step: acquiring the target message to be processed by a micro-processing core corresponding to a message processing channel, wherein the message processing channel comprises a service channel and a management channel, the service channel is a physical channel for transmitting and receiving service messages, the management channel is a physical channel for transmitting and receiving management messages, the micro-processing core is a message processing resource allocated to the physical channel, and the message processing resources on each physical channel are independent of each other.
3. The method of claim 2, wherein, The step of acquiring the target field of the service message according to the message type field comprises the following steps: determining position information of the target field in the service message according to the message type field; acquiring the target field in the service message according to the position information.
4. The method of claim 2, wherein, The step of determining the logical core identifier corresponding to the service message according to the target field and the number of logical cores in the first logical core group comprises the following step: determining the logical core identifier corresponding to the service message according to the target field, a service channel identifier, a number of distributed messages, and the number of logical cores in the first logical core group.
5. The method of claim 2, wherein, The step of determining the logical core identifier according to the characteristic information of the target message comprises the following step: in the case that the target message is a management message, polling a second logical core group by a micro-processing core corresponding to the management channel, and determining a logical core identifier according to a polling result, wherein the target logical core group comprises the second logical core group, and the second logical core group comprises logical cores for processing management messages.
6. A packet processing device, characterized by, The method comprises the following steps: a message acquisition module, configured to acquire a target message to be processed; an identifier determination module, configured to determine a logical core identifier according to characteristic information of the target message, wherein the logical core identifier is used to represent a logical core for processing the target message; a message distribution module, configured to determine a target logical core from a target logical core group according to the logical core identifier, and distribute the target message to the target logical core for processing; wherein the step of determining the logical core identifier according to the characteristic information of the target message comprises the following steps: In a case that the target packet is a service packet, a packet type field is obtained by analyzing the service packet through a micro-processing core corresponding to the service channel; A target field of the service packet is obtained according to the packet type field, wherein the target field is a characteristic field representing a basic hash value of the service packet, and the basic hash value is determined based on a processing result of a previous processing unit of the service packet; A logical core identifier corresponding to the service packet is determined according to the target field and a number of logical cores in a first logical core group, wherein the target logical core group includes the first logical core group, and the first logical core group includes logical cores used for processing service packets.
7. A network processor comprising: A physical channel and a micro-processing core; characterized in that: The physical channel includes a service channel and a management channel, the service channel and the management channel correspond to different micro-processing cores, and logical cores corresponding to the micro-processing cores are divided into a first logical core group and a second logical core group; The service channel is used for transmitting and receiving service packets; The management channel is used for transmitting and receiving management packets; The micro-processing core corresponding to the service channel is used for executing the packet processing method in any one of claims 1-4; The micro-processing core corresponding to the management channel is used for executing the packet processing method in claim 5; The first logical core group is used for processing service packets; The second logical core group is used for processing management packets.
8. An electronic device, comprising: The electronic device includes: At least one network processor; and A memory in communication connection with the at least one network processor; wherein The memory stores a computer program executable by the at least one network processor, and the computer program is executed by the at least one network processor to enable the at least one network processor to execute the packet processing method in any one of claims 1-5.
9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions for enabling a processor to implement the packet processing method in any one of claims 1-5 when executed.
Citation Information
Patent Citations
Method and device for forwarding message
CN101471854A
Classification processing method, device and equipment for network traffic, and medium
CN111628941A