Communication method and device of multi-network card chip, storage medium and electronic device
By establishing a network interface card (NIC) mapping table and dynamic update mechanism in the multi-NIC chip, the problem of the inability of vehicle-mounted multi-NIC control chips to form a network for communication is solved, realizing multi-path data transmission and redundant link switching, thereby improving the communication efficiency and reliability of the vehicle network.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHONGQING CHANGAN AUTOMOBILE CO LTD
- Filing Date
- 2026-02-04
- Publication Date
- 2026-05-19
AI Technical Summary
Vehicle-mounted multi-NIC control chips cannot support multi-path data transmission, resulting in inflexible data transmission and inability to form a network for communication. In particular, vehicle-mounted Ethernet control chips cannot achieve efficient and accurate data routing.
By establishing a network interface card (NIC) mapping table in a multi-NIC chip, the target NIC is found based on the source MAC address and destination MAC address, and the target NIC is used for message forwarding. The mapping table entries are generated by combining topology data and stored in non-volatile memory, enabling dynamic updates and link switching, and supporting multi-path data transmission and redundant link switching.
It realizes a flexible data transmission and forwarding strategy for multiple network interface cards (NICs) in the vehicle network system, improves communication efficiency, and ensures communication redundancy and link switching capability in abnormal situations in the ring network system.
Smart Images

