Method for optical port communication, network device and computer program product

By detecting the optical port negotiation status and adaptively adjusting the working mode, the communication anomaly caused by the mismatch of working modes of network devices is solved, and the stability and compatibility of optical port communication are achieved.

CN121887629APending Publication Date: 2026-04-17TP-LINK INT SHENZHEN CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-23
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Existing network devices experience communication anomalies due to incompatible operating modes in optical port communication, especially low-cost devices that cannot adaptively switch optical port operating modes, leading to compatibility issues.

Method used

By detecting whether the optical port negotiation is successful, the working mode of the optical port is adaptively adjusted to realize the optical port bypass function, ensuring normal communication between the network device and the peer device.

Benefits of technology

It improves the reliability and compatibility of communication between network devices and peer devices, reduces human intervention, and enhances the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121887629A_ABST
    Figure CN121887629A_ABST
Patent Text Reader

Abstract

At least one embodiment of the invention provides a method for optical port communication, network equipment and a computer program product. The method for optical port communication is implemented at network equipment and comprises the following steps: configuring a working mode of a first optical port of the network equipment into a first working mode, so that the first optical port negotiates with a second optical port of opposite-end network equipment in the first working mode; detecting whether negotiation succeeds or not according to the negotiation state information of the physical layer of the network equipment; and determining whether to switch the first optical port from the first working mode to the second working mode or not based on a detection result of whether the negotiation is successful or not. According to the method, the working mode of the optical port can be adaptively adjusted, an optical port bypass function is realized, and normal communication between the network equipment and opposite-end network equipment is facilitated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of this disclosure relate to the field of communications, and more specifically, to methods, network devices, and computer program products for optical communication. Background Technology

[0002] Early communication networks relied on electrical ports (physical interfaces used for transmitting electrical signals) (such as the RJ45 interface) to achieve signal transmission. However, with the popularization of technologies such as the Internet, cloud computing, and big data, data traffic has exploded. Electrical ports are limited by physical characteristics such as electromagnetic interference, signal attenuation, and bandwidth limits, making it difficult to meet the requirements of high-speed transmission (such as data transmission rates of 10Gbps and above). Moreover, signal loss is severe in long-distance transmission, requiring a large number of relay devices, which greatly increases costs and complexity.

[0003] In light of this, optical communication technology, which relies on optical ports (physical interfaces for optical signal transmission) to achieve signal transmission, has emerged. Using optical signals as the transmission carrier and leveraging the advantages of optical fiber media, such as low loss, high bandwidth, and anti-interference, it can achieve high-speed, long-distance, and low-error-rate data transmission. However, there is still room for improvement in ensuring the normal communication of network devices supporting optical communication technology. Summary of the Invention

[0004] At least one embodiment of this disclosure provides a method for optical port communication, the method being implemented at a network device and comprising: configuring the operating mode of a first optical port of the network device to a first operating mode, such that the first optical port negotiates with a second optical port of a peer network device in the first operating mode; detecting whether the negotiation is successful based on the negotiation status information of the physical layer of the network device; and determining whether to switch the first optical port from the first operating mode to a second operating mode based on the detection result of whether the negotiation is successful.

[0005] For example, in some embodiments, determining whether to switch the first optical port from the first working mode to the second working mode based on the detection result of whether the negotiation was successful includes: in response to the negotiation failing, switching the first optical port from the first working mode to the second working mode.

[0006] For example, in some embodiments, detecting whether the negotiation is successful based on the negotiation status information of the physical layer of the network device includes: accessing the negotiation status register of the physical layer chip of the physical layer, the negotiation status register being used to store the negotiation status information; and determining whether the negotiation is successful based on the negotiation status information.

[0007] For example, in some embodiments, detecting whether the negotiation is successful based on the physical layer negotiation status information of the network device includes: detecting whether the negotiation is successful based on the negotiation status information; and in response to detecting that the negotiation is unsuccessful, detecting whether the negotiation is successful again after a predetermined time, and determining whether the negotiation is successful based on the result of the second detection.

[0008] For example, in some embodiments, the predetermined time is determined based on the time taken for the negotiation.

[0009] For example, in some embodiments, the method further includes: detecting whether the first optical port changes from a link disconnected state to a link connected state; and in response to the first optical port changing from a link disconnected state to a link connected state, accessing the physical layer negotiation state information of the network device to detect whether the negotiation is successful.

[0010] For example, in some embodiments, detecting whether the first optical port changes from a disconnected state to a connected state includes: detecting whether the signal on the communication bus of the physical layer chip of the physical layer changes; recording the link state of the first optical port in response to the signal change; and determining whether the first optical port changes from the disconnected state to the connected state based on the recorded link state.

[0011] For example, in some embodiments, detecting whether a signal on the communication bus of the physical layer chip of the physical layer has changed includes: detecting whether the signal has changed at predetermined time intervals.

[0012] For example, in some embodiments, the first operating mode is an automatic negotiation mode, and the second operating mode is a forced mode.

[0013] For example, in some embodiments, detecting whether the negotiation is successful based on the physical layer negotiation status information of the network device includes: detecting whether the negotiation is successful based on the negotiation status information at predetermined time intervals.

[0014] For example, in some embodiments, the method is implemented by the processor of the network device executing software instructions in memory.

