Adaptive switching method, system and storage medium based on dual ethernet ports

CN121462387BActive Publication Date: 2026-08-07SHENZHEN JOYAR TECH (GRP) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHENZHEN JOYAR TECH (GRP) CO LTD
Filing Date
2025-10-28
Publication Date
2026-08-07

AI Technical Summary

Technical Problem

传统方案依赖PHY寄存器的链路通断状态作为唯一切换依据,无法识别信号强度衰减、误码率飙升等渐进性硬件劣化,致使故障响应慢,工业场景中突发性传输中断率高

Benefits of technology

[0015]This invention provides an adaptive switching method, system, and storage medium based on dual Ethernet ports. The method first verifies the physical existence of both ports and initializes the channel state via the PHY register; then, it synchronously collects physical layer, transport layer, and application layer information; if a hardware warning is triggered based on the physical layer information, the port is switched immediately; if no warning is triggered, the continuous deterioration trend of application layer indicators is analyzed, and preventative switching is initiated when deterioration conditions are met; when both the physical and application layers are normal, a quality score is generated by dynamically allocating transport indicator weights according to the real-time service type; if the primary channel score is lower than the secondary channel score, the application layer stability margin score of the secondary channel is calculated and compared with a dynamic threshold; seamless switching is performed only when the margin meets the threshold. This invention improves the accuracy of channel switching and enhances the reliability of communication in industrial scenarios through a fault-level response mechanism and service-aware dynamic weight decision-making.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121462387B_ABST
    Figure CN121462387B_ABST
Patent Text Reader

Abstract

The application provides a kind of based on dual ethernet port adaptive switching method, system and storage medium, according to first through PHY register verification dual-port physical existence and initialize channel state;Synchronous acquisition physical layer information, transport layer information and application layer information;Based on physical layer information triggers hardware early warning immediately switches port;If no early warning is triggered, then analyze the deterioration trend of application layer index continuity, when satisfying deterioration condition, start preventive switching;When physical layer and application layer are normal, according to real-time service type dynamically allocates transmission index weight to generate quality score, if main channel score is lower than auxiliary channel, then calculate auxiliary channel application layer stability margin score and compare with dynamic threshold, only when margin meets the standard, execute no-sense switching;The application improves the accuracy of channel switching and the reliability of industrial scene communication through fault classification response mechanism and service-aware dynamic weight decision.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of Ethernet communication, and more specifically, to an adaptive switching method, system, and storage medium based on dual Ethernet ports. Background Technology

[0002] In current industrial IoT and high-reliability network scenarios, dual Ethernet port redundancy has become the mainstream solution for improving communication reliability. Traditional solutions rely solely on the link connectivity status of the PHY register as the basis for switching, failing to recognize gradual hardware degradation such as signal strength attenuation and spikes in bit error rate, resulting in slow fault response and high rates of sudden transmission interruptions in industrial scenarios. Current mainstream switching technologies use fixed thresholds to judge channel quality, failing to differentiate the network performance requirements of services such as real-time audio / video and file transfer. This leads to erroneous switching in video conferencing scenarios due to instantaneous fluctuations in bandwidth utilization, and low transmission efficiency in file transfers due to the failure of high-latency channels to switch in a timely manner. Existing methods make switching decisions based solely on instantaneous quality scores, ignoring the deteriorating trends of application-layer packet loss and retransmission rates, and lacking a pre-verification mechanism for the stability of auxiliary channels. This results in secondary switching triggered by sudden traffic surges after a high-load channel takes over. Furthermore, after a hardware failure occurs, existing solutions only perform port switching operations without in-depth analysis of the PHY error details register, making it impossible to locate the root causes such as electromagnetic interference and clock synchronization issues. Maintenance personnel must manually troubleshoot the fault, resulting in high average maintenance costs.

[0003] Therefore, there is an urgent need for an adaptive switching technology based on dual Ethernet ports that can improve the accuracy of channel switching and enhance the reliability of communication in industrial scenarios. Summary of the Invention

[0004] In view of the above problems, the purpose of this invention is to provide an adaptive switching method, system, and storage medium based on dual Ethernet ports. This includes a three-level collaborative detection mechanism that uses physical layer signal strength and bit error rate to provide real-time early warning of hardware faults, combines application layer packet loss rate and retransmission rate for degradation trend analysis to achieve early fault interception, and finally completes intelligent decision-making through service-aware dynamic scoring. It also includes a dynamic weight allocation mechanism based on service type, which identifies service types such as real-time audio / video and file transfer based on protocol header parsing, dynamically assigns transmission indicator weights to different scenarios, and eliminates mismatches between service requirements and network performance. Furthermore, it uses the variance of application layer indicators in the secondary channel to calculate a stability margin score, and compares it with a dynamic threshold linked to the quality score to ensure that the switching decision simultaneously meets high quality and high stability requirements.

[0005] The first aspect of this invention provides an adaptive switching method based on dual Ethernet ports, the method comprising: When the preset PHY register verification port is present, initialize the dual-channel port; Activate the channel data stream of the dual-channel port and record physical layer information, transport layer information and application layer information; Determine whether a hardware warning exists based on the physical layer information; If so, then a port switch will be triggered; If not, then based on the application layer information, determine whether the channel is in a state of continuous deterioration; If so, then a port switch will be triggered; If not, then the transmission indicator weights will be dynamically allocated based on the current service type to generate a dual-channel quality score; In response to the main channel quality score being lower than the secondary channel quality score, a stability margin score is obtained based on the secondary channel application layer information, and a margin threshold is obtained based on the secondary channel quality score. If the stability margin score is higher than the margin threshold, then a seamless channel switch is performed.

[0006] In this solution, the initialization of the dual-channel port specifically includes: Read the PHY registers of the first Ethernet port and the second Ethernet port in parallel to verify the physical existence of the dual ports; If present, reset the status flags of the dual-channel port, including at least the link activation flag, fault flag, and historical score cache; Poll the BASIC_STATUS register on both ports to obtain the initial link status and rate negotiation mode; If no valid PHY device identifier is detected on any port, a hardware error alarm is triggered and the port is disabled.

[0007] In this solution, determining whether a hardware warning exists based on the physical layer information specifically includes: The communication signal strength is periodically read using the signal strength indicator bit in the PHY register; Analyze the error counter register and calculate the bit error rate per unit time; Monitor the link pulse signal, record the number of pulse loss events per unit time, and obtain the pulse loss rate; If the signal strength is lower than a preset signal strength threshold, or if the bit error rate or the pulse loss rate exceeds the limit continuously, a physical layer warning state is marked.

[0008] In this solution, determining whether the channel is in a state of continuous deterioration based on the application layer information specifically includes: Obtain the number of tolerance periods N for deterioration; If the packet loss rate exceeds the preset packet loss rate threshold for N consecutive sampling periods and the packet loss rate shows an increasing trend, it is determined to be a continuously deteriorating state. If the retransmission rate exceeds the preset retransmission rate threshold for N consecutive sampling periods and the retransmission rate shows an increasing trend, it is determined to be a continuously deteriorating state. If the number of session interruptions exceeds the preset interruption threshold within the preset time window, it is determined to be a continuously deteriorating state. Record the parameters of the deteriorating state and the business type, and generate a log of analysis of the causes of the deterioration.

