Port testing method, device, system and vehicle

By configuring switch ports into a closed ring link, and using test messages to transmit and detect return messages in the ring link, the difference between automotive Ethernet and traditional Ethernet interfaces is resolved, achieving efficient port function detection and simplified connection.

CN119030892BActive Publication Date: 2025-10-28CHONGQING SELIS PHOENIX INTELLIGENT INNOVATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410984893.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-22
Publication Date
2025-10-28
Estimated Expiration
2044-07-22

AI Technical Summary

Technical Problem

The physical layer and interface differences between automotive Ethernet and traditional Ethernet make direct connection impossible. Most existing Ethernet boxes are designed as single-channel 100M, which limits the monitoring capability of multiple interfaces. Furthermore, using multiple Ethernet boxes is inefficient and increases the difficulty of configuration management, which cannot meet the vehicle ECU's monitoring needs for the status of multiple Ethernet channels.

Method used

By connecting multiple ports of a switch into a closed loop link, a test message is sent through the first port and transmitted within the closed loop link. The port function is determined by detecting the returned message, thus avoiding the tedious process of sending test messages to each port individually.

Benefits of technology

It enables efficient detection of the functions of all ports on the switch, simplifies the connection method, improves detection efficiency, and solves the problem of inability to connect directly due to differences in port types.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119030892B_ABST
    Figure CN119030892B_ABST
Patent Text Reader

Abstract

This invention provides a port testing method, apparatus, system, and vehicle, belonging to the field of switch technology, for testing multiple ports of a switch. The method includes: assembling multiple ports into a closed loop link; wherein a first port among the multiple ports is the start and end node of the closed loop link, and a second port (excluding the first port) among the multiple ports is an intermediate node in the closed loop link; sending a test message to the first port to transmit the test message in the closed loop link; obtaining a return message output by the first port after the test message has been transmitted in the closed loop link; and determining whether the multiple ports are functioning correctly based on the return message. The port testing method provided in this embodiment can solve the problem of switch ports being unable to directly connect to external devices due to differences in port configuration by setting up a closed loop link.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of switch technology, specifically relating to a port testing method, device, system, and vehicle. Background Technology

[0002] Vehicle Ethernet differs from traditional Ethernet in physical layer and interface, making it impossible to directly connect vehicle Ethernet to a computer for monitoring. To address this, an Ethernet box (such as a T1 to TX converter) is needed for signal conversion. However, most Ethernet boxes on the market are currently designed for single-channel 100M, limiting their ability to monitor multiple interfaces. Furthermore, using multiple Ethernet boxes is not only inefficient but also increases configuration management complexity, failing to meet the monitoring needs of the vehicle's ECU (Electronic Control Unit) for multiple Ethernet channels. Summary of the Invention

[0003] In view of the above problems, embodiments of this application provide a port testing method, apparatus, system, and vehicle to overcome or at least partially solve the above problems.

[0004] In a first aspect, this application provides a port testing method for testing multiple ports of a switch, the method comprising:

[0005] The plurality of ports are assembled into a closed loop link; wherein, the first port among the plurality of ports is the starting node and the ending node of the closed loop link, and the second port among the plurality of ports other than the first port is the intermediate node of the closed loop link;

[0006] Send a test message to the first port so that the test message is transmitted in the closed loop link;

[0007] The return message is obtained after the test message is transmitted in the closed loop link and then output through the first port.

[0008] Based on the returned message, determine whether the functions of the multiple ports are normal.

[0009] Furthermore, the plurality of second ports includes two third ports connected to the first port, and the test message carries a tag;

[0010] The step of sending a test message to the first port to enable the test message to be transmitted in the closed loop link includes:

[0011] The test message is sent to the first port so that the first port can determine the target port from the two third ports based on the tag;

[0012] The test message is sent from the first port to the target port, so that after the test message is transmitted through the target port, it is fed back to the first port by one of the two third ports other than the target port.

[0013] Furthermore, during the transmission of the test message in the closed ring link, the method further includes:

[0014] The tag is processed using the second port that currently receives the test message, so that the test message is sent to the next second port;

[0015] The tag processing includes: stripping the tag when the received test message carries the tag; and adding the tag when the received test message does not carry the tag.

[0016] Further, the step of forming a closed loop link from the first port and the multiple second ports includes:

[0017] Obtain the arrangement order among the multiple ports;

[0018] Based on the arrangement order, the connection method between two adjacent ports on the closed loop link is determined; wherein, the connection method includes harness connection and local area network connection;

[0019] Based on the connection method, multiple ports are combined into a closed ring link.

[0020] Further, determining the connection method between two adjacent ports on the closed loop link based on the arrangement order includes:

[0021] If two adjacent ports connected on the closed loop link have the same port type, then the two ports are identified as the harness connection.

[0022] If two adjacent ports connected on the closed loop link have the same port type, then the two ports are determined to be the local area network connection.