[0015] For example, in some embodiments, the network device further includes at least one other optical port, and the network device is connected to the optical ports of the peer network device and / or other peer network devices through the at least one other optical port.

[0016] For example, in some embodiments, the network device is a switch.

[0017] At least one embodiment of this disclosure provides a network device including: at least one processor; and a memory; wherein the memory stores computer-readable instructions and is communicatively connected to the at least one processor; the at least one processor is configured to execute the computer-readable instructions stored in the memory to implement the method as described above.

[0018] For example, in some embodiments, the network device is a switch.

[0019] At least one embodiment of this disclosure provides a computer program product having instructions stored thereon that, when executed by a processor, cause the method described above to be performed. Attached Figure Description

[0020] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the accompanying drawings of the embodiments of this disclosure will be briefly described below. Clearly, the drawings described below only relate to some embodiments of this disclosure and are not intended to limit the scope of this disclosure.

[0021] Figure 1 A schematic diagram of a communication system for communication between network devices is shown as an example.

[0022] Figure 2 A schematic diagram of an example communication system including network devices is shown;

[0023] Figure 3 A schematic diagram of a method for optical port communication according to at least one embodiment of the present disclosure is shown;

[0024] Figures 4 to 6 A schematic diagram of a method for optical port communication including exemplary steps according to at least one embodiment of the present disclosure is shown;

[0025] Figure 7 A schematic diagram of a network device according to at least one embodiment of the present disclosure is shown. Detailed Implementation

[0026] Reference will now be made in detail to specific embodiments of the present disclosure, examples of which are illustrated in the accompanying drawings. Although the present disclosure will be described in conjunction with specific embodiments, it will be understood that it is not intended to limit the present disclosure to the described embodiments. Rather, it is intended to cover variations, modifications, and equivalents included within the spirit and scope of the present disclosure as defined by the appended claims. It should be noted that the method operations described herein can be implemented by any functional block or functional arrangement, and any functional block or functional arrangement can be implemented as a physical entity or a logical entity, or a combination of both.

[0027] To enable those skilled in the art to better understand this disclosure, the disclosure will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0028] Note that the examples described below are merely specific examples and are not intended to limit the embodiments of this disclosure to the specific shapes, hardware, connections, operations, values, conditions, data, sequences, etc., shown and described. Those skilled in the art can utilize the concepts of this disclosure to construct further embodiments not mentioned herein by reading this specification.

[0029] The terminology used in this disclosure is that which is currently widely used in the art in consideration of the functionality of this disclosure; however, these terms may vary depending on the intent, precedent, or new technology of those skilled in the art. Furthermore, specific terms may be chosen by the applicant, and in such cases, their detailed meanings will be described in the detailed description of this disclosure. Therefore, the terminology used in this specification should not be construed as simple names, but rather based on the meaning of the terms and the overall description of this disclosure.

[0030] This disclosure uses flowcharts to illustrate the operations performed by the system according to embodiments of this application. It should be understood that the preceding or following operations are not necessarily performed in exact order. Instead, various steps can be processed in reverse order or simultaneously as needed. Furthermore, other operations can be added to these processes, or one or more steps can be removed from them.

[0031] First, the abbreviations and related terms involved in this application are defined and explained.

[0032] Optical Port: refers to the physical interface used for optical signal transmission.

[0033] Network equipment: Electronic devices that support optical communication. For example, a network device may have an optical port to enable optical signal transmission and reception, data transmission, or signal conversion via a medium such as optical fiber.

[0034] Optical Port Mode: This refers to a set of modes used to define the link establishment method, parameter negotiation mechanism, and signal transmission rules between optical ports. For example, in the IEEE 802.3 protocol, operating modes can include AN mode and Force mode.

[0035] AN mode (Auto-Negotiation Mode): This mode allows the optical port to automatically negotiate parameters such as transmission rate and duplex mode with the peer network device (hereinafter referred to as the peer device) to achieve adaptive matching.

[0036] Force Mode: This is a forced or non-negotiated mode that forces the optical port to operate with preset transmission parameters (such as rate and duplex mode) without negotiating with the other end.

[0037] It is understood that the terms defined above are merely exemplary definitions in specific application scenarios to better understand this application, and this disclosure is not limited thereto.

[0038] Figure 1 A schematic diagram of a communication system for communication between network devices is shown as an example.

[0039] See Figure 1 The communication system 100 includes multiple network devices, shown as a switch 110, a router 120, and a server 130. These network devices may include one or more optical ports to connect to peer network devices via a medium for transmitting light (e.g., optical fiber) for optical communication. For example, switch 110 may connect to one optical port of router 120 via an optical port and an optical fiber medium for optical communication. Alternatively or additionally, switch 110 may connect to one optical port of server 130 via another optical port and an optical fiber medium for optical communication. Similarly, router 120 may connect to one optical port of server 130 via an optical port and an optical fiber medium for optical communication.

[0040] It is worth noting that, Figure 1 These are merely examples. For instance, in addition to switch 110, router 120, and server 130, network devices may include other types of network devices. Furthermore, these network devices may include more or fewer optical ports and may connect to more or fewer other network devices for optical communication.

[0041] Figure 2 A schematic diagram of a communication system including a network device structure is shown as an example.

