Message data processing method, network device, and storage medium

CN122933581APending Publication Date: 2026-10-16WUXI DAPU LIANXIN TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611380270.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-07
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

然而,这种机制需要软件介入,涉及到CPU调度、上下游上下文切换,引入毫秒级的处理时延,难以满足金融交易、实时超算等微秒级敏感场景的需求,并且在软件处理期间,硬件流水线可能仍尝试向已失效端口发送报文数据,导致报文大量丢失

Benefits of technology

[0015]The embodiments of this application have the following beneficial effects: Unlike related technologies, the embodiments of this application determine the reference port by performing a bitwise logical AND operation between the expected aggregation bitmap and the active aggregation bitmap, combined with the message hash result, and dynamically update the active aggregation bitmap when the reference port is detected to be in an abnormal state, thereby re-determining the available target port. As a result, the message forwarding path can be quickly adjusted when the communication port is in an abnormal state, reducing processing latency, reducing or avoiding the situation where messages are sent to communication ports that cannot work properly, resulting in message loss, and improving the accuracy of communication port selection and the reliability of message processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122933581A_ABST
    Figure CN122933581A_ABST
Patent Text Reader

Abstract

The embodiment of the application relates to the technical field of network equipment, in particular to a message data processing method, network equipment and a storage medium. The embodiment of the application determines a reference port by performing bitwise logical AND operation on an expected aggregation bitmap and an active aggregation bitmap in combination with a message hash result, and dynamically updates the active aggregation bitmap when detecting that the reference port is in an abnormal state, thereby redetermining a target port available, so that the message forwarding path can be quickly adjusted when the communication port is in an abnormal state, the processing delay is reduced, the situation that the message is sent to a communication port unable to work normally and causes the message loss is reduced or avoided, and the accuracy of communication port selection and the reliability of message processing are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of network device technology, and in particular to a message data processing method, network device, and storage medium. Background Technology

[0002] With the development of hyperscale data centers and high-performance computing (HPC), network bandwidth demands have reached 100G, 200G, and even higher levels. To improve the reliability and throughput of communication links, port aggregation technology has been widely used in network interface cards (NICs) and switching equipment. In practical applications, hardware offload technology can embed traffic distribution logic into the chip circuitry, thereby achieving rapid forwarding.

[0003] In the hardware port aggregation architecture provided by related technologies, the detection and switching of communication link failures heavily rely on the "interrupt-driven" mechanism. When the physical layer detects a link down, it needs to notify the host CPU or embedded controller via an interrupt request, and then the software redirects traffic by modifying registers or updating memory table entries. However, this mechanism requires software intervention, involves CPU scheduling and upstream / downstream context switching, introducing millisecond-level processing latency. This makes it difficult to meet the needs of microsecond-level sensitive scenarios such as financial transactions and real-time supercomputing. Furthermore, during software processing, the hardware pipeline may still attempt to send packet data to the failed port, resulting in a large number of packet losses. Summary of the Invention

[0004] In view of this, one objective of the embodiments of this application is to provide a message data processing method, network device and storage medium to improve the situation in the related art where the software processing method is used when the port communication link is abnormal, resulting in high processing latency and message data loss.

[0005] In a first aspect, embodiments of this application provide a message data processing method applied to a network device, the network device including multiple communication ports. The method includes: performing a bitwise logical AND operation on the corresponding positions of a pre-constructed desired aggregation bitmap and an active aggregation bitmap to obtain a first mask bitmap, wherein the desired aggregation bitmap includes multiple first identifiers and the active aggregation bitmap includes multiple second identifiers, and one communication port corresponds to one first identifier and one second identifier; performing a hash operation on the message data to be processed to obtain a calculation result; and determining a reference port based on a reference bit width, the calculation result, and the first mask bitmap, wherein the reference bit width is the bit width of the desired aggregation bitmap or the bit width of the active aggregation bitmap, and the reference port is the message that the user expects to participate in processing. The communication port is in a first state and is used to process message data. The first state indicates that the communication port can perform message processing operations normally. In response to the reference port being in a second state, the active aggregation bitmap is updated based on the second state to obtain the updated active aggregation bitmap. The second state indicates that the communication port cannot perform message processing operations normally. The expected aggregation bitmap and the corresponding positions in the updated active aggregation bitmap are subjected to a bitwise logical AND operation to obtain a second mask bitmap. The target port is determined based on the reference bit width, the operation result, and the second mask bitmap, and the message data is forwarded using the target port. The target port is the communication port that the user expects to participate in processing message data and is in the first state and is used to process message data.

[0006] In some embodiments, determining a reference port based on a reference bit width, a calculation result, and a first mask bitmap includes: determining a reference index value based on the reference bit width and the calculation result; moving the identifier corresponding to the reference index value in the first mask bitmap to the least significant bit to obtain a reference mask bitmap; performing a first-bit search operation on the reference mask bitmap to determine the offset of a candidate identifier, wherein the candidate identifier is the identifier in the reference mask bitmap that is closest to the least significant bit and has a value of a first preset value; and determining a reference port based on the reference bit width, the reference index value, and the offset of the candidate identifier.

[0007] In some embodiments, determining a reference port based on a reference bit width, a reference index value, and an offset of a candidate identifier includes: calculating the sum of the reference index value and the offset of the candidate identifier to obtain a reference sum value; performing a modulo operation on the reference sum value based on the reference bit width to obtain a reference number; and determining the communication port corresponding to the reference number as the reference port.

[0008] In some embodiments, determining the target port based on the reference bit width, the calculation result, and the second mask bitmap includes: moving the identifier corresponding to the reference index value in the second mask bitmap to the least significant bit to obtain the target mask bitmap; performing a first-bit search operation on the target mask bitmap to determine the offset of the candidate identifier, wherein the candidate identifier is the identifier in the target mask bitmap that is closest to the least significant bit and has a value of a first preset value; and determining the target port based on the reference bit width, the reference index value, and the offset of the candidate identifier.

[0009] In some embodiments, determining the target port based on the reference bit width, the reference index value, and the offset of the candidate identifier includes: calculating the sum of the reference index value and the offset of the candidate identifier to obtain the target sum value; performing a modulo operation on the target sum value based on the reference bit width to obtain the target number; and determining the communication port corresponding to the target number as the target port.

[0010] In some embodiments, the network device communicates with the target device, and the method further includes: obtaining a first time and a second time, wherein the first time is the start time when the reference port is in the second state, and the second time is the time when the data port of the target device fully receives the message data; determining the difference between the second time and the first time as the port failure delay, wherein the port failure delay characterizes the delay in which the network device performs communication port switching and successfully sends message data in the event of a communication port failure.

[0011] In some embodiments, before performing a bitwise logical AND operation between the pre-constructed expected aggregation bitmap and the identifier at the corresponding position in the active aggregation bitmap to obtain the first mask bitmap, the method further includes: constructing an expected aggregation bitmap based on multiple communication ports, wherein the bit width of the expected aggregation bitmap is the same as the number of communication ports, and the first identifier is used to characterize whether the user expects the communication port to participate in or not participate in processing message data.

[0012] In some embodiments, before performing a bitwise logical AND operation between the pre-constructed desired aggregation bitmap and the corresponding identifiers in the active aggregation bitmap to obtain the first mask bitmap, the method further includes: detecting a first port and a second port among a plurality of communication ports, wherein the first port is a communication port in a first state and the second port is a communication port in a second state; constructing an active aggregation bitmap based on the first port and the second port, wherein the bit width of the active aggregation bitmap is the same as the number of communication ports, and the second identifier is used to characterize whether the communication port is in the first state or the second state.

[0013] Secondly, embodiments of this application provide a network device including a processor and a memory. The processor is communicatively connected to the memory, and the memory stores program instructions executable by the processor. When the program instructions are executed by the processor, the network device performs the message data processing method provided in the first aspect.

[0014] Thirdly, embodiments of this application provide a computer-readable storage medium storing processor-executable program instructions, which, when executed by a processor, cause the processor to perform the message data processing method provided in the first aspect.

[0015] The embodiments of this application have the following beneficial effects: Unlike related technologies, the embodiments of this application determine the reference port by performing a bitwise logical AND operation between the expected aggregation bitmap and the active aggregation bitmap, combined with the message hash result, and dynamically update the active aggregation bitmap when the reference port is detected to be in an abnormal state, thereby re-determining the available target port. As a result, the message forwarding path can be quickly adjusted when the communication port is in an abnormal state, reducing processing latency, reducing or avoiding the situation where messages are sent to communication ports that cannot work properly, resulting in message loss, and improving the accuracy of communication port selection and the reliability of message processing. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the accompanying drawings used in the description of the related technologies or embodiments will be briefly introduced below. Obviously, the drawings described below only show some embodiments of this application and should not be considered as limiting the scope of protection. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 These are schematic diagrams illustrating application scenarios for processing message data in some embodiments of this application; Figure 2 These are schematic diagrams of the network devices provided in some embodiments of this application; Figure 3 This is a flowchart illustrating a message data processing method provided in some embodiments of this application; Figure 4 This is a schematic diagram illustrating the transmission of message data between a network device and a target device in some embodiments of this application. Detailed Implementation

