Communication device exception processing method and apparatus, communication device, and storage medium

By detecting comma numbers in the communication device and using a statistical register to count, the state transition of the synchronous state machine is improved, which solves the problem of communication device freezing due to mismatched comma numbers and ensures normal operation of the device.

CN117596177BActive Publication Date: 2026-07-03SUZHOU CENTEC COMM CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SUZHOU CENTEC COMM CO LTD
Filing Date
2023-10-17
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

Existing synchronous state machines are prone to failing to transition out of the current state in communication devices due to mismatched commas, causing the communication devices to freeze.

Method used

When a communication device establishes a connection with the peer device, it detects the comma number entering the matching state in the asynchronous state and uses a statistical register to count the received data code groups. When the statistical value reaches the threshold, it jumps to the asynchronous state to redefine the boundary and improve the state transition conditions of the synchronous state machine.

Benefits of technology

This effectively prevents communication equipment from freezing due to mismatched commas, ensuring the normal operation of the communication equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117596177B_ABST
    Figure CN117596177B_ABST
Patent Text Reader

Abstract

This invention relates to the field of communication technology, providing a method, apparatus, communication device, and storage medium for handling communication device anomalies. When the synchronization state machine is in an asynchronous state, if the communication device meets preset conditions and detects that the received code group contains commas used to indicate data boundaries, it is controlled to enter a first matching state. If the synchronization state machine is in the first matching state and the received code group is detected to be a data code group, it is controlled to enter a first pre-synchronization state, and a first statistical value is obtained by counting multiple consecutive received data code groups through a statistical register. When the first statistical value reaches a preset threshold, it is determined that the communication device has an anomaly risk, and the synchronization state machine is controlled to jump to the asynchronous state to re-define the data. By adding new state transition conditions to the synchronization state machine to improve it, the anomaly situation such as communication device freezing is effectively prevented.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of communication technology, and more specifically, to a method, apparatus, communication device, and storage medium for handling communication device anomalies. Background Technology

[0002] In Ethernet communication devices such as switches, the PCS (Physical Coding Sublayers) of its 1G port uses a synchronization state machine to synchronize the bit stream transmitted by the PMA (Physical Medium Attachment), that is, to detect whether the code group contains a comma that indicates the data boundary.

[0003] A code-group is a proprietary information format for data transmission within a PCS. The PCS uses 8b / 10b encoding to encode the 8-bit data stream from the upper layer into a 10-bit code-group. Comma is a special 7-bit data format, either 7b0011111 or 7b1100000, which can be understood as an identifier for a data group. Therefore, correctly detecting a code-group containing Comma means finding the correct boundary of the PCS's data transmission, a prerequisite for correct decoding of the code-group. However, existing synchronous state machines can fail to transition out of the current state due to a mismatch with Comma, causing the communication device to freeze. Summary of the Invention

[0004] In view of this, the purpose of the present invention is to provide a method, apparatus, communication device and storage medium for handling abnormalities in communication devices.

[0005] To achieve the above objectives, the technical solution adopted by the present invention is as follows:

[0006] In a first aspect, the present invention provides a method for handling anomalies in a communication device, applied to a communication device, the method comprising:

[0007] During the process of establishing a communication connection between the communication device and the peer device, when the synchronization state machine is in an asynchronous state, if the communication device meets a preset condition and detects that the received code group contains a comma used to indicate the data boundary, it controls the synchronization state machine to enter the first matching state; wherein, the preset condition is that there is a transmission signal on the communication link between the communication device and the peer device or the loopback interface of the communication device is enabled.

[0008] When the synchronization state machine is in the first matching state, when the received code group is detected to be a data code group, the synchronization state machine is controlled to enter the first pre-synchronization state, and the first statistical value is obtained by counting the received consecutive data code groups through the statistical register.

[0009] When the first statistical value reaches a preset threshold, it is determined that the communication device has an abnormal risk, and the synchronization state machine is controlled to jump to the asynchronous state to re-define the data.

[0010] In an optional implementation, the communication device anomaly handling method further includes:

[0011] When the first statistical value does not reach the preset threshold and the received code group contains the comma, the synchronization state machine is controlled to enter the second matching state and the value in the statistical register is cleared to zero.

[0012] When the synchronization state machine is in the second matching state, when the received code group is detected to be a data code group, the synchronization state machine is controlled to enter the second pre-synchronization state, and the second statistical value is obtained by counting the received consecutive data code groups through the statistical register.

[0013] When the second statistical value reaches a preset threshold, it is determined that the communication device has an abnormal risk, and the synchronization state machine is controlled to jump to the asynchronous state to re-define the data.

[0014] In an optional implementation, the communication device anomaly handling method further includes:

[0015] When the second statistical value does not reach the preset threshold and the received code group contains the comma, the synchronization state machine is controlled to enter the third matching state and the value in the statistical register is cleared to zero.

[0016] When the synchronization state machine is in the third matching state, if the received code group is detected to be a data code group, the synchronization state machine is controlled to enter the synchronization state to perform data synchronization.

[0017] In an optional implementation, the communication device anomaly handling method further includes:

[0018] When the synchronization state machine is in the first matching state or the second matching state, if the received code group is detected to be a non-data code group, the synchronization state machine is controlled to jump to the asynchronous state to re-delimit the data.

