WO2023221486A1 - Method and apparatus for processing messages - Google Patents

Method and apparatus for processing messages Download PDF

Info

Publication number
WO2023221486A1
WO2023221486A1 PCT/CN2022/139226 CN2022139226W WO2023221486A1 WO 2023221486 A1 WO2023221486 A1 WO 2023221486A1 CN 2022139226 W CN2022139226 W CN 2022139226W WO 2023221486 A1 WO2023221486 A1 WO 2023221486A1
Authority
WO
WIPO (PCT)
Prior art keywords
message
priority
processing
time
real
Prior art date
Application number
PCT/CN2022/139226
Other languages
French (fr)
Chinese (zh)
Inventor
许正磊
杨凯
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2023221486A1 publication Critical patent/WO2023221486A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • H04L67/61Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources taking into account QoS or priority requirements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L2012/40208Bus networks characterized by the use of a particular bus standard
    • H04L2012/40215Controller Area Network CAN
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L2012/40267Bus for use in transportation systems
    • H04L2012/40273Bus for use in transportation systems the transportation system being a vehicle

Definitions

  • the present application relates to the field of vehicle communications, and more specifically, to a message processing method and device.
  • CAN controller area network
  • ETH Ethernet
  • an electronic control unit (ECU) or controller can support both CAN and Ethernet communication, and an ECU or controller supports multiple physical interfaces (or "ports") of the same type.
  • the messages are generally received through system interrupts.
  • the interrupt priority is set according to the physical interface (the interface corresponding to each CAN/ETH bus).
  • the priority of the CAN bus interrupt is higher than the priority of the Ethernet bus interrupt.
  • CAN/ETH is a bus
  • different delays can be transmitted in the same interface.
  • This application provides a message processing method and device, which helps to improve the reliability and real-time performance of message processing.
  • the vehicle (sometimes referred to as a vehicle) in this application is a vehicle in a broad sense, which can be a means of transportation (such as a car, a truck, a motorcycle, an airplane, a train, a ship, etc.), an industrial vehicle (such as a forklift, a trailer, a tractor) etc.), engineering vehicles (such as excavators, bulldozers, cranes, etc.), agricultural equipment (such as lawn mowers, harvesters, etc.), amusement equipment, toy vehicles, etc.
  • the embodiments of this application do not specifically limit the types of vehicles.
  • the first aspect provides a message processing method, which can be executed by the vehicle; or it can also be executed by the vehicle's on-board terminal such as a vehicle machine, or it can also be executed by an ECU, etc.; or it can also be executed by the vehicle.
  • the vehicle's chip or circuit execution is not limited in this application.
  • the following takes the execution of a message transceiver module, such as a MAC transceiver module or a CAN transceiver module, in a certain ECU of the vehicle as an example.
  • the method may include: determining the priority of the first message; when the priority of the first message meets the first condition, generating a scheduling request, where the scheduling request is used to request real-time processing of the first message; When the priority of the first message meets the second condition, polling processing of the first message is waited for.
  • different processing methods can be used for messages with different priorities based on the priority of the message, so that high-priority messages or messages that affect vehicle safety are processed first, which is conducive to ensuring high priority Real-time processing of messages or messages that affect vehicle safety.
  • Polling processing of business messages with low priority or audio and video streams can improve processing performance and avoid the impact of high-frequency interruptions on the performance of the message processing system. .
  • the first message may be an Ethernet message, or it may be a CAN message, or it may be other messages, which is not specifically limited in the embodiment of the present application.
  • the priority of the first message may be determined according to message fields, field combinations or message content. For example, determine the priority of the first message through the priority field PCP; or determine the priority of the first message through the Message ID field. In some possible implementations, the priority of the first message may also be determined according to protocol provisions, or the priority of the message may be determined in other ways, which is not specifically limited in the embodiments of this application.
  • the real-time processing includes but is not limited to interrupts, soft interrupts, and task scheduling.
  • the polling process may be a periodic polling process, where the cycle of the polling process may be 100 milliseconds, or 500 milliseconds, or other cycles, which are not specifically limited in the embodiments of the present application.
  • the above-mentioned first condition and the above-mentioned second condition are associated with the content carried by the first packet.
  • the first condition is that the content carried by the first packet is control instructions such as vehicle control instructions
  • the second condition is that the content carried by the first packet is entertainment content such as audio and video streams.
  • the first condition is that the first message is a management message
  • the second condition is that the first message is a service message.
  • management packets may include packets for network (or device) management and/or control
  • service packets may include, in addition to management packets, other packets that do not have network (or device) management, Messages for control functions.
  • the first condition and the second condition may also be other conditions associated with the content of the first message.
  • the first condition includes that the priority of the first message is higher than a preset threshold, and the second condition includes that the priority of the first message is lower than or equal to the preset threshold.
  • the method when the priority of the first message satisfies the first condition, the method further includes: determining the first priority according to the priority of the first message.
  • the scheduling priority of the message is used to indicate the priority of the real-time processing; the generating of the scheduling request includes: generating the scheduling request according to the scheduling priority of the first message.
  • the priority of the message can be mapped to the interrupt priority, and further, an interrupt request with priority can be generated according to the interrupt priority.
  • an interrupt request with priority can be generated according to the interrupt priority.
  • a high-priority interrupt request is generated for a message with a higher interrupt priority
  • a low-priority interrupt request is generated for a message with a lower interrupt priority.
  • Messages with high interrupt request priority can interrupt messages with low interrupt request priority.
  • the priority of the message can be mapped to the soft interrupt priority, and further, a soft interrupt request with priority can be generated according to the soft interrupt priority.
  • the priority of the message can be mapped to the task scheduling priority, and further, a task scheduling request with priority can be generated according to the task scheduling priority.
  • the packet processing system can prioritize packets with higher task scheduling priority, and then process packets with lower task scheduling priority.
  • the message transceiving module can also generate a scheduling request without priority for the first message, and then send the scheduling request and scheduling priority indication information respectively, where the scheduling priority indication information is used to indicate The scheduling priority of the first packet.
  • scheduling requests of different priorities are generated according to the priority of the message, so that high-priority messages can be processed preferentially.
  • the priority of packets that affect vehicle safety is higher, and the priority of business packets such as data transmission with large amounts of data, obvious business burst characteristics, and audio and video streaming in the entertainment domain is lower.
  • the above technical solutions can ensure the real-time processing of messages that affect vehicle safety and help improve vehicle safety.
  • the method further includes: based on the priority of the first message and the used space of the message buffer, The first message is cached, and the used space of the message cache area is used to represent the used space of the cached message area.
  • the method further includes: when the priority of the first message is higher than a first threshold, and/or the used space of the message buffer is less than a second threshold when, the first message is cached.
  • the first threshold may be a specific value of a field that represents priority; or, the first threshold may also be a quantized value of a specific value of a field that represents priority.
  • the second threshold may be a specific value of the used space in the message buffer, or may be the proportion of the used space in the message buffer occupying the total space in the message buffer.
  • the method before caching the first message, further includes: when the used space of the message buffer is greater than a third threshold, deleting one or more The second message has a priority lower than the priority of the first message.
  • the second threshold may be a specific value of the used space in the message buffer, or may be the proportion of the used space in the message buffer occupying the total space in the message buffer.
  • the third threshold may be 90% of the cache space, or may be other values, which are not specifically limited in this embodiment of the present application.
  • the second packet may be the packet with the lowest priority.
  • high-priority packets are used to seize cache space for low-priority packets, preventing high-priority packets from being lost due to buffer overflow, and improving the reliability of the packet processing system.
  • the method further includes: determining a priority of a third message; when the priority of the third message is lower than or equal to the first threshold, and the priority of the third message is When the used space of the message buffer is greater than or equal to the second threshold, the third message is discarded.
  • a message processing method is provided, which can be executed by the vehicle; or it can also be executed by the vehicle's on-board terminal such as a vehicle machine, or it can also be executed by an ECU, etc.; or it can also be executed by the vehicle.
  • the vehicle's chip or circuit execution is not limited in this application.
  • the following takes the system scheduling module and TCP/IP protocol stack execution in an ECU of the vehicle as an example.
  • the method may include: determining a first processing strategy for the first message, the first processing strategy being one of real-time processing and polling processing; processing the first message according to the first processing strategy, wherein , the real-time processing is performed when the priority of the first message meets the first condition, and the polling processing is performed when the priority of the first message meets the second condition.
  • higher priority messages can be processed in real time according to scheduling requests, which can improve the real-time performance of higher priority message processing; when the message processing system is idle, lower priority messages can be processed in real time.
  • Message polling processing can avoid the impact of high-frequency interruptions on the performance of the message processing system, and helps improve the performance of the message processing system.
  • the method further includes: receiving a scheduling request, the scheduling request being used to request real-time processing of the first message; and determining the processing of the first message in real time.
  • a processing strategy includes: determining that the first processing strategy for the first message is real-time processing according to the scheduling request.
  • the method further includes: before performing the real-time processing on the first message, interrupting the polling processing on the fourth message; After a packet is processed in real time, polling processing is continued on the fourth packet, where the priority of the fourth packet is lower than the priority of the first packet.
  • the real-time processing of the first message includes a first moment, and the first moment is the moment when the polling process starts.
  • the method also includes The method includes: controlling the first time to be delayed to a second time, the second time being the time after the real-time processing of the first message is performed, and the second time being the time when polling processing starts.
  • the polling process may be a periodic polling process, where the cycle of the polling process may be 100 milliseconds or 500 milliseconds.
  • the polling processing cycle arrives, and the fourth message needs to be polled. In the above situation, the polling process is suspended, and after the real-time processing of the first message is completed, the polling process of the fourth message is started.
  • a message processing device may include: a first processing unit and a second processing unit, wherein the first processing unit is used to determine the priority of the first message; the second processing unit The processing unit is configured to generate a scheduling request when the priority of the first message satisfies the first condition, and the scheduling request is used to request real-time processing of the first message; when the priority of the first message satisfies In the second condition, wait for the polling processing of the first message.
  • the first processing unit and the second processing unit may be the same processing unit, that is, determining the priority of the first message and generating the scheduling request may be completed by one processing unit.
  • the first condition includes that the priority of the first message is higher than a preset threshold
  • the second condition includes that the priority of the first message is lower than or equal to the preset threshold
  • the second processing unit is also configured to: when the priority of the first message meets the first condition, according to the priority of the first message
  • the scheduling priority of the first message is determined, and the scheduling priority is used to indicate the priority of the real-time processing; and the scheduling request is generated according to the scheduling priority of the first message.
  • the device further includes: a third processing unit, configured to, after determining the priority of the first message, process the first message according to the priority and The used space of the message cache area is used to cache the first message.
  • the used space of the message cache area is used to represent the used space of the cached message area.
  • the third processing unit, the first processing unit and the second processing unit may be different processing units, or they may be the same processing unit, which is not specifically limited in the embodiments of this application.
  • the third processing unit is also used to: when the priority of the first message is higher than the first threshold, and/or the message buffer area has used space When it is less than the second threshold, the first message is cached.
  • the third processing unit is further configured to: before caching the first message, when the used space of the message buffer is greater than the third threshold, delete One or more second messages, the priority of the second message is lower than the priority of the first message.
  • the first processing unit is also used to: determine the priority of the third message; the third processing unit is also used to: determine the priority of the third message.
  • the priority is lower than or equal to the first threshold and the used space in the message buffer is greater than or equal to the second threshold, the third message is discarded.
  • a message processing device in a fourth aspect, includes: a first processing unit and a second processing unit, wherein the first processing unit is used to determine a first processing strategy for the first message, and the The first processing strategy includes real-time processing and polling processing; the second processing unit is used to process the first message according to the first processing strategy, wherein the real-time processing is such that the priority of the first message satisfies The processing is performed when the first condition is met, and the polling processing is performed when the priority of the first message meets the second condition.
  • the device further includes: a transceiver unit, configured to receive a scheduling request, the scheduling request being used to request real-time processing of the first message; the first processing The unit is also configured to determine, according to the scheduling request, that the first processing strategy for the first message is real-time processing.
  • the second processing unit is further configured to: interrupt the polling processing of the fourth message before performing the real-time processing of the first message; After the real-time processing of the first message, polling processing of the fourth message is continued, wherein the priority of the fourth message is lower than the priority of the first message.
  • the real-time processing of the first message includes a first moment, the first moment being the moment when the polling process starts, the second process
  • the unit is also configured to: control the first time to be delayed to a second time, the second time being the time after the real-time processing of the first message is performed, and the second time being the time when polling processing starts.
  • a message processing device in a fifth aspect, includes: a memory for storing a program; a processor for executing the program stored in the memory.
  • the processor When the program stored in the memory is executed, the processor is configured to execute the above A method in any possible implementation manner of the first aspect.
  • a message processing system in a sixth aspect, includes the device in any of the possible implementations of the third aspect and/or the fourth aspect, or the system includes any one of the fifth aspects. device in an implementation manner.
  • a seventh aspect provides a vehicle, which includes the device in any possible implementation manner of the third aspect and/or the fourth aspect, or the device in any possible implementation manner of the fifth aspect, or The system in any implementation manner of the above sixth aspect.
  • a computer program product includes: computer program code.
  • the computer program code When the computer program code is run on a computer, it enables the computer to execute any one of the first aspect or the second aspect. method within the method.
  • the above computer program code may be stored in whole or in part on the first storage medium, where the first storage medium may be packaged together with the processor, or may be packaged separately from the processor. This is not the case in the embodiments of this application. Specific limitations.
  • a computer-readable medium stores program code.
  • the computer program code When the computer program code is run on a computer, it makes it possible for the computer to execute any one of the first aspect or the second aspect. Methods in the implementation.
  • a chip in a tenth aspect, includes a processor for calling a computer program or computer instructions stored in a memory, so that the processor executes any of the possible implementation methods of the first aspect or the second aspect. method in.
  • the processor is coupled with the memory through an interface.
  • the chip system further includes a memory, and a computer program or computer instructions are stored in the memory.
  • Figure 1 is a schematic diagram of a communication system interrupting reception of messages.
  • Figure 2 is a schematic diagram of a network architecture provided by an embodiment of the present application.
  • FIG. 3 is a schematic diagram of an Ethernet protocol stack system architecture provided by an embodiment of the present application.
  • Figure 4 is a schematic diagram of a CAN bus system architecture provided by an embodiment of the present application.
  • Figure 5 is a schematic flow chart of a message processing method provided by an embodiment of the present application.
  • Figure 6 is a schematic diagram of a cache queue and a message cache area provided by an embodiment of the present application.
  • Figure 7 is a schematic flow chart of a message processing method provided by an embodiment of the present application.
  • Figure 8 is a schematic diagram of a packet discarding parameter setting provided by an embodiment of the present application.
  • Figure 9 is a schematic flow chart of a message processing method provided by an embodiment of the present application.
  • Figure 10 is another schematic flow chart of a message processing method provided by an embodiment of the present application.
  • Figure 11 is a schematic block diagram of a packet processing device provided by an embodiment of the present application.
  • Figure 12 is a schematic block diagram of a packet processing device provided by an embodiment of the present application.
  • Ethernet network As vehicles evolve towards intelligence, software-defined vehicles have become a new development model for future vehicle software systems. During the actual operation of the vehicle, the communication between various sensors (such as lidar, millimeter wave radar, ultrasonic radar, etc.) and the control system Information interaction, audio and video stream transmission, etc. require the use of large-bandwidth communication buses. The flexibility and large bandwidth of the Ethernet network have become the choice of vehicle communication bus technology. However, the delay fluctuation and lack of reliability guarantee of the Ethernet network are challenged in the field of vehicle applications. They are key technical issues that need to be solved for the application of Ethernet network in the vehicle field. In the application scenario of automotive Ethernet, the following characteristics affect the deterministic delay and reliability of the Ethernet network:
  • burst nature of Ethernet messages Since the CAN bus is dominated by periodic messages, the load of the CAN bus has been determined during system design. The business carried by the Ethernet network is flexible, and the time when each data source sends data to the Ethernet bus may be concurrent, that is, some data overlap in time, which is a so-called conflict, causing the bursty characteristics of Ethernet messages to affect the transmission. Latency and reliability.
  • Ethernet does not provide reliable transmission at the MAC layer and network layer; in automotive Ethernet networks, the transmission layer generally uses the user datagram protocol (UDP) protocol, and the UDP protocol is also unreliable. Transmission protocols, the above-mentioned protocols without reliability guarantee may lead to unreliable data transmission in the Ethernet network.
  • UDP user datagram protocol
  • the vehicle Ethernet network is an embedded system with limited memory and computing resources, and its processing power is inferior to ordinary network information technology (IT) systems, which will affect the deterministic delay of the Ethernet network.
  • IT network information technology
  • Ethernet As the most popular IT technology in the field, Ethernet has also begun to be promoted and applied in the field of industrial control that requires high reliability and latency. Ethernet already has many mature solutions and standards in terms of delay guarantee and reliability, such as the time-sensitive networking (TSN) protocol for deterministic delay network solutions.
  • TSN time-sensitive networking
  • the transport layer/network layer in the ETH network uses the same scheduling mechanism to receive and/or process messages of different priorities, so that in a message burst scenario, large-bandwidth low-priority messages
  • the packets may affect the reception and/or processing of high-priority packets, resulting in high-priority packets not being processed in time or packet loss.
  • the system is connected to the CAN bus and the Ethernet network at the same time.
  • the common method in the industry is to set interrupts according to the physical interface.
  • the priority of the CAN bus interrupt is usually higher than the priority of the Ethernet bus interrupt.
  • the reception of Ethernet high-priority packets is shown in Figure 1.
  • embodiments of the present application provide a message processing method and device, which can determine the priority of the message according to the message content, and then perform scheduling based on the message priority, so that the message can be processed according to the protocol at the transport layer/network layer.
  • high-priority packets can be processed first; in the MAC layer receive buffer overflow scenario, high-priority packets can preempt the low-priority queue cache, thereby ensuring the reliability and low latency of high-priority packets.
  • the system receives the CAN message and the ETH message at the same time, it determines the priority of the CAN message and the ETH message and uses different communication technologies according to the priority of the CAN message and the ETH message. Or between different ports of unified communication technology, system scheduling requests of different priorities can be generated according to the message priority to solve the problem of low-priority messages on the CAN bus interrupting the reception of high-priority messages caused by physical port interruptions.
  • Interrupt A mechanism used by the computer's operating system to respond to hardware device requests. When the operating system receives an interrupt request from the hardware, it will interrupt the executing process, and then call the interrupt handler in the kernel to respond to the request.
  • Soft interrupt In order to solve the problem of too long execution of the interrupt handler and loss of interrupts, the interrupt is divided into two parts: the upper part is used to quickly handle the interrupt. Generally, the interrupt request is temporarily closed and is mainly responsible for processing closely related to the hardware. Or time-sensitive events; the second half is used to delay processing of the unfinished work of the first half, and generally runs in the form of a "kernel thread". That is, soft interrupts use the concept of hardware interrupts to simulate them in software to achieve macroscopic asynchronous execution effects.
  • Task scheduling When multiple tasks share computer system resources at the same time, in order to ensure that multiple tasks can be executed smoothly, the operating system schedules multiple tasks according to certain principles so that they can be executed in a certain order.
  • Scheduling During the actual processing of messages (or data), there is a sequence or dependency relationship between messages. In order to ensure the normal progress of message processing, these messages are required to be executed in an orderly and efficient manner according to the sequence relationship or dependency relationship. Scheduling mechanisms include but are not limited to the above-mentioned interrupts, soft interrupts, and task scheduling.
  • FIG. 2 is an architecture diagram of an Ethernet system provided by this application, including a receiving/transmitting host 100 and an Ethernet switching/routing device 200.
  • the host 100 includes a media access control (media access control, MAC) layer transceiver module 110, a transmission control protocol/Internet protocol (transmission control protocol/Internet protocol, TCP/IP) protocol stack module 120, a CAN transceiver module 130 and a CAN and Upper layer protocol stack module 140.
  • the MAC layer transceiver module 110 and the TCP/IP protocol stack module 120 can implement priority identification based on message content and priority-based scheduling, thereby ensuring the reliability and low latency of high-priority messages.
  • the scheduling priority can also be determined based on the content to achieve unified identification and scheduling of message priorities between different bus technologies.
  • the receiving/transmitting host 100 can be set in an Internet of Vehicles intelligent terminal with external communication functions, such as a vehicle-mounted terminal (telematics box, T-Box), or can also be set in a vehicle control module. , such as vehicle dynamics control (VDC), vehicle control unit (VCU), vehicle domain controller (domain control unit, DCU), etc., or it can also be set in other control units, such as ECU etc., the embodiments of this application do not specifically limit this.
  • VDC vehicle dynamics control
  • VCU vehicle control unit
  • DCU domain controller
  • ECU electronic subnet control unit
  • Figure 3 shows the logical architecture diagram of the Ethernet network and the upper layer protocol stack within the host 100. The following will describe in detail the workflow of the host 100 after receiving the message in conjunction with Figure 3.
  • the MAC layer transceiver module 110 includes a message reception control module 111 and a reception queue cache module 112.
  • the message reception control module 111 is used to complete the reception of MAC layer messages and identify the priority of MAC layer messages.
  • the receiving queue cache module 112 is used for cache maintenance and cache control, divides the cache queue according to the message priority, and in the cache When the space usage exceeds the set threshold, high-priority messages are cached first, and the cache results are returned to the message reception control module 111.
  • the TCP/IP protocol stack module 120 is used to further process the message.
  • the TCP/IP protocol stack module 120 includes a protocol stack processing control module 121 and a protocol stack processing module 122.
  • the protocol stack processing control module 121 controls the protocol stack according to the priority processing policy.
  • the processing module 122 processes messages according to the protocol; the protocol stack processing module 122 reads (or receives) cached messages of different priority queues in the queue cache module 112 and processes them.
  • the system scheduling module 150 is used to call the corresponding protocol stack processing control module according to the scheduling requests of different priorities generated by the message reception control module 111.
  • the system scheduling control module 150 can have multiple scheduling strategies, such as hard interrupts and soft interrupts. , task scheduling, etc., when multiple scheduling requests conflict/compete, schedule according to priority.
  • FIG. 4 shows the system architecture diagram of the CAN bus inside the host 100.
  • the working principle of the CAN transceiver module 130 is similar to that of the MAC transceiver module 110 in FIG. Other information determines the CAN message priority; generates scheduling requests with different priorities, and then sends scheduling requests to the system scheduling control module 150; the working principle of the CAN and upper layer protocol stack module 140 is the same as the TCP/IP protocol stack module 120 in Figure 3 Similarly, that is, to further process the CAN signal, the CAN and upper layer protocol stack module 140 may also include a protocol stack processing control module and a protocol stack processing module; the system scheduling control module 150 is used to schedule requests of different priorities according to the scheduling requests of different priorities generated by the CAN transceiver module 130. Call the corresponding protocol stack processing control module. When the system scheduling control module 150 receives multiple scheduling requests with CAN message priority information and multiple scheduling requests with MAC message priority information at the same time, it calls the corresponding protocol stack processing control module according to the scheduling request. Message processing.
  • Figure 2 may also include a system scheduling control module.
  • Figure 5 shows an exemplary flow chart of a message processing method provided by an embodiment of the present application.
  • the method 500 can be applied to the system shown in Figure 2, or can also be used in the system shown in Figure 3 or Figure 4. implement.
  • the steps or operations of the message processing method shown in FIG. 5 are only exemplary illustrations, and the embodiment of the present application may also perform other operations or modifications of each operation in FIG. 5 .
  • the method 500 includes:
  • the first message may be an Ethernet message; or the first message may also be a CAN message.
  • the Ethernet message is processed through the MAC layer protocol, such as MAC address filtering, cyclic redundancy check (CRC) verification, etc.; or through the CAN protocol Analyze CAN messages.
  • the MAC layer protocol such as MAC address filtering, cyclic redundancy check (CRC) verification, etc.
  • CRC cyclic redundancy check
  • receiving includes the reception of messages by the CAN transceiver module or the MAC transceiver module.
  • S502 Determine the priority of the first message.
  • the message priority is identified based on message fields, field combinations or message content.
  • the step of determining the priority of the first message is completed by the CAN transceiver module or the MAC transceiver module described in the above embodiment.
  • the priority of the first packet is used to indicate the priority of packet processing. For packets with high priority, priority will be processed according to the protocol corresponding to the first packet. For example, the CAN protocol is used to process CAN messages, and the TCP/IP protocol or UDP protocol is used to process Ethernet messages.
  • S503 Determine the message processing strategy of the first message according to the priority of the first message.
  • the message processing strategy includes immediate reception and periodic polling.
  • the immediate reception includes generating a scheduling request for the first message.
  • receive the first message for example, map the priority of the first message to the scheduling priority, and generate a scheduling request;
  • periodic polling means not generating a scheduling request and waiting for periodic polling processing by the upper layer protocol stack.
  • immediate reception refers to realizing real-time or quasi-real-time processing of messages through scheduling mechanisms such as interrupts, operating system soft interrupts, and task scheduling;
  • periodic polling reception mode refers to the system's processing of low-priority Ethernet messages through Receive messages in batches in periodic polling mode. It should be understood that periodic polling may include calling the upper layer protocol stack (such as the transport layer or network layer) to periodically query the message cache area. If there are messages to be processed in the message cache area, the message to be processed is processed.
  • the immediate reception mode is adopted for high-priority and medium-priority packets
  • the periodic polling mode is adopted for low-priority packets.
  • a high-priority interrupt request is generated for a message with a higher interrupt priority
  • a low-priority interrupt request is generated for a message with a lower interrupt priority.
  • Messages with high interrupt request priority can interrupt messages with low interrupt request priority.
  • the packet processing method can also use two or more scheduling mechanisms for mixed processing. For example, interrupts are used to receive messages with higher priority, and task scheduling is used to process messages with lower priority; or other mixed scheduling mechanisms can also be used to process messages.
  • interrupts are used to receive messages with higher priority
  • task scheduling is used to process messages with lower priority
  • other mixed scheduling mechanisms can also be used to process messages.
  • S504 schedule the upper layer protocol stack to process messages according to the scheduling request; at the same time, schedule the upper layer protocol stack to periodically trigger periodic polling tasks to process low-priority messages.
  • the message processing system scheduling control module schedules the upper layer protocol stack to receive and process the message immediately; if the first message is For low-priority messages, the message processing system periodically schedules the upper-layer protocol stack to poll the message buffer area, and uniformly processes all low-priority messages in the message buffer area, including the first message.
  • the upper-layer protocol stack when the message processing system is idle, that is, when the upper layer protocol stack does not immediately receive and process high-priority messages, the upper-layer protocol stack is scheduled to process low-priority messages in batches through periodic polling.
  • the packet processing policy of the first packet is immediate reception
  • the first packet is processed in real-time or quasi-real-time through one or more methods of interrupt, soft interrupt, and task scheduling.
  • the system receives a new scheduling request and requests the system to process the first packet. If the scheduling request priority of the first packet is higher than the scheduling request priority of the second packet, , then the processing of the second message is suspended and the first message is processed first; if the scheduling request priority of the first message is the same as that of the second message, or the scheduling request priority of the first message is lower than that of the second message If the priority of the scheduling request of the message is determined, you can wait for the second message to be processed before processing the first message.
  • the packet processing strategy of the first packet is periodic polling reception, the system periodically schedules the upper layer protocol stack (such as the transport layer or network layer) to receive the packet and process the packet.
  • the above-mentioned polling period may be 100 milliseconds, or it may be 500 milliseconds, or it may be other lengths of time, which are not specifically limited in the embodiments of this application.
  • the first message when processing the first message, can be processed according to the upper layer protocol, for example, the first message can be processed through the TCP/IP protocol, or the UDP protocol; or, through The CAN protocol or the like processes the first message, which is not specifically limited in the embodiments of this application.
  • "message processing” includes “the upper layer protocol stack (such as the transport layer or network layer) receives the message” and/or "the upper layer protocol stack (such as the transport layer or network layer) processes the message according to the communication protocol Processed”.
  • the message processing method provided by the embodiment of the present application can control the priority of message processing based on the priority of the message, so that high-priority messages are processed with priority, which is beneficial to ensuring the processing time of high-priority messages. Delay is better than low-priority packets.
  • management messages that affect vehicle safety have a high priority
  • business messages with large amounts of data, obvious business burst characteristics, data transmission, entertainment domain audio and video streams, etc. have a low priority.
  • the message processing method of the application embodiment processes high-priority messages through immediate reception (such as interruption), which can ensure the real-time processing of high-priority messages that affect vehicle safety, and processes low-priority business messages through periodic polling.
  • Low-priority packets are processed only after high-priority packets are processed, so that in mixed transmission scenarios of control flow, data, audio and video flows with different priorities, large-bandwidth/burst low-priority data flows will not affect high-priority data flows.
  • the transmission of priority messages improves the reliability of vehicle control command transmission.
  • the packet processing method provided by the embodiment of the present application can avoid the interruption of low-priority packets caused by setting priorities based on physical interfaces and the processing of high-priority packets that affect other ports, helping to improve high-priority packets.
  • the processing of messages is real-time and reliable.
  • the system after receiving one or more messages, the system will cache the messages in the corresponding cache queue, and then based on the "start address" included in the "message description information" of each message, Cache the messages in the cache queue to the message cache area.
  • messages 1 to 4 in cache queue 1 and cache queue 2 are cached in the message cache area.
  • the cache queue can be set according to the packet priority. For example, high-priority packets can be set to the same cache queue, and low-priority packets can be set to another cache queue; or the same cache queue can be set.
  • There may be various messages with different priorities in the cache queue which are not specifically limited in this embodiment of the present application.
  • the message when there is no cache space in the message cache, the message can be discarded. The following describes a processing method in the message caching process provided by the embodiment of the present application with reference to FIG. 7 .
  • Figure 7 shows a schematic flowchart of a method for caching messages according to message priority provided by an embodiment of the present application.
  • This method 700 can be applied to the system shown in Figure 2, or can also be used in Figure 3 or The system shown in Figure 4 is implemented.
  • the method 700 includes:
  • S701 Receive the second message and determine the priority of the second message.
  • the method of determining the priority of the second packet may refer to the description in the above embodiment, and will not be described again here.
  • the second message may be the first message in the method 500, or may be a message different from the first message, which is not specifically limited in this embodiment of the present application.
  • S702 Determine whether the second packet satisfies the packet discarding condition based on the priority of the second packet and cache occupancy.
  • cache occupation in the embodiment of this application may include the used cache space of the message cache area.
  • one or more groups of packet discarding condition parameter pairs can be set, for example, [message priority threshold 1, message cache occupancy threshold 1], [message priority threshold 2, message cache occupancy threshold 2].
  • the second packet is discarded when the following conditions are met: the priority of the second packet is lower than the packet priority threshold X, and the buffer occupancy is higher than the packet discard buffer occupancy threshold X.
  • X can also be other values, and "X" should not be understood as a limitation on the embodiments of the present application. More intuitively, as shown in Figure 8, when the packet priority and cache occupancy are located in the shaded area in Figure 8, the second packet is discarded.
  • the conditions for executing S703 are not limited to the condition "the priority of the second message is lower than the message priority threshold X, and the cache occupancy is higher than the message discard cache occupancy threshold X" , that is, S703 can be executed when the priority of the second message is lower than or equal to the message priority threshold X and the buffer occupancy is higher than or equal to the message discard buffer occupancy threshold X.
  • the message cache occupancy threshold 1 can be 60% of the cache space, and the message cache occupancy threshold 2 can be 80% of the cache space. In some possible implementations, the message cache occupancy threshold may also be 100% of the cache space, which is not specifically limited in this application. It should be understood that the above examples of message priority thresholds 1 and 2 and message cache occupancy thresholds 1 and 2 are only illustrative and should not be understood as limitations to the embodiments of the present application.
  • the message priority threshold and the message cache occupancy threshold can also be other indicators or values, which are not specifically limited in the embodiments of this application.
  • S705 when the used space in the message buffer exceeds the preset threshold, S705 is executed. For example, when the used space in the message buffer exceeds 90% or 95%, S705 is executed; otherwise, S706 is executed.
  • the above preset threshold is less than or equal to the message cache occupancy threshold 2.
  • S705 Discard one or more low-priority packets whose priority is lower than the priority of the second packet.
  • the steps or operations of the message processing method shown in FIG. 7 are only exemplary illustrations, and the embodiment of the present application may also perform other operations or modifications of each operation in FIG. 7 .
  • the various steps in FIG. 7 may be performed in a different order than presented in FIG. 7 , and it is possible that not all operations in FIG. 7 may be performed. For example, when it is determined that the second packet satisfies the packet discard condition, S704 to S706 may be skipped; or S702 and S704 may also be executed at the same time, which is not specifically limited in this embodiment of the present application.
  • the message processing method provided by the embodiment of the present application can reduce the loss of high-priority messages due to buffer overflow by using high-priority messages to seize cache space for low-priority messages and discarding low-priority messages first. package probability to improve system reliability.
  • Figure 9 shows a schematic flow chart of a message processing method 900 provided by an embodiment of the present application.
  • the method 900 can be applied in the system architecture shown in FIG. 2 , and the method can also be executed by the system shown in FIG. 3 and/or FIG. 4 .
  • the steps or operations of the message processing method shown in FIG. 9 are only exemplary illustrations, and the embodiment of the present application may also perform other operations or modifications of each operation in FIG. 9 .
  • the method 900 includes:
  • S901 Determine the priority of the first message.
  • the first message may be the Ethernet message described in the above embodiment, or it may also be the CAN message described in the above embodiment.
  • the first message may be the first message in the above method 500.
  • the first message may also be the second message in the above method 700.
  • the first message may also be another message, which is not specifically limited in the embodiment of the present application.
  • the method of determining the priority of the first packet may refer to the description in the above embodiment, and will not be described again here.
  • S902 When the priority of the first message meets the first condition, generate a scheduling request.
  • the scheduling request is used to request real-time processing of the first message; when the priority of the first message meets the second condition time, waiting for the polling processing of the first message.
  • the real-time processing can be the "immediate reception” described in the above embodiment, including but not limited to interrupts, soft interrupts, and task scheduling.
  • the polling process may be the "periodic polling" described in the above embodiment, where the cycle of the polling process may be 100 milliseconds, or 500 milliseconds, or other cycles, which are not specifically limited in the embodiments of the present application.
  • the above-mentioned first condition includes that the priority of the first message is higher than the preset threshold, for example, the priority of the first message is high priority or medium priority as described above; the above-mentioned second condition includes the The priority of a packet is lower than or equal to the preset threshold.
  • the priority of the first packet is low priority as described above.
  • the first condition may include that the content carried by the first packet is a control instruction such as an empty vehicle command; the second condition may include that the content carried by the first packet is entertainment content such as audio and video streams.
  • the first condition and the second condition may also be other conditions associated with the content of the first message, which are not specifically limited in this embodiment of the present application.
  • the method of generating a scheduling request and waiting for polling processing may refer to the description in the above embodiment, and will not be described again here.
  • the message processing method provided by the embodiment of the present application can control the priority of message processing based on the priority of the message, so that high-priority messages are processed with priority, which is beneficial to ensuring the processing time of high-priority messages.
  • Delay is better than low-priority packets. Ensure the real-time processing of high-priority messages that affect vehicle safety, and process low-priority business messages through periodic polling, which can improve processing performance and avoid the impact of high-frequency interruptions on system performance.
  • Figure 10 shows a schematic flow chart of a message processing method 1000 provided by an embodiment of the present application.
  • the method 1000 can be applied in the system architecture shown in Figure 2, and the method can also be executed by the system shown in Figure 3 and/or Figure 4.
  • the steps or operations of the message processing method shown in FIG. 10 are only exemplary illustrations, and embodiments of the present application may also perform other operations or modifications of each operation in FIG. 10 .
  • the method 1000 includes:
  • the first processing strategy is one of real-time processing and polling processing.
  • the real-time processing can be the "immediate reception” described in the above embodiment, including but not limited to interrupts, soft interrupts, and task scheduling.
  • the polling process may be the "periodic polling" described in the above embodiment, where the cycle of the polling process may be 100 milliseconds, or 500 milliseconds, or other cycles, which are not specifically limited in the embodiments of the present application.
  • the first message may be the Ethernet message described in the above embodiment, or it may also be the CAN message described in the above embodiment.
  • the first message may be the first message in the above method 500.
  • the first message may also be the second message in the above method 700.
  • the first message may also be another message, which is not specifically limited in the embodiment of the present application.
  • the method of determining the first processing policy for the first packet may refer to the description in the above embodiment, and will not be described again here.
  • S1020 process the first message according to the first processing policy, where the real-time processing is performed when the priority of the first message meets the first condition, and the polling process is performed on the first message. Processed when the priority meets the second condition.
  • the above-mentioned first condition includes that the priority of the first message is higher than the preset threshold, for example, the priority of the first message is high priority or medium priority as described above; the above-mentioned second condition includes the The priority of a packet is lower than or equal to the preset threshold.
  • the priority of the first packet is low priority as described above.
  • the first condition may include that the content carried by the first packet is a control instruction such as an empty vehicle command; the second condition may include that the content carried by the first packet is entertainment content such as audio and video streams.
  • the first condition and the second condition may also be other conditions associated with the content of the first message, which are not specifically limited in this embodiment of the present application.
  • higher priority messages can be processed in real time according to scheduling requests, which can improve the real-time performance of higher priority message processing; in the message processing system When idle, polling for lower-priority messages can avoid the impact of high-frequency interrupts on the performance of the message processing system and help improve the performance of the message processing system.
  • FIG 11 shows a schematic block diagram of a packet processing device 2000 provided by an embodiment of the present application.
  • the device 2000 includes a first processing unit 2010 and a second processing unit 2020.
  • the first processing unit 2010 and the second processing unit 2020 are used for data processing.
  • the device 2000 also includes a transceiver unit 2030, which can implement corresponding communication functions.
  • the device 2000 may also include a storage unit, which may be used to store instructions and/or data, and the processing unit 2020 may read the instructions and/or data in the storage unit, so that the device implements the foregoing method embodiments. .
  • the apparatus 2000 may include units for performing the methods in FIG. 5, FIG. 7, FIG. 9, and FIG. 10. Moreover, each unit in the device 2000 and the above-mentioned other operations and/or functions are respectively intended to implement the corresponding processes of the method embodiments in FIG. 5, FIG. 7, FIG. 9, and FIG. 10.
  • the first processing unit 2010 can be used to execute S901 in the method 900
  • the second processing unit 2020 can be used to execute S902 in the method 900.
  • the device 2000 includes: a first processing unit 2010 and a second processing unit 2020, where the first processing unit 2010 is used to determine the priority of the first message; the second processing unit 2020 is used to, in the When the priority of the first message meets the first condition, a scheduling request is generated, and the scheduling request is used to request real-time processing of the first message; when the priority of the first message meets the second condition, wait for the Polling processing of the first message.
  • the first processing unit 2010 and the second processing unit 2020 may be the same processing unit.
  • it may be the MAC transceiver module 110 described in the above embodiment, or it may also be the CAN transceiver module 130.
  • the first processing unit 2010 and the second processing unit 2020 may be the message reception control module 111.
  • the first condition includes that the priority of the first packet is higher than a preset threshold
  • the second condition includes that the priority of the first packet is lower than or equal to the preset threshold
  • the second processing unit 2020 is also configured to: when the priority of the first message meets the first condition, determine the priority of the first message according to the priority of the first message. Scheduling priority, the scheduling priority is used to indicate the priority of the real-time processing; the scheduling request is generated according to the scheduling priority of the first message.
  • the device 2000 further includes: a third processing unit, configured to, after determining the priority of the first message, process the first message according to the priority of the first message and the used space in the message cache. , cache the first message, and the used space of the message cache area is used to represent the used space of the cached message area.
  • a third processing unit configured to, after determining the priority of the first message, process the first message according to the priority of the first message and the used space in the message cache. , cache the first message, and the used space of the message cache area is used to represent the used space of the cached message area.
  • the third processing unit may be the receive queue buffer module 112 described in the above embodiment.
  • the first processing unit 2010, the second processing unit 2020 and the third processing unit may be unified processing units, such as the MAC transceiver module 110 or the CAN transceiver module 130.
  • the third processing unit is also configured to: cache the first message when the priority of the first message is higher than a first threshold, and/or the used space in the message buffer is less than a second threshold. First message.
  • the third processing unit is also configured to: before caching the first message, delete one or more second messages when the used space in the message buffer is greater than a third threshold. , the priority of the second message is smaller than the priority of the first message.
  • the first processing unit 2010 is also used to: determine the priority of the third message; the third processing unit is also used to: when the priority of the third message is lower than or equal to the When the first threshold is reached and the used space in the message buffer is greater than or equal to the second threshold, the third message is discarded.
  • the first processing unit 2010 can be used to perform S1010 in the method 1000
  • the second processing unit 2020 can be used to perform S1020 in the method 1000.
  • the device 2000 includes: a first processing unit 2010 and a second processing unit 2020, where the first processing unit 2010 is used to determine a first processing strategy for the first message, and the first processing strategy is real-time processing and one of the polling processes; the second processing unit 2020 is configured to process the first message according to the first processing strategy, wherein the real-time processing is that the priority of the first message satisfies the first condition.
  • the polling processing is performed when the priority of the first message meets the second condition.
  • the device 2000 further includes a transceiver unit 2030, which is configured to receive the first message.
  • the first processing unit 2010 may be the system scheduling control module 150 described in the above embodiment
  • the second processing unit 2020 may be the TCP/IP protocol stack module 120, or it may be CAN and the last Protocol stack module 140.
  • the first processing unit 2010 and the second processing unit 2020 may also be the same processing unit.
  • the device 2000 further includes: a transceiver unit 2030, configured to receive a scheduling request, where the scheduling request is used to request real-time processing of the first message; the first processing unit 2010 is also configured to: The first processing strategy for the first message is determined to be real-time processing according to the scheduling request.
  • the transceiver unit 2030 may be included in the system scheduling control module 150.
  • the second processing unit 2020 is also configured to: before performing the real-time processing on the first message, interrupt the polling processing on the fourth message; After the real-time processing is performed, polling processing is continued on the fourth message, where the priority of the fourth message is lower than the priority of the first message.
  • the real-time processing of the first message includes a first moment, which is the moment when polling processing starts
  • the second processing unit 2020 is also used to: control the The first time is delayed to a second time
  • the second time is the time after the real-time processing of the first message is performed
  • the second time is the time when the polling process starts.
  • each unit in the above device is only a division of logical functions.
  • the units may be fully or partially integrated into a physical entity, or may be physically separated.
  • the unit in the device can be implemented in the form of a processor calling software; for example, the device includes a processor, the processor is connected to a memory, instructions are stored in the memory, and the processor calls the instructions stored in the memory to implement any of the above methods.
  • the processor is, for example, a general-purpose processor, such as a CPU or a microprocessor
  • the memory is a memory within the device or a memory outside the device.
  • the units in the device can be implemented in the form of hardware circuits, and some or all of the functions of the units can be implemented through the design of the hardware circuits, which can be understood as one or more processors; for example, in one implementation,
  • the hardware circuit is an ASIC, which realizes the functions of some or all of the above units through the design of the logical relationship of the components in the circuit; for another example, in another implementation, the hardware circuit can be implemented through PLD, taking FPGA as an example. It can include a large number of logic gate circuits, and the connection relationships between the logic gate circuits can be configured through configuration files to realize the functions of some or all of the above units. All units of the above device may be fully realized by the processor calling software, or may be fully realized by hardware circuits, or part of the units may be realized by the processor calling software, and the remaining part may be realized by hardware circuits.
  • the processor is a circuit with signal processing capabilities.
  • the processor may be a circuit with instruction reading and execution capabilities, such as a CPU, a microprocessor, a GPU, or DSP, etc.; in another implementation, the processor can realize certain functions through the logical relationship of the hardware circuit. The logical relationship of the hardware circuit is fixed or can be reconstructed.
  • the processor is a hardware circuit implemented by ASIC or PLD. For example, FPGA.
  • the process of the processor loading the configuration file and realizing the hardware circuit configuration can be understood as the process of the processor loading instructions to realize the functions of some or all of the above units.
  • it can also be a hardware circuit designed for artificial intelligence, which can be understood as an ASIC, such as NPU, TPU, DPU, etc.
  • each unit in the above device can be one or more processors (or processing circuits) configured to implement the above method, such as: CPU, GPU, NPU, TPU, DPU, microprocessor, DSP, ASIC, FPGA , or a combination of at least two of these processor forms.
  • processors or processing circuits
  • each unit in the above device may be integrated together in whole or in part, or may be implemented independently. In one implementation, these units are integrated together and implemented as a system-on-a-chip (SOC).
  • SOC may include at least one processor for implementing any of the above methods or implementing the functions of each unit of the device.
  • the at least one processor may be of different types, such as a CPU and an FPGA, or a CPU and an artificial intelligence processor. CPU and GPU etc.
  • FIG. 12 is a schematic block diagram of a packet processing device according to an embodiment of the present application.
  • the packet processing device 2100 shown in FIG. 12 may include: a processor 2110, a transceiver 2120, and a memory 2130.
  • the processor 2110, the transceiver 2120 and the memory 2130 are connected through an internal connection path.
  • the memory 2130 is used to store instructions.
  • the processor 2110 is used to execute the instructions stored in the memory 2130, and the transceiver 2120 receives/sends some parameters.
  • the memory 2130 can be coupled with the processor 2110 through an interface or integrated with the processor 2110 .
  • transceiver 2120 may include but is not limited to a transceiver device such as an input/output interface to realize communication between the device 2100 and other devices or communication networks.
  • each step of the above method can be completed by instructions in the form of hardware integrated logic circuits or software in the processor 2110 .
  • the method disclosed in conjunction with the embodiments of the present application can be directly implemented by a hardware processor for execution, or can be executed by a combination of hardware and software modules in the processor.
  • the software module can be located in random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers and other mature storage media in this field.
  • the storage medium is located in the memory 2130.
  • the processor 2110 reads the information in the memory 2130 and completes the steps of the above method in combination with its hardware. To avoid repetition, it will not be described in detail here.
  • the processor 2110 can use a general-purpose CPU, microprocessor, ASIC, GPU or one or more integrated circuits to execute relevant programs to implement the message processing method of the method embodiment of the present application.
  • the processor 2110 can also be an integrated circuit chip with signal processing capabilities.
  • each step of the message processing method of the present application can be completed by instructions in the form of hardware integrated logic circuits or software in the processor 2110 .
  • the above-mentioned processor 2110 can also be a general-purpose processor, DSP, ASIC, FPGA or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component.
  • Each method, step and logical block diagram disclosed in the embodiment of this application can be implemented or executed.
  • a general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
  • the steps of the method disclosed in conjunction with the embodiments of the present application can be directly implemented by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor.
  • the software module can be located in random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers and other mature storage media in this field.
  • the storage medium is located in the memory 2130.
  • the processor 2110 reads the information in the memory 2130 and executes the message processing method of the method embodiment of the present application in conjunction with its hardware.
  • the memory 2130 may be a read-only memory (ROM), a static storage device, a dynamic storage device or a random access memory (RAM).
  • ROM read-only memory
  • RAM random access memory
  • the transceiver 2120 uses a transceiver device such as but not limited to a transceiver to implement communication between the device 2100 and other devices or communication networks. For example, the first message may be received through the transceiver 2120.
  • An embodiment of the present application also provides a vehicle, which may include the above device 2000 or the above device 2100.
  • Embodiments of the present application also provide a computer program product.
  • the computer program product includes: computer program code.
  • the computer program code When the computer program code is run on a computer, it causes the computer to execute the above method.
  • Embodiments of the present application also provide a computer-readable storage medium.
  • the computer-readable medium stores program code.
  • the computer program code When the computer program code is run on a computer, it causes the computer to execute the above-mentioned Figures 5, 7, 9 and 9. Any of the 10 methods.
  • An embodiment of the present application also provides a chip, including: at least one processor and a memory.
  • the at least one processor is coupled to the memory and used to read and execute instructions in the memory to execute the above-mentioned Figures 5, 7, Either method in Figure 9 or Figure 10.
  • At least one refers to one or more
  • plural refers to two or more.
  • “And/or” describes the association of associated objects, indicating that there can be three relationships, for example, A and/or B, which can mean: including the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural.
  • the character “/” generally indicates that the related objects are in an “or” relationship.
  • “At least one of the following” or similar expressions thereof refers to any combination of these items, including any combination of a single item (items) or a plurality of items (items).
  • At least one of a, b, or c can mean: a, b, c, a-b, a-c, b-c, or a-b-c, where a, b, c can be single or multiple .
  • the disclosed systems, devices and methods can be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components may be combined or can be integrated into another system, or some features can be ignored, or not implemented.
  • the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or they may be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present application can be integrated into one processing unit, each unit can exist physically alone, or two or more units can be integrated into one unit.
  • the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can essentially be embodied in the form of a software product.
  • the computer software product is stored in a storage medium and includes a number of instructions to enable a computer device (which can be a personal computer, a server, or network equipment, etc.) to perform all or part of the steps of the methods described in various embodiments of this application.
  • the aforementioned storage media include: U disk, mobile hard disk, ROM, RAM, magnetic disk or optical disk and other media that can store program codes.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Small-Scale Networks (AREA)

