Port configuration detection method and device, network equipment and storage medium
By detecting the status register value and auto-negotiation capability of the network device port, the problem of conflict between the auto-negotiation mode and the forced mode is solved, abnormal detection and real-time alarm of the port configuration are realized, and the working performance of the network device is improved.
Patent Information
- Application Number
- CN202411105553.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-13
- Publication Date
- 2024-10-15
AI Technical Summary
In a network environment, it is impossible to effectively detect and avoid situations where one port is configured in auto-negotiation mode and the other port is configured in forced mode, resulting in conflicts and packet errors, which affect the performance of network equipment.
By detecting the status register value of the local port, it determines its open status and working mode, and checks the auto-negotiation capability of the peer port. If it is found that the auto-negotiation capability is not available, an alarm message is issued to realize anomaly detection and real-time alarms in port configuration.
It improves the accuracy of port configuration, avoids affecting the working performance of network equipment, and ensures the compatibility and stability of communication links.
Smart Images

Figure CN118784479A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network communications, and in particular to a port configuration detection method, device, network equipment and storage medium. Background Art
[0002] The auto-negotiation function allows a network device to convey the information of the working mode it supports to the other end device of the network link, and receive the corresponding information that may be transmitted by the other end device. For devices with both ends in auto-negotiation working mode, if one end works in full-duplex mode and the other end works in half-duplex mode, it is easy to cause conflicts and wrong packets, which will affect the working performance of the network device. Therefore, in the network environment, it is necessary to avoid configuring the port configuration of the two connected ports in auto-negotiation mode on one side and mandatory mode on the other side.
[0003] However, in actual networking, the specific configuration of the peer device is often unknown. When the local port is configured in auto-negotiation mode and the peer port is configured in mandatory mode, the two ports can still establish communication normally, and it is difficult to detect the abnormal configuration of the two port configurations based on the communication situation. Therefore, how to implement abnormal detection when one port is configured in auto-negotiation mode and the other port is configured in mandatory mode is an urgent problem to be solved. Summary of the invention
[0004] In view of this, in order to solve the problems existing in the prior art, the embodiments of the present application provide a port configuration detection method, apparatus, network device and storage medium.
[0005] In a first aspect, the present application provides a port configuration detection method, comprising:
[0006] Check whether the local port is currently open and working in auto-negotiation mode;
[0007] If it is determined that the local port is currently in an open state and operates in an auto-negotiation mode, detecting whether the current operating mode of the local port is a half-duplex mode;
[0008] If it is determined that the current working mode of the local port is the half-duplex mode, detecting whether the opposite port communicating with the local port has a self-negotiation capability;
[0009] If it is determined that the opposite port does not have the auto-negotiation capability, an alarm message is issued.
[0010] In an optional implementation manner, the detecting whether the local port is currently in an open state and working in an auto-negotiation mode includes:
[0011] Obtain the value of the first target state bit in the status register of the local port, and if the first target state bit is 1, determine that the current connection state of the local port is an open state; if the first target state bit is 0, determine that the current connection state of the local port is a closed state;
[0012] Obtain the value of the second target state bit in the status register of the local port. If the second target state bit is 1, determine that the local port is currently operating in auto-negotiation mode; if the second target state bit is 0, determine that the local port is currently operating in non-auto-negotiation mode.
[0013] In an optional implementation manner, before detecting whether the local port is currently in an open state and working in the auto-negotiation mode, the method further includes:
[0014] Establishing a communication link between the local port and the opposite port through a parallel detection mechanism, and setting the self-negotiation completion position of the status register of the physical layer chip in the local port to 1;
[0015] The signal type transmitted on the communication link is detected to set the rate capability position corresponding to the self-negotiation capability notification register of the physical layer chip in the opposite port to 1; different signal types correspond to different rate capabilities.
[0016] In an optional implementation manner, detecting whether the current working mode of the local port is a half-duplex mode includes:
[0017] Obtain the value of the third target state bit in the status register of the local port. If the third target state bit is 0, it is determined that the local port is currently operating in half-duplex mode. If the third target state bit is 1, it is determined that the local port is currently operating in non-half-duplex mode.
[0018] In an optional implementation manner, the detecting whether the peer port communicating with the local port has the auto-negotiation capability includes:
[0019] Detect the value of the fourth target state bit of the auto-negotiation extension register of the physical layer chip in the local port; if the fourth target state position is 1, it is determined that the opposite port has the auto-negotiation capability and works in the auto-negotiation mode; if the fourth target state position is 0, it is determined that the opposite port does not have the auto-negotiation capability and works in the forced mode.
[0020] In an optional embodiment, it also includes:
[0021] If the local port is currently in a closed state, or the local port works in a non-auto-negotiation mode, or the local port currently works in a non-half-duplex mode, or the opposite port does not have the auto-negotiation capability, no processing is performed.
[0022] In an optional embodiment, it also includes:
[0023] The warning information is displayed via a control command line or a web page.
[0024] In a second aspect, the present application provides a port configuration detection device, comprising:
[0025] The first detection module is used to detect whether the local port is currently in an open state and works in an auto-negotiation mode;
[0026] A second detection module is used to detect whether the current working mode of the local port is half-duplex mode if it is determined that the local port is currently in an open state and works in an auto-negotiation mode;
[0027] A third detection module is used to detect whether the opposite port communicating with the local port has a self-negotiation capability if it is determined that the current working mode of the local port is the half-duplex mode;
[0028] The alarm module is used to issue an alarm message if it is determined that the opposite port does not have the auto-negotiation capability.
[0029] In a third aspect, the present application provides a network device, comprising a memory and at least one processor, wherein the memory stores a computer program, and the processor is used to execute the computer program to implement the aforementioned port configuration detection method.
[0030] In a fourth aspect, the present application provides a computer storage medium storing a computer program, wherein when the computer program is executed, the aforementioned port configuration detection method is implemented.
[0031] The embodiments of the present application have the following beneficial effects:
[0032] The embodiment of the present application provides a port configuration detection method, the method comprising: detecting whether the local port is currently in an open state and working in an auto-negotiation mode; if it is determined that the local port is currently in an open state and working in an auto-negotiation mode, detecting whether the current working mode of the local port is a half-duplex mode; if it is determined that the current working mode of the local port is a half-duplex mode, detecting whether the opposite port communicating with the local port has the auto-negotiation capability; if it is determined that the opposite port does not have the auto-negotiation capability, issuing an alarm message. The embodiment of the present application utilizes the auto-negotiation principle of the physical layer chip of the port, combined with the status bit value of the physical layer chip related register to detect the abnormality of the port auto-negotiation configuration in the network environment, that is, automatically detecting whether the auto-negotiation and forced modes of the two ports of the communication connection conflict, and issuing an alarm after the abnormality is found, realizing abnormal detection and real-time alarm of port configuration, improving the accuracy of port configuration, and avoiding affecting the working performance of network equipment. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the technical solution of the present application, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present application and should not be regarded as limiting the scope of protection of the present application. In each of the drawings, similar components are numbered similarly.
[0034] Figure 1 A first flow chart of the port configuration detection method in an embodiment of the present application is shown;
[0035] Figure 2 A second flow chart of the port configuration detection method in an embodiment of the present application is shown;
[0036] Figure 3 A schematic diagram of the structure of a port configuration detection device in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0037] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.
[0038] The components of the embodiments of the present application generally described and shown in the drawings herein may be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0039] Hereinafter, the terms "including", "having" and their cognates, which may be used in various embodiments of the present application, are intended only to indicate specific features, numbers, steps, operations, elements, components, or combinations of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components, or combinations of the foregoing items or adding the possibility of one or more features, numbers, steps, operations, elements, components, or combinations of the foregoing items.
[0040] Furthermore, the terms “first”, “second”, “third”, etc. are merely used for distinguishing descriptions and are not to be understood as indicating or implying relative importance.
[0041] Unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meanings as those generally understood by those skilled in the art to which the various embodiments of the present application belong. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meanings as the contextual meanings in the relevant technical field and will not be interpreted as having idealized meanings or overly formal meanings unless clearly defined in the various embodiments of the present application.
[0042] Traditional Ethernet is 10M half-duplex mode, so a series of mechanisms such as CSMA / CD are needed to ensure the stability of the communication system. With the development of technology, full-duplex mode appeared, followed by 100M and 1000M Ethernet, which greatly improved the performance of Ethernet. However, the problem that followed was: how to ensure the compatibility of the original Ethernet network with the new Ethernet.
[0043] Therefore, the auto-negotiation technology was proposed to solve this contradiction. Auto-negotiation is achieved through a signal called Fast Link Pulse (FLP for short). The two parties in the auto-negotiation exchange data through FLP. The main function of auto-negotiation is to enable the devices at both ends of the physical link to automatically select the same working parameters through mutual information. The content of auto-negotiation mainly includes parameters such as duplex mode, operating rate, and flow control. Once the negotiation is successful, the devices at both ends of the link are locked in the same duplex mode and operating rate.
[0044] Furthermore, auto-negotiation is a way to achieve the maximum possible transmission rate between two devices. It allows devices to "discuss" possible transmission rates in a way and then select the best rate acceptable to both parties. Both ends use fast link pulses (FLPs) to exchange notifications of their respective transmission capabilities. FLPs can let the other end know what the transmission capacity of the source end is; when both ends exchange FLPs, the two communication ports detect the best method shared by both parties based on the priority from high to low.
[0045] In order to ensure that the connection can be established even when the other end does not support auto-negotiation, a mechanism called Parallel Detection is introduced. When auto-negotiation is enabled on one end and disabled on the other end, the connection is established by means of the parallel detection function.
[0046] If the parallel detection mechanism detects NLP, it knows that the other party supports 10M rate; if it detects 4B / 5B coded Idle symbols, it knows that the other party supports 100M rate. However, it is impossible to obtain information about whether the other party supports full-duplex or flow control frames. Therefore, in this case, it is considered that the other party only supports half-duplex, not full-duplex, and does not support flow control frames.
[0047] When a port with auto-negotiation capability does not establish a connection, the port keeps sending FLP, which contains its own connection capability information, that is, it relies on pulse position coding to carry data, where the connection capability information includes supported rate capability, duplex capability, flow control capability, etc. This connection capability is obtained from the auto-negotiation capability register (Auto-Negotiation Advertisement Register, PHY standard register address 4).
[0048] An FLP burst contains 33 pulse positions, 17 odd-numbered pulses are clock pulses, which always exist; 16 even-numbered pulses are used to represent data: a pulse at this position represents 1, and no pulse at this position represents 0 (the corresponding set value and the meaning of the value can be set according to actual needs, and this embodiment does not limit this, and the above setting is only for example). In this way, a FPL burst can transmit 16 bits of data. The self-negotiation interaction data is transmitted through the physical line in this way.
[0049] If both ends support auto-negotiation, they will receive the other party's FLP and decode the information in the FLP to obtain the other party's connection capability.
[0050] The auto-negotiation capability value of the peer device is recorded in the auto-negotiation peer capability register (Auto-Negotiation Link Partner Ability Register, PHY standard register address 5) of the local port. At the same time, the auto-negotiation completion bit (bit 5) of the status register (PHY standard register address 1) is set to 1.
[0051] If auto-negotiation is not completed, the auto-negotiation completion bit is always 0. Then each party selects the best connection mode to establish a connection based on its own and the other party's maximum connection capabilities. For example, if both parties support both 10M and 100M, the connection rate is 100M; if both parties support both full-duplex and half-duplex, the connection is full-duplex. After the connection between the two ends is established, FLP stops sending until the link is disconnected or the auto-negotiation Restart command is received, and then FLP is sent again.
[0052] In addition, in order to ensure that the connection can be established even when the other end does not support auto-negotiation, a mechanism called Parallel Detection is introduced. Furthermore, when auto-negotiation is enabled on one end and disabled on the other end, the connection establishment is achieved by the parallel detection function.
[0053] The implementation logic of the parallel detection mechanism is that if FLP is not received on the device port with auto-negotiation capability, it detects whether there is a characteristic signal of a 10M link or a characteristic signal of a 100M link. If one end supports 10M rate but does not support auto-negotiation, a normal link pulse (NLP) is sent on the link. NLP only indicates that the port is in place and does not contain other additional information. If one end supports 100M rate but does not support auto-negotiation, 4B / 5B encoded Idle symbols are always sent on the link when there is no data.
[0054] Then, through the parallel detection mechanism, if NLP is detected, it is known that the other party supports 10M rate; if 4B / 5B encoded Idle symbols are detected, it is known that the other party supports 100M rate. However, it is impossible to obtain information about whether the other party supports full-duplex or flow control frames. Therefore, in this case, it is considered that the other party only supports half-duplex, not full-duplex, and does not support flow control frames.
[0055] Based on the above principle, when the other end does not enable the auto-negotiation mode, the party that enables the auto-negotiation mode can only negotiate to half-duplex mode.
[0056] Based on this, an embodiment of the present application provides a port configuration detection method, which utilizes the self-negotiation principle of the physical layer chip of the port and combines the status bit values of the relevant registers of the physical layer chip to detect abnormal port self-negotiation configuration in the network environment, that is, automatically detecting whether the self-negotiation and forced modes of the two ports of the communication connection conflict, and issuing an alarm after the abnormality is found, thereby realizing abnormal detection and real-time alarm of port configuration, improving the accuracy of port configuration, and avoiding affecting the working performance of network equipment.
[0057] For example, please refer to Figure 1 , the port configuration detection method is described in detail below.
[0058] S10, detecting whether the local port is currently in an open state and working in an auto-negotiation mode.
[0059] In this embodiment, whether the local port is currently in an open state (ie, link up state) and whether it is working in the auto-negotiation mode is detected by acquiring the value of the corresponding status bit in the corresponding register of the local port.
[0060] Specifically, the value of the first target state bit in the status register of the physical layer chip (i.e., PHY chip) of the local port is obtained. If the first target state bit is 1, it is determined that the current connection state of the local port is in the open state; if the first target state bit is 0, it is determined that the current connection state of the local port is in the closed state.
[0061] Further, the value of the second target state bit in the status register of the local port is obtained. If the second target state bit is 1, it is determined that the local port is currently operating in the auto-negotiation mode; if the second target state bit is 0, it is determined that the local port is currently operating in the non-auto-negotiation mode.
[0062] It should be noted that, in this embodiment, the first target state position can be set to 1 or 0, indicating that the current connection state of the local port is open; in addition, the second target state position can be set to 0 or 1 to determine that the local port is currently working in auto-negotiation mode; that is, this embodiment can set the value of the status position bit (such as 0 or 1) and the corresponding meaning according to actual needs, and this embodiment does not limit this.
[0063] In one implementation, before detecting whether the local port is currently in an open state and working in an auto-negotiation mode, this embodiment can also establish a communication link between the local port and the peer port through a parallel detection mechanism, and set the auto-negotiation completion position of the status register of the physical layer chip in the local port to 1; detect the type of signal transmitted on the communication link to set the rate capability position corresponding to the auto-negotiation capability notification register of the physical layer chip in the peer port to 1; wherein different signal types correspond to different rate capabilities.
[0064] It should be noted that, referring to Table 1 below, according to the 802.3 communication protocol, after establishing a communication connection between the local device and the peer device through parallel detection, this embodiment sets the self-negotiation completion position of the self-negotiation capability registers at both ends to 1, that is, sets the self-negotiation completion bit (bit5) of the PHY status register (PHY standard register address 1) to 1, wherein the current link does not use true self-negotiation operation. At the same time, it is stipulated that when the self-negotiation completion bit is 1, the local port's self-negotiation capability register (PHY standard register address 4) and the peer's self-negotiation capability register (PHY standard register address 5) are meaningful, thereby updating the set value of the standard register address 5.
[0065]
[0066] Table 1
[0067] In addition, if the transmission rate corresponding to the communication link established between the local port and the peer port is 10M, the 10M capability bit (bit5) of the capability notification register 5 of the peer PHY automatic negotiation is set to 1, and the other bits are set to 0, indicating that the peer can only support a 10M half-duplex rate; if the transmission rate corresponding to the communication link established between the local port and the peer port is 100M, the 100M capability bit (bit7) of the capability notification register 5 of the peer PHY automatic negotiation is set to 1, and the other bits are set to 0, indicating that the peer can only support a 100M half-duplex rate.
[0068] Subsequently, the working status detection of the local port, the self-negotiation capability detection of the opposite port, and the parameter detection such as the transmission rate can all be determined according to the value of the corresponding status bit of the corresponding register.
[0069] S20: If it is determined that the local port is currently in an open state and works in an auto-negotiation mode, detect whether the current working mode of the local port is a half-duplex mode.
[0070] If it is determined that the local port is currently in the auto-negotiation mode, it is further detected whether the local port is currently in the half-duplex mode, that is, it is detected whether the local port is currently negotiated to the half-duplex mode through the auto-negotiation principle.
[0071] In one embodiment, the process of detecting whether the current working mode of the local port is half-duplex mode in this embodiment is specifically to obtain the value of the third target state bit in the status register of the local port. If the third target state position is 0, it is determined that the local port is currently working in half-duplex mode. If the third target state position is 1, it is determined that the local port is currently working in non-half-duplex mode.
[0072] It can be understood that this embodiment determines the current working mode through the value of the corresponding status bit of the status register of the local port, wherein, in the specific determination process, when the third target state position is set to 1, it indicates that the current working mode of the local port is half-duplex mode; or, when the third target state position is set to 0, it indicates that the current working mode of the local port is half-duplex mode; that is, this embodiment can set the value of the status position bit and the corresponding meaning according to actual needs, and this embodiment does not limit this.
[0073] S30: If it is determined that the current working mode of the local port is the half-duplex mode, then detecting whether the opposite port communicating with the local port has a self-negotiation capability.
[0074] If it is determined that the current working mode of the local port is half-duplex mode, the peer port is further detected to see whether it has auto-negotiation capability, that is, to determine whether one of the two ports works in auto-negotiation mode and the other works in non-auto-negotiation mode (i.e., forced mode).
[0075] In some examples, if it is necessary to detect whether the peer port communicating with the local port has the auto-negotiation capability, the working mode of the peer port recorded in the corresponding register of the local port can be used to determine whether the peer port has the auto-negotiation capability.
[0076] Specifically, the value of the fourth target state bit of the auto-negotiation extension register of the physical layer chip in the local port is detected; if the fourth target state bit is 1, it is determined that the opposite port has the auto-negotiation capability and works in the auto-negotiation mode; if the fourth target state bit is 0, it is determined that the opposite port does not have the auto-negotiation capability and works in the forced mode.
[0077] It should be noted that when judging whether the opposite port has the self-negotiation capability by the value of the fourth target state bit of the self-negotiation extension register, the fourth target state bit can be set to 1, indicating that the opposite port has the self-negotiation capability; or, the fourth target state bit can be set to 0, indicating that the opposite port has the self-negotiation capability; it can be understood that this embodiment can set the value of the status position bit and the corresponding meaning according to actual needs, and this embodiment does not limit this.
[0078] S40: If it is determined that the opposite port does not have the auto-negotiation capability, an alarm message is issued.
[0079] In this embodiment, if it is determined that the peer port itself does not have the self-negotiation capability, an alarm message is issued, wherein the manner of displaying the alarm message may be one or more, and the specific manner is not limited here, for example, in this embodiment, the alarm message may be displayed through a control command line or a web page (i.e., a web) or a simple network management protocol (i.e., an SNMP protocol), etc. In addition, if it is determined that the peer port does not have the self-negotiation capability, no processing is performed.
[0080] It can be understood that if the local port is currently in auto-negotiation mode and the working mode is half-duplex mode, and the opposite port currently does not have auto-negotiation capability, that is, the current working mode of the opposite port is forced mode, it means that the current working modes of the two end ports conflict, and then an alarm message is output to provide an abnormal prompt.
[0081] like Figure 2 As shown, in this embodiment, it also specifically includes: S50, if the local port is currently in a closed state, or the local port works in a non-auto-negotiation mode, or the local port currently works in a non-half-duplex mode, or the opposite port does not have the auto-negotiation capability, no processing is performed.
[0082] It can be understood that this embodiment uses the self-negotiation principle of the port and the status bits of the relevant registers to detect the port configuration conflict anomaly problem in which one end is configured as self-negotiation and the other end is configured as forced in the network environment, thereby preventing the port in the self-negotiation mode from connecting to the port in the non-self-negotiation mode, and alarming the detected conflict anomaly of the working modes of the two ports, thereby improving the security of port communication and avoiding affecting the working performance of the network equipment.
[0083] Please refer to Figure 3 The present application provides a port configuration detection device, which specifically includes:
[0084] The first detection module 110 is used to detect whether the local port is currently in an open state and works in an auto-negotiation mode;
[0085] The second detection module 120 is used to detect whether the current working mode of the local port is half-duplex mode if it is determined that the local port is currently in an open state and works in an auto-negotiation mode;
[0086] The third detection module 130 is used to detect whether the opposite port communicating with the local port has the auto-negotiation capability if it is determined that the current working mode of the local port is the half-duplex mode;
[0087] The alarm module 140 is configured to issue an alarm message if it is determined that the opposite port does not have the auto-negotiation capability.
[0088] It can be understood that the port configuration detection device of this embodiment corresponds to the port configuration detection method of the above embodiment, and the options in the above embodiment are also applicable to this embodiment, so they will not be described repeatedly here.
[0089] The embodiments of the present application also provide a network device (i.e., a computer network device), which may be, but is not limited to, information network devices, communication network devices, and network security devices, such as switches, routers, firewalls, bridges, hubs, and gateways. Exemplarily, the network device includes a processor and a memory, wherein the memory stores a computer program, and the processor runs the computer program to enable the network device to execute the port configuration detection method of the present application, wherein the method includes: detecting whether the local port is currently in an open state and working in an auto-negotiation mode; if it is determined that the local port is currently in an open state and working in an auto-negotiation mode, detecting whether the current working mode of the local port is a half-duplex mode; if it is determined that the current working mode of the local port is a half-duplex mode, detecting whether the opposite port communicating with the local port has the auto-negotiation capability; if it is determined that the opposite port does not have the auto-negotiation capability, issuing an alarm message; further, the embodiment of the present application utilizes the auto-negotiation principle of the physical layer chip of the port, combined with the status bit value of the physical layer chip related register to detect the abnormality of the port auto-negotiation configuration in the network environment, that is, automatically detecting whether the auto-negotiation and forced modes of the two ports of the communication connection conflict, and issuing an alarm after the abnormality is found, thereby realizing abnormal detection and real-time alarm of the port configuration, improving the accuracy of the port configuration, and avoiding affecting the working performance of the network device.
[0090] Among them, the processor can be an integrated circuit chip with signal processing capabilities. The processor can be a general-purpose processor, including a central processing unit (CPU), a graphics processing unit (GPU), a network processor (NP), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or at least one of other programmable logic devices, discrete gates or transistor logic devices, and discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc., which can implement or execute the disclosed methods, steps and logic block diagrams in the embodiments of the present application.
[0091] The memory may be, but is not limited to, a random access memory (RAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable read-only memory (EEPROM), etc. The memory is used to store a computer program, and the processor may execute the computer program accordingly after receiving an execution instruction.
[0092] In addition, the present application also provides a computer storage medium for storing the computer program used in the above-mentioned network device, wherein, when the computer program is executed on a processor, the port configuration detection method of the above-mentioned embodiment is implemented, the method comprising: detecting whether the local port is currently in an open state and working in an auto-negotiation mode; if it is determined that the local port is currently in an open state and working in an auto-negotiation mode, detecting whether the current working mode of the local port is a half-duplex mode; if it is determined that the current working mode of the local port is a half-duplex mode, detecting whether the opposite port communicating with the local port has auto-negotiation capability; if it is determined that the opposite port does not have auto-negotiation capability, issuing an alarm message.
[0093] It can be understood that the options in the port configuration detection method of the above embodiment are also applicable to this embodiment, so they will not be described repeatedly here.
[0094] The computer storage medium may be a non-volatile storage medium or a volatile storage medium. For example, the computer storage medium may include, but is not limited to, a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0095] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and structure diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in an alternative implementation, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the structure diagram and / or the flow diagram, and the combination of boxes in the structure diagram and / or the flow diagram, can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0096] In addition, the functional modules or units in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0097] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a network device (which can be a smart phone, a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application.
[0098] The above description is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.
Claims
1. A port configuration detection method, characterized in that: include: Check whether the local port is currently open and working in auto-negotiation mode; If it is determined that the local port is currently in an open state and operates in an auto-negotiation mode, detecting whether the current operating mode of the local port is a half-duplex mode; If it is determined that the current working mode of the local port is the half-duplex mode, detecting whether the opposite port communicating with the local port has a self-negotiation capability; If it is determined that the opposite port does not have the auto-negotiation capability, an alarm message is issued.
2. The port configuration detection method according to claim 1, characterized in that: The detecting whether the local port is currently in an open state and working in an auto-negotiation mode includes: Obtain the value of the first target state bit in the status register of the local port, and if the first target state bit is 1, determine that the current connection state of the local port is an open state; if the first target state bit is 0, determine that the current connection state of the local port is a closed state; Obtain the value of the second target state bit in the status register of the local port. If the second target state bit is 1, determine that the local port is currently operating in auto-negotiation mode; if the second target state bit is 0, determine that the local port is currently operating in non-auto-negotiation mode.
3. The port configuration detection method according to claim 2, characterized in that: Before detecting whether the local port is currently in an open state and working in the auto-negotiation mode, the method further includes: Establishing a communication link between the local port and the opposite port through a parallel detection mechanism, and setting the self-negotiation completion position of the status register of the physical layer chip in the local port to 1; The signal type transmitted on the communication link is detected to set the rate capability position corresponding to the self-negotiation capability notification register of the physical layer chip in the opposite port to 1; different signal types correspond to different rate capabilities.
4. The port configuration detection method according to claim 1, characterized in that: The detecting whether the current working mode of the local port is the half-duplex mode comprises: Obtain the value of the third target state bit in the status register of the local port. If the third target state bit is 0, it is determined that the local port is currently operating in half-duplex mode. If the third target state bit is 1, it is determined that the local port is currently operating in non-half-duplex mode.
5. The port configuration detection method according to claim 1, characterized in that: The detecting whether the opposite port communicating with the local port has the auto-negotiation capability includes: Detect the value of the fourth target state bit of the auto-negotiation extension register of the physical layer chip in the local port; if the fourth target state position is 1, it is determined that the opposite port has the auto-negotiation capability and works in the auto-negotiation mode; if the fourth target state position is 0, it is determined that the opposite port does not have the auto-negotiation capability and works in the forced mode.
6. The port configuration detection method according to claim 1, characterized in that: Also includes: If the local port is currently in a closed state, or the local port works in a non-auto-negotiation mode, or the local port currently works in a non-half-duplex mode, or the opposite port does not have the auto-negotiation capability, no processing is performed.
7. The port configuration detection method according to claim 1, characterized in that: Also includes: The warning information is displayed via a control command line or a web page.
8. A port configuration detection device, characterized in that: include: The first detection module is used to detect whether the local port is currently in an open state and works in an auto-negotiation mode; A second detection module is used to detect whether the current working mode of the local port is half-duplex mode if it is determined that the local port is currently in an open state and works in an auto-negotiation mode; A third detection module is used to detect whether the opposite port communicating with the local port has a self-negotiation capability if it is determined that the current working mode of the local port is the half-duplex mode; The alarm module is used to issue an alarm message if it is determined that the opposite port does not have the auto-negotiation capability.
9. A network device, characterized in that: The method comprises a memory and at least one processor, wherein the memory stores a computer program, and the processor is used to execute the computer program to implement the port configuration detection method according to any one of claims 1 to 7.
10. A computer storage medium, characterized in that: The device stores a computer program, which, when executed, implements the port configuration detection method according to any one of claims 1 to 7.