[0018] To make the objectives and advantages of the embodiments of this application more readily understood, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. The detailed description of the embodiments of this application in the accompanying drawings is not intended to limit the scope of protection claimed by this application, but only represents selected embodiments of this application. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0019] It should be noted that, unless there is a conflict, the various technical features involved in the embodiments of this application described below can be combined with each other, and all are within the protection scope of this application. Furthermore, although functional modules are divided in the device or structural schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. In addition, the terms "first," "second," "third," and other similar expressions used herein do not limit the data or execution order, but are only for illustrative purposes and to distinguish identical or similar items with substantially the same function and effect, and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features.

[0020] Unless otherwise defined, the technical and scientific terms used in this specification have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of this application. It should be understood that the term "and / or" as used in this specification includes any and all combinations of one or more of the listed items.

[0021] In related technologies, when the port communication link is abnormal, the message data is processed by software. However, this mechanism requires software intervention and involves CPU scheduling, upstream and downstream context switching, etc., which introduces millisecond-level processing latency. It is difficult to meet the needs of microsecond-level sensitive scenarios such as financial transactions and real-time supercomputing. Furthermore, during software processing, the hardware pipeline may still try to send message data to the failed port, resulting in a large number of message losses.

[0022] In view of this, embodiments of this application provide a message data processing method, which determines a reference port by performing a bitwise logical AND operation between the expected aggregation bitmap and the active aggregation bitmap, combined with the message hash result, and dynamically updates the active aggregation bitmap when an abnormal state is detected in the reference port, thereby re-determining an available target port. Thus, when the communication port state is abnormal, the message forwarding path can be quickly adjusted, the processing latency can be reduced, and the situation of sending messages to communication ports that are not working properly and causing message loss can be reduced or avoided, thereby improving the accuracy of communication port selection and the reliability of message processing.

[0023] Please see Figure 1 , Figure 1 The illustrations are schematic diagrams showing application scenarios for processing message data in some embodiments of this application.

[0024] like Figure 1 As shown, network device 100 includes multiple communication ports. Figure 1(Not shown), network device 100 may be, but is not limited to, a network interface card (NIC) (e.g., a wired NIC, a wireless NIC, a PCIe NIC), a switch (e.g., a Layer 3 switch, an industrial switch, a data center switch), etc. Network device 100 may be configured in any suitable device or apparatus (e.g., a laptop, a desktop computer, a server, etc.) as a component of that device or apparatus or as a component independent of that device or apparatus to process message data packets.

[0025] For example, embodiments of this application perform the following message processing operations to process message data.

[0026] First, based on multiple communication ports, a desired aggregation bitmap and an active aggregation bitmap are constructed. The desired aggregation bitmap includes multiple first identifiers, and the active aggregation bitmap includes multiple second identifiers. One communication port corresponds to one first identifier and one second identifier.

[0027] Next, a bitwise logical AND operation is performed between the corresponding identifiers in the expected aggregation bitmap and the active aggregation bitmap to obtain the first mask bitmap. The bit width of the expected aggregation bitmap is the same as that of the active aggregation bitmap.

[0028] Then, a hash operation is performed on the message data to be processed to obtain the result.

[0029] Then, based on the reference bit width, the calculation result, and the first mask bitmap, the reference port is determined. The reference bit width is the bit width of the expected aggregation bitmap or the bit width of the active aggregation bitmap.

[0030] Furthermore, in response to the reference port being in the second state, the active aggregation bitmap is updated based on the second state to obtain the updated active aggregation bitmap.

[0031] Next, a bitwise logical AND operation is performed between the corresponding identifiers in the expected aggregate bitmap and the updated active aggregate bitmap to obtain the second mask bitmap.

[0032] Finally, the target port is determined based on the reference bit width, the calculation result, and the second mask bitmap, and the packet data is forwarded using the target port.

[0033] By using the above methods, the message forwarding path can be quickly adjusted when the communication port status is abnormal, reducing processing latency, reducing or avoiding the situation where messages are sent to communication ports that are not working properly, thus improving the accuracy of communication port selection and the reliability of message processing.

[0034] It should be understood that Figure 1The embodiments described herein are merely illustrative of one scenario in which network device 100 processes message data in some embodiments of this application, and do not limit the structure, type, or number of network devices in other embodiments. For example, in other embodiments, the network device may be any other suitable type of device, apparatus, or component.

[0035] To facilitate understanding of the message data processing method provided in the embodiments of this application, the network device provided in the embodiments of this application will be described in detail first.

[0036] Please see Figure 2 , Figure 2 A schematic diagram of the structure of a network device in some embodiments of this application is shown.

[0037] See Figure 2 As shown, the network device 100 includes at least one processor 110, at least one memory 120, and a plurality of (G) communication ports 140 connected in communication. Figure 2 Taking a bus system 130, a processor 110, and a memory 120 as an example, the various components of the network device 100 are coupled together through the bus system 130, which is used to realize communication between the various components. The communication port 140 is configured to send or receive data (such as message data or instruction data). It is easy to understand that the bus system 130 may include a power bus, control bus, and status signal bus in addition to the data bus, but for clarity and brevity, these will not be discussed further. Figure 2 The various buses are all labeled as Bus System 130. This is understandable. Figure 2 The structures shown in the embodiments are merely illustrative and do not limit the structure of the network devices described above. For example, the network devices described above may also include components that are more... Figure 2 The structure shown has more or fewer components, or has the same Figure 2 The diagram shows different configurations of the structure. Here, G is an integer greater than or equal to 2.

[0038] Specifically, processor 110 provides computational and control capabilities to support network device 100 in executing corresponding business logic and functions. For example, it supports network device 100 in executing the message data processing method provided in the embodiments of this application, or in executing the steps in any possible implementation of the message data processing method provided in the embodiments of this application. It is understood that processor 110 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), or a digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0039] The memory 120, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, instructions, and modules, such as the program, instructions, and modules corresponding to the message data processing method in the embodiments of this application. In some embodiments, the memory 120 may include a program storage area and a data storage area. The program storage area may store the operating system and application programs required for at least one function, and the data storage area may store data created according to the use of the processor 110. The processor 110 executes various functional applications and data processing of the network device 100 by running the non-transitory software programs, instructions, and modules stored in the memory 120, thereby implementing the message data processing method provided in the embodiments of this application, or executing the steps in any possible implementation of the message data processing method provided in the embodiments of this application. In some embodiments, the memory 120 may include high-speed random access memory and may also include non-transitory memory. For example, at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory 120 may also include memories remotely located relative to the processor 110, and these remotely located memories are connected to the processor 110 via a communication network. It is understood that examples of the aforementioned communication networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0040] As can be understood from the above, the message data processing method provided in this application embodiment can be implemented by any suitable type of network device with certain computing and control capabilities, such as the network device 100 described above. In some implementations, the message data processing method provided in this application embodiment is implemented by a processor executing program instructions stored in a memory.

[0041] The following will describe in detail the message data processing method provided in the embodiments of this application, taking into account exemplary applications and implementations of the network devices provided in the embodiments of this application.

[0042] Please see Figure 3 As shown, the message data processing method provided in this application embodiment includes steps S31 to S36 to realize message data processing.

[0043] Step S31: Perform a bitwise logical AND operation between the pre-constructed expected aggregation bitmap and the corresponding identifiers in the active aggregation bitmap to obtain the first mask bitmap.

[0044] In this embodiment, the bit width of the expected aggregation bitmap is the same as the bit width of the active aggregation bitmap. The expected aggregation bitmap includes multiple first identifiers, and the active aggregation bitmap includes multiple second identifiers. One communication port corresponds to one first identifier and one second identifier. The first identifier indicates whether the user expects the corresponding communication port to participate in or not participate in processing message data, and the second identifier indicates whether the corresponding communication port can normally perform message processing operations. It can be understood that the bit width of the expected aggregation bitmap is equal to the number of first identifiers, and one communication port corresponds to one first identifier; thus, the number of first identifiers is equal to the number of communication ports, meaning the bit width of the expected aggregation bitmap is the same as the number of communication ports. Similarly, for the active aggregation bitmap, the bit width of the active aggregation bitmap is equal to the number of second identifiers, and one communication port corresponds to one second identifier; thus, the number of second identifiers is equal to the number of communication ports, meaning the bit width of the active aggregation bitmap is the same as the number of communication ports.

