Message processing method and device, medium and electronic equipment

The switching chip performs detection based on the number of retransmissions and the retransmission interval of the loop detection message, which solves the problem of Ethernet switch loop status detection consuming CPU resources, realizes loop detection without running the spanning tree protocol, and saves time. CPU computing resources improve network performance.

CN118764449APending Publication Date: 2024-10-11NANJING JINZHEN MICROELECTRONICS TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411057734.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-02
Publication Date
2024-10-11

AI Technical Summary

Technical Problem

Existing Ethernet switches consume a lot of CPU computing resources when detecting loop status, resulting in network performance degradation.

Method used

The loop detection message is obtained through the switching chip, and detected based on the number of retransmissions and retransmission interval, and enters the associated state to avoid running the spanning tree protocol, thereby saving CPU computing resources.

Benefits of technology

It implements loop detection of switch chips, reduces the consumption of CPU computing resources, and improves network performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118764449A_ABST
    Figure CN118764449A_ABST
Patent Text Reader

Abstract

The invention provides a message processing method and device, a medium and electronic equipment. The message processing method comprises the following steps: the switch chip obtains a loop detection message; when the switch chip does not start the loop detection protocol, the switch chip processes the loop detection message as a broadcast message; when the switching chip starts a loop detection protocol, if the switching chip processes the loop detection protocol, the switching chip performs first detection on the loop of the switching chip based on the retransmission times and retransmission intervals of the loop detection message; and if not, the CPU processes the loop detection protocol, when the loop detection message received by the switch chip is the loop detection message sent by the CPU, the received loop detection message is discarded, and if the loop detection message sent by the CPU is not the loop detection message sent by the CPU, the switch chip enters the state associated with the first detection result. And when the loop detection message received by the switching chip is not the loop detection message sent by the switching chip, forwarding the received loop detection message. The message processing method can save CPU computing resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of Ethernet switches and relates to a message processing method, and in particular to a message processing method, device, medium and electronic equipment. Background Art

[0002] Errors in network connection or configuration can cause loops in the network. Once a loop occurs in the network, the network device (switch) will repeatedly send broadcast messages, multicast messages, and unknown unicast messages, causing broadcast storms and network paralysis. For Ethernet switches, the spanning tree protocol is enabled in most networking to complete the loop-free topology of the entire Layer 2 network, but running the spanning tree protocol consumes a lot of CPU computing resources. Therefore, the current message processing method has the problem that the loop status detection of the switch chip consumes a lot of CPU computing resources. Summary of the invention

[0003] The purpose of the present application is to provide a message processing method, device, medium and electronic device, which are used to solve the problem that the loop status detection of the switching chip in the current message processing method consumes a lot of CPU computing resources.

[0004] In a first aspect, the present application provides a message processing method, which is applied to a message processing system, wherein the message processing system includes a switching chip and a CPU, and the message processing method includes: the switching chip obtains a loop detection message; when the switching chip does not enable the loop detection protocol, the switching chip treats the loop detection message as a broadcast message; when the switching chip enables the loop detection protocol, if the switching chip processes the loop detection protocol, the switching chip performs a first detection on the loop of the switching chip based on the number of retransmissions and the retransmission interval of the loop detection message, so that the switching chip enters a state associated with the first detection result, otherwise the CPU processes the loop detection protocol, when the loop detection message received by the switching chip is a loop detection message sent by itself, the received loop detection message is discarded, and when the loop detection message received by the switching chip is not a loop detection message sent by itself, the received loop detection message is forwarded, the state of the switching chip includes a loop state and a non-loop state, and the switching chip is initially in a non-loop state.

[0005] In the message processing method, after the switching chip starts the loop detection protocol, the switching chip performs a first detection on the loop of the switching chip based on the number of retransmissions and the retransmission interval of the loop detection message, so that the switching chip enters a state associated with the first detection result, that is, a loop state or a non-loop state, thereby realizing loop detection of the switch chip. The switching chip does not need to run the spanning tree protocol, which can save CPU computing resources.

[0006] In one embodiment of the present application, the non-loop state includes a normal state and a detection state, the number of retransmissions includes the number of retransmissions of the detection state and the number of retransmissions of the loop state, the retransmission interval includes the retransmission interval of the detection state and the retransmission interval of the loop state, if the loop detection protocol is processed by the switching chip, the switching chip enters the detection state from the normal state, the switching chip detects the loop of the switching chip based on the number of retransmissions and the retransmission interval of the loop detection message, so that the switching chip enters a state associated with the detection result. The implementation method includes: the switching chip transmits the loop detection message to the sending port represented by the mask; based on the detection state The switching chip retransmits the loop detection message according to the sending port according to the number of retransmissions and the retransmission interval of the detection state; the switching chip checks and processes the received message to determine whether the message received by the switching chip is a loop detection message sent by the switching chip itself; if there is a port in the switching chip that receives a loop detection message sent by the switching chip itself, the switching chip enters a loop state, otherwise the switching chip enters a normal state; when the switching chip is in the loop state, a second detection is performed on the loop of the switching chip based on the number of retransmissions of the loop state and the retransmission interval of the loop state, so that the switching chip enters a state associated with the second detection result.

