A port status adjustment method, apparatus, and computer-readable storage medium
By acquiring and analyzing port status information, and forcibly activating ports in abnormal states, the problem of data packet loss caused by abnormal port states in LACP protocol interaction is solved, thereby improving the stability and reliability of data transmission.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZTE CORP
- Filing Date
- 2021-06-30
- Publication Date
- 2026-05-26
AI Technical Summary
During LACP protocol interaction, abnormal port status can lead to data packet loss, especially when the network environment fluctuates or the peer device malfunctions. Unrecovered ports may continue to receive data streams, resulting in packet loss.
The first device obtains the port status information from the message of the second device, combines it with the actual status of its own port, determines the port's recovery capability, and performs activation processing to restore the abnormal port to a normal state, thus avoiding data loss.
This effectively avoids data packet loss caused by port anomalies, improving the stability and reliability of data transmission.
Smart Images

Figure CN115567463B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communications, and more specifically, to a port status adjustment method, apparatus, computer-readable storage medium, and electronic device. Background Technology
[0002] In current network construction, to ensure network stability, reliability, and cost-effectiveness, the Link Aggregation Control Protocol (LACP) is often used to enhance bandwidth. This technology treats multiple physical connections as a single logical connection, allowing two network devices to connect in parallel through multiple ports and transmit data simultaneously, thus providing higher bandwidth and throughput.
[0003] Dynamic aggregation is one way to implement link aggregation. Under the interaction of the LACP protocol, information is exchanged with the peer through the Link Aggregation Control Protocol Data Unit (LACPDU). Once the two ends successfully negotiate, traffic can be load-sharing among the various active member ports.
[0004] In scenarios using LACP, it's crucial to ensure minimal packet loss during link recovery. When the two devices interact using the LACP protocol, once the peer device's port recovers, the data stream will be sent from that port. However, if the local device's port hasn't recovered yet, the received data stream from the peer will be lost due to the port's inactivity. The greater the difference in recovery time, the more packet loss will occur, resulting in poorer recovery performance.
[0005] When the network environment fluctuates, or when the peer device performs abnormal protocol processing, it may mistakenly determine that the ports that the local device has not yet recovered have been recovered, and thus send packets to the unrecovered ports, resulting in packet loss.
[0006] There is currently no effective solution to the above problems. Summary of the Invention
[0007] This invention provides a port status adjustment method, apparatus, computer-readable storage medium, and electronic device to at least solve the problem of data packet loss caused by abnormal port status in related technologies.
[0008] According to an embodiment of the present invention, a port state adjustment method is provided, comprising:
[0009] The first device receives a first message from the second device, wherein the first message carries first status information, which is used to indicate the status of a first port included in the first device, and the first device transmits data with the second device through the first port;
[0010] The first device determines the capability information of the first port based on the first status information and the actual status of the first port read by the first device, wherein the capability information is used to indicate whether the first port is allowed to recover from an abnormal state to a normal state;
[0011] When the capability information is the first capability information, the first device activates the first port to change the state of the first port from the abnormal state to the normal state, wherein the first capability information is used to indicate that the first port is allowed to recover from the abnormal state to the normal state.
[0012] In an exemplary embodiment, the first device determines the first capability information of the first port based on the first status information and the actual status of the first port read by the first device, including:
[0013] When the first device determines that the first status information is used to indicate that the status of the first port included in the first device is the abnormal status or the normal status, and the actual status of the first port read by the first device is the normal status, the first device determines the capability information of the first port as the first capability information.
[0014] In an exemplary embodiment, the first device determines the first capability information of the first port based on the first status information and the actual status of the first port read by the first device, including:
[0015] When the first device determines that the first status information is used to indicate that the status of the first port included in the first device is the abnormal status or the normal status, the actual status of the first port read by the first device is the normal status, and the first port can be recovered after the first device performs a first protocol interaction negotiation with the second device, the first device determines that the capability information of the first port is the first capability information.
[0016] In one exemplary embodiment, after the first device activates the first port, the method further includes:
[0017] The first device sends a second message to the second device, wherein the second message includes second status information indicating that the status of the first port has been restored to the normal state;
[0018] The first device terminates sending a third message to the second device, wherein the third message includes third status information indicating that the status of the first port is the abnormal status.
[0019] In one exemplary embodiment, after the first device activates the first port, the method further includes:
[0020] The first device performs a second protocol negotiation with the second device through the first port;
[0021] If the first device determines that it cannot successfully negotiate with the second device based on the second protocol interaction negotiation process, it deactivates the first port to change the state of the first port from the normal state to the abnormal state.
[0022] In one exemplary embodiment, after the first device deactivates the first port, the method further includes:
[0023] The first device sends a fourth message to the second device to instruct the second device to perform deactivation processing on a second port in the second device that is connected to the first port. The fourth message includes fourth status information indicating that the state of the first port is the abnormal state.
[0024] In one exemplary embodiment, after the first device deactivates the first port, the method further includes:
[0025] The first device sends an alarm message.
[0026] In one exemplary embodiment, after the first device receives the first message from the second device, the method further includes:
[0027] The first device replies to the second device with a fifth message based on the first message, wherein the fifth message carries fifth status information, which is used to indicate the status of the first port obtained by the first device based on the first message;
[0028] The first device acquires the fifth state information and compares the first state information and the fifth state information to obtain a comparison result;
[0029] If the first device determines that the comparison result indicates that the states indicated by the first state information and the fifth state information are different, it shall terminate replying to the second device with the fifth message.
[0030] In one exemplary embodiment, after the first device terminates the recovery of the fifth message to the second device, the method further includes:
[0031] The first device sends a notification message to the second device, wherein the notification message is used to notify the second device to resend the message.
[0032] In one exemplary embodiment, after the first device terminates the recovery of the fifth message to the second device, the method further includes:
[0033] The first device constructs and sends a sixth message, wherein the sixth message carries sixth status information, which is used to indicate the status indicated by the first status information.
[0034] According to another embodiment of the present invention, a port status adjustment device is provided, applied in a first device, comprising:
[0035] The message acquisition module is used to acquire a first message from the second device, wherein the first message carries first status information, the first status information is used to indicate the status of a first port included in the first device, and the first device transmits data with the second device through the first port;
[0036] A capability determination module is used to determine the capability information of the first port based on the first status information and the actual status of the first port read by the first device, wherein the capability information is used to indicate whether the first port is allowed to recover from an abnormal state to a normal state.
[0037] The port activation module is used to activate the first port when the capability information is first capability information, so that the state of the first port is changed from the abnormal state to the normal state, wherein the first capability information is used to indicate that the first port is allowed to recover from the abnormal state to the normal state.
[0038] According to yet another embodiment of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored therein, wherein the computer program is configured to perform the steps in any of the above method embodiments when executed.
[0039] According to yet another embodiment of the present invention, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0040] By forcibly activating the first port in an abnormal state, the first port can send and receive telegrams normally, avoiding data packet loss caused by port abnormality. Therefore, the problem of data packet loss caused by port abnormality can be solved, thereby improving the data sending and receiving capabilities. Attached Figure Description
[0041] Figure 1 This is a hardware structure block diagram of a mobile terminal for a port status adjustment method according to an embodiment of the present invention.
[0042] Figure 2 This is a flowchart of a port status adjustment method according to an embodiment of the present invention;
[0043] Figure 3 This is a structural block diagram of a port status adjustment device according to an embodiment of the present invention;
[0044] Figure 4 This is a structural block diagram of a protocol network according to a specific embodiment of the present invention;
[0045] Figure 5 This is a structural schematic diagram according to a specific embodiment of the present invention. Figure 1 ;
[0046] Figure 6 This is a process according to a specific embodiment of the present invention. Figure 1 ;
[0047] Figure 7 This is a structural schematic diagram according to a specific embodiment of the present invention. Figure 2 ;
[0048] Figure 8 This is a process according to a specific embodiment of the present invention. Figure 2 . Detailed Implementation
[0049] The embodiments of the present invention will be described in detail below with reference to the accompanying drawings and examples.
[0050] It should be noted that the terms "first," "second," etc., in the specification, claims, and drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0051] The methods and embodiments provided in this application can be executed on a mobile terminal, computer terminal, or similar computing device. Taking running on a mobile terminal as an example, Figure 1 This is a hardware structure block diagram of a mobile terminal for a port status adjustment method according to an embodiment of the present invention. Figure 1 As shown, a mobile terminal may include one or more ( Figure 1Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The mobile terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0052] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to a port status adjustment method in this embodiment of the invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0053] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the mobile terminal's communication provider. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.
[0054] This embodiment provides a port status adjustment method. Figure 2 This is a flowchart of a port status adjustment method according to an embodiment of the present invention, such as... Figure 2 As shown, the process includes the following steps:
[0055] In step S202, the first device obtains a first message from the second device, wherein the first message carries first status information, which is used to indicate the status of the first port included in the first device, and the first device transmits data with the second device through the first port;
[0056] In this embodiment, the first status information includes (but is not limited to) the activation / deactivation / abnormal status information of the first port included in the first device, the address information of the first port, the port type of the first port, etc. The number of the first ports may (but is not limited to) be one or at least two; both the first device and the second device are (but are not limited to) devices or apparatuses capable of performing LACP protocol interaction, such as switches, gateways, etc.; the number of both the first device and the second device may (but is not limited to) be multiple, as long as information interaction between the first device and the second device can be realized; the first message may (but is not limited to) be a data packet, or other information streams capable of multiple types of information; the data transmission method of the first message may (but is not limited to) be Ethernet, or wireless network, such as 3G / 4G / 5G / quantum communication, etc.
[0057] For example, the first device receives an LACP message sent by the second device and parses the message to obtain the port parameters.
[0058] Step S204: The first device determines the capability information of the first port based on the first status information and the actual status of the first port read by the first device, wherein the capability information is used to indicate whether the first port is allowed to recover from an abnormal state to a normal state.
[0059] In this embodiment, the actual state of the first port is the state of the first port within the time range of receiving the first message. The time range can be the time node when the first message is received, or it can be the time node with a specified delay duration. The actual state of the first port can be read (but is not limited to) by reading and identifying the status code of the first port, or it can be determined by receiving the port status information or signal fed back by the first port, or it can be implemented in other ways. The actual state of the first port includes (but is not limited to) normal, abnormal, active but not active, inactive, etc.
[0060] For example, while parsing the first message, the first device reads its own actual port status.
[0061] In step S206, when the capability information is the first capability information, the first device activates the first port to change the state of the first port from an abnormal state to a normal state. The first capability information is used to indicate that the first port is allowed to recover from the abnormal state to the normal state.
[0062] In this embodiment, the first capability information is that the first port is in an abnormal state where it can be activated but is not activated. By activating the first port, normal information interaction of the first port can be realized, and data loss caused by abnormal port status can be avoided.
[0063] The activation process for the first port can be either normal activation or forced activation. The activation status can be either indicating that the first port remains active for a predetermined time or indicating that the first port is always active. The activation method can be achieved by sending an activation command to the first port or by adjusting the physical information of the first port (such as address code, current, voltage, etc.).
[0064] For example, the first device uses the LACP protocol to interact and negotiate to confirm whether its first port in the LACP aggregation group of the second device can be restored. Even if the first port's physical state is normal, it may still be deactivated and unable to send or receive data due to protocol interaction failure. Therefore, if the first device's port is physically normal but cannot send or receive data only due to protocol interaction failure, a forced activation command can be sent to the first port to force its activation. The physical state of the first port can be (but is not limited to) determined by polling the first port.
[0065] By adjusting the port status of the first port in an abnormal state, the first port can now perform normal data interaction, thereby avoiding data packet loss caused by abnormal port status, solving the problem of data packet loss caused by abnormal port status, and improving data transmission stability.
[0066] The entities that perform the above steps can be base stations, terminals, etc., but are not limited to these.
[0067] In an optional embodiment, the first device determines the first capability information of the first port based on the first status information and the actual status of the first port read by the first device, including:
[0068] In step S2042, when the first device determines that the first status information is used to indicate that the status of the first port included in the first device is an abnormal status or a normal status, and the actual status of the first port read by the first device is a normal status, the first device determines the capability information of the first port as the first capability information.
[0069] In this embodiment, since the first message comes from the second device, there may be a situation where the status information of the first port is outdated. By comparing and confirming the status information of the first port, the status information of the first port stored by the second device can be updated, thus avoiding the second device from sending and receiving messages incorrectly.
[0070] In an optional embodiment, the first device determines the first capability information of the first port based on the first status information and the actual status of the first port read by the first device, including:
[0071] In step S2044, the first device determines the capability information of the first port as the first capability information when it determines that the first status information is used to indicate that the status of the first port included in the first device is an abnormal state or a normal state, the actual status of the first port read by the first device is a normal state, and the first port can be recovered after the first device performs a first protocol interaction negotiation with the second device.
[0072] In this embodiment, determining the capability information of the first port as the first capability information after determining that the first port can be recovered is to enable the forced activation operation of the first port, thereby enabling the first port to achieve normal data interaction.
[0073] In an optional embodiment, after the first device activates the first port, the method further includes:
[0074] In step S208, the first device sends a second message to the second device, wherein the second message includes second status information indicating that the status of the first port has been restored to the normal state;
[0075] In step S2010, the first device terminates sending the third message to the second device, wherein the third message includes third status information indicating that the status of the first port is abnormal.
[0076] In this embodiment, sending the second message to the second device is to enable the second device to update the status information of the stored first port, while terminating the sending of the third message is to prevent the second device from sending a feedback message based on the third message, thereby avoiding data loss.
[0077] The second and third messages may include (but are not limited to) the status information and IP address of the first port. The first port indicated by the third message may be one or more of the multiple first ports included in the first device. Similarly, the first port indicated by the second message may be one or more of the multiple first ports included in the first device. The second and third messages may be sent via (but are not limited to) Ethernet or wireless networks, such as 3G / 4G / 5G / quantum communication.
[0078] For example, when entering the fast recovery process (i.e., forced activation), the first device needs to directly restore the ports that have not yet been restored (i.e., forced activation), and at the same time, the first device sends a LACP protocol message indicating that the first port has been restored to the second device. Simultaneously, it is necessary to intercept LACP protocol messages that the first device is about to send indicating that the port status has not been restored.
[0079] In an optional embodiment, after the first device activates the first port, the method further includes:
[0080] In step S2012, the first device performs a second protocol negotiation with the second device through the first port;
[0081] In step S2014, if the first device determines that it cannot successfully negotiate with the second device based on the second protocol interaction negotiation process, it performs a first deactivation process on the first port to change the state of the first port from normal state to abnormal state.
[0082] In this embodiment, after the activation process is performed, the first port is determined to be restored through interactive negotiation before subsequent data interaction is carried out, thereby avoiding data loss caused by the port status not being restored; while deactivating the port that cannot be normally interactively negotiated is to prevent abnormal ports from performing data interaction, further avoiding data loss.
[0083] The second protocol can be (but is not limited to) the LACP protocol, or other interactive protocols; the deactivation process can be (but is not limited to) adjusting the state of the first port, or other methods to mark the first port as abnormal; the deactivation process can be sending a deactivation command to the first port, or changing the physical information of the first port, etc.
[0084] For example, if subsequent LACP protocol interactions confirm that the LACP protocol for the fast-recovering port cannot be successfully negotiated, a state rollback is performed, and the port for the first device to recover quickly is deactivated from the aggregated link.
[0085] In an optional embodiment, after the first device deactivates the first port, the method further includes:
[0086] In step S2016, the first device sends a fourth message to the second device to instruct the second device to perform a second deactivation process on the second port that is connected to the first port. The fourth message includes fourth status information indicating that the status of the first port is abnormal.
[0087] In this embodiment, if it is determined that the first port cannot be recovered, the second port is also deactivated to prevent the second port from sending data to the first port. Furthermore, it should be noted that the information sent in different states to indicate that the first port is in an abnormal state can be the same or different. In this embodiment, both the fourth state information and the aforementioned third state information are used to indicate that the first port is in an abnormal state; they can be the same information or different information.
[0088] For example, a LACP protocol message for port deactivation is sent to the second device to notify the second device to perform deactivation processing on the docked port of the second device.
[0089] In an optional embodiment, after the first device deactivates the first port, the method further includes:
[0090] Step S2018: The first device sends an alarm message.
[0091] In this embodiment, sending alarm information is to remind staff to further process the relevant ports and make timely adjustments to the ports.
[0092] For example, an abnormal state where the first device port cannot be recovered can be sent via alarms to notify relevant personnel to troubleshoot the fault.
[0093] In an optional embodiment, after the first device receives the first message from the second device, the method further includes:
[0094] In step S2022, the first device replies to the second device with a fifth message based on the first message. The fifth message carries fifth status information, which is used to indicate the status of the first port obtained by the first device based on the first message.
[0095] Step S2024: The first device acquires the fifth status information and compares the first status information and the fifth status information to obtain the comparison result;
[0096] In step S2026, if the first device determines that the comparison result indicates that the states indicated by the first state information and the fifth state information are different, it terminates the reply of the fifth message to the second device.
[0097] In this embodiment, to improve the data interaction capability, a first device and a second device with the same data transmission and reception functions can be set up.
[0098] For example, after the first device receives the fifth message sent by the second device, it parses the fifth message to determine the fifth status information. At the same time, the control system in the first device sends a reply message to the second device. Before sending the reply message, the first device captures and analyzes the generated but unsent replies to determine whether the fifth status information is consistent with the actual status of the first port read by the first device. If they are inconsistent, the reply message is intercepted. Correspondingly, after the second device receives the fifth message sent by the first device, the control system of the second device also generates a reply message. Before sending the reply message, it compares the fifth status information contained in the reply message with the pre-stored first status information. If they are inconsistent, the reply message is intercepted.
[0099] In an optional embodiment, after the first device terminates the recovery of the fifth message to the second device, the method further includes:
[0100] In step S20262, the first device sends a notification message to the second device, wherein the notification message is used to notify the second device to resend the message.
[0101] In this embodiment, resending the message is to ensure the consistency of the port status, enable normal data interaction, and avoid data loss.
[0102] It should be noted that when the second device confirms that the reply message is incorrect, it can also send a notification message to the first device to instruct the first device to resend the message.
[0103] In an optional embodiment, after the first device terminates the recovery of the fifth message to the second device, the method further includes:
[0104] In step S20264, the first device constructs and sends a sixth message, wherein the sixth message carries sixth status information, which is used to indicate the status indicated by the first status information.
[0105] In this embodiment, the sixth message is reconstructed to update the port status information stored by the second device and ensure the consistency of the port status.
[0106] It should be noted that when the second device confirms that the reply message is incorrect, it can also reconstruct the sixth message to notify the first device that the first port status information stored in the second device has been updated.
[0107] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0108] This embodiment also provides a port status adjustment device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, hardware implementations, or a combination of software and hardware, are also possible and contemplated.
[0109] Figure 3 This is a structural block diagram of a port status adjustment device according to an embodiment of the present invention, such as... Figure 3 As shown, the device is used in a first apparatus, and the device includes:
[0110] The message acquisition module 32 is used to acquire a first message from the second device, wherein the first message carries first status information, the first status information is used to indicate the status of a first port included in the first device, and the first device transmits data with the second device through the first port;
[0111] Capability determination module 34 is used to determine the capability information of the first port based on the first status information and the actual status of the first port read by the first device, wherein the capability information is used to indicate whether the first port is allowed to recover from an abnormal state to a normal state.
[0112] The port activation module 36 is used to activate the first port when the capability information is the first capability information, so that the state of the first port is changed from the abnormal state to the normal state, wherein the first capability information is used to indicate that the first port is allowed to recover from the abnormal state to the normal state.
[0113] In an optional embodiment, the capability determination module 34 includes:
[0114] The first determining unit 342 is configured to determine the capability information of the first port as the first capability information when it is determined that the first status information is used to indicate that the status of the first port included in the first device is the abnormal status or the normal status, and the actual status of the first port read by the first device is the normal status.
[0115] In an optional embodiment, the capability determination module 34 includes:
[0116] The second determining unit 344 is configured to determine the capability information of the first port as the first capability information when the first status information indicates that the status of the first port included in the first device is the abnormal state or the normal state, the actual status of the first port read by the first device is the normal state, and the first port can be recovered after the first device performs a first protocol interaction negotiation with the second device.
[0117] In an optional embodiment, the device further includes:
[0118] The first message sending module 38 is used to send a second message to the second device after the first device activates the first port, wherein the second message includes second status information indicating that the status of the first port has been restored to the normal state.
[0119] The second message sending module 310 is used to terminate the sending of the third message to the second device, wherein the third message includes third status information indicating that the status of the first port is the abnormal status.
[0120] In an optional embodiment, the device further includes:
[0121] The interaction module 312 is used to perform a second protocol interaction negotiation with the second device through the first port after the first port is activated.
[0122] The state transition module 314 is used to deactivate the first port when it is determined that negotiation with the second device cannot be successful based on the second protocol interaction negotiation process, so that the state of the first port is changed from the normal state to the abnormal state.
[0123] In an optional embodiment, the device further includes:
[0124] The second activation module 316 is used to send a fourth message to the second device after deactivating the first port to instruct the second device to perform deactivation processing on the second port in the second device that is connected to the first port. The fourth message includes fourth status information indicating that the status of the first port is the abnormal status.
[0125] In an optional embodiment, the device further includes:
[0126] The alarm module 318 is used to send alarm information after the first port is deactivated.
[0127] In an optional embodiment, the device further includes:
[0128] The third message sending unit 322 is used to reply to the second device with a fifth message based on the first message after obtaining the first message from the second device. The fifth message carries fifth status information, which is used to indicate the status of the first port obtained by the first device based on the first message.
[0129] Status information collection form 324 is used to acquire the fifth status information and compare the first status information and the fifth status information to obtain a comparison result;
[0130] The fourth message sending unit 326 is used to terminate replying to the second device with the fifth message when it is determined that the comparison result indicates that the states indicated by the first state information and the fifth state information are different.
[0131] In an optional embodiment, the device further includes:
[0132] The message sending subunit 3262 is used to send a notification message to the second device after terminating the recovery of the fifth message to the second device, wherein the notification message is used to notify the second device to resend the message.
[0133] In an optional embodiment, the device further includes:
[0134] The fifth message sending unit 3264 is configured to construct and send a sixth message after terminating the recovery of the fifth message to the second device, wherein the sixth message carries sixth status information, which is used to indicate the status indicated by the first status information.
[0135] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.
[0136] The present invention will now be described with reference to specific embodiments.
[0137] like Figure 4 As shown, this is a network environment in which two devices interact through an aggregated link.
[0138] In the LACP protocol messages based on the IEEE 802.3ad standard, the port states of both the local and remote devices are stored. Normally, the device port state can be read from the received messages. Furthermore, in subsequent protocol message replies, the device's own port state and the read port state are included in the message and sent. However, due to network issues or problems with the protocol's processing, the remote port state read in the reply message may be incorrect. The data transmission method of this application can solve this problem.
[0139] It should be noted that the first device and the second device in this application are mainly used to distinguish similar objects. The second device may misjudge the port status of the first device. For example, in a message sent by the first device, the port status is 0x05, indicating that the port of the first device cannot be recovered. However, after receiving the message, the second device replies with a message in which the port status of the first device is 0x0d, indicating that the port of the first device can be aggregated, i.e., it can be recovered. This error in port status causes the second device to send data streams to the incorrectly judged port of the first device, resulting in packet loss. Only when the port of the first device is truly recovered can normal data interaction occur.
[0140] like Figure 5 As shown, corresponding to the network environment and protocol message transmission and reception described above, this embodiment provides a data transmission system used in the aforementioned first device, including:
[0141] The packet receiving module 51 is primarily responsible for receiving and sending LACP protocol messages. When an LACP protocol message arrives from the second device, this module receives the message and passes the message information to the protocol module of the first device for parsing. Additionally, when the first device needs to perform rapid recovery processing, it can send LACP protocol messages indicating port recovery and intercept LACP protocol messages sent by the first device indicating port failure.
[0142] Protocol module 52 is primarily responsible for parsing LACP protocol messages, recording port states within the messages, and comparing port state differences. If the first device needs to perform fast port recovery processing, the protocol module is also responsible for constructing LACP protocol messages and handing them over to the transceiver module for transmission to the second device. Furthermore, the protocol module is also responsible for determining whether ports undergoing fast recovery processing on the first device need state rollback, i.e., deactivating ports that have already recovered from the aggregated link and re-interacting with the LACP protocol to determine the port state.
[0143] Port module 53. This module is primarily responsible for reading the actual port status of the port to be restored from the first device when necessary, and then handing the read port status over to the protocol module. The protocol module compares the actual status with the port status of the first device in the LACP message sent by the second device. Furthermore, this module also notifies the port to perform fast recovery during fast recovery processing or to deactivate the port when a state rollback is required.
[0144] Alarm module 54. This module is primarily responsible for sending relevant alarms simultaneously with the port deactivation process after the first device port has undergone rapid recovery and subsequent LACP protocol interactions reveal that the port cannot successfully negotiate the protocol. This notifies staff to promptly investigate the fault.
[0145] Correspondingly, such as Figure 6 As shown, the data transmission method in this embodiment includes the following steps:
[0146] In step S61 (corresponding to the aforementioned step S202), the first device receives the LACP message sent by the second device and parses the port parameters in the message. It also reads the actual port status of its own device.
[0147] Step S62 (corresponding to steps S204 and S206 above) compares the port status of the first device in the message sent by the second device with the actual port status of the first device. If it is found that the port of the first device in the message can be recovered, but the port has not actually been recovered, then the fast recovery process is entered; otherwise, no processing is performed, and LACP protocol interaction continues.
[0148] It should be noted that the ports in the LACP aggregation group of the first and second devices confirm their recovery capability through LACP protocol interaction and negotiation. Even when the port's physical state is normal, it may be deactivated and unable to send or receive data due to protocol interaction failure. Therefore, in step S62 above, if the port of the first device is physically normal but cannot send or receive data only due to protocol interaction failure, it can be forcibly activated. This situation is the port fast recovery method mentioned in this patent.
[0149] In step S63 (corresponding to steps S208 and S2010 above), when entering the fast recovery process, the first device needs to directly restore the ports that have not yet been restored, and at the same time, the first device sends LACP protocol messages indicating that the ports have been restored. Simultaneously, it is necessary to intercept LACP protocol messages that the first device is about to send indicating that the port status has not been restored.
[0150] Step S64 (corresponding to the aforementioned steps S2012, S2014, and S2016): After the first device port has recovered, LACP protocol interaction continues. If the first device port can indeed recover, it remains in place; if subsequent LACP protocol interactions reveal that the quickly recovered port cannot successfully negotiate the LACP protocol, a state rollback occurs. That is, the quickly recovered port of the first device is deactivated from the aggregated link, and an LACP protocol message deactivating the port is sent to notify the second device to deactivate the connected port.
[0151] In step S65 (corresponding to the aforementioned step S2018), if the rollback situation in step S64 occurs, the abnormal state of the first device port being unable to recover needs to be sent through alarms or other means to notify relevant personnel to troubleshoot the fault.
[0152] like Figure 7 As shown, to prevent the second device from misjudging the port status of the first device, thereby preventing the second device from sending data to a port of the first device that has not yet recovered, resulting in packet loss and improving recovery performance, another specific embodiment includes the following steps:
[0153] Step S71: The second device receives the LACP protocol message sent by the first device, parses and records the port status of the first device in the message.
[0154] In step S72, after the second device receives the message, the system processes the message and replies with an LACP protocol message. At this time, the system parses the reply protocol message and records the port status of the first device in the reply message.
[0155] Step S73: Compare the port status in the received message and the reply message. If it is found that the second device incorrectly identifies the port status of the first device, that is, the port status of the first device is inconsistent in the received message and the sent message, then the erroneous LACP protocol message replied by the second device is intercepted, and the second device is notified to re-enter the protocol interaction.
[0156] In step S74, after intercepting the erroneous LACP protocol message, in order to improve the interaction efficiency, an LACP protocol message with the correct port status can be constructed and sent to the first device without waiting for the second device to re-interact with the protocol.
[0157] Correspondingly, such as Figure 8 As shown, the system applied to the aforementioned second device includes:
[0158] The packet receiving module 81 is primarily responsible for receiving and sending LACP protocol messages. When the LACP protocol message arrives from the first device, this module can receive the message. Additionally, if inconsistencies in port status are detected in the messages, it can replace the second system to send port recovery protocol messages and intercept erroneous port status protocol messages sent by the second system.
[0159] Protocol module 82 is primarily responsible for parsing LACP protocol port packets and comparing port states. If an inconsistency in port states is found in the packets, the second system is notified to re-engage with the protocol, and a protocol packet with the correct port state is constructed and sent to the transceiver module.
[0160] Embodiments of the present invention also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to perform the steps in any of the above method embodiments when executed.
[0161] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0162] Embodiments of the present invention also provide an electronic device including a memory and a processor, the memory storing a computer program and the processor being configured to run the computer program to perform the steps in any of the above method embodiments.
[0163] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0164] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.
[0165] It is obvious to those skilled in the art that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those described herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.
[0166] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, or improvements made within the principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A port status adjustment method, characterized in that, include: The first device receives a first message from the second device, wherein the first message carries first status information, which is used to indicate the status of a first port included in the first device, and the first device transmits data with the second device through the first port; The first device determines the capability information of the first port based on the first status information and the actual status of the first port read by the first device, wherein the capability information is used to indicate whether the first port is allowed to recover from an abnormal state to a normal state; When the capability information is the first capability information, the first device activates the first port to change the state of the first port from the abnormal state to the normal state, wherein the first capability information is used to indicate that the first port is allowed to recover from the abnormal state to the normal state.
2. The method according to claim 1, characterized in that, The first device determines the first capability information of the first port based on the first status information and the actual status of the first port read by the first device, including: When the first device determines that the first status information is used to indicate that the status of the first port included in the first device is the abnormal status or the normal status, and the actual status of the first port read by the first device is the normal status, the first device determines the capability information of the first port as the first capability information.
3. The method according to claim 2, characterized in that, The first device determines the first capability information of the first port based on the first status information and the actual status of the first port read by the first device, including: When the first device determines that the first status information is used to indicate that the status of the first port included in the first device is the abnormal status or the normal status, the actual status of the first port read by the first device is the normal status, and the first port can be recovered after the first device performs a first protocol interaction negotiation with the second device, the first device determines that the capability information of the first port is the first capability information.
4. The method according to claim 1, characterized in that, After the first device activates the first port, the method further includes: The first device sends a second message to the second device, wherein the second message includes second status information indicating that the status of the first port has been restored to the normal state; The first device terminates sending a third message to the second device, wherein the third message includes third status information indicating that the status of the first port is the abnormal status.
5. The method according to claim 1, characterized in that, After the first device activates the first port, the method further includes: The first device performs a second protocol negotiation with the second device through the first port; If the first device determines that it cannot successfully negotiate with the second device based on the second protocol interaction negotiation process, it deactivates the first port to change the state of the first port from the normal state to the abnormal state.
6. The method according to claim 5, characterized in that, After the first device deactivates the first port, the method further includes: The first device sends a fourth message to the second device to instruct the second device to perform deactivation processing on a second port in the second device that is connected to the first port. The fourth message includes fourth status information indicating that the state of the first port is the abnormal state.
7. The method according to claim 5, characterized in that, After the first device deactivates the first port, the method further includes: The first device sends an alarm message.
8. The method according to claim 1, characterized in that, After the first device receives the first message from the second device, the method further includes: The first device replies to the second device with a fifth message based on the first message, wherein the fifth message carries fifth status information, which is used to indicate the status of the first port obtained by the first device based on the first message; The first device acquires the fifth state information and compares the first state information and the fifth state information to obtain a comparison result; If the first device determines that the comparison result indicates that the states indicated by the first state information and the fifth state information are different, it shall terminate replying to the second device with the fifth message.
9. The method according to claim 8, characterized in that, After the first device terminates the recovery of the fifth message to the second device, the method further includes: The first device sends a notification message to the second device, wherein the notification message is used to notify the second device to resend the message.
10. The method according to claim 8, characterized in that, After the first device terminates the recovery of the fifth message to the second device, the method further includes: The first device constructs and sends a sixth message, wherein the sixth message carries sixth status information, which is used to indicate the status indicated by the first status information.
11. A port status adjustment device, characterized in that, Applied to the first device, including: The message acquisition module is used to acquire a first message from the second device, wherein the first message carries first status information, the first status information is used to indicate the status of a first port included in the first device, and the first device transmits data with the second device through the first port; A capability determination module is used to determine the capability information of the first port based on the first status information and the actual status of the first port read by the first device, wherein the capability information is used to indicate whether the first port is allowed to recover from an abnormal state to a normal state. The port activation module is used to activate the first port when the capability information is first capability information, so that the state of the first port is changed from the abnormal state to the normal state, wherein the first capability information is used to indicate that the first port is allowed to recover from the abnormal state to the normal state.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the method described in any one of claims 1 to 10.
13. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method described in any one of claims 1 to 10.