[0019] In an optional implementation, the communication device anomaly handling method further includes:

[0020] When the synchronization state machine is in the first pre-synchronization state or the second pre-synchronization state, if an illegal code group is detected, the value in the statistics register is cleared and the synchronization state machine is controlled to jump to the asynchronous state to re-delimit the data.

[0021] In an optional implementation, the communication device anomaly handling method further includes:

[0022] During the process of establishing a communication connection between the communication device and the peer device, the current information transmission status of the PCS of the communication device is obtained;

[0023] When the current information transmission state is either a first preset state or a second preset state, and the received code group is detected to be a data code group, a target statistical value is obtained by counting multiple consecutive received data code groups through a statistical register; wherein, the first preset state indicates that auto-negotiation related information is being transmitted; and the second preset state indicates that blank information without service meaning is being transmitted.

[0024] When the target statistical value reaches a preset threshold, the abnormal information is recorded through the status register so that the developers can determine the cause of the abnormality of the communication device based on the abnormal information.

[0025] In an optional implementation, the communication device anomaly handling method further includes:

[0026] When the current information transmission state is either the first preset state or the second preset state, if the received code group is detected to be a non-data code group, the value in the statistics register will be cleared to zero.

[0027] In a second aspect, the present invention provides a communication equipment anomaly handling device, applied to a communication equipment, the communication equipment anomaly handling device comprising:

[0028] The first control module is used to control the synchronization state machine to enter a first matching state when the communication device meets a preset condition and detects that the received code group contains a comma used to indicate data boundaries during the process of establishing a communication connection between the communication device and the peer device, and the synchronization state machine is in an asynchronous state; wherein the preset condition is that there is a transmission signal on the communication link between the communication device and the peer device or the loopback interface of the communication device is enabled.

[0029] The second control module is used to control the synchronization state machine to enter the first pre-synchronization state when the received code group is detected to be a data code group when the synchronization state machine is in the first matching state, and to obtain a first statistical value by counting the received consecutive data code groups through the statistical register.

[0030] When the first statistical value reaches a preset threshold, it is determined that the communication device has an abnormal risk, and the synchronization state machine is controlled to jump to the asynchronous state to re-define the data.

[0031] Thirdly, the present invention provides a communication device, including a processor and a memory, wherein the memory stores a computer program, and when the processor executes the computer program, it implements the communication device abnormality handling method described in any of the foregoing embodiments.

[0032] Fourthly, the present invention provides a storage medium storing a computer program, which, when executed by a processor, implements the communication device abnormality handling method described in any of the foregoing embodiments.

[0033] The present invention provides a communication device anomaly handling method, apparatus, communication device, and storage medium. During the establishment of a communication connection between the communication device and the peer device, when the synchronization state machine is in an asynchronous state, if the communication device meets preset conditions and detects that the received code group contains commas used to indicate data boundaries, the synchronization state machine is controlled to enter a first matching state. The preset conditions are that there is a transmission signal on the communication link between the communication device and the peer device or that the loopback interface of the communication device is enabled. When the synchronization state machine is in the first matching state, if the received code group is detected to be a data code group, the synchronization state machine is controlled to enter a first pre-synchronization state, and a first statistical value is obtained by counting multiple consecutive received data code groups through a statistical register. When the first statistical value reaches a preset threshold, it is determined that the communication device has an anomaly risk, and the synchronization state machine is controlled to jump to the asynchronous state to re-define the data. By adding state transition conditions to the synchronization state machine to improve the synchronization state machine, the synchronization state machine is prevented from remaining in the pre-synchronization state, effectively preventing communication device jamming and other abnormal situations.

[0034] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0035] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0036] Figure 1 An example diagram of a synchronization state machine provided in an embodiment of the present invention is shown;

[0037] Figure 2 A block diagram of a communication device provided in an embodiment of the present invention is shown;

[0038] Figure 3 This invention provides a schematic flowchart of a communication device anomaly handling method according to an embodiment of the present invention.

[0039] Figure 4 Another example diagram of the synchronization state machine provided in an embodiment of the present invention is shown;

[0040] Figure 5 This illustration shows another flowchart of the communication device anomaly handling method provided in an embodiment of the present invention;

[0041] Figure 6 A functional block diagram of a communication equipment anomaly handling device provided in an embodiment of the present invention is shown.

[0042] Icons: 120 - Processor; 130 - Memory; 170 - Communication Interface; 310 - Judgment Module; 330 - Status Control Module; 350 - Recording Module. Detailed Implementation

[0043] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.

[0044] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.

[0045] It should be noted that relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0046] In Ethernet communication devices such as switches, the PCS (Physical Coding Sublayers) of its 1G port uses a synchronization state machine to synchronize the bit stream transmitted by the PMA (Physical Medium Attachment), that is, to detect whether the code group contains a comma that indicates the data boundary.

[0047] A code-group is a proprietary information format for data transmission within a PCS. The PCS uses 8b / 10b encoding to encode the 8-bit data stream from the upper layer into a 10-bit code-group. Comma is a special 7-bit data format, either 7b0011111 or 7b1100000, which can be understood as an identifier for a data group. Therefore, correctly detecting a code-group containing Comma means finding the correct boundary of the data transmitted by the PCS, which is a prerequisite for correct decoding of the code-group subsequently.