[0007] In one embodiment of the present application, when the switching chip is in the loop state, the implementation method of the switching chip updating the state based on the number of retransmissions of the loop state and the retransmission interval of the loop state includes: based on the number of retransmissions of the loop state and the retransmission interval of the loop state, the switching chip retransmits the loop detection message according to the port; the switching chip checks and processes the received message to determine whether the message received by the switching chip is a loop detection message sent by the switching chip itself; when the switching chip receives the loop detection message sent by the switching chip itself, the switching chip is still in the loop state; when the number of times the loop detection message in the loop state is sent is the same as the number of retransmissions of the loop state, the switching chip has not received the loop detection message sent by the switching chip itself, and the switching chip updates the state based on the loop detection trigger mode.

[0008] In one embodiment of the present application, the loop detection trigger mode is a periodic inspection mode or a non-periodic inspection mode, and the loop detection trigger mode includes an implementation method for updating the status of the switching chip based on the loop detection trigger mode, including: when the loop detection trigger mode is the periodic inspection mode, the switching chip returns to the detection state; when the loop detection trigger mode is the non-periodic inspection mode, the switching chip returns to the normal state.

[0009] In one embodiment of the present application, the switching chip checks and processes the received message to determine whether the message received by the switching chip is a loop detection message sent by the switching chip itself. The implementation method includes: the switching chip obtains the Ethernet type field value and the protocol value of the received message; based on the Ethernet type field value and the protocol value, the switching chip determines whether the received message is the loop detection message; when the message received by the switching chip is the loop detection message, the source MAC, identifier, and magic number in the message received by the switching chip are compared with the switching MAC, loop detection random number, and loop detection magic number based on the loop detection comparison identifier to determine whether the message received by the switching chip is a loop detection message sent by the switching chip itself.

[0010] In one embodiment of the present application, when the switching chip is in the loop state, the message processing method also includes: the switching chip parses the loop detection message sent by itself to obtain the port number of the sending message; the switching chip sets a first mask for the port for receiving the loop detection message sent by itself; based on the port number of the sending message, the port number of the receiving loop detection message sent by itself and the first mask, the port number of the loop is obtained.

[0011] In one embodiment of the present application, when the loop state is released, the message processing method also includes: the switching chip updates the first mask to obtain a second mask; based on the port number of the sent message, the port number of the loop detection message sent by itself, and the second mask, the updated port number of the loop is obtained.

[0012] In a second aspect, the present application provides a message processing device, which is applied to a message processing system, wherein the message processing system includes a switching chip and a CPU, and the message processing device includes: a loop detection message acquisition module, which is used for the switching chip to acquire a loop detection message; a loop detection message processing module, which is used to process the loop detection message as a broadcast message when the loop detection protocol is not enabled on the switching chip; and a switching chip status update module, which is used to update the loop detection protocol based on the loop detection protocol when the loop detection protocol is enabled on the switching chip. The first detection is performed on the loop of the switching chip according to the number of retransmissions and the retransmission interval of the measurement message, so that the switching chip enters a state associated with the first detection result, otherwise the CPU processes the loop detection protocol, when the loop detection message received by the switching chip is a loop detection message sent by itself, the received loop detection message is discarded, when the loop detection message received by the switching chip is not a loop detection message sent by itself, the received loop detection message is forwarded, the state of the switching chip includes a loop state and a non-loop state, and the switching chip is initially in a non-loop state.

[0013] In a third aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the message processing method described in any one of the first aspects of the present application.

[0014] In a fourth aspect, the present application provides an electronic device, comprising: a memory storing a computer program; and a processor communicatively connected to the memory, for executing any message processing method described in the first aspect of the present application when the computer program is called.

[0015] As described above, the message processing method, device, medium and electronic device of the present application have the following beneficial effects:

[0016] In the message processing method, after the switching chip starts the loop detection protocol, the switching chip performs a first detection on the loop of the switching chip based on the number of retransmissions and the retransmission interval of the loop detection message, so that the switching chip enters a state associated with the first detection result, that is, a loop state or a non-loop state, thereby realizing loop detection of the switch chip. The switching chip does not need to run the spanning tree protocol, which can save CPU computing resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 Shown is a structural schematic diagram of the message processing system of an embodiment of the present application.

[0018] Figure 2 Shown is a flowchart of the message processing method according to an embodiment of the present application.

[0019] Figure 3 Shown is a flowchart of a method for implementing a state update of the switching chip based on the number of retransmissions and the retransmission interval of the loop detection message according to an embodiment of the present application.