[0009] In this solution, the step of dynamically allocating transmission indicator weights based on the current service type to generate a dual-channel quality score specifically includes: Parse the data stream protocol header fields to identify the current dominant business type, which includes at least real-time audio and video, file transfer, and industrial control. Based on the preset mapping table of service type and weight configuration, the transmission index weights are obtained, including the transmission delay coefficient, transmission jitter coefficient and bandwidth utilization coefficient. Based on the transport layer information and transport index weights, a quality score for the corresponding channel is obtained by weighted summation.

[0010] In this scheme, obtaining a stability margin score based on the secondary channel application layer information and obtaining a margin threshold based on the secondary channel quality score specifically includes: Extract application layer information from the auxiliary channel within the most recent M sampling periods; The variances of packet loss rate and retransmission rate are calculated separately as stability quantification factors. The stability coefficient is obtained by combining the signal strength with the physical layer information; The stability margin score is obtained by multiplying the stability quantification factor and the stability coefficient.

[0011] A second aspect of the present invention provides an adaptive handover system based on dual Ethernet ports, including an adaptive handover method program based on dual Ethernet ports, wherein the adaptive handover method program based on dual Ethernet ports, when executed by the processor, implements the following steps: When the preset PHY register verification port is present, initialize the dual-channel port; Activate the channel data stream of the dual-channel port and record physical layer information, transport layer information and application layer information; Determine whether a hardware warning exists based on the physical layer information; If so, then a port switch will be triggered; If not, then based on the application layer information, determine whether the channel is in a state of continuous deterioration; If so, then a port switch will be triggered; If not, then the transmission indicator weights will be dynamically allocated based on the current service type to generate a dual-channel quality score; In response to the main channel quality score being lower than the secondary channel quality score, a stability margin score is obtained based on the secondary channel application layer information, and a margin threshold is obtained based on the secondary channel quality score. If the stability margin score is higher than the margin threshold, then a seamless channel switch is performed.

[0012] In this solution, the initialization of the dual-channel port specifically includes: Read the PHY registers of the first Ethernet port and the second Ethernet port in parallel to verify the physical existence of the dual ports; If present, reset the status flags of the dual-channel port, including at least the link activation flag, fault flag, and historical score cache; Poll the BASIC_STATUS register on both ports to obtain the initial link status and rate negotiation mode; If no valid PHY device identifier is detected on any port, a hardware error alarm is triggered and the port is disabled.

[0013] In this solution, determining whether a hardware warning exists based on the physical layer information specifically includes: The communication signal strength is periodically read using the signal strength indicator bit in the PHY register; Analyze the error counter register and calculate the bit error rate per unit time; Monitor the link pulse signal, record the number of pulse loss events per unit time, and obtain the pulse loss rate; If the signal strength is lower than a preset signal strength threshold, or if the bit error rate or the pulse loss rate exceeds the limit continuously, a physical layer warning state is marked.

[0014] A third aspect of the present invention provides a computer-readable storage medium comprising an adaptive switching method program based on dual Ethernet ports, wherein when the adaptive switching method program based on dual Ethernet ports is executed by a processor, the steps of the adaptive switching method based on dual Ethernet ports as described in any of the preceding claims are implemented.

[0015] This invention provides an adaptive switching method, system, and storage medium based on dual Ethernet ports. The method first verifies the physical existence of both ports and initializes the channel state via the PHY register; then, it synchronously collects physical layer, transport layer, and application layer information; if a hardware warning is triggered based on the physical layer information, the port is switched immediately; if no warning is triggered, the continuous deterioration trend of application layer indicators is analyzed, and preventative switching is initiated when deterioration conditions are met; when both the physical and application layers are normal, a quality score is generated by dynamically allocating transport indicator weights according to the real-time service type; if the primary channel score is lower than the secondary channel score, the application layer stability margin score of the secondary channel is calculated and compared with a dynamic threshold; seamless switching is performed only when the margin meets the threshold. This invention improves the accuracy of channel switching and enhances the reliability of communication in industrial scenarios through a fault-level response mechanism and service-aware dynamic weight decision-making. Attached Figure Description

[0016] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly described 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.

[0017] Figure 1 A flowchart of an adaptive switching method based on dual Ethernet ports according to the present invention is shown; Figure 2 The diagram illustrates an initialization flowchart for a dual-channel port according to an embodiment of the present invention. Figure 3 A flowchart illustrating a method for identifying and marking hardware warnings according to an embodiment of the present invention is shown; Figure 4 A block diagram of an adaptive switching system based on dual Ethernet ports according to the present invention is shown. Detailed Implementation

[0018] 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. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0019] Unless otherwise defined, all terms (including technical and scientific terms) used in embodiments of this invention shall have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. It should also be understood that terms such as those defined in a common dictionary shall be interpreted as having a meaning consistent with their meaning in the context of the relevant art, and not as being interpreted in an idealized or highly formalized sense, unless expressly defined in this embodiment of the invention.

[0020] The terms "first," "second," and similar words used in the embodiments of this invention do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "an," "a," or "the" do not indicate a quantity limitation, but rather indicate the presence of at least one. Similarly, terms such as "including" or "comprising" mean that the element or object preceding the word encompasses the elements or objects listed after the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. The steps preceding or following the steps in the method of the embodiments of this invention are not necessarily performed precisely in sequence. Instead, various steps can be processed in reverse order or simultaneously. Furthermore, other operations can be added to these processes, or one or more steps can be removed from these processes.

[0021] 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.

[0022] A dual Ethernet port circuit, the circuit including a first Ethernet port, a second Ethernet port and an adaptive switching module; The adaptive switching module automatically switches communication channels based on the Ethernet port status.

[0023] Figure 1 A flowchart of an adaptive switching method based on dual Ethernet ports according to the present invention is shown.

[0024] like Figure 1 As shown, the first aspect of this invention discloses an adaptive switching method based on dual Ethernet ports, the method comprising: S102, in response to the preset PHY register verification port being in an existing state, initialize the dual-channel port; S104, activate the channel data stream of the dual-channel port, and record physical layer information, transport layer information and application layer information; S106, determine whether there is a hardware warning based on the physical layer information; S108, if so, then trigger port switching; S110, if not, then determine whether the channel is in a state of continuous deterioration based on the application layer information; S108, if so, then trigger port switching; S112, if not, then dynamically allocate transmission indicator weights based on the current service type and generate a dual-channel quality score; S114, In response to the main channel quality score being lower than the secondary channel quality score, a stability margin score is obtained based on the secondary channel application layer information, and a margin threshold is obtained based on the secondary channel quality score. S116, If the stability margin score is higher than the margin threshold, then perform a seamless channel switching.