[0048] However, existing synchronous state machines can fail to transition out of the current state due to a mismatch with the Comma, causing the communication device to freeze. For easier understanding, the following will combine... Figure 1 The example diagram of the synchronous state machine is shown below for illustration.

[0049] like Figure 1 As shown, the synchronization state machine needs to enter the first matching state (COMMA_DETECT_1), the first pre-synchronization state (ACQUIRE_SYNC_1), the second matching state (COMMA_DETECT_2), the second pre-synchronization state (ACQUIRE_SYNC_2), and the third matching state (COMMA_DETECT_3) sequentially to transition from the asynchronous state (LOSS_OF_SYNC) to the synchronous state (SYNC_ACQUIRE_SYNC_3).

[0050] In practical applications, frequent disabling / enabling of the peer device's MAC (Media Access Control) or PRBS (Pseudo-Random Binary Sequence) can cause the local communication device's synchronization state machine to match an incorrect Comma. Using this Comma as the boundary of the code-group, the synchronization state machine will enter the first matching state, namely the COMMA_DETECT_1 state. At this point, it checks whether the next code-group is a data code group, i.e., the / D / field, to determine whether to enter the first pre-synchronization state, i.e., the ACQUIRE_SYNC_1 state.

[0051] Because a mismatch to a Comma might shift the true boundary of normal data sent from the peer device by one or more bits, this could result in the data following the mismatched Comma-containing code-group being recombined and all containing valid / D / fields.

[0052] According to the protocol, after the synchronization state machine enters the first pre-synchronization state, ACQUIRE_SYNC_1, it will only exit this state if it detects a code-group containing Comma or an invalid code-group. Therefore, if valid / D / fields are continuously received, the synchronization state machine will remain in the first pre-synchronization state, ACQUIRE_SYNC_1, causing the communication device to freeze.

[0053] Similarly, this situation could also occur in the second pre-synchronization state, namely the ACQUIRE_SYNC_2 state. Although the probability of mismatching a Comma and then immediately mismatching a valid / D / field and another Comma is extremely low, the fact that the synchronization state machine remains in the second pre-synchronization state, namely the ACQUIRE_SYNC_2 state, is also a potential risk that could cause the communication device to freeze.

[0054] To make it easier to understand, the following example will illustrate the process of a communication device freezing due to a mismatch with Comma.

[0055] It should be noted that code-groups are divided into data code-groups (D code-groups) and special code-groups (K code-groups). A D code-group can be represented as / Dx.y / , where x takes values ​​from 0 to 31 and y takes values ​​from 0 to 7, resulting in 256 possible data code-groups, corresponding to all values ​​in the 8-bit uncoded array; determining the x and y values ​​uniquely identifies the D code-group. A K code-group can be represented as / Kx.y / ; / Kx.y / has fewer possible values, only 12.

[0056] For example, during the link-up phase, i.e., the process of establishing a communication connection between the peer device and the local device, the peer device enables auto-negotiation after repeatedly disabling / enabling the port. The peer device cyclically sends the / C1 / and / C2 / fields to the local device. Each / C / field contains a / K28.5 / , a / Dx.y / , and a Config_Reg. The Config_Reg consists of two / D / fields, carrying the auto-negotiation information transmitted from the peer device to the local device. The value of the bit controlling LocalPause Ability in Config_Reg is changed from the default value of 3 to 1. Therefore, the peer device will repeatedly send the following data:

[0057] / K28.5 / / D12.5 / / D0.0 / / D16.4 / / K28.5 / / D2.2 / / D0.0 / / D16.4 / , until the local device completes the response, i.e., acknowledge.

[0058] Based on the above, assuming that the disable / enable operation before sending the / C1 / / C2 / fields causes the local device to mismatch the Comma, the code-group delimiter will be shifted 4 bits further back than the actual boundary. That is, the last 6 bits of the original / K28.5 / (6b000101) and the first 4 bits of / D12.5 / (4b1010) will be recombined into a new 10-bit code-group, / D23.5 / , and so on. Then the subsequent data would become:

[0059] / D23.5 / / D21.1 / / D11.6 / / D19.3 / / D23.0 / / D9.1 / / D11.6 / / D19.3 / ......and so on.

[0060] As can be seen, because the synchronization state machine mistakenly matches a code-group containing Comma, the subsequently received data consists of an infinite number of repeated / D / fields. Consequently, the synchronization state machine remains stuck in the current state, causing the communication device to freeze. Therefore, this embodiment of the invention provides a communication device anomaly handling method to solve the above problem.

[0061] Please see Figure 2 This is a block diagram of a communication device provided in an embodiment of the present invention. The communication device includes a processor 120, a memory 130, and a communication interface 170.

[0062] The processor 120, memory 130, and communication interface 170 are electrically connected to each other directly or indirectly to enable data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.

[0063] The processor 120 can be an integrated circuit chip with signal processing capabilities. It can be a general-purpose processor, such as a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), an off-the-shelf programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0064] The memory 130 may be 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 programmable read-only memory (EEPROM), etc.

[0065] The communication interface 170 can be used to communicate with other communication devices for signaling or data.

[0066] Understandable, Figure 2 The structure shown is only a schematic diagram of the communication device; the communication device may also include components that are larger than those shown. Figure 2 The more or fewer components shown, or having the same Figure 2 The different configurations shown. Figure 2The components shown can be implemented using hardware, software, or a combination thereof.