[0020] Figure 4 It is a flowchart of an implementation method of updating the state of the switching chip based on the number of retransmissions of the loop state and the retransmission interval of the loop state when the switching chip is in the loop state according to an embodiment of the present application.

[0021] Figure 5 Shown is a flowchart of a method for implementing a state update of a switching chip based on a loop detection trigger mode according to an embodiment of the present application.

[0022] Figure 6 The flowchart shows a method for implementing a method in which the switching chip of an embodiment of the present application checks and processes a received message to determine whether the message received by the switching chip is a loop detection message sent by the switching chip itself.

[0023] Figure 7 Shown is a flowchart of the message processing method according to an embodiment of the present application.

[0024] Figure 8 It is shown as a flow chart of the message processing method when the loop state is released.

[0025] Fig. 9 Shown is a structural schematic diagram of the message processing device described in an embodiment of the present application.

[0026] Fig.10 The diagram shows the encapsulation format of a loop detection message.

[0027] Component number description

[0028] 10 Message Processing System

[0029] 110 Switch Chip

[0030] 120 CPU

[0031] 800 Message Processing Device

[0032] 810 Loop detection message acquisition module

[0033] 820 loop detection message processing module

[0034] 830 Switch chip status update module

[0035] Steps S11-S13

[0036] Steps S21-S25

[0037] Steps S31-S34

[0038] Steps S41-S42

[0039] Steps S51-S53

[0040] Steps S61-S63

[0041] Steps S71-S72 DETAILED DESCRIPTION

[0042] The following describes the embodiments of the present application through specific examples, and those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. The present application can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.

[0043] It should be noted that the illustrations provided in the following embodiments are only used to illustrate the basic concept of the present application in a schematic manner, and therefore the illustrations only show components related to the present application rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.

[0044] The technical solutions in the embodiments of the present application are described in detail below in conjunction with the drawings in the embodiments of the present application.

[0045] The message processing method provided in the embodiment of the present application can be executed in a message processing system. Figure 1 For example, Figure 1 The structure diagram of the message processing system is shown in FIG. 1. The message processing system 10 may include a switching chip 110 and a CPU 120 which are communicatively connected to each other.

[0046] Optionally, the switching chip 110 includes an LED and a buzzer. When a loop exists in the switching chip 110 and when the loop is released, the working states of the LED and the buzzer are different, which can be used to inform the user whether a loop exists in the switching chip 110.

[0047] like Figure 2 As shown, this embodiment provides a message processing method, which is applied to a message processing system. The message processing system includes a switching chip and a CPU. The message processing method includes:

[0048] S11, the switching chip obtains a loop detection message.

[0049] S12: When the loop detection protocol is not enabled on the switching chip, the switching chip processes the loop detection message as a broadcast message.

[0050] Optionally, when the switching chip enables the loop detection protocol, LDP_ENABLE of the switching chip may be 1; and when the switching chip does not enable the loop detection protocol, LDP_ENABLE of the switching chip may be 0.

[0051] Optionally, the process of the switching chip processing the broadcast message is not described in detail in this embodiment.

[0052] S13, when the switching chip turns on the loop detection protocol, if the switching chip processes the loop detection protocol, the switching chip performs a first detection on the loop of the switching chip based on the number of retransmissions and the retransmission interval of the loop detection message, so that the switching chip enters a state associated with the first detection result; otherwise, the CPU processes the loop detection protocol, when the loop detection message received by the switching chip is a loop detection message sent by itself, the received loop detection message is discarded, and when the loop detection message received by the switching chip is not a loop detection message sent by itself, the received loop detection message is forwarded, and the state of the switching chip includes a loop state and a non-loop state, and the switching chip is initially in a non-loop state.

[0053] Optionally, when the loop detection protocol is processed by the switching chip, LDP_CPU_ENABLE of the switching chip is 0; when the loop detection protocol is processed by the CPU, LDP_CPU_ENABLE of the switching chip is 1.

[0054] Optionally, the number of retransmissions may refer to the number of times the loop detection message is retransmitted, the retransmission interval may refer to the time interval between every two retransmissions of the loop detection message, the number of retransmissions and the retransmission interval may be stored in corresponding registers respectively, and the present embodiment does not explicitly limit the values ​​of the number of retransmissions and the retransmission interval, which may be flexibly set according to actual conditions. Optionally, the non-loop state includes a normal state and a detection state, the number of retransmissions includes the number of retransmissions of the detection state and the number of retransmissions of the loop state, the retransmission interval includes the retransmission interval of the detection state and the retransmission interval of the loop state, and if the loop detection protocol is processed by the switching chip, the switching chip enters the detection state from the normal state.