[0042] See Figure 2 The communication system 200 includes network devices 210 and 220. Network devices 210 and 220 can be connected via optical ports for optical communication. Network device 210 may include a MAC chip 212, a physical layer (PHY) chip 214, and an optical port 216.

[0043] The MAC chip 212 can connect upwards to the processor (such as CPU / SoC / MCU) inside the network device and downwards to the physical layer chip 214. It is primarily responsible for frame encapsulation and decapsulation conforming to protocols (such as Ethernet), media access control, frame error detection, and flow control to achieve data frame transmission and reception and link management. Regarding the processor's location within the network device, in other examples, the processor can be located outside the MAC chip 212 and can be connected to both the MAC chip 212 and the physical layer chip 214 to control both, or the processor can be integrated within the MAC chip 212.

[0044] It is worth noting that the physical layer chip here can support physical layer chips for optical communication protocols / standards. In some examples, the physical layer chip may include an Ethernet physical layer chip that supports the Ethernet protocol.

[0045] One end of the physical layer chip 214 can communicate with the MAC chip 212 via, for example, a GMII / SGMII interface, and the other end can connect to the optical port 216 via, for example, an MDI interface, to realize physical layer signal conversion and transmission adaptation of data frames. This may specifically include signal encoding and decoding, serial-to-parallel conversion, clock synchronization, link negotiation, and format adaptation of electrical and optical signals. Regarding the correspondence between the physical layer chip and the optical port, in some cases, one physical layer chip can be set for each optical port to control or monitor the operation of that single optical port. In other cases, one physical layer chip 214 can be set for multiple optical ports to control or monitor the operation of those multiple optical ports.

[0046] Optical port 216 can be the physical interface between network device 210 and optical fiber link 218. For example, optical port 216 can be encapsulated using the SFP / SFP+ standard, thereby establishing a communication connection with the peer network device (such as network device 220) through optical fiber link 218.

[0047] It is worth noting that although network device 210 only shows one optical port 216, network device 210 may include more optical ports. Additionally, Figure 2 The architecture shown is exemplary, and different architectures can be used to establish communication connections between network devices via optical ports.

[0048] Network device 220 may have the same or similar structure as network device 210, which will not be described in detail here.

[0049] However, the inventors of this disclosure recognized during their research that, for example... Figure 1 and Figure 2In the communication system shown, there are situations where the two ends of the network devices that need to establish communication cannot communicate normally due to the different operating modes of their respective optical ports. In fact, in order to achieve communication between two or more network devices, the optical ports of each network device need to be set to the same operating mode in order to align the link establishment method, parameter negotiation mechanism, and signal transmission rules, etc.

[0050] For example, according to the IEEE 802.3 protocol, the operating modes of a Gigabit Ethernet optical port can include auto-negotiation mode and forced mode. When two optical ports are interconnected, both ports (referred to as both ends) must be configured to the same operating mode (such as both being in auto-negotiation mode or forced mode) for normal communication. Conversely, if the operating modes configured at both ends do not match (such as one optical port being in auto-negotiation mode while the other is in forced mode), a connection cannot be established, resulting in communication abnormalities.

[0051] However, some low-cost network devices cannot adaptively switch the working mode of the optical port, and network devices using this chip may experience compatibility issues in scenarios such as the following examples.

[0052] One example scenario is that the optical ports of network devices on the market only support one of the auto-negotiation mode and the forced mode. When two network devices are used together to establish a communication link and the working modes supported by their respective optical ports do not match, the two network devices cannot communicate normally.

[0053] Another exemplary scenario is when a network device communicates with a managed network device (such as a managed switch) via an optical port. The peer device (i.e., the managed network device) can actively configure the operating mode of its optical port through its management interface. Similarly, if the operating mode configured on the peer device does not match the operating mode of the network device, communication abnormalities will also occur. In this case, the operating mode of the peer device needs to be manually modified for normal communication to be possible.

[0054] In view of this, embodiments of the present disclosure provide a method, network device, and computer program product for optical port communication, which can adaptively adjust the working mode of the optical port based on whether the optical port negotiation is successful, realize the optical port bypass function, and facilitate normal communication between the network device and the peer network device.

[0055] In at least one embodiment of this disclosure, the bypass function can refer to: determining whether to switch the working mode by detecting whether the optical port of the network device has successfully negotiated with the optical port of the peer device in a certain working mode, thereby realizing adaptive switching of the working mode of the optical port and ensuring stable data transmission.

[0056] Figure 3A schematic diagram of a method for optical port communication according to at least one embodiment of the present disclosure is shown. This method 300 can be implemented at a network device. For example, the network device herein may be [see...]. Figure 1 The described switch 110, router 120, and server 130, or see [reference] Figure 2 The network devices described are 210 and 220, etc.

[0057] See Figure 3 The method 300 includes steps S310 to S330.

[0058] In step S310, the operating mode of the first optical port of the network device is configured to the first operating mode, so that the first optical port negotiates with the second optical port of the peer network device in the first operating mode.

[0059] Here, after configuring the first optical port to the first working mode, when the network device needs to communicate with the peer network device, the first optical port can negotiate with the second optical port of the peer network device in the first working mode.

