Method and apparatus for fast notification of port physical state change

CN116708228BActive Publication Date: 2026-08-07NEW H3C TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NEW H3C TECH CO LTD
Filing Date
2023-06-27
Publication Date
2026-08-07

AI Technical Summary

Technical Problem

[0004]但是,目前网络设备的操作系统采用软件依次轮询各端口的寄存器以判断各端口的物理状态是UP/DOWN,导致排列靠后的物理端口被轮询到之前的耗时过程且造成未被轮询到的物理状态为down的端口持续丢包

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116708228B_ABST
    Figure CN116708228B_ABST
Patent Text Reader

Abstract

The application provides a method and device for quickly notifying port physical state change. The method comprises the following steps: receiving a port hardware list change interrupt signal; reading a port hardware list; wherein the port hardware list records the port identifier, fault register value and link register value of each traversed port; performing XOR calculation based on the port hardware list and the stored port software list to generate a state change port software list; wherein the port software list records the port identifier, fault register value and link register value of each previously started port; and performing logical AND operation based on the state change port software list and the stored port software list to generate a closed port software list.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to communication technology, and in particular to a method and device for quickly notifying changes in the physical state of a port. Background Technology

[0002] The physical state of a network device's ports directly affects the forwarding of protocols and data packets. Therefore, network devices need to promptly notify their operating systems of the port's physical state, ensuring that the corresponding protocol and data exchange modules are notified in a timely manner. With the rapid development of internet technology, diverse and differentiated user demands are constantly emerging. As the volume of network requests increases, the requirement for network device ports to respond quickly to physical state down (closed) events is becoming increasingly stringent.

[0003] The hardware chip of a network device scans the port's fault and link registers. A fault register value of 0 indicates that the port is fault-free, meaning negotiation has started normally (UP) or a normal optical signal has been received. A link register value of 1 indicates that the port's physical layer has completed normal negotiation. In a network device, if the fault register of any port is 0 and the link register is 1, the port's physical state is determined to be UP; if either register does not meet the condition, the port's physical state is determined to be down.

[0004] However, current network device operating systems use software to poll the registers of each port sequentially to determine whether the physical state of each port is UP / DOWN. This causes the physical ports that are later in the polling list to be polled for the previous time-consuming process, and causes the ports that are not polled and whose physical state is down to continuously lose packets. Summary of the Invention

[0005] The purpose of this application is to provide a method and device for quickly notifying changes in the physical state of a port, thereby avoiding continuous packet loss of a closed port due to excessively long polling time of the port's physical state.

[0006] To achieve the above objectives, this application provides a method for quickly notifying changes in the physical state of a port; the method includes: receiving a port hardware list change interrupt signal; reading the port hardware list, wherein the port identifier, fault register value, and link register value of each traversed port are recorded; generating a state-changed port software list by performing an XOR operation between the port hardware list and a stored port software list; wherein the port software list records the port identifier, fault register value, and link register value of each previously started port; and generating a shut-down port software list by performing a logical AND operation between the state-changed port software list and the stored port software list.

[0007] To achieve the above objectives, this application also provides a device for quickly notifying changes in the physical state of ports. The device includes a switching chip, a processor, and a memory. The processor performs the following operations by executing processor-executable instructions in the memory: receiving a port hardware list change interrupt signal from the switching chip; reading the port hardware list from the switching chip; wherein the port identifier, fault register value, and link register value of each traversed port are recorded; generating a state-changed port software list by performing an XOR operation between the port hardware list and a stored port software list; wherein the port software list records the port identifier, fault register value, and link register value of each previously started port; and generating a shut-down port software list by performing a logical AND operation between the state-changed port software list and the stored port software list.

[0008] The advantage of this application is that network devices do not need to poll port registers in software, and can quickly generate a list of closed ports. Attached Figure Description

[0009] Figure 1 A flowchart of the method for quickly notifying port physical state changes provided in this application;

[0010] Figure 2 A schematic diagram illustrating the physical state changes of the device notification port provided in this application;

[0011] Figure 3 A schematic diagram of a device for quickly notifying the physical state changes of the port provided in this application. Detailed Implementation