[0055] Optionally, the number of retransmissions of the detection state may be determined by the value of the LDP_RETRY_COUNT_CHKSTATE register, the retransmission interval of the detection state may be determined by the value of the LDP_RETRY_PERIOD_CHKSTATE register, and the time is in milliseconds. The number of retransmissions of the loop state may be determined by the value of the LDP_RETRY_COUNT_LOOPSTATE register, the retransmission interval of the loop state may be determined by the value of the LDP_RETRY_PERIOD_LOOPSTATE register, and the time unit of the retransmission interval is in milliseconds.

[0056] Optionally, the first detection result refers to a result of a first detection of the loop of the switching chip based on the number of retransmissions and the retransmission interval of the loop detection message.

[0057] Optionally, when the loop detection protocol is processed by a CPU, the algorithm on the CPU side is not described in detail in this embodiment.

[0058] Optionally, the switching chip's support for the loop prevention protocol may be supported by a CPU built into the switch. The switching chip only needs to support forwarding the loop prevention protocol message to the CPU for software to implement.

[0059] According to the above description, the message processing method described in this embodiment includes: the switching chip obtains a loop detection message; when the switching chip does not enable the loop detection protocol, the switching chip processes the loop detection message as a broadcast message; when the switching chip enables the loop detection protocol, if the switching chip processes the loop detection protocol, the switching chip performs a first detection on the loop of the switching chip based on the number of retransmissions and the retransmission interval of the loop detection message, so that the switching chip enters a state associated with the first detection result, otherwise the CPU processes the loop detection protocol, when the loop detection message received by the switching chip is a loop detection message sent by itself, the received loop detection message is discarded, when the loop detection message received by the switching chip is not a loop detection message sent by itself, the received loop detection message is forwarded, the state of the switching chip includes a loop state and a non-loop state, and the switching chip is initially in a non-loop state.

[0060] In the message processing method, after the switching chip starts the loop detection protocol, the switching chip performs a first detection on the loop of the switching chip based on the number of retransmissions and the retransmission interval of the loop detection message, so that the switching chip enters a state associated with the first detection result, that is, a loop state or a non-loop state, thereby realizing loop detection of the switch chip. The switching chip does not need to run the spanning tree protocol, which can save CPU computing resources.

[0061] See also Figure 3 ,like Figure 3 As shown, this embodiment provides a flowchart of an implementation method for the switching chip to detect the loop of the switching chip based on the number of retransmissions and the retransmission interval of the loop detection message, so that the switching chip enters a state associated with the detection result, including:

[0062] S21, the switching chip transmits the loop detection message to the sending port indicated by the mask.

[0063] Optionally, the sending port represented by the mask may refer to the port represented by LDP_TX_PMSK, the mask of the sending port may be 1, and the mask of the non-transmitting port may be 0. When the CPU processes the loop detection protocol, the sending port represented by the mask is not affected by the filtering conditions of other strategies of the switching chip.

[0064] S22, based on the number of retransmissions of the detection state and the retransmission interval of the detection state, the switching chip retransmits the loop detection message according to the sending port.

[0065] S23, the switching chip checks and processes the received message to determine whether the message received by the switching chip is a loop detection message sent by the switching chip itself.

[0066] Optionally, the checking process may refer to a process of checking a field value in a message received by the switching chip, which can be used to determine whether the message received by the switching chip is a loop detection message sent by the switching chip itself.

[0067] S24, if there is a port in the switching chip that receives a loop detection message sent by the switching chip itself, the switching chip enters a loop state, otherwise the switching chip enters a normal state.

[0068] Optionally, the existence of a port of the switching chip receiving a loop detection message sent by the switching chip itself may refer to that only one port in the switching chip receives the loop detection message sent by the switching chip itself.

[0069] Optionally, when a port in the switching chip receives a loop detection message sent by the switching chip itself, the switching chip enters a loop state and clears a counter compared with LDP_RETRY_COUNT_LOOPSTATE to 0. The counter can be used to record the number of times the loop detection message is sent in the loop state.

[0070] Optionally, when the switch chip enters the loop state, the switch chip will flash the LED at a slower speed and trigger an external buzzer to inform the user that a loop has occurred. When the switch chip returns to the normal state, the LED will resume the original flashing mode. For example, when the switch chip is in the loop state, the loop detection protocol is turned off, the switch chip returns to the normal state, and the LED resumes the original flashing mode.

[0071] Optionally, turning on the LED and triggering the external buzzer can be completed by the CPU or the switching chip, which can be specifically determined by the value of LDP_INDICATOR_SOURCE. When LDP_INDICATOR_SOURCE=1, it means that the actions of turning on the LED and triggering the buzzer are completed by the switching chip, and when LDP_INDICATOR_SOURCE=0, it means that the actions of turning on the LED and triggering the buzzer are completed by the CPU. When the loop in the switching chip is released, the actions of stopping the LED and the buzzer can also be completed by the switching chip or the CPU, which can be specifically determined by the value of RLDP_INDICATOR_SOURCE. When RLDP_INDICATOR_SOURCE=0, the switching chip stops, and when RLDP_INDICATOR_SOURCE=1, the CPU stops.

