Methods, devices, media and electronic terminals for flow shaping in vehicle systems
By using random access memory and credit/token bucket shaping methods in the vehicle system, the problems of large chip area and high cost in vehicle system traffic shaping are solved, achieving flexible traffic shaping and resource saving.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-30
- Publication Date
- 2026-03-10
AI Technical Summary
Current methods for shaping traffic in in-vehicle systems suffer from problems such as large chip area and high cost, especially when processing audio and video streams of different priorities. Existing technologies consume a lot of resources and have high chip costs.
Random access memory is used to store the queue counter in the vehicle system port. Flexible traffic shaping is achieved by using two traffic shaping methods, credit and token bucket, combined with audio and video stream bandwidth latching switches.
By saving onboard system resources, reducing chip area and cost, and improving the flexibility of traffic shaping, it supports efficient transmission of traffic with different priorities.
Smart Images

Figure CN120301837B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure belongs to the field of vehicle-mounted Ethernet, and relates to a traffic shaping method, in particular to a vehicle system traffic shaping method, device, medium and electronic terminal. BACKGROUND
[0002] In the vehicle-mounted Ethernet technology, in addition to the traffic processing of traditional Ethernet, the processing of audio and video streams also needs to be supported. The traffic of specific audio and video streams such as brake and vehicle distance detection is not large, but it is required to quickly and accurately transmit the traffic of each endpoint in the vehicle to the target device within a fixed number of microseconds or milliseconds. For the audio and video streams of the entertainment type, the priority is not high. Therefore, a port may support traffic types including audio and video streams of different priorities. The traffic shaping methods used for traffic of different priorities are also different. Credit-based traffic shaping is a traffic shaping method that must be supported in traffic reservation technology, which requires to reduce the line delay of frames as much as possible while implementing traffic shaping. For the conventional Ethernet traffic with low priority, a token bucket traffic shaping algorithm is used.
[0003] At present, in the process of traffic shaping for a large number of ports, credit or token counters occupy a large amount of resources, and the chip area is large, thereby increasing the chip cost. Therefore, the current vehicle system traffic shaping method has the problems of large chip area and high cost. SUMMARY
[0004] The present disclosure aims to provide a vehicle system traffic shaping method, device, medium and electronic terminal, which is used to solve the problem of large chip area and high cost of the current vehicle system traffic shaping method.
[0005] In a first aspect, the present disclosure provides a vehicle system traffic shaping method, comprising: obtaining a queue request signal; processing the queue request signal to obtain a random access memory number and an address number associated with the queue request signal, the random access memory storing counters of each queue in the port of the vehicle system, and the counter being used to record the credit or token of the queue; and performing traffic shaping on the queue in the port of the vehicle system based on the random access memory number and the address number.
[0006] In the traffic shaping method, the port queue counter is stored by the random access memory, which can save the resources of the vehicle system, reduce the chip area, and further reduce the chip cost. In addition, the traffic shaping method supports two traffic shaping methods of credit and token, which can improve the flexibility of traffic shaping.
[0007] In an embodiment of the present disclosure, the method for traffic shaping of the queue in the vehicle system port based on the random access memory number and the address number comprises: increasing the credit amount or token of the queue in the vehicle system port based on the random access memory number and the address number every fixed time period; reading the counter requiring the increase of the credit amount or token at the first time in the fixed time period, and writing back the increased credit amount or token to the counter in the fixed time period; reading the counter requiring the decrease of the credit amount or token at the second time in the fixed time period, and writing back the decreased credit amount or token to the counter in the fixed time period.
[0008] In an embodiment of the present disclosure, the method for traffic shaping of the queue in the vehicle system port based on the random access memory number and the address number comprises: obtaining the target port associated with the queue request signal based on the random access memory number and the address number; when the target port enables the audio / video flow reservation function, traffic shaping of the queue in the target port based on the audio / video flow bandwidth latch switch; when the target port does not enable the audio / video flow reservation function, token bucket traffic shaping of the queue in the target port.
[0009] In an embodiment of the present disclosure, when the audio / video flow bandwidth latch switch is off, the bandwidth of the high-priority traffic class can be shared to the low-priority traffic class, when the high-priority queue indicates that the bandwidth allocated to the queue is greater than the actual flow of the queue, the remaining bandwidth of the high-priority queue can be given to the low-priority queue, and the traffic shaping of the high-priority queue is credit-based traffic shaping; when the low-priority queue indicates that it can receive the remaining bandwidth of the high-priority queue, the traffic shaping of the low-priority queue is credit-based traffic shaping; when the audio / video flow bandwidth latch switch is on, the bandwidth of the high-priority traffic class is locked and cannot be shared with the low-priority traffic class.
[0010] In an embodiment of the present disclosure, when the audio / video stream bandwidth latch switch is off, and the target port enables the audio / video flow reservation function, an implementation method for the queue in the target port to perform flow shaping based on the audio / video stream bandwidth latch switch includes: the queue of the target port includes a first queue and a second queue, and the priority of the first queue is higher than the priority of the second queue; if the first queue is not empty or the credit amount counter value of the first queue is less than 0, the credit amount of the first queue is increased by a configured rate every fixed time period; if the first queue is empty and the credit amount counter value of the first queue is greater than 0, the remaining credit amount counter value of the first queue is added to the credit amount counter of the second queue, and the credit amount counter value of the first queue is cleared; if the first queue is empty and the credit amount counter value of the first queue is 0, the increment of the first queue is added to the credit amount counter of the second queue, and the increasing credit amount value of the second queue is the sum of the increment of the first queue and the increment of the second queue every time when the second queue is not empty; if the second queue is empty and the credit amount counter value of the second queue is greater than 0, the credit amount counter of the second queue is cleared.
[0011] In an embodiment of the present disclosure, when the packets in the first queue are output by port bandwidth, the decreasing slope of the credit amount in the first queue is a first slope; when the packets in the second queue are output by port bandwidth and the credit amount in the first queue is less than 0, the decreasing slope of the credit amount in the second queue is a second slope; when the packets in the second queue are output by port bandwidth and the credit amount in the first queue is 0, the decreasing slope of the credit amount in the second queue is a third slope.
[0012] In an embodiment of the present disclosure, the first slope is represented as:
[0013] L1 = -portrate + rateA
[0014] wherein L1 represents the first slope, portrate represents the maximum bandwidth of the port, and rateA represents the shaping rate of the first queue; the second slope is represented as:
[0015] L2 = -portrate + rateB
[0016] wherein L2 represents the second slope, and rateB represents the shaping rate of the second queue;
[0017] The third slope is represented as:
[0018] L3 = -portrate + rateA + rateB
[0019] L3 represents the third slope.
[0020] In a second aspect, the present disclosure provides a vehicle-mounted system traffic shaping device, comprising: a signal acquisition module configured to acquire a queue request signal; a signal processing module configured to process the queue request signal to obtain a random access memory number and an address number associated with the queue request signal, the random access memory storing counters of each queue in a port of the vehicle-mounted system, the counters being configured to record credit or tokens of the queue; and a traffic shaping module configured to perform traffic shaping on the queue in the port of the vehicle-mounted system based on the random access memory number and the address number.
[0021] In a third aspect, the present disclosure provides a computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the traffic shaping method of the first aspect.
[0022] In a fourth aspect, the present disclosure provides an electronic terminal comprising a memory, a processor, and a computer program stored on the memory, the processor executing the computer program to implement the traffic shaping method of any one of the first aspect.
[0023] As described above, the vehicle-mounted system traffic shaping method, device, medium, and electronic terminal of the present disclosure have the following beneficial effects:
[0024] In the traffic shaping method, the port queue counters are stored by the random access memory, which can save resources of the vehicle-mounted system, reduce chip area, and further reduce chip cost. In addition, the traffic shaping method supports both credit and token traffic shaping, which can improve the flexibility of traffic shaping. BRIEF DESCRIPTION OF DRAWINGS
[0025] Figure 1 A structural schematic diagram of a vehicle-mounted system according to an embodiment of the present disclosure is shown.
[0026] Figure 2 A flowchart of a traffic shaping method of a vehicle-mounted system according to an embodiment of the present disclosure is shown.
[0027] Figure 3 A flowchart of an implementation method of traffic shaping on a queue in a port of a vehicle-mounted system based on a random access memory number and an address number according to an embodiment of the present disclosure is shown.
[0028] Figure 4 A flowchart of an implementation method of traffic shaping on a queue in a port of a vehicle-mounted system based on a random access memory number and an address number according to an embodiment of the present disclosure is shown.
[0029] Figure 5A flow chart of an implementation method of a queue traffic shaping based on a bandwidth latch switch of an audio / video stream for a target port when the target port enables an audio / video flow reservation function is shown.
[0030] Figure 6 A flow chart of a traffic shaping method is shown.
[0031] Figure 7 A read operation schematic diagram is shown.
[0032] Figure 8 A schematic diagram of queue credit amount counter deduction and increase is shown.
[0033] Figure 9 A structural schematic diagram of a vehicle-mounted system traffic shaping device is shown.
[0034] Figure 10 A structural schematic diagram of an electronic terminal is shown. DETAILED DESCRIPTION
[0035] The embodiments of the present disclosure will be described in detail by specific concrete examples below, and those skilled in the art can easily understand other advantages and effects of the present disclosure from the content disclosed in the specification. The present disclosure can also be implemented or applied by other different specific embodiments, and various modifications or changes can be made to the details in the specification based on different views and applications without departing from the spirit of the present disclosure. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.
[0036] It should be noted that the diagrams provided in the following embodiments only illustrate the basic concept of the present disclosure in a schematic manner, and only the components related to the present disclosure are shown in the diagrams, not the number, shape and size of the components when actually implemented. The actual implementation of each component may be a random change in shape, number and proportion, and the layout pattern of the components may also be more complex.
[0037] The technical solutions in the embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.
[0038] The principles and implementation methods of the vehicle-mounted system traffic shaping method and the vehicle-mounted system traffic shaping device of the embodiments of the present disclosure will be described in detail below, so that those skilled in the art can understand the vehicle-mounted system traffic shaping method and the vehicle-mounted system traffic shaping device of the embodiments of the present disclosure without creative labor.
[0039] Figure 1is a structural schematic diagram of a vehicle-mounted system according to an embodiment of the present disclosure. The vehicle-mounted system comprises a display unit 10, an input unit 20, an I / O switching interface 30 and a vehicle-mounted hardware system 40. The vehicle-mounted hardware system 40 interacts with a user by means of the input unit 20 and the display unit 10.
[0040] The display unit is a touch screen display, a tablet computer or a liquid crystal display screen without touch control function. The input unit comprises a touch screen display, a mouse, a knob or a key.
[0041] In this embodiment, the display unit and the input unit are integrated in the same touch screen display, and only the touch screen display is used for signal input and display. One end of the I / O switching interface 30 is connected to the touch screen display, and the other end is connected to the vehicle-mounted hardware system 40 respectively. Since the signal input is completely performed by the touch screen display, there is no need for too many knobs or keys, and the vehicle-mounted panel can be used for display to the greatest extent.
[0042] In other embodiments, the input unit can also comprise a mouse, a knob or a key, and the mouse movement can be realized by means of a metal touch panel, or the content of the vehicle-mounted hardware system can be operated by means of the knob or the key.
[0043] In this embodiment, the I / O switching interface comprises a switching controller, a display signal switcher and an input signal switcher. The switching controller is connected to the display signal switcher and the input signal switcher respectively, and is used for controlling the display signal switcher and the input signal switcher to switch. The display signal switcher is connected to the display unit at the output end of the display signal of the vehicle-mounted hardware system. The input signal switcher is connected to the input unit at the input end of the input signal of the vehicle-mounted hardware system, and switches the two vehicle-mounted hardware systems by means of switching trigger.
[0044] Figure 2 is a flow chart of a traffic shaping method of a vehicle-mounted system according to an embodiment of the present disclosure. As shown in Figure 1 The present embodiment provides a traffic shaping method of a vehicle-mounted system, which can be applied to a vehicle-mounted system. The traffic shaping method comprises the following steps.
[0045] S11, obtaining a queue request signal.
[0046] Optionally, the queue request signal is used to indicate whether there is a message in each queue in each port of the vehicle-mounted system to apply for processing. At a certain moment, multiple queues in a port can simultaneously initiate a request, but only one queue will be responded.
[0047] S12, processing the queue request signal to obtain the random access memory number and address number associated with the queue request signal, the random access memory storing the counters of the queues in the port of the vehicle-mounted system, the counters being used to record the credit amount or token of the queue.
[0048] Optionally, the random access memory can be a dual-port random access memory, and all the counters of the queues can be stored in one or more dual-port random access memories in the vehicle-mounted system. The counters of 8 queues in one port can be placed in the same address of the dual-port random access memory, and all the counters of the queues in the corresponding port are read out at the same time each time an address is accessed.
[0049] Optionally, the number of random access memories of the vehicle-mounted system can be related to the number of ports in the vehicle-mounted system. When the number of ports in the vehicle-mounted system is greater than 10, a plurality of random access memories are needed, each of which supports up to 10 port numbers, and the last one supports the remaining port numbers. For example, the vehicle-mounted system has 16 port numbers, which can be divided into two random access memories, one of which supports 10 port numbers and the other of which supports 6 port numbers. For a vehicle-mounted system with a supported port number N, N is a positive integer, when N is not greater than 10, the number of random access memories needed is N / 10, and when N is greater than 10, the number of random access memories needed is N / 10+1.
[0050] Optionally, when the vehicle-mounted system has a plurality of random access memories, they can be logically divided according to the port number.
[0051] Optionally, the implementation method for processing the queue request signal to obtain the random access memory number and address number associated with the queue request signal includes address conversion of the queue request signal to obtain the random access memory number and address number associated with the queue request signal. The input width of the queue request signal can be [N*8-1:0], where N is the number of ports. The process of address conversion of the queue request signal is not described herein.
[0052] Optionally, when the vehicle-mounted system has a plurality of random access memories, they can be logically divided according to the port number. The random access memory number and address number associated with the queue request signal can refer to the number of the random access memory where the queue is located and the port address number of the queue in the random access memory. The queue refers to the queue that applies for a message, which can be determined according to the indication of the queue request signal. For example, the queue to be requested is the 7th queue of the 14th port, and the number of the random access memory where the queue is located and the address number can be 2 and 4, indicating the 4th port of the 2nd random access memory.
[0053] S13, traffic shaping a queue in the vehicle system port based on the random access memory number and the address number.
[0054] Optionally, the traffic shaping can be credit-based traffic shaping or token-based traffic shaping.
[0055] Optionally, the method for traffic shaping a queue in the vehicle system port based on the random access memory number and the address number comprises: updating the credit or token of the queue in the vehicle system port based on the random access memory number and the address number.
[0056] Optionally, during the sending of a packet in a queue, when the traffic shaping of the queue is credit-based traffic shaping, the credit is deducted while being added, and the change slope of the credit can be represented as L=-portrate+rate, where portrate represents the maximum bandwidth of the port where the queue is located, and rate represents the shaping rate of the queue. When the traffic shaping of the queue is token bucket traffic shaping, the credit can be replaced by token. The difference between the credit-based traffic shaping and the token bucket traffic shaping is that the credit-based traffic shaping can be emptied when the queue is empty, while the token bucket traffic shaping continues to fill the bucket until the bucket depth is reached, and no more tokens are added. The bucket depth is maintained. When the queue is not empty, the accumulated tokens in the bucket are relatively large, so the frames can be continuously sent in a short time until the bucket is negative. Then a traffic burst in a short time is formed. The larger the bucket depth is, the larger the supported traffic burst is. The bucket depth can be flexibly set according to the actual situation, and the embodiment does not explicitly limit this.
[0057] According to the above description, the traffic shaping method comprises: obtaining a queue request signal; processing the queue request signal to obtain a random access memory number and an address number associated with the queue request signal, the random access memory storing counters of each queue in the vehicle system port, and the counter being used to record the credit or token of the queue; and traffic shaping a queue in the vehicle system port based on the random access memory number and the address number.
[0058] In the traffic shaping method, the port queue counter is stored by the random access memory, which can save the resources of the vehicle system, reduce the chip area, and further reduce the chip cost. In addition, the traffic shaping method supports two kinds of traffic shaping, i.e., credit and token, which can improve the flexibility of traffic shaping.
[0059] Figure 2is a flow chart illustrating an implementation method of traffic shaping of a queue in a vehicle system port based on the random access memory number and the address number according to an embodiment of the present disclosure. As shown in Figure 2 The embodiment provides an implementation method of traffic shaping of a queue in a vehicle system port based on the random access memory number and the address number, which comprises the following steps of:
[0060] S21, based on the random access memory number and the address number, increasing the credit amount or token of the queue in the vehicle system port which is not empty once every fixed time period.
[0061] Optionally, the fixed time period can be 200 ns.
[0062] S22, reading the counter which needs to increase the credit amount or token at the first time in the fixed time period, and writing back the increased credit amount or token to the counter in the fixed time period.
[0063] S23, reading the counter which needs to decrease the credit amount or token at the second time in the fixed time period, and writing back the decreased credit amount or token to the counter in the fixed time period.
[0064] Optionally, the second time and the first time are two different times.
[0065] Figure 3 is a flow chart illustrating an implementation method of traffic shaping of a queue in a vehicle system port based on the random access memory number and the address number according to an embodiment of the present disclosure. As shown in Figure 3 The embodiment provides an implementation method of traffic shaping of a queue in a vehicle system port based on the random access memory number and the address number, which comprises the following steps of:
[0066] S31, based on the random access memory number and the address number, obtaining a target port associated with the queue request signal.
[0067] Optionally, the target port associated with the queue request signal can refer to a target port determined according to the indication of the queue request signal, the target port can refer to a port of a message in the queue which applies for processing, i.e. a port where the queue is located, and the target port can be determined by the random access memory number and the address number, which will not be described herein.
[0068] S32, when the target port enables the audio / video flow reservation function, traffic shaping of the queue in the target port based on the audio / video flow bandwidth latching switch.
[0069] Optionally, the audio and video traffic can refer to audio and video traffic of the vehicle-mounted system, and the reservation function can refer to that when there is remaining bandwidth of a high-priority queue of a port, the vehicle-mounted system can use the remaining bandwidth for a low-priority queue.
[0070] S33, when the target port does not enable the audio and video traffic reservation function, performing token bucket traffic shaping on the queues in the target port.
[0071] Optionally, when the audio and video stream bandwidth latching switch is off, the bandwidth of the high-priority traffic class can be shared with the low-priority traffic class; when the high-priority queue indicates that the bandwidth allocated to the queue is greater than the actual traffic of the queue, the remaining bandwidth of the high-priority queue can be given to the low-priority queue, and the traffic shaping of the high-priority queue is credit-based traffic shaping; when the low-priority queue indicates that it can receive the remaining bandwidth of the high-priority queue, the traffic shaping of the low-priority queue is credit-based traffic shaping; when the audio and video stream bandwidth latching switch is on, the bandwidth of the high-priority traffic class is locked and cannot be shared with the low-priority traffic class. The shared bandwidth can be realized by credit sharing between the high-priority queue and the low-priority queue, which will not be described herein.
[0072] In an embodiment of the present disclosure, the audio and video stream bandwidth latching switch is off, the queues of the target port include a first queue and a second queue, and the priority of the first queue is higher than that of the second queue. The first queue and the second queue can be arbitrarily designated from the queues in a port, as long as the priority of the first queue is higher than that of the second queue, for example, there are 8 queues in a port, the priorities of queue 0 to queue 7 are in an increasing relationship, the priority of queue 7 is the highest, and the priority of queue 0 is the lowest. The first queue can be queue 7, and the second queue can be any one of queue 0 to queue 6.
[0073] Figure 4 is a flow chart illustrating an implementation method of traffic shaping of queues in a target port based on an audio and video stream bandwidth latching switch when the target port enables an audio and video traffic reservation function. As shown in Figure 4 , the embodiment provides an implementation method of traffic shaping of queues in a target port based on an audio and video stream bandwidth latching switch when the target port enables an audio and video traffic reservation function, which includes:
[0074] S41, if the first queue is not empty or the credit amount counter value of the first queue is less than 0, increasing the credit amount of the first queue by a configured rate every fixed time period.
[0075] Optionally, the configuration rate can be flexibly set according to actual conditions, and the embodiment does not explicitly limit this.
[0076] S42, if the first queue is empty and the credit amount counter value of the first queue is greater than 0, adding the remaining credit amount counter value of the first queue to the credit amount counter of the second queue, and clearing the credit amount counter value of the first queue.
[0077] Optionally, when the packets in the first queue are output according to the port bandwidth, the credit amount in the first queue decreases at a first slope. The credit amount decrease slope refers to the rate of change of the credit amount with time, and the credit amount counter value refers to the value counted by the credit amount counter.
[0078] Optionally, the first slope is represented as:
[0079] L1 = -portrate + rateA
[0080] Wherein, L1 represents the first slope, portrate represents the maximum port bandwidth, and rateA represents the shaping rate of the first queue.
[0081] S43, if the first queue is empty and the credit amount counter value of the first queue is 0, adding the increment of the first queue to the credit amount counter of the second queue, and the increase credit amount value of the second queue each time when the second queue is not empty is the sum of the increment of the first queue and the increment of the second queue.
[0082] S44, if the second queue is empty and the credit amount counter value of the second queue is greater than 0, clearing the credit amount counter of the second queue.
[0083] Optionally, when the packets in the second queue are output according to the port bandwidth and the credit amount in the first queue is less than 0, the credit amount in the second queue decreases at a second slope; when the packets in the second queue are output according to the port bandwidth and the credit amount in the first queue is 0, the credit amount in the second queue decreases at a third slope.
[0084] Optionally, the second slope is represented as:
[0085] L2 = -portrate + rateB
[0086] Wherein, L2 represents the second slope, and rateB represents the shaping rate of the second queue.
[0087] The third slope is represented as:
[0088] L3 = -portrate + rateA + rateB
[0089] Wherein, L3 represents the third slope, portrate in L1, L2 and L3 can represent the maximum bandwidth of the port where the first queue and the second queue are located.
[0090] In an embodiment of the present disclosure, the vehicle-mounted system clock is 125Mhz (megahertz), and the credit-based traffic shaping provided by the embodiment has a shaping accuracy of 50kbps (kilobits per second). Its characteristics are to increase the credit amount every 200ns (nanoseconds), and every increase of 1 represents 0.01bit (bit). Therefore, when the shaping rate rate is known, the credit value that needs to be increased each time is:
[0091] credit = rate / 50000bps
[0092] Wherein, rate is in units of bps (bit rate), credit represents credit, and shaping rate can refer to the shaping rate of the queue.
[0093] The token bucket traffic shaping algorithm provided in the embodiment has a shaping accuracy of 8kbps. The token bucket is filled every 2us (microsecond), and every increase of 1 represents 0.016bit. It supports traffic calibration every 20us. Therefore, when the shaping rate rate is known, the bucket granularity each time is:
[0094] grty = rate / 8000bps + delt*t2
[0095] Wherein, rate is in units of bps, t2 is valid every 20us, t2 represents the time of traffic calibration, delt can refer to the change value of calibration, and grty represents the bucket granularity. Delt can be flexibly set according to actual conditions, and the embodiment does not explicitly limit it.
[0096] In order to support the above two kinds of traffic shaping, a 24-bit counter is allocated to each queue to record the real-time credit or token amount. In the same bit case in chip design, the area occupied by random access memory is much smaller than that of multi-bit trigger. Therefore, in order to save resources as much as possible, one or more blocks of dual-port random access memory are used to store all the queue counters. The counters of 8 queues in one port are placed in the same address of the dual-port random access memory. Each time an address is accessed, the counters of all queues in the corresponding port are read out at the same time. When any counter needs to be updated, whether it is increased or decreased, it needs to be read from the random access memory first, and then the original value of the counter is obtained. The queue that needs to be updated is increased or decreased, and the queue that does not need to be updated is kept unchanged. Then it is written back to the original address. Therefore, the size of the dual-port random access memory is N*24*8, where N is the number of ports.
[0097] The random access memory is dual-port, which can support reading and writing at the same time. If the credit amount / token needs to be increased at one address and decreased at another address at the same time, the situation of needing to read two different addresses at the same time will occur, but there is only one set of read interface. In order to avoid such conflicts, the read operation of increasing credit amount / token and the read operation of decreasing credit amount / token need to be separated in time. Therefore, within 200ns, the credit amount / token can be increased for a maximum of 10 ports. Therefore, when the number of ports of the system is greater than 10, multiple blocks of random access memory are needed. Each block supports up to 10 ports, and the last block is the actual number of ports. Because the time of increasing the credit amount / token for each port has been divided, even if some ports do not need to increase the credit amount / token in a certain time period, they will also be read in order, but they will not participate in the calculation and write-back operation. As long as the traffic shaping of one queue in a port is enabled, the random access memory needs to be accessed.
[0098] In order to ensure that all ports can be processed within 200ns, a signal is pulled high every 200ns in the design, and when all the queues in the ports have completed the credit amount processing, the signal is pulled low. It is pulled up again after 200ns, and this process is repeated. When a port is accessed, its 8 queues will be processed together, and only the queues that meet the conditions will increase the credit amount, and the queues that do not meet the conditions will keep the original credit amount unchanged and write it back to the original position.
[0099] The system supports independent traffic shaping switches for each queue, and when each queue enables traffic shaping, it can select credit-based traffic shaping and token bucket traffic shaping.
[0100] So for a system with N supported ports, the number of required random access memories is N / 10 or N / 10+1. When there are multiple random access memories, logically, they need to be divided according to the port number.
[0101] In the system, a queue request signal with a width of [N*8-1:0] is input, which is used to indicate whether there is a message in each queue in each port to apply for processing. At a certain moment, multiple queues in a port can simultaneously initiate a request, but only one queue will be responded.
[0102] Figure 7 The right side of the middle indicates that the time will be divided into T0 and T1 moments, and the read operation of increasing the credit amount / token will be fixed at T0 moment; the read operation of deducting the credit amount / token is only allowed to be generated at T1 moment. At T0 moment, multiple random access memories are processed together. The ATU is an address conversion unit, which generates the corresponding random access memory number and address number according to the actual queue number.
[0103] The system supports that when the bandwidth of any high-priority traffic is left, it can be used for a low-priority queue. Each port needs to provide the following three configurations:
[0104] A port is an audio and video stream port, which has an audio and video stream bandwidth latch switch, which is used to determine whether the bandwidth of a certain high-priority traffic class is shared to a certain low-priority traffic class; when it is 0, it indicates that the bandwidth can be shared; when the stream bandwidth latch switch is 1, it indicates that the bandwidth allocated to the high-priority is locked, and even if the bandwidth of the queue has a surplus, the remaining bandwidth will not be given to the low-priority.
[0105] A high-priority queue A indicates that when the bandwidth allocated to the queue is greater than the actual traffic of the queue, the remaining bandwidth can be given to the low-priority queue; the queue must select credit-based traffic shaping;
[0106] A low-priority queue number B can receive the remaining bandwidth of the high-priority queue A. The queue must select credit-based traffic shaping;
[0107] If the above conditions are met, and the audio and video stream bandwidth latch switch is configured as 0, the bandwidth sharing effect acts on the configured two queues A and B. If one of the above conditions is not met, queues A and B will not share bandwidth.
[0108] When the bandwidth of queue A is shared to queue B, it is reflected in two aspects, one is that the remaining credit amount of queue A is given to queue B, and the other is that the credit amount increment of queue A is given to queue B.
[0109] The implementation is that when a port has a queue request, when the port allows the message to be sent out, the random access memory is read to obtain the credit counter value of 8 queues or the token value in the token bucket. If it is judged that three conditions in the above conditions are met, and the audio and video stream bandwidth latch switch is configured as 0. It is judged whether there is a message to be sent in the queue A, and whether the credit counter value is greater than 0,
[0110] If the queue A is not empty or the credit counter value is less than 0, the credit is added at the configured rate;
[0111] If the queue A is empty and the credit counter value is greater than 0, the remaining credit counter value of A needs to be added to the credit counter of queue B, and the credit counter value of A queue is cleared.
[0112] If the queue A is empty and the credit counter value is 0, the increment of the queue A also needs to be added to the credit counter of the queue B. Then the increment of B is the increment of queue A plus the increment of queue B each time.
[0113] If the queue B is empty and the counter is greater than 0, the credit counter of the queue B is cleared.
[0114] The credit counter deduction and increment of the two queues are as follows Figure 8 The slope of L0 represents the credit increment of queue A (Qa), which represents the traffic shaping bandwidth of queue A, so L0 = rateA; L1 is the credit decrease slope of queue A. Because a message is scheduled to be output, it is output according to the port bandwidth, but at the same time the credit is increased, so L1 = -portrate + rateA, which is a negative value. Frame1, Frame2, Frame3 respectively represent frame1, frame2, frame3, wait represents waiting, send represents sending, Qc represents queue C, Credit represents credit, CreditA represents the credit of queue A, and CreditB represents the credit of queue B. The slope of L2 represents the credit increment of queue B (Qb), which represents the traffic shaping bandwidth of queue B, and the slope L2 = rateB; L5 is the credit decrease slope of queue B. The message is output according to the port bandwidth, and at the same time the credit is increased, so L5 = -portrate + rateB, which is a negative value.
[0115] At T2 time, the low-priority queue C sends out, and queue A and queue B both have frames to send, but the priority of queue A is high, so the frame of queue A is sent first.
[0116] At T3, the frames of queue A are scheduled, the queue is empty, and there is a remaining credit amount, so the remaining amount is given to queue B. During the frame output of queue B, that is, during the T3-T4 period, queue A is empty, so the credit amount increment of A is also added to queue B, so the slope of L4 is output according to the port bandwidth, and the credit amount increment of queue B and queue A is added, L4=-portrate+rateA+rateB.
[0117] At T4, queue B is empty, and there is a remaining credit amount, which needs to be emptied.
[0118] During T10-T11, because the credit amount of queue A is negative, its increment cannot be given to queue B, and the rising slope of the credit amount of queue B at this time is consistent with L2; during T11-T12, queue A is empty, and its credit amount is not negative, so its increment needs to be given to queue B, and the rising slope of the credit amount of B at this time is L3=rateB+rateA.
[0119] If a port does not enable the audio and video flow reservation function, then when flow shaping is needed, the flow shaping algorithm of the token bucket algorithm needs to be used. Or a port enables the audio and video flow reservation function, but some queues enable the flow shaping of the token bucket algorithm, so the queue will achieve the shaping effect of the token bucket. The token bucket algorithm supports a deficit, and the difference from the credit-based flow shaping is that when the queue is empty, the bucket is continuously filled until the bucket depth is reached and no more tokens are added, and the bucket depth is maintained. When the queue is not empty, because there are many tokens accumulated in the bucket, frames can be continuously sent in a short time until the bucket is negative. Then this forms a flow burst in a short time, and the larger the bucket depth is set, the larger the supported flow burst is. In the present system, the bucket depth of all queues can be set, and the bucket depth can be adjusted according to actual needs.
[0120] The protection scope of the vehicle-mounted system flow shaping method described in the embodiments of the present disclosure is not limited to the order of steps listed in the embodiments, and any scheme realized by increasing, reducing, or replacing steps according to the principle of the present disclosure is included in the protection scope of the present disclosure.
[0121] Figure 9 is a structural schematic diagram of a vehicle-mounted system flow shaping device according to an embodiment of the present disclosure. As shown in Figure 9 The present embodiment provides a vehicle-mounted system flow shaping device 90, which comprises:
[0122] The signal acquisition module 910 is configured to acquire a queue request signal.
[0123] The signal processing module 920 is used to process the queue request signal to obtain the random access memory number and address number associated with the queue request signal. The random access memory stores the counters of each queue in the vehicle system port. The counters are used to record the credits or tokens of the queue.
[0124] The traffic shaping module 930 is used to perform traffic shaping on the queues in the vehicle system port based on the random access memory number and the address number.
[0125] The signal acquisition module in the vehicle system flow shaping device corresponds one-to-one with step S11 in the vehicle system flow shaping method, the signal processing module corresponds one-to-one with step S12, and the flow shaping module corresponds one-to-one with step S13.
[0126] In the several embodiments provided in this disclosure, it should be understood that the disclosed apparatus or method can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of modules / units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or units may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection of apparatuses or modules or units may be electrical, mechanical, or other forms.
[0127] The modules / units described as separate components may or may not be physically separate. The components shown as modules / units may or may not be physical modules; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules / units can be selected to achieve the objectives of the embodiments of this disclosure, depending on actual needs. For example, the functional modules / units in the various embodiments of this disclosure may be integrated into one processing module, or each module / unit may exist physically separately, or two or more modules / units may be integrated into one module / unit.
[0128] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this disclosure.
[0129] Figure 10 This is a schematic block diagram of the electronic terminal provided in an embodiment of this application. Figure 10 As shown, the electronic terminal 1000 includes at least one processor 1001, a memory 1002, at least one network interface 1003, and a user interface 1005. The various components in the device are coupled together via a bus system 1004. It is understood that the bus system 1004 is used to implement communication between these components. In addition to a data bus, the bus system 1004 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in… Figure 10 The general will label all buses as bus systems.
[0130] The user interface 1005 may include a monitor, keyboard, mouse, trackball, clicker, button, touchpad, or touch screen.
[0131] It is understood that memory 1002 can be volatile memory or non-volatile memory, or both. Non-volatile memory can be read-only memory (ROM) or programmable read-only memory (PROM), which serves as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (SRAM) and synchronous static random access memory (SSRAM). The memories described in the embodiments of this invention are intended to include, but are not limited to, these and any other suitable categories of memory.
[0132] In this embodiment of the invention, the memory 1002 is used to store various types of data to support the operation of the electronic terminal 1000. Examples of this data include: any executable program for operation on the electronic terminal 1000, such as the operating system 10021 and application programs 10022; the operating system 10021 contains various system programs, such as the framework layer, core library layer, driver layer, etc., for implementing various basic services and handling hardware-based tasks. The application program 10022 may contain various applications, such as a media player, browser, etc., for implementing various application services. The probability table update method provided in this embodiment of the invention can be included in the application program 10022.
[0133] The methods disclosed in the above embodiments of the present invention can be applied to or implemented by the processor 1001. The processor 1001 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in the processor 1001 or by instructions in the form of software. The processor 1001 may be a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The processor 1001 can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor 1001 may be a microprocessor or any conventional processor, etc. The steps of the accessory optimization method provided in the embodiments of the present invention can be directly reflected as being executed by a hardware decoding processor, or being executed by a combination of hardware and software modules in the decoding processor. The software module may be located in a storage medium, which is located in a memory. The processor reads the information in the memory and combines it with its hardware to complete the steps of the aforementioned method.
[0134] In an exemplary embodiment, the electronic terminal 1000 may be used by one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), or complex programmable logic devices (CPLDs) to execute the aforementioned method.
[0135] This disclosure also provides a computer-readable storage medium. Those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing a processor. The program can be stored in a computer-readable storage medium, which is a non-transitory medium, such as random access memory, read-only memory, flash memory, hard disk, solid-state drive, magnetic tape, floppy disk, optical disk, and any combination thereof. The storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., digital video disc (DVD)), or a semiconductor medium (e.g., solid-state drive (SSD)).
[0136] This disclosure also provides a computer program product comprising one or more computer instructions. When the computer instructions are loaded and executed on a computing device, all or part of the processes or functions described in this disclosure are generated. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means.
[0137] When the computer program product is executed by a computer, the computer performs the method described in the foregoing method embodiments. The computer program product can be a software installation package; when the foregoing method is required, the computer program product can be downloaded and executed on the computer.
[0138] The descriptions of the processes or structures corresponding to the above figures each have their own emphasis. For parts of a process or structure that are not described in detail, please refer to the relevant descriptions of other processes or structures.
[0139] The above embodiments are merely illustrative of the principles and effects of this disclosure and are not intended to limit this disclosure. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of this disclosure. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in this disclosure should still be covered by the claims of this disclosure.
Claims
1. A method for traffic shaping of an in-vehicle system, characterized by, The method comprises the following steps: acquiring a queue request signal; processing the queue request signal to acquire a random access memory number and an address number associated with the queue request signal, the random access memory storing counters of queues in the vehicle system port, the counters recording credit or token of the queues; traffic shaping the queues in the vehicle system port based on the random access memory number and the address number; the method for traffic shaping the queues in the vehicle system port based on the random access memory number and the address number comprises the following steps: based on the random access memory number and the address number, acquiring a target port associated with the queue request signal; when the target port enables the audio / video flow reservation function, traffic shaping the queues in the target port based on the audio / video flow bandwidth latch switch; 2. The traffic shaping method of claim 1, wherein, when the target port does not enable the audio / video flow reservation function, token bucket traffic shaping the queues in the target port; when the audio / video flow bandwidth latch switch is off, the bandwidth of a high-priority traffic class can be shared with a low-priority traffic class; when a high-priority queue indicates that the bandwidth allocated to the queue is greater than the actual flow of the queue, the remaining bandwidth of the high-priority queue can be given to a low-priority queue, and the traffic shaping of the high-priority queue is credit-based traffic shaping; when a low-priority queue indicates that it can receive the remaining bandwidth of the high-priority queue, the traffic shaping of the low-priority queue is credit-based traffic shaping; when the audio / video flow bandwidth latch switch is on, the bandwidth of a high-priority traffic class is locked and cannot be shared with a low-priority traffic class, and the shared bandwidth is realized through credit sharing between the high-priority queue and the low-priority queue. The method for traffic shaping the queues in the vehicle system port based on the random access memory number and the address number comprises the following steps:
3. The traffic shaping method of claim 2, wherein, every fixed time period, increasing credit or token of a non-empty queue in the vehicle system port based on the random access memory number and the address number; at a first time in the fixed time period, reading a counter that needs to increase credit or token, and writing the increased credit or token to the counter in the fixed time period; at a second time in the fixed time period, reading a counter that needs to decrease credit or token, and writing the decreased credit or token to the counter in the fixed time period. When the audio / video flow bandwidth latch switch is off, the method for traffic shaping the queues in the target port based on the audio / video flow bandwidth latch switch when the target port enables the audio / video flow reservation function comprises the following steps: the queues of the target port comprise a first queue and a second queue, and the priority of the first queue is higher than that of the second queue; if the first queue is not empty or the credit counter value of the first queue is less than 0, increasing the credit of the first queue at a configured rate every fixed time period; if the first queue is empty and the credit counter value of the first queue is greater than 0, adding the credit counter value of the first queue remaining to the credit counter of the second queue, and clearing the credit counter value of the first queue; if the first queue is empty and the credit counter value of the first queue is 0, adding the increment of the first queue to the credit counter of the second queue, and the increment of the second queue each time the second queue is not empty is the sum of the increment of the first queue and the increment of the second queue; if the second queue is empty and the credit counter value of the second queue is greater than 0, clearing the credit counter of the second queue.
4. The traffic shaping method according to claim 3, wherein: when the messages in the first queue are output according to the port bandwidth, the credit amount in the first queue decreases at a first slope; when the messages in the second queue are output according to the port bandwidth and the credit amount in the first queue is less than 0, the credit amount in the second queue decreases at a second slope; when the messages in the second queue are output according to the port bandwidth and the credit amount in the first queue is 0, the credit amount in the second queue decreases at a third slope; the first slope is represented as: L1 = -portrate + rateA wherein L1 represents the first slope, portrate represents the maximum port bandwidth, and rateA represents the shaping rate of the first queue; the second slope is represented as: L2 = -portrate + rateB wherein L2 represents the second slope, and rateB represents the shaping rate of the second queue; the third slope is represented as: L3 = -portrate + rateA + rateB wherein L3 represents the third slope.
5. An in-vehicle system traffic shaping apparatus, characterized by comprising: The method comprises: a signal acquisition module, configured to acquire a queue request signal; a signal processing module, configured to process the queue request signal to acquire a random access memory number and an address number associated with the queue request signal, wherein the random access memory stores the counters of the queues in the port of the vehicle-mounted system, and the counters are used to record the credit amount or tokens of the queues; a traffic shaping module, configured to perform traffic shaping on the queues in the port of the vehicle-mounted system based on the random access memory number and the address number; The implementation method for performing traffic shaping on the queues in the port of the vehicle-mounted system based on the random access memory number and the address number comprises: based on the random access memory number and the address number, acquiring a target port associated with the queue request signal; when the target port enables the audio / video traffic reservation function, performing traffic shaping on the queues in the target port based on the audio / video stream bandwidth latch switch; and when the target port does not enable the audio / video traffic reservation function, performing token bucket traffic shaping on the queues in the target port. When the audio / video stream bandwidth latch switch is off, the bandwidth of the high-priority traffic class can be shared to the low-priority traffic class; when the high-priority queue indicates that the bandwidth allocated to the queue is greater than the actual traffic of the queue, the remaining bandwidth of the high-priority queue can be given to the low-priority queue, and the traffic shaping of the high-priority queue is credit-based traffic shaping; when the low-priority queue indicates that it can receive the remaining bandwidth of the high-priority queue, the traffic shaping of the low-priority queue is credit-based traffic shaping; When the audio / video stream bandwidth latch switch is on, the bandwidth of the high-priority traffic class is locked and not shared with the low-priority traffic class, and the shared bandwidth is realized through credit sharing between the high-priority queue and the low-priority queue.
6. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to realize the traffic shaping method of any one of claims 1-4.
7. An electronic terminal comprising a memory, a processor and a computer program stored on the memory, characterized in that, The processor executes the computer program to realize the traffic shaping method of any one of claims 1-4.
Citation Information
Patent Citations
Traffic shaping and barrel filling processing method, control module, network chip and equipment
CN118138537A