[0045] For example, the system retrieves a pre-constructed expected aggregation bitmap and an active aggregation bitmap. The expected aggregation bitmap represents the set of communication ports that the user expects to participate in processing message data, while the active aggregation bitmap represents the set of communication ports currently capable of performing message processing operations. The expected aggregation bitmap and the active aggregation bitmap have the same bit width, and each identifier (i.e., the first identifier or the second identifier) ​​in either the expected aggregation bitmap or the active aggregation bitmap corresponds to a communication port.

[0046] According to a preset port numbering order (e.g., 0, 1, 2, 3, 4, 5, 6, 7), each communication port is assigned a corresponding position. That is, a one-to-one mapping relationship is established between the port number of the communication port and the identifier positions in the desired aggregation bitmap and the active aggregation bitmap, so that the... The communication port corresponds to the first desired aggregation bitmap. The first identifier of the identifier location and the first active aggregation bitmap The second identifier is located at each identifier position. Thus, the identifiers corresponding to the same communication port in the desired aggregation bitmap and the active aggregation bitmap are determined by the same identifier position.

[0047] For example, a blank initial mask bitmap is generated, with the same bit width as the expected aggregation bitmap. The identifier positions of the expected and active aggregation bitmaps are traversed. For any identifier position, the first and second identifiers corresponding to that position in both the expected and active aggregation bitmaps are read, and a bitwise logical AND operation is performed between the first and second identifiers at that position to obtain the result. This result is then written into the corresponding identifier position in the initial mask bitmap. It should be understood that when both the first and second identifiers are valid values ​​(e.g., 1), the logical AND result at the corresponding identifier position is valid; when at least one of the first and second identifiers is invalid (e.g., 0), the logical AND result at the corresponding identifier position is invalid.

[0048] After performing the bitwise AND operation on all corresponding identifier positions in the expected aggregation bitmap and the active aggregation bitmap, and writing the results of the AND operation sequentially into the corresponding identifier positions in the initial mask bitmap, the first mask bitmap is obtained. Therefore, identifiers in the first mask bitmap with valid values ​​(e.g., 1) indicate that both conditions are met: "the user expects to participate in processing message data" and "they are currently in the first state (i.e., able to perform message processing operations normally)." The communication port corresponding to an identifier with a valid value (e.g., 1) is the communication port that the user expects to participate in processing message data and that can perform message processing operations normally.

[0049] For example, in some embodiments, it is desirable to aggregate bitmaps. Active aggregation bitmap The expected aggregation bitmap and the active aggregation bitmap both have a bit width of 8 (i.e., the number of first or second identifiers). The eight first identifiers in the expected aggregation bitmap, arranged sequentially, indicate whether the user expects communication ports 0, 1, 2, 3, 4, 5, 6, and 7 to participate in or not participate in message data processing. The eight second identifiers in the active aggregation bitmap, arranged sequentially, indicate whether communication ports 0, 1, 2, 3, 4, 5, 6, and 7 can perform message processing operations normally.

[0050] The mapping relationship between the first identifier, the second identifier, the third identifier and each communication port is shown in Table 1 below.

[0051] Table 1:

[0052] Referring to Table 1, in the expected aggregation bitmap, when the value of the first identifier is 1, it indicates that the communication port corresponding to the first identifier is the communication port that the user expects to participate in processing message data; when the value of the first identifier is 0, it indicates that the communication port corresponding to the first identifier is the communication port that the user expects not to participate in processing message data. According to Table 1, the values ​​of the first identifiers corresponding to communication ports 0, 1, 2, and 3 are all 1, indicating that the user expects communication ports 0, 1, 2, and 3 to participate in processing message data; the values ​​of the first identifiers corresponding to communication ports 4, 5, 6, and 7 are all 0, indicating that the user expects communication ports 4, 5, 6, and 7 not to participate in processing message data. In the active aggregation bitmap, when the value of the second identifier is 1, it indicates that the communication port corresponding to the second identifier is the communication port that can currently perform message processing operations normally; when the value of the second identifier is 0, it indicates that the communication port corresponding to the second identifier is the communication port that cannot perform message processing operations normally. According to Table 1, the value of the second identifier corresponding to communication ports 0, 2, 3, and 6 is 1, indicating that communication ports 0, 2, 3, and 6 can perform message processing operations normally; the value of the second identifier corresponding to communication ports 1, 4, 5, and 7 is 0, indicating that communication ports 1, 4, 5, and 7 cannot perform message processing operations normally.

[0053] The expected aggregated bitmap is The active aggregation bitmap is The first mask bitmap is obtained by performing a bitwise logical AND operation between the corresponding positions of the desired aggregation bitmap and the active aggregation bitmap. Referring to Table 1, in the first mask bitmap, the values ​​of the third identifiers corresponding to communication ports 0, 2, and 3 (i.e., the identifiers corresponding to the communication ports in the first mask bitmap, where one third identifier corresponds to one communication port) are all 1, indicating that communication ports 0, 2, and 3 are communication ports that the user expects to participate in processing message data and can normally perform message processing operations; the values ​​of the third identifiers corresponding to communication ports 1, 4, 5, 6, and 7 are all 0, indicating that communication ports 1, 4, 5, 6, and 7 are communication ports that the user expects not to participate in processing message data and / or cannot normally perform message processing operations.

[0054] Step S32: Perform a hash operation on the message data to be processed to obtain the result.

[0055] The results of the calculations are represented in binary. The message data to be processed can be a message received by the network device from an external device, or a message that the network device itself needs to send to an external device.

[0056] The message data includes the message header and message payload. The message header includes fields such as source address, destination address, source port, destination port, and protocol type. The message payload refers to the part of the message that carries the actual business data, that is, the content that the message actually needs to transmit (such as HTTP requests, video data, and file data).

[0057] For example, the process acquires the message data to be processed and determines the message fields used for port selection. For instance, based on a preset hash input rule, one or more message fields are selected from the message data to form hash input data. In some embodiments, a quintuple of the message data (i.e., source address, destination address, source port, destination port, and protocol type) is selected as the field for port selection and hashed.

[0058] The selected message fields are concatenated or combined according to a preset field order to obtain hash input data. When multiple fields participate in the hash operation, the fields are arranged according to a preset byte order so that messages with the same field content can obtain consistent hash input data, and different messages can form different hash input characteristics.

[0059] For example, a preset hash algorithm and its corresponding parameters are obtained. The hash algorithm is suitable for network device hardware processing, and the parameters include an initial hash value and a seed value. By setting a fixed hash algorithm and parameters, the same packet data can produce the same hash result under the same configuration.

[0060] The hash input data is fed into the hash algorithm, and each data unit of the hash input data is iteratively calculated to map message data with different data lengths and contents into a fixed-length hash value, thus obtaining the calculation result. The calculation result is represented in binary form and has a preset bit width; for example, a result of 0011011101110011 has a bit width of 16.

[0061] By utilizing the hash characteristics of message data, different messages are mapped to different candidate port locations, thereby achieving a deterministic association between message data and communication ports.

[0062] Step S33: Determine the reference port based on the reference bit width, the calculation result, and the first mask bitmap.

[0063] In this embodiment, the reference bit width is either the bit width of the desired aggregation bitmap or the bit width of the active aggregation bitmap. As mentioned earlier, the desired aggregation bitmap... Active aggregation bitmap The expected bit width (i.e., reference bit width) of both the active aggregation bitmap and the active aggregation bitmap is 8. The reference port is the communication port that the user expects to participate in processing message data and is in the first state for processing message data. The first state indicates that the communication port can normally perform message processing operations.

[0064] Understandably, since the first mask bitmap is obtained by performing a bitwise logical AND operation between the identifiers at corresponding positions in the expected aggregation bitmap and the active aggregation bitmap, the bit width of the first mask bitmap is the same as the reference bit width (i.e., the bit width of the expected aggregation bitmap or the bit width of the active aggregation bitmap), and each third identifier in the first mask bitmap corresponds to a communication port.

[0065] For example, the number of characters to be truncated is determined based on the reference bit width. The number of characters to be truncated is the minimum number of characters (such as 1 or 0) that can represent all communication ports. For example, if the reference bit width is... For the result of the operation represented in binary, the calculated number of characters extracted is: , Indicates the number of characters extracted. This refers to The calculation result is rounded up.