[0060] In some embodiments, a network device can negotiate with a peer network device by sending a configuration stream for data transmission. For example, this configuration stream may contain information such as the speed and duplex mode supported by its own optical port. For instance, as specified in the IEEE 802.3 protocol standard, the configuration stream may include / C / codes and / I / codes. For example, when the network device's optical port is in auto-negotiation mode, the network device can negotiate with the peer network device by sending / C / codes. As another example, when the network device's optical port is in forced mode, the network device can negotiate with the peer network device by sending / I / codes.

[0061] In step S320, the negotiation status is checked based on the physical layer negotiation status information of the network device to determine whether the negotiation was successful.

[0062] In some embodiments, the success of the negotiation can be determined based on whether the information contained in the configuration stream sent by the network device and the peer network device corresponds to the operating mode of its own optical port. Negotiation status information can be set at the physical layer of the network device to indicate whether the negotiation between the first optical port and the second optical port of the peer network device in the first operating mode was successful; that is, the negotiation status information corresponds to or includes the negotiation status information of the negotiation between the first optical port and the second optical port of the peer network device in the first operating mode. Therefore, the success of the negotiation can be detected by accessing this negotiation status information.

[0063] As mentioned above, the success of the negotiation is related to whether the optical ports of the network device and the peer network device operate in the same mode.

[0064] In one example, when both the network device and the peer network device are in auto-negotiation mode, they can send each other / C / codes. For instance, if three identical / C / codes are received consecutively from the other party and the received code stream matches the local operating mode, a / C / code with an Ack acknowledgment can be returned to the other party. Upon receiving the Ack message, the peer end can indicate that the negotiation was successful, and both parties can then communicate normally.

[0065] In another example, when both the network device and the peer network device's optical ports are operating in forced mode, they can send each other / I / codes. For instance, if one end receives an / I / code, it indicates that the negotiation was successful, and both parties can communicate normally.

[0066] In another example, when one optical port of a network device operates in auto-negotiation mode and the other optical port of a peer network device operates in forced mode, the forced mode end can send / I / codes, while the auto-negotiation mode end can send / C / codes. Since the forced mode end cannot provide the peer end with its own negotiation information, nor can it return an Ack acknowledgment, the negotiation between the two parties fails, and normal communication is impossible.

[0067] In step S330, based on the detection result of whether the negotiation was successful, it is determined whether to switch the first optical port from the first working mode to the second working mode.

[0068] As mentioned above, the success of negotiation depends at least on whether the optical ports of the network device and the peer network device operate in the same mode. Therefore, the operating mode of the optical port can be adaptively adjusted based on the detection results of negotiation success, thereby increasing the probability of successful negotiation between the optical ports of the network device and the peer network device, and facilitating normal communication between the two devices.

[0069] As described above, the method for optical port communication according to at least one embodiment of this disclosure can adaptively adjust the operating mode of the optical port to achieve optical port bypass function, which helps network devices to communicate normally with peer network devices. For example, when a network device using the method for optical port communication according to at least one embodiment of this disclosure is used in conjunction with various peer network devices (e.g., peer network devices with optical ports supporting different operating modes) for communication, it can quickly establish communication with the peer network devices without human intervention, thereby significantly improving the reliability and versatility of the network device and enhancing the user experience.

[0070] The following describes exemplary additional aspects of a method for optical port communication according to at least one embodiment of the present disclosure. For example, the following is combined with... Figures 4 to 6This describes one or more exemplary additional aspects of a method for optical port communication according to at least one embodiment of the present disclosure.

[0071] Figures 4 to 6 A schematic diagram of a method for optical port communication, including exemplary steps, according to at least one embodiment of the present disclosure is shown. It is worth noting that... Figures 4 to 6 The individual steps in the described method for optical port communication are merely exemplary and intended to illustrate the point. (See also: [link to relevant documentation]) Figure 3 More detailed exemplary aspects and / or exemplary additional aspects of the described method for optical port communication. Additionally, Figures 4 to 6 The steps in the described method for optical port communication, along with other exemplary additional aspects, can be combined with each other.

[0072] Figure 4 Steps S410 and S420 in the process can be combined with Figure 3 They are basically the same, so I will not go into details here.

[0073] In step S430, similar to step S330, it can be determined whether to switch the first optical port from the first working mode to the second working mode based on the detection result of whether the negotiation was successful.

[0074] For details, see Figure 4 In some embodiments, step S430 may include step S4302. In step S4302, in response to successful negotiation, the first optical port is maintained in the first operating mode.

[0075] Here, when the negotiation is successful, it indicates that the optical ports of the network device and the peer network device are operating in the same mode and can communicate normally. In this case, the current operating mode (i.e., the first operating mode) can be maintained, and subsequent communication can continue. Alternatively, after maintaining the current operating mode, the method for optical port communication can be terminated, for example, by no longer performing the negotiation success check.

[0076] In some embodiments, step S430 may include step S4304. In step S4304, in response to the unsuccessful negotiation, the first optical port is switched from a first operating mode to a second operating mode. Additionally, after switching the first optical port from the first operating mode to the second operating mode, the method for optical port communication may be terminated without performing the negotiation success detection.