[0012] The following detailed description will be provided with reference to several examples illustrated in the accompanying figures. In this detailed description, numerous specific details are used to provide a comprehensive understanding of the present application. Known methods, steps, components, and circuits are not described in detail in the examples to avoid obscuring their meaning.

[0013] In the terminology used, the term "including" means including but not limited to; the term "containing" means including but not limited to; the terms "above," "within," and "below" include the number itself; the terms "greater than" and "less than" mean not including the number itself. The term "based on" means based on at least a portion of them.

[0014] Figure 1 A flowchart of a method for quickly notifying port physical state changes provided in this application; the method includes the following steps:

[0015] Step 101: Receive the interrupt signal indicating a change in the port hardware list;

[0016] Step 102: Read the port hardware list that records the port identifier, fault register value, and link register value of each traversed port;

[0017] Step 103: Perform an XOR operation between the port hardware list and the stored port software list to generate a list of port software with changed states; wherein, the port software list records the port identifier, fault register value, and link register value of each previously started port.

[0018] Step 104: Perform a logical AND operation between the list of port software with state changes and the stored list of port software to generate a list of closed port software.

[0019] Figure 1 The beneficial effect of this embodiment is that the network device does not need to poll the port register in software and can quickly generate a list of closed ports.

[0020] Figure 2 A schematic diagram illustrating the physical state changes of the device notification port provided in this application.

[0021] For example, if ports P1, P2, P3, and P4 are all in the UP state in the initial state, the port status monitoring module of the switching chip 20 receives the start interrupt signal of the fault register / Link register of any port and iterates through the Fault register and Link register of each port P1, P2, P3, and P4.

[0022] The port status monitoring module records the port identifier bit1 of port P1, the register value of Fault register F1 being 0, and the register value of link register L1 being 1 in the port hardware list hw(hardware)_pbmp. Similarly, the port status monitoring module records the port identifier bit2 of P2, the register value of Fault register F2 being 0, and the register value of link register L2 being 1 in the port hardware list hw_pbmp; records the port identifier bit3 of P3, the register value of Fault register F3 being 0, and the register value of link register L3 being 1 in the port hardware list hw_pbmp; and records the port identifier bit4 of P4, the register value of Fault register F4 being 0, and the register value of link register L4 being 1 in the port hardware list hw_pbmp.

[0023] The port status monitoring module generates a port hardware list change interrupt signal and sends it to CPU21. CPU21 receives the port hardware list change interrupt signal and reads the port hardware list hw_pbmp from the memory of the switching chip 20.

[0024] CPU21 performs an XOR operation between the port hardware list hw_pbmp and the stored port software list sw(software)_pbmp to generate the state-change port software list hw_change. If the stored port software list sw_pbmp is empty in the initial state, the state-change port software list hw_change generated by CPU1 records the port identifier, fault register value, and link register value of P1-P4 respectively.

[0025] CPU21 performs a logical AND (&&) operation between the state change port software list hw_change and the stored port software list sw_pbmp, i.e., hw_change&&sw_pbmp. If the generated shutdown port software list hw_change_down is empty, then CPU21 will not generate a port physical shutdown event.

[0026] CPU21 performs a logical inversion on the port software list sw_pbmp stored in the initial state; it then performs a logical AND operation on the state-changed port software list hw_change and the inverted port software list sw_pbmp, i.e., hw_change&&(!sw_pbmp), to generate the startup port software list hw_change_up; that is, bit1->(F1=0,L1=1); bit2->(F2=0,L2=1); bit3>(F3=0,L3=1); bit4>(F4=0,L4=1).

[0027] CPU21 generates a port physical boot event to notify the operating system based on the boot port software list hw_change_up, and notifies ports P1, P2, P3, and P4 to boot; thereby enabling the operating system to notify the corresponding protocol modules of the boot physical status of ports P1, P2, P3, and P4 and refresh the corresponding forwarding table entries, which will not be elaborated in this application.

[0028] The CPU adds the identifier, fault register value, and link register value of each boot port in the boot port software list hw_change_up to the port software list sw_pbmp.