Abstract

A method and apparatus for processing messages. The method comprises: determining a priority of a first message; when the priority of the first message meets a first condition, generating a scheduling request, the scheduling request being used to request real-time processing of the first message; and when the priority of the first message meets a second condition, waiting for polling processing of the first message, the first condition and the second condition being associated with the content of the first message. By means of the present method for processing messages, reliability and real-time performance of message processing can be improved, thereby further helping to improve vehicle safety.

Description

报文处理的方法和装置Message processing methods and devices
本申请要求于2022年5月16日提交中国专利局、申请号为202210529722.0、申请名称为“报文处理的方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to the Chinese patent application filed with the China Patent Office on May 16, 2022, with application number 202210529722.0 and application title "Method and Device for Message Processing", the entire content of which is incorporated into this application by reference. .
技术领域Technical field
本申请涉及车载通信领域,更具体地,涉及一种报文处理的方法和装置。The present application relates to the field of vehicle communications, and more specifically, to a message processing method and device.
背景技术Background technique
在车载总线系统中,存在多种通信技术,包括控制器局域网络(controller area network,CAN)通信技术和以太网络(Ethernet,ETH)通信技术。在实际通信过程中,一个电子控制器单元(electronic control unit,ECU)或控制器可以同时支持CAN和以太通信,并且一个ECU或控制器支持同一类型的多个物理接口(或称“端口”)。在车载总线系统中,当ECU等作为接收端接收报文时,一般通过系统中断的方式接收报文,中断优先级按物理接口(每个CAN/ETH总线对应的接口)设置。一般而言,在接收端同时接收到CAN报文和ETH报文时,CAN总线中断的优先级高于以太总线中断的优先级,而CAN/ETH作为总线,同一个接口中可以传输不同时延/功能安全要求的报文,不同接口中也可能有优先级相互交叉的报文,这可能导致CAN总线的低优先级报文中断以太高优先级报文接收的情况,产生功能安全威胁。In the vehicle bus system, there are a variety of communication technologies, including controller area network (CAN) communication technology and Ethernet (ETH) communication technology. In the actual communication process, an electronic control unit (ECU) or controller can support both CAN and Ethernet communication, and an ECU or controller supports multiple physical interfaces (or "ports") of the same type. . In the vehicle bus system, when the ECU, etc. serves as the receiving end to receive messages, the messages are generally received through system interrupts. The interrupt priority is set according to the physical interface (the interface corresponding to each CAN/ETH bus). Generally speaking, when the receiving end receives CAN messages and ETH messages at the same time, the priority of the CAN bus interrupt is higher than the priority of the Ethernet bus interrupt. As CAN/ETH is a bus, different delays can be transmitted in the same interface. / For messages required by functional safety, there may also be messages with overlapping priorities in different interfaces, which may cause low-priority messages on the CAN bus to interrupt the reception of Ethernet high-priority messages, resulting in functional safety threats.
因此,一种能够提升报文的可靠性和实时性的报文处理的方法和装置亟待开发。Therefore, a message processing method and device that can improve the reliability and real-time performance of messages urgently needs to be developed.
发明内容Contents of the invention
本申请提供一种报文处理的方法和装置,有助于提升报文处理的可靠性和实时性。This application provides a message processing method and device, which helps to improve the reliability and real-time performance of message processing.
本申请中的车辆(有时简称为车)为广义概念上的车辆,可以是交通工具(如汽车、卡车、摩托车、飞机、火车、轮船等),工业车辆(如:叉车、挂车、牵引车等),工程车辆(如挖掘机、推土车、吊车等),农用设备(如割草机、收割机等),游乐设备,玩具车辆等,本申请实施例对车辆的类型不作具体限定。The vehicle (sometimes referred to as a vehicle) in this application is a vehicle in a broad sense, which can be a means of transportation (such as a car, a truck, a motorcycle, an airplane, a train, a ship, etc.), an industrial vehicle (such as a forklift, a trailer, a tractor) etc.), engineering vehicles (such as excavators, bulldozers, cranes, etc.), agricultural equipment (such as lawn mowers, harvesters, etc.), amusement equipment, toy vehicles, etc. The embodiments of this application do not specifically limit the types of vehicles.
第一方面,提供了一种报文处理的方法,该方法可以由车辆执行;或者,也可以由车辆的车载终端如车机执行,或者也可以由ECU等执行;或者,还可以由用于车辆的芯片或电路执行,本申请对此不作限定。为了便于描述,下面以车辆某ECU中的报文收发模块,如MAC收发模块或CAN收发模块执行为例进行说明。The first aspect provides a message processing method, which can be executed by the vehicle; or it can also be executed by the vehicle's on-board terminal such as a vehicle machine, or it can also be executed by an ECU, etc.; or it can also be executed by the vehicle. The vehicle's chip or circuit execution is not limited in this application. For the convenience of description, the following takes the execution of a message transceiver module, such as a MAC transceiver module or a CAN transceiver module, in a certain ECU of the vehicle as an example.
该方法可以包括:确定第一报文的优先级;在该第一报文的优先级满足第一条件时,生成调度请求,该调度请求用于请求对该第一报文进行实时处理;在该第一报文的优先级满足第二条件时,等待对该第一报文的轮询处理。The method may include: determining the priority of the first message; when the priority of the first message meets the first condition, generating a scheduling request, where the scheduling request is used to request real-time processing of the first message; When the priority of the first message meets the second condition, polling processing of the first message is waited for.
在上述技术方案中,能够基于报文的优先级,对优先级不同的报文采用不同的处理方 式,实现高优先级报文或影响车辆安全的报文被优先处理,有利于保证高优先级报文或影响车辆安全的报文处理的实时性,对低优先级或音视频流等业务报文采用轮询处理,能够提升处理性能,以及避免高频中断对报文处理系统性能产生的影响。In the above technical solution, different processing methods can be used for messages with different priorities based on the priority of the message, so that high-priority messages or messages that affect vehicle safety are processed first, which is conducive to ensuring high priority Real-time processing of messages or messages that affect vehicle safety. Polling processing of business messages with low priority or audio and video streams can improve processing performance and avoid the impact of high-frequency interruptions on the performance of the message processing system. .
示例性地,该第一报文可以为以太报文,或者也可以为CAN报文,或者还可以为其他报文,本申请实施例对此不作具体限定。For example, the first message may be an Ethernet message, or it may be a CAN message, or it may be other messages, which is not specifically limited in the embodiment of the present application.
示例性地,可以根据报文字段、字段组合或报文内容确定第一报文的优先级。例如,通过优先级字段PCP确定第一报文的优先级;或者,通过Message ID字段确定第一报文的优先级。在一些可能的实现方式中,还可以根据协议规定确定第一报文的优先级,或者,也可以通过其他方式确定报文的优先级,本申请实施例对此不作具体限定。For example, the priority of the first message may be determined according to message fields, field combinations or message content. For example, determine the priority of the first message through the priority field PCP; or determine the priority of the first message through the Message ID field. In some possible implementations, the priority of the first message may also be determined according to protocol provisions, or the priority of the message may be determined in other ways, which is not specifically limited in the embodiments of this application.
示例性地,该实时处理包括但不限于中断、软中断、任务调度。该轮询处理可以为周期轮询处理,其中轮询处理的周期可以为100毫秒,或者500毫秒,或者也可以为其他周期,本申请实施例对此不作具体限定。Illustratively, the real-time processing includes but is not limited to interrupts, soft interrupts, and task scheduling. The polling process may be a periodic polling process, where the cycle of the polling process may be 100 milliseconds, or 500 milliseconds, or other cycles, which are not specifically limited in the embodiments of the present application.
在一些可能的实现方式中,上述第一条件和上述第二条件与第一报文承载的内容相关联。例如,第一条件为第一报文承载的内容为车控指令等控制指令,第二条件为第一报文承载的内容为音视频流等娱乐性内容。或者,第一条件为第一报文为管理报文,第二条件为第一报文为业务报文。在一些可能的实现方式中,管理报文可以包括用于网络(或设备)管理和/或控制的报文,业务报文可以包括除管理报文以外,其他不具备网络(或设备)管理、控制功能的报文。或者,该第一条件和第二条件也可以为与第一报文的内容相关联的其他条件。In some possible implementations, the above-mentioned first condition and the above-mentioned second condition are associated with the content carried by the first packet. For example, the first condition is that the content carried by the first packet is control instructions such as vehicle control instructions, and the second condition is that the content carried by the first packet is entertainment content such as audio and video streams. Or, the first condition is that the first message is a management message, and the second condition is that the first message is a service message. In some possible implementations, management packets may include packets for network (or device) management and/or control, and service packets may include, in addition to management packets, other packets that do not have network (or device) management, Messages for control functions. Alternatively, the first condition and the second condition may also be other conditions associated with the content of the first message.
结合第一方面,在第一方面的某些实现方式中,该第一条件包括该第一报文的优先级高于预设阈值,该第二条件包括该第一报文的优先级低于或等于该预设阈值。In connection with the first aspect, in some implementations of the first aspect, the first condition includes that the priority of the first message is higher than a preset threshold, and the second condition includes that the priority of the first message is lower than or equal to the preset threshold.
示例性地,该预设阈值可以为表征优先级的字段的具体取值,如PCP=3或Message ID=2;或者,该预设阈值也可以对表征优先级的字段的具体取值进行量化后的值,将PCP=3~5的报文的优先级量化为“中优先级”,将PCP=6~7的报文的优先级量化为“高优先级”,则上述预设阈值可以为“中优先级”。应理解,上述预设阈值仅为示例性说明,在具体实现过程中,还可以设置其他预设阈值,本申请实施例对此不作具体限定。For example, the preset threshold can be a specific value of a field that represents priority, such as PCP=3 or Message ID=2; or, the preset threshold can also quantify the specific value of a field that represents priority. After quantizing the priority of the packets with PCP=3~5 as "medium priority" and quantizing the priority of the packets with PCP=6~7 as "high priority", the above preset threshold can be As "medium priority". It should be understood that the above-mentioned preset threshold is only an illustrative description. During the specific implementation process, other preset thresholds may also be set, which is not specifically limited in the embodiments of the present application.
结合第一方面,在第一方面的某些实现方式中,在该第一报文的优先级满足该第一条件时,该方法还包括:根据该第一报文的优先级确定该第一报文的调度优先级,该调度优先级用于指示该实时处理的优先级;该生成调度请求,包括:根据该第一报文的调度优先级生成该调度请求。In connection with the first aspect, in some implementations of the first aspect, when the priority of the first message satisfies the first condition, the method further includes: determining the first priority according to the priority of the first message. The scheduling priority of the message is used to indicate the priority of the real-time processing; the generating of the scheduling request includes: generating the scheduling request according to the scheduling priority of the first message.
一示例,对采用中断的报文处理系统,可以将报文的优先级映射到中断优先级,进一步地,根据中断优先级生成带有优先级的中断请求。例如,对于PCP=3~7的报文,其中,PCP=6~7的报文对应于较高中断优先级,PCP=3~5的报文对应于较低中断优先级。进一步地,针对中断优先级较高的报文生成高优先级中断请求,针对中断优先级较低的报文生成低优先级中断请求。中断请求优先级高的报文可以中断中断请求优先级低的报文。As an example, for a message processing system that uses interrupts, the priority of the message can be mapped to the interrupt priority, and further, an interrupt request with priority can be generated according to the interrupt priority. For example, for messages with PCP=3~7, messages with PCP=6~7 correspond to higher interrupt priorities, and messages with PCP=3~5 correspond to lower interrupt priorities. Further, a high-priority interrupt request is generated for a message with a higher interrupt priority, and a low-priority interrupt request is generated for a message with a lower interrupt priority. Messages with high interrupt request priority can interrupt messages with low interrupt request priority.
又一示例,对采用软中断的报文处理系统,可以将报文的优先级映射到软中断优先级,进一步地,根据软中断优先级生成带有优先级的软中断请求。例如,对于PCP=3~7的报文,映射到两个不同的中断优先级,其中,PCP=6~7的报文对应于较高软中断优先级,PCP=3~5的报文对应于较低软中断优先级。软中断优先级较高的报文可以中断软中断优 先级较低的报文。As another example, for a message processing system that uses soft interrupts, the priority of the message can be mapped to the soft interrupt priority, and further, a soft interrupt request with priority can be generated according to the soft interrupt priority. For example, messages with PCP=3~7 are mapped to two different interrupt priorities. Among them, messages with PCP=6~7 correspond to higher soft interrupt priorities, and messages with PCP=3~5 correspond to at a lower softirq priority level. Messages with higher soft interrupt priority can interrupt messages with lower soft interrupt priority.
再一示例,对采用任务调度的报文处理系统,可以将报文的优先级映射到任务调度优先级,进一步地,根据任务调度优先级生成带有优先级的任务调度请求。例如,对于PCP=3~7的报文,映射到两个不同的任务调度优先级,其中,PCP=6~7的报文对应于较高任务调度优先级,PCP=3~5的报文对应于较低任务调度优先级。报文处理系统可以优先处理较高任务调度优先级的报文,再处理较低任务调度优先级的报文。As another example, for a message processing system that adopts task scheduling, the priority of the message can be mapped to the task scheduling priority, and further, a task scheduling request with priority can be generated according to the task scheduling priority. For example, messages with PCP=3~7 are mapped to two different task scheduling priorities. Among them, messages with PCP=6~7 correspond to higher task scheduling priorities, and messages with PCP=3~5 Corresponds to lower task scheduling priority. The packet processing system can prioritize packets with higher task scheduling priority, and then process packets with lower task scheduling priority.
在一些可能的实现方式中,报文收发模块也可以针对第一报文生成不带有优先级的调度请求,进而分别发送调度请求和调度优先级指示信息,其中调度优先级指示信息用于指示第一报文的调度优先级。In some possible implementations, the message transceiving module can also generate a scheduling request without priority for the first message, and then send the scheduling request and scheduling priority indication information respectively, where the scheduling priority indication information is used to indicate The scheduling priority of the first packet.
在上述技术方案中,根据报文的优先级生成不同优先级的调度请求,能够实现高优先级报文被优先处理。特别地,在车辆控制领域中,影响车辆安全的报文的优先级较高,数据量大、业务突发特征明显的数据传输、娱乐域音视频流等业务报文的优先级较低,通过上述技术方案,能够保证影响车辆安全的报文处理的实时性,有助于提升车辆安全。In the above technical solution, scheduling requests of different priorities are generated according to the priority of the message, so that high-priority messages can be processed preferentially. Especially in the field of vehicle control, the priority of packets that affect vehicle safety is higher, and the priority of business packets such as data transmission with large amounts of data, obvious business burst characteristics, and audio and video streaming in the entertainment domain is lower. The above technical solutions can ensure the real-time processing of messages that affect vehicle safety and help improve vehicle safety.
结合第一方面,在第一方面的某些实现方式中,该确定第一报文的优先级之后,该方法还包括:根据该第一报文的优先级和报文缓存区已用空间,缓存该第一报文,该报文缓存区已用空间用于表征缓存报文区域的已用空间。Combined with the first aspect, in some implementations of the first aspect, after determining the priority of the first message, the method further includes: based on the priority of the first message and the used space of the message buffer, The first message is cached, and the used space of the message cache area is used to represent the used space of the cached message area.
结合第一方面,在第一方面的某些实现方式中,该方法还包括:在该第一报文的优先级高于第一阈值,和/或报文缓存区已用空间小于第二阈值时,缓存该第一报文。In connection with the first aspect, in some implementations of the first aspect, the method further includes: when the priority of the first message is higher than a first threshold, and/or the used space of the message buffer is less than a second threshold when, the first message is cached.
示例性地,该第一阈值可以为表征优先级的字段的具体取值;或者,该第一阈值也可以对表征优先级的字段的具体取值进行量化后的值。第二阈值可以为报文缓存区已用空间的具体数值,或者也可以为报文缓存区已用空间占用报文缓存区总空间的比例。一示例,第一阈值可以为PCP=6,第二阈值可以为缓存空间的95%。For example, the first threshold may be a specific value of a field that represents priority; or, the first threshold may also be a quantized value of a specific value of a field that represents priority. The second threshold may be a specific value of the used space in the message buffer, or may be the proportion of the used space in the message buffer occupying the total space in the message buffer. As an example, the first threshold may be PCP=6, and the second threshold may be 95% of the cache space.
在上述技术方案中,在报文缓存区已用空间和报文的优先级满足一定条件时,缓存该报文,否则丢弃该报文,能够降低高优先级报文因缓存溢出的丢包概率,提升报文处理系统的可靠性。In the above technical solution, when the used space in the message buffer area and the priority of the message meet certain conditions, the message is cached, otherwise the message is discarded, which can reduce the probability of packet loss of high-priority messages due to buffer overflow. , improve the reliability of the message processing system.
结合第一方面,在第一方面的某些实现方式中,在缓存该第一报文之前,该方法还包括:在该报文缓存区已用空间大于第三阈值时,删除一个或多个第二报文,该第二报文的优先级小于该第一报文的优先级。Combined with the first aspect, in some implementations of the first aspect, before caching the first message, the method further includes: when the used space of the message buffer is greater than a third threshold, deleting one or more The second message has a priority lower than the priority of the first message.
示例性地,第二阈值可以为报文缓存区已用空间的具体数值,或者也可以为报文缓存区已用空间占用报文缓存区总空间的比例。示例性地,该第三阈值可以为缓存空间的90%,或者也可以为其他数值,本申请实施例对此不作具体限定。For example, the second threshold may be a specific value of the used space in the message buffer, or may be the proportion of the used space in the message buffer occupying the total space in the message buffer. For example, the third threshold may be 90% of the cache space, or may be other values, which are not specifically limited in this embodiment of the present application.
在一些可能的实现方式中,第二报文可以为优先级最低的报文。In some possible implementations, the second packet may be the packet with the lowest priority.
在上述技术方案中,通过高优先级报文抢占低优先级报文缓存空间,防止高优先级报文因缓存溢出而丢包,提升报文处理系统可靠性。In the above technical solution, high-priority packets are used to seize cache space for low-priority packets, preventing high-priority packets from being lost due to buffer overflow, and improving the reliability of the packet processing system.
结合第一方面,在第一方面的某些实现方式中,该方法还包括:确定第三报文的优先级;在该第三报文的优先级低于或等于该第一阈值,且报文缓存区已用空间大于或等于该第二阈值时,丢弃该第三报文。In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: determining a priority of a third message; when the priority of the third message is lower than or equal to the first threshold, and the priority of the third message is When the used space of the message buffer is greater than or equal to the second threshold, the third message is discarded.
示例性地,可以设置多组第一阈值和第二阈值(以下表示为[第一阈值,第二阈值]),例如[PCP=4,80%],[PCP=1,60%]等。即,在报文优先级处于PCP=2~4,且报文缓 存区已用空间大于或等于80%时,丢弃该报文;在在报文优先级处于PCP=1,且报文缓存区已用空间大于或等于60%时,丢弃该报文。For example, multiple sets of first thresholds and second thresholds (hereinafter represented as [first threshold, second threshold]) may be set, such as [PCP=4, 80%], [PCP=1, 60%], etc. That is, when the message priority is PCP=2~4, and the used space of the message buffer is greater than or equal to 80%, the message is discarded; when the message priority is PCP=1, and the message buffer uses space When the used space is greater than or equal to 60%, the packet is discarded.
在上述技术方案中,针对不同优先级的报文,设定不同的报文缓存区丢弃门限,以使得报文缓存区有足够的空间缓存较高优先级的报文,在保证报文处理系统的可靠性的同时,降低报文缓存过程中的复杂度。In the above technical solution, different message buffer discard thresholds are set for messages of different priorities, so that the message buffer has enough space to cache higher priority messages, while ensuring that the message processing system While improving reliability, it also reduces the complexity in the message caching process.
第二方面,提供了一种报文处理的方法,该方法可以由车辆执行;或者,也可以由车辆的车载终端如车机执行,或者也可以由ECU等执行;或者,还可以由用于车辆的芯片或电路执行,本申请对此不作限定。为了便于描述,下面以车辆某ECU中的系统调度模块以及TCP/IP协议栈执行为例进行说明。In the second aspect, a message processing method is provided, which can be executed by the vehicle; or it can also be executed by the vehicle's on-board terminal such as a vehicle machine, or it can also be executed by an ECU, etc.; or it can also be executed by the vehicle. The vehicle's chip or circuit execution is not limited in this application. For the convenience of description, the following takes the system scheduling module and TCP/IP protocol stack execution in an ECU of the vehicle as an example.
该方法可以包括:确定对第一报文的第一处理策略,该第一处理策略为实时处理和轮询处理中的一项;根据该第一处理策略对该第一报文进行处理,其中,该实时处理为该第一报文的优先级满足第一条件时进行的处理,该轮询处理为该第一报文的优先级满足第二条件时进行的处理。The method may include: determining a first processing strategy for the first message, the first processing strategy being one of real-time processing and polling processing; processing the first message according to the first processing strategy, wherein , the real-time processing is performed when the priority of the first message meets the first condition, and the polling processing is performed when the priority of the first message meets the second condition.
在上述技术方案中,可以根据调度请求对优先级较高的报文进行实时处理,能够提高较高优先级的报文处理的实时性;在报文处理系统空闲时,对较低优先级的报文轮询处理,能够避免高频中断对报文处理系统性能产生的影响,有助于提升报文处理系统的性能。In the above technical solution, higher priority messages can be processed in real time according to scheduling requests, which can improve the real-time performance of higher priority message processing; when the message processing system is idle, lower priority messages can be processed in real time. Message polling processing can avoid the impact of high-frequency interruptions on the performance of the message processing system, and helps improve the performance of the message processing system.
结合第二方面,在第二方面的某些实现方式中,该方法还包括:接收调度请求,该调度请求用于请求对该第一报文进行实时处理;该确定对第一报文的第一处理策略,包括:根据该调度请求确定对该第一报文的该第一处理策略为该实时处理。With reference to the second aspect, in some implementations of the second aspect, the method further includes: receiving a scheduling request, the scheduling request being used to request real-time processing of the first message; and determining the processing of the first message in real time. A processing strategy includes: determining that the first processing strategy for the first message is real-time processing according to the scheduling request.
结合第二方面,在第二方面的某些实现方式中,该方法还包括:在对该第一报文进行该实时处理之前,中断对第四报文进行的轮询处理;在对该第一报文进行该实时处理之后,继续对该第四报文进行轮询处理,其中,该第四报文的优先级低于该第一报文的优先级。Combined with the second aspect, in some implementations of the second aspect, the method further includes: before performing the real-time processing on the first message, interrupting the polling processing on the fourth message; After a packet is processed in real time, polling processing is continued on the fourth packet, where the priority of the fourth packet is lower than the priority of the first packet.
结合第二方面,在第二方面的某些实现方式中,对该第一报文进行该实时处理的过程中包括第一时刻,该第一时刻为该轮询处理开始的时刻,该方法还包括:控制该第一时刻延后至第二时刻,该第二时刻为对该第一报文进行该实时处理之后的时刻,且该第二时刻为轮询处理开始的时刻。Combined with the second aspect, in some implementations of the second aspect, the real-time processing of the first message includes a first moment, and the first moment is the moment when the polling process starts. The method also includes The method includes: controlling the first time to be delayed to a second time, the second time being the time after the real-time processing of the first message is performed, and the second time being the time when polling processing starts.
在一些可能的实现方式中,该轮询处理可以为周期轮询处理,其中轮询处理的周期可以为100毫秒,或者500毫秒。在一些可能实现方式中,对第一报文进行实时处理的过程中,轮询处理周期到达,需要对第四报文进行轮询处理。在上述情况下,暂停轮询处理,待对第一报文的实时处理完成后,开始对第四报文的轮询处理。In some possible implementations, the polling process may be a periodic polling process, where the cycle of the polling process may be 100 milliseconds or 500 milliseconds. In some possible implementations, during the real-time processing of the first message, the polling processing cycle arrives, and the fourth message needs to be polled. In the above situation, the polling process is suspended, and after the real-time processing of the first message is completed, the polling process of the fourth message is started.
第三方面,提供了一种报文处理的装置,该装置可以包括:第一处理单元和第二处理单元,其中,该第一处理单元用于确定第一报文的优先级;该第二处理单元用于,在该第一报文的优先级满足第一条件时,生成调度请求,该调度请求用于请求对该第一报文进行实时处理;在该第一报文的优先级满足第二条件时,等待对该第一报文的轮询处理。In a third aspect, a message processing device is provided. The device may include: a first processing unit and a second processing unit, wherein the first processing unit is used to determine the priority of the first message; the second processing unit The processing unit is configured to generate a scheduling request when the priority of the first message satisfies the first condition, and the scheduling request is used to request real-time processing of the first message; when the priority of the first message satisfies In the second condition, wait for the polling processing of the first message.
在一些可能的实现方式中,上述第一处理单元和第二处理单元可以为同一处理单元,即,确定第一报文的优先级以及生成调度请求可以由一个处理单元完成。In some possible implementations, the first processing unit and the second processing unit may be the same processing unit, that is, determining the priority of the first message and generating the scheduling request may be completed by one processing unit.
结合第三方面,在第三方面的某些实现方式中,该第一条件包括该第一报文的优先级高于预设阈值,该第二条件包括该第一报文的优先级低于或等于该预设阈值。Combined with the third aspect, in some implementations of the third aspect, the first condition includes that the priority of the first message is higher than a preset threshold, and the second condition includes that the priority of the first message is lower than or equal to the preset threshold.
结合第三方面,在第三方面的某些实现方式中,该第二处理单元还用于:在该第一报 文的优先级满足该第一条件时,根据该第一报文的优先级确定该第一报文的调度优先级,该调度优先级用于指示该实时处理的优先级;根据该第一报文的调度优先级生成该调度请求。Combined with the third aspect, in some implementations of the third aspect, the second processing unit is also configured to: when the priority of the first message meets the first condition, according to the priority of the first message The scheduling priority of the first message is determined, and the scheduling priority is used to indicate the priority of the real-time processing; and the scheduling request is generated according to the scheduling priority of the first message.
结合第三方面,在第三方面的某些实现方式中,该装置还包括:第三处理单元,用于在确定该第一报文的优先级之后,根据该第一报文的优先级和报文缓存区已用空间,缓存该第一报文,该报文缓存区已用空间用于表征缓存报文区域的已用空间。In conjunction with the third aspect, in some implementations of the third aspect, the device further includes: a third processing unit, configured to, after determining the priority of the first message, process the first message according to the priority and The used space of the message cache area is used to cache the first message. The used space of the message cache area is used to represent the used space of the cached message area.
在一些可能的实现方式中,第三处理单元与第一处理单元和第二处理单元可以为不同的处理单元,或者也可以为同一处理单元,本申请实施例对此不作具体限定。In some possible implementations, the third processing unit, the first processing unit and the second processing unit may be different processing units, or they may be the same processing unit, which is not specifically limited in the embodiments of this application.
结合第三方面,在第三方面的某些实现方式中,该第三处理单元还用于:在该第一报文的优先级高于第一阈值,和/或报文缓存区已用空间小于第二阈值时,缓存该第一报文。Combined with the third aspect, in some implementations of the third aspect, the third processing unit is also used to: when the priority of the first message is higher than the first threshold, and/or the message buffer area has used space When it is less than the second threshold, the first message is cached.
结合第三方面,在第三方面的某些实现方式中,该第三处理单元还用于:在缓存该第一报文之前,在该报文缓存区已用空间大于第三阈值时,删除一个或多个第二报文,该第二报文的优先级小于该第一报文的优先级。Combined with the third aspect, in some implementations of the third aspect, the third processing unit is further configured to: before caching the first message, when the used space of the message buffer is greater than the third threshold, delete One or more second messages, the priority of the second message is lower than the priority of the first message.
结合第三方面,在第三方面的某些实现方式中,该第一处理单元还用于:确定第三报文的优先级;该第三处理单元还用于:在该第三报文的优先级低于或等于该第一阈值,且报文缓存区已用空间大于或等于该第二阈值时,丢弃该第三报文。Combined with the third aspect, in some implementations of the third aspect, the first processing unit is also used to: determine the priority of the third message; the third processing unit is also used to: determine the priority of the third message. When the priority is lower than or equal to the first threshold and the used space in the message buffer is greater than or equal to the second threshold, the third message is discarded.
第四方面,提供了一种报文处理的装置,该装置包括:第一处理单元和第二处理单元,其中,该第一处理单元用于确定对第一报文的第一处理策略,该第一处理策略包含于实时处理和轮询处理;该第二处理单元用于根据该第一处理策略对该第一报文进行处理,其中,该实时处理为该第一报文的优先级满足第一条件时进行的处理,该轮询处理为该第一报文的优先级满足第二条件时进行的处理。In a fourth aspect, a message processing device is provided. The device includes: a first processing unit and a second processing unit, wherein the first processing unit is used to determine a first processing strategy for the first message, and the The first processing strategy includes real-time processing and polling processing; the second processing unit is used to process the first message according to the first processing strategy, wherein the real-time processing is such that the priority of the first message satisfies The processing is performed when the first condition is met, and the polling processing is performed when the priority of the first message meets the second condition.
结合第四方面,在第四方面的某些实现方式中,该装置还包括:收发单元,用于接收调度请求,该调度请求用于请求对该第一报文进行实时处理;该第一处理单元还用于:根据该调度请求确定对该第一报文的该第一处理策略为该实时处理。With reference to the fourth aspect, in some implementations of the fourth aspect, the device further includes: a transceiver unit, configured to receive a scheduling request, the scheduling request being used to request real-time processing of the first message; the first processing The unit is also configured to determine, according to the scheduling request, that the first processing strategy for the first message is real-time processing.
结合第四方面,在第四方面的某些实现方式中,该第二处理单元还用于:在对该第一报文进行该实时处理之前,中断对第四报文进行的轮询处理;在对该第一报文进行该实时处理之后,继续对该第四报文进行轮询处理,其中,该第四报文的优先级低于该第一报文的优先级。In conjunction with the fourth aspect, in some implementations of the fourth aspect, the second processing unit is further configured to: interrupt the polling processing of the fourth message before performing the real-time processing of the first message; After the real-time processing of the first message, polling processing of the fourth message is continued, wherein the priority of the fourth message is lower than the priority of the first message.
结合第四方面,在第四方面的某些实现方式中,对该第一报文进行该实时处理的过程中包括第一时刻,该第一时刻为轮询处理开始的时刻,该第二处理单元还用于:控制该第一时刻延后至第二时刻,该第二时刻为对该第一报文进行该实时处理之后的时刻,且该第二时刻为轮询处理开始的时刻。In connection with the fourth aspect, in some implementations of the fourth aspect, the real-time processing of the first message includes a first moment, the first moment being the moment when the polling process starts, the second process The unit is also configured to: control the first time to be delayed to a second time, the second time being the time after the real-time processing of the first message is performed, and the second time being the time when polling processing starts.
第五方面,提供了一种报文处理的装置,该装置包括:存储器,用于存储程序;处理器,用于执行存储器存储的程序,当存储器存储的程序被执行时,处理器用于执行上述第一方面中任一种可能实现方式中的方法。In a fifth aspect, a message processing device is provided. The device includes: a memory for storing a program; a processor for executing the program stored in the memory. When the program stored in the memory is executed, the processor is configured to execute the above A method in any possible implementation manner of the first aspect.
第六方面,提供了一种报文处理的系统,该系统包括上述第三方面和/或第四方面中任一种可能实现方式中的装置,或者,该系统包括上述第五方面中任一种实现方式中的装置。In a sixth aspect, a message processing system is provided. The system includes the device in any of the possible implementations of the third aspect and/or the fourth aspect, or the system includes any one of the fifth aspects. device in an implementation manner.
第七方面,提供了一种车辆,该车辆包括上述第三方面和/或第四方面中任一种可能 实现方式中的装置,或者上述第五方面中任一种实现方式中的装置,或者上述第六方面中任一种实现方式中的系统。A seventh aspect provides a vehicle, which includes the device in any possible implementation manner of the third aspect and/or the fourth aspect, or the device in any possible implementation manner of the fifth aspect, or The system in any implementation manner of the above sixth aspect.
第八方面,提供了一种计算机程序产品,上述计算机程序产品包括:计算机程序代码,当上述计算机程序代码在计算机上运行时,使得计算机执行上述第一方面或第二方面中任一种可能实现方式中的方法。In an eighth aspect, a computer program product is provided. The computer program product includes: computer program code. When the computer program code is run on a computer, it enables the computer to execute any one of the first aspect or the second aspect. method within the method.
需要说明的是,上述计算机程序代码可以全部或部分存储在第一存储介质上,其中第一存储介质可以与处理器封装在一起的,也可以与处理器单独封装,本申请实施例对此不作具体限定。It should be noted that the above computer program code may be stored in whole or in part on the first storage medium, where the first storage medium may be packaged together with the processor, or may be packaged separately from the processor. This is not the case in the embodiments of this application. Specific limitations.
第九方面,提供了一种计算机可读介质,上述计算机可读介质存储由程序代码,当上述计算机程序代码在计算机上运行时,使得计算机执行上述第一方面或第二方面中任一种可能实现方式中的方法。In a ninth aspect, a computer-readable medium is provided. The computer-readable medium stores program code. When the computer program code is run on a computer, it makes it possible for the computer to execute any one of the first aspect or the second aspect. Methods in the implementation.
第十方面,提供了一种芯片,该芯片包括处理器,用于调用存储器中存储的计算机程序或计算机指令,以使得该处理器执行上述第一方面或第二方面中任一种可能实现方式中的方法。In a tenth aspect, a chip is provided. The chip includes a processor for calling a computer program or computer instructions stored in a memory, so that the processor executes any of the possible implementation methods of the first aspect or the second aspect. method in.
结合第十方面,在一种可能的实现方式中,该处理器通过接口与存储器耦合。Combined with the tenth aspect, in a possible implementation manner, the processor is coupled with the memory through an interface.
结合第十方面,在一种可能的实现方式中,该芯片系统还包括存储器,该存储器中存储有计算机程序或计算机指令。In conjunction with the tenth aspect, in a possible implementation manner, the chip system further includes a memory, and a computer program or computer instructions are stored in the memory.
附图说明Description of the drawings
图1是通信系统中断接收报文的示意图。Figure 1 is a schematic diagram of a communication system interrupting reception of messages.
图2是本申请实施例提供的一种网络架构示意图。Figure 2 is a schematic diagram of a network architecture provided by an embodiment of the present application.
图3是本申请实施例提供的一种以太协议栈系统架构示意图。Figure 3 is a schematic diagram of an Ethernet protocol stack system architecture provided by an embodiment of the present application.
图4是本申请实施例提供的一种CAN总线系统架构示意图。Figure 4 is a schematic diagram of a CAN bus system architecture provided by an embodiment of the present application.
图5是本申请实施例提供的一种报文处理的方法的示意性流程图。Figure 5 is a schematic flow chart of a message processing method provided by an embodiment of the present application.
图6是本申请实施例提供的一种缓存队列与报文缓存区的示意图。Figure 6 is a schematic diagram of a cache queue and a message cache area provided by an embodiment of the present application.
图7是本申请实施例提供的一种报文处理的方法的示意性流程图。Figure 7 is a schematic flow chart of a message processing method provided by an embodiment of the present application.
图8是本申请实施例提供的一种报文丢弃参数设置的示意图。Figure 8 is a schematic diagram of a packet discarding parameter setting provided by an embodiment of the present application.
图9是本申请实施例提供的一种报文处理的方法的示意性流程图。Figure 9 is a schematic flow chart of a message processing method provided by an embodiment of the present application.
图10是本申请实施例提供的一种报文处理的方法的又一示意性流程图。Figure 10 is another schematic flow chart of a message processing method provided by an embodiment of the present application.
图11是本申请实施例提供的一种报文处理的装置的示意性框图。Figure 11 is a schematic block diagram of a packet processing device provided by an embodiment of the present application.
图12是本申请实施例提供的一种报文处理的装置的示意性框图。Figure 12 is a schematic block diagram of a packet processing device provided by an embodiment of the present application.
具体实施方式Detailed ways
下面将结合附图,对本申请实施例中的技术方案进行描述。The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings.
随着车辆向智能化演进,软件定义车辆成为未来车辆软件系统新的开发模式,在车辆实际运行过程中,多种传感器(例如激光雷达、毫米波雷达、超声雷达等)与控制系统之间的信息交互、音视频流的传输等需要使用大带宽通信总线。以太网络的灵活性、大带宽成为车载通信总线技术的选择,但以太网络的时延波动和无可靠性保证在车载应用领域受到挑战,是以太网络在车载领域应用需要解决的关键技术问题。在车载以太网的应用场景 中,有以下特点影响以太网络的确定性时延和可靠性:As vehicles evolve towards intelligence, software-defined vehicles have become a new development model for future vehicle software systems. During the actual operation of the vehicle, the communication between various sensors (such as lidar, millimeter wave radar, ultrasonic radar, etc.) and the control system Information interaction, audio and video stream transmission, etc. require the use of large-bandwidth communication buses. The flexibility and large bandwidth of the Ethernet network have become the choice of vehicle communication bus technology. However, the delay fluctuation and lack of reliability guarantee of the Ethernet network are challenged in the field of vehicle applications. They are key technical issues that need to be solved for the application of Ethernet network in the vehicle field. In the application scenario of automotive Ethernet, the following characteristics affect the deterministic delay and reliability of the Ethernet network:
1.控制命令、音视频流等不同类型的数据具有不同的服务质量(quality of service,QoS)要求,在同一个以太网络中传输,会相互影响,进而影响以太网络的确定性时延和可靠性。1. Different types of data such as control commands and audio and video streams have different quality of service (QoS) requirements. When transmitted in the same Ethernet network, they will affect each other, thereby affecting the deterministic delay and reliability of the Ethernet network. sex.
2.以太报文突发性:由于CAN总线中以周期性报文为主,因此在系统设计时,CAN总线的负荷就已经确定。而以太网络承载的业务灵活,各个数据源发送数据到以太总线的时间可能具有并发性,即部分数据出现时间重叠现象,也就是产生了所谓的冲突,使得以太报文突发性特征影响到了传输时延和可靠性。2. Burst nature of Ethernet messages: Since the CAN bus is dominated by periodic messages, the load of the CAN bus has been determined during system design. The business carried by the Ethernet network is flexible, and the time when each data source sends data to the Ethernet bus may be concurrent, that is, some data overlap in time, which is a so-called conflict, causing the bursty characteristics of Ethernet messages to affect the transmission. Latency and reliability.
3.以太网络协议的可靠性:以太网络在MAC层及网络层不提供可靠传输;在车载以太网络中,传输层普遍采用用户数据包协议(user datagram protocol,UDP)协议,UDP协议也是不可靠的传输协议,上述无可靠性保障的协议可能导致以太网络中数据传输的不可靠。3. Reliability of the Ethernet protocol: Ethernet does not provide reliable transmission at the MAC layer and network layer; in automotive Ethernet networks, the transmission layer generally uses the user datagram protocol (UDP) protocol, and the UDP protocol is also unreliable. Transmission protocols, the above-mentioned protocols without reliability guarantee may lead to unreliable data transmission in the Ethernet network.
4.车载以太网络是嵌入式系统,内存和计算资源受限,处理能力上不及普通的网络信息技术(Internet technology,IT)系统,会影响以太网络的确定性时延。4. The vehicle Ethernet network is an embedded system with limited memory and computing resources, and its processing power is inferior to ordinary network information technology (IT) systems, which will affect the deterministic delay of the Ethernet network.
以太网络作为领域最为普及的IT技术,也在高可靠性时延要求的工业控制领域开始推广应用。以太网络在时延保证和可靠性方面已经有了很多成熟方案并形成了标准,如时间敏感网络(time-sensitive networking,TSN)协议用于确定性时延网络方案。但业界的研究或标准化方案,聚焦在如何降低网络交换/路由节点的报文转发时延和时延确定性,而缺少如何提高接收/发送主机侧的确定性时延和可靠性保障措施的研究。As the most popular IT technology in the field, Ethernet has also begun to be promoted and applied in the field of industrial control that requires high reliability and latency. Ethernet already has many mature solutions and standards in terms of delay guarantee and reliability, such as the time-sensitive networking (TSN) protocol for deterministic delay network solutions. However, research or standardization solutions in the industry focus on how to reduce the packet forwarding delay and delay certainty of network switching/routing nodes, but there is a lack of research on how to improve the deterministic delay and reliability guarantee measures on the receiving/sending host side. .
当前技术背景下,主机侧MAC层接收到报文后,不同类型的报文统一处理,无优先级保障措施。如调度机制统一采用中断或轮询机制,报文处理无优先级区别;MAC层缓存溢出无差别丢包。以上处理过程导致低优先级(如日志文件)报文可能对高可靠性要求报文产生冲击(如车控指令),如使得高可靠性要求报文无法及时获得处理;瞬间突发的大数据量报文,可能导致高可靠性要求的车控指令报文溢出,影响功能安全。因此,如何避免大数据量、低优先级报文对高优先级报文的影响是需要解决的问题。Under the current technical background, after the MAC layer on the host side receives a message, different types of messages are processed uniformly without priority protection measures. If the scheduling mechanism uniformly adopts the interrupt or polling mechanism, there will be no priority difference in packet processing; there will be no difference in packet loss when the MAC layer buffer overflows. As a result of the above processing process, low-priority messages (such as log files) may have an impact on messages with high reliability requirements (such as vehicle control instructions). For example, messages with high reliability requirements cannot be processed in time; instant bursts of big data A large amount of messages may cause vehicle control command messages with high reliability requirements to overflow, affecting functional safety. Therefore, how to avoid the impact of large amounts of data and low-priority messages on high-priority messages is a problem that needs to be solved.
如上所述,当前技术背景下,ETH网络中传输层/网络层对不同优先级的报文采用同样的调度机制进行接收和/或处理,使得在报文突发场景,大带宽低优先级报文可能影响高优先级报文的接收和/或处理,导致高优先级报文无法获得及时处理或丢包。另外,系统同时接入CAN总线和以太网络,业界通用方式是按物理接口设置中断,CAN总线中断的优先级通常高于以太总线中断的优先级,可能会存在CAN总线的低优先级报文中断以太高优先级报文接收的情况,具体如图1所示。鉴于此,本申请实施例提供一种报文处理的方法和装置,能够根据报文内容确定报文的优先级,进而基于报文优先级进行调度,使得在传输层/网络层根据协议对报文进行处理时,能够优先处理高优先级报文;在MAC层接收缓存溢出场景中,高优先级报文可以抢占低优先级队列缓存,进而保证高优先级报文的可靠性和低时延。此外,在系统同时接收到CAN报文和ETH报文时,通过确定CAN报文和ETH报文的优先级,并根据CAN报文和ETH报文的优先级高低,使不同通信技术,和/或统一通信技术的不同端口间,可以按报文优先级生成不同优先级的系统调度请求,以解决物理端口中断导致的CAN总线的低优先级报文中断以太高优先级报文接收的情况。As mentioned above, under the current technical background, the transport layer/network layer in the ETH network uses the same scheduling mechanism to receive and/or process messages of different priorities, so that in a message burst scenario, large-bandwidth low-priority messages The packets may affect the reception and/or processing of high-priority packets, resulting in high-priority packets not being processed in time or packet loss. In addition, the system is connected to the CAN bus and the Ethernet network at the same time. The common method in the industry is to set interrupts according to the physical interface. The priority of the CAN bus interrupt is usually higher than the priority of the Ethernet bus interrupt. There may be low-priority message interrupts of the CAN bus. The reception of Ethernet high-priority packets is shown in Figure 1. In view of this, embodiments of the present application provide a message processing method and device, which can determine the priority of the message according to the message content, and then perform scheduling based on the message priority, so that the message can be processed according to the protocol at the transport layer/network layer. When processing packets, high-priority packets can be processed first; in the MAC layer receive buffer overflow scenario, high-priority packets can preempt the low-priority queue cache, thereby ensuring the reliability and low latency of high-priority packets. . In addition, when the system receives the CAN message and the ETH message at the same time, it determines the priority of the CAN message and the ETH message and uses different communication technologies according to the priority of the CAN message and the ETH message. Or between different ports of unified communication technology, system scheduling requests of different priorities can be generated according to the message priority to solve the problem of low-priority messages on the CAN bus interrupting the reception of high-priority messages caused by physical port interruptions.
为便于理解本申请实施例,首先对本申请中涉及到的术语做简单说明:In order to facilitate understanding of the embodiments of this application, first a brief explanation of the terms involved in this application is given:
1.中断:计算机的操作系统用来响应硬件设备请求的一种机制,操作系统收到硬件的中断请求,会打断正在执行的进程,然后调用内核中的中断处理程序来响应请求。1. Interrupt: A mechanism used by the computer's operating system to respond to hardware device requests. When the operating system receives an interrupt request from the hardware, it will interrupt the executing process, and then call the interrupt handler in the kernel to respond to the request.
2.软中断:为了解决中断处理程序执行过长和中断丢失问题,将中断过长分成两个部分:上半部分用来快速处理中断,一般会暂时关闭中断请求,主要负责处理跟硬件紧密相关或者时间敏感的事件;下半部分用来延迟处理上半部分未完成的工作,一般以“内核线程”的方式运行。即,软中断是利用硬件中断的概念,用软件方式进行模拟,实现宏观上的异步执行的效果。2. Soft interrupt: In order to solve the problem of too long execution of the interrupt handler and loss of interrupts, the interrupt is divided into two parts: the upper part is used to quickly handle the interrupt. Generally, the interrupt request is temporarily closed and is mainly responsible for processing closely related to the hardware. Or time-sensitive events; the second half is used to delay processing of the unfinished work of the first half, and generally runs in the form of a "kernel thread". That is, soft interrupts use the concept of hardware interrupts to simulate them in software to achieve macroscopic asynchronous execution effects.
3.任务调度:多个任务同时共享计算机系统资源时,为了使多个任务均能够顺利执行,操作系统按照一定的原则对多个任务进行调度,使它们按照一定次序执行。3. Task scheduling: When multiple tasks share computer system resources at the same time, in order to ensure that multiple tasks can be executed smoothly, the operating system schedules multiple tasks according to certain principles so that they can be executed in a certain order.
4.调度:在报文(或数据)的实际的处理过程中,报文和报文之间存在着先后的顺序关系或依赖关系。为保证报文处理的正常进行,要求这些报文按照顺序关系或依赖关系有序、高效的执行。调度机制包括但不限于上述中断、软中断、任务调度。4. Scheduling: During the actual processing of messages (or data), there is a sequence or dependency relationship between messages. In order to ensure the normal progress of message processing, these messages are required to be executed in an orderly and efficient manner according to the sequence relationship or dependency relationship. Scheduling mechanisms include but are not limited to the above-mentioned interrupts, soft interrupts, and task scheduling.
图2为本申请提供的一种以太网络系统架构图,包括接收/发送主机100和以太网络的交换/路由设备200。其中,主机100包括媒体访问控制(media access control,MAC)层收发模块110、传输控制协议/网际协议(transmission control protocol/Internet protocol,TCP/IP)协议栈模块120、CAN收发模块130和CAN及上层协议栈模块140。具体地,MAC层收发模块110和TCP/IP协议栈模块120能够实现基于报文内容的优先级识别,以及基于优先级的调度,进而保证高优先级报文的可靠性和低时延。此外,对于CAN收发模块130和CAN及上层协议栈模块140,也可以基于内容确定调度优先级,以实现不同的总线技术间报文优先级的统一识别和调度。Figure 2 is an architecture diagram of an Ethernet system provided by this application, including a receiving/transmitting host 100 and an Ethernet switching/routing device 200. Among them, the host 100 includes a media access control (media access control, MAC) layer transceiver module 110, a transmission control protocol/Internet protocol (transmission control protocol/Internet protocol, TCP/IP) protocol stack module 120, a CAN transceiver module 130 and a CAN and Upper layer protocol stack module 140. Specifically, the MAC layer transceiver module 110 and the TCP/IP protocol stack module 120 can implement priority identification based on message content and priority-based scheduling, thereby ensuring the reliability and low latency of high-priority messages. In addition, for the CAN transceiver module 130 and the CAN and upper layer protocol stack module 140, the scheduling priority can also be determined based on the content to achieve unified identification and scheduling of message priorities between different bus technologies.
在一些可能的实现方式中,接收/发送主机100可以设置在具有与外部通信功能的车联网智能终端,如车载终端(telematics box,T-Box)中,或者,也可以设置在车辆控制模块中,如汽车动态控制系统(vehicle dynamics control,VDC)、整车控制器(vehiclecontrolunit,VCU)、汽车域控制器(domain control unit,DCU)等,或者,还可以设置在其他控制单元中,如ECU等,本申请实施例对此不作具体限定。In some possible implementations, the receiving/transmitting host 100 can be set in an Internet of Vehicles intelligent terminal with external communication functions, such as a vehicle-mounted terminal (telematics box, T-Box), or can also be set in a vehicle control module. , such as vehicle dynamics control (VDC), vehicle control unit (VCU), vehicle domain controller (domain control unit, DCU), etc., or it can also be set in other control units, such as ECU etc., the embodiments of this application do not specifically limit this.
图3示出了主机100内部的以太网络及上层协议栈逻辑架构图,以下将结合图3详细说明主机100接收报文后的工作流程。具体地,MAC层收发模块110包括报文接收控制模块111和接收队列缓存模块112,报文接收控制模块111用于完成MAC层报文的接收,以及对MAC层报文的优先级进行识别,并针对不同优先级的报文生成不同的处理策略,进而可以向系统调度控制模块150发送调度请求;接收队列缓存模块112用于缓存维护和缓存控制,按照报文优先级划分缓存队列,在缓存空间使用率超设定门限时优先缓存高优先级报文,并向报文接收控制模块111返回缓存结果。TCP/IP协议栈模块120用于进一步处理报文,TCP/IP协议栈模块120包括协议栈处理控制模块121和协议栈处理模块122,协议栈处理控制模块121根据优先级处理策略,控制协议栈处理模块122根据协议进行报文处理;协议栈处理模块122读取(或接收)队列缓存模块112中不同优先级队列的缓存报文并进行处理。系统调度模块150用于根据报文接收控制模块111生成的不同优先级的调度请求,调用对应的协议栈处理控制模块,系统调度控制模块150可以有多种调度策略方案,如硬中断、软中断、任务调度等,在多种调度请求冲突/竞争时,按优先级进行调 度。Figure 3 shows the logical architecture diagram of the Ethernet network and the upper layer protocol stack within the host 100. The following will describe in detail the workflow of the host 100 after receiving the message in conjunction with Figure 3. Specifically, the MAC layer transceiver module 110 includes a message reception control module 111 and a reception queue cache module 112. The message reception control module 111 is used to complete the reception of MAC layer messages and identify the priority of MAC layer messages. And generate different processing strategies for messages of different priorities, and then send scheduling requests to the system scheduling control module 150; the receiving queue cache module 112 is used for cache maintenance and cache control, divides the cache queue according to the message priority, and in the cache When the space usage exceeds the set threshold, high-priority messages are cached first, and the cache results are returned to the message reception control module 111. The TCP/IP protocol stack module 120 is used to further process the message. The TCP/IP protocol stack module 120 includes a protocol stack processing control module 121 and a protocol stack processing module 122. The protocol stack processing control module 121 controls the protocol stack according to the priority processing policy. The processing module 122 processes messages according to the protocol; the protocol stack processing module 122 reads (or receives) cached messages of different priority queues in the queue cache module 112 and processes them. The system scheduling module 150 is used to call the corresponding protocol stack processing control module according to the scheduling requests of different priorities generated by the message reception control module 111. The system scheduling control module 150 can have multiple scheduling strategies, such as hard interrupts and soft interrupts. , task scheduling, etc., when multiple scheduling requests conflict/compete, schedule according to priority.
图4示出了主机100内部的CAN总线的系统架构图,其中,CAN收发模块130的工作原理与图3中的MAC收发模块110类似,即接收CAN信号,并根据CAN报文的MessageID字段或其他信息确定CAN报文优先级;生成不同优先级的调度请求,进而向系统调度控制模块150发送调度请求;CAN及上层协议栈模块140的工作原理与图3中的TCP/IP协议栈模块120类似,即进一步处理CAN信号,CAN及上层协议栈模块140也可以包括协议栈处理控制模块和协议栈处理模块;系统调度控制模块150用于根据CAN收发模块130生成的不同优先级的调度请求,调用对应的协议栈处理控制模块。在系统调度控制模块150同时收到多个带有CAN报文优先级信息的调度请求和多个带有MAC报文优先级信息的调度请求时,根据调度请求调用对应的协议栈处理控制模块进行报文处理。FIG. 4 shows the system architecture diagram of the CAN bus inside the host 100. The working principle of the CAN transceiver module 130 is similar to that of the MAC transceiver module 110 in FIG. Other information determines the CAN message priority; generates scheduling requests with different priorities, and then sends scheduling requests to the system scheduling control module 150; the working principle of the CAN and upper layer protocol stack module 140 is the same as the TCP/IP protocol stack module 120 in Figure 3 Similarly, that is, to further process the CAN signal, the CAN and upper layer protocol stack module 140 may also include a protocol stack processing control module and a protocol stack processing module; the system scheduling control module 150 is used to schedule requests of different priorities according to the scheduling requests of different priorities generated by the CAN transceiver module 130. Call the corresponding protocol stack processing control module. When the system scheduling control module 150 receives multiple scheduling requests with CAN message priority information and multiple scheduling requests with MAC message priority information at the same time, it calls the corresponding protocol stack processing control module according to the scheduling request. Message processing.
应理解,上述模块及装置仅为一个示例,实际应用中,上述模块和装置有可能根据实际需要添加或删除。一示例,图2中还可以包括系统调度控制模块。It should be understood that the above-mentioned modules and devices are only examples. In actual applications, the above-mentioned modules and devices may be added or deleted according to actual needs. As an example, Figure 2 may also include a system scheduling control module.
图5示出了本申请实施例提供的一种报文处理的方法的示例性流程图,该方法500可以应用于图2所示的系统中,也可以由图3或图4所示的系统执行。图5示出的报文处理的方法的步骤或操作仅为示例性说明,本申请实施例还可以执行其他操作或者图5中的各个操作的变形。该方法500包括:Figure 5 shows an exemplary flow chart of a message processing method provided by an embodiment of the present application. The method 500 can be applied to the system shown in Figure 2, or can also be used in the system shown in Figure 3 or Figure 4. implement. The steps or operations of the message processing method shown in FIG. 5 are only exemplary illustrations, and the embodiment of the present application may also perform other operations or modifications of each operation in FIG. 5 . The method 500 includes:
S501,接收第一报文。S501, receive the first message.
示例性地,该第一报文可以为以太报文;或者,该第一报文也可以为CAN报文。For example, the first message may be an Ethernet message; or the first message may also be a CAN message.
示例性地,在接收到第一报文后,通过MAC层协议对以太报文进行处理,如MAC地址过滤、循环冗余校验码(cyclic redundancy check,CRC)校验等;或通过CAN协议对CAN报文进行解析。For example, after receiving the first message, the Ethernet message is processed through the MAC layer protocol, such as MAC address filtering, cyclic redundancy check (CRC) verification, etc.; or through the CAN protocol Analyze CAN messages.
应理解,上述的“接收”包括CAN收发模块或MAC收发模块对报文的接收。It should be understood that the above-mentioned "receiving" includes the reception of messages by the CAN transceiver module or the MAC transceiver module.
S502,确定该第一报文的优先级。S502: Determine the priority of the first message.
示例性地,根据报文字段、字段组合或报文内容进行报文优先级识别。在一些可能的实现方式中,确定第一报文的优先级的步骤,由上文实施例中描述的CAN收发模块或MAC收发模块完成。For example, the message priority is identified based on message fields, field combinations or message content. In some possible implementations, the step of determining the priority of the first message is completed by the CAN transceiver module or the MAC transceiver module described in the above embodiment.
在一些可能的实现方式中,该第一报文的优先级用于指示报文处理的优先级,对于优先级高的报文,会根据与第一报文对应的协议进行优先处理。例如,采用CAN协议对CAN报文进行处理,采用TCP/IP协议,或者UDP协议对以太报文进行处理。In some possible implementations, the priority of the first packet is used to indicate the priority of packet processing. For packets with high priority, priority will be processed according to the protocol corresponding to the first packet. For example, the CAN protocol is used to process CAN messages, and the TCP/IP protocol or UDP protocol is used to process Ethernet messages.
在一些可能的实现方式中,可以通过以太报文的优先级字段(priority code point,PCP)字段确定以太报文的优先级;或者,还可以根据协议规定确定报文的优先级;或者,也可以使用其他字段或其他方式确定报文的优先级,本申请实施例对此不作具体限定。示例性地,除了PCP=0以及PCP=1以外,PCP字段数值越大,则优先级越高。例如,“PCP=7”的报文的优先级高于“PCP=5”的报文的优先级。在具体实现过程中,也可以设定其他的优先级高低的判定方式,本申请实施例对此不作具体限定。In some possible implementations, the priority of the Ethernet message can be determined through the priority field (priority code point, PCP) field of the Ethernet message; or the priority of the message can also be determined according to the protocol; or, also Other fields or other methods may be used to determine the priority of the message, which is not specifically limited in the embodiments of this application. For example, except for PCP=0 and PCP=1, the larger the value of the PCP field, the higher the priority. For example, the priority of the packet "PCP=7" is higher than the priority of the packet "PCP=5". During the specific implementation process, other priority determination methods may also be set, which are not specifically limited in the embodiments of this application.
在一些可能的实现方式中,可以通过CAN报文的标识符Message ID字段确定CAN报文的优先级,Message ID字段数值越低,报文优先级越高。例如,“Message ID=1”的CAN报文的优先级高于“Message ID=2”的CAN报文的优先级。In some possible implementations, the priority of the CAN message can be determined by the identifier Message ID field of the CAN message. The lower the value of the Message ID field, the higher the priority of the message. For example, the priority of the CAN message "Message ID=1" is higher than the priority of the CAN message "Message ID=2".
示例性地,CAN报文和以太报文中各字段与报文优先级之间的对应关系如表1所示。For example, the corresponding relationship between the fields in the CAN message and the Ethernet message and the message priority is as shown in Table 1.
表1不同报文字段数值与优先级的对应关系Table 1 Correspondence between different message field values and priorities
报文类型Message type 报文字段数值Message field value 报文优先级Message priority
CANCAN Message ID=1Message ID=1 high
CANCAN Message ID=2Message ID=2 middle
CANCAN Message ID=3Message ID=3 middle
CANCAN Message ID=4Message ID=4 Low
以太ether PCP=6~7PCP=6~7 high
以太ether PCP=3~5PCP=3~5 middle
以太ether PCP=0~2PCP=0~2 Low
S503,根据该第一报文的优先级确定该第一报文的报文处理策略,其中,报文处理策略包括立即接收和周期轮询,立即接收包括,对第一报文生成调度请求,并接收第一报文,例如将第一报文的优先级映射到调度优先级,并生成调度请求;周期轮询是指,不生成调度请求,等待上层协议栈周期轮询处理。S503: Determine the message processing strategy of the first message according to the priority of the first message. The message processing strategy includes immediate reception and periodic polling. The immediate reception includes generating a scheduling request for the first message. And receive the first message, for example, map the priority of the first message to the scheduling priority, and generate a scheduling request; periodic polling means not generating a scheduling request and waiting for periodic polling processing by the upper layer protocol stack.
具体地,立即接收是指通过中断、操作系统软中断、任务调度等调度机制,实现对报文的实时或准实时处理;周期轮询接收模式是指对低优先级的以太报文,系统通过周期轮询方式批量接收报文。应理解,周期轮询可以包括调用上层协议栈(如传输层或网络层)周期性查询报文缓存区,如果报文缓存区有待处理报文,则进行对待处理报文进行处理。Specifically, immediate reception refers to realizing real-time or quasi-real-time processing of messages through scheduling mechanisms such as interrupts, operating system soft interrupts, and task scheduling; periodic polling reception mode refers to the system's processing of low-priority Ethernet messages through Receive messages in batches in periodic polling mode. It should be understood that periodic polling may include calling the upper layer protocol stack (such as the transport layer or network layer) to periodically query the message cache area. If there are messages to be processed in the message cache area, the message to be processed is processed.
在一些可能的实现方式中,对高优先级和中优先级的报文采取立即接收模式,对低优先级报文采取周期轮询模式。In some possible implementations, the immediate reception mode is adopted for high-priority and medium-priority packets, and the periodic polling mode is adopted for low-priority packets.
还需说明的是,在立即接收模式中,对报文的处理方式依赖于系统调度机制。根据报文的优先级可以生成不同优先级的调度请求。一示例,对采用中断的系统,可以根据报文的优先级生成不同优先级的中断请求。例如,对于表1所示的PCP=3~7的报文,映射到两个不同的中断优先级,其中,PCP=6~7的报文对应于较高中断优先级,PCP=3~5的报文对应于较低中断优先级;对于表1所示的Message ID=2、Message ID=3以及PCP=6~7的报文,映射到两个不同的中断优先级,其中,PCP=6~7的报文对应于较高中断优先级,Message ID=2~3的报文对应于较低中断优先级。进一步地,针对中断优先级较高的报文生成高优先级中断请求,针对中断优先级较低的报文生成低优先级中断请求。中断请求优先级高的报文可以中断中断请求优先级低的报文。又一示例,对采用软中断调用的系统,可以根据报文的优先级设定不同的软中断或调用优先级,例如,对于表1所示的PCP=3~7的报文,映射到两个不同的中断优先级,其中,PCP=6~7的报文对应于较高软中断优先级,PCP=3~5的报文对应于较低软中断优先级。软中断优先级较高的报文可以中断软中断优先级较低的报文。再一示例,对采用任务调度的系统,可以根据报文的优先级设置不同的任务调度优先级,例如,对于表1所示的PCP=3~7的报文,映射到两个不同的任务调度优先级,其中,PCP=6~7的报文对应于较高任务调度优先级,PCP=3~5的报文对应于较低任务调度优先级。系统可以优先处理较高任务调度优先级的报文,再处理较低任务调度优先级的报文。It should also be noted that in immediate reception mode, the processing of messages depends on the system scheduling mechanism. Scheduling requests with different priorities can be generated based on the priority of the message. As an example, for a system that uses interrupts, interrupt requests of different priorities can be generated according to the priority of the message. For example, the packets with PCP=3~7 shown in Table 1 are mapped to two different interrupt priorities. Among them, the packets with PCP=6~7 correspond to higher interrupt priorities, and PCP=3~5 The messages correspond to lower interrupt priorities; for the messages with Message ID=2, Message ID=3 and PCP=6~7 shown in Table 1, they are mapped to two different interrupt priorities, where PCP= Messages 6 to 7 correspond to higher interrupt priorities, and messages with Message ID = 2 to 3 correspond to lower interrupt priorities. Further, a high-priority interrupt request is generated for a message with a higher interrupt priority, and a low-priority interrupt request is generated for a message with a lower interrupt priority. Messages with high interrupt request priority can interrupt messages with low interrupt request priority. As another example, for systems that use soft interrupt calls, different soft interrupt or call priorities can be set according to the priority of the message. For example, for the messages with PCP=3~7 shown in Table 1, they are mapped to two Different interrupt priorities, among which, messages with PCP=6~7 correspond to higher soft interrupt priority, and messages with PCP=3~5 correspond to lower soft interrupt priority. Messages with higher soft interrupt priority can interrupt messages with lower soft interrupt priority. As another example, for a system that uses task scheduling, different task scheduling priorities can be set according to the priority of the message. For example, the messages with PCP=3~7 shown in Table 1 are mapped to two different tasks. Scheduling priority, where messages with PCP=6 to 7 correspond to higher task scheduling priorities, and messages with PCP=3 to 5 correspond to lower task scheduling priorities. The system can prioritize packets with higher task scheduling priority and then process packets with lower task scheduling priority.
在一些可能的实现方式中,在系统支持两种及以上调度机制时,对报文的处理方式也可以采用两种及以上调度机制进行混合处理。例如,采用中断对优先级较高的报文进行接收,采用任务调度对优先级较低的报文进行处理;或者,也可以采用其他混合的调度机制对报文进行处理,本申请实施例对此不作具体限定。In some possible implementations, when the system supports two or more scheduling mechanisms, the packet processing method can also use two or more scheduling mechanisms for mixed processing. For example, interrupts are used to receive messages with higher priority, and task scheduling is used to process messages with lower priority; or other mixed scheduling mechanisms can also be used to process messages. The embodiments of this application are This is not specifically limited.
S504,调度上层协议栈根据调度请求进行报文处理;同时,调度上层协议栈周期性触发周期轮询任务,处理低优先级报文。S504, schedule the upper layer protocol stack to process messages according to the scheduling request; at the same time, schedule the upper layer protocol stack to periodically trigger periodic polling tasks to process low-priority messages.
示例性地,若第一报文为上文中高优先级报文或中优先级报文,则报文处理系统调度控制模块调度上层协议栈对报文进行立即接收处理;若第一报文为低优先级报文,则报文处理系统周期性调度上层协议栈轮询报文缓存区,对报文缓存区的包含第一报文在内的所有低优先级报文统一处理。For example, if the first message is a high-priority message or a medium-priority message as mentioned above, the message processing system scheduling control module schedules the upper layer protocol stack to receive and process the message immediately; if the first message is For low-priority messages, the message processing system periodically schedules the upper-layer protocol stack to poll the message buffer area, and uniformly processes all low-priority messages in the message buffer area, including the first message.
在一些可能的实现方式中,在报文处理系统空闲时,即上层协议栈未对高优先级报文进行立即接收处理时,调度上层协议栈通过周期轮询批量处理低优先级报文。In some possible implementations, when the message processing system is idle, that is, when the upper layer protocol stack does not immediately receive and process high-priority messages, the upper-layer protocol stack is scheduled to process low-priority messages in batches through periodic polling.
示例性地,若第一报文的报文处理策略为立即接收,则通过中断、软中断、任务调度的一种或多种方式对第一报文实时或准实时处理。例如,系统正在处理第二报文的过程中,接收到新的调度请求,请求系统处理第一报文,若该第一报文的调度请求优先级高于第二报文的调度请求优先级,则暂停处理第二报文,优先处理第一报文;若该第一报文的调度请求优先级与第二报文的相同,或第一报文的调度请求优先级低于第二报文的调度请求优先级,则可以等待第二报文处理完毕,再处理第一报文。若第一报文的报文处理策略为周期轮询接收,则系统周期性调度上层协议栈(如传输层或网络层)接收报文并对报文进行处理。For example, if the packet processing policy of the first packet is immediate reception, the first packet is processed in real-time or quasi-real-time through one or more methods of interrupt, soft interrupt, and task scheduling. For example, while the system is processing the second packet, it receives a new scheduling request and requests the system to process the first packet. If the scheduling request priority of the first packet is higher than the scheduling request priority of the second packet, , then the processing of the second message is suspended and the first message is processed first; if the scheduling request priority of the first message is the same as that of the second message, or the scheduling request priority of the first message is lower than that of the second message If the priority of the scheduling request of the message is determined, you can wait for the second message to be processed before processing the first message. If the packet processing strategy of the first packet is periodic polling reception, the system periodically schedules the upper layer protocol stack (such as the transport layer or network layer) to receive the packet and process the packet.
进一步地,上述轮询周期可以为100毫秒,或者也可以为500毫秒,或者还可以为其他时长,本申请实施例对此不作具体限定。Further, the above-mentioned polling period may be 100 milliseconds, or it may be 500 milliseconds, or it may be other lengths of time, which are not specifically limited in the embodiments of this application.
示例性地,在对第一报文进行处理时,可以根据上层协议完成对第一报文进行处理,例如,通过TCP/IP协议,或者UDP协议等对第一报文进行处理;或者,通过CAN协议等对第一报文进行处理,本申请实施例对此不作具体限定。For example, when processing the first message, the first message can be processed according to the upper layer protocol, for example, the first message can be processed through the TCP/IP protocol, or the UDP protocol; or, through The CAN protocol or the like processes the first message, which is not specifically limited in the embodiments of this application.
在步骤S503和S504中,“报文处理”包括“上层协议栈(如传输层或网络层)接收报文”和/或“上层协议栈(如传输层或网络层)根据通信协议对报文进行处理”。In steps S503 and S504, "message processing" includes "the upper layer protocol stack (such as the transport layer or network layer) receives the message" and/or "the upper layer protocol stack (such as the transport layer or network layer) processes the message according to the communication protocol Processed".
在本申请实施例中,为便于理解和说明,引入了“较高”、“较低”等术语。其中,“较高”例如可以是指报文优先级、调度优先级较高等,“较低”例如可以是报文优先级、调度优先级较低等。此外,本申请实施例中的“高优先级”、“中优先级”、“低优先级”可以理解为设定报文的三个等级的优先级,从“高优先级”至“低优先级”的报文优先级逐渐降低。应理解,这些术语仅为便于理解而引入,不应对本申请构成任何限定。In the embodiments of this application, for convenience of understanding and description, terms such as "higher" and "lower" are introduced. For example, "higher" may mean that the message priority and scheduling priority are higher, and "lower" may mean that the message priority and scheduling priority are lower. In addition, the "high priority", "medium priority" and "low priority" in the embodiments of this application can be understood as setting the three levels of priority of the message, from "high priority" to "low priority". Level" packet priority gradually decreases. It should be understood that these terms are introduced only to facilitate understanding and shall not constitute any limitation on the present application.
本申请实施例提供的一种报文处理的方法,能够基于报文的优先级,控制报文处理的优先级,实现高优先级报文被优先处理,有利于保证高优先级报文处理时延优于低优先级报文。示例性地,在车辆控制领域中,影响车辆安全的管理报文的优先级高,数据量大、业务突发特征明显的数据传输、娱乐域音视频流等业务报文的优先级低,本申请实施例的报文处理方法通过立即接收(如中断)处理高优先级报文,能够保证高优先级的影响车辆安全的报文处理的实时性,通过周期轮询处理低优先级的业务报文,能够提升报文处理性能,有助于避免高频中断对系统性能产生的影响。在完成高优先级报文处理后才处理低优 先级报文,使得在控制流、数据、音视频流不同优先级混合传输场景中,大带宽/突发的低优先级数据流不会影响高优先级报文的传输,提升车控命令传输的可靠性。此外,本申请实施例提供的报文处理方法,能够避免按物理接口设置优先级,导致的低优先级报文中断和影响其他端口的高优先级报文的处理,有助于提升高优先级报文的处理实时性和可靠性。The message processing method provided by the embodiment of the present application can control the priority of message processing based on the priority of the message, so that high-priority messages are processed with priority, which is beneficial to ensuring the processing time of high-priority messages. Delay is better than low-priority packets. For example, in the field of vehicle control, management messages that affect vehicle safety have a high priority, and business messages with large amounts of data, obvious business burst characteristics, data transmission, entertainment domain audio and video streams, etc. have a low priority. The message processing method of the application embodiment processes high-priority messages through immediate reception (such as interruption), which can ensure the real-time processing of high-priority messages that affect vehicle safety, and processes low-priority business messages through periodic polling. This can improve message processing performance and help avoid the impact of high-frequency interruptions on system performance. Low-priority packets are processed only after high-priority packets are processed, so that in mixed transmission scenarios of control flow, data, audio and video flows with different priorities, large-bandwidth/burst low-priority data flows will not affect high-priority data flows. The transmission of priority messages improves the reliability of vehicle control command transmission. In addition, the packet processing method provided by the embodiment of the present application can avoid the interruption of low-priority packets caused by setting priorities based on physical interfaces and the processing of high-priority packets that affect other ports, helping to improve high-priority packets. The processing of messages is real-time and reliable.
在一些可能的实现方式中,系统接收到一个或多个报文后,会将报文缓存在对应的缓存队列,进而根据各报文的“报文描述信息”中包括的“开始地址”,将缓存队列中的报文缓存至报文缓存区。具体如图6所示,将缓存队列1和缓存队列2中的报文1至4缓存至报文缓存区。在一些可能的实现方式中,可以根据报文优先级设置缓存队列,例如,将高优先级的报文设置至同一缓存队列中,将低优先级报文设置至另一缓存队列;或者,同一缓存队列中可以有优先级不同的各种报文,本申请实施例对此不作具体限定。在一些可能的实现方式中,在报文缓存区无可缓存空间时,可以对报文进行丢弃。以下结合图7说明本申请实施例提供的一种报文缓存过程中的处理方法。In some possible implementations, after receiving one or more messages, the system will cache the messages in the corresponding cache queue, and then based on the "start address" included in the "message description information" of each message, Cache the messages in the cache queue to the message cache area. Specifically, as shown in Figure 6, messages 1 to 4 in cache queue 1 and cache queue 2 are cached in the message cache area. In some possible implementations, the cache queue can be set according to the packet priority. For example, high-priority packets can be set to the same cache queue, and low-priority packets can be set to another cache queue; or the same cache queue can be set. There may be various messages with different priorities in the cache queue, which are not specifically limited in this embodiment of the present application. In some possible implementations, when there is no cache space in the message cache, the message can be discarded. The following describes a processing method in the message caching process provided by the embodiment of the present application with reference to FIG. 7 .
图7示出了本申请实施例提供的一种根据报文优先级进行报文缓存的方法的示意性流程图,该方法700可以应用于图2所示的系统中,也可以由图3或图4所示的系统执行。该方法700包括:Figure 7 shows a schematic flowchart of a method for caching messages according to message priority provided by an embodiment of the present application. This method 700 can be applied to the system shown in Figure 2, or can also be used in Figure 3 or The system shown in Figure 4 is implemented. The method 700 includes:
S701,接收第二报文,确定第二报文的优先级。S701: Receive the second message and determine the priority of the second message.
示例性地,确定第二报文优先级的方法可以参考上述实施例中的描述,在此不再赘述。For example, the method of determining the priority of the second packet may refer to the description in the above embodiment, and will not be described again here.
应理解,该第二报文可以为方法500中的第一报文,或者也可以为与第一报文不同的报文,本申请实施例对此不作具体限定。It should be understood that the second message may be the first message in the method 500, or may be a message different from the first message, which is not specifically limited in this embodiment of the present application.
S702,根据第二报文的优先级和缓存占用判断第二报文是否满足报文丢弃条件。S702: Determine whether the second packet satisfies the packet discarding condition based on the priority of the second packet and cache occupancy.
具体地,如果第二报文优先级和缓存占用满足报文丢弃条件,执行S703;否则,执行S704。Specifically, if the second packet priority and buffer occupancy meet the packet discard condition, execute S703; otherwise, execute S704.
应理解,本申请实施例中的“缓存占用”可以包括报文缓存区的已用缓存空间。It should be understood that the “cache occupation” in the embodiment of this application may include the used cache space of the message cache area.
示例性地,可以设定一组或多组报文丢弃条件参数对,例如,[报文优先级门限1,报文缓存占用门限1],[报文优先级门限2,报文缓存占用门限2]。在满足以下条件时,丢弃第二报文:第二报文的优先级低于报文优先级门限X,且缓存占用高于报文丢弃缓存占用门限X。其中,X仅代表为“报文优先级门限”或“报文缓存占用门限”的代号,在本申请实施例中可以取值为1或2。在一些可能的实现方式中,X也可以为其他数值,“X”不应理解为对本申请实施例的限制。更直观地,如图8所示,报文优先级和缓存占用情况位于图8中的阴影区域时,则丢弃第二报文。For example, one or more groups of packet discarding condition parameter pairs can be set, for example, [message priority threshold 1, message cache occupancy threshold 1], [message priority threshold 2, message cache occupancy threshold 2]. The second packet is discarded when the following conditions are met: the priority of the second packet is lower than the packet priority threshold X, and the buffer occupancy is higher than the packet discard buffer occupancy threshold X. Wherein, In some possible implementations, X can also be other values, and "X" should not be understood as a limitation on the embodiments of the present application. More intuitively, as shown in Figure 8, when the packet priority and cache occupancy are located in the shaded area in Figure 8, the second packet is discarded.
需要说明的是,在具体实现过程中,执行S703的条件不限制于“第二报文的优先级低于报文优先级门限X,且缓存占用高于报文丢弃缓存占用门限X”这个条件,即,可以在第二报文的优先级低于或等于报文优先级门限X,且缓存占用高于或等于报文丢弃缓存占用门限X时,执行S703。It should be noted that during the specific implementation process, the conditions for executing S703 are not limited to the condition "the priority of the second message is lower than the message priority threshold X, and the cache occupancy is higher than the message discard cache occupancy threshold X" , that is, S703 can be executed when the priority of the second message is lower than or equal to the message priority threshold X and the buffer occupancy is higher than or equal to the message discard buffer occupancy threshold X.
示例性地,报文优先级门限1可以为PCP=3,报文优先级门限2可以为PCP=6,其中,PCP=6的优先级高于PCP=3的优先级。报文缓存占用门限1可以为缓存空间的60%,报文缓存占用门限2可以为缓存空间的80%。在一些可能的实现方式中,报文缓存占用门限也可以为缓存空间的100%,本申请对此不作具体限定。应理解,上述对报文优先级门 限1、2,以及对报文缓存占用门限1、2的举例仅为示例性说明,不应理解为对本申请实施例的限制。报文优先级门限、报文缓存占用门限也可以为其他指标或数值,本申请实施例对此不作具体限定。For example, the message priority threshold 1 may be PCP=3, and the message priority threshold 2 may be PCP=6, where the priority of PCP=6 is higher than the priority of PCP=3. The message cache occupancy threshold 1 can be 60% of the cache space, and the message cache occupancy threshold 2 can be 80% of the cache space. In some possible implementations, the message cache occupancy threshold may also be 100% of the cache space, which is not specifically limited in this application. It should be understood that the above examples of message priority thresholds 1 and 2 and message cache occupancy thresholds 1 and 2 are only illustrative and should not be understood as limitations to the embodiments of the present application. The message priority threshold and the message cache occupancy threshold can also be other indicators or values, which are not specifically limited in the embodiments of this application.
S703,丢弃第二报文,报文缓存过程结束。S703, discard the second message, and the message caching process ends.
应理解,如果第二报文被丢弃,则不继续第二报文进行处理。It should be understood that if the second message is discarded, the processing of the second message will not continue.
S704,判断报文缓存空间是否已满。S704, determine whether the message cache space is full.
具体地,如果报文缓存空间已满,则执行S705,否则执行S706。Specifically, if the message cache space is full, S705 is executed, otherwise S706 is executed.
在一些可能的实现方式中,在报文缓存区已用空间超过预设阈值时,执行S705。例如,当报文缓存区已用空间超过90%或95%时,执行S705,否则执行S706。In some possible implementations, when the used space in the message buffer exceeds the preset threshold, S705 is executed. For example, when the used space in the message buffer exceeds 90% or 95%, S705 is executed; otherwise, S706 is executed.
需要说明的是,在一些可能的实现方式中,上述预设阈值小于或等于报文缓存占用门限2。It should be noted that in some possible implementations, the above preset threshold is less than or equal to the message cache occupancy threshold 2.
S705,丢弃一个或多个低优先级、且优先级低于第二报文的优先级的报文。S705: Discard one or more low-priority packets whose priority is lower than the priority of the second packet.
S706,缓存第二报文,报文缓存过程结束。S706, cache the second message, and the message caching process ends.
需要说明的是,本申请实施例涉及的“丢弃”可以理解为不存储报文或删除报文。It should be noted that the "discard" involved in the embodiment of this application can be understood as not storing the message or deleting the message.
应理解,图7示出的处理报文的方法的步骤或操作仅为示例性说明,本申请实施例还可以执行其他操作或者图7中的各个操作的变形。此外,图7中的各个步骤可以按照与图7呈现的不同的顺序来执行,并且有可能并非要执行图7中的全部操作。示例性地,在确定第二报文满足报文丢弃条件时,可以跳过S704至S706;或者,S702和S704也可以同时执行,本申请实施例对此不作具体限定。It should be understood that the steps or operations of the message processing method shown in FIG. 7 are only exemplary illustrations, and the embodiment of the present application may also perform other operations or modifications of each operation in FIG. 7 . Furthermore, the various steps in FIG. 7 may be performed in a different order than presented in FIG. 7 , and it is possible that not all operations in FIG. 7 may be performed. For example, when it is determined that the second packet satisfies the packet discard condition, S704 to S706 may be skipped; or S702 and S704 may also be executed at the same time, which is not specifically limited in this embodiment of the present application.
本申请实施例提供的一种报文处理的方法,通过高优先级报文抢占低优先级报文缓存空间,以及优先丢弃低优先级报文,能够降低高优先级报文因缓存溢出的丢包概率,提升系统可靠性。The message processing method provided by the embodiment of the present application can reduce the loss of high-priority messages due to buffer overflow by using high-priority messages to seize cache space for low-priority messages and discarding low-priority messages first. package probability to improve system reliability.
图9示出了本申请实施例提供的报文处理的方法900的示意性流程图。该方法900可以应用于图2所示的系统架构中,该方法也可以由图3和/或图4所示的系统执行。图9示出的报文处理的方法的步骤或操作仅为示例性说明,本申请实施例还可以执行其他操作或者图9中的各个操作的变形。该方法900包括:Figure 9 shows a schematic flow chart of a message processing method 900 provided by an embodiment of the present application. The method 900 can be applied in the system architecture shown in FIG. 2 , and the method can also be executed by the system shown in FIG. 3 and/or FIG. 4 . The steps or operations of the message processing method shown in FIG. 9 are only exemplary illustrations, and the embodiment of the present application may also perform other operations or modifications of each operation in FIG. 9 . The method 900 includes:
S901,确定第一报文的优先级。S901: Determine the priority of the first message.
示例性地,该第一报文可以为上述实施例中描述的以太报文,或者也可以为上述实施例中描述的CAN报文。示例性地,该第一报文可以为上述方法500中的第一报文。在一些可能的实现方式中,该第一报文也可以为上述方法700中的第二报文。或者,该第一报文也可以为其他报文,本申请实施例对此不作具体限定。For example, the first message may be the Ethernet message described in the above embodiment, or it may also be the CAN message described in the above embodiment. For example, the first message may be the first message in the above method 500. In some possible implementations, the first message may also be the second message in the above method 700. Alternatively, the first message may also be another message, which is not specifically limited in the embodiment of the present application.
示例性地,确定第一报文优先级的方法可以参考上述实施例中的描述,在此不再赘述。For example, the method of determining the priority of the first packet may refer to the description in the above embodiment, and will not be described again here.
S902,在该第一报文的优先级满足第一条件时,生成调度请求,该调度请求用于请求对该第一报文进行实时处理;在该第一报文的优先级满足第二条件时,等待对该第一报文的轮询处理。S902: When the priority of the first message meets the first condition, generate a scheduling request. The scheduling request is used to request real-time processing of the first message; when the priority of the first message meets the second condition time, waiting for the polling processing of the first message.
示例性地,该实时处理可以为上述实施例中描述的“立即接收”,包括但不限于中断、软中断、任务调度。该轮询处理可以为上述实施例中描述的“周期轮询”,其中轮询处理的周期可以为100毫秒,或者500毫秒,或者也可以为其他周期,本申请实施例对此不作具体限定。For example, the real-time processing can be the "immediate reception" described in the above embodiment, including but not limited to interrupts, soft interrupts, and task scheduling. The polling process may be the "periodic polling" described in the above embodiment, where the cycle of the polling process may be 100 milliseconds, or 500 milliseconds, or other cycles, which are not specifically limited in the embodiments of the present application.
示例性地,上述第一条件包括第一报文的优先级高于预设阈值,例如,第一报文的优先级如上文中描述的为高优先级或中优先级;上述第二条件包括第一报文的优先级低于或等于预设阈值,例如,第一报文的优先级如上文中描述的为低优先级。或者,第一条件可以包括第一报文承载的内容为车空指令等控制指令;第二条件可以包括第一报文承载的内容为音视频流等娱乐性内容。或者,该第一条件和第二条件也可以为与第一报文的内容相关联的其他条件,本申请实施例对此不作具体限定。Exemplarily, the above-mentioned first condition includes that the priority of the first message is higher than the preset threshold, for example, the priority of the first message is high priority or medium priority as described above; the above-mentioned second condition includes the The priority of a packet is lower than or equal to the preset threshold. For example, the priority of the first packet is low priority as described above. Alternatively, the first condition may include that the content carried by the first packet is a control instruction such as an empty vehicle command; the second condition may include that the content carried by the first packet is entertainment content such as audio and video streams. Alternatively, the first condition and the second condition may also be other conditions associated with the content of the first message, which are not specifically limited in this embodiment of the present application.
示例性地,生成调度请求以及等待轮询处理的方法可以参考上述实施例中的描述,在此不再赘述。For example, the method of generating a scheduling request and waiting for polling processing may refer to the description in the above embodiment, and will not be described again here.
本申请实施例提供的一种报文处理的方法,能够基于报文的优先级,控制报文处理的优先级,实现高优先级报文被优先处理,有利于保证高优先级报文处理时延优于低优先级报文。保证高优先级的影响车辆安全的报文处理的实时性,通过周期轮询处理低优先级的业务报文,能够提升处理性能,及避免高频中断对系统性能产生的影响。The message processing method provided by the embodiment of the present application can control the priority of message processing based on the priority of the message, so that high-priority messages are processed with priority, which is beneficial to ensuring the processing time of high-priority messages. Delay is better than low-priority packets. Ensure the real-time processing of high-priority messages that affect vehicle safety, and process low-priority business messages through periodic polling, which can improve processing performance and avoid the impact of high-frequency interruptions on system performance.
图10示出了本申请实施例提供的报文处理的方法1000的示意性流程图。该方法1000可以应用于图2所示的系统架构中,该方法也可以由图3和/或图4所示的系统执行。图10示出的报文处理的方法的步骤或操作仅为示例性说明,本申请实施例还可以执行其他操作或者图10中的各个操作的变形。该方法1000包括:Figure 10 shows a schematic flow chart of a message processing method 1000 provided by an embodiment of the present application. The method 1000 can be applied in the system architecture shown in Figure 2, and the method can also be executed by the system shown in Figure 3 and/or Figure 4. The steps or operations of the message processing method shown in FIG. 10 are only exemplary illustrations, and embodiments of the present application may also perform other operations or modifications of each operation in FIG. 10 . The method 1000 includes:
S1010,确定对第一报文的第一处理策略,该第一处理策略为实时处理和轮询处理中的一项。S1010. Determine a first processing strategy for the first message. The first processing strategy is one of real-time processing and polling processing.
示例性地,该实时处理可以为上述实施例中描述的“立即接收”,包括但不限于中断、软中断、任务调度。该轮询处理可以为上述实施例中描述的“周期轮询”,其中轮询处理的周期可以为100毫秒,或者500毫秒,或者也可以为其他周期,本申请实施例对此不作具体限定。For example, the real-time processing can be the "immediate reception" described in the above embodiment, including but not limited to interrupts, soft interrupts, and task scheduling. The polling process may be the "periodic polling" described in the above embodiment, where the cycle of the polling process may be 100 milliseconds, or 500 milliseconds, or other cycles, which are not specifically limited in the embodiments of the present application.
示例性地,该第一报文可以为上述实施例中描述的以太报文,或者也可以为上述实施例中描述的CAN报文。示例性地,该第一报文可以为上述方法500中的第一报文。在一些可能的实现方式中,该第一报文也可以为上述方法700中的第二报文。或者,该第一报文也可以为其他报文,本申请实施例对此不作具体限定。For example, the first message may be the Ethernet message described in the above embodiment, or it may also be the CAN message described in the above embodiment. For example, the first message may be the first message in the above method 500. In some possible implementations, the first message may also be the second message in the above method 700. Alternatively, the first message may also be another message, which is not specifically limited in the embodiment of the present application.
示例性地,确定第一报文的第一处理策略的方法可以参考上述实施例中的描述,在此不再赘述。For example, the method of determining the first processing policy for the first packet may refer to the description in the above embodiment, and will not be described again here.
S1020,根据该第一处理策略对该第一报文进行处理,其中,该实时处理为该第一报文的优先级满足第一条件时进行的处理,该轮询处理为该第一报文的优先级满足第二条件时进行的处理。S1020, process the first message according to the first processing policy, where the real-time processing is performed when the priority of the first message meets the first condition, and the polling process is performed on the first message. Processed when the priority meets the second condition.
示例性地,上述第一条件包括第一报文的优先级高于预设阈值,例如,第一报文的优先级如上文中描述的为高优先级或中优先级;上述第二条件包括第一报文的优先级低于或等于预设阈值,例如,第一报文的优先级如上文中描述的为低优先级。或者,第一条件可以包括第一报文承载的内容为车空指令等控制指令;第二条件可以包括第一报文承载的内容为音视频流等娱乐性内容。或者,该第一条件和第二条件也可以为与第一报文的内容相关联的其他条件,本申请实施例对此不作具体限定。Exemplarily, the above-mentioned first condition includes that the priority of the first message is higher than the preset threshold, for example, the priority of the first message is high priority or medium priority as described above; the above-mentioned second condition includes the The priority of a packet is lower than or equal to the preset threshold. For example, the priority of the first packet is low priority as described above. Alternatively, the first condition may include that the content carried by the first packet is a control instruction such as an empty vehicle command; the second condition may include that the content carried by the first packet is entertainment content such as audio and video streams. Alternatively, the first condition and the second condition may also be other conditions associated with the content of the first message, which are not specifically limited in this embodiment of the present application.
示例性地,根据第一处理策略对第一报文进行处理的方法可以参考上述实施例中的描述,在此不再赘述。For example, for a method of processing the first packet according to the first processing policy, reference may be made to the description in the above embodiment, which will not be described again here.
本申请实施例提供的一种报文处理的方法中,可以根据调度请求对优先级较高的报文进行实时处理,能够提高较高优先级的报文处理的实时性;在报文处理系统空闲时,对较低优先级的报文轮询处理,能够避免高频中断对报文处理系统性能产生的影响,有助于提升报文处理系统的性能。In a message processing method provided by the embodiment of the present application, higher priority messages can be processed in real time according to scheduling requests, which can improve the real-time performance of higher priority message processing; in the message processing system When idle, polling for lower-priority messages can avoid the impact of high-frequency interrupts on the performance of the message processing system and help improve the performance of the message processing system.
在本申请的各个实施例中,如果没有特殊说明以及逻辑冲突,各个实施例之间的术语和/或描述具有一致性、且可以相互引用,不同的实施例中的技术特征根据其内在的逻辑关系可以组合形成新的实施例。In the various embodiments of this application, if there is no special explanation or logical conflict, the terms and/or descriptions between the various embodiments are consistent and can be referenced to each other. The technical features in different embodiments are based on their inherent logic. Relationships can be combined to form new embodiments.
上文中结合图5至图10详细说明了本申请实施例提供的方法。下面将结合图11和图12详细说明本申请实施例提供的装置。应理解,装置实施例的描述与方法实施例的描述相互对应,因此,未详细描述的内容可以参见上文方法实施例,为了简洁,这里不再赘述。The method provided by the embodiment of the present application is described in detail above with reference to FIGS. 5 to 10 . The device provided by the embodiment of the present application will be described in detail below with reference to Figures 11 and 12. It should be understood that the description of the device embodiments corresponds to the description of the method embodiments. Therefore, for content that is not described in detail, please refer to the above method embodiments. For the sake of brevity, they will not be described again here.
图11示出了本申请实施例提供的一种报文处理的装置2000的示意性框图,该装置2000包括第一处理单元2010和第二处理单元2020。第一处理单元2010和第二处理单元2020用于进行数据处理。在一些可能的实现方式中,该装置2000还包括收发单元2030,该收发单元2030可以实现相应的通信功能。Figure 11 shows a schematic block diagram of a packet processing device 2000 provided by an embodiment of the present application. The device 2000 includes a first processing unit 2010 and a second processing unit 2020. The first processing unit 2010 and the second processing unit 2020 are used for data processing. In some possible implementations, the device 2000 also includes a transceiver unit 2030, which can implement corresponding communication functions.
可选地,该装置2000还可以包括存储单元,该存储单元可以用于存储指令和/或数据,处理单元2020可以读取存储单元中的指令和/或数据,以使得装置实现前述方法实施例。Optionally, the device 2000 may also include a storage unit, which may be used to store instructions and/or data, and the processing unit 2020 may read the instructions and/or data in the storage unit, so that the device implements the foregoing method embodiments. .
该装置2000可以包括用于执行图5、图7、图9、图10中的方法的单元。并且,该装置2000中的各单元和上述其他操作和/或功能分别为了实现图5、图7、图9、图10的方法实施例的相应流程。The apparatus 2000 may include units for performing the methods in FIG. 5, FIG. 7, FIG. 9, and FIG. 10. Moreover, each unit in the device 2000 and the above-mentioned other operations and/or functions are respectively intended to implement the corresponding processes of the method embodiments in FIG. 5, FIG. 7, FIG. 9, and FIG. 10.
其中,当该装置2000用于执行图9中的方法900时,第一处理单元2010可用于执行方法900中的S901,第二处理单元2020可用于执行方法900中的S902。When the device 2000 is used to execute the method 900 in Figure 9, the first processing unit 2010 can be used to execute S901 in the method 900, and the second processing unit 2020 can be used to execute S902 in the method 900.
具体地,该装置2000包括:第一处理单元2010和第二处理单元2020,其中,该第一处理单元2010用于确定第一报文的优先级;该第二处理单元2020用于,在该第一报文的优先级满足第一条件时,生成调度请求,该调度请求用于请求对该第一报文进行实时处理;在该第一报文的优先级满足第二条件时,等待对该第一报文的轮询处理。Specifically, the device 2000 includes: a first processing unit 2010 and a second processing unit 2020, where the first processing unit 2010 is used to determine the priority of the first message; the second processing unit 2020 is used to, in the When the priority of the first message meets the first condition, a scheduling request is generated, and the scheduling request is used to request real-time processing of the first message; when the priority of the first message meets the second condition, wait for the Polling processing of the first message.
在一些可能的实现方式中,第一处理单元2010和第二处理单元2020可以为同一处理单元。例如,可以为上述实施例中描述的MAC收发模块110,或者也可以为CAN收发模块130。更具体地,第一处理单元2010和第二处理单元2020可以为报文接收控制模块111。In some possible implementations, the first processing unit 2010 and the second processing unit 2020 may be the same processing unit. For example, it may be the MAC transceiver module 110 described in the above embodiment, or it may also be the CAN transceiver module 130. More specifically, the first processing unit 2010 and the second processing unit 2020 may be the message reception control module 111.
在一些可能的实现方式中,该第一条件包括该第一报文的优先级高于预设阈值,该第二条件包括该第一报文的优先级低于或等于该预设阈值。In some possible implementations, the first condition includes that the priority of the first packet is higher than a preset threshold, and the second condition includes that the priority of the first packet is lower than or equal to the preset threshold.
在一些可能的实现方式中,该第二处理单元2020还用于:在该第一报文的优先级满足该第一条件时,根据该第一报文的优先级确定该第一报文的调度优先级,该调度优先级用于指示该实时处理的优先级;根据该第一报文的调度优先级生成该调度请求。In some possible implementations, the second processing unit 2020 is also configured to: when the priority of the first message meets the first condition, determine the priority of the first message according to the priority of the first message. Scheduling priority, the scheduling priority is used to indicate the priority of the real-time processing; the scheduling request is generated according to the scheduling priority of the first message.
在一些可能的实现方式中,该装置2000还包括:第三处理单元,用于在确定该第一报文的优先级之后,根据该第一报文的优先级和报文缓存区已用空间,缓存该第一报文,该报文缓存区已用空间用于表征缓存报文区域的已用空间。In some possible implementations, the device 2000 further includes: a third processing unit, configured to, after determining the priority of the first message, process the first message according to the priority of the first message and the used space in the message cache. , cache the first message, and the used space of the message cache area is used to represent the used space of the cached message area.
示例性地,该第三处理单元可以为上述实施例中描述的接收队列缓存模块112。For example, the third processing unit may be the receive queue buffer module 112 described in the above embodiment.
在具体实现过程中,第一处理单元2010、第二处理单元2020和第三处理单元可以为统一处理单元,如MAC收发模块110,或者CAN收发模块130。In a specific implementation process, the first processing unit 2010, the second processing unit 2020 and the third processing unit may be unified processing units, such as the MAC transceiver module 110 or the CAN transceiver module 130.
在一些可能的实现方式中,该第三处理单元还用于:在该第一报文的优先级高于第一阈值,和/或报文缓存区已用空间小于第二阈值时,缓存该第一报文。In some possible implementations, the third processing unit is also configured to: cache the first message when the priority of the first message is higher than a first threshold, and/or the used space in the message buffer is less than a second threshold. First message.
在一些可能的实现方式中,该第三处理单元还用于:在缓存该第一报文之前,在该报文缓存区已用空间大于第三阈值时,删除一个或多个第二报文,该第二报文的优先级小于该第一报文的优先级。In some possible implementations, the third processing unit is also configured to: before caching the first message, delete one or more second messages when the used space in the message buffer is greater than a third threshold. , the priority of the second message is smaller than the priority of the first message.
在一些可能的实现方式中,该第一处理单元2010还用于:确定第三报文的优先级;该第三处理单元还用于:在该第三报文的优先级低于或等于该第一阈值,且报文缓存区已用空间大于或等于该第二阈值时,丢弃该第三报文。In some possible implementations, the first processing unit 2010 is also used to: determine the priority of the third message; the third processing unit is also used to: when the priority of the third message is lower than or equal to the When the first threshold is reached and the used space in the message buffer is greater than or equal to the second threshold, the third message is discarded.
在一些可能的实现方式中,当该装置2000用于执行图10中的方法1000时,第一处理单元2010可用于执行方法1000中的S1010,第二处理单元2020可用于执行方法1000中的S1020。In some possible implementations, when the device 2000 is used to perform the method 1000 in Figure 10, the first processing unit 2010 can be used to perform S1010 in the method 1000, and the second processing unit 2020 can be used to perform S1020 in the method 1000. .
具体地,该装置2000包括:第一处理单元2010和第二处理单元2020,其中,该第一处理单元2010用于确定对第一报文的第一处理策略,该第一处理策略为实时处理和轮询处理中的一项;该第二处理单元2020用于根据该第一处理策略对该第一报文进行处理,其中,该实时处理为该第一报文的优先级满足第一条件时进行的处理,该轮询处理为该第一报文的优先级满足第二条件时进行的处理。Specifically, the device 2000 includes: a first processing unit 2010 and a second processing unit 2020, where the first processing unit 2010 is used to determine a first processing strategy for the first message, and the first processing strategy is real-time processing and one of the polling processes; the second processing unit 2020 is configured to process the first message according to the first processing strategy, wherein the real-time processing is that the priority of the first message satisfies the first condition. The polling processing is performed when the priority of the first message meets the second condition.
在一些可能的实现方式中,装置2000还包括收发单元2030,该收发单元2030用于接收第一报文。In some possible implementations, the device 2000 further includes a transceiver unit 2030, which is configured to receive the first message.
在一些可能的实现方式中,第一处理单元2010可以为上述实施例中描述的系统调度控制模块150,第二处理单元2020可以为TCP/IP协议栈模块120,或者也可以为CAN及上次协议栈模块140。In some possible implementations, the first processing unit 2010 may be the system scheduling control module 150 described in the above embodiment, and the second processing unit 2020 may be the TCP/IP protocol stack module 120, or it may be CAN and the last Protocol stack module 140.
在一些可能的实现方式中,第一处理单元2010和第二处理单元2020也可以为同一处理单元。In some possible implementations, the first processing unit 2010 and the second processing unit 2020 may also be the same processing unit.
在一些可能的实现方式中,该装置2000还包括:收发单元2030,用于接收调度请求,该调度请求用于请求对该第一报文进行实时处理;该第一处理单元2010还用于:根据该调度请求确定对该第一报文的该第一处理策略为该实时处理。In some possible implementations, the device 2000 further includes: a transceiver unit 2030, configured to receive a scheduling request, where the scheduling request is used to request real-time processing of the first message; the first processing unit 2010 is also configured to: The first processing strategy for the first message is determined to be real-time processing according to the scheduling request.
示例性地,该收发单元2030可以包含于系统调度控制模块150。For example, the transceiver unit 2030 may be included in the system scheduling control module 150.
在一些可能的实现方式中,该第二处理单元2020还用于:在对该第一报文进行该实时处理之前,中断对第四报文进行的轮询处理;在对该第一报文进行该实时处理之后,继续对该第四报文进行轮询处理,其中,该第四报文的优先级低于该第一报文的优先级。In some possible implementations, the second processing unit 2020 is also configured to: before performing the real-time processing on the first message, interrupt the polling processing on the fourth message; After the real-time processing is performed, polling processing is continued on the fourth message, where the priority of the fourth message is lower than the priority of the first message.
在一些可能的实现方式中,对该第一报文进行该实时处理的过程中包括第一时刻,该第一时刻为轮询处理开始的时刻,该第二处理单元2020还用于:控制该第一时刻延后至第二时刻,该第二时刻为对该第一报文进行该实时处理之后的时刻,且该第二时刻为轮询处理开始的时刻。In some possible implementations, the real-time processing of the first message includes a first moment, which is the moment when polling processing starts, and the second processing unit 2020 is also used to: control the The first time is delayed to a second time, the second time is the time after the real-time processing of the first message is performed, and the second time is the time when the polling process starts.
应理解,以上装置中各单元的划分仅是一种逻辑功能的划分,实际实现时可以全部或部分集成到一个物理实体上,也可以物理上分开。此外,装置中的单元可以以处理器调用软件的形式实现;例如装置包括处理器,处理器与存储器连接,存储器中存储有指令,处理器调用存储器中存储的指令,以实现以上任一种方法或实现该装置各单元的功能,其中处理器例如为通用处理器,例如CPU或微处理器,存储器为装置内的存储器或装置外的 存储器。或者,装置中的单元可以以硬件电路的形式实现,可以通过对硬件电路的设计实现部分或全部单元的功能,该硬件电路可以理解为一个或多个处理器;例如,在一种实现中,该硬件电路为ASIC,通过对电路内元件逻辑关系的设计,实现以上部分或全部单元的功能;再如,在另一种实现中,该硬件电路为可以通过PLD实现,以FPGA为例,其可以包括大量逻辑门电路,通过配置文件来配置逻辑门电路之间的连接关系,从而实现以上部分或全部单元的功能。以上装置的所有单元可以全部通过处理器调用软件的形式实现,或全部通过硬件电路的形式实现,或部分通过处理器调用软件的形式实现,剩余部分通过硬件电路的形式实现。It should be understood that the division of each unit in the above device is only a division of logical functions. In actual implementation, the units may be fully or partially integrated into a physical entity, or may be physically separated. In addition, the unit in the device can be implemented in the form of a processor calling software; for example, the device includes a processor, the processor is connected to a memory, instructions are stored in the memory, and the processor calls the instructions stored in the memory to implement any of the above methods. Or realize the functions of each unit of the device, where the processor is, for example, a general-purpose processor, such as a CPU or a microprocessor, and the memory is a memory within the device or a memory outside the device. Alternatively, the units in the device can be implemented in the form of hardware circuits, and some or all of the functions of the units can be implemented through the design of the hardware circuits, which can be understood as one or more processors; for example, in one implementation, The hardware circuit is an ASIC, which realizes the functions of some or all of the above units through the design of the logical relationship of the components in the circuit; for another example, in another implementation, the hardware circuit can be implemented through PLD, taking FPGA as an example. It can include a large number of logic gate circuits, and the connection relationships between the logic gate circuits can be configured through configuration files to realize the functions of some or all of the above units. All units of the above device may be fully realized by the processor calling software, or may be fully realized by hardware circuits, or part of the units may be realized by the processor calling software, and the remaining part may be realized by hardware circuits.
在本申请实施例中,处理器是一种具有信号的处理能力的电路,在一种实现中,处理器可以是具有指令读取与运行能力的电路,例如CPU、微处理器、GPU、或DSP等;在另一种实现中,处理器可以通过硬件电路的逻辑关系实现一定功能,该硬件电路的逻辑关系是固定的或可以重构的,例如处理器为ASIC或PLD实现的硬件电路,例如FPGA。在可重构的硬件电路中,处理器加载配置文档,实现硬件电路配置的过程,可以理解为处理器加载指令,以实现以上部分或全部单元的功能的过程。此外,还可以是针对人工智能设计的硬件电路,其可以理解为一种ASIC,例如NPU、TPU、DPU等。In the embodiment of the present application, the processor is a circuit with signal processing capabilities. In one implementation, the processor may be a circuit with instruction reading and execution capabilities, such as a CPU, a microprocessor, a GPU, or DSP, etc.; in another implementation, the processor can realize certain functions through the logical relationship of the hardware circuit. The logical relationship of the hardware circuit is fixed or can be reconstructed. For example, the processor is a hardware circuit implemented by ASIC or PLD. For example, FPGA. In a reconfigurable hardware circuit, the process of the processor loading the configuration file and realizing the hardware circuit configuration can be understood as the process of the processor loading instructions to realize the functions of some or all of the above units. In addition, it can also be a hardware circuit designed for artificial intelligence, which can be understood as an ASIC, such as NPU, TPU, DPU, etc.
可见,以上装置中的各单元可以是被配置成实施以上方法的一个或多个处理器(或处理电路),例如:CPU、GPU、NPU、TPU、DPU、微处理器、DSP、ASIC、FPGA,或这些处理器形式中至少两种的组合。It can be seen that each unit in the above device can be one or more processors (or processing circuits) configured to implement the above method, such as: CPU, GPU, NPU, TPU, DPU, microprocessor, DSP, ASIC, FPGA , or a combination of at least two of these processor forms.
此外,以上装置中的各单元可以全部或部分可以集成在一起,或者可以独立实现。在一种实现中,这些单元集成在一起,以片上系统(system-on-a-chip,SOC)的形式实现。该SOC中可以包括至少一个处理器,用于实现以上任一种方法或实现该装置各单元的功能,该至少一个处理器的种类可以不同,例如包括CPU和FPGA,CPU和人工智能处理器,CPU和GPU等。In addition, each unit in the above device may be integrated together in whole or in part, or may be implemented independently. In one implementation, these units are integrated together and implemented as a system-on-a-chip (SOC). The SOC may include at least one processor for implementing any of the above methods or implementing the functions of each unit of the device. The at least one processor may be of different types, such as a CPU and an FPGA, or a CPU and an artificial intelligence processor. CPU and GPU etc.
图12是本申请实施例的一种报文处理的装置的示意性框图。图12所示的报文处理的装置2100可以包括:处理器2110、收发器2120以及存储器2130。其中,处理器2110、收发器2120以及存储器2130通过内部连接通路相连,该存储器2130用于存储指令,该处理器2110用于执行该存储器2130存储的指令,以收发器2120接收/发送部分参数。可选地,存储器2130既可以和处理器2110通过接口耦合,也可以和处理器2110集成在一起。Figure 12 is a schematic block diagram of a packet processing device according to an embodiment of the present application. The packet processing device 2100 shown in FIG. 12 may include: a processor 2110, a transceiver 2120, and a memory 2130. Among them, the processor 2110, the transceiver 2120 and the memory 2130 are connected through an internal connection path. The memory 2130 is used to store instructions. The processor 2110 is used to execute the instructions stored in the memory 2130, and the transceiver 2120 receives/sends some parameters. Optionally, the memory 2130 can be coupled with the processor 2110 through an interface or integrated with the processor 2110 .
需要说明的是,上述收发器2120可以包括但不限于输入/输出接口(input/output interface)一类的收发装置,来实现装置2100与其他设备或通信网络之间的通信。It should be noted that the above-mentioned transceiver 2120 may include but is not limited to a transceiver device such as an input/output interface to realize communication between the device 2100 and other devices or communication networks.
在实现过程中,上述方法的各步骤可以通过处理器2110中的硬件的集成逻辑电路或者软件形式的指令完成。结合本申请实施例所公开的方法可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器2130,处理器2110读取存储器2130中的信息,结合其硬件完成上述方法的步骤。为避免重复,这里不再详细描述。During the implementation process, each step of the above method can be completed by instructions in the form of hardware integrated logic circuits or software in the processor 2110 . The method disclosed in conjunction with the embodiments of the present application can be directly implemented by a hardware processor for execution, or can be executed by a combination of hardware and software modules in the processor. The software module can be located in random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers and other mature storage media in this field. The storage medium is located in the memory 2130. The processor 2110 reads the information in the memory 2130 and completes the steps of the above method in combination with its hardware. To avoid repetition, it will not be described in detail here.
处理器2110可以采用通用的CPU,微处理器,ASIC,GPU或者一个或多个集成电路,用于执行相关程序,以实现本申请方法实施例的处理报文的方法。处理器2110还可 以是一种集成电路芯片,具有信号的处理能力。在具体实现过程中,本申请的处理报文的方法的各个步骤可以通过处理器2110中的硬件的集成逻辑电路或者软件形式的指令完成。上述处理器2110还可以是通用处理器、DSP、ASIC、FPGA或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器2130,处理器2110读取存储器2130中的信息,结合其硬件执行本申请方法实施例的处理报文的方法。The processor 2110 can use a general-purpose CPU, microprocessor, ASIC, GPU or one or more integrated circuits to execute relevant programs to implement the message processing method of the method embodiment of the present application. The processor 2110 can also be an integrated circuit chip with signal processing capabilities. In a specific implementation process, each step of the message processing method of the present application can be completed by instructions in the form of hardware integrated logic circuits or software in the processor 2110 . The above-mentioned processor 2110 can also be a general-purpose processor, DSP, ASIC, FPGA or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component. Each method, step and logical block diagram disclosed in the embodiment of this application can be implemented or executed. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present application can be directly implemented by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software module can be located in random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers and other mature storage media in this field. The storage medium is located in the memory 2130. The processor 2110 reads the information in the memory 2130 and executes the message processing method of the method embodiment of the present application in conjunction with its hardware.
存储器2130可以是只读存储器(read only memory,ROM),静态存储设备,动态存储设备或者随机存取存储器(random access memory,RAM)。The memory 2130 may be a read-only memory (ROM), a static storage device, a dynamic storage device or a random access memory (RAM).
收发器2120使用例如但不限于收发器一类的收发装置,来实现装置2100与其他设备或通信网络之间的通信。例如,可以通过收发器2120接收第一报文。The transceiver 2120 uses a transceiver device such as but not limited to a transceiver to implement communication between the device 2100 and other devices or communication networks. For example, the first message may be received through the transceiver 2120.
本申请实施例还提供一种车辆,该车辆可以包括上述装置2000,或者上述装置2100。An embodiment of the present application also provides a vehicle, which may include the above device 2000 or the above device 2100.
本申请实施例还提供了一种计算机程序产品,该计算机程序产品包括:计算机程序代码,当该计算机程序代码在计算机上运行时,使得计算机执行上述方法。Embodiments of the present application also provide a computer program product. The computer program product includes: computer program code. When the computer program code is run on a computer, it causes the computer to execute the above method.
本申请实施例还提供一种计算机可读存储介质,该计算机可读介质存储有程序代码,当该计算机程序代码在计算机上运行时,使得该计算机执行上述图5、图7、图9、图10中的任一种方法。Embodiments of the present application also provide a computer-readable storage medium. The computer-readable medium stores program code. When the computer program code is run on a computer, it causes the computer to execute the above-mentioned Figures 5, 7, 9 and 9. Any of the 10 methods.
本申请实施例还提供一种芯片,包括:至少一个处理器和存储器,该至少一个处理器与该存储器耦合,用于读取并执行该存储器中的指令,以执行上述图5、图7、图9、图10中的任一种方法。An embodiment of the present application also provides a chip, including: at least one processor and a memory. The at least one processor is coupled to the memory and used to read and execute instructions in the memory to execute the above-mentioned Figures 5, 7, Either method in Figure 9 or Figure 10.
本申请将围绕包括多个设备、组件、模块等的系统来呈现各个方面、实施例或特征。应当理解和明白的是,各个系统可以包括另外的设备、组件、模块等,并且/或者可以并不包括结合附图讨论的所有设备、组件、模块等。此外,还可以使用这些方案的组合。Various aspects, embodiments, or features of this application will be presented in terms of systems including multiple devices, components, modules, etc. It should be understood and appreciated that various systems may include additional devices, components, modules, etc., and/or may not include all devices, components, modules, etc. discussed in connection with the figures. Additionally, a combination of these scenarios can be used.
另外,在本申请实施例中,“示例的”、“例如”等词用于表示作例子、例证或说明。本申请中被描述为“示例”的任何实施例或设计方案不应被解释为比其它实施例或设计方案更优选或更具优势。确切而言,使用示例的一词旨在以具体方式呈现概念。In addition, in the embodiments of this application, words such as "exemplary" and "for example" are used to represent examples, illustrations or explanations. Any embodiment or design described herein as "example" is not intended to be construed as preferred or advantageous over other embodiments or designs. Rather, the use of the word example is intended to present a concept in a concrete way.
本申请实施例中,“相应的(corresponding,relevant)”和“对应的(corresponding)”有时可以混用,应当指出的是,在不强调其区别时,其所要表达的含义是一致的。In the embodiments of this application, "corresponding (relevant)" and "corresponding (corresponding)" can sometimes be used interchangeably. It should be noted that when the difference is not emphasized, their intended meanings are consistent.
本申请实施例描述的网络架构以及业务场景是为了更加清楚地说明本申请实施例的技术方案,并不构成对于本申请实施例提供的技术方案的限定,本领域普通技术人员可知,随着网络架构的演变和新业务场景的出现,本申请实施例提供的技术方案对于类似的技术问题,同样适用。The network architecture and business scenarios described in the embodiments of this application are to more clearly explain the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. Those of ordinary skill in the art will know that with the network With the evolution of architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
在本说明书中描述的参考“一个实施例”或“一些实施例”等意味着在本申请的一个或多个实施例中包括结合该实施例描述的特定特征、结构或特点。由此,在本说明书中的不同之处出现的语句“在一个实施例中”、“在一些实施例中”、“在其他一些实施例中”、“在另外一些实施例中”等不是必然都参考相同的实施例,而是意味着“一个或多个但不是所有的 实施例”,除非是以其他方式另外特别强调。术语“包括”、“包含”、“具有”及它们的变形都意味着“包括但不限于”,除非是以其他方式另外特别强调。Reference in this specification to "one embodiment" or "some embodiments" or the like means that a particular feature, structure or characteristic described in connection with the embodiment is included in one or more embodiments of the application. Therefore, the phrases "in one embodiment", "in some embodiments", "in other embodiments", "in other embodiments", etc. appearing in different places in this specification are not necessarily References are made to the same embodiment, but rather to "one or more but not all embodiments" unless specifically stated otherwise. The terms “including,” “includes,” “having,” and variations thereof all mean “including but not limited to,” unless otherwise specifically emphasized.
本申请中,“至少一个”是指一个或者多个,“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:包括单独存在A,同时存在A和B,以及单独存在B的情况,其中A,B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。“以下至少一项(个)”或其类似表达,是指的这些项中的任意组合,包括单项(个)或复数项(个)的任意组合。例如,a,b,或c中的至少一项(个),可以表示:a,b,c,a-b,a-c,b-c,或a-b-c,其中a,b,c可以是单个,也可以是多个。In this application, "at least one" refers to one or more, and "plurality" refers to two or more. "And/or" describes the association of associated objects, indicating that there can be three relationships, for example, A and/or B, which can mean: including the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The character "/" generally indicates that the related objects are in an "or" relationship. "At least one of the following" or similar expressions thereof refers to any combination of these items, including any combination of a single item (items) or a plurality of items (items). For example, at least one of a, b, or c can mean: a, b, c, a-b, a-c, b-c, or a-b-c, where a, b, c can be single or multiple .
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each specific application, but such implementations should not be considered beyond the scope of this application.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, devices and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be described again here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or can be integrated into another system, or some features can be ignored, or not implemented. On the other hand, the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or they may be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, each functional unit in each embodiment of the present application can be integrated into one processing unit, each unit can exist physically alone, or two or more units can be integrated into one unit.
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can essentially be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions to enable a computer device (which can be a personal computer, a server, or network equipment, etc.) to perform all or part of the steps of the methods described in various embodiments of this application. The aforementioned storage media include: U disk, mobile hard disk, ROM, RAM, magnetic disk or optical disk and other media that can store program codes.
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above are only specific embodiments of the present application, but the protection scope of the present application is not limited thereto. Any person familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application. should be covered by the protection scope of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.