[0077] Here, if the negotiation fails, it indicates that the operating modes of the optical ports of the network device and the peer network device may be different. In this case, the operating mode of the network device's optical port can be switched from its current operating mode (i.e., the first operating mode) to another operating mode (i.e., the second operating mode). This allows the network device to negotiate with the peer network device's second optical port using this new operating mode. Switching the network device's optical port operating mode from its current mode to another operating mode helps to align the network device's optical port operating mode with that of the peer network device's optical port (i.e., the second optical port), thereby increasing the probability of successful negotiation between the network device's optical port and the peer network device's optical port and facilitating normal communication between the two devices.

[0078] As mentioned above, negotiation status information can be set at the physical layer of a network device to indicate whether the negotiation was successful. For example, a negotiation status register can be set in the physical layer chip to store the negotiation status information.

[0079] Therefore, in some embodiments, see Figure 4 Step S420 may include: accessing the negotiation status register of the physical layer chip, the negotiation status register being used to store negotiation status information; and determining whether the negotiation was successful based on the negotiation status information.

[0080] In one example, the physical layer chip has multiple registers, and the register at address 0x01 can be used as the negotiation status register. This register can include 16 bits, and bit 5 in this register can be used to indicate whether the negotiation was successful. For example, a value of 1 for bit 5 indicates successful negotiation, and a value of 0 for bit 5 indicates unsuccessful negotiation.

[0081] It is worth noting that the register address of the negotiation state register used to identify the negotiation state information and the specific bits of the negotiation state register can be changed according to different physical layer chips, and this disclosure is not limited to the above examples.

[0082] Alternatively or additionally, negotiation state information can be stored through other chips in the physical layer or other components of the physical layer chip.

[0083] Step S330 above describes how the decision to switch the optical port's operating mode can be determined based on the detection result of whether the negotiation was successful. Furthermore, the inventors of this disclosure recognized in their research that negotiation involves, for example, the transmission of configuration code streams (e.g., / C / code, / I / code) and / or Ack between the network device and the peer device, meaning that negotiation requires a certain amount of time. Detecting whether the negotiation was successful during the negotiation process would lead to unreliable detection results.

[0084] In view of this, in some embodiments, see Figure 5 Step S520 may include steps S5202 and S5204. In step S5202, the negotiation status information is used to determine whether the negotiation was successful. In step S5204, in response to the detection that the negotiation was unsuccessful, the negotiation is checked again after a predetermined time to determine whether the negotiation was successful, and the result of the second check is used to determine whether the negotiation was successful.

[0085] In this embodiment, step S5202 can be simply referred to as the initial detection, and step S5204 can be simply referred to as the re-detection. If the initial detection indicates that the negotiation has failed, considering that the initial detection may occur during the negotiation process, a re-detection can be performed by delaying the process by a predetermined time. This ensures that the re-detection occurs after the negotiation has ended, making the detection result regarding the success or failure of the negotiation more reliable.

[0086] Although this embodiment shows two detections, an initial detection and a second detection, multiple detections may be performed in other embodiments.

[0087] exist Figure 5 In other aspects, steps S510 and S530 are basically the same as steps S310 and S330 respectively, and will not be described in detail here.

[0088] In some embodiments, the predetermined time in step S5204 may be determined based on the negotiated time.

[0089] In this embodiment, for example, the predetermined time can be equal to or substantially equal to the negotiation time. Alternatively, the predetermined time can be greater than the negotiation time. This allows the re-detection to occur after the negotiation has ended, thus ensuring the reliability of the detection result regarding the success or failure of the negotiation.

[0090] Different network devices may take different amounts of time to negotiate, so the predetermined time can be determined based on the specific negotiation time of each network device. In some examples, the negotiation time can be obtained through timing. In other examples, the negotiation time can be obtained through simulation or as an empirical value.

[0091] As mentioned above, negotiation involves, for example, the transmission of configuration streams (e.g., / C / code, / I / code) and / or Ack between the network device and the peer device. Therefore, to detect whether the negotiation was successful, it can be determined whether a physical connection has been established between the network device and the peer device for, for example, the transmission of configuration streams and / or Ack.

[0092] In view of this, in some embodiments, see Figure 6The method for optical port communication may further include step S615. In step S615, it is detected whether the first optical port changes from a link disconnected state to a link connected state. In addition, in response to the first optical port changing from a link disconnected state to a link connected state, step S620 is executed, that is, accessing the physical layer negotiation status information of the network device to detect whether the negotiation is successful.

[0093] In this embodiment, the change of the link state of the first optical port from a disconnected state to a connected state indicates that a physical connection has been established between the detection network device and the peer device, and that they are ready for negotiation. Thus, the detection of whether negotiation was successful can be triggered only after the negotiation is ready, avoiding unnecessary triggering of the negotiation success detection.

[0094] In other embodiments, in response to the first optical port not changing from a disconnected state to a connected state, the method for optical port communication can be terminated, and the detection of whether the first optical port has changed from a disconnected state to a connected state is no longer performed.

[0095] It should be noted that, in Figure 6 In this process, steps S610, S620 and S630 are basically the same as steps S310, S320 and S330, respectively, and will not be described again here.

[0096] The inventors of this disclosure also recognized during their research that the link state of the optical port will not change when the optical port is not plugged in or unplugged and / or the operating mode is not switched. In this case, detecting whether the first optical port has changed from a disconnected state to a connected state will not only fail to obtain new information but will also consume resources and affect performance.