[0066] For example, when (That is, when the number of communication ports is 8 / 8 communication ports) This means that all (8) communication ports can be represented using three combined characters: 000 (decimal value 0), 001 (decimal value 1), 010 (decimal value 2), 011 (decimal value 3), 100 (decimal value 4), 101 (decimal value 5), 110 (decimal value 6), and 111 (decimal value 7) represent communication ports 0, 1, 2, 3, 4, 5, 6, and 7, respectively. (That is, when the number of communication ports is 10 / 10 communication ports) In other words, all (10) communication ports can be represented by four combined characters. Specifically, 0000 (decimal value 0), 0001 (decimal value 1), 0010 (decimal value 2), 0011 (decimal value 3), 0100 (decimal value 4), 0101 (decimal value 5), 0110 (decimal value 6), 0111 (decimal value 7), 1000 (decimal value 8), and 1001 (decimal value 9) represent communication ports 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9, respectively.

[0067] For example, determine the actual bit width of the operation result and compare it with the number of characters to be truncated. When the actual bit width of the operation result is greater than or equal to the number of characters to be truncated, select the required number of characters (i.e., 0 or 1) from the least significant bit to the most significant bit of the operation result to obtain a reference result. When the actual bit width of the operation result is less than the number of characters to be truncated, extend the characters from the most significant bit of the operation result to make the bit width of the operation result equal to the number of characters to be truncated to obtain a reference result. It can be understood that the least significant bit and the most significant bit of the operation result refer to the positions of the rightmost and leftmost characters, respectively.

[0068] For example, a preset bitwise operation or numerical conversion operation (e.g., conversion to decimal representation) is performed on the reference result to obtain the candidate port number. The candidate port number is used to represent the communication port used for processing message data in the first mask bitmap.

[0069] Based on the candidate port number, determine the candidate communication port corresponding to the candidate port number. Obtain the third identifier corresponding to the candidate communication port in the first mask bitmap as the first reference identifier, and determine whether the value of the first reference identifier is valid. When the value of the first reference identifier is valid, determine the candidate communication port as the reference port.

[0070] If the value of the first reference identifier is invalid, then according to the preset identifier position traversal rules, the search continues in the first mask bitmap to find the third identifier with a valid value. For example, based on the third identifier corresponding to the candidate communication port, each third identifier is traversed sequentially towards the highest bit, skipping third identifiers with invalid values ​​during the traversal; when the traversal reaches the highest bit of the first mask bitmap, the traversal continues from the lowest bit of the first mask bitmap towards the highest bit, until a third identifier with a valid value is determined. It can be understood that the lowest and highest bits of the first mask bitmap refer to the positions of the rightmost and leftmost third identifiers, respectively.

[0071] For example, a correspondence is established between a reference port and the message data to be processed. Thus, in the above manner, a reference port (i.e. a communication port used to process message data and in the first state that the user expects to participate in processing message data and is in the first state) is determined from the set of valid ports defined by the first mask bitmap (including one or more communication ports that the user expects to participate in processing message data and are in the first state), and the message data is processed using the reference port.

[0072] Step S34: In response to the reference port being in the second state, update the active aggregation bitmap based on the second state to obtain the updated active aggregation bitmap.

[0073] In this embodiment, the second state indicates that the communication port cannot perform message processing operations normally.

[0074] For example, after determining the reference port, the system obtains the corresponding status information for the reference port and determines whether the reference port is in a first state or a second state. The first state indicates that the reference port can perform packet processing operations normally, while the second state indicates that the reference port cannot perform packet processing operations normally. It is easy to understand that the status information can be obtained by the port status detection module or link status management module configured in the network device.

[0075] Based on the pre-established mapping relationship between communication ports and identifier positions in the active aggregation bitmap, the identifier position in the active aggregation bitmap corresponding to the reference port is determined as the target position. Since the expected aggregation bitmap and the active aggregation bitmap have the same bit width and use the same port-position mapping relationship, the reference port simultaneously corresponds to the first identifier corresponding to the target position in the expected aggregation bitmap and the second identifier corresponding to the target position in the active aggregation bitmap.

[0076] For example, when a reference port is detected to be in a second state, it is determined that the reference port currently lacks the ability to perform normal message processing operations (i.e., the reference port cannot perform message processing operations normally). The value of the second identifier corresponding to the target position in the active aggregation bitmap (i.e., the second identifier corresponding to the reference port) is updated to an invalid value (e.g., 0). The second identifiers at other positions in the active aggregation bitmap, except for the target position, remain unchanged, so that the active aggregation bitmap no longer represents the reference port as a currently available communication port, resulting in an updated active aggregation bitmap. Therefore, the updated active aggregation bitmap can reflect the abnormal state of the reference port in real time.

[0077] The updated active aggregation bitmap undergoes a status check to confirm that the value of the second identifier corresponding to the reference port (target location) has been updated to an invalid value, while the values ​​of the second identifier corresponding to other communication ports (identifier locations) remain unchanged. After successful verification, the updated active aggregation bitmap is used for subsequent communication port reselection. Specifically, the updated active aggregation bitmap and the desired aggregation bitmap are again subjected to a bitwise logical AND operation to filter out reference ports in the second state. This yields a second mask bitmap that represents the set of currently available communication ports that meet user expectations. Based on this second mask bitmap, the target port for processing message data is then re-determined.

[0078] For example, active aggregation bitmap The reference port is communication port 0. Once it is determined that communication port 0 is in the second state, please refer to Table 1 to set the active aggregation bitmap. The value of the second identifier corresponding to communication port 0 is updated from the valid value 1 to the invalid value 0. Thus, the updated active aggregation bitmap is... At this point, the updated active aggregation bitmap In the diagram, the value of the second identifier corresponding to communication ports 2, 3, and 6 is 1, indicating that communication ports 2, 3, and 6 can perform message processing operations normally. The value of the second identifier corresponding to communication ports 0, 1, 4, 5, and 7 is 0, indicating that communication ports 0, 1, 4, 5, and 7 cannot perform message processing operations normally.

[0079] In some embodiments, an enable signal is triggered periodically by a timer to force a specified port (such as a reference port) into a second state. This enables communication port anomaly / fault injection, thereby detecting and verifying the performance and effectiveness of communication port switching and message data transmission during the functional verification phase. This eliminates the need for other complex testing instruments and saves testing costs.

[0080] Step S35: Perform a bitwise logical AND operation on the corresponding positions of the desired aggregate bitmap and the updated active aggregate bitmap to obtain the second mask bitmap.

[0081] For example, a blank original mask bitmap is initialized, with the same bit width as the desired aggregate bitmap. Following a predefined traversal order (e.g., traversing from the least significant bit to the most significant bit), the positions of each identifier in the desired aggregate bitmap and the updated active aggregate bitmap are determined sequentially. For any identifier position, the first and second identifiers corresponding to that position in both the desired and updated active aggregate bitmaps are read. A bitwise logical AND operation is performed on the first and second identifiers corresponding to that position to obtain the result. This logical AND result is then written into the corresponding identifier position in the original mask bitmap.

[0082] The bitwise AND operation described above is performed on all corresponding identifier positions in the expected aggregation bitmap and the updated active aggregation bitmap. After writing the results of the AND operation sequentially into the corresponding identifier positions in the original mask bitmap, a second mask bitmap is obtained. At this time, identifiers with valid values ​​(such as 1) in the second mask bitmap indicate that both the conditions of "user expects to participate in message data processing" and "currently in the first state" are met. The communication port corresponding to the identifier with a valid value (such as 1) is the communication port that the user expects to participate in message data processing and can normally perform message processing operations. The reference port in the second state is filtered out in the second mask bitmap because the value of its corresponding second identifier has been invalidated.

[0083] Based on the identifier position corresponding to the reference port, the second mask bitmap is verified to determine that the identifier value corresponding to the reference port (identifier position) in the second mask bitmap is invalid, and to determine that the identifier values ​​corresponding to other communication ports not in the second state can be correctly assigned according to their current active state, thereby obtaining the final second mask bitmap for subsequent target port selection.

[0084] For example, the expected aggregated bitmap is The updated active aggregation bitmap is Thus, by performing a bitwise logical AND operation between the corresponding identifier positions in the desired aggregation bitmap and the updated active aggregation bitmap, the resulting second mask bit is... Referring to Table 1, in the second mask bitmap, the values ​​of the fourth identifiers corresponding to communication ports 2 and 3 (i.e., the identifiers corresponding to the communication ports in the second mask bitmap, with one fourth identifier corresponding to one communication port) are all 1, indicating that communication ports 2 and 3 are the communication ports that the user expects to participate in processing message data and can perform message processing operations normally; the values ​​of the fourth identifiers corresponding to communication ports 0, 1, 4, 5, 6, and 7 are all 0, indicating that communication ports 0, 1, 4, 5, 6, and 7 are the communication ports that the user expects not to participate in processing message data and / or cannot perform message processing operations normally.