Claims (27)

  1. 一种报文处理的方法,其特征在于,包括:A message processing method, characterized by including:
    确定第一报文的优先级;Determine the priority of the first message;
    在所述第一报文的优先级满足第一条件时,生成调度请求,所述调度请求用于请求对所述第一报文进行实时处理;When the priority of the first message meets the first condition, a scheduling request is generated, and the scheduling request is used to request real-time processing of the first message;
    在所述第一报文的优先级满足第二条件时,等待对所述第一报文的轮询处理。When the priority of the first message satisfies the second condition, wait for polling processing of the first message.
  2. 根据权利要求1所述的方法,其特征在于,所述第一条件包括所述第一报文的优先级高于预设阈值,所述第二条件包括所述第一报文的优先级低于或等于所述预设阈值。The method of claim 1, wherein the first condition includes that the priority of the first message is higher than a preset threshold, and the second condition includes that the priority of the first message is low. is at or equal to the preset threshold.
  3. 根据权利要求1或2所述的方法,其特征在于,在所述第一报文的优先级满足所述第一条件时,所述方法还包括:The method according to claim 1 or 2, characterized in that when the priority of the first message meets the first condition, the method further includes:
    根据所述第一报文的优先级确定所述第一报文的调度优先级,所述调度优先级用于指示所述实时处理的优先级;Determine the scheduling priority of the first message according to the priority of the first message, and the scheduling priority is used to indicate the priority of the real-time processing;
    所述生成调度请求,包括:The generated scheduling request includes:
    根据所述第一报文的调度优先级生成所述调度请求。The scheduling request is generated according to the scheduling priority of the first message.
  4. 根据权利要求1至3中任一项所述的方法,其特征在于,所述确定第一报文的优先级之后,所述方法还包括:The method according to any one of claims 1 to 3, characterized in that after determining the priority of the first message, the method further includes:
    根据所述第一报文的优先级和报文缓存区已用空间,缓存所述第一报文,所述报文缓存区已用空间用于表征缓存报文区域的已用空间。The first message is cached according to the priority of the first message and the used space of the message cache area, and the used space of the message cache area is used to represent the used space of the cached message area.
  5. 根据权利要求4所述的方法,其特征在于,所述根据所述第一报文的优先级和报文缓存区已用空间,缓存所述第一报文,包括:The method according to claim 4, characterized in that caching the first message according to the priority of the first message and the used space in the message cache area includes:
    在所述第一报文的优先级高于第一阈值,和/或报文缓存区已用空间小于第二阈值时,缓存所述第一报文。When the priority of the first message is higher than the first threshold, and/or the used space of the message buffer is less than the second threshold, the first message is cached.
  6. 根据权利要求5所述的方法,其特征在于,在缓存所述第一报文之前,所述方法还包括:The method according to claim 5, characterized in that before caching the first message, the method further includes:
    在所述报文缓存区已用空间大于第三阈值时,删除一个或多个第二报文,所述第二报文的优先级小于所述第一报文的优先级。When the used space of the message cache area is greater than the third threshold, one or more second messages are deleted, and the priority of the second message is lower than the priority of the first message.
  7. 根据权利要求4至6中任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 4 to 6, characterized in that the method further includes:
    确定第三报文的优先级;Determine the priority of the third message;
    在所述第三报文的优先级低于或等于所述第一阈值,且报文缓存区已用空间大于或等于所述第二阈值时,丢弃所述第三报文。When the priority of the third message is lower than or equal to the first threshold and the used space of the message buffer is greater than or equal to the second threshold, the third message is discarded.
  8. 一种报文处理的方法,其特征在于,包括:A message processing method, characterized by including:
    确定对第一报文的第一处理策略,所述第一处理策略包含于实时处理和轮询处理;Determine a first processing strategy for the first message, the first processing strategy being included in real-time processing and polling processing;
    根据所述第一处理策略对所述第一报文进行处理,其中,所述实时处理为所述第一报文的优先级满足第一条件时进行的处理,所述轮询处理为所述第一报文的优先级满足第二条件时进行的处理。The first message is processed according to the first processing strategy, wherein the real-time processing is the processing performed when the priority of the first message meets the first condition, and the polling processing is the Processing performed when the priority of the first packet meets the second condition.
  9. 根据权利要求8所述的方法,其特征在于,所述方法还包括:The method of claim 8, further comprising:
    接收调度请求,所述调度请求用于请求对所述第一报文进行实时处理;Receive a scheduling request, where the scheduling request is used to request real-time processing of the first message;
    所述确定对第一报文的第一处理策略,包括:Determining the first processing strategy for the first packet includes:
    根据所述调度请求确定对所述第一报文的所述第一处理策略为所述实时处理。The first processing strategy for the first packet is determined to be the real-time processing according to the scheduling request.
  10. 根据权利要求9所述的方法,其特征在于,所述方法还包括:The method of claim 9, further comprising:
    在对所述第一报文进行所述实时处理之前,中断对第四报文进行的轮询处理;Before performing the real-time processing on the first message, interrupt the polling processing on the fourth message;
    在对所述第一报文进行所述实时处理之后,继续对所述第四报文进行轮询处理,其中,所述第四报文的优先级低于所述第一报文的优先级。After performing the real-time processing on the first message, continue to perform polling processing on the fourth message, wherein the priority of the fourth message is lower than the priority of the first message. .
  11. 根据权利要求9或10所述的方法,其特征在于,对所述第一报文进行所述实时处理的过程中包括第一时刻,所述第一时刻为轮询处理开始的时刻,所述方法还包括:The method according to claim 9 or 10, characterized in that the real-time processing of the first message includes a first moment, and the first moment is the moment when polling processing starts, and the Methods also include:
    控制所述第一时刻延后至第二时刻,所述第二时刻为对所述第一报文进行所述实时处理之后的时刻,且所述第二时刻为轮询处理开始的时刻。The first time is controlled to be delayed to a second time, the second time is the time after the real-time processing of the first message is performed, and the second time is the time when polling processing starts.
  12. 一种报文处理的装置,其特征在于,包括第一处理单元和第二处理单元,其中,所述第一处理单元用于确定第一报文的优先级;A message processing device, characterized by comprising a first processing unit and a second processing unit, wherein the first processing unit is used to determine the priority of the first message;
    所述第二处理单元用于,在所述第一报文的优先级满足第一条件时,生成调度请求,所述调度请求用于请求对所述第一报文进行实时处理;在所述第一报文的优先级满足第二条件时,等待对所述第一报文的轮询处理。The second processing unit is configured to generate a scheduling request when the priority of the first message meets the first condition, and the scheduling request is used to request real-time processing of the first message; in the When the priority of the first message meets the second condition, polling processing of the first message is waited for.
  13. 根据权利要求12所述的装置,其特征在于,所述第一条件包括所述第一报文的优先级高于预设阈值,所述第二条件包括所述第一报文的优先级低于或等于所述预设阈值。The device according to claim 12, wherein the first condition includes that the priority of the first message is higher than a preset threshold, and the second condition includes that the priority of the first message is low. is at or equal to the preset threshold.
  14. 根据权利要求12或13所述的装置,其特征在于,所述第二处理单元还用于:The device according to claim 12 or 13, characterized in that the second processing unit is also used for:
    在所述第一报文的优先级满足所述第一条件时,根据所述第一报文的优先级确定所述第一报文的调度优先级,所述调度优先级用于指示所述实时处理的优先级;When the priority of the first message meets the first condition, the scheduling priority of the first message is determined according to the priority of the first message, and the scheduling priority is used to indicate the real-time processing priorities;
    根据所述第一报文的调度优先级生成所述调度请求。The scheduling request is generated according to the scheduling priority of the first message.
  15. 根据权利要求12至14中任一项所述的装置,其特征在于,所述装置还包括:The device according to any one of claims 12 to 14, characterized in that the device further includes:
    第三处理单元,用于在确定所述第一报文的优先级之后,根据所述第一报文的优先级和报文缓存区已用空间,缓存所述第一报文,所述报文缓存区已用空间用于表征缓存报文区域的已用空间。The third processing unit is configured to cache the first message according to the priority of the first message and the used space in the message buffer area after determining the priority of the first message. The used space of the message cache area is used to represent the used space of the cached message area.
  16. 根据权利要求15所述的装置,其特征在于,所述第三处理单元还用于:The device according to claim 15, characterized in that the third processing unit is also used for:
    在所述第一报文的优先级高于第一阈值,和/或报文缓存区已用空间小于第二阈值时,缓存所述第一报文。When the priority of the first message is higher than the first threshold, and/or the used space of the message buffer is less than the second threshold, the first message is cached.
  17. 根据权利要求16所述的装置,其特征在于,所述第三处理单元还用于:The device according to claim 16, characterized in that the third processing unit is also used for:
    在缓存所述第一报文之前,在所述报文缓存区已用空间大于第三阈值时,删除一个或多个第二报文,所述第二报文的优先级小于所述第一报文的优先级。Before caching the first message, when the used space in the message cache area is greater than the third threshold, delete one or more second messages, and the priority of the second message is smaller than the first message. The priority of the message.
  18. 根据权利要求15至17中任一项所述的装置,其特征在于,所述第一处理单元还用于:确定第三报文的优先级;The device according to any one of claims 15 to 17, characterized in that the first processing unit is also used to: determine the priority of the third message;
    所述第三处理单元还用于:在所述第三报文的优先级低于或等于所述第一阈值,且报文缓存区已用空间大于或等于所述第二阈值时,丢弃所述第三报文。The third processing unit is also configured to: when the priority of the third message is lower than or equal to the first threshold and the used space of the message cache is greater than or equal to the second threshold, discard all the messages. Describe the third message.
  19. 一种报文处理的装置,其特征在于,包括第一处理单元和第二处理单元,其中,所述第一处理单元用于确定对第一报文的第一处理策略,所述第一处理策略为实时处理和轮询处理中的一项;A message processing device, characterized in that it includes a first processing unit and a second processing unit, wherein the first processing unit is used to determine a first processing strategy for the first message, and the first processing unit The strategy is one of real-time processing and polling processing;
    所述第二处理单元用于根据所述第一处理策略对所述第一报文进行处理,The second processing unit is configured to process the first message according to the first processing strategy,
    其中,所述实时处理为所述第一报文的优先级满足第一条件时进行的处理,所述轮询处理为所述第一报文的优先级满足第二条件时进行的处理。Wherein, the real-time processing is the processing performed when the priority of the first message satisfies the first condition, and the polling processing is the processing performed when the priority of the first message satisfies the second condition.
  20. 根据权利要求19所述的装置,其特征在于,所述装置还包括:The device of claim 19, further comprising:
    收发单元,用于接收调度请求,所述调度请求用于请求对所述第一报文进行实时处理;A transceiver unit, configured to receive a scheduling request, where the scheduling request is used to request real-time processing of the first message;
    所述第一处理单元还用于:根据所述调度请求确定对所述第一报文的所述第一处理策略为所述实时处理。The first processing unit is further configured to determine, according to the scheduling request, that the first processing strategy for the first message is the real-time processing.
  21. 根据权利要求20所述的装置,其特征在于,所述第二处理单元还用于:The device according to claim 20, characterized in that the second processing unit is also used for:
    在对所述第一报文进行所述实时处理之前,中断对第四报文进行的轮询处理;Before performing the real-time processing on the first message, interrupt the polling processing on the fourth message;
    在对所述第一报文进行所述实时处理之后,继续对所述第四报文进行轮询处理,其中,所述第四报文的优先级低于所述第一报文的优先级。After performing the real-time processing on the first message, continue to perform polling processing on the fourth message, wherein the priority of the fourth message is lower than the priority of the first message. .
  22. 根据权利要求20或21所述的装置,其特征在于,对所述第一报文进行所述实时处理的过程中包括第一时刻,所述第一时刻为轮询处理开始的时刻,所述第二处理单元还用于:The device according to claim 20 or 21, characterized in that the process of performing the real-time processing on the first message includes a first time, and the first time is the time when polling processing starts, and the The second processing unit is also used for:
    控制所述第一时刻延后至第二时刻,所述第二时刻为对所述第一报文进行所述实时处理之后的时刻,且所述第二时刻为轮询处理开始的时刻。The first time is controlled to be delayed to a second time, the second time is the time after the real-time processing of the first message is performed, and the second time is the time when polling processing starts.
  23. 一种报文处理的装置,其特征在于,包括:A message processing device, characterized by including:
    存储器,用于存储计算机程序;Memory, used to store computer programs;
    处理器,用于执行所述存储器中存储的计算机程序,以使得所述装置执行如权利要求1至11中任一项所述的方法。A processor, configured to execute a computer program stored in the memory, so that the device executes the method according to any one of claims 1 to 11.
  24. 一种报文处理的系统,其特征在于,包括如权利要求12至18中任一项所述的装置,和/或如权利要求19至22中任一项所述的装置。A message processing system, characterized by comprising the device according to any one of claims 12 to 18, and/or the device according to any one of claims 19 to 22.
  25. 一种车辆,其特征在于,包括如权利要求12至22中任一项所述的装置,或者,如权利要求23所述的装置,或者,如权利要求24所述的系统。A vehicle, characterized by comprising the device according to any one of claims 12 to 22, or the device according to claim 23, or the system according to claim 24.
  26. 一种计算机可读存储介质,其特征在于,其上存储有计算机程序,所述计算机程序被计算机执行时,以使得实现如权利要求1至11中任一项所述的方法。A computer-readable storage medium, characterized in that a computer program is stored thereon, and when the computer program is executed by a computer, the method according to any one of claims 1 to 11 is implemented.
  27. 一种芯片,其特征在于,所述芯片包括处理器与数据接口,所述处理器通过所述数据接口读取存储器上存储的指令,以执行如权利要求1至11中任一项所述的方法。A chip, characterized in that the chip includes a processor and a data interface, and the processor reads instructions stored in the memory through the data interface to execute the instructions as described in any one of claims 1 to 11 method.