[0029] For example, when port P1 fails, the value of the fault register of port P1 is set to 1; when the port status monitoring module receives the fault interrupt signal of the register of port P1, it traverses the fault register and link register of each port P1, P2, P3 and P4.

[0030] The port status monitoring module records the following in the port hardware list hw_pbmp: Port P1: port identifier bit1, Fault register F1 value = 1, Link register L1 value = 1; Port P2: port identifier bit2, Fault register F2 value = 0, Link register L2 value = 1; Port P3: port identifier bit3, Fault register F3 value = 0, Link register L3 value = 1; Port P4: port identifier bit4, Fault register F4 value = 0, Link register L4 value = 1. That is, bit1 -> (F1 = 1, L1 = 1); bit2 -> (F2 = 0, L2 = 1); bit3 > (F3 = 0, L3 = 1); bit4 > (F4 = 0, L4 = 1).

[0031] The port status monitoring module generates a port hardware list change interrupt signal and sends it to CPU21. CPU21 receives the port hardware list change interrupt signal and reads the port hardware list from the memory of the switching chip 20.

[0032] CPU21 performs an XOR operation between the port hardware list hw_pbmp and the stored port software list sw_pbmp to generate the state-changed port software list hw_change; it records the port identifier, fault register value, and link register value of P1; that is, bit1->(F1=1,L1=1).

[0033] CPU21 performs a logical AND (&&) operation on the state change port software list hw_change and the port software list sw_pbmp, i.e., hw_change&&sw_pbmp, to generate the closed port software list hw_change_down; that is, bit1->(F1=1,L1=1), generating a port physical shutdown event to notify the operating system of port P1.

[0034] The operating system notifies the corresponding protocol module of the physical state of port P1 being closed, refreshes the corresponding forwarding table entries, and no longer forwards protocols and data packets through port P1.

[0035] CPU21 removes the identifier bit1, fault register value F1, and link register value L1 of port p1 from the list of closed port software hw_change_down based on the identifier of port p1.

[0036] CPU21 performs a logical inversion on the port software list sw_pbmp; it then performs a logical AND operation between the state-change port software list hw_change and the inverted port software list sw_pbmp, i.e., hw_change&&(!sw_pbmp). If the generated startup port software list hw_change_up is empty, then there is no need to generate a port physical startup event.

[0037] When both ports P1, P2, P3, and P4 of the switching chip 20 are closed and both are started, the switching chip traverses the Fault register and Link register of each port according to the start interrupt signal / stop terminal signal; and generates hw_change_down and a port physical close event to notify the operating system, and generates hw_change_up and a port physical start event to notify the operating system, as described above; this application will not elaborate further.

[0038] The beneficial effect of this application is that it can quickly generate the hw_change_down list, provide a fast response to physical status down (closed) events to notify the operating system, and avoid packet loss caused by the software polling of the switching chip port due to the port not being polled for a long time.

[0039] In addition, this application prioritizes providing responses to physical state down (closed) events, followed by responses to physical state up events, thus eliminating the impact of down state ports on forwarding failures of network devices. By providing responses to physical down events and up events in stages, the refresh of forwarding table entries and related ports in the protocol module is accelerated, which is beneficial for service recovery.

[0040] Figure 3 This is a schematic diagram of a device for quickly notifying changes in the physical state of ports, as provided in this application. The device 30 includes a switching chip, a processor, and a memory. The processor performs the following operations by executing processor-executable instructions in the memory: receiving a port hardware list change interrupt signal from the switching chip; reading the port hardware list from the switching chip; wherein the port identifier, fault register value, and link register value of each traversed port are recorded; generating a state-changed port software list by performing an XOR operation between the port hardware list and a stored port software list; wherein the port software list records the port identifier, fault register value, and link register value of each previously started port; and generating a shut-down port software list by performing a logical AND operation between the state-changed port software list and the stored port software list.

[0041] The processor also performs the following operations by running processor-executable instructions in memory: generating a port physical shutdown event that notifies the operating system based on the list of shutdown port software; and deleting the identifier, fault register value, and link register value of each shutdown port from the stored list of shutdown port software, based on the identifier of each shutdown port in the list of shutdown port software.