[0025] It should be noted that the physical layer information includes at least signal strength and bit error rate; the transport layer information includes at least transmission delay, transmission jitter and bandwidth utilization; the application layer information includes at least packet loss rate, retransmission rate and number of session interruptions; and the seamless channel switching operation includes at least cloning the MAC address to the target port, buffering data packets to be forwarded, and updating the network topology.

[0026] In this embodiment, the physical existence of the dual ports is first verified by setting a preset flag value in the PHY register. Once both Ethernet ports are confirmed to be operational, the dual-channel port initialization process is executed, including resetting port status flags and clearing historical cache data. Subsequently, the dual-channel data flow monitoring module is activated, simultaneously collecting three key indicators: physical layer signal strength and bit error rate, transmission layer latency jitter and bandwidth utilization, and application layer packet loss rate, retransmission rate, and session interruption count. Then, based on real-time analysis of the physical layer indicators, if the signal strength is continuously below a threshold or the bit error rate continuously exceeds the tolerance range, a port switching action is immediately triggered to mitigate hardware failure risks. If there is no warning signal at the physical layer, the process transitions to the application layer degradation status judgment mechanism. By monitoring the increasing trend of the packet loss rate within a continuous sampling period and whether the session interruption frequency exceeds a threshold, it is determined whether there is service-level degradation in the channel. If service-level degradation is determined, the switching process is initiated. When there are no anomalies in the physical layer and application layer, the system identifies the dominant service type based on the current data stream protocol header characteristics, including real-time audio and video, file transfer, etc., and calls a preset weight configuration template to dynamically weight the transport layer indicators to generate a dual-channel quality score. Finally, when the primary channel score is lower than the secondary channel score, the system further calculates the stability margin score of the secondary channel based on the variance of the application layer indicators and the signal strength stability, which is then compared with the margin threshold. A seamless handover operation is performed only when the stability margin exceeds the threshold; this operation achieves zero-service-interruption channel migration by cloning the source port MAC address to the target port, establishing a data packet buffer queue, and broadcasting ARP updates. This embodiment achieves graded fault response through a three-level detection mechanism, sequentially from physical layer early warning, application layer deterioration, and dynamic scoring handover; combined with service-aware seamless handover technology, it significantly improves channel utilization efficiency while avoiding the risks of hardware failure and service interruption.

[0027] Figure 2 The diagram illustrates an initialization flowchart for a dual-channel port according to an embodiment of the present invention.

[0028] According to embodiments of the present invention, such as Figure 2 As shown, the initialization of the dual-channel port specifically includes: S202, read the PHY registers of the first Ethernet port and the second Ethernet port in parallel to verify the physical existence of the dual ports; S204, if present, reset the status flags of the dual-channel port, including at least the link activation flag, fault flag, and historical score cache; S206, poll the BASIC_STATUS register of the two ports to obtain the initial link status and rate negotiation mode; S208 If no valid PHY device identifier is detected on any port, a hardware abnormality alarm is triggered and the port is disabled.

[0029] It should be noted that, in this embodiment, the implementation process for initializing the dual-channel ports includes four core operations. First, the PHY device identifier registers of the first and second ports are accessed in parallel to verify the existence of the port's physical entity by checking the preset manufacturer code in the register. After both ports pass the existence verification, the system resets three types of status flags. These include setting the link activation flag to an unconnected state, clearing the fault flag, and clearing the historical score cache, thereby ensuring that the initial state is free from historical data interference. Second, the BASIC_STATUS registers of both ports are polled to extract the link activation status bit, rate negotiation result bit, and duplex mode bit, and the initial negotiated rate and duplex configuration are recorded. Then, if the preset unique identifier code is not detected or the register access times out during the device identifier register reading process, the port is determined to be hardware abnormal, an alarm signal is triggered, and the physical layer driver of the port is disabled. At the same time, the fault information is written to the system log. In this implementation, the failure of initialization of any port does not affect the normal entry of the other port into the monitoring process, but the system will automatically degrade to single-port working mode until the faulty port recovers. The dual-port initialization process in this embodiment, combined with the real-time hardware anomaly disable mechanism, ensures that the system automatically degrades to a lower level in the event of a single point of failure, avoiding overall network paralysis caused by port initialization failure and greatly enhancing the device's fault tolerance.

[0030] Figure 3 A flowchart illustrating an embodiment of the present invention for identifying and marking hardware warnings is shown.

[0031] According to embodiments of the present invention, such as Figure 3 As shown, determining whether a hardware warning exists based on the physical layer information specifically includes: S302 periodically reads the communication signal strength through the signal strength indicator bit of the PHY register; S304, parsing the error count register, calculates the bit error rate per unit time; S306 monitors the link pulse signal, records the number of pulse loss events per unit time, and obtains the pulse loss rate; S308, if the signal strength is lower than the preset signal strength threshold, or if the bit error rate or the pulse loss rate exceeds the limit continuously, mark the physical layer as a warning state.

[0032] It should be noted that in this embodiment, the hardware early warning judgment process is divided into two stages: data acquisition and decision-making. In the acquisition stage, the system reads the RSSI indicator bit of the PHY register at a preset acquisition cycle, converting the binary code in the register into an absolute signal strength value of -30dBm to -10dBm. Simultaneously, the frame check error count and symbol error count of the error count register are analyzed, and the bit error rate within a unit time window is calculated based on the ratio of the error count to the total number of transmitted bits. Furthermore, the link pulse signal state machine is monitored simultaneously, and the pulse loss rate is obtained by dividing the number of pulse loss events triggered in the PHY interrupt service routine by the monitoring duration. In the decision-making stage, as one implementation method, the real-time signal strength is compared with a preset threshold. A level one early warning is triggered when the signal strength is below the threshold for three consecutive cycles. The bit error rate is compared with a dynamically adjusted threshold; a level two early warning is triggered when the threshold is exceeded twice consecutively. A level three early warning is triggered if the pulse loss rate exceeds five times per second. Activation of any of the above-mentioned warnings marks the physical layer warning status and initiates the port switching preparation process. Simultaneously, the warning type is recorded for use by the fault diagnosis module. Warning types include, but are not limited to, signal attenuation, bit error rate spikes, and pulse loss of synchronization. This embodiment upgrades traditional connectivity detection to warning prediction based on multi-dimensional physical layer joint monitoring of signal strength, bit error rate, and pulse loss rate, improving hardware fault response speed and effectively preventing sudden link collapses.

[0033] According to an embodiment of the present invention, determining whether the channel is in a continuously deteriorating state based on the application layer information specifically includes: Obtain the number of tolerance periods N for deterioration; If the packet loss rate exceeds the preset packet loss rate threshold for N consecutive sampling periods and the packet loss rate shows an increasing trend, it is determined to be a continuously deteriorating state. If the retransmission rate exceeds the preset retransmission rate threshold for N consecutive sampling periods and the retransmission rate shows an increasing trend, it is determined to be a continuously deteriorating state. If the number of session interruptions exceeds the preset interruption threshold within the preset time window, it is determined to be a continuously deteriorating state. Record the parameters of the deteriorating state and the business type, and generate a log of analysis of the causes of the deterioration.