[0085] Step S36: Determine the target port based on the reference bit width, the calculation result, and the second mask bitmap, and use the target port to forward the packet data.

[0086] In this embodiment, the target port is the communication port that the user expects to participate in processing message data and is in a first state for processing message data.

[0087] It is understandable that, since the second mask bitmap is obtained by performing a bitwise logical AND operation between the corresponding identifiers in the expected aggregation bitmap and the updated active aggregation bitmap, the bit width of the second mask bitmap is the same as the reference bit width (i.e., the bit width of the expected aggregation bitmap or the bit width of the updated active aggregation bitmap), and each fourth identifier in the second mask bitmap corresponds to a communication port.

[0088] For example, determine the actual bit width of the operation result and compare it with the number of characters to be truncated. When the actual bit width of the operation result is greater than or equal to the number of characters to be truncated, select the number of characters (i.e., 0 or 1) from the least significant bit to the most significant bit of the operation result to obtain a reference result. When the actual bit width of the operation result is less than the number of characters to be truncated, perform character expansion from the most significant bit of the operation result to make the bit width of the operation result equal to the number of characters to be truncated, and obtain a reference result.

[0089] For example, a preset bitwise operation or numerical conversion operation (e.g., conversion to decimal representation) is performed on the reference result to obtain the undetermined port number. This undetermined port number is used to represent the communication port in the second mask bitmap used for processing message data.

[0090] The pending communication port corresponding to the pending port number is determined based on the pending port number. The fourth identifier corresponding to the pending communication port in the second mask bitmap is obtained as the second reference identifier, and it is determined whether the value of the second reference identifier is valid. When the value of the second reference identifier is valid, the pending communication port is determined as the target port.

[0091] If the value of the second reference identifier is invalid, the search for a valid fourth identifier continues in the second mask bitmap according to the preset identifier position traversal rules. For example, based on the fourth identifier corresponding to the communication port to be determined, each fourth identifier is traversed sequentially towards the highest bit, skipping fourth identifiers with invalid values ​​during the traversal; when the highest bit of the second mask bitmap is reached, the traversal continues from the lowest bit of the second mask bitmap towards the highest bit, until a fourth identifier with a valid value is determined. It can be understood that the lowest and highest bits of the second mask bitmap refer to the positions of the rightmost and leftmost fourth identifiers, respectively.

[0092] For example, a correspondence is established between the target port and the message data to be processed. Thus, the target port (i.e. the communication port used to process message data and which the user expects to participate in processing message data and is in the first state) is determined from the set of valid ports defined by the second mask bitmap (including one or more communication ports that the user expects to participate in processing message data and are in the first state) in the above manner, and the message data is processed using the target port.

[0093] For example, the forwarding task corresponding to the message data to be processed is assigned to the target port, and corresponding sending processing information is generated according to the port configuration of the target port. The message data to be processed is then sent to the sending channel corresponding to the target port. The target port sends the message data to the next network node according to the preset link protocol and sending parameters, thereby completing the forwarding of the message data. In this way, after excluding communication ports in the second state, the target port for processing the message data is re-determined from the communication ports that meet the user's expectations and are currently available.

[0094] This application embodiment determines the reference port by performing a bitwise logical AND operation between the expected aggregation bitmap and the active aggregation bitmap, combined with the message hash result. When an abnormal state of the reference port is detected, the active aggregation bitmap is dynamically updated, thereby re-determining the available target port. As a result, when the communication port state is abnormal, the message forwarding path is quickly adjusted, the processing latency is reduced, and the situation of sending messages to communication ports that are not working properly and causing message loss is reduced or avoided, thereby improving the accuracy of communication port selection and the reliability of message processing.

[0095] In some implementations, embodiments of this application determine the reference port based on the reference bit width, the calculation result, and the first mask bitmap through steps S331 to S334.

[0096] Step S331: Determine the reference index value based on the reference bit width and the calculation result.

[0097] For example, the number of characters to be truncated is determined based on the reference bit width, and the actual bit width of the result is determined. The actual bit width of the result is then compared with the number of characters to be truncated. When the actual bit width of the result is greater than or equal to the number of characters to be truncated, characters (i.e., 0 or 1) are selected from the least significant bit to the most significant bit of the result to obtain the reference result. When the actual bit width of the result is less than the number of characters to be truncated, characters are extended from the most significant bit of the result to make the bit width of the result equal to the number of characters to be truncated, thus obtaining the reference result.

[0098] For example, in this embodiment of the application, the reference result is converted from binary to decimal representation to obtain a reference index value. The reference index value represents the identifier of the communication port expected to be used to process message data.

[0099] For example, the operation result is 0011011101110011, and its actual bit width is 16. The number of characters truncated is 3. Obviously, the actual bit width of 16 is greater than the number of characters truncated by 3. In this embodiment, starting from the least significant bit of the operation result 0011011101110011, three characters are selected sequentially from the least significant bit to the most significant bit. That is, the characters (0 or 1) located in the least significant bit, the second least significant bit, and the third least significant bit from the end are selected to obtain the reference result "011". The reference result "011" is then converted from binary to decimal representation to obtain the reference index value of 3.

[0100] Step S332: Move the identifier corresponding to the reference index value in the first mask bitmap to the least significant bit to obtain the reference mask bitmap.

[0101] It should be understood that moving the identifier corresponding to the reference index value in the first mask bitmap to the lowest bit means: moving the identifier corresponding to the position of the identifier at the reference index value in the first mask bitmap to the lowest bit, and cyclically moving the identifiers originally located in the low bit to the high bit, thereby obtaining the reference mask bitmap.

[0102] For example, the first mask bitmap is The reference index value is 3. In the first mask bitmap, the identifier position corresponding to reference index value 3 is the fourth least significant bit from the end. The value of the identifier corresponding to the fourth least significant bit from the end is 1. After moving the identifier corresponding to the fourth least significant bit from the end to the lowest bit and cyclically moving the identifiers of the lower bits (including the third least significant bit, the second least significant bit, and the lowest bit) that were originally located after the fourth least significant bit from the end to the higher bits, the reference mask bitmap is obtained. In this case, the identifier "1" corresponding to the fourth lowest bit from the end is moved to the lowest bit, and the identifier "101" which was originally located after the fourth lowest bit from the end is cyclically moved to the highest bit.

[0103] Step S333: Perform a first-bit search operation on the reference mask bitmap to determine the offset of the candidate identifier.

[0104] In this embodiment of the application, the candidate identifier is the identifier in the reference mask bitmap that is closest to the least significant bit and has a value of a first preset value, where the first preset value is a valid value of 1.

[0105] In this embodiment, the first-order search operation is the FFS (Find First Set) operation, which is used to retrieve the identifier (i.e., candidate identifier) ​​in the reference mask bitmap that is closest to the least significant bit and has a value of a first preset value (e.g., a valid value of 1), and calculate the offset between the position of the candidate identifier and the least significant bit of the reference mask bitmap.

[0106] For example, a first-bit search operation is performed on the reference mask bitmap starting from the least significant bit to find candidate identifiers. Then, the offset of the candidate identifier is calculated based on the distance between the position of the candidate identifier and the least significant bit; that is, the difference between the position of the candidate identifier and the least significant bit is determined as the offset of the candidate identifier. For example, if the reference mask bitmap is... The search yields a candidate identifier of "1". Since the candidate identifier "1" is in the lowest bit, the distance between the candidate identifier "1" and the lowest bit is calculated to be 0, and the offset of the candidate identifier is determined to be 0.

[0107] Step S334: Determine the reference port based on the reference bit width, reference index value, and offset of the candidate identifier.

[0108] For example, the sum of the offsets of the reference index value and the candidate identifier is calculated, and the reference bit width is moduloed based on the sum of the offsets of the reference index value and the candidate identifier to obtain the reference port.

[0109] In some embodiments, the present application implements steps S3341 to S3343 to determine the reference port based on the reference bit width, the reference index value, and the offset of the candidate identifier.

[0110] Step S3341: Calculate the sum of the offsets of the reference index value and the candidate identifier to obtain the reference sum value.

[0111] Step S3342: Perform a modulo operation on the reference sum based on the reference bit width to obtain the reference number.

[0112] Step S3343: Determine the communication port corresponding to the reference number as the reference port.