[0023] Furthermore, determining whether the functions of the multiple ports are normal based on the returned message includes:

[0024] Obtain the transmission direction of the test message in the closed ring link;

[0025] Based on the transmission direction, a preset return message is determined; wherein, the preset return message is a test message of the correct test result returned by the first port when the multiple ports are functioning normally;

[0026] The system compares the returned message with the preset returned message to determine whether the functions of the multiple ports are normal.

[0027] Furthermore, the step of comparing the returned message with the preset returned message to determine whether the functions of the multiple ports are normal includes:

[0028] Within a preset test period, the first number of times the test message is sent and the second number of times the return message is output from the first port are obtained;

[0029] Based on the difference between the first count and the second count, and the difference between the returned message and the preset returned message, it is determined whether the multiple ports are normal.

[0030] A second aspect of this application provides a port testing apparatus for testing multiple ports of a switch, the apparatus comprising:

[0031] A component module is used to form a closed loop link from the plurality of ports; wherein, the first port among the plurality of ports is the starting node and the ending node in the closed loop link, and the second port among the plurality of ports other than the first port is the intermediate node in the closed loop link;

[0032] A sending module is configured to send a test message to the first port so that the test message is transmitted in the closed loop link;

[0033] The acquisition module is used to acquire the return message output through the first port after the test message is transmitted in the closed ring link;

[0034] The determination module is used to determine whether the functions of the multiple ports are normal based on the returned message.

[0035] Furthermore, the plurality of second ports includes two third ports connected to the first port, and the test message carries a tag;

[0036] The sending module includes:

[0037] The first determining module is configured to send the test message to the first port, so that the first port can determine the target port from the two third ports according to the tag;

[0038] The test message is sent from the first port to the target port, so that after the test message is transmitted through the target port, it is fed back to the first port by one of the two third ports other than the target port.

[0039] Furthermore, during the transmission of the test message in the closed ring link, the sending module further includes:

[0040] The configuration module is used to perform tag processing on the tag using the second port that currently receives the test message, so that the test message is sent to the next second port;

[0041] The tag processing includes: stripping the tag when the received test message carries the tag; and adding the tag when the received test message does not carry the tag.

[0042] Furthermore, the component module includes:

[0043] The first acquisition module is used to acquire the arrangement order among the plurality of ports;

[0044] Based on the arrangement order, the connection method between two adjacent ports on the closed loop link is determined; wherein, the connection method includes harness connection and local area network connection;

[0045] Based on the connection method, multiple ports are combined into a closed ring link.

[0046] Further, the first acquisition module includes:

[0047] The second determining module is used to determine that the two ports connected adjacent to each other on the closed loop link are the wire harness connection if the port types of the two ports are the same.

[0048] If two adjacent ports connected on the closed loop link have the same port type, then the two ports are determined to be the local area network connection.

[0049] Furthermore, the determining module includes:

[0050] The second acquisition module is used to acquire the transmission direction of the test message in the closed ring link;

[0051] Based on the transmission direction, a preset return message is determined; wherein, the preset return message is a message of the correct test result returned by the first port when the multiple ports are functioning normally;

[0052] The system compares the returned message with the preset returned message to determine whether the functions of the multiple ports are normal.

[0053] Further, the first acquisition module includes:

[0054] The third determining module is used to obtain, within a preset test period, the first number of times the test message is sent and the second number of times the return message is output by the first port;

[0055] Based on the difference between the first count and the second count, and the difference between the returned message and the preset returned message, it is determined whether the multiple ports are normal.

[0056] A third aspect of this application provides a port testing system, the system comprising: a main controller and a switch connected to the main controller; wherein the switch includes multiple ports, including a first port connected to the main controller and multiple second ports; wherein the main controller is used to execute the port testing method as described in the first aspect of this application.

[0057] In a fourth aspect of this application, a vehicle is provided, the vehicle including the port testing device described in the second aspect of this application.

[0058] The port testing method provided in this embodiment firstly establishes multiple ports into a closed loop link; the first port among the multiple ports is the starting node and the ending node of the closed loop link, and the second port among the multiple ports other than the first port is the intermediate node of the closed loop link. Then, a test message is sent to the first port to transmit the test message in the closed loop link; then, the return message output by the first port after the test message has been transmitted in the closed loop link is obtained; finally, based on the return message, it is determined whether the functions of the multiple ports are normal.

[0059] By connecting the first port of a switch to multiple second ports to form a closed loop link, all ports in the entire closed loop link can be tested simply by sending test messages to the first port, avoiding the tedious process of sending test messages to each port individually. Secondly, after the test messages are transmitted in the closed loop link, only the return messages output by the first port need to be checked to determine whether multiple ports are functioning correctly at once, improving testing efficiency. The closed loop link setup allows the first port to act as both the start and end node, replacing the previous method of connecting multiple Ethernet boxes to each port separately. In this way, the first port acts as a single connection point to external testing devices (such as computers), solving the problem of inability to directly connect due to port differences. Attached Figure Description