[0034] It should be noted that in this embodiment, the determination of continuous channel degradation relies on the correlation analysis of multi-dimensional application layer indicators. First, based on the service type, the degradation tolerance period N is adaptively determined. As one implementation method, N=3 for real-time audio and video, N=5 for file transfer, and N=2 for industrial control. Regarding the packet loss rate dimension, when the packet loss rate exceeds the type-related threshold within a period and the difference in packet loss rate between adjacent periods is positive, a packet loss degradation flag is marked. Regarding the retransmission rate dimension, if the retransmission rate exceeds a set threshold and shows a continuous upward trend, a retransmission degradation flag is marked. Regarding the session interruption event dimension, the number of TCP connection resets or ICMP unreachable errors is counted within a preset sliding time window; if the limit is exceeded, a session degradation flag is marked. When degradation is activated in any dimension, the channel is determined to be in a continuous degradation state. Finally, the degradation type, associated service type, and timestamp are written to the analysis log, and a preventative switchover is triggered to avoid the risk of service collapse. This embodiment accurately identifies hidden degradation at the service layer through packet loss rate and retransmission rate trend analysis and correlation judgment with session interruption frequency, providing a key time window for preventative switchover.

[0035] According to an embodiment of the present invention, the step of dynamically allocating transmission indicator weights based on the current service type and generating a dual-channel quality score specifically includes: Parse the data stream protocol header fields to identify the current dominant business type, which includes at least real-time audio and video, file transfer, and industrial control. Based on the preset mapping table of service type and weight configuration, the transmission index weights are obtained, including the transmission delay coefficient, transmission jitter coefficient and bandwidth utilization coefficient. Based on the transport layer information and transport index weights, a quality score for the corresponding channel is obtained by weighted summation.

[0036] It should be noted that in this embodiment, the dominant service type of the current network traffic is first identified by deep analysis of the protocol header fields of the data stream transport layer and network layer. As one implementation, when an RTP protocol header or video conferencing characteristic port is detected, it is classified as a real-time audio / video service; when FTP / SMB protocol characteristics are present, it is marked as a file transfer service; and if Modbus / TCP or PROFINET industrial protocol frames are identified, it is determined to be an industrial control service. Next, the weight configuration mapping table pre-stored in the system memory is queried to extract the transport layer indicator weight coefficients for the corresponding service type. As one implementation, a 60% weight is assigned to transmission delay and a 40% weight to transmission jitter for real-time audio / video services, with bandwidth utilization not included in the score; a 70% weight is assigned to bandwidth utilization and a 30% weight to packet loss rate for file transfer services, with transmission jitter not included in the score; and an 80% weight is assigned to packet loss rate and a 20% weight to delay for industrial control services. Finally, the transport layer indicators for each channel are normalized, converting the actual measured values ​​into relative scores within the range of 0-1, and a final quality score is generated using a weighted summation formula. This embodiment employs a dynamic weighting mechanism to ensure that in video conferencing scenarios, high-latency channels will be classified as low-quality even with sufficient bandwidth, while high-latency channels with zero packet loss will still receive a high-quality score during file transfers. This embodiment eliminates the mismatch between service requirements and network performance by dynamically configuring transmission indicator weights based on service type, reducing video conferencing stuttering rates and improving the effectiveness of file transfers.

[0037] According to an embodiment of the present invention, obtaining a stability margin score based on the secondary channel application layer information and obtaining a margin threshold based on the secondary channel quality score specifically includes: Extract application layer information from the auxiliary channel within the most recent M sampling periods; The variances of packet loss rate and retransmission rate are calculated separately as stability quantification factors. The stability coefficient is obtained by combining the signal strength with the physical layer information; The stability margin score is obtained by multiplying the stability quantification factor and the stability coefficient.

[0038] It should be noted that in this embodiment, the generation of the stability margin score and margin threshold is implemented in two stages: data preprocessing and composite calculation. In the preprocessing stage, the application layer dataset for the most recent M sampling periods of the auxiliary channel is first extracted, including the packet loss rate sequence and retransmission rate sequence for each period. The variances of the two sequences are calculated using statistical methods; the packet loss rate variance reflects the degree of data loss fluctuation, and the retransmission rate variance characterizes the suddenness of retransmission requests; together, they constitute the stability quantification factor. Simultaneously, the physical layer signal strength index is integrated, and the standard deviation of the signal strength is converted into a stability coefficient in the 0-1 range after inverse scaling, where the smaller the signal fluctuation, the higher the coefficient. In the composite calculation stage, the stability quantification factor is multiplied by the stability coefficient, and the product is output as the stability margin score, thus ensuring that a high score is obtained only when the application layer index is stable and the physical layer signal is stable. The margin threshold is dynamically adjusted according to the real-time quality score of the auxiliary channel; the higher the quality score, the lower the threshold. This embodiment avoids erroneous switching triggered by instantaneous fluctuations in the high-load channel; the auxiliary channel is only allowed to take over the main channel when it remains stable under high-quality conditions.

[0039] It is worth mentioning that it also includes: When a hardware warning is determined to exist based on the physical layer information, the error details register is read to obtain the fault code; Based on the fault code, a preset fault code library is matched to obtain the fault type, which includes at least electromagnetic interference, clock loss, and port oxidation. Based on the fault type, activate the self-healing mechanism.

[0040] It should be noted that this embodiment also includes a hardware-based early warning linkage fault diagnosis mechanism. When a physical layer early warning is triggered, the system immediately reads the error details register of the PHY chip to obtain the fault code defined by the manufacturer. The code is input into a pre-built fault knowledge base for pattern matching to obtain the fault cause. As one implementation, when code 0x805F maps to electromagnetic interference, code 0x1A0C corresponds to clock synchronization failure, and code 0x302A indicates port oxidation. After a successful match, the corresponding self-healing strategy is activated. As one implementation, for electromagnetic interference types, the PHY chip is controlled to enable the adaptive equalizer and switch to a more interference-resistant coding mode; for clock synchronization failures, synchronization to a high-precision PTP time source is forced, and the clock tree register is reset; for port oxidation failures, a physical cleaning alarm is sent to the operation and maintenance system, and a shortened maintenance cycle is recommended. All diagnostic results and handling measures are recorded in a timestamped audit log, forming a complete evidence chain from fault detection to self-healing response, providing data support for subsequent network optimization.

[0041] It is worth mentioning that it also includes: After switching to the auxiliary channel, monitor the fault repair status of the main channel; Within the preset monitoring period, compare the quality scores of the main channel and the auxiliary channel; When the quality score of the main channel continuously exceeds that of the auxiliary channel, a switchback operation is performed. The back-switch operation employs a gradual traffic migration, prioritizing the migration of low-priority data streams.

