Ethernet interface detection method and device, electronic equipment and storage medium
By connecting multiple Ethernet interfaces in sequence, detecting Ethernet interface abnormalities using detection devices and automatic switching devices, solving the problem of high cost and low efficiency in the prior art, and achieving efficient and accurate interface detection.
Patent Information
- Application Number
- CN202510832658.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-20
- Publication Date
- 2025-08-08
AI Technical Summary
The prior art is costly and inefficient in the detection of Ethernet interfaces of multiple controllers, and cannot perform efficient detection.
By determining the sequential connection of multiple Ethernet interfaces, the preset detection device sends and receives Ethernet messages, detects interface abnormalities based on the output results, and uses an automatic switching device to locate the abnormal interface.
Reduces detection costs, improves detection efficiency, and enables rapid and accurate positioning of abnormal Ethernet interfaces.
Smart Images

Figure CN120455324A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of Ethernet interface detection, and in particular to a method, device, electronic equipment and storage medium for detecting an Ethernet interface. Background Art
[0002] The Ethernet interface configured on the controller is a key component for communication between the controller and the Ethernet, enabling high-speed data transmission and interaction between the controller and the Ethernet. Therefore, testing the Ethernet interface configured on the controller is a key step in ensuring the normal communication function of the Ethernet interface and verifying its reliability. The existing method for testing the Ethernet interface configured on the controller is to connect the load module to the Ethernet interface of the controller one-to-one and use a fixed Ethernet protocol for communication. However, when faced with multiple controllers and multiple Ethernet interfaces configured on the controller for testing, the cost of the load module is high, the testing cycle is long, and the efficiency is low. Summary of the Invention
[0003] The present invention provides a method, device, electronic device and storage medium for detecting an Ethernet interface, so as to solve the problems of high cost of required load modules and low detection efficiency when detecting multiple Ethernet interfaces.
[0004] According to one aspect of the present invention, a method for detecting an Ethernet interface is provided, the method comprising:
[0005] Determining a first number of Ethernet interfaces, where the first number of Ethernet interfaces are sequentially connected so that Ethernet packets can be transmitted between two adjacent Ethernet interfaces;
[0006] Transmitting a first message sent by a preset detection device to a first interface, where the first interface is a first Ethernet interface among the first number of Ethernet interfaces, and the first message is an Ethernet message;
[0007] receiving, by a preset detection device, an output result of a second interface, where the second interface is the last Ethernet interface among the first number of Ethernet interfaces;
[0008] Based on the output result of the second interface, it is detected whether there is an abnormal Ethernet interface among the first number of Ethernet interfaces.
[0009] According to another aspect of the present invention, there is provided a device for detecting an Ethernet interface, the device comprising:
[0010] A first determining module is configured to determine a first number of Ethernet interfaces, where the first number of Ethernet interfaces are sequentially connected so that Ethernet packets can be transmitted between two adjacent Ethernet interfaces;
[0011] A first transmission module, configured to transmit a first message sent by a preset detection device to a first interface, where the first interface is a first Ethernet interface among the first number of Ethernet interfaces, and the first message is an Ethernet message;
[0012] a first receiving module, configured to receive an output result of a second interface through a preset detection device, where the second interface is the last Ethernet interface among the first number of Ethernet interfaces;
[0013] The first detection module is configured to detect whether there is an abnormal Ethernet interface among the first number of Ethernet interfaces based on the output result of the second interface.
[0014] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0015] At least one processor; and a memory in communication with the at least one processor; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the Ethernet interface detection method of any embodiment of the present invention.
[0016] According to another aspect of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium stores computer instructions, which are used to enable a processor to implement the Ethernet interface detection method of any embodiment of the present invention when executed.
[0017] The technical solution of the embodiment of the present invention is as follows: by determining a first number of Ethernet interfaces, the first number of Ethernet interfaces are connected in sequence so that Ethernet messages can be transmitted between two adjacent Ethernet interfaces; a first message sent by a preset detection device is transmitted to a first interface, the first interface is the first Ethernet interface in the first number of Ethernet interfaces, and the first message belongs to an Ethernet message, so that the first message can be transmitted in sequence on each Ethernet interface; an output result of a second interface is received by a preset detection device, the second interface is the last Ethernet interface in the first number of Ethernet interfaces; based on the output result of the second interface, whether there is an abnormal Ethernet interface in the first number of Ethernet interfaces is detected; when there is no abnormal Ethernet interface in the first number of Ethernet interfaces, the output result of the second interface is the first message, so that the first number of Ethernet interfaces can be detected based on the comparison result of the output result of the second interface with the first message, so as to realize detection of whether there is an abnormal Ethernet interface in the first number of Ethernet interfaces based on a preset detection device, thereby reducing the cost of detecting the first number of Ethernet interfaces and improving detection efficiency.
[0018] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present invention, nor is it intended to limit the scope of the present invention. Other features of the present invention will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0020] Figure 1 A flow chart of a method for detecting an Ethernet interface provided by an embodiment of the present invention;
[0021] Figure 2 An architectural diagram of an Ethernet interface detection method provided by an embodiment of the present invention;
[0022] Figure 3 A flowchart of another Ethernet interface detection method provided by an embodiment of the present invention;
[0023] Figure 4 Another architecture diagram for detecting an Ethernet interface provided by an embodiment of the present invention;
[0024] Figure 5 A diagram illustrating another architecture for detecting an Ethernet interface provided by an embodiment of the present invention;
[0025] Figure 6 A schematic structural diagram of a detection device for an Ethernet interface provided by an embodiment of the present invention;
[0026] Figure 7 A schematic structural diagram of an electronic device implementing a method for detecting an Ethernet interface provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0027] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0028] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0029] Figure 1 The present invention provides a flowchart of a method for detecting an Ethernet interface. The present invention is applicable to the case of detecting anomalies in multiple Ethernet interfaces. The method can be executed by a detection device for an Ethernet interface. The device can be implemented in the form of hardware and / or software and can be configured in an electronic device that implements the Ethernet interface detection method. Figure 1 As shown, the Ethernet interface detection method includes:
[0030] S101: Determine a first number of Ethernet interfaces, and connect the first number of Ethernet interfaces in sequence so that Ethernet packets can be transmitted between any two adjacent Ethernet interfaces.
[0031] An Ethernet interface may refer to a physical interface that complies with the Ethernet communication protocol. An Ethernet device can communicate with and transmit data over an Ethernet network through a configured Ethernet interface. Exemplary Ethernet interfaces may include at least an RJ-45 interface, an SC fiber optic interface, and a Fiber Distributed Data Interface (FDDI). An Ethernet packet may refer to the basic unit of data transmission in an Ethernet network.
[0032] Specifically, refer to Figure 2 The first number is represented by N. The first number of Ethernet interfaces are connected in sequence to achieve serial communication of the first number of Ethernet interfaces, so that the latter Ethernet interface of two adjacent Ethernet interfaces can receive the Ethernet message transmitted by the former Ethernet interface.
[0033] As an optional implementation manner of the embodiment of the present invention, the first number of Ethernet interfaces includes an Ethernet interface configured on each of the at least one vehicle-mounted controller.
[0034] The onboard controller may refer to an electronic control unit in an automotive electronic system. The Ethernet interface configured on the onboard controller enables communication and data transmission between the onboard controllers. By using the Ethernet interface configured on each of at least one onboard controller of a vehicle as the first number of Ethernet interfaces, Ethernet communication testing of the entire vehicle can be performed, improving test integrity.
[0035] S102: Transmit a first message sent by a preset detection device to a first interface, where the first interface is a first Ethernet interface among a first number of Ethernet interfaces, and the first message is an Ethernet message.
[0036] The preset detection device may refer to a pre-configured test device that can send and receive Ethernet messages. For example, the preset detection device may be a host computer. Figure 2 The first interface is Ethernet interface 1, and the preset detection device can send a first message to the first interface based on the Ethernet communication protocol. Furthermore, a first number of Ethernet interfaces communicate in series, so that the first message is expected to be transmitted in sequence on each Ethernet interface.
[0037] As an optional implementation of an embodiment of the present invention, the first message is sent by the target Ethernet interface configured by the preset detection device, the transmission rate of the target Ethernet interface is a preset multiple of the target transmission rate, and the target transmission rate is the average transmission rate of the first number of Ethernet interfaces.
[0038] The transmission rate of an Ethernet interface may refer to the amount of data that the Ethernet interface can transmit per unit time. The target Ethernet interface configured for the preset detection device is determined based on the target transmission rate and the preset multiplier to improve the efficiency and accuracy of Ethernet interface detection. For example, when the preset multiplier is 10 and the target transmission rate is 100 Mbps, the first message is sent via the Gigabit Ethernet interface configured for the preset detection device.
[0039] S103: Receive an output result of a second interface through a preset detection device, where the second interface is the last Ethernet interface among the first number of Ethernet interfaces.
[0040] Specifically, refer to Figure 2 The second interface is Ethernet interface N, and the preset detection device can receive an output result of the second interface relative to the first message based on the Ethernet communication protocol. If no abnormal Ethernet interface exists among the first number of Ethernet interfaces, the first message can be normally transmitted to the second interface through each Ethernet interface in sequence, and the output result of the second interface is the first message.
[0041] S104: Detect whether there is an abnormal Ethernet interface among the first number of Ethernet interfaces based on the output result of the second interface.
[0042] Specifically, by comparing the output result of the second interface with the first message, if the output result of the second interface is the same as the first message, it indicates that there is no abnormal Ethernet interface among the first number of Ethernet interfaces. If the output result of the second interface is different from the first message, it indicates that there is at least one abnormal Ethernet interface among the first number of Ethernet interfaces.
[0043] As an optional implementation manner of an embodiment of the present invention, detecting whether there is an abnormal Ethernet interface among the first number of Ethernet interfaces based on the output result of the second interface includes: if the output result of the second interface is empty or the frame loss rate of the output result of the second interface relative to the first message is greater than the preset frame loss rate, then there is an abnormal Ethernet interface among the first number of Ethernet interfaces.
[0044] Among them, the frame loss rate can be used to describe the proportion of data frames lost during the transmission of the Ethernet message to the total data frames sent. The preset frame loss rate is used to indicate the reliability of the Ethernet interface when communicating. When the output result of the second interface is not empty and the frame loss rate of the output result of the second interface relative to the first message is not greater than the preset frame loss rate, it can be indicated that there are no abnormal Ethernet interfaces among the first number of Ethernet interfaces. By determining whether the output result of the second interface is empty, or determining whether the frame loss rate of the output result of the second interface relative to the first message is greater than the preset frame loss rate, the effectiveness of detecting the first number of Ethernet interfaces can be improved.
[0045] The technical solution of the embodiment of the present invention is as follows: by determining a first number of Ethernet interfaces, the first number of Ethernet interfaces are connected in sequence so that Ethernet messages can be transmitted between two adjacent Ethernet interfaces; a first message sent by a preset detection device is transmitted to a first interface, the first interface is the first Ethernet interface in the first number of Ethernet interfaces, and the first message belongs to an Ethernet message, so that the first message can be transmitted in sequence on each Ethernet interface; an output result of a second interface is received by a preset detection device, the second interface is the last Ethernet interface in the first number of Ethernet interfaces; based on the output result of the second interface, whether there is an abnormal Ethernet interface in the first number of Ethernet interfaces is detected; when there is no abnormal Ethernet interface in the first number of Ethernet interfaces, the output result of the second interface is the first message, so that the first number of Ethernet interfaces can be detected based on the comparison result of the output result of the second interface with the first message, so as to realize detection of whether there is an abnormal Ethernet interface in the first number of Ethernet interfaces based on a preset detection device, thereby reducing the cost of detecting the first number of Ethernet interfaces and improving detection efficiency.
[0046] Figure 3A flowchart of another Ethernet interface detection method provided by an embodiment of the present invention. The technical solution of this embodiment further optimizes the process after detecting whether there is an abnormal Ethernet interface in the first number of Ethernet interfaces based on the output result of the second interface in the above embodiment. The solutions not fully described in this embodiment can be found in the above embodiment. This embodiment can be combined with various optional solutions in one or more of the above embodiments. Figure 3 As shown, the Ethernet interface detection method includes:
[0047] S201: Determine a first number of Ethernet interfaces, and connect the first number of Ethernet interfaces in sequence so that Ethernet packets can be transmitted between any two adjacent Ethernet interfaces.
[0048] S202: Transmit a first message sent by a preset detection device to a first interface, where the first interface is a first Ethernet interface among a first number of Ethernet interfaces, and the first message is an Ethernet message.
[0049] S203: Receive an output result of a second interface through a preset detection device, where the second interface is the last Ethernet interface in the first number of Ethernet interfaces.
[0050] S204: Detect whether there is an abnormal Ethernet interface among the first number of Ethernet interfaces based on the output result of the second interface.
[0051] S205: If there is an abnormal Ethernet interface among the first number of Ethernet interfaces, use at least one Ethernet interface among the first number of Ethernet interfaces except the first interface and the second interface as a third interface.
[0052] Specifically, when it is detected that there is an abnormal Ethernet interface among the first number of Ethernet interfaces, it is necessary to further locate the abnormal Ethernet interface. Figure 4 The first number is represented by N. When the first interface is Ethernet interface 1 and the second interface is Ethernet interface N, the third interface is at least one of Ethernet interface 2 to Ethernet interface N-1.
[0053] S206. Transmit the first message to the first interface through the automatic switching device, and transmit the output result of the third interface to the preset detection device through the automatic switching device, the automatic switching device being used to switch the Ethernet interface in the first number of Ethernet interfaces that communicates with the preset detection device.
[0054] The automatic switching device may be connected to each Ethernet interface of the first number of Ethernet interfaces, thereby sending Ethernet messages to each Ethernet interface and receiving output results of each Ethernet interface.
[0055] Specifically, refer to Figure 4 The first message sent by the preset detection device is transmitted to the first interface through the automatic switching device, with the expectation that the first message will be transmitted on each Ethernet interface in sequence. Furthermore, the output result of the third interface for the first message can be received through the automatic switching device and transmitted to the preset detection device. If the first message can be transmitted normally to the third interface and there is no abnormality on the third interface, the output result of the third interface is the first message.
[0056] S207: Detect whether there is an abnormal Ethernet interface among the Ethernet interfaces between the first interface and the third interface based on the output result of the third interface.
[0057] The Ethernet interfaces between the first interface and the third interface include the first interface and the third interface. Specifically, by comparing the output result of the third interface with the first message, if the output result of the third interface is the same as the first message, it indicates that there is no abnormal Ethernet interface among the Ethernet interfaces between the first interface and the third interface, and there is at least one abnormal Ethernet interface among the Ethernet interfaces after the third interface.
[0058] If the output result of the third interface is different from the first message, it indicates that there is at least one abnormal Ethernet interface among the Ethernet interfaces between the first interface and the third interface. Furthermore, the first message needs to be transmitted to the third interface via an automatic switching device, and the current output result of the second interface needs to be transmitted to a preset detection device via the automatic switching device to detect whether there is an abnormal Ethernet interface among the Ethernet interfaces between the third interface and the second interface based on the current output result of the second interface. The Ethernet interfaces between the third interface and the second interface include the third interface and the second interface.
[0059] Optionally, by using at least one Ethernet interface other than the first interface, the second interface and the third interface among the first number of Ethernet interfaces as a new third interface, repeatedly performing the operation of transmitting the first message to the first interface through the automatic switching device, and transmitting the output result of the third interface to a preset detection device through the automatic switching device, until the abnormal Ethernet interface among the first number of Ethernet interfaces is located.
[0060] Optionally, the first message is transmitted to each Ethernet interface of the first number of Ethernet interfaces through an automatic switching device, and the output results of each Ethernet interface are transmitted to a preset detection device to detect whether there is an abnormality in each Ethernet interface based on the output results of each Ethernet interface.
[0061] As an optional implementation of the embodiment of the present invention, the Ethernet interface detection method further includes the following steps A1-A5:
[0062] Step A1: Use the first interface as the fourth interface and the second interface as the fifth interface.
[0063] Step A2: Use the Ethernet interface located between the fourth interface and the fifth interface among the first number of Ethernet interfaces as the sixth interface.
[0064] Step A3: Use the Ethernet interface located next to the sixth interface among the first number of Ethernet interfaces as the seventh interface.
[0065] Step A4: transmit the first message to the fourth interface through the automatic switching device, and transmit the output result of the sixth interface to the preset detection device through the automatic switching device, and detect whether there is an abnormal Ethernet interface in the Ethernet interface between the fourth interface and the sixth interface based on the output result of the sixth interface.
[0066] Step A5: transmit the first message to the seventh interface through the automatic switching device, and transmit the output result of the fifth interface to the preset detection device through the automatic switching device, and detect whether there is an abnormal Ethernet interface in the Ethernet interface between the seventh interface and the fifth interface based on the output result of the fifth interface.
[0067] Among them, the Ethernet interface between the fourth interface and the sixth interface includes the fourth interface and the sixth interface. The Ethernet interface between the seventh interface and the fifth interface includes the seventh interface and the fifth interface. Figure 5 The first quantity is represented by N. When the fourth interface is Ethernet interface 1 and the fifth interface is Ethernet interface N, the sixth interface is Ethernet interface M, and the seventh interface is Ethernet interface M+1. M is the integer half of N and represents the midpoint between the fourth and fifth interfaces.
[0068] The first message is transmitted to the fourth interface via the automatic switching device, with the expectation that the first message will be transmitted sequentially through each Ethernet interface between the fourth interface and the sixth interface. Furthermore, the automatic switching device can receive the output result of the sixth interface for the first message and transmit the output result of the sixth interface to a preset detection device. If the output result of the sixth interface is the same as the first message, it indicates that there is no abnormal Ethernet interface among the Ethernet interfaces between the fourth interface and the sixth interface; otherwise, it indicates that there is at least one abnormal Ethernet interface among the Ethernet interfaces between the fourth interface and the sixth interface.
[0069] The first message is transmitted to the seventh interface via the automatic switching device, with the expectation that the first message will be transmitted sequentially through each Ethernet interface between the seventh interface and the fifth interface. Furthermore, the automatic switching device can receive the output result of the fifth interface for the first message and transmit the output result of the fifth interface to a preset detection device. If the output result of the fifth interface is the same as the first message, then it indicates that there is no abnormal Ethernet interface among the Ethernet interfaces between the seventh interface and the fifth interface; otherwise, it indicates that there is at least one abnormal Ethernet interface among the Ethernet interfaces between the seventh interface and the fifth interface.
[0070] As an optional implementation manner of the embodiment of the present invention, after detecting whether there is an abnormal Ethernet interface among the Ethernet interfaces between the seventh interface and the fifth interface based on the output result of the fifth interface, the following steps B1-B2 are also included:
[0071] Step B1. If there is an abnormal Ethernet interface among the Ethernet interfaces between the fourth interface and the sixth interface, the sixth interface is used as the fifth interface, and the operation of using the Ethernet interface located between the fourth interface and the fifth interface in the first number of Ethernet interfaces as the sixth interface is returned to, until it is determined that there is an abnormal Ethernet interface between the fourth interface and the sixth interface.
[0072] Step B2: If there is an abnormal Ethernet interface among the Ethernet interfaces between the seventh interface and the fifth interface, use the seventh interface as the fourth interface, and return to execute the operation of using the Ethernet interface located between the fourth interface and the fifth interface in the first number of Ethernet interfaces as the sixth interface, until it is determined that there is an abnormal Ethernet interface between the seventh interface and the fifth interface.
[0073] Specifically, if there is an abnormal Ethernet interface between the fourth interface and the sixth interface, the sixth interface is used as the fifth interface, and the operations of steps A2-A5 and steps B1-B2 are repeatedly and recursively executed based on the fourth interface and the fifth interface, so as to determine the abnormal Ethernet interface between the fourth interface and the sixth interface.
[0074] If there is an abnormal Ethernet interface among the Ethernet interfaces between the seventh interface and the fifth interface, the seventh interface is used as the fourth interface, and the operations of steps A2-A5 and steps B1-B2 are repeatedly and recursively executed based on the fourth interface and the fifth interface, so as to determine the abnormal Ethernet interface between the seventh interface and the fifth interface.
[0075] The above steps A2-A5 and steps B1-B2 are based on the binary algorithm idea to detect whether there are abnormal Ethernet interfaces in the first number of Ethernet interfaces, and can quickly and accurately locate the abnormal Ethernet interfaces in the first number of Ethernet interfaces.
[0076] The technical solution of the embodiment of the present invention is as follows: if there is an abnormal Ethernet interface among the first number of Ethernet interfaces, at least one Ethernet interface among the first number of Ethernet interfaces except the first interface and the second interface is used as a third interface; the first message is transmitted to the first interface by an automatic switching device, and the output result of the third interface is transmitted to a preset detection device by the automatic switching device, and the automatic switching device is used to switch the Ethernet interface among the first number of Ethernet interfaces that communicates with the preset detection device; based on the output result of the third interface, it is detected whether there is an abnormal Ethernet interface among the Ethernet interfaces between the first interface and the third interface, so that when there is an abnormal Ethernet interface among the first number of Ethernet interfaces, the output result of the third interface is obtained by the preset detection device and the automatic switching device, and it is detected whether there is an abnormal Ethernet interface among the Ethernet interfaces between the first interface and the third interface; thereby, by continuously adjusting the third interface, the abnormal Ethernet interface among the first number of Ethernet interfaces can be located based on the preset detection device and the automatic switching device.
[0077] Figure 6 This is a schematic diagram of the structure of an Ethernet interface detection device provided by an embodiment of the present invention. The embodiment of the present invention is applicable to the case of abnormality detection of multiple Ethernet interfaces, and the device can be implemented in the form of hardware and / or software. Figure 6 As shown, the detection device of the Ethernet interface includes:
[0078] A first determining module 301 is configured to determine a first number of Ethernet interfaces, where the first number of Ethernet interfaces are sequentially connected so that Ethernet packets can be transmitted between two adjacent Ethernet interfaces;
[0079] A first transmission module 302 is configured to transmit a first message sent by a preset detection device to a first interface, where the first interface is a first Ethernet interface among the first number of Ethernet interfaces, and the first message is an Ethernet message;
[0080] A first receiving module 303 is configured to receive an output result of a second interface through a preset detection device, where the second interface is the last Ethernet interface in the first number of Ethernet interfaces;
[0081] The first detection module 304 is configured to detect whether there is an abnormal Ethernet interface among the first number of Ethernet interfaces based on the output result of the second interface.
[0082] Based on any of the above optional technical solutions, optionally, the first detection module 304 is specifically used to determine that if the output result of the second interface is empty or the frame loss rate of the output result of the second interface relative to the first message is greater than the preset frame loss rate, then there is an abnormal Ethernet interface among the first number of Ethernet interfaces.
[0083] Based on any of the above optional technical solutions, the Ethernet interface detection device optionally further includes: a second determination module, a second transmission module, and a second detection module. The second determination module is configured to, after detecting whether there is an abnormal Ethernet interface among the first number of Ethernet interfaces based on the output result of the second interface, use at least one Ethernet interface among the first number of Ethernet interfaces other than the first interface and the second interface as a third interface if there is an abnormal Ethernet interface among the first number of Ethernet interfaces; the second transmission module is configured to transmit the first message to the first interface through an automatic switching device, and transmit the output result of the third interface to a preset detection device through the automatic switching device, wherein the automatic switching device is configured to switch the Ethernet interface among the first number of Ethernet interfaces to communicate with the preset detection device; and the second detection module is configured to detect whether there is an abnormal Ethernet interface among the Ethernet interfaces between the first interface and the third interface based on the output result of the third interface.
[0084] Based on any of the above optional technical solutions, optionally, the Ethernet interface detection device further includes: a third determination module, a fourth determination module, a fifth determination module, a third detection module, and a fourth detection module. The third determination module is configured to use the first interface as the fourth interface and the second interface as the fifth interface; the fourth determination module is configured to use the Ethernet interface located between the fourth and fifth interfaces in the first number of Ethernet interfaces as the sixth interface; the fifth determination module is configured to use the Ethernet interface located below the sixth interface in the first number of Ethernet interfaces as the seventh interface; the third detection module is configured to transmit the first message to the fourth interface via the automatic switching device, and transmit the output result of the sixth interface to a preset detection device via the automatic switching device, and detect whether there is an abnormal Ethernet interface in the Ethernet interfaces between the fourth and sixth interfaces based on the output result of the sixth interface; and the fourth detection module is configured to transmit the first message to the seventh interface via the automatic switching device, and transmit the output result of the fifth interface to a preset detection device via the automatic switching device, and detect whether there is an abnormal Ethernet interface in the Ethernet interfaces between the seventh and fifth interfaces based on the output result of the fifth interface.
[0085] On the basis of any of the above optional technical solutions, optionally, the detection device for the Ethernet interface further includes: a sixth determination module and a seventh determination module. The sixth determination module is configured to, after detecting whether there is an abnormal Ethernet interface among the Ethernet interfaces between the seventh interface and the fifth interface based on the output result of the fifth interface, if there is an abnormal Ethernet interface among the Ethernet interfaces between the fourth interface and the sixth interface, use the sixth interface as the fifth interface, and return to executing the operation of using the Ethernet interface located between the fourth interface and the fifth interface in the first number of Ethernet interfaces as the sixth interface, until it is determined that there is an abnormal Ethernet interface between the fourth interface and the sixth interface; and the seventh determination module is configured to, if there is an abnormal Ethernet interface among the Ethernet interfaces between the seventh interface and the fifth interface, use the seventh interface as the fourth interface, and return to executing the operation of using the Ethernet interface located between the fourth interface and the fifth interface in the first number of Ethernet interfaces as the sixth interface, until it is determined that there is an abnormal Ethernet interface between the seventh interface and the fifth interface.
[0086] Based on any of the above optional technical solutions, optionally, the first message is sent by the target Ethernet interface configured by the preset detection device, the transmission rate of the target Ethernet interface is a preset multiple of the target transmission rate, and the target transmission rate is the average transmission rate of the first number of Ethernet interfaces.
[0087] Based on any of the above optional technical solutions, optionally, the first number of Ethernet interfaces includes an Ethernet interface configured on each of the at least one vehicle-mounted controller.
[0088] The technical solution of the embodiment of the present invention is as follows: a first determination module 301 determines a first number of Ethernet interfaces, and the first number of Ethernet interfaces are connected in sequence so that Ethernet messages can be transmitted between two adjacent Ethernet interfaces; a first transmission module 302 transmits a first message sent by a preset detection device to a first interface, where the first interface is the first Ethernet interface in the first number of Ethernet interfaces, and the first message belongs to an Ethernet message, in the expectation that the first message can be transmitted in sequence on each Ethernet interface; a first receiving module 303 receives an output result of a second interface through a preset detection device, where the second interface is the last Ethernet interface in the first number of Ethernet interfaces; a first detection module 304 detects whether there are any abnormal Ethernet interfaces in the first number of Ethernet interfaces based on the output result of the second interface; when there are no abnormal Ethernet interfaces in the first number of Ethernet interfaces, the output result of the second interface is the first message, so that the first number of Ethernet interfaces can be detected based on the comparison result of the output result of the second interface with the first message, so as to realize detection of whether there are any abnormal Ethernet interfaces in the first number of Ethernet interfaces based on a preset detection device, thereby reducing the cost of detecting the first number of Ethernet interfaces and improving detection efficiency.
[0089] The Ethernet interface detection device provided in the embodiment of the present invention can execute the Ethernet interface detection method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0090] Figure 7 A schematic structural diagram of an electronic device for implementing a detection method for an Ethernet interface provided in an embodiment of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0091] like Figure 7As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., which is communicatively connected to the at least one processor 11. The memory stores a computer program that can be executed by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 into the random access memory (RAM) 13. Various programs and data required for the operation of the electronic device 10 can also be stored in the RAM 13. The processor 11, ROM 12, and RAM 13 are connected to each other via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0092] Multiple components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0093] The processor 11 can be any general-purpose and / or specialized processing component with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the Ethernet interface detection method.
[0094] In particular, according to an embodiment of the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present invention includes a computer program product that includes a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication unit 19, or installed from the storage unit 18, or installed from the ROM 12. When the computer program is executed by the processor 11, the above-mentioned functions defined in the method of the embodiment of the present invention are performed.
[0095] In some embodiments, the method for detecting an Ethernet interface may be implemented as a computer program that is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the method for detecting an Ethernet interface described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the method for detecting an Ethernet interface in any other appropriate manner (e.g., by means of firmware).
[0096] Various embodiments of the systems and techniques described above can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on a chip (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0097] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the computer program is executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0098] In the context of the present invention, computer-readable storage media can be tangible media that can contain or store a computer program for use with an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. Computer-readable storage media can include but are not limited to electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, computer-readable storage media can be machine-readable signal media. More specific examples of machine-readable storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0099] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0100] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0101] A computing system may include clients and servers. The clients and servers are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host. This server is a hosting product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosting and VPS services.
[0102] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in the present invention can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved. This is not limited herein.
[0103] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.
Claims
1. A method for detecting an Ethernet interface, characterized in that: The method comprises: Determining a first number of Ethernet interfaces, where the first number of Ethernet interfaces are sequentially connected so that Ethernet packets can be transmitted between two adjacent Ethernet interfaces; Transmitting a first message sent by a preset detection device to a first interface, where the first interface is a first Ethernet interface among the first number of Ethernet interfaces, and the first message is an Ethernet message; receiving, by the preset detection device, an output result of a second interface, where the second interface is the last Ethernet interface among the first number of Ethernet interfaces; Based on the output result of the second interface, it is detected whether there is an abnormal Ethernet interface among the first number of Ethernet interfaces.
2. The method according to claim 1, characterized in that Detecting whether there is an abnormal Ethernet interface among the first number of Ethernet interfaces based on the output result of the second interface includes: If the output result of the second interface is empty or the frame loss rate of the output result of the second interface relative to the first message is greater than the preset frame loss rate, then there is an abnormal Ethernet interface among the first number of Ethernet interfaces.
3. The method according to claim 1, characterized in that After detecting whether there is an abnormal Ethernet interface among the first number of Ethernet interfaces based on the output result of the second interface, the method further includes: If there is an abnormal Ethernet interface among the first number of Ethernet interfaces, use at least one Ethernet interface among the first number of Ethernet interfaces other than the first interface and the second interface as a third interface; Transmitting the first message to the first interface through an automatic switching device, and transmitting the output result of the third interface to the preset detection device through the automatic switching device, wherein the automatic switching device is used to switch the Ethernet interface in the first number of Ethernet interfaces to communicate with the preset detection device; Based on the output result of the third interface, it is detected whether there is an abnormal Ethernet interface among the Ethernet interfaces between the first interface and the third interface.
4. The method according to claim 3, characterized in that The method further comprises: Using the first interface as the fourth interface and the second interface as the fifth interface; Using the Ethernet interface located between the fourth interface and the fifth interface among the first number of Ethernet interfaces as the sixth interface; Using the Ethernet interface located next to the sixth interface among the first number of Ethernet interfaces as the seventh interface; Transmitting the first message to the fourth interface through the automatic switching device, and transmitting the output result of the sixth interface to the preset detection device through the automatic switching device, and detecting whether there is an abnormal Ethernet interface among the Ethernet interfaces between the fourth interface and the sixth interface based on the output result of the sixth interface; The first message is transmitted to the seventh interface through the automatic switching device, and the output result of the fifth interface is transmitted to the preset detection device through the automatic switching device, and based on the output result of the fifth interface, it is detected whether there is an abnormal Ethernet interface in the Ethernet interface between the seventh interface and the fifth interface.
5. The method according to claim 4, characterized in that After detecting whether there is an abnormal Ethernet interface among the Ethernet interfaces between the seventh interface and the fifth interface based on the output result of the fifth interface, the method further includes: If an abnormal Ethernet interface exists among the Ethernet interfaces between the fourth interface and the sixth interface, the sixth interface is used as the fifth interface, and the operation of using an Ethernet interface located between the fourth interface and the fifth interface among the first number of Ethernet interfaces as the sixth interface is performed again until it is determined that an abnormal Ethernet interface exists between the fourth interface and the sixth interface. If there is an abnormal Ethernet interface among the Ethernet interfaces between the seventh interface and the fifth interface, the seventh interface will be used as the fourth interface, and the operation of using the Ethernet interface located between the fourth interface and the fifth interface among the first number of Ethernet interfaces as the sixth interface will be returned until it is determined that there is an abnormal Ethernet interface between the seventh interface and the fifth interface.
6. The method according to claim 1, characterized in that The first message is sent by the target Ethernet interface configured by the preset detection device, the transmission rate of the target Ethernet interface is a preset multiple of the target transmission rate, and the target transmission rate is the average transmission rate of the first number of Ethernet interfaces.
7. The method according to claim 1, characterized in that The first number of Ethernet interfaces includes an Ethernet interface configured on each of the at least one vehicle-mounted controller.
8. A detection device for an Ethernet interface, characterized in that: The device comprises: A first determining module is configured to determine a first number of Ethernet interfaces, where the first number of Ethernet interfaces are connected in sequence so that Ethernet packets can be transmitted between two adjacent Ethernet interfaces; A first transmission module, configured to transmit a first message sent by a preset detection device to a first interface, where the first interface is a first Ethernet interface among a first number of Ethernet interfaces, and the first message is an Ethernet message; a first receiving module, configured to receive an output result of a second interface through the preset detection device, where the second interface is the last Ethernet interface among the first number of Ethernet interfaces; The first detection module is configured to detect whether there is an abnormal Ethernet interface among the first number of Ethernet interfaces based on the output result of the second interface.
9. An electronic device, characterized in that: The electronic device comprises: At least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the Ethernet interface detection method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the Ethernet interface detection method according to any one of claims 1 to 7 when executed.