Vehicle-mounted ethernet ring network link switching method and system, vehicle and storage medium
Patent Information
- Application Number
- CN202310392187.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-12
- Publication Date
- 2026-09-22
- Estimated Expiration
- 2043-04-12
AI Technical Summary
[0005]本申请提供一种车载以太环网链路切换方法、系统、交通工具及存储介质,以至少解决相关技术中车载以太环网在链路切换过程中造成通信阻塞的技术问题
[0032]需要说明的是,第二方面至第五方面中的任一种实现方式所带来的技术效果可参见第一方面中对应实现方式所带来的技术效果,此处不再赘述。
Smart Images

Figure CN116455699B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of vehicle communication technology, specifically to a vehicle-mounted Ethernet ring network link switching method, system, vehicle, and storage medium. Background Technology
[0002] With the development of vehicular networks, the adoption of cost-effective Ethernet technology to build network links has become an unstoppable trend. Ethernet is generally deployed in a ring topology network structure, using two ports to interconnect with adjacent devices on both sides, forming a ring topology network including a closed link, i.e., an Ethernet ring network. Among them, Ethernet ring protection switch (ERPS) is an Ethernet-based protection switching technology, and its application in Ethernet ring networks is increasing.
[0003] Currently, the common method in related technologies is to call the switch port function to implement the protection switching function of Ethernet ring network. However, this method depends on the call time of the switch port function, which can cause communication blockage during implementation and affect the performance of the vehicle system.
[0004] Therefore, how to avoid congestion during the switching process of vehicle-mounted Ethernet ring network links is an urgent problem to be solved. Summary of the Invention
[0005] This application provides a method, system, vehicle, and storage medium for link switching in a vehicular Ethernet ring network, to at least solve the technical problem of communication congestion caused during link switching in vehicular Ethernet ring networks in related technologies. The technical solution of this application is as follows:
[0006] According to a first aspect of this application, a method for switching links in a vehicle-mounted Ethernet ring network is provided. The Ethernet ring network includes a master node and multiple slave nodes, wherein the slave nodes connected to the master node via a ring protection link are adjacent nodes. The method includes:
[0007] Execute the first cycle task, and then execute the second cycle task;
[0008] The first cycle task includes polling the status of the master node and multiple slave nodes;
[0009] The second phase of tasks includes:
[0010] When the return value of the first cycle task is the first return value, the target link is blocked, and the ring protection link is enabled; the first return value is used to characterize the slave nodes with fault states at both ends of the target link.
[0011] When the return value of the first cycle task is the second return value, the blocking ring protects the link and the target link is opened; the second return value is used to indicate that the slave nodes at both ends of the target link are in a normal state.
[0012] The technical solution provided in this application provides at least the following beneficial effects: Vehicle-mounted Ethernet ring networks have stringent requirements regarding the effectiveness of message transmission, the time consumed by message transmission, and the time of message response. In related technologies, the protection switching function of the Ethernet ring network is typically implemented by calling the switch port function. However, this method relies on the call time of the switch port function, which can lead to communication congestion during implementation, affecting the performance of the vehicle system. To address this, this application's embodiment polls the status of each node in the Ethernet ring network in the first cycle task and performs the Ethernet ring network link switching in the second cycle task. Through asynchronous processing, the first and second cycle tasks are scheduled and executed with the same priority, preventing preemption and reducing the time spent waiting for polling results from each node in the Ethernet network during the Ethernet ring network link switching process, thus avoiding communication congestion.
[0013] In one possible implementation, when the return value of the first cycle task is the first return value, blocking the target link and opening the ring protection link includes: blocking the ports of the slave nodes at both ends of the target link, and opening the secondary ports of the master node and the secondary ports of the adjacent nodes, so that the ring protection link is opened, and the secondary ports of the master node are connected to the secondary ports of the adjacent nodes through the ring protection link.
[0014] In one possible implementation, when the return value of the first cycle task is the second return value, the blocking ring protection link and the opening of the target link include: blocking the secondary port of the master node and opening the ports of the slave nodes at both ends of the target link.
[0015] In one possible implementation, the second cycle task further includes updating the forwarding tables of the master node and multiple slave nodes, wherein the forwarding table of the master node includes the outgoing port of the message, and the outgoing port of the message is used to indicate the output port of the message.
[0016] As can be seen from the above embodiments, by updating the forwarding tables of the master node and multiple slave nodes, the correspondence between the MAC addresses and outgoing ports of the master node and multiple slave nodes can be updated to ensure the normal operation of the Ethernet ring network.
[0017] In one possible implementation, the first cycle task further includes: obtaining the VLAN members of the slave nodes at both ends of the target link; and issuing a prompt message when the VLAN members of the slave nodes at both ends of the target link are inconsistent with the preset VLAN members, the prompt message being used to indicate a target link connection error.
[0018] As can be seen from the above embodiments, when the VLAN members of the slave nodes at both ends of the target link are inconsistent with the preset VLAN members, it indicates that the two slave nodes connected to the target link are different from the two preset slave nodes. In this case, the user needs to be prompted to check the link connection to determine whether it needs to be modified.
[0019] According to the second aspect provided in this application, a vehicle-mounted Ethernet ring network link switching system is provided, including a processing module.
[0020] Used to execute the first cycle task, and to execute the second cycle task;
[0021] The first cycle task includes polling the status of the master node and multiple slave nodes;
[0022] The second phase of tasks includes:
[0023] When the return value of the first cycle task is the first return value, the target link is blocked, and the ring protection link is enabled; the first return value is used to characterize the slave nodes with fault states at both ends of the target link.
[0024] When the return value of the first cycle task is the second return value, the blocking ring protects the link and the target link is opened; the second return value is used to indicate that the slave nodes at both ends of the target link are in a normal state.
[0025] In one possible implementation, the above-mentioned processing module is further configured to block the ports of the slave nodes at both ends of the target link, and to open the secondary ports of the master node and the adjacent nodes, so that the ring protection link is enabled, and the secondary ports of the master node are connected to the secondary ports of the adjacent nodes through the ring protection link.
[0026] In one possible implementation, the above-mentioned processing module is also used to block the secondary port of the master node and open the ports of the slave nodes at both ends of the target link.
[0027] In one possible implementation, the above-mentioned processing module is further configured to update the forwarding tables of the master node and multiple slave nodes. The forwarding table of the master node includes the outgoing port of the message, which is used to indicate the output port of the message.
[0028] In one possible implementation, the Ethernet ring network link switching system further includes an acquisition module and a prompting module. The acquisition module is used to acquire the VLAN members of the slave nodes at both ends of the target link, and the prompting module is used to issue a prompting message when the VLAN members of the slave nodes at both ends of the target link are inconsistent with the preset VLAN members. The prompting message is used to indicate that the target link connection is incorrect.
[0029] According to a third aspect provided in this application, a vehicle is provided, comprising: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute instructions to implement the method described in the first aspect and any possible implementation thereof.
[0030] According to a fourth aspect provided in this application, a computer-readable storage medium is provided that, when the instructions in the computer-readable storage medium are executed by a processor of a vehicle, enables the vehicle to perform the methods described in the first aspect and any possible implementation thereof.
[0031] According to the fifth aspect provided in this application, a computer program product is provided, the computer program product including computer instructions that, when executed on a vehicle, cause the vehicle to perform the method described in the first aspect and any possible implementation thereof.
[0032] It should be noted that the technical effects of any of the implementation methods in aspects two through five can be found in the technical effects of the corresponding implementation methods in aspect one, and will not be repeated here.
[0033] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0034] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application, and do not constitute an undue limitation of this application.
[0035] Figure 1 This is a schematic diagram illustrating the structure of an in-vehicle Ethernet ring network link switching system according to an exemplary embodiment;
[0036] Figure 2 This is a schematic diagram of another vehicle-mounted Ethernet ring network link switching system according to an exemplary embodiment;
[0037] Figure 3 This is a schematic diagram illustrating an application scenario of a vehicle-mounted Ethernet ring network link switching method according to an exemplary embodiment;
[0038] Figure 4 This is a schematic diagram illustrating a method flow for switching links in a vehicle-mounted Ethernet ring network according to an exemplary embodiment;
[0039] Figure 5 This is a schematic diagram illustrating a cycle task allocation method in an RTOS according to an exemplary embodiment;
[0040] Figure 6This is a flowchart illustrating yet another method for switching links in a vehicle-mounted Ethernet ring network according to an exemplary embodiment;
[0041] Figure 7 This is a block diagram illustrating an in-vehicle Ethernet ring network link switching system according to an exemplary embodiment;
[0042] Figure 8 This is a block diagram illustrating a means of transportation according to an exemplary embodiment. Detailed Implementation
[0043] To enable those skilled in the art to better understand the technical solutions of this application, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings.
[0044] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0045] To facilitate understanding, a brief introduction to the relevant concepts involved in this application will be provided first.
[0046] 1. Ethernet ring protection switching (ERPS) is a highly reliable and stable Ethernet ring network link layer technology. When the Ethernet ring is intact, it can prevent the network from forming broadcast storms, and when the Ethernet ring experiences a link failure, it can quickly restore the communication path between the nodes on the ring and has a high convergence speed.
[0047] Users configure each device on the ERPS ring as a different node, including a master node and slave nodes. The slave nodes connected to the master node via the ring protection link (RPL) are adjacent nodes. Both the master and slave nodes include two ports, each with a blocking state and a forwarding state. In the forwarding state, the port forwards all types of packets, and in the blocking state, it forwards link failure packets (signal fall, SF) and link recovery packets.
[0048] The master node operates as follows: it periodically sends fault detection messages to the slave nodes. If the master node receives the fault detection message within a preset time, it indicates that all links in the Ethernet ring network are in normal condition. If the master node does not receive the fault detection message within the preset time, it indicates that there is a faulty link in the Ethernet ring network. In this case, the master node sets both of its ports to forwarding mode.
[0049] The slave nodes operate as follows: When the target link is in a faulty state, the slave nodes at both ends of the target link set the port status connected to the target link to a blocked state and send link fault messages to the master node and adjacent nodes, respectively. When the target link recovers to a normal state, the slave nodes at both ends of the target link send link recovery messages to the master node and adjacent nodes, respectively. The target link can be any ordinary link other than an RPL in the Ethernet ring network.
[0050] After the master node receives a link failure message or link recovery message from the slave node, the master node reduces the time interval for sending fault detection messages. When the master node detects a change in the target link status, it resets the status of the master node port and clears the MAC address forwarding table. Then, it sends topology change messages to the two ports of the target link respectively. After the two slave nodes connected to the target link receive the topology change messages, they reset the port status and clear the MAC address forwarding table, thereby realizing the switching of the Ethernet ring network link.
[0051] like Figure 1 As shown, under normal Ethernet ring network conditions, port 1 of the master node and port 1 of the adjacent node are in a blocked state, meaning the RPL link is not enabled. Port 2 of the master node, port 2 of the adjacent node, and all ports of slave nodes a and b are in a forwarding state. The master node periodically sends fault detection messages to slave node a.
[0052] like Figure 2 As shown, taking the link between slave node a and slave node b as the target link as an example, when the target link is in a fault state, the master node cannot receive the fault detection message within a preset time. At this time, the master node opens port 1 and the adjacent node opens port 1, that is, the RPL link is opened. Slave node a and slave node b send link fault messages to the adjacent node and the master node respectively, and port 2 of slave node a and slave node b is set to the blocked state.
[0053] After the target link is restored, slave node a and slave node b send link restoration messages to their neighboring nodes and the master node, respectively. Upon receiving the link restoration message, the master node sets port 1 to a blocking state, and the neighboring nodes also set their ports to a blocking state to block the RPL link. Simultaneously, ports 2 of slave node a and slave node b are set to forwarding state, thus restoring the Ethernet ring network link to its normal state. Figure 1 The state shown.
[0054] 2. Automotive open system architecture (AutoSAR) is a set of standard protocols for automotive technology development. The Classic AutoSar platform is AutoSAR's solution for traditional vehicle control embedded systems, with strict real-time and security limitations.
[0055] 3. The ETHSWT module provides a unified Ethernet switch driver, offering a unified port for controlling and configuring Ethernet switches, driving different Ethernet switches, and coordinating MAC learning.
[0056] 4. Virtual Local Area Network (VLAN) technology can divide a physical LAN into multiple logical LANs—VLANs. Each VLAN is a broadcast domain. VLANs can be divided based on ports, defining VLAN members according to device ports. After a specified port is added to a specified VLAN, the port can forward packets of that VLAN.
[0057] 5. An Ethernet forwarding table, also known as a MAC address table, is a Layer 2 forwarding table that contains the mapping between MAC addresses and outgoing ports. It guides packet forwarding and is fundamental for Ethernet switches to achieve fast Layer 2 packet forwarding. In an Ethernet environment, hosts on the same network segment need to know each other's MAC addresses to communicate. The MAC address table includes the MAC address, VLAN ID, and outgoing port. When a packet arrives at the switch, it can look up the outgoing port of the packet in the MAC address table based on the destination MAC address and VLAN ID in the packet.
[0058] 6. Real-time operating system (RTOS) is used to allocate hardware resources to software modules to support multi-tasking software operation modes, including various periodic tasks.
[0059] As described in the background section, in related technologies, the protection switching function of an Ethernet ring network is usually implemented by calling the switch port function. However, when calling the switch port function, this method requires synchronous operation of the switch register mode to obtain the status of each node in the Ethernet ring network. The microcontroller unit (MCU) must wait for the return value of reading and writing the switch register before it can determine how to perform the Ethernet ring network link switching operation based on the return value of the switch register. This will cause communication congestion and affect the performance of the vehicle system.
[0060] In view of this, in the embodiments of this application, the status of each node in the Ethernet ring network is polled in the first cycle task, and the Ethernet ring network link is switched in the second cycle task. By using asynchronous processing, the waiting time for polling results during the Ethernet ring network link switching process is reduced, and communication blockage is avoided.
[0061] The vehicle-mounted Ethernet ring network link switching method provided in this application embodiment can be applied to, for example... Figure 3 The vehicle-mounted Ethernet ring network link switching system shown.
[0062] Figure 3 This application illustrates an exemplary embodiment of an in-vehicle Ethernet ring network link switching method in an application scenario, such as... Figure 3 As shown, the Ethernet ring network in this embodiment consists of three nodes: node A, node B, and node C. Node A is the master node, node B is the neighboring node, and node C is the slave node. The link between node A and node B is an RPL link, and the link between node B and node C is a normal link. The number of slave nodes in this embodiment can be multiple, and this embodiment does not impose any limitation on this.
[0063] In some embodiments, node A includes switch A and controller A, node B includes switch B and controller B, and node C includes switch C and controller C. The link between port 1 of node A and port 0 of node C is a normal link, the link between port 1 of node C and port 0 of node B is a normal link, and the link between port 0 of node A and port 1 of node B is an RPL link.
[0064] In some embodiments, the switch is used to automatically learn the MAC address table and forward packets according to the MAC address table.
[0065] Optionally, the switches at each node in the Ethernet ring network can form a ring network, with each switch having two ports (port0 and port1), forming a ring network topology. The link between the master node's switch and the switches of adjacent nodes is an RPL (Remote Link Link). RPL is not enabled under normal Ethernet ring network conditions but is enabled when a normal link in the Ethernet ring network fails.
[0066] In some embodiments, the controller is used to send instructions to the switch to block or open a port.
[0067] In some embodiments, a controller refers to a device that can generate operation control signals based on instruction opcodes and timing signals, instructing the switch to execute control instructions. Exemplarily, the controller can be a central processing unit (CPU), a network processor (NP), a digital signal processor (DSP), a microprocessor, a microcontroller, a programmable logic device (PLD), or any combination thereof. The controller can also be other devices with processing capabilities, such as circuits, devices, or software modules; this application does not impose any limitations on these aspects.
[0068] In some embodiments, the controller can be a microcontroller unit (MCU). An MCU, also known as a single-chip microcomputer, is a chip-level computer that integrates a central processing unit (CPU) with appropriately reduced frequency and specifications, along with peripheral interfaces such as memory, timer, USB, A / D converter, UART, PLC, DMA, and even LCD driver circuitry, all onto a single chip. This allows for different combinations of control for various applications.
[0069] For example, continue as follows Figure 3 As shown, controllers A, B, and C are MCUs. When the Ethernet ring network link is in a normal state, the MCU (controller A) of node A sends a command to switch A, instructing switch A to set port 1 of node A to the open state and port 0 to the blocked state. When there is a link failure in the Ethernet ring network, the MCU of node A sends a command to switch A, instructing switch A to set both port 1 and port 0 of node A to the open state.
[0070] For ease of understanding, the following detailed description of the vehicle-mounted Ethernet ring network link switching method provided in this application is provided in conjunction with the accompanying drawings.
[0071] The vehicle-mounted Ethernet ring network link switching method provided in this application embodiment can be applied to the ClassicAutoSar platform. For other software development platforms, the Ethernet ring network link switching can also be implemented with reference to this application embodiment. This application embodiment does not impose any limitations.
[0072] Figure 4 This is a flowchart illustrating a method for switching links in a vehicular Ethernet ring network according to an exemplary embodiment. Figure 4 As shown, in this Ethernet ring network link switching method, the first cycle task is executed through the RTOS, and the second cycle task is executed.
[0073] The first cycle task includes polling the status of the master node and multiple slave nodes. For example, the first cycle task can be a 5ms cycle task in the runtime environment (RTE) module.
[0074] In some embodiments, the RTOS queries the status of the master node and each slave node by calling the query function of the Classic AutoSar platform, including the RTOS polling the switch status and cache configuration of the master node and multiple slave nodes.
[0075] Optionally, the status of the master node and multiple slave nodes includes a fault status and a normal status, where the fault status is that the switch cannot respond to the controller's control commands, and the normal status is that the switch can respond to the controller's control commands.
[0076] For example, when the master node detects a link failure, it marks the faulty link as faulty, sends a topology change message from the master node's secondary port, and then updates the MAC address table of the master node's secondary port. After receiving the topology change message sent by the master node, the slave nodes at both ends of the faulty link mark the faulty link as faulty and update the MAC address tables of the slave nodes at both ends of the faulty link, so as to block the ports at both ends of the faulty link.
[0077] For example, the first cycle task is a 5ms cycle task in the RTOS. Every 5ms, the RTOS calls a query function to check the status of the master node and each slave node. If the query function returns the first return value (i.e., the first cycle task returns the first return value), it indicates that there is a link failure in the Ethernet ring network. If the query function returns the second return value (i.e., the first cycle task returns the second return value), it indicates that all links in the Ethernet ring network are in normal condition. The first and second return values can be set by the developers; for example, the first return value can be "0" and the second return value can be "1".
[0078] Among them, continue as Figure 4 As shown, the second cycle task includes the following steps S101-S102.
[0079] S101. When the return value of the first cycle task is the first return value, block the target link and enable RPL.
[0080] The first return value is used to characterize the slave nodes that are in a fault state at both ends of the target link.
[0081] For example, the second cycle task can be a 10ms cycle task in the RTE module.
[0082] In some embodiments, when the return value of the first cycle task is a first return value, the ports of the slave nodes at both ends of the target link are blocked, and the secondary ports of the master node are opened to enable RPL. The slave nodes at both ends of the target link include the slave nodes at both ends of the target link.
[0083] As one possible implementation, when the first cycle task returns the first return value, the controllers of the slave nodes at both ends of the target link send control commands to their respective switches to block the ports on the slave nodes connected to both ends of the target link. The controller of the master node sends a control command to its switch to open its secondary port. The controllers of adjacent nodes send control commands to their switches to open their secondary ports, thereby blocking the target link and enabling the RPL link between the secondary port of the master node and the secondary port of the adjacent node.
[0084] Optionally, the `EthSwt_EnableVlan` port function can be extended to enable or disable a specific port, thereby adding VLAN functionality to Ethernet frames. A new `EthSwt_SetDestPortsByMacAddrVlanId` port function can be added to modify outgoing port members based on MAC address and VLAN ID, configuring the forwarding table. Configuring the forwarding table allows for the control of port blocking and enabling.
[0085] In this way, when the return value of the first cycle task is the first return value, the ports of the slave nodes at both ends of the target link are disabled, and the MAC address tables of the ports of the slave nodes at both ends of the target link are updated to block the ports of the slave nodes at both ends of the target link. At the same time, the secondary ports of the master node are enabled, and the MAC address tables of the ports of the master node and the slave nodes adjacent to the master node are updated to enable RPL.
[0086] S102. When the return value of the first cycle task is the second return value, block RPL and start the target link.
[0087] The second return value is used to indicate that the slave nodes at both ends of the target link are in a normal state.
[0088] In some embodiments, when the return value of the first cycle task is the second return value, the secondary port of the master node is blocked, and the ports of the slave nodes at both ends of the target link are opened.
[0089] As one possible implementation, when the return value of the first cycle task is the second return value, the controller of the master node sends a control command to the master node's switch to block the master node's secondary port. Similarly, the controllers of adjacent nodes send control commands to the adjacent nodes' switches to block the adjacent nodes' secondary ports, thus blocking RPL. The controllers of the slave nodes at both ends of the target link send control commands to their respective switches to open the two ports connected to the target link, thereby enabling the target link.
[0090] Optionally, the `EthSwt_EnableVlan` function disables the secondary ports of the master node, and the `EthSwt_SetDestPortsByMacAddrVlanId` function updates the MAC address tables of the secondary ports of the master node and the ports of the adjacent slave nodes, thereby blocking RPL. The `EthSwt_EnableVlan` function enables the ports of the slave nodes at both ends of the target link, and the `EthSwt_SetDestPortsByMacAddrVlanId` function updates the MAC address tables of the slave nodes at both ends of the target link, thereby enabling the target link.
[0091] In related technologies, assuming each port has n VLANs, when switching links in an Ethernet ring network, it is necessary to disconnect the n VLANs of the slave node on the faulty link, enable the n VLANs of the secondary port of the master node, and perform configuration operations on the forwarding table.
[0092] For example, when n is 3 and the number of data traffic VLANs is 6, when switching Ethernet ring network links, the EthSwt_EnableVlan port function needs to be called 6 times and the EthSwt_SetDestPortsByMacAddrVlanId port function needs to be called 12 times. If each call to the EthSwt_EnableVlan port function takes 2ms and each call to the EthSwt_SetDestPortsByMacAddrVlanId port function takes 1ms, then when blocking the slave nodes at both ends of the target link and opening the secondary ports of the master node, or blocking the secondary ports of the master node and opening the slave nodes at both ends of the target link, the RTOS will need to spend 5*2ms + 12*1ms = 22ms. During this process, after calling the port function, the status of the master node and multiple slave nodes needs to be queried. The next operation can only be performed after receiving the query return value, which may cause communication blockage.
[0093] Figure 4 The illustrated embodiment offers at least the following advantages: In-vehicle Ethernet ring networks have stringent requirements regarding message transmission effectiveness, message transmission time, and message response time. While related technologies typically implement protection switching functionality in Ethernet ring networks by calling switch port functions, this method relies on the call time of the switch port functions, which can lead to communication congestion during implementation, impacting the performance of the in-vehicle system. Therefore, as... Figure 5 As shown, in the embodiment of this application, the status of each node in the Ethernet ring network is polled in the first cycle task, and the Ethernet ring network link is switched in the second cycle task. Through asynchronous processing, the first cycle task and the second cycle task are scheduled and executed with the same priority, without preemption. At the same time, the waiting time for polling results during the Ethernet ring network link switching process is reduced, and communication blockage is avoided.
[0094] In some embodiments, the second cycle task described above also includes updating the forwarding tables of the master node and multiple slave nodes.
[0095] The forwarding table, also known as the MAC address table, includes the outgoing port of the message in the master node's forwarding table. The outgoing port of the message is used to indicate the output port of the message.
[0096] Optionally, the forwarding table includes the mapping between MAC addresses and VLAN IDs and outgoing ports. The forwarding tables of the master node and multiple slave nodes can be updated via a 2ms periodic task in the RTE module.
[0097] One possible way to achieve this is to update the forwarding table by modifying the outgoing port corresponding to the MAC address and VLAN ID in the forwarding table.
[0098] In this way, by updating the forwarding tables of the master node and multiple slave nodes, the correspondence between the MAC addresses and outgoing ports of the master node and multiple slave nodes can be updated to ensure the normal operation of the Ethernet ring network.
[0099] In some embodiments, such as Figure 6 As shown, the second cycle task mentioned above also includes the following steps S201-S202.
[0100] S201. Obtain the VLAN members of the slave nodes at both ends of the target link.
[0101] Optionally, you can obtain the VLAN members under the switch port by adding the EthSwt_GetVlanMembersOfSpecPort port function.
[0102] S202. When the VLAN members of the slave nodes at both ends of the target link are inconsistent with the preset VLAN members, a prompt message is issued.
[0103] The error message indicates a target link connection error. Preset VLAN members can be the VLAN members of the switch ports configured by the user.
[0104] For example, when the VLAN members of the slave nodes at both ends of the target link obtained by adding the EthSwt_GetVlanMembersOfSpecPort port function are inconsistent with the preset VLAN members, a "link connection error" message is displayed to the user.
[0105] As can be seen from the above embodiments, when the VLAN members of the slave nodes at both ends of the target link are inconsistent with the preset VLAN members, it indicates that the two slave nodes connected to the target link are different from the two preset slave nodes. In this case, the user needs to be prompted to check the link connection to determine whether it needs to be modified.
[0106] In some embodiments, the EthSwt_DelArlEntryByDestPort port function is added to delete outgoing port information based on the target port and VLAN ID.
[0107] In some embodiments, the EthIf_RxIndication port function is extended to add an outgoing port for the destination MAC address to the existing source address of an Ethernet frame.
[0108] In some embodiments, a new port function, EthSwt_GetDestPortsByMacAddrVlanId, is added to retrieve port members based on the MAC address and VLAN ID. This allows for verification of whether the newly added EthSwt_SetDestPortsByMacAddrVlanId port function has been successfully implemented.
[0109] In some embodiments, if the switching of the Ethernet ring network link cannot be completed within the duration of a first cycle task, the port function is called in segments.
[0110] For example, the port function can be called 3-4 times in a second task cycle. When n is 3, the total number of calls to the EthSwt_EnableVlan port function and the EthSwt_SetDestPortsByMacAddrVlanId port function is 18, requiring a maximum of 18 / 3 = 6 second task cycles. During this process, the execution time of the first cycle task is 5ms * 6 = 30ms. Although this is 8ms longer than the 22ms Ethernet ring network link switching time, the use of asynchronous calls will not cause communication blockage and will increase the stability of the vehicle-mounted Ethernet ring network link switching system.
[0111] The above primarily describes the solutions provided by the embodiments of this application from a methodological perspective. To achieve the above functions, the Ethernet ring network link switching system includes corresponding hardware structures and / or software modules for executing each function. Those skilled in the art should readily recognize that, based on the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0112] This application embodiment can, based on the above method, exemplarily divide an Ethernet ring network link switching system into functional modules. For example, the Ethernet ring network link switching system may include functional modules corresponding to each functional division, or two or more functions may be integrated into one processing module. The integrated module can be implemented in hardware or as a software functional module. It should be noted that the module division in this application embodiment is illustrative and only represents one logical functional division; in actual implementation, there may be other division methods.
[0113] Figure 7 This is a block diagram illustrating an in-vehicle Ethernet ring network link switching system 10 according to an exemplary embodiment. (Refer to...) Figure 7 The Ethernet ring network link switching system 10 includes: a processing module 101, an acquisition module 102, and a prompting module 103.
[0114] In some embodiments, the processing module 101 can be used to execute a first periodic task and a second periodic task. The first periodic task includes polling the status of the master node and multiple slave nodes. The second periodic task includes: when the return value of the first periodic task is a first return value, blocking the target link and enabling RPL; the first return value indicates that there are faulty slave nodes at both ends of the target link; when the return value of the first periodic task is a second return value, blocking RPL and enabling the target link; the second return value indicates that the slave nodes at both ends of the target link are in a normal state.
[0115] In some embodiments, the processing module 101 can be used to block the ports of the slave nodes at both ends of the target link, and to open the secondary ports of the master node and the adjacent nodes, so that the RPL is enabled, and the secondary ports of the master node are connected to the secondary ports of the adjacent nodes through the RPL.
[0116] In some embodiments, the processing module 101 can be used to block the secondary port of the master node and open the ports of the slave nodes at both ends of the target link.
[0117] In some embodiments, the processing module 101 can be used to update the forwarding tables of the master node and multiple slave nodes. The forwarding table of the master node includes the outgoing port of the message, which is used to indicate the output port of the message.
[0118] In some embodiments, the acquisition module 102 can be used to acquire the VLAN members of the slave nodes at both ends of the target link.
[0119] In some embodiments, the prompting module 103 can be used to issue a prompting message when the VLAN members of the slave nodes at both ends of the target link are inconsistent with the preset VLAN members. The prompting message is used to indicate that the target link connection is incorrect.
[0120] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0121] Figure 8 This is a block diagram illustrating a means of transportation according to an exemplary embodiment. Figure 8 As shown, the vehicle 800 includes, but is not limited to, a processor 801 and a memory 802.
[0122] The aforementioned memory 802 is used to store the executable instructions of the aforementioned processor 801. It is understood that the aforementioned processor 801 is configured to execute instructions to implement the vehicle-mounted Ethernet ring network link switching method in the above embodiment.
[0123] It should be noted that those skilled in the art will understand that Figure 8 The vehicle structure shown does not constitute a limitation on the vehicle; the vehicle may include, but is not limited to, other vehicles. Figure 8 This may indicate more or fewer components, or combinations of certain components, or different component arrangements.
[0124] The processor 801 is the control center of the vehicle, connecting various parts of the vehicle via various ports and lines. It performs various functions and processes data by running or executing software programs and / or modules stored in the memory 802, and by calling data stored in the memory 802, thereby providing overall monitoring of the vehicle. The processor 801 may include one or more processing units. Optionally, the processor 801 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, while the modem processor mainly handles wireless communication. It is understood that the modem processor may also not be integrated into the processor 801.
[0125] The memory 802 can be used to store software programs and various data. The memory 802 may primarily include a program storage area and a data storage area. The program storage area may store the operating system, application programs required by at least one functional module (such as a determination unit, processing unit, etc.), etc. Furthermore, the memory 802 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0126] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 802 including instructions, which can be executed by a processor 801 of a vehicle 800 to implement the vehicle-mounted Ethernet ring network link switching method in the above embodiments.
[0127] In actual implementation, Figure 7 The functions of the processing module 101, the acquisition module 102, and the prompting module 103 can all be provided by... Figure 8 The processor 801 calls the computer program stored in the memory 802 to implement the process. The specific execution process can be found in the description of the Ethernet ring network link switching method in the previous embodiment, and will not be repeated here.
[0128] Optionally, the computer-readable storage medium may be a non-transitory computer-readable storage medium, such as a read-only memory (ROM), random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device.
[0129] In an exemplary embodiment, this application also provides a computer program product including one or more instructions, which can be executed by a processor 801 of a vehicle to complete the vehicle-mounted Ethernet ring network link switching method in the above embodiments.
[0130] It should be noted that when one or more instructions in the computer-readable storage medium or computer program product are executed by the processor of the vehicle, they implement the various processes of the above-described Ethernet ring network link switching method embodiment and achieve the same technical effect as the above-described Ethernet ring network link switching method. To avoid repetition, they will not be described again here.
[0131] Through the above description of the embodiments, those skilled in the art can clearly understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0132] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between devices or units through some ports, and may be electrical, mechanical, or other forms.
[0133] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units; that is, it can be located in one place or distributed in multiple different locations. Some or all of the classified units can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0134] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0135] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiments of this application, essentially, or the part that contributes to the prior art, or a complete or partial classification of the technical solution, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.
[0136] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for switching links in a vehicle-mounted Ethernet ring network, characterized in that, The Ethernet ring network includes a master node and multiple slave nodes, wherein the slave nodes connected to the master node via a ring protection link are adjacent nodes, and the method includes: The first cycle task is executed through a real-time operating system (RTOS), and then the second cycle task is executed; the first cycle task and the second cycle task are scheduled and executed with the same priority, and no preemption occurs; The first periodic task includes polling the status of the master node and the plurality of slave nodes; The second cycle of tasks includes: When the return value of the first periodic task is the first return value, the target link is blocked, and the ring protection link is enabled; the first return value is used to characterize the slave nodes with fault states at both ends of the target link; When the return value of the first cycle task is the second return value, the ring protection link is blocked, and the target link is opened; the second return value is used to indicate that the slave nodes at both ends of the target link are in a normal state; The method further includes: Obtain the VLAN members of the slave nodes at both ends of the target link; When the VLAN members of the slave nodes at both ends of the target link are inconsistent with the preset VLAN members, a prompt message is issued to indicate that the target link connection is incorrect.
2. The method according to claim 1, characterized in that, The steps of blocking the target link and enabling the ring protection link when the return value of the first periodic task is the first return value include: The ports of the slave nodes at both ends of the target link are blocked, and the secondary ports of the master node and the adjacent node are opened, so that the ring protection link is opened, and the secondary port of the master node is connected to the secondary port of the adjacent node through the ring protection link.
3. The method according to claim 2, characterized in that, The step of blocking the ring protection link and opening the target link when the return value of the first periodic task is the second return value includes: Block the secondary port of the master node and open the ports of the slave nodes at both ends of the target link.
4. The method according to any one of claims 1 to 3, characterized in that, The second cycle task also includes: Update the forwarding tables of the master node and the plurality of slave nodes. The forwarding table of the master node includes the outgoing port of the message, which is used to indicate the output port of the message.
5. A vehicle-mounted Ethernet ring network link switching system, characterized in that, include: The processing module is configured to execute a first-cycle task and a second-cycle task through a real-time operating system (RTOS); the first-cycle task and the second-cycle task are scheduled and executed with the same priority and no preemption occurs. The first periodic task includes polling the status of the master node and multiple slave nodes; The second cycle of tasks includes: When the return value of the first periodic task is the first return value, the target link is blocked, and the ring protection link is enabled; the first return value is used to characterize the slave nodes with fault states at both ends of the target link; When the return value of the first cycle task is the second return value, the ring protection link is blocked, and the target link is opened; the second return value is used to indicate that the slave nodes at both ends of the target link are in a normal state; The acquisition module is used to acquire the VLAN members of the slave nodes at both ends of the target link; The prompting module is used to issue a prompting message when the VLAN members of the slave nodes at both ends of the target link are inconsistent with the preset VLAN members. The prompting message is used to indicate that the target link connection is incorrect.
6. The vehicle-mounted Ethernet ring network link switching system according to claim 5, characterized in that, Also includes: The processing module is also used to block the ports of the slave nodes at both ends of the target link, and to open the secondary ports of the master node and the adjacent nodes, so that the ring protection link is opened, and the secondary ports of the master node are connected to the secondary ports of the adjacent nodes through the ring protection link. The processing module is also used to block the secondary port of the master node and open the ports of the slave nodes at both ends of the target link; The processing module is also used to update the forwarding table of the master node and the plurality of slave nodes. The forwarding table of the master node includes the outgoing port of the message, and the outgoing port of the message is used to indicate the output port of the message.
7. A means of transportation, characterized in that, The system includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the vehicle-mounted Ethernet ring network link switching method as described in any one of claims 1 to 4.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions that, when executed on a computer, cause the computer to perform the vehicle-mounted Ethernet ring network link switching method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Vehicle-mounted Ethernet ring network protection switching method and device, electronic equipment and storage medium
CN115695082A