[0042] It should be noted that this embodiment provides a back-switch control mechanism. After switching to the secondary channel, the system starts the primary channel repair monitoring thread. Simultaneously, the physical layer register status of the primary channel is polled at fixed intervals. When link reactivation is detected, a 10-minute stability monitoring period is initiated. During this period, quality score datasets of the primary and backup channels are continuously collected in parallel, and the magnitude by which the primary channel score exceeds the secondary channel score is calculated—if the primary channel score exceeds the secondary channel score five consecutive times, the primary channel is deemed to have recovered stability. Before executing the back-switch, the system identifies service priorities by analyzing the TOS field or VLAN tag in the IP header of the data flow, dividing traffic into critical flows, real-time flows, and background flows. Data flows are migrated step-by-step according to the priority from low to high. As one implementation, the background flow is migrated to the primary channel first, using a dual-path parallel transmission mechanism. A new primary channel connection is established while maintaining the original path of the secondary channel; the secondary channel link is dismantled after the TCP session is completely migrated. Next, the real-time flow is migrated, utilizing the connectionless nature of the UDP protocol to directly switch the routing table. Finally, the critical flow is migrated, using session persistence technology to ensure zero loss of control commands. This embodiment employs a progressive back-switch mechanism combined with a service priority migration mechanism to ensure zero interruption of high-priority services during channel recovery, thereby ensuring communication reliability.

[0043] It is worth mentioning that it also includes: Build a historical fault database to store fault codes and environmental parameters corresponding to physical layer early warning events; When real-time collected physical layer information triggers a hardware warning, the recurrence rate of the same type of fault within a preset time window is calculated by matching the current fault code with the historical fault database. If the recurrence rate exceeds a preset probability threshold, the deterioration trend analysis stage is skipped, and preventive switching is initiated directly. The environmental parameters include at least temperature, humidity, and electromagnetic field strength, which are used to generate a root cause correlation map of the fault.

[0044] It should be noted that this embodiment provides a predictive switching mechanism driven by historical faults. First, a ring-buffered historical fault database is constructed in the system memory, recording the timestamp, fault code, and synchronously collected environmental sensor data for each physical layer warning event. When real-time physical layer monitoring triggers a hardware warning, the system extracts the current fault code, retrieves the number of occurrences of similar faults in the database within the last 72 hours, and calculates the recurrence rate using a sliding time window. If this frequency exceeds a preset probability threshold, it is determined to be a high-risk recurring fault. In this case, the conventional application layer degradation analysis process is bypassed, and preventative switching is immediately executed to seize the repair time window. Simultaneously, a multi-dimensional correlation graph is constructed using environmental parameters to dynamically adjust the probability threshold; for example, when the temperature is greater than 85℃, the recurrence probability of electromagnetic interference faults increases by 40%. This embodiment predicts hardware degradation trajectories through historical fault recurrence rates, reducing switching response time, and is particularly suitable for preventing sudden faults in high-vibration industrial scenarios.

[0045] Figure 4 A block diagram of an adaptive switching system based on dual Ethernet ports according to the present invention is shown.

[0046] like Figure 4 As shown, the second aspect of the present invention discloses an adaptive handover system 4 based on dual Ethernet ports, including a memory 41 and a processor 42. The memory includes an adaptive handover method program based on dual Ethernet ports. When the processor executes the adaptive handover method program based on dual Ethernet ports, it performs the following steps: When the preset PHY register verification port is present, initialize the dual-channel port; Activate the channel data stream of the dual-channel port and record physical layer information, transport layer information and application layer information; Determine whether a hardware warning exists based on the physical layer information; If so, then a port switch will be triggered; If not, then based on the application layer information, determine whether the channel is in a state of continuous deterioration; If so, then a port switch will be triggered; If not, then the transmission indicator weights will be dynamically allocated based on the current service type to generate a dual-channel quality score; In response to the main channel quality score being lower than the secondary channel quality score, a stability margin score is obtained based on the secondary channel application layer information, and a margin threshold is obtained based on the secondary channel quality score. If the stability margin score is higher than the margin threshold, then a seamless channel switch is performed.

[0047] It should be noted that the physical layer information includes at least signal strength and bit error rate; the transport layer information includes at least transmission delay, transmission jitter and bandwidth utilization; the application layer information includes at least packet loss rate, retransmission rate and number of session interruptions; and the seamless channel switching operation includes at least cloning the MAC address to the target port, buffering data packets to be forwarded, and updating the network topology.

[0048] In this embodiment, the physical existence of the dual ports is first verified by setting a preset flag value in the PHY register. Once both Ethernet ports are confirmed to be operational, the dual-channel port initialization process is executed, including resetting port status flags and clearing historical cache data. Subsequently, the dual-channel data flow monitoring module is activated, simultaneously collecting three key indicators: physical layer signal strength and bit error rate, transmission layer latency jitter and bandwidth utilization, and application layer packet loss rate, retransmission rate, and session interruption count. Then, based on real-time analysis of the physical layer indicators, if the signal strength is continuously below a threshold or the bit error rate continuously exceeds the tolerance range, a port switching action is immediately triggered to mitigate hardware failure risks. If there is no warning signal at the physical layer, the process transitions to the application layer degradation status judgment mechanism. By monitoring the increasing trend of the packet loss rate within a continuous sampling period and whether the session interruption frequency exceeds a threshold, it is determined whether there is service-level degradation in the channel. If service-level degradation is determined, the switching process is initiated. When there are no anomalies in the physical layer and application layer, the system identifies the dominant service type based on the current data stream protocol header characteristics, including real-time audio and video, file transfer, etc., and calls a preset weight configuration template to dynamically weight the transport layer indicators to generate a dual-channel quality score. Finally, when the primary channel score is lower than the secondary channel score, the system further calculates the stability margin score of the secondary channel based on the variance of the application layer indicators and the signal strength stability, which is then compared with the margin threshold. A seamless handover operation is performed only when the stability margin exceeds the threshold; this operation achieves zero-service-interruption channel migration by cloning the source port MAC address to the target port, establishing a data packet buffer queue, and broadcasting ARP updates. This embodiment achieves graded fault response through a three-level detection mechanism, sequentially from physical layer early warning, application layer deterioration, and dynamic scoring handover; combined with service-aware seamless handover technology, it significantly improves channel utilization efficiency while avoiding the risks of hardware failure and service interruption.

[0049] According to an embodiment of the present invention, the initialization of the dual-channel port specifically includes: Read the PHY registers of the first Ethernet port and the second Ethernet port in parallel to verify the physical existence of the dual ports; If present, reset the status flags of the dual-channel port, including at least the link activation flag, fault flag, and historical score cache; Poll the BASIC_STATUS register on both ports to obtain the initial link status and rate negotiation mode; If no valid PHY device identifier is detected on any port, a hardware error alarm is triggered and the port is disabled.