[0060] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0061] Figure 1 This is a flowchart illustrating the steps of a port testing method provided in an embodiment of this application;

[0062] Figure 2 This is a schematic diagram of a port testing system and external devices provided in an embodiment of this application;

[0063] Figure 3 This is a schematic diagram of a configuration table provided in an embodiment of the application;

[0064] Figure 4 against Figure 2 and Figure 3 A flowchart of the steps for port testing is provided.

[0065] Figure 5 This is a schematic diagram of a port testing device provided in an embodiment of this application. Detailed Implementation

[0066] Exemplary embodiments of this application will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of this application are shown in the drawings, it should be understood that this application may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of this application and to fully convey the scope of this application to those skilled in the art.

[0067] In existing solutions, each port is typically connected to a separate Ethernet box via an Ethernet cable, which is then routed to a computer for testing. However, in practice, different port types exist in switches, and the interfaces of the Ethernet boxes vary accordingly. Most Ethernet boxes use 100M interfaces, with other types being rare. Using Ethernet boxes as adapters to assist the computer in testing the switch ports is inconvenient and costly.

[0068] In view of this, this embodiment provides a port testing method to solve the above problems. A closed loop link is formed by connecting a first port and multiple second ports of a switch. The first port is then connected to an external device, and a test message is sent to this port for transmission within the closed loop link. The external device can be a computer or a microcontroller, used to send the test message to the first port. By obtaining and detecting the return message through the first port, the functional status of all ports in the switch can be determined at once, avoiding the tedious process of configuring and testing each port individually, and improving testing efficiency.

[0069] Specifically, refer to Figure 1 , Figure 1 This is a flowchart illustrating the steps of a port testing method provided in an embodiment of this application. Figure 1 The port testing methods described herein are used to test multiple ports of a switch. Figure 1 The steps and procedures include:

[0070] Step S101: Assemble the plurality of ports into a closed loop link; wherein, the first port among the plurality of ports is the starting node and the ending node of the closed loop link, and the second port among the plurality of ports other than the first port is the intermediate node of the closed loop link.

[0071] In this embodiment, the switch has multiple ports, which can be of the same or different types. The first and second ports are connected end-to-end in a closed loop, with the first port serving as both the start and end node. This allows the first port to be configured for connection to external devices, simplifying the connection process. By using only one first port as an interface for receiving test messages and outputting return messages, the problem of needing multiple Ethernet boxes for connection due to port type differences, and thus preventing direct connection to external devices, can be solved. This improves the compatibility between automotive Ethernet and traditional Ethernet. The external device is a device that performs functional testing on the multiple ports of the switch; it can be a computer or other testing equipment.

[0072] Step S102: Send a test message to the first port so that the test message is transmitted in the closed loop link.

[0073] In this embodiment, since the switch can be configured with a MAC address table that records the correspondence between all MAC addresses in the network and the ports of the switch, when a port of the switch receives an Ethernet packet, it parses the Ethernet packet, looks up the MAC address in the MAC address table based on the destination MAC address of the test packet frame, obtains the port corresponding to that address, and then forwards the test packet out of that port. If the destination MAC address in the test packet frame is not in the MAC address table, it is forwarded to all ports. If the sent test packet is a broadcast frame or a multicast frame, it will also be forwarded to all ports.

[0074] Therefore, by referring to the internal packet forwarding logic of the switch and configuring multiple ports in the switch accordingly, external devices can send test packets to the first port so that the test packets enter the closed loop link for transmission through the first port. Based on the transmission status of the test packets in the closed loop link, the functional status of each port in the switch and the connection status with external devices can be verified.

[0075] Step S103: Obtain the return message output through the first port after the test message is transmitted in the closed ring link.

[0076] In this embodiment, since the test message has been sent to the first port, after the test message is sent to the first port, it will be processed and forwarded through all the second ports in the closed loop in sequence until the last processing is completed and it is forwarded to the first port. Then the first port outputs the return message indicating that the closed loop has completed the test of the test message.

[0077] Step S104: Based on the returned message, determine whether the functions of the multiple ports are normal.

[0078] In this embodiment, since each second port in the closed loop link processes the test message, the information carried in the test message is adjusted during the processing. Since the closed loop link is established before the test message, it is known that after the test message is transmitted through the closed loop link, the corresponding correct preset return message is output by the first port.

[0079] Therefore, by comparing the returned message with the preset returned message, when the returned message is consistent with the preset returned message, it can be determined that the functions of multiple ports in the switch are normal. In practice, if there is environmental influence, some error is allowed. It can also be determined that the functions of multiple ports in the switch are normal when the difference between the returned message and the preset returned message is not significant.