[0067] The following section will use the aforementioned communication device as the execution subject to describe the steps and technical effects of the various methods provided in the embodiments of the present invention.

[0068] Please see Figure 3 , Figure 3 This is a flowchart illustrating a communication device anomaly handling method provided in an embodiment of the present invention.

[0069] Step S202: During the process of establishing a communication connection between the communication device and the peer device, when the synchronization state machine is in an asynchronous state, if the communication device meets the preset conditions and detects that the received code group contains a comma used to indicate the data boundary, the synchronization state machine is controlled to enter the first matching state.

[0070] The preset conditions are that there is a transmission signal on the communication link between the communication device and the peer device or the loopback interface of the communication device is enabled.

[0071] In this embodiment, during the process of establishing a communication connection between the local communication device and the peer device, if the synchronization state machine of the local communication device is in an asynchronous state, i.e., the LOSS_OF_SYNC state, it is determined whether the local communication device meets the preset conditions, and the received code group is detected to determine whether it contains commas used to indicate data boundaries.

[0072] If the local communication device meets preset conditions, such as the presence of a transmission signal on the communication link between the local and remote devices (signal_detect = OK) or the loopback interface of the local device being enabled (mr_loopback = TRUE), and the received code group containing a comma (PUDI([ / COMMA / ]), then the synchronization state machine is controlled to move from the asynchronous state (LOSS_OF_SYNC) to the first matching state (COMMA_DETECT_1). Figure 4 The state transition shown is ①.

[0073] If the local communication device does not meet the preset conditions, such as there is no transmission signal on the communication link between the local and remote devices (signal_detect = FAIL), or the loopback interface of the local device is disabled (mr_loopback = FALSE), or the received code group does not contain a comma (PUDI(![ / COMMA / ]), then the control synchronization state machine remains in the asynchronous state (LOSS_OF_SYNC state). Figure 4 The state transition shown is ②.

[0074] Understandably, the `signal_detect` parameter indicates whether there is signal transmission on the communication link between the communication device and the peer device. The `mr_loopback` parameter indicates the status of the loopback interface of the communication device. `PUDI` is the code-group transmission function, which indicates that the signal sent from the PMA to the PCS carries a complete code-group; `PUDI([ / COMMA / ])` indicates that the signal carries a field containing the Comma. `PUDI([ / D / ])` indicates that the signal carries the / D / field.

[0075] Step S204: When the synchronization state machine is in the first matching state, when the received code group is detected to be a data code group, the synchronization state machine is controlled to enter the first pre-synchronization state, and the first statistical value is obtained by counting the received consecutive data code groups through the statistical register.

[0076] Step S206: When the first statistical value reaches the preset threshold, it is determined that there is an abnormal risk in the communication device, and the synchronous state machine is controlled to jump to the asynchronous state to re-define the data.

[0077] In this embodiment, when the synchronization state machine enters the first matching state, i.e., the COMMA_DETECT_1 state, it detects the received code group. When it detects that the received code group is a data code group, i.e., PUDI([ / D / ]), it controls the synchronization state machine to enter the first pre-synchronization state, i.e., the ACQUIRE_SYNC_1 state, from the first matching state, i.e., the COMMA_DETECT_1 state. Figure 4 The state transition shown is ③.

[0078] Understandably, in the existing technology, the synchronous state machine may remain in the first pre-synchronization state because the received code group is always the data code group, which may cause the synchronous state machine to freeze in the first pre-synchronization state.

[0079] Therefore, in this embodiment of the invention, when the synchronization state machine enters the first pre-synchronization state, a statistical register is activated to count the received consecutive data code groups to obtain a first statistical value, and the first statistical value is compared with a preset threshold to determine whether there is a risk of the communication device freezing. It is understood that the preset threshold can be set according to actual conditions, and this embodiment of the invention does not limit it, and the preset threshold can be represented by n.

[0080] When the first statistical value reaches the preset threshold (data_cnt1≥n), it indicates that a large number of data code groups may have been received due to a mismatch of commas. Therefore, it is determined that the communication device is at risk of freezing, i.e., there is an anomaly risk. The synchronization state machine is then controlled to transition from the first pre-synchronization state (ACQUIRE_SYNC_1) to the asynchronous state (LOSS_OF_SYNC). Figure 4 The state transition shown is ④. This causes the synchronous state machine to re-define the data, that is, to re-check whether the received code group contains a comma, and to clear the value in the statistics register so that the counting can be restarted later.

[0081] It can be understood that the embodiments of the present invention improve the synchronization state machine by adding state transition conditions, thereby avoiding the synchronization state machine from staying in the pre-synchronization state and effectively preventing abnormal situations such as communication equipment freezing.

[0082] As can be seen from the above steps, during the process of establishing a communication connection between the communication device and the peer device, when the synchronization state machine is in an asynchronous state, if the communication device meets the preset conditions and detects that the received code group contains commas used to indicate data boundaries, it controls the synchronization state machine to enter the first matching state. The preset conditions are that there is a transmission signal on the communication link between the communication device and the peer device or that the loopback interface of the communication device is enabled. When the synchronization state machine is in the first matching state, if the received code group is detected to be a data code group, the synchronization state machine is controlled to enter the first pre-synchronization state, and a first statistical value is obtained by counting multiple consecutive received data code groups through a statistical register. When the first statistical value reaches a preset threshold, it is determined that there is an abnormal risk in the communication device, and the synchronization state machine is controlled to jump to the asynchronous state to re-define the data. By adding state transition conditions to the synchronization state machine to improve it, the synchronization state machine is prevented from remaining in the pre-synchronization state, effectively preventing abnormal situations such as communication device freezing.

[0083] Optionally, after step S204, this embodiment of the invention provides a possible implementation.

[0084] Step S208: When the first statistical value does not reach the preset threshold and the received code group contains a comma, control the synchronization state machine to enter the second matching state and clear the value in the statistical register to zero.

[0085] In this embodiment, when the synchronization state machine is in the first pre-synchronization state, i.e., ACQUIRE_SYNC_1, if a received code group is detected to contain a comma (PUDI[ / COMMA / ]), and the total number of consecutively received data code groups counted by the statistics register (i.e., the first statistical value) does not reach the preset threshold (data_cnt1 < n), it indicates that the data received by the communication device is normal data. Therefore, the synchronization state machine is controlled to transition from the first pre-synchronization state, i.e., ACQUIRE_SYNC_1, to the second matching state, i.e., COMMA_DETECT_2. Figure 4 The state transition shown is ⑤, and the value in the statistics register is cleared to zero so that the counting can be restarted later.

[0086] Step S210: When the synchronization state machine is in the second matching state, when the received code group is detected to be a data code group, the synchronization state machine is controlled to enter the second pre-synchronization state, and the second statistical value is obtained by counting the received consecutive data code groups through the statistical register.

[0087] Step S212: When the second statistical value reaches the preset threshold, it is determined that there is an abnormal risk in the communication device, and the synchronous state machine is controlled to jump to the asynchronous state to re-define the data.

[0088] In this embodiment, when the synchronization state machine enters the second matching state, i.e., the COMMA_DETECT_2 state, it detects the received code group. When it detects that the received code group is a data code group, i.e., PUDI([ / D / ]), it controls the synchronization state machine to enter the second pre-synchronization state, i.e., the ACQUIRE_SYNC_2 state, from the second matching state, i.e., the COMMA_DETECT_2 state. Figure 4 The state transition shown is ⑥.

[0089] Following a similar principle to the synchronization state machine entering the first pre-synchronization state from the first matching state, in order to prevent the synchronization state machine from remaining in the second pre-synchronization state and causing the communication device to freeze, when the synchronization state machine enters the second pre-synchronization state, a statistical register is enabled to count the received multiple consecutive data code groups to obtain a second statistical value, and the second statistical value is compared with a preset threshold to determine whether there is a risk of the communication device freezing.

[0090] When the second statistical value reaches the preset threshold (data_cnt2≥n), it indicates that a large number of data code groups may have been received due to a mismatch of commas. Therefore, it is determined that the communication device is at risk of freezing, i.e., there is an anomaly risk. The synchronization state machine is then controlled to transition from the second pre-synchronization state (ACQUIRE_SYNC_2) to the asynchronous state (LOSS_OF_SYNC). Figure 4 The state transition shown is ⑦. This causes the synchronous state machine to re-delimit the data and clear the value in the statistics register so that it can start counting again later.

[0091] Optionally, after step S210, this embodiment of the invention provides a possible implementation.

[0092] Step S214: When the second statistical value does not reach the preset threshold and the received code group contains a comma, control the synchronization state machine to enter the third matching state and clear the value in the statistical register to zero.

[0093] In this embodiment, when the synchronization state machine is in the second pre-synchronization state, i.e., ACQUIRE_SYNC_2, and a comma (PUDI) is detected in the received code group, and the total number of consecutively received data code groups counted by the statistics register (i.e., the second statistical value) does not reach the preset threshold (data_cnt2 < n), it indicates that the data received by the communication device is normal data. Therefore, the synchronization state machine is controlled to enter the third matching state, i.e., COMMA_DETECT_3, from the second pre-synchronization state, ACQUIRE_SYNC_2. Figure 4 The state transition shown is ⑧, and the value in the statistics register is cleared to zero so that the counting can be restarted later.

[0094] Step S216: When the synchronization state machine is in the third matching state, and the received code group is detected to be a data code group, the synchronization state machine is controlled to enter the synchronization state to perform data synchronization.

[0095] In this embodiment, when the synchronization state machine enters the third matching state, i.e., the COMMA_DETECT_3 ​​state, it detects the received code group. When it detects that the received code group is a data code group, i.e., PUDI([ / D / ]), it controls the synchronization state machine to enter the synchronization state, i.e., the SYNC_ACQUIRED state, from the third matching state, i.e., the COMMA_DETECT_3 ​​state. Figure 4 The state transition shown in step 9 is used to enable the synchronization state machine to synchronize data.

[0096] Optionally, when the synchronization state machine is in the first matching state or the second matching state, the present invention also provides a possible implementation method, namely: when the synchronization state machine is in the first matching state or the second matching state, when the received code group is detected to be a non-data code group, the synchronization state machine is controlled to jump to the asynchronous state to re-delimit the data.

[0097] In this embodiment, when the synchronization state machine enters the first matching state, i.e., the COMMA_DETECT_1 state, it detects the received code group. When it detects that the received code group is a non-data code group, i.e., PUDI (![ / D / ]), it controls the synchronization state machine to jump from the first matching state, i.e., the COMMA_DETECT_1 state, to the asynchronous state, i.e., the LOSS_OF_SYNC state. Figure 4 The state transition shown in Figure 10 is to allow the synchronous state machine to re-define the data.

[0098] Similarly, when the synchronization state machine enters the second matching state, i.e., the COMMA_DETECT_2 state, it checks the received code group. When it detects that the received code group is a non-data code group, i.e., PUDI (![ / D / ]), it controls the synchronization state machine to jump from the second matching state, i.e., the COMMA_DETECT_2 state, to the asynchronous state, i.e., the LOSS_OF_SYNC state, as follows. Figure 4 The state transition shown This allows the synchronous state machine to re-define the data.

[0099] Similarly, when the synchronization state machine enters the third matching state, i.e., the COMMA_DETECT_3 ​​state, it checks the received code group. When it detects that the received code group is a non-data code group, i.e., PUDI (![ / D / ]), it controls the synchronization state machine to jump from the third matching state, i.e., the COMMA_DETECT_3 ​​state, to the asynchronous state, i.e., the LOSS_OF_SYNC state. Figure 4 The state transition shown This allows the synchronous state machine to re-define the data.

[0100] Optionally, when the synchronization state machine is in the first pre-synchronization state or the second pre-synchronization state, the present invention also provides a possible implementation method, namely: when the synchronization state machine is in the first pre-synchronization state or the second pre-synchronization state, when the received code group is detected to be an illegal code group, the value in the statistics register is cleared and the synchronization state machine is controlled to jump to the asynchronous state to redefine the data.

[0101] In this embodiment, when the synchronization state machine enters the first pre-synchronization state, i.e., the ACQUIRE_SYNC_1 state, it checks the received code group. When it detects that the received code group is an illegal code group, i.e., cgbad, it clears the value in the statistics register and controls the synchronization state machine to jump from the first pre-synchronization state, i.e., the ACQUIRE_SYNC_1 state, to the asynchronous state, i.e., the LOSS_OF_SYNC state. Figure 4The state transition shown is ④. This causes the synchronous state machine to re-delimit the data and clear the value in the statistics register to facilitate subsequent counting.

[0102] Similarly, when the synchronization state machine enters the second pre-synchronization state, namely ACQUIRE_SYNC_2, it checks the received code group. When an illegal code group (cgbad) is detected, the value in the statistics register is cleared, and the machine transitions from the second pre-synchronization state (ACQUIRE_SYNC_2) to the asynchronous state (LOSS_OF_SYNC). Figure 4 The state transition shown is ⑦. This causes the synchronous state machine to re-delimit the data and clear the value in the statistics register so that it can start counting again later.

[0103] An illegal code group (cgbad) can be understood as a non-standard code group, such as an invalid code group or a code group containing a comma that is not in an even number of positions.

[0104] Furthermore, the `rx_even` parameter, set by the PCS synchronization process, can be used to specify whether a valid code group (i.e., a code-group conforming to the specification) is in an even-numbered position or an odd-numbered position. Generally, a code-group containing a Comma must be in an even-numbered position. That is, `rx_even = TRUE` indicates a code-group containing a Comma in an even-numbered position; `rx_even = FALSE` indicates a code-group containing a Comma that is not in an even-numbered position.

[0105] The above implementation can be understood as follows: since the Ethernet port is designed based on the IEEE protocol, and the synchronization state machine in this protocol does not take into account some special cases that may cause communication equipment to malfunction, the above implementation improves the synchronization state machine without violating the protocol. That is, when constructing the RTL (Register Transfer Level) of the synchronization state machine, a new condition is added for jumping out of the pre-synchronization state. That is, a statistical register is used to count the received consecutive data code groups, and when the statistical value reaches a preset threshold, it is considered an abnormal situation. Then, the synchronization state machine is controlled to jump from the pre-synchronization state to the asynchronous state to redefine the received data.

[0106] Alternatively, in addition to the above-described method of improving the synchronization state machine, this embodiment of the invention also provides another implementation method, please refer to [link to relevant documentation]. Figure 5 , Figure 5 This is another flowchart illustrating the communication device anomaly handling method provided in this embodiment of the invention.

[0107] Step S222: During the process of establishing a communication connection between the communication device and the peer device, obtain the current information transmission status of the PCS of the communication device;

[0108] Step S224: When the current information transmission state is the first preset state or the second preset state, when the received code group is detected to be a data code group, the target statistical value is obtained by counting the received consecutive data code groups through the statistical register.

[0109] The first preset state indicates that auto-negotiation related information is being transmitted; the second preset state indicates that blank information with no business meaning is being transmitted.

[0110] Step S226: When the target statistical value reaches the preset threshold, the abnormal information is recorded through the status register so that the developers can determine the cause of the communication device's abnormality based on the abnormal information.

[0111] In this embodiment, during the process of establishing a communication connection between the communication device and the peer device, the current information transmission status of the PCS of the communication device can be obtained, that is, the current information transmission status of the PCS auto-negotiation process to the PCS receiving process. This current information transmission status can be represented by xmit.

[0112] When the current information transmission state is the first preset state (xmit = CONFIGURATION), it indicates that configuration information related to auto-negotiation from the PCS auto-negotiation process is being transmitted. When the current information transmission state is the second preset state (xmit = IDLE), it indicates that the / I / field (blank information without business meaning) from the PCS auto-negotiation process is being transmitted. When the current information transmission state is the third preset state (xmit = DATA), it indicates that the / I / field from the PCS and data information with business meaning are being transmitted.

[0113] It is understandable that a large number of data code groups, i.e. / D / fields, will only be transmitted in the third preset state. Therefore, if a large number of data code groups, i.e. / D / fields, are received continuously in the first and second preset states, it indicates an abnormal situation.

[0114] Therefore, in this embodiment of the invention, when the current information transmission state is a first preset state or a second preset state, the received code group is detected. When the received code group is detected to be a data code group, the statistical register is enabled to count the received multiple consecutive data code groups to obtain a target statistical value. The target statistical value is then compared with a preset threshold to determine whether there is an abnormality in the communication device.

[0115] When the target statistical value reaches a preset threshold, it indicates an anomaly in the communication device. A status register is then used to record this anomaly information, such as setting the corresponding bit value to 1. When the communication device freezes, developers can use the anomaly information recorded in the status register to troubleshoot the cause of the anomaly and perform a soft reset to re-establish communication between the local and remote devices.

[0116] Optionally, after step S222, this embodiment of the invention also provides a possible implementation method, please refer to the following: Figure 5 .

[0117] Step S228: When the current information transmission state is the first preset state or the second preset state, if the received code group is detected to be a non-data code group, the value in the statistics register is cleared to zero.

[0118] In this embodiment, when the current information transmission state is a first preset state or a second preset state, the received code group is detected. When the received code group is detected to be a non-data code group, the value in the statistics register is cleared to facilitate subsequent recounting.

[0119] To perform the corresponding steps in the above embodiments and various possible methods, an implementation of a communication device exception handling apparatus is given below. Please refer to... Figure 6 , Figure 6 This is a functional block diagram of a communication device anomaly handling apparatus provided in an embodiment of the present invention. It should be noted that the basic principle and technical effects of the communication device anomaly handling apparatus provided in this embodiment are the same as those in the above embodiments. For the sake of brevity, any parts not mentioned in this embodiment can be referred to the corresponding content in the above embodiments. The communication device anomaly handling apparatus includes:

[0120] The judgment module 310 is used to control the synchronization state machine to enter the first matching state when the communication device meets the preset conditions and detects that the received code group contains a comma used to indicate the data boundary during the process of establishing a communication connection between the communication device and the peer device, and the synchronization state machine is in the asynchronous state; wherein the preset conditions are that there is a transmission signal on the communication link between the communication device and the peer device or the loopback interface of the communication device is enabled.

[0121] The state control module 330 is used to control the synchronization state machine to enter the first pre-synchronization state when the received code group is detected to be a data code group when the synchronization state machine is in the first matching state, and to obtain the first statistical value by counting the received consecutive data code groups through the statistical register.

[0122] When the first statistical value reaches the preset threshold, it is determined that there is an abnormal risk in the communication equipment, and the synchronous state machine is controlled to jump to the asynchronous state to re-define the data.

[0123] Optionally, the state control module 330 is also used to: control the synchronization state machine to enter the second matching state and clear the value in the statistics register when the first statistical value does not reach the preset threshold and the received code group contains a comma;

[0124] When the synchronization state machine is in the second matching state, when the received code group is detected to be a data code group, the synchronization state machine is controlled to enter the second pre-synchronization state, and the second statistical value is obtained by counting the received consecutive data code groups through the statistical register.

[0125] When the second statistical value reaches the preset threshold, it is determined that there is an abnormal risk in the communication equipment, and the synchronous state machine is controlled to jump to the asynchronous state to re-define the data.

[0126] Optionally, the state control module 330 is also used to: control the synchronization state machine to enter the third matching state and clear the value in the statistics register when the second statistical value does not reach the preset threshold and the received code group contains a comma;

[0127] When the synchronization state machine is in the third matching state, if the received code group is detected to be a data code group, the synchronization state machine is controlled to enter the synchronization state to perform data synchronization.

[0128] Optionally, the state control module 330 is also used to: when the synchronous state machine is in the first matching state or the second matching state, and the received code group is detected to be a non-data code group, control the synchronous state machine to jump to the asynchronous state to re-delimit the data.

[0129] Optionally, the state control module 330 is also used to: when the synchronization state machine is in the first pre-synchronization state or the second pre-synchronization state, and the received code group is detected to be an illegal code group, clear the value in the statistics register and control the synchronization state machine to jump to the asynchronous state to re-delimit the data.

[0130] Optionally, the communication equipment anomaly handling device further includes a recording module 350, used to obtain the current information transmission status of the communication equipment's PCS during the process of establishing a communication connection between the communication equipment and the peer equipment;

[0131] When the current information transmission state is either the first preset state or the second preset state, and the received code group is detected to be a data code group, the target statistical value is obtained by counting multiple consecutive received data code groups through the statistical register; wherein, the first preset state indicates that auto-negotiation related information is being transmitted; the second preset state indicates that blank information without business meaning is being transmitted;

[0132] When the target statistical value reaches the preset threshold, the abnormal information is recorded through the status register so that the developers can determine the cause of the communication device's abnormality based on the abnormal information.

[0133] Optionally, the recording module 350 is also used to: when the current information transmission state is a first preset state or a second preset state, and the received code group is detected to be a non-data code group, clear the value in the statistics register to zero.

[0134] This invention also provides a communication device, including a processor and a memory. The memory stores a computer program, and when the processor executes the computer program, it implements the communication device exception handling method disclosed in this invention.

[0135] This invention also provides a storage medium storing a computer program, which, when executed by a processor, implements the communication device anomaly handling method disclosed in this invention.

[0136] In the several embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative; for example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of the invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0137] In addition, the functional modules in the various embodiments of the present invention can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0138] If the aforementioned functions are implemented as software functional 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 this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0139] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for handling anomalies in communication equipment, characterized in that, Applied to communication equipment, the communication equipment fault handling method includes: During the process of establishing a communication connection between the communication device and the peer device, when the synchronization state machine is in an asynchronous state, if the communication device meets a preset condition and detects that the received code group contains a comma used to indicate the data boundary, it controls the synchronization state machine to enter the first matching state; wherein, the preset condition is that there is a transmission signal on the communication link between the communication device and the peer device or the loopback interface of the communication device is enabled. When the synchronization state machine is in the first matching state, when the received code group is detected to be a data code group, the synchronization state machine is controlled to enter the first pre-synchronization state, and the first statistical value is obtained by counting the received consecutive data code groups through the statistical register. When the first statistical value reaches a preset threshold, it is determined that the communication device has an abnormal risk, and the synchronization state machine is controlled to jump to the asynchronous state to re-define the data.