[0050] It should be noted that, in this embodiment, the implementation process for initializing the dual-channel ports includes four core operations. First, the PHY device identifier registers of the first and second ports are accessed in parallel to verify the existence of the port's physical entity by checking the preset manufacturer code in the register. After both ports pass the existence verification, the system resets three types of status flags. These include setting the link activation flag to an unconnected state, clearing the fault flag, and clearing the historical score cache, thereby ensuring that the initial state is free from historical data interference. Second, the BASIC_STATUS registers of both ports are polled to extract the link activation status bit, rate negotiation result bit, and duplex mode bit, and the initial negotiated rate and duplex configuration are recorded. Then, if the preset unique identifier code is not detected or the register access times out during the device identifier register reading process, the port is determined to be hardware abnormal, an alarm signal is triggered, and the physical layer driver of the port is disabled. At the same time, the fault information is written to the system log. In this implementation, the failure of initialization of any port does not affect the normal entry of the other port into the monitoring process, but the system will automatically degrade to single-port working mode until the faulty port recovers. The dual-port initialization process in this embodiment, combined with the real-time hardware anomaly disable mechanism, ensures that the system automatically degrades to a lower level in the event of a single point of failure, avoiding overall network paralysis caused by port initialization failure and greatly enhancing the device's fault tolerance.

[0051] According to an embodiment of the present invention, determining whether a hardware warning exists based on the physical layer information specifically includes: The communication signal strength is periodically read using the signal strength indicator bit in the PHY register; Analyze the error counter register and calculate the bit error rate per unit time; Monitor the link pulse signal, record the number of pulse loss events per unit time, and obtain the pulse loss rate; If the signal strength is lower than a preset signal strength threshold, or if the bit error rate or the pulse loss rate exceeds the limit continuously, a physical layer warning state is marked.

[0052] It should be noted that in this embodiment, the hardware early warning judgment process is divided into two stages: data acquisition and decision-making. In the acquisition stage, the system reads the RSSI indicator bit of the PHY register at a preset acquisition cycle, converting the binary code in the register into an absolute signal strength value of -30dBm to -10dBm. Simultaneously, the frame check error count and symbol error count of the error count register are analyzed, and the bit error rate within a unit time window is calculated based on the ratio of the error count to the total number of transmitted bits. Furthermore, the link pulse signal state machine is monitored simultaneously, and the pulse loss rate is obtained by dividing the number of pulse loss events triggered in the PHY interrupt service routine by the monitoring duration. In the decision-making stage, as one implementation method, the real-time signal strength is compared with a preset threshold. A level one early warning is triggered when the signal strength is below the threshold for three consecutive cycles. The bit error rate is compared with a dynamically adjusted threshold; a level two early warning is triggered when the threshold is exceeded twice consecutively. A level three early warning is triggered if the pulse loss rate exceeds five times per second. Activation of any of the above-mentioned warnings marks the physical layer warning status and initiates the port switching preparation process. Simultaneously, the warning type is recorded for use by the fault diagnosis module. Warning types include, but are not limited to, signal attenuation, bit error rate spikes, and pulse loss of synchronization. This embodiment upgrades traditional connectivity detection to warning prediction based on multi-dimensional physical layer joint monitoring of signal strength, bit error rate, and pulse loss rate, improving hardware fault response speed and effectively preventing sudden link collapses.

[0053] According to an embodiment of the present invention, determining whether the channel is in a continuously deteriorating state based on the application layer information specifically includes: Obtain the number of tolerance periods N for deterioration; If the packet loss rate exceeds the preset packet loss rate threshold for N consecutive sampling periods and the packet loss rate shows an increasing trend, it is determined to be a continuously deteriorating state. If the retransmission rate exceeds the preset retransmission rate threshold for N consecutive sampling periods and the retransmission rate shows an increasing trend, it is determined to be a continuously deteriorating state. If the number of session interruptions exceeds the preset interruption threshold within the preset time window, it is determined to be a continuously deteriorating state. Record the parameters of the deteriorating state and the business type, and generate a log of analysis of the causes of the deterioration.

[0054] It should be noted that in this embodiment, the determination of continuous channel degradation relies on the correlation analysis of multi-dimensional application layer indicators. First, based on the service type, the degradation tolerance period N is adaptively determined. As one implementation method, N=3 for real-time audio and video, N=5 for file transfer, and N=2 for industrial control. Regarding the packet loss rate dimension, when the packet loss rate exceeds the type-related threshold within a period and the difference in packet loss rate between adjacent periods is positive, a packet loss degradation flag is marked. Regarding the retransmission rate dimension, if the retransmission rate exceeds a set threshold and shows a continuous upward trend, a retransmission degradation flag is marked. Regarding the session interruption event dimension, the number of TCP connection resets or ICMP unreachable errors is counted within a preset sliding time window; if the limit is exceeded, a session degradation flag is marked. When degradation is activated in any dimension, the channel is determined to be in a continuous degradation state. Finally, the degradation type, associated service type, and timestamp are written to the analysis log, and a preventative switchover is triggered to avoid the risk of service collapse. This embodiment accurately identifies hidden degradation at the service layer through packet loss rate and retransmission rate trend analysis and correlation judgment with session interruption frequency, providing a key time window for preventative switchover.

[0055] According to an embodiment of the present invention, the step of dynamically allocating transmission indicator weights based on the current service type and generating a dual-channel quality score specifically includes: Parse the data stream protocol header fields to identify the current dominant business type, which includes at least real-time audio and video, file transfer, and industrial control. Based on the preset mapping table of service type and weight configuration, the transmission index weights are obtained, including the transmission delay coefficient, transmission jitter coefficient and bandwidth utilization coefficient. Based on the transport layer information and transport index weights, a quality score for the corresponding channel is obtained by weighted summation.

[0056] It should be noted that in this embodiment, the dominant service type of the current network traffic is first identified by deep analysis of the protocol header fields of the data stream transport layer and network layer. As one implementation, when an RTP protocol header or video conferencing characteristic port is detected, it is classified as a real-time audio / video service; when FTP / SMB protocol characteristics are present, it is marked as a file transfer service; and if Modbus / TCP or PROFINET industrial protocol frames are identified, it is determined to be an industrial control service. Next, the weight configuration mapping table pre-stored in the system memory is queried to extract the transport layer indicator weight coefficients for the corresponding service type. As one implementation, a 60% weight is assigned to transmission delay and a 40% weight to transmission jitter for real-time audio / video services, with bandwidth utilization not included in the score; a 70% weight is assigned to bandwidth utilization and a 30% weight to packet loss rate for file transfer services, with transmission jitter not included in the score; and an 80% weight is assigned to packet loss rate and a 20% weight to delay for industrial control services. Finally, the transport layer indicators for each channel are normalized, converting the actual measured values ​​into relative scores within the range of 0-1, and a final quality score is generated using a weighted summation formula. This embodiment employs a dynamic weighting mechanism to ensure that in video conferencing scenarios, high-latency channels will be classified as low-quality even with sufficient bandwidth, while high-latency channels with zero packet loss will still receive a high-quality score during file transfers. This embodiment eliminates the mismatch between service requirements and network performance by dynamically configuring transmission indicator weights based on service type, reducing video conferencing stuttering rates and improving the effectiveness of file transfers.

[0057] According to an embodiment of the present invention, obtaining a stability margin score based on the secondary channel application layer information and obtaining a margin threshold based on the secondary channel quality score specifically includes: Extract application layer information from the auxiliary channel within the most recent M sampling periods; The variances of packet loss rate and retransmission rate are calculated separately as stability quantification factors. The stability coefficient is obtained by combining the signal strength with the physical layer information; The stability margin score is obtained by multiplying the stability quantification factor and the stability coefficient.