[0080] The port testing method provided in this embodiment allows a closed loop link to be formed by connecting the first port of a switch with multiple second ports. The first port is then connected to an external device (such as a computer), and test messages are sent to transmit within the closed loop link. By detecting the test messages returned through the first port, the functional status of all ports in the switch can be determined at once, avoiding the tedious process of configuring and testing each port individually, thus improving testing efficiency.

[0081] In one specific embodiment, the plurality of second ports includes two third ports connected to the first port, and the test message carries a tag; sending the test message to the first port to enable the test message to be transmitted in the closed loop link may include the following steps:

[0082] First, the test message is sent to the first port so that the first port can determine the target port from the two third ports according to the tag; then the first port sends the test message to the target port so that after the test message is transmitted through the target port, it is fed back to the first port by the port other than the target port among the two third ports.

[0083] In this embodiment, since the link formed by the first port and the second port is a closed loop link, and among the multiple second ports there are two third ports connected to the first port, and the first port is the start node and the end node in the closed loop link, then for the closed loop link, the transmission direction of the test message in the closed loop link will have two directions. If the two third ports are A and B, assuming that the direction of transmission along A is the first direction, then the direction opposite to the first direction is the direction of transmission along B, denoted as the second direction. The start node and the end node are determined according to the transmission direction of the test message in the closed loop link. The test message is transmitted through the first port in different directions, and finally, different return messages are output through the first port.

[0084] For example, suppose there are four second ports: Port0, Port1, Port2, and Port3; Port9 is a first port; and Port0 and Port3 are third ports. Assuming the first direction is Port9→Port0→Port1→Port2→Port3→Port9, then the second direction is Port9→Port3→Port2→Port1→Port0→Port9. Since the return messages for the first and second directions are different, to ensure the correctness of the preset return messages, tags can be added to the test messages to indicate the transmission direction indicated by the tags.

[0085] Therefore, after receiving the test message at the first port, the first port will determine the third port corresponding to the tag from the two adjacent third ports, i.e., the target port, based on the tag carried in the test message. If the tag indicates that Port0 is the target port, the test message sent by the first port will be transmitted to Port0; if the tag indicates that Port3 is the target port, the test message sent by the first port will be transmitted to Port3. Since the transmission mode of the closed loop link is unidirectional, the transmission direction can be determined simply by adding the tag corresponding to Port3 or Port0 to the test message. At the same time, the first port can also determine the transmission direction of the test message by recognizing the tag carried in the test message. In this embodiment, the tag carried in the test message can be a local area network tag, i.e., Port0 and Port9, and Port3 and Port9 are set to different local area networks. Port9 and Port0 and Port3 have different port types and cannot be directly connected by a wiring harness. If the test message carries the same local area network tag as Port0 and Port9, then Port9 can recognize it and directly transmit the test message to Port0.

[0086] In one specific embodiment, during the transmission of the test message in the closed ring link, the method may further include the following steps:

[0087] The tag is processed using the second port that currently receives the test message, so that the test message is sent to the next second port; wherein, the tag processing includes: stripping the tag if the received test message carries the tag; and adding the tag if the received test message does not carry the tag.

[0088] In this embodiment, since the closed loop link has two transmission directions and the transmission mode of the closed loop link is unidirectional, in order to ensure that the test transmission is correct and sequential in the closed loop link, and to facilitate the differentiation between the return messages obtained from the first and second directions, the second port, which acts as an intermediate node, will be used to process the tags carried in the test messages. In this embodiment, the first port is only used to connect to external devices and only forwards the test messages without processing them.

[0089] The following section further elaborates on the tag processing in the test message during its transmission in the first direction:

[0090] When a tag corresponding to Port0 is added to the test message, it is sent to Port9. Port9 will recognize the tag in the test message and determine that the next port to receive the test message is Port0. After receiving the test message, Port0 will still read the information of the test message and read the configuration table corresponding to multiple ports in the switch. The configuration table contains the tags corresponding to multiple ports in the switch, and one tag corresponds to two ports. Then it determines that the next port to receive the test message is Port1. If a tag exists, the tag will be deleted and the test message will be forwarded to the next port to receive the test message, Port1. If the tag is not deleted, it may indicate that the next port to receive the test message for Port1 is Port0, which does not satisfy the unidirectional transmission along the first direction.

[0091] If the received test message does not carry a tag, the tag corresponding to the second port currently receiving the test message needs to be added to the test message so that the next second port receiving the test message knows the source of the test message. For example, if the second port is Port1, the tag corresponding to Port1 is added to the test message. If Port2 receives this test message, it knows that the test message is transmitted in the first direction. Then, in the configuration table, it can be found that the next second port receiving the test message along the first direction is Port3. If the tag corresponding to Port2 is not added, by querying the configuration table, it will be found that the next second port receiving the test message is Port1 and Port3. There are second ports in two directions, which cannot meet the requirement of unidirectional transmission of test messages.