Figure CN121644517B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of vehicle technology, and more specifically, to a communication method and apparatus, storage medium, and electronic device for multiple network interface cards (NICs). Background Technology
[0002] In related technologies, automotive multi-NIC control chips are mostly System-on-Chip (SoCs), and the communication method relies on the system's default network configuration, such as statically binding application communication NICs or using routing configurations to achieve data forwarding between different NICs. This means that applications bound to the system can only transmit data or forward all data within the local area network through a single path. With the development of automotive Ethernet control chips, the automotive industry has gradually seen the emergence of microcontroller units (MCUs) that replace the original single NIC control chips plus switches with multi-NIC control chips. MCUs are usually without an operating system or are mainly based on lightweight real-time operating systems (RTOS), which cannot support the routing strategies of systems such as Linux / Android / QNX on the SoC, and can only transmit data through a single path.
[0003] No efficient and accurate solution has yet been found to address the aforementioned issues in the relevant technologies. Summary of the Invention
[0004] This invention provides a communication method and apparatus, storage medium, and electronic device for multiple network interface cards (NICs) to solve technical problems in related technologies.
[0005] According to an embodiment of the present invention, a communication method for multiple network interface cards (NICs) is provided, comprising: determining a first message received by a multi-NIC chip in a vehicle, wherein the multi-NIC chip includes a virtual NIC and multiple physical NICs; parsing the source MAC address of the first message, wherein the first message carries the source MAC address and a destination MAC address; searching for a target NIC matching the source MAC address in the multi-NIC chip according to a NIC mapping table, wherein the NIC mapping table is used to store multiple sets of mapping relationships between source MAC addresses and NICs; and forwarding the first message using the target NIC and the destination MAC address.
[0006] Optionally, before searching for a target network card matching the source MAC address among the multiple network card chips according to the network card mapping table, the method further includes: acquiring the topology data of the vehicle's in-vehicle network communication; determining the local MAC address and data transmission network card of each communication device in the vehicle according to the topology data; generating a mapping table entry for each communication device using the local MAC address and the corresponding data transmission network card, and adding a timeout period to the mapping table entry; generating a network card mapping table using the mapping table entries of all communication devices in the vehicle, and storing it in the vehicle's non-volatile memory.
[0007] Optionally, searching for a target network interface card (NIC) matching the source MAC address in the multi-NIC chip according to the NIC mapping table includes: determining whether the source MAC address matches the NIC mapping table; if the source MAC address matches the NIC mapping table, searching for a target NIC matching the destination MAC address in the NIC mapping table of the multi-NIC chip; if the source MAC address does not match the NIC mapping table, configuring the receiving NIC of the first message as the target NIC of the source MAC address, and dynamically updating the NIC mapping table of the multi-NIC chip using the source MAC address and the target NIC.
[0008] Optionally, searching for a target network interface card (NIC) matching the destination MAC address in the NIC mapping table of the multi-NIC chip includes: parsing the destination MAC address of the first message; determining whether the primary communication link between the source MAC address and the destination MAC address has failed, wherein the primary communication link between the source MAC address and the destination MAC address includes a primary communication link and a backup communication link, the primary communication link corresponds to a first NIC mapping table, and the backup communication link corresponds to a second NIC mapping table; if the primary communication link between the source MAC address and the destination MAC address has not failed, searching for a first target NIC matching the destination MAC address in the first NIC mapping table of the multi-NIC chip; if the primary communication link between the source MAC address and the destination MAC address has failed, switching the primary communication link to the backup communication link, dynamically updating the first NIC mapping table to the second NIC mapping table, and searching for a second target NIC matching the destination MAC address in the second NIC mapping table.
[0009] Optionally, searching for a target network interface card (NIC) matching the destination MAC address in the NIC mapping table of the multi-NIC chip includes: identifying the message type of the first message based on the destination MAC address, wherein the message type includes: unicast message, multicast message, and broadcast message; if the message type is a unicast message, searching for a single target NIC matching the destination MAC address in the multi-NIC chip according to the NIC mapping table; if the message type is a multicast message or a broadcast message, searching for multiple target NICs matching the destination MAC address in the multi-NIC chip according to the NIC mapping table.
[0010] Optionally, after determining the first message received by the vehicle's multi-NIC chip, the method further includes: extracting the destination network field of the first message, wherein the destination network field includes a destination MAC address, a destination IP address, and a destination VLAN; determining whether the destination network field is an in-vehicle network field of the vehicle; if the destination network field is an in-vehicle network field of the vehicle, determining the source MAC address for parsing the first message; if the destination network field is not an in-vehicle network field of the vehicle, filtering and deleting the first message.
[0011] Optionally, forwarding the first message using the target network interface card (NIC) and the destination MAC address includes: searching for a matching target forwarding queue in the queue mapping table of the multi-NIC chip according to the destination MAC address, wherein the queue mapping table includes multiple forwarding queues, each forwarding queue corresponding to a NIC or a combination of NICs; adding the target NIC to the target forwarding queue; and when the target forwarding queue reaches the target NIC, calling the target NIC to forward the first message to the destination MAC address.
[0012] Optionally, searching for a matching target forwarding queue in the queue mapping table of the multi-NIC chip based on the destination MAC address includes: determining whether there is a target forwarding queue in the queue mapping table of the multi-NIC chip that matches the destination MAC address; if there is a first forwarding queue in the queue mapping table of the multi-NIC chip that matches the destination MAC address, determining the first forwarding queue as the matching target forwarding queue; if there is no first forwarding queue in the queue mapping table of the multi-NIC chip that matches the destination MAC address, searching for a second forwarding queue in the queue mapping table of the multi-NIC chip that matches the target NIC, and determining the second forwarding queue as the matching target forwarding queue.
[0013] Optionally, invoking the target network interface card (NIC) to forward the first message to the destination MAC address includes: adding the first message to the target forwarding queue; finding the target NIC bound to the target forwarding queue and obtaining the sending queue of the target NIC; adding the first message to the sending queue; and when the first message arrives in the sending queue, invoking the target NIC to forward the first message to the destination MAC address.
[0014] Optionally, after searching for a matching target forwarding queue in the queue mapping table of the multi-NIC chip based on the destination MAC address, the method further includes: if there is no target forwarding queue matching the destination MAC address in the queue mapping table of the multi-NIC chip, identifying the receiving NIC of the first message; searching for the first forwarding queue where the receiving NIC is located in the queue mapping table; and binding the destination MAC address to the first forwarding queue.
[0015] According to another embodiment of the present invention, a communication device with multiple network interface cards (NICs) is provided, comprising: a first determining module, configured to determine a first message received by a multi-NIC chip in a vehicle, wherein the multi-NIC chip includes a virtual NIC and multiple physical NICs; a parsing module, configured to parse the source MAC address of the first message, wherein the first message carries the source MAC address and a destination MAC address; a searching module, configured to search for a target NIC matching the source MAC address in the multi-NIC chip according to a NIC mapping table, wherein the NIC mapping table stores multiple sets of mapping relationships between source MAC addresses and NICs; and a forwarding module, configured to forward the first message using the target NIC and the destination MAC address.
[0016] Optionally, the device further includes: an acquisition module, configured to acquire the in-vehicle network communication topology data of the vehicle before the search module searches for a target network card matching the source MAC address in the multi-network card chip according to the network card mapping table; a second determination module, configured to determine the local MAC address and data transmission network card of each communication device of the vehicle according to the topology data; a generation module, configured to generate a mapping table entry for each communication device using the local MAC address and the corresponding data transmission network card, and add a timeout period to the mapping table entry; and a storage module, configured to generate a network card mapping table using the mapping table entries of all communication devices of the vehicle, and store it in the non-volatile memory of the vehicle.
[0017] Optionally, the lookup module includes: a judgment unit, used to judge whether the source MAC address matches the network interface card (NIC) mapping table; and a lookup unit, used to, if the source MAC address matches the NIC mapping table, search for a target NIC that matches the destination MAC address in the NIC mapping table of the multi-NIC chip; and if the source MAC address does not match the NIC mapping table, configure the receiving NIC of the first message as the target NIC of the source MAC address, and dynamically update the NIC mapping table of the multi-NIC chip using the source MAC address and the target NIC.
[0018] Optionally, the lookup unit includes: a parsing subunit, used to parse the destination MAC address of the first message; a judging subunit, used to judge whether the main communication link between the source MAC address and the destination MAC address has failed, wherein the link between the source MAC address and the destination MAC address includes a main communication link and a backup communication link, the main communication link corresponds to a first network interface card (NIC) mapping table, and the backup communication link corresponds to a second NIC mapping table; a first lookup subunit, used to, if the main communication link between the source MAC address and the destination MAC address has not failed, search for a first target NIC matching the destination MAC address in the first NIC mapping table of the multi-NIC chip; if the main communication link between the source MAC address and the destination MAC address has failed, switch the main communication link to the backup communication link, dynamically update the first NIC mapping table to the second NIC mapping table, and search for a second target NIC matching the destination MAC address in the second NIC mapping table.
[0019] Optionally, the lookup unit includes: an identification subunit, configured to identify the message type of the first message based on the destination MAC address, wherein the message type includes: unicast message, multicast message, and broadcast message; and a second lookup subunit, configured to, if the message type is a unicast message, search for a single target network interface card (NIC) matching the destination MAC address in the multi-NIC chip according to a NIC mapping table; and if the message type is a multicast message or a broadcast message, search for multiple target NICs matching the destination MAC address in the multi-NIC chip according to a NIC mapping table.
[0020] Optionally, the device further includes: an extraction module, configured to extract the destination network field of the first message after the first determining module determines that the vehicle's multi-NIC chip has received the first message, wherein the destination network field includes a destination MAC address, a destination IP address, and a destination VLAN; a judging module, configured to judge whether the destination network field is an in-vehicle network field of the vehicle; and a filtering module, configured to determine the source MAC address for parsing the first message if the destination network field is an in-vehicle network field of the vehicle; and to filter and delete the first message if the destination network field is not an in-vehicle network field of the vehicle.
[0021] Optionally, the forwarding module includes: a first lookup unit, configured to look up a matching target forwarding queue in the queue mapping table of the multi-NIC chip according to the destination MAC address, wherein the queue mapping table includes multiple forwarding queues, each forwarding queue corresponding to a NIC or a combination of NICs; an adding unit, configured to add the target NIC to the target forwarding queue; and a forwarding unit, configured to, when the target forwarding queue reaches the target NIC, invoke the target NIC to forward the first message to the destination MAC address.
[0022] Optionally, the search unit includes: a judgment subunit, configured to determine whether a target forwarding queue matching the destination MAC address exists in the queue mapping table of the multi-NIC chip; and a determination subunit, configured to determine the first forwarding queue as a matching target forwarding queue if a first forwarding queue matching the destination MAC address exists in the queue mapping table of the multi-NIC chip; and to search for a second forwarding queue matching the target NIC in the queue mapping table of the multi-NIC chip if no first forwarding queue matching the destination MAC address exists, and determine the second forwarding queue as a matching target forwarding queue.
[0023] Optionally, the forwarding unit includes: an acquisition subunit, configured to add the first message to the target forwarding queue; locate the target network interface card bound to the target forwarding queue, and acquire the sending queue of the target network interface card; an addition subunit, configured to add the first message to the sending queue; and a forwarding subunit, configured to, when the first message arrives in the sending queue, invoke the target network interface card to forward the first message to the destination MAC address.
[0024] Optionally, the forwarding module further includes: an identification unit, configured to identify the receiving network card of the first message if, after the search unit searches for a matching target forwarding queue in the queue mapping table of the multi-NIC chip based on the destination MAC address, there is no target forwarding queue matching the destination MAC address in the queue mapping table; a second search unit, configured to search for the first forwarding queue where the receiving network card is located in the queue mapping table; and a binding unit, configured to bind the destination MAC address to the first forwarding queue.
[0025] According to another aspect of the embodiments of this application, a storage medium is also provided, the storage medium including a stored program that executes the above steps when the program is run.
[0026] According to another aspect of the embodiments of this application, an electronic device is also provided, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; wherein: the memory is used to store computer programs; and the processor is used to execute the steps in the above method by running the programs stored in the memory.
[0027] This application also provides a computer program product containing instructions that, when run on a computer, cause the computer to perform the steps in the above-described method.
[0028] The beneficial effects of this invention are:
[0029] 1. To address the data routing problem of control chips in vehicle-mounted multi-NIC chips, a data transmission and routing method for multi-NIC chips is proposed, providing flexible strategies for data transmission and forwarding of multi-NIC chips. Furthermore, an Ethernet networking method is proposed for a ring network system composed of multi-NIC chips, solving the technical problem that multi-NIC chips cannot form a network for communication in vehicle-mounted network systems.
[0030] 2. In a ring network system based on multiple network cards, the links for vehicle data interaction can be specified by static configuration based on the above-mentioned multi-network card data transmission method and data routing method. At the same time, the timeout dynamic switching method can be used to achieve the effect of redundant link switching when the ring network link communication is abnormal, thus ensuring redundancy in the event of abnormal vehicle Ethernet communication. Attached Figure Description
[0031] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:
[0032] Figure 1 This is a hardware structure block diagram of a car according to an embodiment of the present invention;
[0033] Figure 2 This is a flowchart of a communication method for a multi-NIC chip according to an embodiment of the present invention;
[0034] Figure 3 This is a timing diagram of updating the network interface card mapping table in an embodiment of the present invention;
[0035] Figure 4 This is a schematic diagram of network card mapping table switching in an embodiment of the present invention;
[0036] Figure 5 This is a flowchart of a method for data routing between multiple network interface cards according to an embodiment of the present invention;
[0037] Figure 6 This is a timing diagram of the forwarding data in an embodiment of the present invention;
[0038] Figure 7 This is a schematic diagram of the structure of a multi-NIC chip provided in an embodiment of the present invention;
[0039] Figure 8 This is a schematic diagram of a ring network configuration method based on multiple network interface card (NIC) chips according to an embodiment of the present invention;
[0040] Figure 9 This is a structural block diagram of a communication device with multiple network interface cards (NICs) according to an embodiment of the present invention. Detailed Implementation
[0041] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, and not all of them. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present application. It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of the present application can be combined with each other.
[0042] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0043] Example 1
[0044] The method embodiment provided in Embodiment 1 of this application can be executed in an automobile, processor, controller, MCU chip, or similar processing device. Taking its operation in an automobile as an example, Figure 1 This is a hardware structure block diagram of a car according to an embodiment of the present invention. For example... Figure 1 As shown, a car may include one or more ( Figure 1 Only one is shown in the image. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. Optionally, the vehicle may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned automobile. For example, the automobile may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0045] The memory 104 can be used to store automotive programs, such as application software programs and modules, like the automotive program corresponding to a communication method for a multi-NIC chip in an embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the automotive program stored in the memory 104, thereby implementing the aforementioned method. The memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the vehicle via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0046] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by a vehicle's communication provider. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.
[0047] This embodiment provides a communication method for multiple network interface card (NIC) chips. Figure 2This is a flowchart of a communication method for a multi-NIC chip according to an embodiment of the present invention, such as... Figure 2 As shown, the process includes the following steps:
[0048] Step S201: Determine the first message received by the vehicle's multi-NIC chip, wherein the multi-NIC chip includes a virtual NIC and multiple physical NICs;
[0049] Optionally, the first message can be a message sent by other chips inside the vehicle or a message sent by external devices. The multi-NIC chip can be the vehicle's controller.
[0050] Step S202: Parse the source MAC address of the first message, wherein the first message carries the source MAC address and the destination MAC address;
[0051] Step S203: Search for the target network card that matches the source MAC address in the multiple network card chips according to the network card mapping table, wherein the network card mapping table is used to store multiple sets of mapping relationships between source MAC addresses and network cards;
[0052] Step S204: Forward the first message using the target network card and the destination MAC address.
[0053] Through the above steps, the first message received by the vehicle's multi-NIC chip is determined, wherein the multi-NIC chip includes a virtual NIC and multiple physical NICs; the source MAC address of the first message is parsed, wherein the first message carries the source MAC address and the destination MAC address; a target NIC matching the source MAC address is searched in the multi-NIC chip according to a NIC mapping table, wherein the NIC mapping table is used to store multiple sets of mapping relationships between source MAC addresses and NICs; the first message is forwarded using the target NIC and the destination MAC address. By using the NIC mapping table to allocate the target NIC for forwarding messages, a flexible strategy for data transmission and forwarding by the multi-NIC chip is realized, solving the technical problem that multi-NIC chips cannot form a network for communication in the vehicle network system in the prior art, and improving the communication efficiency of the vehicle network.
[0054] In one embodiment of this example, before searching for a target network card matching the source MAC address among the multiple network card chips according to the network card mapping table, the method further includes: acquiring the topology data of the vehicle's in-vehicle networking communication; determining the local MAC address and data transmission network card of each communication device of the vehicle according to the topology data; generating a mapping table entry for each communication device using the local MAC address and the corresponding data transmission network card, and adding a timeout period to the mapping table entry; generating a network card mapping table using the mapping table entries of all communication devices of the vehicle, and storing it in the vehicle's non-volatile memory.
[0055] In this embodiment, the network card mapping table is updated by static configuration. In the topology data of the in-vehicle network communication, the in-vehicle network IP and MAC are fixed. The MAC and the network card involved in the transmission path can be pre-written into the network card mapping table, and the timeout time is set to permanent. The table is stored in non-volatile memory as a default entry (the table entry will not be cleared when the power is off). The default table entry is loaded and used every time the power is initialized.
[0056] In this embodiment, searching for a target network interface card (NIC) matching the source MAC address in the multi-NIC chip according to the NIC mapping table includes: determining whether the source MAC address matches the NIC mapping table; if the source MAC address matches the NIC mapping table, searching for a target NIC matching the destination MAC address in the NIC mapping table of the multi-NIC chip; if the source MAC address does not match the NIC mapping table, configuring the receiving NIC of the first message as the target NIC of the source MAC address, and dynamically updating the NIC mapping table of the multi-NIC chip using the source MAC address and the target NIC.
[0057] For external devices or temporary external devices connected to the vehicle, since their MAC addresses are unknown, they cannot be added to the initial default entries of the network interface card (NIC) mapping table. The NIC mapping table needs to be updated in real-time by identifying the MAC addresses of received data. When data is received from the NIC, it is checked whether the source MAC address matches the MAC address in the default entry. If not, the MAC address and the receiving NIC are added to the table read during this power-on cycle. Furthermore, after receiving the entries to be added in the previous step, a timeout period must be set. The timeout period can be set based on the minimum interaction cycle of all services to avoid communication problems caused by the chip still sending data using the original NIC when the external device switches access paths. Based on the static configuration and dynamic updates above, the NIC mapping table for this power-on cycle is obtained. Each entry must at least include the MAC address, the corresponding sending NIC, and the timeout period. There can be one or more sending NICs; for multicast and broadcast, multiple NICs may be involved. After setting the timeout period, the corresponding entries are deleted according to the timeout period for timely updates.
[0058] Figure 3This is a timing diagram of updating the network interface card (NIC) mapping table in this embodiment of the invention. Upon power-up, the default NIC mapping table is first read from the non-volatile storage space. After reading, a timeout is added to each entry, and the corresponding entry is deleted after the timeout. The default NIC mapping table is used when, in the initial power-up situation, no data is received from the external controller, but the system has data to send, it needs to send the data from the default NIC. After loading the default NIC mapping table, if data is received, the source MAC address of the received data and the receiving NIC are given to the NIC mapping module for maintenance and update. Then, the destination MAC address of the data is identified, the NIC mapping table is queried to find the corresponding NIC, and the data is sent. This completes the dynamic data identification and sending during the power-up operation.
[0059] In one implementation scenario of this embodiment, searching for a target network interface card (NIC) matching the destination MAC address in the NIC mapping table of the multi-NIC chip includes: parsing the destination MAC address of the first message; determining whether the primary communication link between the source MAC address and the destination MAC address has failed, wherein the primary communication link between the source MAC address and the destination MAC address includes a primary communication link and a backup communication link, the primary communication link corresponds to a first NIC mapping table, and the backup communication link corresponds to a second NIC mapping table; if the primary communication link between the source MAC address and the destination MAC address has not failed, searching for a first target NIC matching the destination MAC address in the first NIC mapping table of the multi-NIC chip; if the primary communication link between the source MAC address and the destination MAC address has failed, switching the primary communication link to the backup communication link, dynamically updating the first NIC mapping table to the second NIC mapping table, and searching for a second target NIC matching the destination MAC address in the second NIC mapping table.
[0060] The network interface card (NIC) mapping table in this embodiment includes columns such as MAC address, NIC, and timeout period, to enable device switching or redundant receive path switching between different NICs. Figure 4This is a schematic diagram of the network interface card (NIC) mapping table switching in this embodiment of the invention. The communication network includes controller B, and controllers A, C, and D that may communicate with it. In the initial ring network state, one link is blocked by default (no data transmission) to prevent ring network storms. In this network scenario, controllers A and B interact through NIC 1 of controller B. When other links in the network fail, the initially blocked link AD is opened. At this time, the interaction between controllers A and B will be received through NICs D and C to NIC 2 of controller B. When data is received from NIC 2, NIC 1, which was originally communicating with controller A, needs to be switched to NIC 2. Otherwise, if data is still sent according to the NIC, controller A will not receive data from controller B. The timeout period should be set to the minimum interaction cycle for in-vehicle applications. In one scenario, the timeout period for the network interface card (NIC) mapping entry "MAC address of A - NIC 1" on controller B should be set to the minimum application cycle between A and B, i.e., the time from the AB link failure to the next receipt of data from controller A. This ensures that the mapping table can be updated in a timely manner after a failure, and that the data returned to A can be sent out through NIC 2 for seamless switching. Alternatively, the timeout period can be set to permanent. During path switching, an interface for modifying the mapping table entry can be provided. For example, when an AB link failure is detected, the modification interface can be called to change the mapping table entry "MAC address of A - NIC 1" on controller B to "MAC address of A - NIC 2", which can also meet the link switching requirements. The above applies to unicast packets and requires meeting switching requirements. For multicast or broadcast packets, the NICs for interaction are generally pre-specified, including redundant NICs after switching, to maximize the configuration of multicast and broadcast NIC mapping table entries. The timeout period for these is permanent.
[0061] In one embodiment of this example, searching for a target network interface card (NIC) matching the destination MAC address in the NIC mapping table of the multi-NIC chip includes: identifying the message type of the first message based on the destination MAC address, wherein the message type includes: unicast message, multicast message, and broadcast message; if the message type is a unicast message, searching for a single target NIC matching the destination MAC address in the multi-NIC chip according to the NIC mapping table; if the message type is a multicast message or a broadcast message, searching for multiple target NICs matching the destination MAC address in the multi-NIC chip according to the NIC mapping table.
[0062] In one implementation scenario, after determining the first message received by the vehicle's multi-NIC chip, the method further includes: extracting the destination network field of the first message, wherein the destination network field includes the destination MAC address, the destination IP address, and the destination VLAN; determining whether the destination network field is the vehicle's in-vehicle network field; if the destination network field is the vehicle's in-vehicle network field, determining the source MAC address for parsing the first message; if the destination network field is not the vehicle's in-vehicle network field, filtering and deleting the first message.
[0063] Optionally, the data received by the network card can be filtered. The data can be filtered based on fields that can identify data that are not used by the in-vehicle network, such as the destination MAC address, destination IP address, and VLAN. Illegal data can be removed to reduce the load on the in-vehicle network. After filtering, the data is sent to the next module for processing.
[0064] In one embodiment of this example, forwarding the first message using the target network interface card (NIC) and the destination MAC address includes: searching for a matching target forwarding queue in the queue mapping table of the multi-NIC chip according to the destination MAC address, wherein the queue mapping table includes multiple forwarding queues, each forwarding queue corresponding to a NIC or a combination of NICs; adding the target NIC to the target forwarding queue; and when the target forwarding queue reaches the target NIC, calling the target NIC to forward the first message to the destination MAC address.
[0065] Each forwarding queue in the queue mapping table is bound to the corresponding network interface card (NIC) for transmission. The mapping relationship in the queue mapping table is "destination MAC address - queue - target NIC".
[0066] In one example, searching for a matching target forwarding queue in the queue mapping table of the multi-NIC chip based on the destination MAC address includes: determining whether a target forwarding queue matching the destination MAC address exists in the queue mapping table of the multi-NIC chip; if a first forwarding queue matching the destination MAC address exists in the queue mapping table of the multi-NIC chip, determining the first forwarding queue as the matching target forwarding queue; if a first forwarding queue matching the destination MAC address does not exist in the queue mapping table of the multi-NIC chip, searching for a second forwarding queue matching the target NIC in the queue mapping table of the multi-NIC chip, and determining the second forwarding queue as the matching target forwarding queue.
[0067] In this implementation, all network interface cards (NICs) are arranged and combined to allocate corresponding forwarding queues. Each forwarding queue is bound to a corresponding NIC. Since the chip itself does not have a physical NIC, data received is represented by a virtual name, indicating the NIC that needs to be internally received. The matching relationship between the destination MAC address and the queue is pre-configured. After receiving data from the data receiving module, the destination MAC address is identified, and the data is placed into the corresponding forwarding queue and sent from the corresponding NIC. Assuming the multi-NIC chip device has two external NICs, NIC 1 and NIC 2, and the chip's own receiving interface is abstracted as a virtual NIC 3, then all NICs are arranged and combined to allocate forwarding queues. Queue 1 is bound to NIC 1, meaning data in queue 1 needs to be sent from NIC 1. Queue 3 is bound to virtual NIC 3, meaning data in queue 3 is received by the chip itself. Queue 4 is bound to both NIC 1 and virtual NIC 3, meaning data in queue 4 needs to be received by the chip itself. The data routing module needs to simultaneously forward data to both network interface card 1 (NIC 1) and its own chip. After the queue is bound to the NIC, it also needs to map the relationship between the destination MAC address and the queue, i.e., which MAC addresses enter the corresponding queue. For example, if queue 1 matches MAC address 1, then when the destination MAC address is MAC1, the data enters queue 1 to wait for transmission. Since external devices may randomly connect to the in-vehicle network, such as debugging computers and diagnostic instruments, their MAC addresses are usually unknown. Routing relationships cannot be pre-configured for unknown MAC addresses. Therefore, the data routing module also needs to have the function of dynamically loading the routing table to map the source MAC address of the received data and the NIC to the corresponding routing NIC queue. That is, if NIC 1 receives an unknown MAC1 address, it binds this unknown MAC1 address to NIC 1 and queue 1. Subsequently, if the destination MAC address is MAC1, the data is placed in queue 1 and sent from NIC 1. This also involves redundant switching of the ring network link; therefore, this routing relationship needs to have a timeout to prevent changes during dynamic link switching.
[0068] In one example, invoking the target network interface card (NIC) to forward the first message to the destination MAC address includes: adding the first message to the target forwarding queue; finding the target NIC bound to the target forwarding queue and obtaining the target NIC's sending queue; adding the first message to the sending queue; and when the first message arrives in the sending queue, invoking the target NIC to forward the first message to the destination MAC address.
[0069] Optionally, after searching for a matching target forwarding queue in the queue mapping table of the multi-NIC chip based on the destination MAC address, the method further includes: if there is no target forwarding queue matching the destination MAC address in the queue mapping table of the multi-NIC chip, identifying the receiving NIC of the first message; searching for the first forwarding queue where the receiving NIC is located in the queue mapping table; and binding the destination MAC address to the first forwarding queue.
[0070] If no source MAC address is found to be bound to a forwarding queue, the MAC address needs to be mapped to the receiving network card and added to the forwarding queue mapping relationship of other network cards to ensure the correct forwarding of returned data.
[0071] Figure 5 A flowchart of a method for data routing between multiple network interface cards (NICs) according to an embodiment of the present invention includes:
[0072] S501 receives and filters data. It filters the data received by the network card. The data can be filtered based on fields that can identify data that is not used by the in-vehicle network, such as the destination MAC address, destination IP address, and VLAN. Illegal data is removed to reduce the load on the in-vehicle network. After filtering, the data is sent to the next module for processing.
[0073] S502, determine whether the source MAC address has been matched with the forwarding queue. If it is determined that the source MAC address has been mapped to a forwarding relationship after receiving the data, then transfer the data to S503 for the next step of processing; otherwise, proceed to step S504.
[0074] S503 identifies the destination MAC address of the received data and places it into the corresponding forwarding queue;
[0075] S504: If no source MAC address is found to be bound to a forwarding queue, the MAC address needs to be matched with the receiving network card and added to the forwarding queue mapping relationship of other network cards in order to achieve correct forwarding of the returned data.
[0076] S505 binds the forwarding queue of this network card to the sending queue of the corresponding network card. For example, if the forwarding queue of network card 1 is "network card 3", then after this queue receives data, it will immediately forward the data to the sending queue of network card 3, thereby realizing data routing and forwarding.
[0077] Figure 6 This is a timing diagram of forwarding data in an embodiment of the present invention. Upon power-up, the default route network card queue mapping table is first read from the non-volatile storage space. After reading, a timeout period is added to the unicast address table entry, and the corresponding table entry is deleted after the timeout. During power-up operation, if data is received, the source MAC address of the received data and the receiving network card are maintained and updated in the route network card queue mapping table. Then, the destination MAC address of the data is identified, the network card queue list is queried, and the data is placed into the corresponding network card queue for transmission.
[0078] This embodiment proposes a data transmission and routing method for multiple network cards in vehicle MCUs, addressing the data routing problem of control chips with multiple network cards. It provides flexible strategies for data transmission and forwarding of the MCU, and proposes an Ethernet networking method for a ring network system composed of multiple network card chips, solving the networking application problem of multi-network card MCUs in vehicle network systems.
[0079] Figure 7 This is a schematic diagram of a multi-NIC chip provided in an embodiment of the present invention, including a data receiving module 71, a NIC mapping module 72, a data sending module 73, and a data routing module 74, located between the IP layer and the data link layer of the network protocol architecture. The data receiving module receives data from different NICs and identifies the data information to the NIC mapping module. The NIC mapping module establishes a mapping relationship between the source MAC address of the received data and the receiving NIC, enabling the sending of data to select the appropriate NIC. The data sending module selects the data sending NIC according to the NIC mapping table. The data routing module determines whether to receive or forward the received data based on the routing relationship. In a complete data communication process, the data receiving module first receives data from different network cards (NICs) and identifies the data information before sending it to the NIC mapping module. Specifically, it provides the source MAC address and corresponding NIC of the received data to the NIC mapping module, and then sends the data to the data routing module. Simultaneously, the data receiving module can also perform a filtering step to determine if the data is illegal, such as identifying known VLANs. After receiving the information from the data receiving module, the NIC mapping module updates its NIC mapping table. When the upper layer needs to send data, it knows the peer's IP address based on the socket and can retrieve the MAC address corresponding to the IP from the ARP (Address Resolution Protocol) table. After obtaining the MAC address for sending data, it sends the data to the data sending module. Upon receiving the data, the data sending module queries the NIC mapping table for the destination address and, after obtaining the NIC, forwards the data to the corresponding NIC. The data routing module arranges and combines all NICs, assigning them to corresponding queues, and the queues are then bound to the corresponding NICs for forwarding.
[0080] Figure 8 This is a schematic diagram of a ring network configuration method based on multiple network interface card (NIC) chips according to an embodiment of the present invention, applicable to the communication configuration of in-vehicle Ethernet networks, including:
[0081] S801, in the early stages of vehicle network design, needs to collect all unicast, multicast, and broadcast addresses involved in the vehicle Ethernet network and pre-specify the routing path of the vehicle network; in addition, if ring network is involved, ring network breaking configuration needs to be performed based on unused paths after specifying the routing path to prevent data storms;
[0082] After obtaining all data addresses, S802 configures a static network interface card (NIC) mapping table for multicast and broadcast on the multiNIC chip. Since the dynamic update of the NIC mapping table is based on identifying the source MAC address, and the source MAC address can only be unicast, multicast and broadcast must be statically configured. Specifically, it can be configured to send from a single NIC, or, considering redundancy, it can be configured to send from multiple NICs.
[0083] S803 determines whether a specific network interface card (NIC) needs to be specified for unicast transmission. If a specific NIC is required, S804 configures the address in the static table. If no NIC is required, S805 dynamically updates the NIC mapping table based on the real-time received data, enabling dynamic selection of the NIC to send data.
[0084] S806 determines whether the MAC address is the address designed for the in-vehicle network. If so, it proceeds to S807 to statically specify the forwarding queue mapping relationship for all MAC addresses in the vehicle to ensure the routing and forwarding efficiency of in-vehicle data. If it is a non-in-vehicle known MAC address, such as when connecting external debugging equipment or for diagnosis, the device address MAC is unknown and random. S808 needs to update the forwarding queue mapping relationship according to the receiving network card of the external address data to complete the communication interaction between the in-vehicle network and the external network.
[0085] Using the solution in this embodiment, in a ring network system based on multiple network cards, the links for vehicle data interaction can be specified by static configuration based on the above-mentioned multi-network card data transmission method and data routing method. At the same time, the timeout dynamic switching method can be used to achieve the effect of redundant link switching when the ring network link communication is abnormal, thus ensuring redundancy in the abnormal vehicle Ethernet communication.
[0086] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0087] Example 2
[0088] This embodiment also provides a communication device with multiple network interface cards (NICs), which is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0089] Figure 9 This is a structural block diagram of a communication device with a multi-NIC chip according to an embodiment of the present invention, such as... Figure 9 As shown, the device includes:
[0090] The first determining module 91 is used to determine the first message received by the vehicle's multi-NIC chip, wherein the multi-NIC chip includes a virtual NIC and multiple physical NICs;
[0091] The parsing module 92 is used to parse the source MAC address of the first message, wherein the first message carries the source MAC address and the destination MAC address;
[0092] The lookup module 93 is used to look up a target network card that matches the source MAC address in the multiple network card chips according to the network card mapping table, wherein the network card mapping table is used to store multiple sets of mapping relationships between source MAC addresses and network cards;
[0093] Forwarding module 94 is used to forward the first message using the target network card and the destination MAC address.
[0094] Optionally, the device further includes: an acquisition module, configured to acquire the in-vehicle network communication topology data of the vehicle before the search module searches for a target network card matching the source MAC address in the multi-network card chip according to the network card mapping table; a second determination module, configured to determine the local MAC address and data transmission network card of each communication device of the vehicle according to the topology data; a generation module, configured to generate a mapping table entry for each communication device using the local MAC address and the corresponding data transmission network card, and add a timeout period to the mapping table entry; and a storage module, configured to generate a network card mapping table using the mapping table entries of all communication devices of the vehicle, and store it in the non-volatile memory of the vehicle.
[0095] Optionally, the lookup module includes: a judgment unit, used to judge whether the source MAC address matches the network interface card (NIC) mapping table; and a lookup unit, used to, if the source MAC address matches the NIC mapping table, search for a target NIC that matches the destination MAC address in the NIC mapping table of the multi-NIC chip; and if the source MAC address does not match the NIC mapping table, configure the receiving NIC of the first message as the target NIC of the source MAC address, and dynamically update the NIC mapping table of the multi-NIC chip using the source MAC address and the target NIC.
[0096] Optionally, the lookup unit includes: a parsing subunit, used to parse the destination MAC address of the first message; a judging subunit, used to judge whether the main communication link between the source MAC address and the destination MAC address has failed, wherein the link between the source MAC address and the destination MAC address includes a main communication link and a backup communication link, the main communication link corresponds to a first network interface card (NIC) mapping table, and the backup communication link corresponds to a second NIC mapping table; a first lookup subunit, used to, if the main communication link between the source MAC address and the destination MAC address has not failed, search for a first target NIC matching the destination MAC address in the first NIC mapping table of the multi-NIC chip; if the main communication link between the source MAC address and the destination MAC address has failed, switch the main communication link to the backup communication link, dynamically update the first NIC mapping table to the second NIC mapping table, and search for a second target NIC matching the destination MAC address in the second NIC mapping table.
[0097] Optionally, the lookup unit includes: an identification subunit, configured to identify the message type of the first message based on the destination MAC address, wherein the message type includes: unicast message, multicast message, and broadcast message; and a second lookup subunit, configured to, if the message type is a unicast message, search for a single target network interface card (NIC) matching the destination MAC address in the multi-NIC chip according to a NIC mapping table; and if the message type is a multicast message or a broadcast message, search for multiple target NICs matching the destination MAC address in the multi-NIC chip according to a NIC mapping table.
[0098] Optionally, the device further includes: an extraction module, configured to extract the destination network field of the first message after the first determining module determines that the vehicle's multi-NIC chip has received the first message, wherein the destination network field includes a destination MAC address, a destination IP address, and a destination VLAN; a judging module, configured to judge whether the destination network field is an in-vehicle network field of the vehicle; and a filtering module, configured to determine the source MAC address for parsing the first message if the destination network field is an in-vehicle network field of the vehicle; and to filter and delete the first message if the destination network field is not an in-vehicle network field of the vehicle.
[0099] Optionally, the forwarding module includes: a first lookup unit, configured to look up a matching target forwarding queue in the queue mapping table of the multi-NIC chip according to the destination MAC address, wherein the queue mapping table includes multiple forwarding queues, each forwarding queue corresponding to a NIC or a combination of NICs; an adding unit, configured to add the target NIC to the target forwarding queue; and a forwarding unit, configured to, when the target forwarding queue reaches the target NIC, invoke the target NIC to forward the first message to the destination MAC address.
[0100] Optionally, the search unit includes: a judgment subunit, configured to determine whether a target forwarding queue matching the destination MAC address exists in the queue mapping table of the multi-NIC chip; and a determination subunit, configured to determine the first forwarding queue as a matching target forwarding queue if a first forwarding queue matching the destination MAC address exists in the queue mapping table of the multi-NIC chip; and to search for a second forwarding queue matching the target NIC in the queue mapping table of the multi-NIC chip if no first forwarding queue matching the destination MAC address exists, and determine the second forwarding queue as a matching target forwarding queue.
[0101] Optionally, the forwarding unit includes: an acquisition subunit, configured to add the first message to the target forwarding queue; locate the target network interface card bound to the target forwarding queue, and acquire the sending queue of the target network interface card; an addition subunit, configured to add the first message to the sending queue; and a forwarding subunit, configured to, when the first message arrives in the sending queue, invoke the target network interface card to forward the first message to the destination MAC address.
[0102] Optionally, the forwarding module further includes: an identification unit, configured to identify the receiving network card of the first message if, after the search unit searches for a matching target forwarding queue in the queue mapping table of the multi-NIC chip based on the destination MAC address, there is no target forwarding queue matching the destination MAC address in the queue mapping table; a second search unit, configured to search for the first forwarding queue where the receiving network card is located in the queue mapping table; and a binding unit, configured to bind the destination MAC address to the first forwarding queue.
[0103] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.
[0104] Example 3
[0105] Embodiments of the present invention also provide a storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above method embodiments when running.
[0106] Optionally, in this embodiment, the storage medium may be configured to store a computer program for performing the following steps:
[0107] S1, determine the first message received by the vehicle's multi-NIC chip, wherein the multi-NIC chip includes a virtual NIC and multiple physical NICs;
[0108] S2, parse the source MAC address of the first message, wherein the first message carries the source MAC address and the destination MAC address;
[0109] S3, according to the network card mapping table, find the target network card that matches the source MAC address in the multiple network card chips, wherein the network card mapping table is used to store multiple sets of mapping relationships between source MAC addresses and network cards;
[0110] S4, forward the first message using the target network card and the destination MAC address.
[0111] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing computer programs, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0112] Embodiments of the present invention also provide an electronic device including a memory and a processor, the memory storing a computer program and the processor being configured to run the computer program to perform the steps in any of the above method embodiments.
[0113] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0114] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0115] S1, determine the first message received by the vehicle's multi-NIC chip, wherein the multi-NIC chip includes a virtual NIC and multiple physical NICs;
[0116] S2, parse the source MAC address of the first message, wherein the first message carries the source MAC address and the destination MAC address;
[0117] S3, according to the network card mapping table, find the target network card that matches the source MAC address in the multiple network card chips, wherein the network card mapping table is used to store multiple sets of mapping relationships between source MAC addresses and network cards;
[0118] S4, forward the first message using the target network card and the destination MAC address.
[0119] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.
[0120] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0121] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented using software plus a general-purpose hardware platform, or of course, using hardware. Based on this understanding, the above technical solutions, in essence or the parts that contribute to the related technology, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0122] It should be understood that the terminology used herein is for the purpose of describing particular exemplary embodiments only and is not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms “a,” “an,” and “described” as used herein may also include the plural forms. The terms “comprising,” “including,” “containing,” and “having” are inclusive and therefore indicate the presence of the stated features, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, elements, components, and / or combinations thereof. The method steps, processes, and operations described herein are not construed as requiring them to be performed in a particular order described or illustrated unless the order of performance is explicitly indicated. It should also be understood that additional or alternative steps may be used.
[0123] The above description is merely a specific embodiment of the present invention, enabling those skilled in the art to understand or implement the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A communication method using multiple network interface card (NIC) chips, characterized in that, include: The first message received by the vehicle's multi-NIC chip is determined, wherein the multi-NIC chip includes a virtual NIC and multiple physical NICs; Parse the source MAC address of the first message, wherein the first message carries the source MAC address and the destination MAC address; The network interface card (NIC) mapping table is used to search for the target NIC that matches the source MAC address among the multiple NIC chips. The NIC mapping table is used to store multiple sets of mapping relationships between source MAC addresses and NICs. The first message is forwarded using the target network interface card and the destination MAC address; The step of searching for a target network interface card (NIC) matching the source MAC address in the multi-NIC chip according to the NIC mapping table includes: determining whether the source MAC address matches the NIC mapping table; if the source MAC address matches the NIC mapping table, searching for a target NIC matching the destination MAC address in the NIC mapping table of the multi-NIC chip; if the source MAC address does not match the NIC mapping table, configuring the receiving NIC of the first message as a new target NIC for the source MAC address, and dynamically updating the NIC mapping table of the multi-NIC chip using the source MAC address and the new target NIC. The process of searching for a target network interface card (NIC) matching the destination MAC address in the NIC mapping table of the multi-NIC chip includes: parsing the destination MAC address of the first message; determining whether the primary communication link between the source MAC address and the destination MAC address has failed, wherein the primary communication link between the source MAC address and the destination MAC address includes a primary communication link and a backup communication link, the primary communication link corresponds to a first NIC mapping table, and the backup communication link corresponds to a second NIC mapping table; if the primary communication link between the source MAC address and the destination MAC address has not failed, searching for a first target NIC matching the destination MAC address in the first NIC mapping table of the multi-NIC chip; if the primary communication link between the source MAC address and the destination MAC address has failed, switching the primary communication link to the backup communication link, dynamically updating the first NIC mapping table to the second NIC mapping table, and searching for a second target NIC matching the destination MAC address in the second NIC mapping table.
2. The method according to claim 1, characterized in that, Before searching for the target network interface card (NIC) matching the source MAC address among the multiple NIC chips according to the NIC mapping table, the method further includes: Obtain the topology data of the vehicle's in-vehicle network communication; Based on the topology data, determine the local MAC address and data transmission network card of each communication device in the vehicle; For each communication device, a mapping table entry is generated using the local MAC address and the corresponding data transmission network card, and the timeout period of the mapping table entry is added; A network interface card (NIC) mapping table is generated using the mapping table entries of all communication devices in the vehicle, and stored in the vehicle's non-volatile memory.
3. The method according to claim 1, characterized in that, Searching for the target network interface card (NIC) matching the destination MAC address in the NIC mapping table of the multi-NIC chip includes: The message type of the first message is identified based on the destination MAC address, wherein the message type includes: unicast message, multicast message, and broadcast message; If the message type is a unicast message, a single target network interface card (NIC) matching the destination MAC address is searched in the multi-NIC chip according to the NIC mapping table; if the message type is a multicast message or a broadcast message, multiple target NICs matching the destination MAC address are searched in the multi-NIC chip according to the NIC mapping table.
4. The method according to claim 1, characterized in that, After determining the first message received by the vehicle's multi-NIC chip, the method further includes: Extract the destination network field of the first message, wherein the destination network field includes the destination MAC address, the destination IP address, and the destination VLAN; Determine whether the target network field is the in-vehicle network field of the vehicle; If the destination network field is the vehicle's in-vehicle network field, determine the source MAC address of the first message; if the destination network field is not the vehicle's in-vehicle network field, filter and delete the first message.
5. The method according to claim 1, characterized in that, Forwarding the first message using the target network interface card and the destination MAC address includes: The target forwarding queue is searched in the queue mapping table of the multi-NIC chip according to the destination MAC address. The queue mapping table includes multiple forwarding queues, and each forwarding queue corresponds to a NIC or a combination of NICs. Add the target network interface card to the target forwarding queue; When the target forwarding queue reaches the target network card, the target network card is invoked to forward the first message to the destination MAC address.
6. The method according to claim 5, characterized in that, The process of searching for a matching target forwarding queue in the queue mapping table of the multi-NIC chip based on the destination MAC address includes: Determine whether a target forwarding queue matching the destination MAC address exists in the queue mapping table of the multi-NIC chip; If a first forwarding queue matching the destination MAC address exists in the queue mapping table of the multi-NIC chip, the first forwarding queue is determined as the matching target forwarding queue; if a first forwarding queue matching the destination MAC address does not exist in the queue mapping table of the multi-NIC chip, a second forwarding queue matching the target NIC is searched in the queue mapping table of the multi-NIC chip, and the second forwarding queue is determined as the matching target forwarding queue.
7. The method according to claim 5, characterized in that, Invoking the target network interface card to forward the first message to the destination MAC address includes: Add the first message to the target forwarding queue; Locate the target network interface card (NIC) bound to the target forwarding queue, and obtain the transmission queue of the target NIC; Add the first message to the sending queue; When the first message arrives in the sending queue, the target network card is invoked to forward the first message to the destination MAC address.
8. The method according to claim 5, characterized in that, After searching for a matching target forwarding queue in the queue mapping table of the multi-NIC chip based on the destination MAC address, the method further includes: If there is no target forwarding queue matching the destination MAC address in the queue mapping table of the multi-NIC chip, identify the receiving NIC of the first message; Find the first forwarding queue where the receiving network card is located in the queue mapping table; Bind the destination MAC address to the first forwarding queue.
9. A communication device with multiple network interface card (NIC) chips, characterized in that, include: The first determining module is used to determine the first message received by the vehicle's multi-NIC chip, wherein the multi-NIC chip includes a virtual NIC and multiple physical NICs; A parsing module is used to parse the source MAC address of the first message, wherein the first message carries the source MAC address and the destination MAC address; The lookup module is used to find the target network card that matches the source MAC address in the multiple network card chips according to the network card mapping table, wherein the network card mapping table is used to store multiple sets of mapping relationships between source MAC addresses and network cards; The forwarding module is used to forward the first message using the target network card and the destination MAC address; The lookup module includes: a judgment unit, used to judge whether the source MAC address matches the network interface card (NIC) mapping table; and a lookup unit, used to, if the source MAC address matches the NIC mapping table, search for a target NIC matching the destination MAC address in the NIC mapping table of the multi-NIC chip; and if the source MAC address does not match the NIC mapping table, configure the receiving NIC of the first message as a new target NIC for the source MAC address, and dynamically update the NIC mapping table of the multi-NIC chip using the source MAC address and the new target NIC. The lookup unit includes: a parsing subunit for parsing the destination MAC address of the first message; a judging subunit for judging whether the main communication link between the source MAC address and the destination MAC address has failed, wherein the link between the source MAC address and the destination MAC address includes a main communication link and a backup communication link, the main communication link corresponds to a first network interface card (NIC) mapping table, and the backup communication link corresponds to a second NIC mapping table; and a first lookup subunit for, if the main communication link between the source MAC address and the destination MAC address has not failed, searching for a first target NIC matching the destination MAC address in the first NIC mapping table of the multi-NIC chip; if the main communication link between the source MAC address and the destination MAC address has failed, switching the main communication link to the backup communication link, dynamically updating the first NIC mapping table to the second NIC mapping table, and searching for a second target NIC matching the destination MAC address in the second NIC mapping table.
10. A storage medium, characterized in that, The storage medium stores a computer program, wherein the computer program is configured to execute the method described in any one of claims 1 to 8 when it is run.
11. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the method as described in any one of claims 1 to 8.