[0058] It should be noted that in this embodiment, the generation of the stability margin score and margin threshold is implemented in two stages: data preprocessing and composite calculation. In the preprocessing stage, the application layer dataset for the most recent M sampling periods of the auxiliary channel is first extracted, including the packet loss rate sequence and retransmission rate sequence for each period. The variances of the two sequences are calculated using statistical methods; the packet loss rate variance reflects the degree of data loss fluctuation, and the retransmission rate variance characterizes the suddenness of retransmission requests; together, they constitute the stability quantification factor. Simultaneously, the physical layer signal strength index is integrated, and the standard deviation of the signal strength is converted into a stability coefficient in the 0-1 range after inverse scaling, where the smaller the signal fluctuation, the higher the coefficient. In the composite calculation stage, the stability quantification factor is multiplied by the stability coefficient, and the product is output as the stability margin score, thus ensuring that a high score is obtained only when the application layer index is stable and the physical layer signal is stable. The margin threshold is dynamically adjusted according to the real-time quality score of the auxiliary channel; the higher the quality score, the lower the threshold. This embodiment avoids erroneous switching triggered by instantaneous fluctuations in the high-load channel; the auxiliary channel is only allowed to take over the main channel when it remains stable under high-quality conditions.

[0059] It is worth mentioning that it also includes: When a hardware warning is determined to exist based on the physical layer information, the error details register is read to obtain the fault code; Based on the fault code, a preset fault code library is matched to obtain the fault type, which includes at least electromagnetic interference, clock loss, and port oxidation. Based on the fault type, activate the self-healing mechanism.

[0060] It should be noted that this embodiment also includes a hardware-based early warning linkage fault diagnosis mechanism. When a physical layer early warning is triggered, the system immediately reads the error details register of the PHY chip to obtain the fault code defined by the manufacturer. The code is input into a pre-built fault knowledge base for pattern matching to obtain the fault cause. As one implementation, when code 0x805F maps to electromagnetic interference, code 0x1A0C corresponds to clock synchronization failure, and code 0x302A indicates port oxidation. After a successful match, the corresponding self-healing strategy is activated. As one implementation, for electromagnetic interference types, the PHY chip is controlled to enable the adaptive equalizer and switch to a more interference-resistant coding mode; for clock synchronization failures, synchronization to a high-precision PTP time source is forced, and the clock tree register is reset; for port oxidation failures, a physical cleaning alarm is sent to the operation and maintenance system, and a shortened maintenance cycle is recommended. All diagnostic results and handling measures are recorded in a timestamped audit log, forming a complete evidence chain from fault detection to self-healing response, providing data support for subsequent network optimization.

[0061] It is worth mentioning that it also includes: After switching to the auxiliary channel, monitor the fault repair status of the main channel; Within the preset monitoring period, compare the quality scores of the main channel and the auxiliary channel; When the quality score of the main channel continuously exceeds that of the auxiliary channel, a switchback operation is performed. The back-switch operation employs a gradual traffic migration, prioritizing the migration of low-priority data streams.

[0062] It should be noted that this embodiment provides a back-switch control mechanism. After switching to the secondary channel, the system starts the primary channel repair monitoring thread. Simultaneously, the physical layer register status of the primary channel is polled at fixed intervals. When link reactivation is detected, a 10-minute stability monitoring period is initiated. During this period, quality score datasets of the primary and backup channels are continuously collected in parallel, and the magnitude by which the primary channel score exceeds the secondary channel score is calculated—if the primary channel score exceeds the secondary channel score five consecutive times, the primary channel is deemed to have recovered stability. Before executing the back-switch, the system identifies service priorities by analyzing the TOS field or VLAN tag in the IP header of the data flow, dividing traffic into critical flows, real-time flows, and background flows. Data flows are migrated step-by-step according to the priority from low to high. As one implementation, the background flow is migrated to the primary channel first, using a dual-path parallel transmission mechanism. A new primary channel connection is established while maintaining the original path of the secondary channel; the secondary channel link is dismantled after the TCP session is completely migrated. Next, the real-time flow is migrated, utilizing the connectionless nature of the UDP protocol to directly switch the routing table. Finally, the critical flow is migrated, using session persistence technology to ensure zero loss of control commands. This embodiment employs a progressive back-switch mechanism combined with a service priority migration mechanism to ensure zero interruption of high-priority services during channel recovery, thereby ensuring communication reliability.

[0063] It is worth mentioning that it also includes: Build a historical fault database to store fault codes and environmental parameters corresponding to physical layer early warning events; When real-time collected physical layer information triggers a hardware warning, the recurrence rate of the same type of fault within a preset time window is calculated by matching the current fault code with the historical fault database. If the recurrence rate exceeds a preset probability threshold, the deterioration trend analysis stage is skipped, and preventive switching is initiated directly. The environmental parameters include at least temperature, humidity, and electromagnetic field strength, which are used to generate a root cause correlation map of the fault.

[0064] It should be noted that this embodiment provides a predictive switching mechanism driven by historical faults. First, a ring-buffered historical fault database is constructed in the system memory, recording the timestamp, fault code, and synchronously collected environmental sensor data for each physical layer warning event. When real-time physical layer monitoring triggers a hardware warning, the system extracts the current fault code, retrieves the number of occurrences of similar faults in the database within the last 72 hours, and calculates the recurrence rate using a sliding time window. If this frequency exceeds a preset probability threshold, it is determined to be a high-risk recurring fault. In this case, the conventional application layer degradation analysis process is bypassed, and preventative switching is immediately executed to seize the repair time window. Simultaneously, a multi-dimensional correlation graph is constructed using environmental parameters to dynamically adjust the probability threshold; for example, when the temperature is greater than 85℃, the recurrence probability of electromagnetic interference faults increases by 40%. This embodiment predicts hardware degradation trajectories through historical fault recurrence rates, reducing switching response time, and is particularly suitable for preventing sudden faults in high-vibration industrial scenarios.

[0065] A third aspect of the present invention provides a computer-readable storage medium comprising an adaptive switching method program based on dual Ethernet ports, wherein when the adaptive switching method program based on dual Ethernet ports is executed by a processor, the steps of the adaptive switching method based on dual Ethernet ports as described in any of the preceding claims are implemented.

[0066] In summary, this invention provides an adaptive switching method, system, and storage medium based on dual Ethernet ports. The method first verifies the physical existence of both ports and initializes the channel state via the PHY register; then, it synchronously collects physical layer, transport layer, and application layer information; when a hardware warning is triggered based on the physical layer information, the port is switched immediately; if no warning is triggered, the continuous deterioration trend of application layer indicators is analyzed, and preventative switching is initiated when deterioration conditions are met; when both the physical and application layers are normal, a quality score is generated by dynamically allocating transport indicator weights according to the real-time service type; if the primary channel score is lower than the secondary channel score, the application layer stability margin score of the secondary channel is calculated and compared with a dynamic threshold; seamless switching is performed only when the margin meets the threshold. This invention improves the accuracy of channel switching and enhances the reliability of communication in industrial scenarios through a fault-level response mechanism and service-aware dynamic weight decision-making.