[0092] Therefore, if the test message received at the second port carries a label, the label is stripped before forwarding. If the test message received at the second port does not carry a label, a label is added before forwarding. In the transmission of the test message within the closed loop link, multiple second ports are typically paired to enable bidirectional transmission and reception of test messages. If the test message is transmitted in the first direction, the final return message will carry the same label as Port3; if the test message is transmitted in the second direction, the final return message will carry the same label as Port0. In this embodiment, it is important to note that the label addition process refers to adding the label corresponding to the second port currently processing the test message. This facilitates the identification of whether the return message is correct.

[0093] In one specific embodiment, the step of forming a closed loop link from the first port and the multiple second ports may include the following steps:

[0094] First, the arrangement order of the multiple ports is obtained; then, based on the arrangement order, the connection method between two adjacent ports on the closed loop link is determined; wherein, the connection method includes harness connection and local area network connection; finally, based on the connection method, the multiple ports are assembled into the closed loop link.

[0095] In this embodiment, the first port and multiple second ports are configured into a closed loop link. Ports of the same type mean they have the same communication rate. When port types are the same, a wiring harness connection can be used for transmission. However, since the switch contains ports of different types, wiring harness connections alone are insufficient. Therefore, to allow transmission between ports of different types, a local area network (LAN) connection is introduced to connect different types of interfaces. Since the transmission of test packets in the closed loop link is unidirectional, following a predetermined route, it is necessary to obtain the arrangement order of the multiple ports. This arrangement order reveals the port types of adjacent ports, allowing for the determination of the connection method based on the port types. Finally, the multiple ports are configured into a closed loop link through the connection method of the first port and multiple second ports.

[0096] In one specific embodiment, determining the connection method between two adjacent ports on the closed loop link based on the arrangement order may include the following steps: if the two adjacent ports on the closed loop link have the same port type, determine that the two ports are the harness connection; if the two adjacent ports on the closed loop link have the same port type, determine that the two ports are the local area network connection.

[0097] In this embodiment, the port types of two adjacent ports connected on a closed loop link can be determined based on the arrangement order. When the port types are the same, test message forwarding and reception can be achieved through a wiring harness connection. When the port types are different, test message forwarding and reception cannot be achieved through a wiring harness connection, and a local area network connection will be selected to achieve test message forwarding and reception between two ports with different port types. In a specific embodiment, determining whether the functions of the multiple ports are normal based on the returned message may include the following steps:

[0098] First, the transmission direction of the test message in the closed loop link is obtained; then, based on the transmission direction, a preset return message is determined; wherein, the preset return message is the message of the correct test result returned by the first port when the multiple ports are functioning normally; finally, the return message is compared with the preset return message to determine whether the multiple ports are functioning normally.

[0099] In this embodiment, to determine whether the functions of multiple ports are normal by returning messages, the transmission direction of the test message in the closed loop link can be obtained first. Specifically, this can be known through the tag carried by the test message. By knowing the transmission direction through the tag, the correct test result message returned by the first port when the multiple ports are functioning normally can be predicted, i.e., the preset return message.

[0100] For example, suppose a closed ring link consists of five ports (Port0, Port1, Port2, Port3, and Port9), connected sequentially to form a ring. Test messages are sent starting from Port9, with Port1 as the first port and the remaining ports as second ports. Since it's a closed ring link, the test message passes sequentially through Port1, Port2, and Port3 within the ring, finally reaching Port9. Under normal functional conditions, the test message should return from Port3 to Port9. Therefore, the default return message is a transmission from Port3 to Port9, carrying a tag for Port9. If the return message from Port1 does not carry the tag for Port3, it indicates that multiple ports are malfunctioning; if the return message from Port1 carries the tag for Port3, it indicates that multiple ports are functioning correctly.

[0101] In one specific embodiment, determining whether the functions of the plurality of ports are normal by comparing the returned message with the preset returned message may include the following steps: within a preset test period, obtaining a first number of times the test message is sent and a second number of times the returned message is output by the first port; determining whether the plurality of ports are normal based on the difference between the first number and the second number, and the difference between the returned message and the preset returned message.

[0102] In this embodiment, to verify whether multiple ports are functioning correctly and to avoid accidental erroneous determinations of multiple ports as malfunctioning, test packets are typically sent to the first port multiple times over a period of time. Therefore, within a preset test period, the difference between the first number of test packets sent and the second number of return packets output by the first port, as well as the difference between the return packets and the preset return packets, are used to determine whether multiple ports are functioning correctly. Assuming the allowable error is within 5%, the first number is 100, the second number is 96, and the difference between the first and second numbers is 4. This is within the allowable error range, and the return packets are also within the allowable error range if they match the preset return packets. In this case, multiple ports are determined to be functioning correctly. If there is a difference between the first number of test packets sent and the second number of return packets output by the first port, or if the difference between the return packets and the preset return packets exceeds the allowable error range, then multiple ports of the switch are determined to be malfunctioning.

[0103] This application also provides a port testing system, the system comprising: a main controller and a switch connected to the main controller; wherein the switch includes multiple ports, including a first port connected to the main controller and multiple second ports; wherein the main controller is used to execute the port testing method as described in the embodiment.