[0072] Optionally, the message processing method also includes: when a loop is detected in the switching chip, the switching chip sends a first interrupt notification to the CPU, and the first interrupt notification is used to inform the CPU that a loop has occurred; when the loop in the switching chip is released, the switching chip sends a second interrupt notification to the CPU, and the second interrupt notification is used to inform the CPU that the loop state in the CPU has been removed.

[0073] Optionally, when a loop is detected in the switching chip:

[0074] write LDP_LOOP_PMSK, LDP_LOOP_PORT_Pn; (write LDP_LOOP_PMSK and LDP_LOOP_PORT_Pn)

[0075] set INTER_IMS_LOOP_DETECTION; (the switching chip sets the interruption of the loop port)

[0076] interrupt to CPU; (send interrupt notification to CPU)

[0077] set INTER_IMS_CPU_LOOP_DETECTION; (CPU sets the interrupt of the loop port)

[0078] interrupt to CPU (send interrupt notification to CPU).

[0079] When the loop in the switching chip is cleared:

[0080] write LDP_LOOP_PMSK; (write LDP_LOOP_PMSK)

[0081] set INTER_IMS_LOOP_DETECTION; (the switching chip sets the interruption of the loop port)

[0082] interrupt to CPU; (send interrupt notification to CPU)

[0083] set INTER_IMS_CPU_LOOP_DETECTION; (CPU sets the interrupt of the loop port)

[0084] interrupt to CPU. (Send interrupt notification to CPU)

[0085] S25, when the switching chip is in the loop state, performing a second detection on the loop of the switching chip based on the number of retransmissions of the loop state and the retransmission interval of the loop state, so that the switching chip enters a state associated with the second detection result.

[0086] Optionally, the second detection result may refer to the result of a second detection of the loop of the switching chip based on the number of retransmissions of the loop state and the retransmission interval of the loop state. The "first" and "second" in the first detection and the second detection are only used to indicate different detection processes.

[0087] Optionally, when the second detection result is that there is no loop in the switching chip, the state associated with the second detection result is the non-loop state; when the second detection result is that there is a loop in the switching chip, the state associated with the second detection result is the loop state.

[0088] See also Figure 4 ,like Figure 4 As shown, this embodiment provides a method for implementing that when the switching chip is in the loop state, the switching chip updates the state based on the number of retransmissions of the loop state and the retransmission interval of the loop state, including:

[0089] S31, based on the number of retransmissions of the loop status and the retransmission interval of the loop status, the switching chip retransmits the loop detection message according to the port.

[0090] S32: The switching chip checks and processes the received message to determine whether the message received by the switching chip is a loop detection message sent by the switching chip itself.

[0091] S33, when the switch chip receives a loop detection message sent by the switch chip itself, the switch chip is still in the loop state.

[0092] S34, when the number of times the loop detection message in the loop state is sent is the same as the number of times the loop state is resent, the switching chip has not received the loop detection message sent by the switching chip itself, and the switching chip updates the state based on the loop detection trigger mode.

[0093] Optionally, the number of times the loop detection message is sent in the loop state may be recorded through a register.

[0094] Optionally, the loop detection trigger mode may be a value of LDP_TRIGGER_MODE, and the value of LDP_TRIGGER_MODE may be 0 or 1. When the value of LDP_TRIGGER_MODE is 0, it indicates a non-periodic check mode, and when the value of LDP_TRIGGER_MODE is 1, it indicates a periodic check mode.

[0095] See also Figure 5 ,like Figure 5 As shown, the loop detection trigger mode is a periodic check mode or a non-periodic check mode. This embodiment provides a method for implementing the state update of the switching chip based on the loop detection trigger mode, including:

[0096] S41, when the loop detection trigger mode is the periodic check mode, the switching chip returns to the detection state.

[0097] S42, when the loop detection trigger mode is the non-periodic check mode, the switching chip returns to the normal state.

[0098] See also Figure 6 ,like Figure 6 As shown, this embodiment provides a method for implementing the switching chip to check and process the received message to determine whether the message received by the switching chip is a loop detection message sent by the switching chip itself, including:

[0099] S51, the switching chip obtains the Ethernet type field value and protocol value of the received message.

[0100] Optionally, the frame format of the loop detection message is shown in Table 1 below:

[0101]

[0102] Table 1

[0103] DA indicates the destination address, SA indicates the source address, EtherType indicates the Ethernet type, Protocol indicates the protocol, Identifier indicates the identifier, magic number indicates the magic number, Port Number indicates the port number, and Padding+CRC indicates padding and cyclic redundancy check.