PCT/CN2022/139226 2022-05-16 2022-12-15 Method and apparatus for processing messages WO2023221486A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210529722.0A CN117119056A (en) 2022-05-16 2022-05-16 Message processing method and device
CN202210529722.0 2022-05-16

Publications (1)

Publication Number Publication Date
WO2023221486A1 true WO2023221486A1 (en) 2023-11-23

Family

ID=88798905

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/139226 WO2023221486A1 (en) 2022-05-16 2022-12-15 Method and apparatus for processing messages

Country Status (2)

Country Link
CN (1) CN117119056A (en)
WO (1) WO2023221486A1 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101674242A (en) * 2009-10-13 2010-03-17 福建星网锐捷网络有限公司 Service message sending control method and device
CN104243349A (en) * 2013-06-21 2014-12-24 中兴通讯股份有限公司 Message scheduling method and device
CN104915254A (en) * 2014-12-31 2015-09-16 杰瑞石油天然气工程有限公司 Embedded system multi-task scheduling method and system
WO2020220954A1 (en) * 2019-04-28 2020-11-05 华为技术有限公司 Scheduling priority determination method and apparatus
CN113268446A (en) * 2021-04-07 2021-08-17 中国电子科技集团公司电子科学研究院 Information processing method and device for accessing various airborne buses

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101674242A (en) * 2009-10-13 2010-03-17 福建星网锐捷网络有限公司 Service message sending control method and device
CN104243349A (en) * 2013-06-21 2014-12-24 中兴通讯股份有限公司 Message scheduling method and device
CN104915254A (en) * 2014-12-31 2015-09-16 杰瑞石油天然气工程有限公司 Embedded system multi-task scheduling method and system
WO2020220954A1 (en) * 2019-04-28 2020-11-05 华为技术有限公司 Scheduling priority determination method and apparatus
CN113268446A (en) * 2021-04-07 2021-08-17 中国电子科技集团公司电子科学研究院 Information processing method and device for accessing various airborne buses