[0104] In this embodiment, combined with Figures 2-4 The port testing method provided in this embodiment is applied to multiple port testing in a switch, and is described in detail below:

[0105] Reference Figure 2 , Figure 2 This is a schematic diagram of a port testing system and external devices provided in an embodiment of this application; from Figure 2 As can be seen, the MCU (Microcontroller Unit) is the main controller, and the switch is connected to the MCU. The switch and the MCU are part of the electronic control unit in the vehicle. In this way, the MCU can be directly connected to external devices (computers) without having to connect each port of the switch to the computer through an Ethernet box for testing. The switch has 5 Ethernet channels, namely Port0, Port1, Port2, Port3 and Port9. Assuming that Port0 and Port1 have the same interface type, which is 100BASE_T1 interface, and Port2 and Port3 have the same interface type, which is 1000BASE_T1 interface, Port0, Port1, Port2 and Port3 are the second ports, and Port9 is the first port.

[0106] The connection methods for each Ethernet channel are as follows:

[0107] Port9 connects to the MCU via the SGMII protocol, using four wires: TX (data transmit signal), TXCLK (data transmit clock signal), RX (data receive signal), and RXCLK (data receive clock signal). Ports 0 and 1 are connected via a wiring harness. The 100BASE_T1 harness has two wires, which can be connected arbitrarily without polarity. Ports 2 and 3 are also connected via a wiring harness. The 1000BASE_T1 harness also has two wires, but with distinct polarity. Positive wires must be connected to positive wires, and negative wires to negative wires; otherwise, communication will fail. The computer and MCU's CAN bus are connected via a wiring harness and a CAN adapter box.

[0108] In Ethernet packet forwarding on a switch, the IEEE 802.1Q protocol adds a 4-byte LAN tag to ordinary Ethernet packets. One of these tags is a test packet, which is the tag corresponding to each port. Ports within the same LAN are grouped into a virtual LAN (VLAN), meaning they share the same tag and can communicate with each other. Ports in different LANs cannot communicate with each other. Tagging functionality can also be configured, typically as a tagged port or an untagged port. A port configured with a tagged port compares a received tagged test packet with its own tag; if they are different, the test packet is discarded; otherwise, it is forwarded as is. When a test packet without a tag is received, its own tag is added before forwarding. A port configured with an untagged port removes the tag from a received tagged test packet before forwarding, and adds its own tag to a received untagged test packet before forwarding.

[0109] Reference Figure 3 , Figure 3 This is a schematic diagram of a configuration table provided in the application embodiment, from... Figure 3 As can be seen from this, the switch configuration is as follows:

[0110] First, configure the basic configuration of each port on the switch, mainly configuring the default label, i.e., the label and master / slave mode. Other configurations can remain at their default values. The port with label 10 can receive all test packets. Ethernet is a point-to-point communication, requiring both ends to be designated as master and slave. Port9 is configured with the default label 10 and connected to the MCU's ETH (Ethernet) pin. It uses the RMII protocol and cannot be configured in master / slave mode. Port0 is configured with the default label 10 and the mode is slave. Port1 is configured with the default label 11 and the mode is master. Port2 is configured with the default label 12 and the mode is slave. Port3 is configured with the default label 13 and the mode is slave. Alternatively, industrial Ethernet can also avoid configuring master / slave mode; the two ports can automatically negotiate and determine their roles. Configuring master / slave mode for automotive Ethernet can reduce the connection success time between the two ports, as vehicles have strict startup time requirements. The master device can control and decide when to send test packets, while the slave device receives and processes the data transmission.

[0111] from Figure 3 As can be seen, the primary members (Member Ports) with a valid VLAN ID of 10 are Port0 and Port9; those with a valid VLAN ID of 11 are Port1 and Port2; and those with a valid VLAN ID of 13 are Port3 and Port9. Ports 0, 1, 2, and 3 are all configured as Untagged Ports, meaning that when a test packet without a tag is received, its own tag is added before forwarding. When a test packet with a tag is received, the tag is removed before forwarding; when a test packet without a tag is received, its own tag is added before forwarding.

[0112] Therefore, for Figure 2 In general, the entire communication process consists of three communication methods. The first is communication between the MCU and the switch, which sends and receives test messages through the hardware-designed circuit. The second is Ethernet test messages with tags. After receiving the test message, the first port queries the configuration table to determine the second port with the same configuration tag, and then forwards the test message to the second port with the same configuration tag. The third is test messages without tags, which are transmitted between the ports of the switch through the connection of the wiring harness.

[0113] exist Figure 3 After completing the configuration table, you can test multiple ports on the switch. The testing process is as follows: Figure 4 , Figure 4 against Figure 2 and Figure 3 A flowchart of port testing steps is provided; the steps include:

[0114] Step S401: The MCU sends a test message with tag 10 and increments the number of test messages sent by one.

[0115] Step S402: Port9 receives and forwards test messages.

[0116] Step S403: Query the configuration table.

[0117] Step S404: Port0 receives the test message and sends a test message without a tag.

[0118] Step S405: Port1 receives the test message, adds a tag, and forwards it.

[0119] Step S406: Query the configuration table.

[0120] Step S407: Port2 receives the test message and sends a test message without a tag.

[0121] Step S408: Port3 receives the test message, adds a tag, and forwards it.

[0122] Step S409: Query the configuration table.

[0123] Step S410: Port1 receives the return message, forwards it to the MCU, and increments the number of received test messages by one.

[0124] Step S411: Feedback the number of test messages sent and the number of returned messages received to the computer.

[0125] The process of steps S401 to S411 is described as follows: The MCU performs test message packet assembly, records the number of Ethernet messages sent plus one, and sends a test message with tag 10 to Port9. Since Port9 is configured with tag 10, it will receive all test messages with tag 10. Then, it queries the configuration table. The only members in the table configured with tag 10 are Port0 and Port9. Therefore, the test messages with tag 10 received by Port9 will be forwarded to Port0. Port0 is configured with a tag function. When sending a test message, it removes the tag from the message and forwards it to Port1, which is connected by a harness. At this time, the test message received by Port1 is untagged. Since Port1 is configured with a tag function, it will add its own tag to the untagged test message before forwarding it. Thus, it adds data with tag 11 to the message. Then, it checks the configuration table and finds that Port1 and Port2 are configured with tag 11. So Port2 receives the test message. Port2 is configured as an untagged port, so it removes the tag and sends the test message to Port3, which is connected by a harness. Port3 adds a test message with tag 13 and forwards it to Port9. Port9 then sends the test message to the MCU. At this time, the MCU checks whether the tag in the received test message is equal to 13. If it is, it increments the number of Ethernet received messages by one. The MCU feeds back the number of Ethernet sent test messages and the number of received return messages to the computer via CAN. Considering the inherent delay in forwarding test packets within Ethernet, this process can be performed in 100ms intervals. A small difference between the number of received and sent packets is normal, and a small number of packets may be lost in the return messages. When the number of received packets is zero or significantly different, it indicates a poor connection in the wiring harness, causing some test packets to not complete the entire process. Testers can then determine the Ethernet communication status based on the comparison of these numbers.

[0126] Reference Figure 5 , Figure 5 This is a schematic diagram of a port testing device provided in an embodiment of this application. Figure 5 The provided port testing device is used to test multiple ports of a switch. The device includes: a component module 501, a transmission module 502, an acquisition module 503, and a determination module 504. Each module is configured to perform the following functions:

[0127] The assembly module 501 is used to assemble the plurality of ports into a closed loop link; wherein, the first port among the plurality of ports is the starting node and the ending node in the closed loop link, and the second port among the plurality of ports other than the first port is the intermediate node in the closed loop link.

[0128] The sending module 502 is used to send a test message to the first port so that the test message is transmitted in the closed loop link.

[0129] The acquisition module 503 is used to acquire the return message output through the first port after the test message is transmitted in the closed ring link.

[0130] The determination module 504 is used to determine whether the functions of the multiple ports are normal based on the returned message.

[0131] In this embodiment, the plurality of second ports include two third ports connected to the first port, and the test message carries a tag;

[0132] The sending module 502 includes: a first determining module, configured to send the test message to the first port, so that the first port can determine a target port from the two third ports according to the tag; and send the test message to the target port from the first port, so that after the test message is transmitted through the target port, it is fed back to the first port from the two third ports other than the target port.

[0133] In this embodiment, during the transmission of the test message in the closed loop link, the sending module 502 further includes:

[0134] A configuration module is used to perform tag processing on the tag using the second port that currently receives the test message, so that the test message is sent to the next second port; wherein, the tag processing includes: stripping the tag if the received test message carries the tag; and adding the tag if the received test message does not carry the tag.

[0135] In this embodiment, the assembly module includes: a first acquisition module, used to acquire the arrangement order among the plurality of ports; based on the arrangement order, determine the connection method between two adjacent ports connected on the closed loop link; wherein the connection method includes harness connection and local area network connection; based on the connection method, assemble the plurality of ports into the closed loop link.

[0136] In this embodiment, the first acquisition module includes a second determination module, configured to determine that the two ports are the harness connection when the port types of two adjacent ports connected on the closed loop link are the same; and to determine that the two ports are the local area network connection when the port types of two adjacent ports connected on the closed loop link are the same.

[0137] In this embodiment, the determining module includes: a second acquisition module, configured to acquire the transmission direction of the test message in the closed loop link; determine a preset return message based on the transmission direction; wherein the preset return message is a message of the correct test result returned by the first port when the plurality of ports are functioning normally; and determine whether the functions of the plurality of ports are normal by comparing the return message with the preset return message.