2. The communication equipment anomaly handling method according to claim 1, characterized in that, The communication equipment anomaly handling method further includes: When the first statistical value does not reach the preset threshold and the received code group contains the comma, the synchronization state machine is controlled to enter the second matching state and the value in the statistical register is cleared to zero. When the synchronization state machine is in the second matching state, when the received code group is detected to be a data code group, the synchronization state machine is controlled to enter the second pre-synchronization state, and the second statistical value is obtained by counting the received consecutive data code groups through the statistical register. When the second statistical value reaches a preset threshold, it is determined that the communication device has an abnormal risk, and the synchronization state machine is controlled to jump to the asynchronous state to re-define the data.

3. The communication equipment anomaly handling method according to claim 2, characterized in that, The communication equipment anomaly handling method further includes: When the second statistical value does not reach the preset threshold and the received code group contains the comma, the synchronization state machine is controlled to enter the third matching state and the value in the statistical register is cleared to zero. When the synchronization state machine is in the third matching state, if the received code group is detected to be a data code group, the synchronization state machine is controlled to enter the synchronization state to perform data synchronization.

4. The communication equipment anomaly handling method according to claim 2, characterized in that, The communication equipment anomaly handling method further includes: When the synchronization state machine is in the first matching state or the second matching state, if the received code group is detected to be a non-data code group, the synchronization state machine is controlled to jump to the asynchronous state to re-delimit the data.