[0113] For example, according to the formula: Determine the reference number. In the formula, For reference only. For reference index value, This represents the first mask bitmap. This is the reference bit width. This indicates the first mask bitmap Circular right shift Bit (i.e., moving the identifier corresponding to the reference index value in the first mask bitmap to the least significant bit), Indicates the reference mask bitmap Circular left shift Bit (i.e., moving the identifier corresponding to the reference index value in the first mask bitmap to the least significant bit). " indicates "or", This indicates the first mask bitmap Circular right shift Bits, or for the first mask bitmap Circular left shift Bits, to obtain the reference mask bitmap . Indicates the reference mask bitmap Perform a first-order search operation to determine the offset of the candidate identifier. ,Right now: .in, For reference and value.

[0114] For example, the reference index value, the offset of the candidate identifier, and the reference bit width are substituted into the above formula to calculate the reference number. Finally, based on the reference number, the communication port corresponding to the reference number is determined as the reference port.

[0115] In some implementations, embodiments of this application determine the target port based on the reference bit width, the calculation result, and the second mask bitmap through steps S361 to S363.

[0116] Step S361: Move the identifier corresponding to the reference index value in the second mask bitmap to the lowest bit to obtain the target mask bitmap.

[0117] It should be understood that moving the identifier corresponding to the reference index value in the second mask bitmap to the lowest bit means: moving the identifier corresponding to the identifier position of the reference index value in the second mask bitmap to the lowest bit, and cyclically moving the identifiers originally located in the low bit to the high bit, thereby obtaining the target mask bitmap.

[0118] For example, the second mask bitmap is The reference index value is 3. In the second mask bitmap, the identifier position corresponding to reference index value 3 is the fourth lowest bit from the end. The value of the identifier corresponding to the fourth lowest bit from the end is 1. After moving the identifier corresponding to the fourth lowest bit from the end to the lowest bit and cyclically moving the identifiers of the lower bits (including the third lowest bit, the second lowest bit, and the lowest bit) that were originally located after the fourth lowest bit from the end to the higher bits, the target mask bitmap is obtained. In this case, the identifier "1" corresponding to the fourth lowest bit from the end is moved to the lowest bit, and the identifier "100" which was originally located after the fourth lowest bit from the end is cyclically moved to the highest bit.

[0119] Step S362: Perform a first-bit search operation on the target mask bitmap to determine the offset of the candidate identifier.

[0120] In this embodiment of the application, the candidate identifier is the identifier in the target mask bitmap that is closest to the least significant bit and has a value of a first preset value, where the first preset value is a valid value of 1.

[0121] In this embodiment, the first-order search operation is the FFS (Find First Set) operation, which is used to retrieve the identifier (i.e., candidate identifier) ​​in the target mask bitmap that is closest to the least significant bit and has a value of a first preset value (e.g., a valid value of 1), and calculate the offset between the position of the candidate identifier and the least significant bit of the target mask bitmap.

[0122] For example, a first-bit search operation is performed on the target mask bitmap starting from the least significant bit to find candidate identifiers. Then, the offset of the candidate identifier is calculated based on the distance between the position of the candidate identifier and the least significant bit; that is, the difference between the position of the candidate identifier and the least significant bit is determined as the offset of the candidate identifier. For example, if the target mask bitmap is... The search yields a candidate identifier of "1". Since the candidate identifier "1" is in the lowest bit, the distance between the candidate identifier "1" and the lowest bit is calculated to be 0, and the offset of the candidate identifier is determined to be 0.

[0123] Step S363: Determine the target port based on the reference bit width, reference index value, and offset of the alternative identifier.

[0124] For example, the sum of the offsets of the reference index value and the candidate identifier is calculated, and the reference bit width is moduloed based on the sum of the offsets of the reference index value and the candidate identifier to obtain the target port.

[0125] The logic of steps S361 to S363 above is to ensure that the hardware can quickly and accurately determine the currently available communication port closest to the reference index value within a few clock cycles, thereby instantly migrating the traffic of the abnormal communication port to the target port.

[0126] In some embodiments, the present application implements steps S3631 to S3633 to determine the target port based on the reference bit width, reference index value and offset of the alternative identifier.

[0127] Step S3631: Calculate the sum of the offsets of the reference index value and the candidate identifiers to obtain the target value.

[0128] Step S3632: Perform a modulo operation on the target and the sum of the values ​​based on the reference bit width to obtain the target number.

[0129] Step S3633: Determine the communication port corresponding to the target number as the target port.

[0130] For example, according to the formula Determine the target number. In the formula, Number the target. For reference index value, This represents the second mask bitmap. This is the reference bit width. This indicates the second mask bitmap Circular right shift The bit (i.e., moving the identifier corresponding to the reference index value in the second mask bitmap to the least significant bit), This indicates the second mask bitmap Circular left shift Bit (i.e., move the identifier corresponding to the reference index value in the second mask bitmap to the least significant bit). This indicates the second mask bitmap Circular right shift Bits, or for the second mask bitmap Circular left shift Bits, to obtain the target mask bitmap . Represents the target mask bitmap Perform a first-order search operation to determine the offset of the candidate identifier. ,Right now: .in, For the target and value.

[0131] For example, the reference index value, the offset of the candidate identifier, and the reference bit width are substituted into the above formula to calculate the target number. Finally, based on the target number, the communication port corresponding to the target number is determined as the target port.

[0132] In some embodiments, the message data processing method provided in this application further includes steps S41 to S42.

[0133] Step S41: Obtain the first time point and the second time point.

[0134] Step S42: Determine that the difference between the second time point and the first time point is the port fault delay.

[0135] In this embodiment, the first moment is the start time when the reference port is in the second state, and the second moment is the moment when the target device's data port fully receives the packet data (i.e., the moment when the target device's data port fully receives the packet data resent by the network device after the first moment).

[0136] Port failure delay characterizes the time it takes for a network device to perform a communication port switch and successfully send message data in the event of a communication port failure.

[0137] Please see Figure 4Network device 100 is communicatively connected to target device 200. Network device 100 includes multiple (G) communication ports 140, and target device 200 includes multiple (H) data ports 210, where G and H are integers greater than or equal to 2. Network device 100 uses communication ports 140 to send message data to data ports 210, or network device 100 uses communication ports 140 to receive message data sent by target device 200 through data ports 210. Target device 200 may be, but is not limited to, network testing equipment, terminal equipment, communication equipment, computing equipment, etc.

[0138] For example, the status information of the reference port is detected in real time. When the reference port changes from the first state to the second state, the moment when the abnormal status of the reference port is detected is determined as the first moment, that is, the starting moment when the reference port fails.

[0139] After the initial moment, the reference port is marked as an unavailable port, and the value of the second identifier corresponding to the reference port in the active aggregation bitmap is updated to an invalid value, resulting in an updated active aggregation bitmap. This removes the reference port from the set of optional communication ports for subsequent messages. Simultaneously, the target port for sending the pending message data is re-determined based on the updated active aggregation bitmap.

[0140] The message data to be processed is sent to the newly determined target port, which then transmits the message data to the target device. On the target device side, the received message data at the data port is monitored. When it is determined that the target device's data port has completely received the message data, the timestamp corresponding to the completely received message data is obtained and this timestamp is determined as the second time point. To ensure the accuracy of the time difference calculation, the first and second times points use a unified time base.

[0141] The time difference between the second moment and the first moment is calculated to obtain the time difference value; this time difference value is then determined as the port fault delay. The port fault delay is characterized by the time elapsed from the occurrence of a fault at the reference port to the target device fully receiving the message data.

[0142] In this embodiment, port failure latency is used as an indicator to evaluate the port failure recovery capability of network devices. A lower port failure latency indicates that the network device can complete the removal of unavailable ports, reselection of communication ports, and retransmission of packets faster after detecting a communication port failure, thereby reducing the adverse impact of communication port failures on packet transmission services.

[0143] In some embodiments, before performing a bitwise logical AND operation between the pre-constructed desired aggregation bitmap and the corresponding identifiers in the active aggregation bitmap to obtain the first mask bitmap, the message data processing method provided in this application embodiment further includes step S51.

[0144] Step S51: Construct the desired aggregate bitmap based on multiple communication ports.

[0145] The expected bit width of the aggregation bitmap is the same as the number of communication ports, and the first identifier is used to characterize whether the user expects the communication port to participate in or not participate in processing message data.

[0146] Based on the multiple communication ports included in the network device, the number of communication ports is determined. These ports are then sorted or numbered according to a preset port numbering order to establish a one-to-one correspondence between the communication ports and their corresponding positions in the bitmap.

[0147] The bit width of the desired aggregated bitmap is determined based on the number of communication ports, such that the desired aggregated bitmap includes multiple identifier positions equal to the number of communication ports. Each identifier position uniquely corresponds to one communication port. For example, the first... The communication port corresponds to the first desired aggregation bitmap. Each identifier location.