[0104] S52: Based on the Ethernet type field value and the protocol value, the switching chip determines whether the received message is the loop detection message.

[0105] Optionally, when the Ethernet type field value is 0x88aa and the protocol value is 0x18, the message received by the switching chip is the loop detection message.

[0106] S53, when the message received by the switching chip is the loop detection message, the source MAC, identifier, and magic number in the message received by the switching chip are compared with the switching MAC, loop detection random number, and loop detection magic number based on the loop detection comparison identifier to determine whether the message received by the switching chip is a loop detection message sent by the switching chip itself.

[0107] Optionally, the loop detection random number and the loop detection magic number may refer to a random number and a magic number generated during a loop detection process on the switching chip.

[0108] Optionally, each time the switch chip enters the detection state, it generates a set of 6-byte Random Sequence Number, and the Random Sequence Number is the Identifier in the message.

[0109] Optionally, when the CPU processes the loop detection protocol, the CPU can inform the switching chip to generate a set of random numbers to the LDP_RANDOM_NUMBER register by writing 1 to the register LDP_GEN_RANDOM. LDP_GEN_RANDOM is cleared by hardware. When a new Random Number is generated, in order to prevent the switching chip from generating the same Random Number when the chips are powered on at the same time, a magic number can be used to avoid this situation. The value of the magic number exists in the LDP_MAGIC_NUMBER register, and the value stored in this register is the loop detection magic number.

[0110] Optionally, the implementation method of comparing the source MAC, identifier, and random number seed in the message received by the switching chip with the switching MAC, the loop detection random number, and the loop detection magic number based on the loop detection comparison identifier to determine whether the message received by the switching chip is a loop detection message sent by the switching chip itself includes: when the value of the loop detection comparison identifier is 0, the source MAC and the random number seed in the message received by the switching chip are compared with the switching MAC and the loop detection magic number to determine whether the message received by the switching chip is a loop detection message sent by the switching chip itself; when the value of the loop detection comparison identifier is 1, the source MAC, identifier, and random number seed in the message received by the switching chip are compared with the switching MAC, the loop detection random number, and the loop detection magic number to determine whether the message received by the switching chip is a loop detection message sent by the switching chip itself. The loop detection comparison identifier can be represented as LDP_COMP_ID, and the switching MAC is the MAC of the switching chip itself.

[0111] See also Figure 7 ,like Figure 7 As shown, this embodiment provides a method for processing a message when the switching chip is in the loop state, further comprising:

[0112] S61, the switching chip parses the loop detection message sent by itself to obtain the port number of the sent message.

[0113] Optionally, the switching chip can parse the loop detection message to obtain the port number of the sending message, and the parsing process is not described in detail in this embodiment.

[0114] S62: The switching chip sets a first mask of a port for receiving the loop detection message sent by itself.

[0115] Optionally, when the switching chip receives a loop detection message sent by itself, the mask value of the port receiving the loop detection message may be set to 1.

[0116] S63: Acquire the port number of the loop based on the port number of the sent message, the port number of the received loop detection message sent by itself, and the first mask.

[0117] Alternatively, see Table 2 below:

[0118] Port0 Port1 Port2 Port3 LDP_LOOP_PORT_Pn 3 2 0 0 LDP_LOOP_PMSK 1 0 0 1

[0119] Table 2

[0120] Optionally, the port number that forms the loop is meaningful only when LDP_LOOP_PMSK is 1, indicating that a loop is formed between the port number that sends the message and the port number that receives the loop detection message sent by itself, and LDP_LOOP_PORT_Pn refers to the port number that sends the message. The ports that form the loop in Table 1 are Port0 and Port3.

[0121] See also Figure 8 ,like Figure 8 As shown, this embodiment provides a method for processing a message when the loop state is released, further comprising:

[0122] S71: The switching chip updates the first mask to obtain a second mask.

[0123] Optionally, in the first mask, if the loop state is released, the mask value forming the loop in the first mask is updated from 1 to 0, and the updated first mask is the second mask. For example, taking the loop between Port0 and Port3 as an example, when the loop state between Port0 and Port3 is released, the first mask 1,1 of Port0 and Port3 is updated to the second mask 0,0.

[0124] S72: Based on the port number of the sending message, the port number of the receiving loop detection message sent by itself, and the second mask, obtain the updated port number of the loop forming port.

[0125] The protection scope of the message processing method described in the embodiment of the present application is not limited to the execution order of the steps listed in the present embodiment. All solutions implemented by adding, reducing or replacing steps in the prior art based on the principles of the present application are included in the protection scope of the present application.

[0126] See also Fig. 9 ,like Fig. 9 As shown, this embodiment provides a message processing device 900, which is applied to a message processing system. The message processing system includes a switching chip and a CPU. The message processing device 900 includes:

[0127] The loop detection message acquisition module 910 is used to acquire a loop detection message.

[0128] The loop detection message processing module 920 is used to process the loop detection message as a broadcast message when the loop detection protocol is not enabled on the switching chip.

[0129] The switching chip status update module 930 is used for, when the switching chip turns on the loop detection protocol, if the switching chip processes the loop detection message, the switching chip updates the status based on the number of retransmissions and the retransmission interval of the loop detection message, otherwise when the loop detection message received by the switching chip is a loop detection message sent by itself, the received loop detection message is discarded, and when the loop detection message received by the switching chip is not a loop detection message sent by itself, the received loop detection message is forwarded. The status of the switching chip includes a loop status and a non-loop status.

[0130] In the message processing device 900 provided in this embodiment, the loop detection message acquisition module 910 and Figure 2 The loop detection message processing module 920 corresponds to step S11 of the message processing method shown in FIG. Figure 2 The message processing method shown in step S12 corresponds to the switching chip status update module 930. Figure 2 The message processing method shown corresponds to step S13.

[0131] This embodiment also provides the encapsulation format of the loop detection message as follows: Fig.10 As shown, it is for reference only and will not be described in detail in this embodiment.

[0132] In the several embodiments provided in the present application, it should be understood that the disclosed device or method can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of modules / units is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or units can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules or units, which can be electrical, mechanical or other forms.

[0133] The modules / units described as separate components may or may not be physically separated, and the components displayed as modules / units may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules / units may be selected according to actual needs to achieve the purpose of the embodiments of the present application. For example, the functional modules / units in the various embodiments of the present application may be integrated into one processing module, or each module / unit may exist physically separately, or two or more modules / units may be integrated into one module / unit.

[0134] Those of ordinary skill in the art should further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0135] This embodiment provides an electronic device, the electronic device comprising a memory storing a computer program; a processor connected to the memory for communication, and executing the computer program when the computer program is called. Figure 2 The message processing method shown.

[0136] The present application embodiment also provides a computer-readable storage medium. A person of ordinary skill in the art can understand that all or part of the steps in the method for implementing the above embodiment can be completed by a program to instruct the processor, and the program can be stored in a computer-readable storage medium, and the storage medium is a non-transitory medium, such as a random access memory, a read-only memory, a flash memory, a hard disk, a solid-state hard disk, a magnetic tape, a floppy disk, an optical disc, and any combination thereof. The above storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a digital video disc (DVD)), or a semiconductor medium (e.g., a solid-state hard disk (SSD)), etc.

[0137] The present application embodiment may also provide a computer program product, the computer program product including one or more computer instructions. When the computer instructions are loaded and executed on a computing device, the process or function described in the embodiment of the present application is generated in whole or in part. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer or data center.

[0138] When the computer program product is executed by a computer, the computer executes the method described in the above method embodiment. The computer program product may be a software installation package, and when the above method is required, the computer program product may be downloaded and executed on a computer.

[0139] The descriptions of the processes or structures corresponding to the above-mentioned figures have different emphases. For parts that are not described in detail in a certain process or structure, please refer to the relevant descriptions of other processes or structures.

[0140] The above embodiments are merely illustrative of the principles and effects of the present application and are not intended to limit the present application. Anyone familiar with the technology may modify or change the above embodiments without violating the spirit and scope of the present application. Therefore, all equivalent modifications or changes made by a person of ordinary skill in the art without departing from the spirit and technical ideas disclosed in the present application shall still be covered by the claims of the present application.

Claims

1. A message processing method, characterized in that: Applied to a message processing system, the message processing system includes a switching chip and a CPU, and the message processing method includes: The switching chip obtains a loop detection message; When the switching chip does not enable the loop detection protocol, the switching chip processes the loop detection message as a broadcast message; When the switching chip starts the loop detection protocol, if the switching chip processes the loop detection protocol, the switching chip performs a first detection on the loop of the switching chip based on the number of retransmissions and the retransmission interval of the loop detection message, so that the switching chip enters a state associated with the first detection result; otherwise, the CPU processes the loop detection protocol, and when the loop detection message received by the switching chip is a loop detection message sent by itself, the received loop detection message is discarded; when the loop detection message received by the switching chip is not a loop detection message sent by itself, the received loop detection message is forwarded; the state of the switching chip includes a loop state and a non-loop state, and the switching chip is initially in a non-loop state.