[0097] In view of this, in some embodiments, see further reference. Figure 6 Step S615 may include steps S6152, S6154 and S6156.

[0098] In step S6152, it is possible to detect whether the signal on the communication bus of the physical layer chip has changed.

[0099] Here, plugging and unplugging the optical port and / or switching the operating mode can cause changes in the signals on the communication bus of the physical layer chip. In some examples, changes in the signals of the serializer / deserializer (SerDes) of the physical layer chip can be detected.

[0100] In step S6154, the link status of the first optical port can be recorded in response to a change in the signal.

[0101] As described above, when the signal changes, it indicates the insertion / removal of the optical port and / or the switching of the working mode. At this time, the link status of the first optical port (e.g., link disconnection status or link connection status) can be recorded by the register of the physical layer chip or the memory of the network device.

[0102] In step S6156, it can be determined whether the first optical port has changed from a disconnected state to a connected state based on the recorded link status.

[0103] For example, the recorded link status can be compared with the previously recorded link connection status of the first optical port to determine whether the first optical port has changed from a disconnected state to a connected state.

[0104] Considering that network devices may experience optical port plugging / unplugging (such as hot-plugging) or switching of working modes during operation, in order to adapt to this scenario, the success of negotiation can be detected in real time or at certain time intervals.

[0105] For example, in some embodiments, in Figure 6 In this process, step S615, which detects whether the first optical port changes from a disconnected state to a connected state, can be executed at predetermined time intervals. For example, more specifically, in some embodiments, step S6152, which detects whether the signal changes, can be executed at predetermined time intervals.

[0106] As described above, step S615 is optional. When the method for optical port communication according to at least one embodiment of the present disclosure does not include step S615, step S620 can be executed at a predetermined time interval, that is, at a predetermined time interval, the negotiation status information is detected, and the negotiation is detected as successful, thereby realizing the adaptive switching of the optical port of the network device during operation.

[0107] In at least one embodiment of this disclosure, steps S320, S420, S520, S615, S620, and S6152 may optionally be repeated, referred to herein as "polling," thereby enabling the network device to dynamically detect link status or negotiation status during operation, so as to dynamically adjust the operating mode of the optical port based on these detection results. In some examples, and as described above, these steps may be repeated at predetermined time intervals (i.e., periodic polling) to dynamically adjust the operating mode of the optical port.

[0108] Considering that in most scenarios, the optical port of the peer network device communicating with the network device operates in auto-negotiation mode, in some embodiments, the operating mode of the network device's first optical port can be preferentially set to auto-negotiation mode. Therefore, in some embodiments, the first operating mode can be auto-negotiation mode, and the second operating mode can be forced mode. This increases the probability of successful initial negotiation, speeds up the onboarding of normal communication, and reduces resource consumption caused by multiple handovers.

[0109] In some examples, the operating mode of the first optical port of the network device can be set to auto-negotiation mode during optical port initialization. In other examples, if it is detected in step S615 above that the first optical port has not changed from a link disconnected state to a link connected state, the operating mode of the first optical port can be set to auto-negotiation mode, that is, it can remain unchanged.

[0110] In other embodiments, considering that in some application scenarios, such as knowing in advance that the peer network device only supports forced mode or is usually set to forced mode, the first working mode can be forced mode and the second working mode can be automatic negotiation mode.

[0111] In some embodiments, the method for optical port communication according to at least one embodiment of this disclosure can be implemented by a processor of a network device executing software instructions in memory. For example, it can be seen from [reference needed]. Figure 2 The processor of the network device described (located in or outside the MAC chip 212) executes software instructions in memory to achieve this.

[0112] In this embodiment, the method for optical port communication according to at least one embodiment of this disclosure can be implemented through the interaction between the software and the physical layer, improving the ease of implementation. For example, the method for optical port communication can be implemented by storing the software in the memory of an existing network device and executing it by a processor, without modifying the hardware logic of the network device, such as without modifying the physical layer chip of the network device to embed the hardware logic for implementing the method for optical port communication. Additionally, the various steps of the method for optical port communication can be repeatedly executed by software, i.e., the bypass function of the optical port can be implemented by software polling.

[0113] In some examples, the software can be host computer software. This host computer software can be a computer program that facilitates programming or operation by staff to interact with network devices, monitor network devices, configure parameters, or issue commands. This allows for convenient software programming. Additionally, the host computer software can support a graphical user interface (GUI) display (e.g., when used with a monitor) to display the operating mode and other information of the network device's optical port, facilitating monitoring of the optical port's operation by staff.

[0114] The above description focuses on a single optical port (i.e., the first optical port) of a network device, outlining several aspects of its adaptive switching operating mode. In some embodiments, the network device may further include one or more other optical ports, and the network device can connect to the optical ports of the peer network device or other peer networks connected to the first optical port using their respective operating modes through these optical ports for communication.

[0115] For example, in some embodiments, the network device further includes at least one other optical port, and the network device is connected to the optical ports of peer network devices and / or other peer network devices through at least one other optical port.

[0116] For example, a network device can connect to two optical ports (such as a first optical port and another optical port) of the same peer network device. In this way, the network device can connect to the same peer network device through two different optical ports. In this case, the network device can achieve parallel data transmission with the same peer network device through the two different optical ports, or it can choose to use only one optical port for data transmission between the network device and the peer network device.