[0148] For each communication port, obtain the port participation status pre-configured by the user. The port participation status includes the status of participating in message data processing and the status of not participating in message data processing. Among them, the communication ports that participate in message data processing are the ports that the user wants to include in the message processing scope, while the communication ports that do not participate in message data processing are the ports that the user wants to exclude from the message processing scope.

[0149] Based on the port participation status of each communication port, a first identifier with a valid or invalid value is set in the identifier position corresponding to each communication port in the expected aggregation bitmap. That is, when a communication port is configured to participate in processing message data, a first identifier with a valid value is set in the identifier position corresponding to the communication port; when a communication port is configured not to participate in processing message data, a first identifier with an invalid value is set in the identifier position corresponding to the communication port.

[0150] Based on the correspondence between each communication port and the identifier position, multiple first identifiers are sequentially written to their corresponding identifier positions to obtain the expected aggregation bitmap. Thus, the expected aggregation bitmap can represent the user's expectation regarding whether each communication port participates in processing message data through the first identifier at each identifier position.

[0151] The generated expected aggregate bitmap is verified to ensure that its bit width is the same as the number of communication ports, and that each communication port corresponds to a first identifier, thus obtaining the final expected aggregate bitmap.

[0152] In some embodiments, before performing a bitwise logical AND operation between the pre-constructed desired aggregation bitmap and the corresponding identifiers in the active aggregation bitmap to obtain the first mask bitmap, the message data processing method provided in this application embodiment further includes steps S61 to S62.

[0153] Step S61: Detect the first port and the second port among multiple communication ports.

[0154] Step S62: Construct an active aggregation bitmap based on the first port and the second port.

[0155] In this configuration, the first port is the communication port in the first state, and the second port is the communication port in the second state. The bit width of the active aggregation bitmap is the same as the number of communication ports, and the second identifier is used to indicate whether the communication port is in the first or second state.

[0156] The system performs status checks on multiple communication ports in a network device, obtains the status information for each port, and identifies the ports as the first port and the second port based on the check results. The status information indicates whether the communication port is currently capable of performing message processing operations normally.

[0157] According to the preset port numbering order, multiple communication ports are numbered, and a one-to-one correspondence is established between the communication ports and the identifier positions in the active aggregation bitmap according to the numbering order of the communication ports, so that each communication port uniquely corresponds to an identifier position in the active aggregation bitmap.

[0158] Obtain the number of multiple communication ports and determine the number of communication ports as the bit width of the active aggregation bitmap, so that the active aggregation bitmap includes multiple identifier positions equal to the number of communication ports. Each identifier position corresponds to one communication port.

[0159] For each communication port, determine the corresponding second identifier based on whether the communication port is the first port or the second port. When the communication port is the first port, set the value of the second identifier at the identifier position corresponding to the communication port to a valid value; when the communication port is the second port, set the value of the second identifier corresponding to the communication port to an invalid value.

[0160] Based on the correspondence between communication ports and identifier positions, the value of the second identifier corresponding to each communication port is written into the corresponding identifier position in the active aggregation bitmap. For example, the value of the second identifier at the identifier position corresponding to the first port is set to a valid value, and the value of the second identifier at the identifier position corresponding to the second port is set to an invalid value, so that the active aggregation bitmap can directly reflect the current working status of each communication port according to the identifier position.

[0161] After writing the second identifier corresponding to all communication ports, an active aggregation bitmap is obtained. This active aggregation bitmap is then verified to ensure that its bit width is the same as the number of communication ports, and that each communication port uniquely corresponds to a second identifier. Therefore, the active aggregation bitmap can characterize whether each communication port in the network device is currently in a first or second state.

[0162] The following describes in detail the process of processing message data according to a specific embodiment of this application.

[0163] The network device is configured to have 8 communication ports (i.e., communication ports 0, 1, 2, 3, 4, 5, 6, and 7), thus the reference bit width is... If the user expects communication ports 0, 1, 2, and 3 to participate in processing message data, then they expect an aggregated bitmap. The detection revealed that communication ports 0, 1, 2, and 3 are in the first state, while communication ports 4, 5, 6, and 7 are in the second state. Therefore, the active aggregation bitmap is... .

[0164] Step 1: The normal forwarding process is as follows (A1), A2), A3), and A4).

[0165] A1) Hash operation: The message Mess is input into the hash engine, which calculates the hash result of the message Mess and determines the reference index value based on the reference bit width. (Binary representation is 010), refer to the index value This indicates that port number 2 is expected to be selected (i.e., The communication port forwards the Mess message.

[0166] A2) Perform a bitwise AND operation: Perform a bitwise AND operation between the corresponding positions of the desired aggregate bitmap and the active aggregate bitmap to obtain the first mask bitmap. and the first mask bitmap by The bits are shifted cyclically to the right (i.e., shifted 2 bits to the right) based on the reference bit. The original order of the communication ports is [7,6,5,4,3,2,1,0]. After the shift (communication port 2 is shifted to the least significant bit), the order of the communication ports is [1,0,7,6,5,4,3,2]. At this point, the reference mask bitmap is... .

[0167] A3), First-order search (FFS) operation: from the reference mask bitmap The algorithm iterates from the least significant bit to the most significant bit to find candidate identifiers (i.e., identifiers closest to the least significant bit with a value of the first preset value). The reference mask bitmap is as follows: In the algorithm, the value of the identifier corresponding to the least significant bit (bit 0, i.e., communication port 2) is the first preset value (i.e., the valid value 1). Therefore, this identifier is a candidate identifier, and the offset of the candidate identifier is calculated. That is, the difference between the position of the candidate identifier (i.e., bit 0) and the least significant bit (i.e., bit 0) is 0.

[0168] A4) Determine the reference port: According to the formula: Determine the reference number Determine the reference number The corresponding communication port 2 is the reference port, and the Mess message is forwarded using the reference port (i.e., communication port 2).

[0169] Step 2: Communication port anomaly and instantaneous switching process is as follows (B1), B2), B3), B4), B5).

[0170] B1) Anomaly occurs: An anomaly occurs at 12:00:00. The reference port is in the second state. At this time, the value of the second identifier corresponding to the reference port (i.e., communication port 2) is updated to an invalid value of 0.

[0171] B2), Active Aggregation Bitmap Update: The active aggregation bitmap is updated from... Updated to The updated active aggregation bitmap is The value of the second identifier in bit 2 is updated from the valid value 1 to the invalid value 0, indicating that the reference port (i.e., communication port 2) is in the second state (i.e., it cannot perform message processing operations normally).

[0172] B3) Redetermine the message Mess forwarding path: The message Mess is input into the hash engine again. The hash engine calculates the hash result of the message Mess and determines the reference index value based on the reference bit width. (Binary representation is 010), refer to the index value This indicates that port number 2 is expected to be selected (i.e., The communication port forwards the Mess message. A bitwise logical AND operation is performed between the expected aggregate bitmap and the corresponding identifiers in the updated active aggregate bitmap to obtain the second mask bitmap. ; the second mask bitmap by The data is then cyclically shifted to the right (i.e., shifted 2 bits to the right). The original order of the communication ports is [7,6,5,4,3,2,1,0]. After the shift (with communication port 2 shifted to the least significant bit), the order of the communication ports is [1,0,7,6,5,4,3,2]. At this point, the target mask bitmap is... .

[0173] B4), First-order search (FFS) operation: from the target mask bitmap The algorithm iterates from the least significant bit to the most significant bit to find a candidate identifier (i.e., the identifier closest to the least significant bit and with a value of the first preset value). The target mask bitmap is as follows: In the algorithm, the value of the identifier corresponding to the least significant bit (bit 0, i.e., communication port 2) is not the first preset value, so this identifier is not a candidate identifier; the value of the identifier corresponding to the second least significant bit (bit 1, i.e., communication port 3) is the first preset value (i.e., valid value 1), so this identifier is a candidate identifier, and the offset of the candidate identifier is calculated. That is, the difference between the position of the candidate identifier (i.e., bit 1) and the least significant bit (i.e. bit 0) is 1.

[0174] B5) Determine the target port: According to the formula: Determine the target number Determine the target number The corresponding communication port 3 is the target port, and the message Mess is forwarded using the target port (i.e., communication port 3). In this way, the message Mess that was originally processed by the reference port (i.e., communication port 2) can be migrated to be processed by the target port (i.e., communication port 3).

[0175] Step 3: The process for determining port failure delay is as follows (C1), C2), C3).

[0176] C1) Record the first moment: Record the precise moment when the reference port (i.e., communication port 2) experienced an anomaly. (i.e., 12:00:00), will As the first moment.

