Configuration system, data transmission method and medium for virtual Ethernet of vehicle-mounted USB port
Through the virtual Ethernet interface on the car USB port, data packaging and transmission are used to use the protocol layers of each layer in the configuration system, solve the problem of low vehicle network transmission efficiency, realize efficient data transmission, and reduce the cost of hardware.
Patent Information
- Application Number
- CN202310088794.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-06
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2043-02-06
AI Technical Summary
Since some SOC chips in the existing vehicle network do not support Ethernet interfaces, the transmission efficiency is low, the speed is only 1.5M bit/second, and the cost of replacing the Ethernet chip is relatively high.
The configuration system of virtual Ethernet virtual Ethernet through the car, including the hardware layer, USB protocol layer, MAC protocol layer, and network card drive layer to realize data packaging and transmission of data, and improve transmission efficiency.
The transmission rate of the car network has been increased to 12Mbit/second, while avoiding the need to increase the cost of hardware.
Smart Images

Figure CN116112356B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a configuration system, a data transmission method and a medium for a virtual Ethernet of a vehicle-mounted USB port. Background Art
[0002] With the development of the Internet of Vehicles, major car manufacturers and car computer manufacturers are gradually using Ethernet interfaces for data exchange, transmission, upgrades and networking between modules. Automotive Ethernet is defined as the next generation of in-vehicle local area network technology. It cannot completely replace the existing in-vehicle network in the short term, and its application in the automotive industry requires a gradual process.
[0003] At present, since some SOC chips do not support Ethernet interfaces, vehicle networks usually use USB 1.1 to transmit data, resulting in low transmission efficiency, for example, the rate is only 1.5M bit / second. If the chip is replaced with an in-vehicle Ethernet chip, the cost will be high. Therefore, it is necessary to provide a method to improve the transmission efficiency of vehicle network communication. Summary of the invention
[0004] The present invention provides a configuration system, a data transmission method and a medium of a vehicle-mounted USB port virtual Ethernet, so as to realize data transmission through the vehicle-mounted USB port virtual Ethernet, and improve the transmission rate of the vehicle-mounted network.
[0005] In a first aspect, in order to solve the above technical problems, the present invention provides a configuration system for a virtual Ethernet of a vehicle-mounted USB port, comprising:
[0006] The hardware layer is used to configure registers to implement hardware transmission;
[0007] USB protocol layer, used to bind the callback function of USB protocol layer and remove coupling to facilitate porting and code reuse;
[0008] The MAC protocol layer is used to receive network messages and convert them into corresponding USB messages, or receive USB messages from the USB protocol layer and convert them into corresponding network messages;
[0009] The network card driver layer includes a network protocol stack, which is used to receive or send network messages.
[0010] Preferably, the network card driver layer is further used to encapsulate the network message again, so that the final transmission format is the network message.
[0011] Preferably, the MAC protocol layer is also used to select a corresponding driver protocol according to the installed driver to encapsulate the message into a network message.
[0012] Preferably, the MAC protocol layer is used to convert the network message at the MAC layer into a binary USB message by binding the network message header of the USB protocol layer.
[0013] Preferably, the MAC protocol layer includes a platform driver, and the platform driver is used to allocate resources, initialize hardware, and obtain a MAC address.
[0014] Preferably, each network message has a 2-byte network message header, and each network message contains only one Ethernet frame.
[0015] Preferably, each USB message includes multiple Ethernet frames, and calling a USB message once corresponds to sending or receiving multiple network messages.
[0016] In a second aspect, the present invention provides a data transmission method, which is implemented based on the configuration system of the in-vehicle USB port virtual Ethernet as described in any one of the above, and is characterized by comprising:
[0017] Get the original data to be sent;
[0018] Encapsulate the original data at the network layer and data link layer, and add a network message header to obtain a network message;
[0019] The network message is encapsulated into a USB message containing a binary data segment for transmission.
[0020] In a third aspect, the present invention provides a data transmission method, which is implemented based on the configuration system of the in-vehicle USB port virtual Ethernet as described in any one of the above, and is characterized by comprising:
[0021] Unpacking the received USB message containing the binary data segment at the network layer and the data link layer;
[0022] Remove the network message header from the unpacked data to obtain the original data.
[0023] In a fourth aspect, the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the data transmission methods described above.
[0024] Compared with the prior art, the present invention has the following beneficial effects:
[0025] The present invention provides a configuration system for a virtual Ethernet of an in-vehicle USB port, comprising: a hardware layer for configuring registers to implement hardware transmission; a USB protocol layer for binding a callback function of the USB protocol layer and removing coupling for easy transplantation and code reuse; a MAC protocol layer for receiving a network message and converting it into a corresponding USB message, or receiving a USB message from the USB protocol layer and converting it into a corresponding network message; a network card driver layer, including a network protocol stack, for receiving or sending a network message. The present invention transmits data through the virtual Ethernet of the in-vehicle USB port, which can improve the transmission rate of the in-vehicle network without increasing the hardware cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 It is a schematic diagram of the configuration system structure of the in-vehicle USB port virtual Ethernet provided by the first embodiment of the present invention;
[0027] Figure 2 It is a flowchart of a data transmission method provided by an embodiment of the present invention;
[0028] Figure 3 It is a flowchart of another data transmission method provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0029] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments 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 creative work are within the scope of protection of the present invention.
[0030] Reference Figure 1 The first embodiment of the present invention provides a system for configuring a virtual Ethernet of a vehicle-mounted USB port, comprising:
[0031] The hardware layer is used to configure registers to implement hardware transmission;
[0032] USB protocol layer, used to bind the callback function of USB protocol layer and remove coupling to facilitate porting and code reuse;
[0033] The MAC protocol layer is used to receive network messages and convert them into corresponding USB messages, or receive USB messages from the USB protocol layer and convert them into corresponding network messages;
[0034] The network card driver layer includes a network protocol stack, which is used to receive or send network messages.
[0035] In one implementation, the network card driver layer is further used to encapsulate the network message again so that the final transmission format is the network message.
[0036] In one implementation, the MAC protocol layer is further used to select a corresponding driver protocol according to an installed driver to encapsulate the message into a network message.
[0037] The MAC protocol layer is used to convert the network message of the MAC layer into a binary USB message by binding the network message header of the USB protocol layer.
[0038] In this embodiment, each network message has a 2-byte network message header, each network message only includes one Ethernet frame, each USB message includes multiple Ethernet frames, and calling a USB message once corresponds to sending or receiving multiple network messages.
[0039] In one implementation, the MAC protocol layer includes a platform driver, and the platform driver is used to allocate resources, initialize hardware, and obtain a MAC address.
[0040] In one implementation, the hardware layer configures registers, changes the USB driver to a virtual Ethernet driver, the transmission port is a unit of the virtual Ethernet port, generates a virtual network port, and the hardware layer unit includes configuration registers to implement hardware transmission.
[0041] The USB protocol layer is used to interact with the hardware layer downwards and the MAC protocol function driver layer upwards, and bind the callback functions related to the USB protocol layer. By binding the network message header of the USB protocol layer, the message of the MAC layer is converted into a binary USB message format.
[0042] The MAC protocol layer uses platform for registration. The platform driver is used to allocate resources and initialize hardware, obtain SOC ID to generate an internationally unique MAC address. The structures are struct usb_gadget and struct usb_gadget_driver. The struct usb_gadget definition is initialized when the USB protocol memory is started. The structusb_gadget_driver definition is initialized in the USB device, and is passed from the USB device layer through the usb_gadget_register_driver (structusb_gadget_driver*driver) function and then assigned to the memory.
[0043] In one implementation, the Ethernet access controller, namely the MAC protocol layer, is divided into: Ethernet control model (ECM), Ethernet simulation model (EEM), and Ethernet interface specification (RNDIS). Among them, the Ethernet access controller (MAC): access scheduling function, mapping logical channels to transmission channels, and each transmission channel selects an appropriate transmission format according to the rate.
[0044] Ethernet Control Model (ECM): The virtual network card host_mac is passed to the host through the USB string descriptor (the string index is iMACAddress).
[0045] Ethernet Emulation Model (EEM): Each EEM message has a 2-byte EEM header and each EEM message contains only one Ethernet frame; the header is processed by wrap() and unwrap() in the code.
[0046] Ethernet Interface Specification (RNDIS): RNDIS messages can contain multiple Ethernet frames (MaxPacketsPerTransfer), that is, a single URB call can send or receive multiple IP messages.
[0047] Reference Figure 2 The second embodiment of the present invention provides a data transmission method, which is implemented based on the configuration system of the in-vehicle USB port virtual Ethernet as described in any one of the first embodiments, and is characterized by comprising:
[0048] S11, obtaining the original data to be sent;
[0049] S12, encapsulating the original data at the network layer and the data link layer, and adding a network message header to obtain a network message;
[0050] S13, encapsulating the network message into a USB message containing a binary data segment for transmission.
[0051] Reference Figure 3 The third embodiment of the present invention provides a data transmission method, which is implemented based on the configuration system of the in-vehicle USB port virtual Ethernet as described in any one of the first embodiments, and is characterized by comprising:
[0052] S21, unpacking the received USB message containing the binary data segment at the network layer and the data link layer;
[0053] S22, remove the network message header from the unpacked data to obtain the original data.
[0054] It should be noted that the process of data transmission is the process of encapsulating and packaging the original data. The example is as follows:
[0055] Use VLAN to create a virtual VLANID and encapsulate the data to be sent into a data segment. For example, send "Galaxy". "Galaxy" is called the original data, which is encapsulated at the network layer and data link layer. Add TCP, IP, and MAC headers to get LLC+IP+TCP+Galaxy, which is encapsulated into a binary data segment of 0101110101001000010 through VLANID.
[0056] Similarly, receiving data is the process of unpacking and parsing the received data. The example is as follows:
[0057] The binary data segment received through VLANID: 0101110101001000010 is unpacked at the network layer and data link layer, and the TCP, IP, and MAC headers are removed to obtain the original data of "Xinghe";
[0058] During the transmission process, the transmission data needs to be converted into network language binary. The present invention adopts Vlan technology, reuses the header TCP, IP, and MAC information in the encoding process, and forms different network vlanids through mutual permission of Vlantg, which can split multiple access transmission objects at the same time, and share the physical network link to achieve mutual non-interference sharing. Compared with traditional technology, Vlan technology is more flexible and can improve transmission efficiency and network security.
[0059] In summary, SOC chips all have USB ports. The present invention transmits data through the virtual Ethernet of the vehicle-mounted USB port, which can improve the transmission rate of the vehicle-mounted network, and the transmission rate can reach 12Mbit / second. At the same time, the method of the present invention does not require a dedicated Ethernet chip, and only needs to adjust the configuration of the virtual Ethernet driver, thereby reducing hardware costs.
[0060] The embodiment of the present invention further provides a terminal device. The terminal device includes: a processor, a memory, and a computer program stored in the memory and executable on the processor, such as a data transmission program. When the processor executes the computer program, the steps in the above-mentioned various data transmission method embodiments are implemented, such as Figure 2 Alternatively, the processor implements the functions of each module / unit in the above-mentioned device embodiments when executing the computer program.
[0061] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory and executed by the processor to implement the present invention. The one or more modules / units may be a series of computer program instruction segments capable of implementing specific functions, which are used to describe the execution process of the computer program in the terminal device.
[0062] The terminal device may be a computing device such as a desktop computer, a notebook, a PDA, and a smart tablet. The terminal device may include, but is not limited to, a processor and a memory. Those skilled in the art will appreciate that the above components are merely examples of terminal devices and do not constitute a limitation on the terminal device. The terminal device may include more or fewer components than the above components, or may combine certain components, or different components. For example, the terminal device may also include input and output devices, network access devices, buses, etc.
[0063] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the terminal device, and uses various interfaces and lines to connect various parts of the entire terminal device.
[0064] The memory can be used to store the computer program and / or module, and the processor realizes various functions of the terminal device by running or executing the computer program and / or module stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0065] Wherein, if the module / unit integrated in the terminal device is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0066] It should be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the accompanying drawings of the device embodiments provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art may understand and implement it without paying any creative effort.
[0067] The specific embodiments described above further illustrate the purpose, technical solutions and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. It is particularly pointed out that for those skilled in the art, any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of protection of the present invention.
Claims
1. A system for configuring a virtual Ethernet for a vehicle-mounted USB port, characterized in that: include: The hardware layer is used to configure registers to implement hardware transmission; USB protocol layer, used to bind the callback function of USB protocol layer and remove coupling to facilitate porting and code reuse; The MAC protocol layer is used to receive network messages and convert them into corresponding USB messages, or receive USB messages from the USB protocol layer and convert them into corresponding network messages; The network card driver layer includes a network protocol stack, which is used to receive or send network messages; The network protocol stack uses VLAN to multiplex the network message header information, encapsulates the network message into a data segment for transmission, or unpacks the received data segment into the network message.
2. The vehicle-mounted USB port virtual Ethernet configuration system according to claim 1, characterized in that: The network card driver layer is also used to encapsulate the network message again so that the final transmission format is the network message.
3. The system for configuring a virtual Ethernet for a vehicle-mounted USB port according to claim 1, characterized in that: The MAC protocol layer is also used to select a corresponding driver protocol according to the installed driver to encapsulate the message into a network message.
4. The system for configuring a virtual Ethernet for an in-vehicle USB port according to claim 1, characterized in that: The MAC protocol layer is used to convert the network message of the MAC layer into a binary USB message by binding the network message header of the USB protocol layer.
5. The vehicle-mounted USB port virtual Ethernet configuration system according to claim 4, characterized in that: The MAC protocol layer includes a platform driver, and the platform driver is used to allocate resources, initialize hardware, and obtain a MAC address.
6. The system for configuring a virtual Ethernet for an in-vehicle USB port according to claim 1, characterized in that: Each network message has a 2-byte network message header, and each network message contains only one Ethernet frame.
7. The system for configuring a virtual Ethernet for an in-vehicle USB port according to claim 1, characterized in that: Each USB message includes multiple Ethernet frames, and calling a USB message once corresponds to sending or receiving multiple network messages.
8. A data transmission method, implemented based on the configuration system of the in-vehicle USB port virtual Ethernet according to any one of claims 1 to 7, characterized in that: include: Get the original data to be sent; Encapsulate the original data at the network layer and data link layer, and add a network message header to obtain a network message; The network message is encapsulated into a USB message containing a binary data segment using VLAN for transmission.
9. A data transmission method, implemented based on the configuration system of the in-vehicle USB port virtual Ethernet according to any one of claims 1 to 7, characterized in that: include: After the received USB message containing the binary data segment is unpacked into a network message using VLAN, it is unpacked at the network layer and data link layer; Remove the network message header from the unpacked data to obtain the original data.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located is controlled to execute the data transmission method according to any one of claims 8 or 9.
Citation Information
Patent Citations
USB network card and communication method
CN115499505A