[0117] For example, a network device can connect to the optical port of a peer network device through one optical port (such as the first optical port), and connect to the optical port of another peer network device through another optical port (such as another optical port). In this case, the network device can connect to different peer network devices through two different optical ports. For example, the network device can be a network device with management functions, so as to manage multiple downstream network devices as an upstream device.

[0118] In some embodiments, at least one other optical port of the network device may be the same as or similar to the first optical port described above, i.e., employing one or more aspects of the methods for optical port communication described above, and additionally, the operating mode of at least one other optical port may be the same as or different from the operating mode of the first optical port. In other embodiments, at least one other optical port may be different from the first optical port, for example, not employing one or more aspects of the methods for optical port communication described above, thereby only not supporting the switching of operating modes.

[0119] For example, in some embodiments, the network device further includes at least one other optical port. In this case, the method for optical port communication may further include: configuring the operating mode of at least one other optical port of the network device to a third operating mode, such that the at least one other optical port negotiates with the optical port of the first optical port connected to the peer network device and / or another peer network device in the third operating mode; detecting whether the negotiation is successful based on the negotiation status information of the physical layer of the network device (i.e., the negotiation status information corresponding to the negotiation of the at least one other optical port connecting to the optical port of the first optical port connected to the peer network device and / or another peer network device in the third operating mode); and determining whether to switch the at least one other optical port from the third operating mode to a fourth operating mode based on the detection result of whether the negotiation is successful.

[0120] In this embodiment, the third and fourth operating modes may be the same as or different from the first and second operating modes, respectively. For example, if the first operating mode is an auto-negotiation mode and the second operating mode is a forced mode, the third operating mode may be a forced mode and the fourth operating mode may be an auto-negotiation mode. As another example, if the first operating mode is an auto-negotiation mode and the second operating mode is a forced mode, the third and fourth operating modes may be operating modes other than the forced mode and the auto-negotiation mode. Yet another example, if the first operating mode is an auto-negotiation mode and the second operating mode is a forced mode, one of the third and fourth operating modes may be either the forced mode or the auto-negotiation mode, and the other of the third and fourth operating modes may be an operating mode other than the forced mode and the auto-negotiation mode.

[0121] It is worth noting that although the above description uses forced mode and auto-negotiation mode as examples of working modes, this disclosure is not limited to this. For example, based on different standards, the working modes described herein may correspondingly include more types or other different types of working modes. Furthermore, based on different standards, the working modes described herein may correspondingly include a greater number of working modes. Accordingly, the method for optical port communication according to at least one embodiment of this disclosure can also switch between a greater number of working modes. For example, for the optical port of a network device, if the negotiation of its first working mode fails, it can switch to the second working mode; if the negotiation of its second working mode still fails, it can switch to the third working mode, and so on. In addition, the switching order can be set as needed. Correspondingly, with a greater number of working modes, it can also adaptively adjust the working mode of the optical port to realize the optical port bypass function, which helps the network device to communicate normally with the peer network device; further details will not be elaborated here.

[0122] At least one embodiment of this disclosure also provides a computer program product having instructions stored thereon that, when executed by a processor, cause the execution of a method for optical port communication according to at least one embodiment of this disclosure.

[0123] At least one embodiment of this disclosure also provides a network device. Figure 7 A schematic diagram of a network device according to at least one embodiment of the present disclosure is shown.

[0124] like Figure 7 As shown, the network device 700 includes at least one processor 720 and a memory 710. The memory 710 stores computer-readable instructions and is communicatively connected to the processor 720. The processor 720 executes the computer-readable instructions stored in the memory 710 to implement a method for optical port communication according to at least one embodiment of the present disclosure and its additional aspects.

[0125] For example, the memory 710 and the processor 720 can communicate with each other directly or indirectly. For example, in some examples, such as... Figure 7 As shown, the network device 700 may also include a system bus 730, through which the memory 710 and the processor 720 can communicate with each other. For example, the processor 720 can access the memory 710 through the system bus 730. For example, in other examples, components such as the memory 710 and the processor 720 can communicate through a network on-chip (NOC) connection.

[0126] For example, processor 720 can control other components in network device 700 to perform desired functions. Processor 720 can be a device with data processing and / or program execution capabilities, such as a central processing unit (CPU), tensor processor (TPU), network processor (NP), or graphics processing unit (GPU), or it can be a digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.

[0127] For example, memory 710 may include any combination of one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, erasable programmable read-only memory (EPROM), portable compact disc read-only memory (CD-ROM), USB memory, flash memory, etc.

[0128] For example, one or more computer-readable instructions can be stored on memory 710, and processor 720 can execute the computer-readable instructions to perform various functions. Various application programs and various data, such as instruction processing code and various data used and / or generated by the application programs, can also be stored in the computer-readable storage medium.

[0129] For example, some computer instructions stored in memory 710 can be executed by processor 720 to perform one or more steps of the method for optical port communication and its additional aspects as described above.

[0130] For example, such as Figure 7 As shown, network device 700 may further include an input interface 740 that allows external devices to communicate with network device 700. For example, input interface 740 may be used to receive instructions from external computer devices, users, etc. Network device 700 may also include an output interface 750 that enables network device 700 to connect to one or more external devices. For example, network device 700 can communicate via output interface 750, etc.