[0177] C2) Record the second moment: After switching to the target port (i.e., communication port 3), after the message Mess is sent from the target port (i.e., communication port 3), obtain the timestamp of the target device fully receiving the message Mess. As the second moment.

[0178] C3) Calculate port fault delay: The second moment... With the first moment The difference is used to obtain the port failure delay. ,Right now: .

[0179] In summary, the embodiments of this application determine the reference port by performing a bitwise logical AND operation between the expected aggregation bitmap and the active aggregation bitmap, combined with the message hash result. When an abnormal state of the reference port is detected, the active aggregation bitmap is dynamically updated, thereby re-determining the available target port. As a result, the message forwarding path can be quickly adjusted when the communication port state is abnormal, reducing processing latency, reducing or avoiding the situation where messages are sent to communication ports that are not working properly, resulting in message loss, and improving the accuracy of communication port selection and the reliability of message processing.

[0180] This application provides a computer-readable storage medium storing processor-executable program instructions. When executed by a processor, the program instructions cause the processor to perform the message data processing method provided in this application, or to perform the steps in any possible implementation of the message data processing method provided in this application.

[0181] In some embodiments, the storage medium may be a flash memory, a hard disk, an optical disk, a register, a magnetic surface memory, a removable disk, a CD-ROM, a random access memory (RAM), a read-only memory (ROM), an electrically programmable ROM, and an electrically erasable programmable ROM, or any other form of storage medium known in the art, or various devices including one or any combination of the above storage media.

[0182] In some embodiments, program instructions may take the form of programs, software, software modules, scripts, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as stand-alone programs or as modules, components, subroutines, or other units suitable for use in a computing environment.

[0183] As an example, program instructions may, but do not necessarily, correspond to files in the file system. They may be stored as part of a file that holds other programs or data, for example, in one or more scripts in a Hyper Text Markup Language (HTML) document, or in a single file dedicated to the program in question, or in multiple collaborative files (such as files that store one or more modules, subroutines, or code sections).

[0184] As an example, program instructions can be deployed to execute on a computing device (including devices such as smart terminals and servers), or on multiple computing devices located in one location, or on multiple computing devices distributed across multiple locations and interconnected via a communication network. It is understood that all or part of the steps of the methods described in the embodiments provided in this application can be implemented directly using electronic hardware or processor-executable program instructions, or a combination of both.

[0185] Those skilled in the art will understand that the embodiments provided in this application are merely illustrative. The order in which the steps in the methods of the embodiments are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The order can be adjusted, merged, and deleted according to actual needs. Modules or sub-modules, units or sub-units in the apparatus or system of the embodiments can be merged, divided, and deleted according to actual needs. For example, the division of units is only a logical functional division, and there may be other division methods in actual implementation. For another example, multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed.

[0186] Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented using software plus a general-purpose hardware platform, and of course, it can also be implemented using hardware. Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This computer program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. It should be understood that the storage medium can be flash memory, hard disk, optical disk, register, magnetic surface memory, removable disk, CD-ROM, random access memory (RAM), read-only memory (ROM), electrically programmable ROM, and electrically erasable programmable ROM, etc.

[0187] It should be noted that the above embodiments are for illustrating the technical concept and features of this application, and are intended to enable those skilled in the art to understand the content of this application and implement it accordingly. They should not be construed as limiting the scope of protection of this application. Those skilled in the art can understand that all or part of the processes of the above embodiments can be implemented, modified according to the technical solutions described in the embodiments of this application, or equivalent substitutions can be made to some of the technical features. It is understood that these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application, and should be considered as equivalent changes and modifications made based on the embodiments of this application, all of which should fall within the scope of the claims of this application.

Claims

1. A message data processing method, characterized in that, Applied to a network device, the network device including multiple communication ports, the method includes: A bitwise logical AND operation is performed between the pre-constructed expected aggregation bitmap and the corresponding identifiers in the active aggregation bitmap to obtain a first mask bitmap. The expected aggregation bitmap includes multiple first identifiers, and the active aggregation bitmap includes multiple second identifiers. Each communication port corresponds to one first identifier and one second identifier. Perform a hash operation on the message data to be processed to obtain the result; Based on the reference bit width, the calculation result, and the first mask bitmap, a reference port is determined. The reference bit width is the bit width of the expected aggregation bitmap or the bit width of the active aggregation bitmap. The reference port is the communication port that the user expects to participate in processing message data and is in a first state and used to process the message data. The first state indicates that the communication port can normally perform message processing operations. In response to the reference port being in the second state, the active aggregation bitmap is updated based on the second state to obtain the updated active aggregation bitmap. The second state indicates that the communication port cannot perform message processing operations normally. Perform a bitwise logical AND operation between the desired aggregate bitmap and the corresponding identifiers in the updated active aggregate bitmap to obtain a second mask bitmap; The target port is determined based on the reference bit width, the calculation result, and the second mask bitmap, and the message data is forwarded using the target port. The target port is the communication port that the user expects to participate in processing the message data, is in the first state, and is used to process the message data.

2. The message data processing method according to claim 1, characterized in that, The step of determining the reference port based on the reference bit width, the calculation result, and the first mask bitmap includes: The reference index value is determined based on the reference bit width and the calculation result; The identifier corresponding to the reference index value in the first mask bitmap is moved to the least significant bit to obtain the reference mask bitmap. A first-bit search operation is performed on the reference mask bitmap to determine the offset of the candidate identifier, wherein the candidate identifier is the identifier in the reference mask bitmap that is closest to the least significant bit and has a value of a first preset value; The reference port is determined based on the reference bit width, the reference index value, and the offset of the candidate identifier.

3. The message data processing method according to claim 2, characterized in that, Determining the reference port based on the reference bit width, the reference index value, and the offset of the candidate identifier includes: The reference sum is obtained by summing the offset of the reference index value and the candidate identifier. Perform a modulo operation on the reference sum value based on the reference bit width to obtain the reference number; The communication port corresponding to the reference number is determined as the reference port.

4. The message data processing method according to claim 2, characterized in that, The step of determining the target port based on the reference bit width, the calculation result, and the second mask bitmap includes: The identifier corresponding to the reference index value in the second mask bitmap is moved to the least significant bit to obtain the target mask bitmap. Perform a first-bit search operation on the target mask bitmap to determine the offset of the candidate identifier, wherein the candidate identifier is the identifier in the target mask bitmap that is closest to the least significant bit and has a value of a first preset value; The target port is determined based on the reference bit width, the reference index value, and the offset of the candidate identifier.

5. The message data processing method according to claim 4, characterized in that, Determining the target port based on the reference bit width, the reference index value, and the offset of the candidate identifier includes: The target value is obtained by summing the offset of the reference index value and the candidate identifier. Perform a modulo operation on the target and the value based on the reference bit width to obtain the target number; The communication port corresponding to the target number is determined as the target port.

6. The message data processing method according to any one of claims 1-5, characterized in that, The network device is communicatively connected to the target device, and the method further includes: The first moment and the second moment are obtained. The first moment is the start time when the reference port is in the second state, and the second moment is the moment when the data port of the target device completely receives the message data. The difference between the second time point and the first time point is determined as the port failure delay, which represents the time delay for the network device to perform communication port switching and successfully send message data in the event of a communication port failure.

7. The message data processing method according to claim 1, characterized in that, Before performing a bitwise logical AND operation between the pre-constructed desired aggregation bitmap and the corresponding identifiers in the active aggregation bitmap to obtain the first mask bitmap, the method further includes: Based on the multiple communication ports, a desired aggregation bitmap is constructed, wherein the bit width of the desired aggregation bitmap is the same as the number of communication ports, and the first identifier is used to characterize whether the user expects the communication port to participate in or not participate in processing message data.

8. The message data processing method according to claim 1, characterized in that, Before performing a bitwise logical AND operation between the pre-constructed desired aggregation bitmap and the corresponding identifiers in the active aggregation bitmap to obtain the first mask bitmap, the method further includes: Detect a first port and a second port among a plurality of communication ports, wherein the first port is a communication port in a first state and the second port is a communication port in a second state; An active aggregation bitmap is constructed based on the first port and the second port, wherein the bit width of the active aggregation bitmap is the same as the number of communication ports, and the second identifier is used to characterize whether the communication port is in a first state or a second state.

9. A network device, characterized in that, The device includes a processor and a memory, the processor being communicatively connected to the memory, the memory storing program instructions executable by the processor, and the program instructions, when executed by the processor, causing the network device to perform the message data processing method as described in any one of claims 1-8.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores processor-executable program instructions, which, when executed by the processor, cause the processor to perform the message data processing method as described in any one of claims 1-8.