[0042] The processor also performs the following operations by running processor-executable instructions in memory: logically inverting the stored port software list; and performing a logical AND operation between the state-changed port software list and the inverted stored port software list to generate a startup port software list.

[0043] The processor also performs the following operations by running processor-executable instructions in memory: generating a port physical boot event that notifies the operating system based on the boot port software list; and adding the identifier, fault register value, and link register value of each boot port in the boot port software list to the stored port software list.

[0044] The switching chip is used to receive fault register start / stop interrupt signals or link register start / stop interrupt signals from any port; traverse the fault registers and link registers of each port; record the port identifier, fault register value, and link register value of each traversed port in the port hardware list; and generate a port hardware list change interrupt signal.

[0045] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A method for quickly notifying changes in the physical state of a port, characterized in that, The method includes: Receive port hardware list change interrupt signal; Read the port hardware list; it records the port identifier, fault register value, and link register value for each port being traversed. An XOR operation is performed between the port hardware list and the stored port software list to generate a state-changed port software list; wherein, the port software list records the port identifier, fault register value, and link register value of each previously started port; A logical AND operation is performed between the state change port software list and the stored port software list to generate a list of closed port software. Based on the list of software programs that close ports, a physical port closure event is generated to notify the operating system; wherein... Before the interrupt signal indicating a change in the received port hardware list, the method further includes: Receive fault register start / stop interrupt signal or link register start / stop interrupt signal from any port; Iterate through the fault registers and link registers of each port; The port identifier, fault register value, and link register value of each port traversed are recorded in the port hardware list; Generate an interrupt signal for the change in the port hardware list.

2. The method according to claim 1, characterized in that, The method further includes: Based on the identifier of each closed port in the closed port software list, delete the identifier, fault register value, and link register value of each closed port from the stored port software list.

3. The method according to claim 1, characterized in that, The method further includes: The fault register value and link register value of each previously started port in the stored port software list are logically inverted; A logical AND operation is performed between the state-change port software list and the inverted stored port software list to generate a startup port software list.

4. The method according to claim 3, characterized in that, The method further includes: Based on the list of startup port software, a port physical startup event is generated to notify the operating system. The identifier, fault register value, and link register value of each startup port in the startup port software list are added to the stored port software list.

5. A device for quickly notifying changes in the physical state of a port, characterized in that, The device includes a switching chip, a processor, and a memory; The switching chip is used to receive fault register start / stop interrupt signals or link register start / stop interrupt signals from any port; Iterate through the fault registers and link registers of each port; Record the port identifier, fault register value, and link register value of each port in the port hardware list. Generate an interrupt signal for changes in the port hardware list; The processor performs the following operations by executing processor-executable instructions in the memory; Receives a hardware list change interrupt signal from the port of the switching chip; The port hardware list is read from the switching chip; wherein, the port identifier, fault register value, and link register value of each traversed port are recorded; An XOR operation is performed between the port hardware list and the stored port software list to generate a state-changed port software list; wherein, the port software list records the port identifier, fault register value, and link register value of each previously started port; A logical AND operation is performed between the state change port software list and the stored port software list to generate a list of closed port software. Based on the list of software programs that close ports, a notification is generated to the operating system to physically close the ports.

6. The device according to claim 5, characterized in that, The processor also performs the following operations by executing processor-executable instructions in the memory; Based on the identifier of each closed port in the closed port software list, delete the identifier, fault register value, and link register value of each closed port from the stored port software list.

7. The device according to claim 5, characterized in that, The processor also performs the following operations by executing processor-executable instructions in the memory; The stored list of port software is logically inverted; A logical AND operation is performed between the state-change port software list and the inverted stored port software list to generate a startup port software list.

8. The device according to claim 7, characterized in that, The processor also performs the following operations by executing processor-executable instructions in the memory; Based on the list of startup port software, a port physical startup event is generated to notify the operating system. Based on the identifier, fault register value, and link register value of each startup port in the startup port software list, a logical AND operation is performed on the stored port software list to generate a shutdown port software list.

Citation Information

Patent Citations

  • Method for establishing in-band connection in open flow network and switch

    CN104580025A

  • Bioinformatics systems, apparatus, and methods for performing secondary and / or tertiary processing

    CN109416928A