[0067] 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, 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.

[0068] 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. An adaptive switching method based on dual Ethernet ports, applied to a dual Ethernet port circuit, the circuit including a first Ethernet port, a second Ethernet port and an adaptive switching module; The adaptive switching module automatically switches communication channels based on the Ethernet port status. Its features are, The method includes: When the preset PHY register verification port is present, initialize the dual-channel port; Activate the channel data stream of the dual-channel port and record physical layer information, transport layer information and application layer information; Determine whether a hardware warning exists based on the physical layer information; If so, then a port switch will be triggered; If not, then based on the application layer information, determine whether the channel is in a state of continuous deterioration; If so, then a port switch will be triggered; If not, then the transmission indicator weights will be dynamically allocated based on the current service type to generate a dual-channel quality score; In response to the main channel quality score being lower than the secondary channel quality score, a stability margin score is obtained based on the secondary channel application layer information, and a margin threshold is obtained based on the secondary channel quality score. If the stability margin score is higher than the margin threshold, then a seamless channel switch is performed; The process of obtaining a stability margin score based on the secondary channel application layer information and obtaining a margin threshold based on the secondary channel quality score specifically includes: Extract application layer information from the auxiliary channel within the most recent M sampling periods; The variances of packet loss rate and retransmission rate are calculated separately as stability quantification factors. The stability coefficient is obtained by combining the signal strength with the physical layer information; The stability margin score is obtained by multiplying the stability quantification factor and the stability coefficient.

2. The adaptive switching method based on dual Ethernet ports according to claim 1, characterized in that, The initialization of the dual-channel port specifically includes: Read the PHY registers of the first Ethernet port and the second Ethernet port in parallel to verify the physical existence of the dual ports; If present, reset the status flags of the dual-channel port, including at least the link activation flag, fault flag, and historical score cache; Poll the BASIC_STATUS register on both ports to obtain the initial link status and rate negotiation mode; If no valid PHY device identifier is detected on any port, a hardware error alarm is triggered and the port is disabled.

3. The adaptive switching method based on dual Ethernet ports according to claim 1, characterized in that, The step of determining whether a hardware warning exists based on the physical layer information specifically includes: The communication signal strength is periodically read using the signal strength indicator bit in the PHY register; Analyze the error counter register and calculate the bit error rate per unit time; Monitor the link pulse signal, record the number of pulse loss events per unit time, and obtain the pulse loss rate; If the signal strength is lower than a preset signal strength threshold, or if the bit error rate or the pulse loss rate exceeds the limit continuously, a physical layer warning state is marked.

4. The adaptive switching method based on dual Ethernet ports according to claim 1, characterized in that, The step of determining whether the channel is in a state of continuous deterioration based on the application layer information specifically includes: Obtain the number of tolerance periods N for deterioration; If the packet loss rate exceeds the preset packet loss rate threshold for N consecutive sampling periods and the packet loss rate shows an increasing trend, it is determined to be a continuously deteriorating state. If the retransmission rate exceeds the preset retransmission rate threshold for N consecutive sampling periods and the retransmission rate shows an increasing trend, it is determined to be a continuously deteriorating state. If the number of session interruptions exceeds the preset interruption threshold within the preset time window, it is determined to be a continuously deteriorating state. Record the parameters of the deteriorating state and the business type, and generate a log of analysis of the causes of the deterioration.

5. The adaptive switching method based on dual Ethernet ports according to claim 1, characterized in that, The process of dynamically allocating transmission indicator weights based on the current service type to generate a dual-channel quality score specifically includes: Parse the data stream protocol header fields to identify the current dominant business type, which includes at least real-time audio and video, file transfer, and industrial control. Based on the preset mapping table of service type and weight configuration, the transmission index weights are obtained, including the transmission delay coefficient, transmission jitter coefficient and bandwidth utilization coefficient. Based on the transport layer information and transport index weights, a quality score for the corresponding channel is obtained by weighted summation.

6. An adaptive switching system based on dual Ethernet ports, applied to a dual Ethernet port circuit, the circuit including a first Ethernet port, a second Ethernet port and an adaptive switching module; The adaptive switching module automatically switches communication channels based on the Ethernet port status. Its features are, The system includes a memory and a processor. The memory includes a program for an adaptive handover method based on dual Ethernet ports. When executed by the processor, the adaptive handover method program based on dual Ethernet ports performs the following steps: When the preset PHY register verification port is present, initialize the dual-channel port; Activate the channel data stream of the dual-channel port and record physical layer information, transport layer information and application layer information; Determine whether a hardware warning exists based on the physical layer information; If so, then a port switch will be triggered; If not, then based on the application layer information, determine whether the channel is in a state of continuous deterioration; If so, then a port switch will be triggered; If not, then the transmission indicator weights will be dynamically allocated based on the current service type to generate a dual-channel quality score; In response to the main channel quality score being lower than the secondary channel quality score, a stability margin score is obtained based on the secondary channel application layer information, and a margin threshold is obtained based on the secondary channel quality score. If the stability margin score is higher than the margin threshold, then a seamless channel switch is performed; the process of obtaining the stability margin score based on the secondary channel application layer information and obtaining the margin threshold based on the secondary channel quality score specifically includes: Extract application layer information from the auxiliary channel within the most recent M sampling periods; The variances of packet loss rate and retransmission rate are calculated separately as stability quantification factors. The stability coefficient is obtained by combining the signal strength with the physical layer information; The stability margin score is obtained by multiplying the stability quantification factor and the stability coefficient.

7. The adaptive switching system based on dual Ethernet ports according to claim 6, characterized in that, The initialization of the dual-channel port specifically includes: Read the PHY registers of the first Ethernet port and the second Ethernet port in parallel to verify the physical existence of the dual ports; If present, reset the status flags of the dual-channel port, including at least the link activation flag, fault flag, and historical score cache; Poll the BASIC_STATUS register on both ports to obtain the initial link status and rate negotiation mode; If no valid PHY device identifier is detected on any port, a hardware error alarm is triggered and the port is disabled.

8. The adaptive switching system based on dual Ethernet ports according to claim 6, characterized in that, The step of determining whether a hardware warning exists based on the physical layer information specifically includes: The communication signal strength is periodically read using the signal strength indicator bit in the PHY register; Analyze the error counter register and calculate the bit error rate per unit time; Monitor the link pulse signal, record the number of pulse loss events per unit time, and obtain the pulse loss rate; If the signal strength is lower than a preset signal strength threshold, or if the bit error rate or the pulse loss rate exceeds the limit continuously, a physical layer warning state is marked.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, The computer-readable storage medium includes a program for an adaptive switching method based on dual Ethernet ports, which, when executed by a processor, implements the steps of the adaptive switching method based on dual Ethernet ports as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • HBase client main and standby switching method and system based on fault perception

    CN119537484A

  • Industrial Internet of Things security authentication method and system based on zero-knowledge proof

    CN119743270A