5. The communication equipment anomaly handling method according to claim 2, characterized in that, The communication equipment anomaly handling method further includes: When the synchronization state machine is in the first pre-synchronization state or the second pre-synchronization state, if an illegal code group is detected, the value in the statistics register is cleared and the synchronization state machine is controlled to jump to the asynchronous state to redefine the data.

6. The communication equipment anomaly handling method according to claim 1, characterized in that, The communication equipment anomaly handling method further includes: During the process of establishing a communication connection between the communication device and the peer device, the current information transmission status of the PCS of the communication device is obtained; When the current information transmission state is either a first preset state or a second preset state, and the received code group is detected to be a data code group, a target statistical value is obtained by counting multiple consecutive received data code groups through a statistical register; wherein, the first preset state indicates that auto-negotiation related information is being transmitted; and the second preset state indicates that blank information without service meaning is being transmitted. When the target statistical value reaches a preset threshold, the abnormal information is recorded through the status register so that the developers can determine the cause of the abnormality of the communication device based on the abnormal information.

7. The communication equipment anomaly handling method according to claim 6, characterized in that, The communication equipment anomaly handling method further includes: When the current information transmission state is either the first preset state or the second preset state, if the received code group is detected to be a non-data code group, the value in the statistics register will be cleared to zero.

8. A communication equipment anomaly handling device, characterized in that, The communication equipment fault handling device is applied to communication equipment and includes: The judgment module is used to control the synchronization state machine to enter the first matching state when the communication device meets a preset condition and detects that the received code group contains a comma used to indicate the data boundary during the process of establishing a communication connection between the communication device and the peer device, and the synchronization state machine is in an asynchronous state; wherein, the preset condition is that there is a transmission signal on the communication link between the communication device and the peer device or the loopback interface of the communication device is enabled. The state control module is used to control the synchronization state machine to enter the first pre-synchronization state when the received code group is detected to be a data code group when the synchronization state machine is in the first matching state, and to obtain a first statistical value by counting the received consecutive data code groups through the statistical register. When the first statistical value reaches a preset threshold, it is determined that the communication device has an abnormal risk, and the synchronization state machine is controlled to jump to the asynchronous state to re-define the data.

9. A communication device, characterized in that, The device includes a processor and a memory, the memory storing a computer program, and when the processor executes the computer program, it implements the communication device abnormality handling method according to any one of claims 1 to 7.

10. A storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the communication device anomaly handling method according to any one of claims 1 to 7.