Network interface adaptive switching method and device and public network access system
By monitoring the physical layer status of external network interfaces, dynamically optimizing protocol stack parameters, and synchronously updating security policies, the problem of slow network interface switching response in existing technologies is solved, enabling efficient public network access for multi-SoC systems and improving real-time performance and reliability.
Patent Information
- Application Number
- CN202511289490.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-10
- Publication Date
- 2026-01-02
AI Technical Summary
Existing technologies suffer from slow switching response when enabling public network access for different types of network ports, failing to meet the real-time requirements of multi-SoC systems, especially in high real-time scenarios related to assisted driving.
By monitoring the physical layer status of external network interfaces, dynamically optimizing protocol stack parameters, and synchronously updating security policies, adaptive switching of network interfaces is achieved, including media detection, interface switching, protocol stack parameter optimization, and security policy updates.
It improves the real-time performance, stability, and security of public network access, ensuring efficient communication of multi-SoC systems in the vehicle environment and avoiding manual intervention and switching delays.
Smart Images

Figure CN121262233A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of vehicle-mounted SoC network communication, in particular to a network interface adaptive switching method and device, a public network access system of a vehicle-mounted multi-SoC, an electronic device and a computer storage medium. BACKGROUND
[0002] With the development of vehicle-mounted systems and embedded systems, a single system on chip (SoC) has been difficult to meet the growing demand for computing and communication, and traditional vehicle-mounted systems generally integrate multiple SoC chips and are divided into vehicle-mounted entertainment, information security / processing or automatic driving assistance light functions. In order to ensure the normal operation of multiple SoC systems, high-speed and low-latency communication between SoCs needs to be implemented, and at the same time, the system needs to have public network access capability. In particular, the public network access capability largely determines the basis for data interaction between the vehicle-mounted system and the external cloud platform, remote service center, such as over-the-air (OTA), map and navigation data update, vehicle operating status reporting and Internet of Vehicles services, and lack of public network access capability will seriously affect the continuous operation and evolution of the vehicle-mounted system.
[0003] In actual application, the public network access capability of the vehicle-mounted system is mainly through wired network interfaces, including electrical interfaces and optical interfaces. The electrical interface is generally an Ethernet copper cable interface, which has low cost and is easy to deploy, but the transmission rate and distance are limited, and the anti-interference capability is insufficient. The optical interface is generally a fiber interface, which has the advantages of large bandwidth, low delay and strong anti-interference capability, and is more suitable for applications in high data volume or complex electromagnetic environments. In different use scenarios or device conditions, the vehicle-mounted system usually needs to have public network access capability using both electrical interfaces and optical interfaces.
[0004] In the prior art, in order to realize the communication and public network access of the multi-SoC system, a hardware gateway relay-based method is generally used, that is, independent routing or switching devices are deployed between SoCs to complete data exchange through multi-stage forwarding. Although this method can maintain interconnection, it will destroy the direct connection path between SoCs, resulting in high delay and being unable to meet real-time requirements, especially high real-time requirements related to assisted driving. In addition, there is also a software protocol stack-based method, which relies on a statically configured TCP / IP protocol stack to complete public network access through manual intervention when a network interface change is detected, that is, different physical interfaces are uniformly adapted using upper protocol stack parameters to realize network communication switching between optical interfaces and electrical interfaces. However, manual intervention is usually required during interface switching, and the response time is long.
[0005] In summary, the prior art has the technical problem of slow response in the switching process when implementing public network access of different types of network interfaces. Summary of the Invention
[0006] Therefore, the purpose of this invention is to provide a network interface adaptive switching method.
[0007] A network interface adaptive switching method includes the following steps:
[0008] S1: Monitor the physical layer status of the external network interface and output the target active medium type;
[0009] S2: Based on the current active media type, switch the corresponding hardware interface to obtain an interrupt signal;
[0010] S3A: Dynamically optimizes protocol stack parameters based on interrupt signals and the current active media type to obtain an optimized protocol stack configuration;
[0011] S3B: Updates the security policy based on the interrupt signal and the current active media type to obtain the updated security configuration;
[0012] S4: Enables the current SoC to communicate based on the optimized protocol stack configuration and the updated security configuration, and completes the dynamic switching of the communication network medium.
[0013] The network interface adaptive switching method described in this invention, compared with the prior art, not only realizes network interface switching, but also ensures that the switching process is not limited to the physical layer medium switching through dynamic optimization of protocol stack parameters and synchronous update of security policies. It also enables the protocol stack layer and security configuration to be linked, thereby ensuring the consistency and reliability of public network access, thus avoiding manual intervention and improving the real-time performance, stability and security of multi-SoC systems in the vehicle environment.
[0014] Furthermore, the monitoring is used to determine whether the physical layer state of the current external network interface has changed by reading the register state information of the physical layer chip. When a change occurs and the switching conditions are met, the target active medium type is output. The switching conditions specifically include:
[0015] When the current physical layer state is that neither the electrical port nor the optical port is connected, and then only the optical port is connected, the switching condition is met, and the optical port is used as the target active medium type for output.
[0016] When the current physical layer state is that neither the electrical port nor the optical port is connected, and then only the electrical port is connected, the switching condition is met, and the electrical port is used as the target active medium type for output.
[0017] When the current physical layer state is that only the electrical port is connected, and then the optical port is connected, the switching condition is met, and the optical port is used as the target active medium type.
[0018] When the current physical layer state is that both the electrical port and the optical port are connected at the same time, and then the optical port is unplugged, the switching condition is met, and the electrical port is used as the target active medium type.
[0019] All other physical layer state changes are considered not to meet the switching conditions, so the current interface is maintained and monitoring continues;
[0020] The register status information of the physical layer chip is used to characterize the physical layer access status of the external network interface, and includes optical port link status flag, electrical port link status flag and medium priority configuration bit.
[0021] The optical port link status flag is used to indicate whether the optical port link is in a valid connection state;
[0022] The electrical port link status flag is used to indicate whether the electrical port link is in a valid connection state;
[0023] The media priority configuration bit is used to determine the preferred physical media type when both the optical port and the electrical port are in a connected state.
[0024] Accordingly, this invention reads the register status information of the physical layer chip, combines the optical port link flag bit, the electrical port link flag bit, and the media priority configuration bit to automatically determine the physical layer status of the external network interface, and outputs the target active media type when the switching conditions are met. In this way, the target active media type can be accurately determined in different physical layer change scenarios, thereby ensuring the determinism and uniqueness of the switching process and avoiding the problems of complex manual configuration, error-proneness and switching delay caused by the lack of automated determination in the prior art.
[0025] Furthermore, when dynamically optimizing the protocol stack parameters, the following judgments are also included:
[0026] When an interrupt signal is present and the current active medium type is optical port, the protocol stack parameters are optimized to obtain an optimized protocol stack configuration, which includes increasing the write buffer, disabling delayed acknowledgment, and enabling fast open aggressive mode.
[0027] The increased write buffer is used to improve the caching capacity during high-volume data transmission.
[0028] The disabled delayed acknowledgment is used to shorten the waiting time for TCP acknowledgment messages;
[0029] The enabled fast open aggressive mode is used to skip part of the handshake process when establishing a TCP connection;
[0030] When an interrupt signal is present and the current active medium type is an electrical port, the protocol stack parameters are rolled back to obtain an optimized protocol stack configuration, which includes restoring the write buffer and enabling ECN congestion control.
[0031] The recovery write buffer is used to return to the standard frame length and normal buffer configuration;
[0032] The enabled ECN congestion control is used to explicitly mark congestion when network congestion occurs.
[0033] Accordingly, when the active medium type is optical port, the present invention optimizes the protocol stack parameters, such as increasing the write buffer, disabling delayed acknowledgment, and enabling the fast open aggressive mode, so that the system can make full use of the characteristics of high bandwidth, low latency and low packet loss rate of optical fiber links, thereby enabling the optical port to achieve higher throughput and lower latency when accessing the public network, meeting the requirements of high-speed links for large data transmission and real-time vehicle services.
[0034] In addition, when the active medium type is an Ethernet port, this invention improves the communication stability of the Ethernet port in complex electromagnetic environments or under bandwidth-limited conditions by restoring the write buffer to the standard frame length and normal buffer configuration and enabling ECN congestion control. This allows the sending end to perceive congestion without relying on packet loss, adjust the transmission rate in advance, reduce packet loss and retransmission, and thus improve the robustness and reliability of the communication link in the Ethernet port environment.
[0035] In summary, by dynamically optimizing the protocol stack parameters based on different media types, it is possible to leverage the advantages of high speed and low latency in optical port scenarios, while ensuring communication stability and compatibility in electrical port scenarios. This improves transmission efficiency, real-time performance, and robustness during the process of adaptively switching network interfaces for public network access.
[0036] Furthermore, when updating security policies, the following judgments are also included:
[0037] When an interrupt signal is present and the current active medium type is an optical port, the security policy is updated to obtain the updated security configuration, which specifically includes clearing old NAT rules, updating optical port NAT rules, clearing old DNAT rules, and loading optical port-specific DNAT rules.
[0038] The "Clear Old NAT Rules" rule is used to delete legacy historical address translation rules.
[0039] The updated optical port NAT rules are used to reload network address translation rules when the optical port is used as an external interface;
[0040] The old DNAT clearing rules are used to delete legacy address mapping configurations;
[0041] The loaded optical port dedicated DNAT rule is used to correctly map internal network DNS requests to the optical port dedicated DNS address when the optical port accesses the public network;
[0042] When an interrupt signal is present and the current active medium type is an electrical port, the security policy is updated to obtain the updated security configuration, which specifically includes clearing the old DNAT rules and updating the electrical port DNAT rules.
[0043] The updated Ethernet DNAT rules are used to correctly map internal network DNS requests to the dedicated Ethernet DNS address when the Ethernet port is connected to the public network.
[0044] Accordingly, by synchronously updating and cleaning up the NAT / DNAT security policy during network media switching, this invention can ensure that the public network access policy is consistent with the currently active media, avoiding public network access errors caused by rule residues and inconsistent configurations in the prior art, thereby further improving the reliability and security of the system during the switching process.
[0045] A network interface adaptive switching device includes a media detection unit, an interface switching control unit, a protocol stack parameter optimization unit, a security policy update unit, and a communication execution unit;
[0046] The media detection unit is used to monitor the physical layer status of the external network interface and output the target active media type;
[0047] The interface switching control unit is used to switch the corresponding hardware interface according to the current active media type and obtain an interrupt signal;
[0048] The protocol stack parameter optimization unit is used to dynamically optimize the protocol stack parameters based on the interrupt signal and the current active medium type to obtain the optimized protocol stack configuration.
[0049] The security policy update unit is used to update the security policy based on the interrupt signal and the current active media type to obtain the updated security configuration.
[0050] The communication execution unit is used to enable the current SoC to communicate according to the optimized protocol stack configuration and the updated security configuration, and to complete the dynamic switching of the communication network medium.
[0051] A public network access system for vehicle-mounted multi-SoC includes a slave SoC, a master SoC connected to the slave SoC via wired communication, a physical layer chip connected to the master SoC via wired communication, and an optical port and an electrical port connected to the physical layer chip.
[0052] The slave SoC is a subordinate processing unit in the vehicle platform. It communicates with the master SoC through an intranet interface to send network access requests generated by itself to the master SoC and to receive and process public network return data returned by the master SoC.
[0053] The master SoC is the core processing unit in the vehicle platform. It communicates with the slave SoC and the physical layer chip through the intranet interface. It is used to send network access requests received from the slave SoC or public network access requests generated by itself to the physical layer chip, and forward the public network data returned by the physical layer chip to the slave SoC.
[0054] The physical layer chip is a network physical layer interface device, used to call the aforementioned network interface adaptive switching device according to the network access request of the main control SoC, so as to select the electrical port or the optical port as the physical medium to realize public network access.
[0055] The optical port is a fiber optic physical interface that is electrically connected to the physical layer chip. When the network interface adaptive switching device selects the optical port, it converts the electrical signal of the network access request output by the physical layer chip into an optical signal and transmits it to the public network through the fiber optic medium, thereby completing communication with the public network.
[0056] The electrical port includes a network transformer and a WAN interface; the network transformer is electrically connected to the physical layer chip and is used to couple and isolate the electrical signal of the network access request output by the physical layer chip when the network interface adaptive switching device selects the electrical port, and transmit the processed electrical signal to the WAN interface.
[0057] The WAN interface is connected to the network transformer and is used to transmit the processed electrical signal to the public network through the copper cable medium of the network cable, thereby completing communication with the public network.
[0058] To better understand and implement this invention, the following detailed description is provided in conjunction with the accompanying drawings. Attached Figure Description
[0059] Figure 1 A simplified structural example diagram of a public network access system for multiple SoCs in a vehicle;
[0060] Figure 2 This is a simplified structural diagram of the network interface adaptive switching device described in this invention;
[0061] Figure 3 This is a simplified flowchart illustrating the network interface adaptive switching method described in this invention. Detailed Implementation
[0062] To address the issue of slow response during the switching process when implementing public network access for different types of network interfaces in existing technologies, this invention monitors the physical layer status of the external network interface to obtain the target active medium type. Once the target active medium type changes, the corresponding hardware interface is switched according to the target active medium type, generating an interrupt signal. Based on this interrupt signal and the target active medium type, the protocol stack parameters are dynamically optimized, and the security policy is updated simultaneously, resulting in an optimized protocol stack configuration and an updated security configuration. Ultimately, the current SoC communicates according to the optimized protocol stack configuration and the updated security configuration, completing the dynamic switching of the communication network medium.
[0063] Accordingly, this invention dynamically optimizes protocol stack parameters and updates security policies based on the target active medium type to achieve rapid switching between different types of network interfaces. This avoids the problems of slow switching response and reliance on manual intervention in existing technologies, thereby significantly improving the real-time performance and reliability of public network access and ensuring the stable operation and efficient communication of multi-SoC systems in automotive applications.
[0064] Based on the above design, this invention proposes a network interface adaptive switching method, and based on this method, proposes a network interface adaptive switching device.
[0065] Please see Figure 1 , Figure 1 This is a simplified structural example diagram of a public network access system for multiple SoCs in a vehicle.
[0066] A public network access system for vehicle-mounted multi-SoC includes a slave SoC, a master SoC connected to the slave SoC via wired communication, a physical layer chip connected to the master SoC via wired communication, and an optical port and an electrical port connected to the physical layer chip.
[0067] The slave SoC is a subordinate processing unit in the vehicle platform. It communicates with the master SoC through an intranet interface to send network access requests generated by itself to the master SoC and to receive and process public network return data returned by the master SoC.
[0068] The master SoC is the core processing unit in the vehicle platform. It communicates with the slave SoC and the physical layer chip through the intranet interface. It is used to send network access requests received from the slave SoC or public network access requests generated by itself to the physical layer chip, and forward the public network data returned by the physical layer chip to the slave SoC.
[0069] The physical layer chip (Port Physical Layer, PHY) is a network physical layer interface device used to call a network interface adaptive switching device according to the network access request of the main control SoC, so as to select the electrical port or the optical port as the physical medium to realize public network access.
[0070] The optical port is a fiber optic physical interface that is electrically connected to the physical layer chip. When the network interface adaptive switching device selects the optical port, it converts the electrical signal of the network access request output by the physical layer chip into an optical signal and transmits it to the public network through the fiber optic medium, thereby completing communication with the public network.
[0071] The electrical port includes a network transformer and a WAN interface; the network transformer is electrically connected to the physical layer chip and is used to couple and isolate the electrical signal of the network access request output by the physical layer chip when the network interface adaptive switching device selects the electrical port, and transmit the processed electrical signal to the WAN interface.
[0072] The WAN interface is connected to the network transformer and is used to transmit the processed electrical signal to the public network through the copper cable medium of the network cable, thereby completing communication with the public network.
[0073] Please also refer to Figure 2 and Figure 3 , Figure 2 This is a simplified structural diagram of the network interface adaptive switching device described in this invention. Figure 3 This is a simplified flowchart illustrating the network interface adaptive switching method described in this invention.
[0074] The network interface adaptive switching device includes a media detection unit 1, an interface switching control unit 2, a protocol stack parameter optimization unit 3A, a security policy update unit 3B, and a communication execution unit 4.
[0075] The media detection unit 1 is used to perform step S1: monitor the physical layer status of the external network interface and output the target active media type.
[0076] Specifically, the monitoring is used to determine whether the physical layer state of the current external network interface has changed by reading the register state information of the physical layer chip. When a change occurs and the switching conditions are met, the target active medium type is output. The switching conditions specifically include:
[0077] When the current physical layer state is that neither the electrical port nor the optical port is connected, and then only the optical port is connected, the switching condition is met, and the optical port is used as the target active medium type for output.
[0078] When the current physical layer state is that neither the electrical port nor the optical port is connected, and then only the electrical port is connected, the switching condition is met, and the electrical port is used as the target active medium type for output.
[0079] When the current physical layer state is that only the electrical port is connected, and then the optical port is connected, the switching condition is met, and the optical port is used as the target active medium type.
[0080] When the current physical layer state is that both the electrical port and the optical port are connected at the same time, and then the optical port is unplugged, the switching condition is met, and the electrical port is used as the target active medium type.
[0081] All other physical layer state changes are considered not to meet the switching conditions, so the current interface is maintained and monitoring continues.
[0082] The register status information of the physical layer chip is used to characterize the physical layer access status of the external network interface, and includes optical port link status flag, electrical port link status flag and medium priority configuration bit.
[0083] The optical port link status flag is used to indicate whether the optical port link is in a valid connection state;
[0084] The electrical port link status flag is used to indicate whether the electrical port link is in a valid connection state;
[0085] The media priority configuration bit is used to determine the preferred physical media type when both the optical port and the electrical port are in a connected state. In this invention, the optical port is preferred by default.
[0086] Therefore, when the physical layer chip detects that the optical port link is valid, that is, the optical port is connected, the optical port link status flag is set to a valid value; when the physical layer chip detects that the electrical port link is valid, that is, the electrical port is connected, the electrical port link status flag is set to a valid value; when the physical layer chip detects that both the optical port and the electrical port link are valid, that is, both the optical port and the electrical port are connected, the medium priority configuration bit is set to a valid value, so that the monitoring process determines the target active medium based on the medium priority configuration bit, that is, determines the optical port as the target active medium.
[0087] To configure and read the aforementioned flags and priority strategies, write and query operations can be performed on the physical layer chip's operating mode register and function configuration register to achieve rapid response to changes in the physical layer state of the external network interface and update of flags. For example, the following configuration command can be executed on the physical layer chip:
[0088] #Set 3'b010:UTP_FIBER_TO_RGMII mode
[0089] phy_reg_write 0xA001 0x0004
[0090] #bit[8] (used for optical port priority) + [7] = 1 (Jumbo Frame) + [2:1] = 00 (1-second switching)
[0091] phy_reg_write 0xA006$((0x0100|0x0080|0x0004))
[0092] It should be noted that the above register addresses and bit definitions are for illustrative purposes only. The specific semantics and values should be based on the datasheet of the physical layer chip used.
[0093] The interface switching control unit 2 is used to execute step S2: switch the corresponding hardware interface according to the current active medium type and obtain an interrupt signal.
[0094] Specifically, if the current active medium type is an optical port, the physical layer chip is controlled to shut down the physical layer of the electrical port to achieve hardware-level isolation and complete the link switching. At the same time, an interrupt signal is output to notify the protocol stack to enter the update process.
[0095] If the current active medium type is an electrical port, the physical layer chip is controlled to shut down the physical layer of the optical port to achieve hardware-level isolation and complete the link switching. At the same time, an interrupt signal is output to notify the protocol stack to enter the rollback process.
[0096] It should be noted that during the hardware interface switching process, whether switching from an electrical port to an optical port or vice versa, the update or rollback of protocol stack parameters is involved. Therefore, to ensure the correctness and security of data transmission during the switching process, this invention outputs an interrupt signal to suspend the current network access, and resumes normal communication after the protocol stack has been updated or rolled back.
[0097] In addition, the essence of the hardware-level isolation is to ensure that the system retains only a single external path within the switching window by performing PHY power-off / disabling and MAC queue removal on non-target physical ports, thereby eliminating Layer 2 loops, MAC migration and protocol layer jitter caused by concurrent links, and avoiding broadcast storms and ARP jitter, thus ensuring deterministic low-latency switching and higher security boundaries in real-time vehicle service scenarios.
[0098] The protocol stack parameter optimization unit 3A is used to perform step S3A: dynamically optimize the protocol stack parameters according to the interrupt signal and the current active medium type to obtain the optimized protocol stack configuration.
[0099] Specifically, when an interrupt signal is present and the current active medium type is optical port, the protocol stack parameters are optimized to obtain an optimized protocol stack configuration, which includes increasing the write buffer, disabling delayed acknowledgment, and enabling the FastOpen aggressive mode.
[0100] The increase in write buffer size is used to improve caching capacity during high-volume data transmission and reduce data blocking caused by insufficient buffer. For details, please refer to the following command lines:
[0101] ip link set sfp0 mtu 9000
[0102] sysctl -w net.core.wmem_max = 16777216 # Increase the write buffer
[0103] The disabled delayed acknowledgment is used to shorten the waiting time for TCP acknowledgment messages, thereby reducing communication latency. For details, please refer to the following command lines:
[0104] sysctl -w net.ipv4.tcp_no_delay_ack=1 # Disable delayed acknowledgment
[0105] The "Enable Fast Open Aggressive Mode" is used to skip part of the handshake process when establishing a TCP connection, thereby speeding up the initial connection. For details, please refer to the following command lines:
[0106] sysctl -w net.ipv4.tcp_fastopen=3# radical Fast Open
[0107] When an interrupt signal is present and the current active medium type is an electrical port, the protocol stack parameters are rolled back to obtain an optimized protocol stack configuration, which includes restoring the write buffer and enabling ECN (Explicit Congestion Notification) congestion control.
[0108] The recovery write buffer is used to revert to the standard frame length and normal buffer configuration to ensure compatibility under the electrical interface. For details, please refer to the following command lines:
[0109] ip link set eth0 mtu 1500 # standard MTU
[0110] Enabling ECN congestion control is used to explicitly mark congestion when network congestion occurs, in order to reduce packet loss and improve transmission stability. For details, please refer to the following command lines:
[0111] sysctl -w net.ipv4.tcp_ecn=1 # Enable ECN congestion control
[0112] It should be noted that the above command line is only an implementation example. The specific execution instructions and parameter configurations depend on the operating system kernel and network management tools used. Their semantics and values should be based on the corresponding technical manuals. This invention does not limit them.
[0113] The security policy update unit 3B is used to perform step S3B: update the security policy according to the interrupt signal and the current active media type to obtain the updated security configuration.
[0114] Specifically, when an interruption signal is present and the current active medium type is an optical port, the security policy is updated to obtain the updated security configuration, which specifically includes clearing old NAT (Network Address Translation) rules, updating optical port NAT rules, clearing old DNAT rules, and loading optical port-specific DNAT rules.
[0115] The "Clear Old NAT Rules" command is used to delete legacy address translation rules to avoid conflicts with the current NAT configuration of the optical interface. For details, please refer to the following command lines:
[0116] iptables -t nat -F POSTROUTING # Clear old NAT rules
[0117] The updated optical port NAT rules are used to reload network address translation rules when the optical port is used as an external interface, ensuring that data can be correctly mapped and access the public network. For details, please refer to the following command lines:
[0118] iptables-t nat-A POSTROUTING-o sfp0-j MASQUERADE
[0119] The "Clear Old DNAT Rules" are used to delete legacy address mapping configurations to avoid conflicts with optical port configurations. For details, please refer to the following command lines:
[0120] iptables -t nat -F PREROUTING
[0121] The loaded optical port-specific DNAT rule is used to correctly map internal network DNS requests to the optical port-specific DNS address when the optical port accesses the public network, thereby ensuring the correctness of network access. For details, please refer to the following command lines:
[0122] iptables-t nat-APREROUTING-i eth1-p udp--dport 53-j DNAT--to 10.8.0.1
[0123] When an interrupt signal is present and the current active medium type is an electrical port, the security policy is updated to obtain the updated security configuration, which specifically includes clearing the old DNAT rules and updating the electrical port DNAT rules.
[0124] The updated Ethernet DNAT rules are used to correctly map internal network DNS requests to the dedicated Ethernet DNS address when the Ethernet port is connected to the public network, thus ensuring the correctness of network access. For details, please refer to the following command lines:
[0125] iptables-t nat-A PREROUTING-i eth1-p udp--dport 53-j DNAT--to 8.8.8.8
[0126] Therefore, by updating the security policy as described above, the public network access policy under different physical media can always maintain consistency and correctness.
[0127] The communication execution unit 4 is used to execute step S4: enabling the current SoC to communicate according to the optimized protocol stack configuration and the updated security configuration, thereby completing the dynamic switching of the communication network medium.
[0128] Specifically, if the current SoC is the main control SoC, then the main control SoC, under the optimized protocol stack configuration and updated security configuration, selects the active media type through the physical layer chip to access the public network;
[0129] If the current SoC is a slave SoC, the data traffic of the slave SoC is forwarded to the master SoC via the intranet interface, and public network access is completed through the protocol stack configuration and security configuration of the master SoC. The data returned from the outside is then restored by the master SoC and forwarded to the slave SoC, thereby realizing public network access for multiple SoC systems.
[0130] Compared to existing technologies, this invention can accurately determine the target active medium type by monitoring the physical layer status of the external network interface; and based on this, it automatically completes the optimization of protocol stack parameters and synchronous update of security policies (NAT / DNAT rules) according to the target active medium type, thereby achieving adaptive switching of network interfaces without manual intervention, significantly shortening the switching response time and improving the real-time performance and reliability of public network access.
[0131] Based on the same inventive concept, this application also provides an electronic device, which can be a server, a desktop computing device, or a mobile computing device (e.g., a laptop computing device, a handheld computing device, a tablet computer, a netbook, etc.). The device includes one or more processors and a memory, wherein the processor is used to execute a program to implement the network interface adaptive switching method of the embodiments of the present invention; the memory is used to store computer programs executable by the processor.
[0132] Based on the same inventive concept, this application also provides a computer-readable storage medium corresponding to the aforementioned embodiment of a network interface adaptive switching method. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the steps of the network interface adaptive switching method described in any of the above embodiments.
[0133] This application may take the form of a computer program product implemented on one or more storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing program code. Computer storage media include permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information may be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to: phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device.
[0134] The embodiments described above are merely examples of several implementations of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and the present invention also intends to include these modifications and variations.
Claims
1. A network interface adaptive switching method, characterized in that, Includes the following steps: S1: Monitor the physical layer status of the external network interface and output the target active medium type; S2: Based on the current active media type, switch the corresponding hardware interface to obtain an interrupt signal; S3A: Dynamically optimizes protocol stack parameters based on interrupt signals and the current active media type to obtain an optimized protocol stack configuration; S3B: Updates the security policy based on the interrupt signal and the current active media type to obtain the updated security configuration; S4: Enables the current SoC to communicate based on the optimized protocol stack configuration and the updated security configuration, and completes the dynamic switching of the communication network medium.
2. The network interface adaptive switching method according to claim 1, characterized in that, The monitoring is used to determine whether the physical layer state of the current external network interface has changed by reading the register state information of the physical layer chip. When a change occurs and the switching conditions are met, the target active medium type is output. The switching conditions specifically include: When the current physical layer state is that neither the electrical port nor the optical port is connected, and then only the optical port is connected, the switching condition is met, and the optical port is used as the target active medium type for output. When the current physical layer state is that neither the electrical port nor the optical port is connected, and then only the electrical port is connected, the switching condition is met, and the electrical port is used as the target active medium type for output. When the current physical layer state is that only the electrical port is connected, and then the optical port is connected, the switching condition is met, and the optical port is used as the target active medium type. When the current physical layer state is that both the electrical port and the optical port are connected at the same time, and then the optical port is unplugged, the switching condition is met, and the electrical port is used as the target active medium type. All other physical layer state changes are considered not to meet the switching conditions, so the current interface is maintained and monitoring continues; The register status information of the physical layer chip is used to characterize the physical layer access status of the external network interface, and includes optical port link status flag, electrical port link status flag and medium priority configuration bit. The optical port link status flag is used to indicate whether the optical port link is in a valid connection state; The electrical port link status flag is used to indicate whether the electrical port link is in a valid connection state; The media priority configuration bit is used to determine the preferred physical media type when both the optical port and the electrical port are in a connected state.
3. The network interface adaptive switching method according to claim 2, characterized in that, When dynamically optimizing protocol stack parameters, the following checks are also performed: When an interrupt signal is present and the current active medium type is optical port, the protocol stack parameters are optimized to obtain an optimized protocol stack configuration, which includes increasing the write buffer, disabling delayed acknowledgment, and enabling fast open aggressive mode. The increased write buffer is used to improve the caching capacity during high-volume data transmission. The disabled delayed acknowledgment is used to shorten the waiting time for TCP acknowledgment messages; The enabled fast open aggressive mode is used to skip part of the handshake process when establishing a TCP connection; When an interrupt signal is present and the current active medium type is an electrical port, the protocol stack parameters are rolled back to obtain an optimized protocol stack configuration, which includes restoring the write buffer and enabling ECN congestion control. The recovery write buffer is used to return to the standard frame length and normal buffer configuration; The enabled ECN congestion control is used to explicitly mark congestion when network congestion occurs.
4. The network interface adaptive switching method according to claim 3, characterized in that, When updating security policies, the following checks are also performed: If an interrupt signal is present and the current active media type is an optical port, the security policy is updated to obtain the updated security configuration, which specifically includes: Clear old NAT rules, update optical port NAT rules, clear old DNAT rules, and load optical port-specific DNAT rules; The "Clear Old NAT Rules" rule is used to delete legacy historical address translation rules. The updated optical port NAT rules are used to reload network address translation rules when the optical port is used as an external interface; The old DNAT clearing rules are used to delete legacy address mapping configurations; The loaded optical port dedicated DNAT rule is used to correctly map internal network DNS requests to the optical port dedicated DNS address when the optical port accesses the public network; When an interrupt signal is present and the current active medium type is an electrical port, the security policy is updated to obtain the updated security configuration, which specifically includes clearing the old DNAT rules and updating the electrical port DNAT rules. The updated Ethernet DNAT rules are used to correctly map internal network DNS requests to the dedicated Ethernet DNS address when the Ethernet port is connected to the public network.
5. A network interface adaptive switching device, characterized in that, It includes a media detection unit, an interface switching control unit, a protocol stack parameter optimization unit, a security policy update unit, and a communication execution unit; The media detection unit is used to monitor the physical layer status of the external network interface and output the target active media type; The interface switching control unit is used to switch the corresponding hardware interface according to the current active media type and obtain an interrupt signal; The protocol stack parameter optimization unit is used to dynamically optimize the protocol stack parameters based on the interrupt signal and the current active medium type to obtain the optimized protocol stack configuration. The security policy update unit is used to update the security policy based on the interrupt signal and the current active media type to obtain the updated security configuration. The communication execution unit is used to enable the current SoC to communicate according to the optimized protocol stack configuration and the updated security configuration, and to complete the dynamic switching of the communication network medium.
6. The network interface adaptive switching device according to claim 5, characterized in that, The monitoring in the media detection unit is used to determine whether the physical layer state of the current external network interface has changed by reading the register state information of the physical layer chip. When a change occurs and the switching conditions are met, the target active media type is output. The switching conditions specifically include: When the current physical layer state is that neither the electrical port nor the optical port is connected, and then only the optical port is connected, the switching condition is met, and the optical port is used as the target active medium type for output. When the current physical layer state is that neither the electrical port nor the optical port is connected, and then only the electrical port is connected, the switching condition is met, and the electrical port is used as the target active medium type for output. When the current physical layer state is that only the electrical port is connected, and then the optical port is connected, the switching condition is met, and the optical port is used as the target active medium type. When the current physical layer state is that both the electrical port and the optical port are connected at the same time, and then the optical port is unplugged, the switching condition is met, and the electrical port is used as the target active medium type. All other physical layer state changes are considered not to meet the switching conditions, so the current interface is maintained and monitoring continues; The register status information of the physical layer chip is used to characterize the physical layer access status of the external network interface, and includes optical port link status flag, electrical port link status flag and medium priority configuration bit. The optical port link status flag is used to indicate whether the optical port link is in a valid connection state; The electrical port link status flag is used to indicate whether the electrical port link is in a valid connection state; The media priority configuration bit is used to determine the preferred physical media type when both the optical port and the electrical port are in a connected state.
7. The network interface adaptive switching device according to claim 6, characterized in that, When dynamically optimizing the protocol stack parameters, the protocol stack parameter optimization unit also includes performing the following judgment: When an interrupt signal is present and the current active medium type is optical port, the protocol stack parameters are optimized to obtain an optimized protocol stack configuration, which includes increasing the write buffer, disabling delayed acknowledgment, and enabling fast open aggressive mode. The increased write buffer is used to improve the caching capacity during high-volume data transmission. The disabled delayed acknowledgment is used to shorten the waiting time for TCP acknowledgment messages; The enabled fast open aggressive mode is used to skip part of the handshake process when establishing a TCP connection; When an interrupt signal is present and the current active medium type is an electrical port, the protocol stack parameters are rolled back to obtain an optimized protocol stack configuration, which includes restoring the write buffer and enabling ECN congestion control. The recovery write buffer is used to return to the standard frame length and normal buffer configuration; The enabled ECN congestion control is used to explicitly mark congestion when network congestion occurs; The security policy update unit, when updating the security policy, further includes performing the following judgment: When an interrupt signal is present and the current active medium type is an optical port, the security policy is updated to obtain the updated security configuration, which specifically includes clearing old NAT rules, updating optical port NAT rules, clearing old DNAT rules, and loading optical port-specific DNAT rules. The "Clear Old NAT Rules" rule is used to delete legacy historical address translation rules. The updated optical port NAT rules are used to reload network address translation rules when the optical port is used as an external interface; The old DNAT clearing rules are used to delete legacy address mapping configurations; The loaded optical port dedicated DNAT rule is used to correctly map internal network DNS requests to the optical port dedicated DNS address when the optical port accesses the public network; When an interrupt signal is present and the current active medium type is an electrical port, the security policy is updated to obtain the updated security configuration, which specifically includes clearing the old DNAT rules and updating the electrical port DNAT rules. The updated Ethernet DNAT rules are used to correctly map internal network DNS requests to the dedicated Ethernet DNS address when the Ethernet port is connected to the public network.
8. A public network access system for vehicle-mounted multi-SoCs, characterized in that, It includes a slave SoC, a master SoC that is wired / communicating with the slave SoC, a physical layer chip that is wired / communicating with the master SoC, and an optical port and an electrical port that are connected to the physical layer chip; The slave SoC is a subordinate processing unit in the vehicle platform. It communicates with the master SoC through an intranet interface to send network access requests generated by itself to the master SoC and to receive and process public network return data returned by the master SoC. The master SoC is the core processing unit in the vehicle platform. It communicates with the slave SoC and the physical layer chip through the intranet interface. It is used to send network access requests received from the slave SoC or public network access requests generated by itself to the physical layer chip, and forward the public network data returned by the physical layer chip to the slave SoC. The physical layer chip is a network physical layer interface device, used to call the network interface adaptive switching device according to any one of claims 5-7 above, based on the network access request of the main control SoC, to select the electrical port or the optical port as the physical medium to realize public network access. The optical port is a fiber optic physical interface that is electrically connected to the physical layer chip. When the network interface adaptive switching device selects the optical port, it converts the electrical signal of the network access request output by the physical layer chip into an optical signal and transmits it to the public network through the fiber optic medium, thereby completing communication with the public network. The electrical port includes a network transformer and a WAN interface; the network transformer is electrically connected to the physical layer chip and is used to couple and isolate the electrical signal of the network access request output by the physical layer chip when the network interface adaptive switching device selects the electrical port, and transmit the processed electrical signal to the WAN interface. The WAN interface is connected to the network transformer and is used to transmit the processed electrical signal to the public network through the copper cable medium of the network cable, thereby completing communication with the public network.
9. An electronic device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, when the processor executes the computer program, it implements a network interface adaptive switching method as described in any one of claims 1-4.
10. A computer-readable storage medium storing computer-executable instructions, characterized in that, When the computer-executable instructions are executed by the processor, they implement a network interface adaptive switching method as described in any one of claims 1-4.
Citation Information
Cited By
Network reliability enhancement method in industrial control scene
CN121509203A