Also Published As

Publication number Publication date
CN117119056A (en) 2023-11-24

Similar Documents

Publication Publication Date Title
US8831025B2 (en) Parallel processing using multi-core processor
CN113711173A (en) System and method for facilitating data request management in a Network Interface Controller (NIC)
CN109697122B (en) Task processing method, device and computer storage medium
CN110647071B (en) Method, device and storage medium for controlling data transmission
EP4175232A1 (en) Congestion control method and device
CN112953967A (en) Network protocol unloading device and data transmission system
US8121129B2 (en) Optimizing throughput of data in a communications network
CN115349121A (en) Method and device for processing stateful service
CN112688846A (en) Routing method, device, equipment and storage medium of CAN message
CN113141321A (en) Data transmission method based on edge calculation and electronic equipment
US11343205B2 (en) Real-time, time aware, dynamic, context aware and reconfigurable ethernet packet classification
WO2023221486A1 (en) Method and apparatus for processing messages
WO2019109902A1 (en) Queue scheduling method and apparatus, communication device, and storage medium
CN113438169A (en) Data scheduling method, electronic equipment and storage medium
EP3872634A1 (en) Multicore system on chip architecture
CN108427894B (en) Data communication method and device
CN115509644A (en) Calculation force unloading method and device, electronic equipment and storage medium
WO2022174444A1 (en) Data stream transmission method and apparatus, and network device
CN116074154A (en) CAN bus-based data transmission method, electronic equipment and storage medium
CN114095431A (en) Queue management method and network equipment
WO2023004801A1 (en) Task processing method and apparatus
CN113518082B (en) Message processing method, electronic equipment and storage medium
WO2022227636A1 (en) Transmission control method, apparatus and system
CN115396380B (en) Data stream transmission method, device and equipment based on time sensitive network
US11349769B1 (en) Method and network device for controlling the flow of data traffic

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22942506

Country of ref document: EP

Kind code of ref document: A1