[0138] In this embodiment, the first acquisition module includes a third determination module, configured to acquire, within a preset test period, a first number of times the test message is sent and a second number of times the return message is output by the first port; and determine whether the plurality of ports are normal based on the difference between the first number and the second number, and the difference between the return message and the preset return message.

[0139] This application also provides a vehicle that includes the port testing device described in this embodiment.

[0140] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0141] Embodiments of the present invention are described with reference to flowchart illustrations and / or block diagrams of methods and apparatus according to embodiments of the present invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable test message processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable test message processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0142] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable test message processing terminal device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0143] These computer program instructions can also be loaded onto a computer or other programmable test message processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0144] Although preferred embodiments of the present invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present invention.

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

[0146] The present invention has provided a detailed description of a port testing method, apparatus, system, and vehicle. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A port testing method for testing multiple ports of a switch, characterized in that, The method includes: The plurality of ports are assembled into a closed loop link; wherein, the first port among the plurality of ports is the starting node and the ending node of the closed loop link, and the second port among the plurality of ports other than the first port is the intermediate node of the closed loop link; A test message is sent to the first port to transmit the test message in the closed loop link; the test message carries a tag, the tag representing the transmission direction of the test message; including: using the second port currently receiving the test message to perform tag processing on the tag, so that the test message is sent to the next second port; wherein, the tag processing includes: removing the tag if the received test message carries the tag; adding the tag if the received test message does not carry the tag; adding the tag represents adding the tag corresponding to the second port currently processing the test message; The return message is obtained after the test message is transmitted in the closed loop link and then output through the first port. Based on the returned message, determine whether the functions of the multiple ports are normal.

2. The port testing method according to claim 1, characterized in that, The plurality of second ports includes two third ports connected to the first port; The step of sending a test message to the first port to enable the test message to be transmitted in the closed loop link includes: The test message is sent to the first port so that the first port can determine the target port from the two third ports based on the tag; The test message is sent from the first port to the target port, so that after the test message is transmitted through the target port, it is fed back to the first port by one of the two third ports other than the target port.

3. The port testing method according to claim 1, characterized in that, The step of forming a closed loop link from the first port and the multiple second ports includes: Obtain the arrangement order among the multiple ports; Based on the arrangement order, the connection method between two adjacent ports on the closed loop link is determined; wherein, the connection method includes harness connection and local area network connection; Based on the connection method, multiple ports are combined into a closed ring link.

4. The port testing method according to claim 3, characterized in that, The step of determining the connection method between two adjacent ports on the closed loop link based on the arrangement order includes: If two adjacent ports connected on the closed loop link have the same port type, then the two ports are identified as the harness connection. If two adjacent ports connected on the closed loop link have different port types, then the two ports are determined to be the local area network connection.

5. The port testing method according to claim 2, characterized in that, The step of determining whether the functions of the multiple ports are normal based on the returned message includes: Obtain the transmission direction of the test message in the closed ring link; Based on the transmission direction, a preset return message is determined; wherein, the preset return message is a test message of the correct test result returned by the first port when the multiple ports are functioning normally; The system compares the returned message with the preset returned message to determine whether the functions of the multiple ports are normal.

6. The port testing method according to claim 5, characterized in that, The step of comparing the returned message with the preset returned message to determine whether the functions of the multiple ports are normal includes: Within a preset test period, the first number of times the test message is sent and the second number of times the return message is output from the first port are obtained; Based on the difference between the first count and the second count, and the difference between the returned message and the preset returned message, it is determined whether the multiple ports are normal.

7. A port testing device for testing multiple ports of a switch, characterized in that, The device includes: A component module is used to connect a first port and multiple second ports among the plurality of ports into a closed loop link; wherein the first port is configured to connect to an external device, and the second ports are ports other than the first port among the plurality of ports; A sending module is configured to send a test message to the first port to transmit the test message in the closed loop link; the test message carries a tag, the tag representing the transmission direction of the test message; including: using the second port currently receiving the test message to perform tag processing on the tag, so that the test message is sent to the next second port; wherein, the tag processing includes: removing the tag if the received test message carries the tag; adding the tag if the received test message does not carry the tag; The acquisition module is used to acquire the return message output through the first port after the test message is transmitted in the closed ring link; The determination module is used to determine whether the functions of the multiple ports are normal based on the returned message.

8. A port testing system, characterized in that, The system includes: a main controller and a switch connected to the main controller; wherein the switch includes multiple ports, including a first port connected to the main controller and multiple second ports; wherein the main controller is used to execute the port testing method according to any one of claims 1 to 6.

9. A vehicle, characterized in that, The vehicle includes the port testing device as described in claim 7.

Citation Information

Patent Citations

  • Vehicle-mounted Ethernet loopback test method and system based on BroadR-Reach technology

    CN112104466A

  • A switch snakelike test failure analysis method and device and a storage medium

    CN113872827A