[0131] It should be noted that the network device 700 according to at least one embodiment of the present disclosure is exemplary and not restrictive. Depending on the actual application needs, the network device 700 may also include other conventional components or structures. For example, in order to realize the necessary functions of the network device, those skilled in the art can set other conventional components or structures according to the specific application scenario. The embodiments of the present disclosure do not limit this.

[0132] For example, network device 700 may also include (see above) Figure 2 The optical port 216, physical layer chip 214, MAC chip 212, etc. are described.

[0133] In some embodiments, network device 700 may be a switch, for example, see [link to documentation] Figure 1 The described switch is 110.

[0134] At least one embodiment of this disclosure also provides a computer-readable storage medium. This computer-readable storage medium stores computer-readable instructions that, when executed by a computer (including a processor), can implement a method for optical port communication according to at least one embodiment of this disclosure, and additional aspects thereof.

[0135] For example, one or more computer-readable instructions may be stored on a computer-readable storage medium. Some of the computer-readable instructions stored on the computer-readable storage medium may be, for example, instructions for implementing one or more steps in the methods described above.

[0136] For example, a computer-readable storage medium may include a storage component of a tablet computer, a hard disk of a personal computer, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), optical disc read-only memory (CD-ROM), flash memory, or any combination of the above computer-readable storage media, or other suitable storage media. For example, a computer-readable storage medium may include the memory 710 in the network device 700 described above.

[0137] In addition to the exemplary descriptions above, the following points should be noted regarding this disclosure:

[0138] (1) The accompanying drawings of the embodiments of this disclosure only involve the structures involved in the embodiments of this disclosure. Other structures can be referred to the general design.

[0139] (2) Where there is no conflict, the embodiments of this disclosure and the features in the embodiments can be combined with each other to obtain new embodiments.

[0140] The above description is merely an exemplary embodiment of this disclosure and is not intended to limit the scope of protection of this disclosure, which is determined by the appended claims.

Claims

1. A method for optical port communication, the method being implemented at a network device and comprising: Configure the first optical port of the network device to a first working mode, so that the first optical port negotiates with the second optical port of the peer network device in the first working mode. Based on the negotiation status information of the physical layer of the network device, it is detected whether the negotiation was successful; as well as Based on the detection result of whether the negotiation was successful, it is determined whether to switch the first optical port from the first working mode to the second working mode.

2. The method of claim 1, wherein, Based on the detection result of whether the negotiation was successful, determine whether to switch the first optical port from the first working mode to the second working mode, including: In response to the failure of the negotiation, the first optical port is switched from the first working mode to the second working mode.

3. The method of claim 1, wherein, Based on the physical layer negotiation status information of the network device, detect whether the negotiation was successful, including: Access the negotiation status register of the physical layer chip, the negotiation status register being used to store the negotiation status information; and The success of the negotiation is determined based on the negotiation status information.

4. The method according to claim 1, wherein, Based on the physical layer negotiation status information of the network device, detect whether the negotiation was successful, including: Based on the negotiation status information, detect whether the negotiation was successful; and In response to the detection that the negotiation was unsuccessful, the negotiation is checked again after a predetermined time to determine whether the negotiation was successful, and the success of the negotiation is determined based on the result of the second check.

5. The method according to claim 4, wherein, The predetermined time is determined based on the time taken for the negotiation.

6. The method according to claim 1, further comprising: Detect whether the first optical port changes from a disconnected state to a connected state; as well as In response to the first optical port changing from a disconnected state to a connected state, the negotiation status information of the physical layer of the network device is accessed to detect whether the negotiation is successful.

7. The method according to claim 6, wherein, Detecting whether the first optical port changes from a disconnected state to a connected state includes: Detect whether the signals on the communication bus of the physical layer chip of the physical layer have changed; In response to a change in the signal, the link status of the first optical port is recorded; and Based on the recorded link status, determine whether the first optical port has changed from the link disconnected state to the link connected state.

8. The method according to claim 7, wherein, Detecting whether the signals on the communication bus of the physical layer chip have changed includes: The signal is detected at predetermined time intervals to determine whether it has changed.

9. The method according to claim 1, wherein, The first working mode is the automatic negotiation mode, and the second working mode is the forced mode.

10. The method according to claim 1, wherein, Based on the physical layer negotiation status information of the network device, detect whether the negotiation was successful, including: The negotiation is checked at predetermined time intervals based on the negotiation status information to determine whether the negotiation was successful.

11. The method according to claim 1, wherein, The method is implemented by the processor of the network device executing software instructions in the memory.

12. The method according to claim 1, wherein, The network device also includes at least one other optical port, and the network device is connected to the optical ports of the peer network device and / or other peer network devices through the at least one other optical port.

13. A network device, comprising: At least one processor; as well as Memory; wherein, The memory stores computer-readable instructions and is communicatively connected to the at least one processor; The at least one processor is configured to execute the computer-readable instructions stored in the memory to implement the method according to any one of claims 1-12.

14. The network device according to claim 13, wherein, The network device is a switch.

15. A computer program product having instructions stored thereon that, when executed by a processor, cause the method according to any one of claims 1-12 to be performed.