2. The message processing method according to claim 1, characterized in that: The non-loop state includes a normal state and a detection state, the number of retransmissions includes the number of retransmissions of the detection state and the number of retransmissions of the loop state, the retransmission interval includes the retransmission interval of the detection state and the retransmission interval of the loop state, if the switching chip processes the loop detection protocol, the switching chip enters the detection state from the normal state, the switching chip detects the loop of the switching chip based on the number of retransmissions and the retransmission interval of the loop detection message, so that the switching chip enters a state associated with the detection result. The implementation method includes: The switching chip transmits the loop detection message to a sending port indicated by a mask; Based on the number of retransmissions of the detection state and the retransmission interval of the detection state, the switching chip retransmits the loop detection message according to the sending port; The switching chip checks and processes the received message to determine whether the message received by the switching chip is a loop detection message sent by the switching chip itself; If there is a port in the switching chip that receives a loop detection message sent by the switching chip itself, the switching chip enters a loop state, otherwise the switching chip enters a normal state; When the switch chip is in the loop state, a second detection is performed on the loop of the switch chip based on the number of retransmissions of the loop state and the retransmission interval of the loop state, so that the switch chip enters a state associated with a second detection result.

3. The message processing method according to claim 2, characterized in that: When the switching chip is in the loop state, the implementation method of the switching chip updating the state based on the number of retransmissions of the loop state and the retransmission interval of the loop state includes: Based on the number of retransmissions of the loop status and the retransmission interval of the loop status, the switching chip retransmits the loop detection message according to the port; The switching chip checks and processes the received message to determine whether the message received by the switching chip is a loop detection message sent by the switching chip itself; When the switching chip receives a loop detection message sent by the switching chip itself, the switching chip is still in the loop state; When the number of times the loop detection message in the loop state is sent is the same as the number of times the loop state is resent, the switching chip has not received the loop detection message sent by the switching chip itself, and the switching chip updates the state based on the loop detection trigger mode.

4. The message processing method according to claim 3, characterized in that: The loop detection trigger mode is a periodic check mode or a non-periodic check mode, and the implementation method of the switching chip updating the state based on the loop detection trigger mode includes: When the loop detection trigger mode is the periodic check mode, the switching chip returns to the detection state; When the loop detection trigger mode is the non-periodic check mode, the switching chip returns to the normal state.

5. The message processing method according to claim 3, characterized in that: The switching chip checks and processes the received message to determine whether the message received by the switching chip is a loop detection message sent by the switching chip itself, and the implementation method includes: The switching chip obtains the Ethernet type field value and the protocol value of the received message; Based on the Ethernet type field value and the protocol value, the switching chip determines whether the received message is the loop detection message; When the message received by the switching chip is the loop detection message, the source MAC, identifier, and magic number in the message received by the switching chip are compared with the switching MAC, loop detection random number, and loop detection magic number based on the loop detection comparison identifier to determine whether the message received by the switching chip is a loop detection message sent by the switching chip itself.

6. The message processing method according to claim 5, characterized in that: When the switching chip is in the loop state, the message processing method further includes: The switching chip parses the loop detection message sent by itself to obtain the port number of the message; The switching chip sets a first mask of a port for receiving the loop detection message sent by itself; The port number for forming the loop is acquired based on the port number for sending the message, the port number for receiving the loop detection message sent by itself, and the first mask.

7. The message processing method according to claim 6, characterized in that: When the loop state is released, the message processing method further includes: The switching chip updates the first mask to obtain a second mask; The updated port number for forming the loop is acquired based on the port number for sending the message, the port number for receiving the loop detection message sent by itself, and the second mask.

8. A message processing device, characterized in that: A message processing system is applied, the message processing system includes a switching chip and a CPU, and the message processing device includes: A loop detection message acquisition module, used for the switching chip to acquire a loop detection message; A loop detection message processing module, used for, when the loop detection protocol is not enabled on the switching chip, the switching chip processes the loop detection message as a broadcast message; A switching chip status update module is used for, when the switching chip turns on the loop detection protocol, if the switching chip processes the loop detection protocol, the switching chip performs a first detection on the loop of the switching chip based on the number of retransmissions and the retransmission interval of the loop detection message, so that the switching chip enters a state associated with the first detection result; otherwise, the CPU processes the loop detection protocol; when the loop detection message received by the switching chip is a loop detection message sent by itself, the received loop detection message is discarded; when the loop detection message received by the switching chip is not a loop detection message sent by itself, the received loop detection message is forwarded; the status of the switching chip includes a loop status and a non-loop status, and the switching chip is initially in a non-loop status.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the message processing method described in any one of claims 1 to 7 is implemented.

10. An electronic device, characterized in that: The electronic device comprises: A memory storing a computer program; A processor is communicatively connected to the memory, and executes the message processing method according to any one of claims 1 to 7 when calling the computer program.

Citation Information

Patent Citations

  • Method for detecting and automatically recovering Ethernet loopback

    CN101707538A

  • Loop detection method and device

    CN102281172A

  • Loop automatic detection device and method in EoC network

    CN103780444A

  • Switch adopting double-CPU architecture and message processing method

    CN114268595A

  • Two-layer network loop processing method, system, equipment and medium

    CN117221213A