Vehicle-mounted system traffic shaping method and device, medium and electronic terminal
By using random access memory to manage queue counters in the on-board system, two traffic shaping, credit and token traffic shaping are realized, solving the problems of large chip area and high cost in the on-board system traffic shaping method, and improving the flexibility and resource utilization efficiency of traffic shaping.
Patent Information
- Application Number
- CN202510567440.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-30
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2045-04-30
AI Technical Summary
The current on-board system traffic shaping methods have problems with large chip area and high cost, especially because the credit or token counter occupies a large amount of resources.
Random access memory is used to store queue counters in the on-board system ports, and the queue is managed by the random access memory number and address number, and the credit or token shaping of two traffic volumes is realized, reducing chip area and cost.
By saving on-board system resources, reducing chip area, reducing chip costs, and improving the flexibility of traffic shaping.
Smart Images

Figure CN120301837A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure belongs to the field of in-vehicle Ethernet, and relates to a traffic shaping method, in particular to an in-vehicle system traffic shaping method, device, medium and electronic terminal. Background Art
[0002] In in-vehicle Ethernet technology, in addition to supporting the traffic processing of traditional Ethernet, it is also necessary to support the processing of audio and video streams. The traffic of specific audio and video streams similar to those for braking and detecting vehicle distance is not large, but it is necessary to ensure that the traffic of each endpoint in the vehicle can be quickly and accurately transmitted to the target device every fixed number of microseconds or milliseconds. For entertainment-type audio and video streams, the priority is not so high. Therefore, a port may support traffic types including these audio and video streams with different priorities. These traffic with different priorities adopt different traffic shaping methods. And credit-based traffic shaping is a traffic shaping means for controlling bandwidth that must be supported in traffic reservation technology, which requires minimizing the line delay of frames while implementing traffic shaping. For low-priority conventional Ethernet traffic, the token bucket traffic shaping algorithm is used.
[0003] Currently, during the traffic shaping process of a large number of ports, the credit or token counter will occupy a large amount of resources and the chip area is large, thus increasing the chip cost. Therefore, the current in-vehicle system traffic shaping method has the problems of large chip area and high cost. Summary of the Invention
[0004] The purpose of the present disclosure is to provide an in-vehicle system traffic shaping method, device, medium and electronic terminal, which are used to solve the problems of large chip area and high cost existing in the current in-vehicle system traffic shaping method.
[0005] In a first aspect, an embodiment of the present disclosure provides an in-vehicle system traffic shaping method, including: obtaining a queue request signal; processing the queue request signal to obtain the random access memory number and address number associated with the queue request signal, where the random access memory stores counters of each queue in the in-vehicle system port, and the counters are used to record the credit or token of the queue; performing traffic shaping on the queue in the in-vehicle system port based on the random access memory number and the address number.
[0006] In the traffic shaping method, by storing the port queue counters in a random access memory, the resources of the in-vehicle system can be saved, the chip area can be reduced, and thus the chip cost can be reduced. In addition, the traffic shaping method supports both credit and token traffic shaping, which can improve the flexibility of traffic shaping.
[0007] In an embodiment of the present disclosure, an implementation method for traffic shaping of queues in the in-vehicle system port based on the random access memory number and the address number includes: at fixed time intervals, adding a credit amount or token to the non-empty queues in the in-vehicle system port based on the random access memory number and the address number; reading the counter that needs to add the credit amount or token at the first moment within the fixed time period, and writing back the added credit amount or token to the counter within the fixed time period; reading the counter that needs to deduct the credit amount or token at the second moment within the fixed time period, and writing back the deducted credit amount or token to the counter within the fixed time period.
[0008] In an embodiment of the present disclosure, an implementation method for traffic shaping of queues in the in-vehicle system port based on the random access memory number and the address number includes: based on the random access memory number and the address number, obtaining the target port associated with the queue request signal; when the target port enables the audio and video traffic reservation function, performing traffic shaping on the queues in the target port based on the audio and video stream bandwidth latch switch; 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.
[0009] In an embodiment of the present disclosure, when the audio and video stream bandwidth latch 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 allocated bandwidth of the queue is greater than the actual traffic of the queue, the remaining bandwidth 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 latch switch is on, the bandwidth of the high-priority traffic class is locked and not shared with the low-priority traffic class.
[0010] In one embodiment of the present disclosure, the audio - video stream bandwidth latch switch is off. When the target port enables the audio - video traffic reservation function, the implementation method for traffic shaping of the queues in the target port based on the audio - video stream bandwidth latch switch includes: The queues in 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; If the first queue is not empty or the credit counter value of the first queue is less than 0, then the credit of the first queue is increased 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, then the remaining credit counter value of the first queue is added to the credit counter of the second queue, and the credit counter value of the first queue is cleared; If the first queue is empty and the credit counter value of the first queue is 0, then the increment of the first queue is added to the credit counter of the second queue. When the second queue is not empty, the credit increment value each time for the second queue 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, then the credit counter of the second queue is cleared.
[0011] In one embodiment of the present disclosure, when the packets in the first queue are output at the port bandwidth, the credit decrease slope in the first queue is the first slope; When the packets in the second queue are output at the port bandwidth and the credit in the first queue is less than 0, the credit decrease slope in the second queue is the second slope; When the packets in the second queue are output at the port bandwidth and the credit in the first queue is 0, the credit decrease slope in the second queue is the third slope.
[0012] In one embodiment of the present disclosure, the first slope is expressed as:
[0013] L1 = - portrate+rateA
[0014] 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 expressed 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 expressed as:
[0018] L3 = - portrate+rateA+rateB
[0019] Among them, L3 represents the third slope.
[0020] In a second aspect, an embodiment of the present disclosure provides a vehicle-mounted system traffic shaping device, including: 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, where the random access memory stores counters of each queue in the vehicle-mounted system port, and the counters are used to record the credit amount or tokens of the queue; a traffic shaping module, configured to perform traffic shaping on the queues in the vehicle-mounted system port 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, on which a computer program is stored, and when the computer program is executed by a processor, the traffic shaping method described in the first aspect is implemented.
[0022] In a fourth aspect, the present disclosure provides an electronic terminal, including a memory, a processor, and a computer program stored on the memory, and the processor executes the computer program to implement the traffic shaping method according to 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 application have the following beneficial effects:
[0024] In the traffic shaping method, by storing the port queue counters in the random access memory, the resources of the vehicle-mounted system can be saved, the chip area can be reduced, and thus the chip cost can be reduced. In addition, the traffic shaping method supports two types of traffic shaping, namely credit amount and tokens, which can improve the flexibility of traffic shaping. Description of the Drawings
[0025] Figure 1 It shows a schematic structural diagram of a vehicle-mounted system according to an embodiment of the present disclosure.
[0026] Figure 2 It shows a flowchart of a vehicle-mounted system traffic shaping method according to an embodiment of the present disclosure.
[0027] Figure 3 It shows a flowchart of an implementation method for performing traffic shaping on the queues in the vehicle-mounted system port based on the random access memory number and the address number according to an embodiment of the present disclosure.
[0028] Figure 4 It shows a flowchart of an implementation method for performing traffic shaping on the queues in the vehicle-mounted system port based on the random access memory number and the address number according to an embodiment of the present disclosure.
[0029] Figure 5It shows a flowchart of an implementation method for traffic shaping of queues in the target port based on the audio - video stream bandwidth latch switch when the target port enables the audio - video traffic reservation function in an embodiment of the present disclosure.
[0030] Figure 6 It shows a flowchart of a traffic shaping method in an embodiment of the present disclosure.
[0031] Figure 7 It shows a schematic diagram of a read operation in an embodiment of the present disclosure.
[0032] Figure 8 It shows a schematic diagram of the deduction and increase of the queue credit counter in an embodiment of the present disclosure.
[0033] Figure 9 It shows a schematic structural diagram of a vehicle - mounted system traffic shaping device in an embodiment of the present disclosure.
[0034] Figure 10 It shows a schematic structural diagram of an electronic terminal in an embodiment of the present disclosure. Detailed implementation manners
[0035] The following uses specific specific examples to illustrate the implementation manners of the present disclosure. Those skilled in the art can easily understand other advantages and effects of the present disclosure from the content disclosed in this specification. The present disclosure can also be implemented or applied through other different specific implementation manners. Various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present disclosure. It should be noted that, without conflict, the following embodiments and the features in the embodiments can be combined with each other.
[0036] It should be noted that the diagrams provided in the following embodiments only illustrate the basic concept of the present disclosure schematically. Therefore, only the components related to the present disclosure are shown in the diagrams, rather than being drawn according to the number, shape, and size of the components in actual implementation. The type, quantity, and ratio of each component in actual implementation can be an arbitrary change, and the component layout type may also be more complex.
[0037] The following combines the drawings in the embodiments of the present disclosure to describe the technical solutions in the embodiments of the present disclosure in detail.
[0038] The following will elaborate in detail on the principles and implementation manners of the vehicle - mounted system traffic shaping method and the vehicle - mounted system traffic shaping device in the embodiments of the present disclosure, so that those skilled in the art can understand the vehicle - mounted system traffic shaping method and the vehicle - mounted system traffic shaping device in the embodiments of the present disclosure without creative labor.
[0039] Figure 1It is a schematic structural diagram showing an in-vehicle system according to an embodiment of the present disclosure. The in-vehicle system includes: a display unit 10, an input unit 20, an I / O switching interface 30, and an in-vehicle hardware system 40. The in-vehicle hardware system 40 interacts with the user by using 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 includes a touch screen display, a mouse, a knob, or a button.
[0041] In this embodiment, the display unit and the input unit are integrated in the same touch screen display. 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 respectively connected to the in-vehicle hardware system 40. Since the signal input is completely performed by the touch screen display, there is no need for too many knobs or buttons, and the in-vehicle panel can be utilized for display to the greatest extent.
[0042] In other embodiments, the input unit may further include a mouse, a knob, or a button, and a metal touch panel is used to realize mouse movement, or the content of the in-vehicle hardware system is operated through the knob or the button.
[0043] In this embodiment, the I / O switching interface includes a switching controller, a display signal switch, and an input signal switch. The switching controller is respectively connected to the display signal switch and the input signal switch, and is used to control the display signal switch and the input signal switch to perform switching. The display signal switch connects the display signal output end of the in-vehicle hardware system to the display unit, and the input signal switch connects the input signal input end of the in-vehicle hardware system to the input unit respectively, and switches between two in-vehicle hardware systems through a switching trigger.
[0044] Figure 2 It is a flowchart showing a traffic shaping method for an in-vehicle system according to an embodiment of the present disclosure. As Figure 1 shown, this embodiment provides a traffic shaping method for an in-vehicle system, which can be applied to an in-vehicle system. The traffic shaping method includes:
[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 within each port of the in-vehicle system applying for processing. At a certain moment, multiple queues may initiate requests simultaneously within one port, but only one queue will be responded to.
[0047] S12 processes 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 in-vehicle system port, and the counters are used to record the credit amount or tokens of the queue.
[0048] Optionally, the random access memory can be a dual-port random access memory. In the in-vehicle system, all queue counters can be stored in one or more dual-port random access memories. The counters of 8 queues in one port can be placed at the same address in the dual-port random access memory. Each time an address is accessed, the counters of all queues in the corresponding port are read out simultaneously.
[0049] Optionally, the number of random access memories in the in-vehicle system can be related to the number of ports in the in-vehicle system. When the number of ports in the in-vehicle system is greater than 10, it needs to be divided into multiple random access memories, with each block supporting up to 10 port numbers, and the last one being the remaining port numbers. For example, if the in-vehicle system has 16 port numbers, it can be divided into two random access memories, one supporting 10 port numbers and the other supporting 6 port numbers. For an in-vehicle system with a supported port number of N, where N is a positive integer, when N is not greater than 10, the number of random access memories required is N / 10, and when N is greater than 10, the number of random access memories required is N / 10 + 1.
[0050] Optionally, when the in-vehicle system has multiple random access memories, it can be logically partitioned according to the port number.
[0051] Optionally, the implementation method of processing the queue request signal to obtain the random access memory number and address number associated with the queue request signal includes: performing address conversion on 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 performing address conversion on the queue request signal is not elaborated in this embodiment.
[0052] Optionally, when the in-vehicle system has multiple random access memories, it can be logically partitioned 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 requested queue is located and the port address number of the queue in the random access memory. The requested queue refers to the queue with a message application, which can be determined according to the indication of the queue request signal. For example, if the requested queue is the 7th queue of the 14th port, the number and address number of the random access memory where this queue is located can be 2 and 4, indicating the 4th port of the 2nd random access memory.
[0053] S13, perform traffic shaping on the queue in the in - 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 (i.e., credit traffic shaping) or token - based traffic shaping (i.e., token bucket traffic shaping).
[0055] Optionally, the implementation method of performing traffic shaping on the queue in the in - vehicle system port based on the random access memory number and the address number includes: updating the credit amount or token for the queue in the in - vehicle system port based on the random access memory number and the address number.
[0056] Optionally, during the packet sending of the queue, when the traffic shaping of the queue is credit - based traffic shaping, the credit amount is both increased and deducted. The slope of the credit amount change can be expressed 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 amount can be replaced by tokens. The difference from credit - based traffic shaping is that credit - based traffic shaping can clear the credit amount when the queue is empty, while token bucket traffic shaping will continuously fill the bucket when the queue is empty until the bucket depth is reached and no more tokens are added, and it will always maintain the bucket depth. When the queue is not empty, since there are more tokens accumulated in the bucket, frames can be continuously sent in a short period until the bucket becomes negative. Then this forms a traffic burst in a short period. The larger the bucket depth is set, the larger the supported traffic burst is, and the bucket depth can be flexibly set according to the actual situation. This embodiment does not specifically limit this.
[0057] According to the above description, the traffic shaping method includes: obtaining a queue request signal; processing the queue request signal to obtain the random access memory number and the address number associated with the queue request signal. The random access memory stores the counters of each queue in the in - vehicle system port, and the counters are used to record the credit amount or tokens of the queue; performing traffic shaping on the queue in the in - vehicle system port based on the random access memory number and the address number.
[0058] In the traffic shaping method, storing the port queue counters through the random access memory can save the resources of the in - vehicle system, reduce the chip area, and thus reduce the chip cost. In addition, the traffic shaping method supports both credit - based and token - based traffic shaping, which can improve the flexibility of traffic shaping.
[0059] Figure 2It is a flowchart showing an implementation method for traffic shaping of queues in the in-vehicle system port based on the random access memory number and the address number. As Figure 2 shown, this embodiment provides an implementation method for traffic shaping of queues in the in-vehicle system port based on the random access memory number and the address number, including:
[0060] S21, every fixed time period, increase the credit or token for the non-empty queues in the in-vehicle system port based on the random access memory number and the address number.
[0061] Optionally, the fixed time period can be 200 ns.
[0062] S22, read the counter that needs to increase the credit or token at the first moment within the fixed time period, and write back the increased credit or token to the counter within the fixed time period.
[0063] S23, read the counter that needs to deduct the credit or token at the second moment within the fixed time period, and write back the deducted credit or token to the counter within the fixed time period.
[0064] Optionally, the second moment and the first moment are two different moments.
[0065] Figure 3 It is a flowchart showing an implementation method for traffic shaping of queues in the in-vehicle system port based on the random access memory number and the address number. As Figure 3 shown, this embodiment provides an implementation method for traffic shaping of queues in the in-vehicle system port based on the random access memory number and the address number, including:
[0066] S31, based on the random access memory number and the address number, obtain the target port associated with the queue request signal.
[0067] Optionally, the target port associated with the queue request signal may refer to the target port determined according to the indication of the queue request signal. The target port may refer to the port where the packets in the queue apply for processing, that is, the port where the request queue is located. The target port can be determined by the random access memory number and the address number, and this embodiment will not elaborate on this.
[0068] S32, when the target port enables the audio-visual traffic reservation function, perform traffic shaping on the queues in the target port based on the audio-visual stream bandwidth latch switch.
[0069] Optionally, the audio - video traffic may refer to the audio and video traffic of the vehicle system, and the reservation function may refer to that when there is remaining bandwidth in a high - priority queue of a port, the vehicle system can use this remaining bandwidth for a lower - priority queue.
[0070] S33. When the target port does not enable the audio - video traffic reservation function, perform token - bucket traffic shaping on the queues in the target port.
[0071] Optionally, when the audio - video stream bandwidth latch 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 allocated bandwidth of the queue is greater than the actual traffic of the queue, the remaining bandwidth can be given to the low - priority queue. 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. The shared bandwidth can be specifically realized through credit sharing between the high - priority queue and the low - priority queue, and this embodiment will not elaborate on this.
[0072] In an embodiment of the present disclosure, the audio - video stream bandwidth latch 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 specified 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, and the priorities of queues 0 to 7 are in an increasing relationship, with queue 7 having the highest priority and queue 0 having the lowest priority. The first queue can be queue 7, and the second queue can be any one of queues 0 to 6.
[0073] Figure 4 It is a flowchart showing the implementation method of traffic shaping for the queues in the target port based on the audio - video stream bandwidth latch switch when the target port enables the audio - video traffic reservation function in the embodiments of the present disclosure. As Figure 4 shown, this embodiment provides an implementation method of traffic shaping for the queues in the target port based on the audio - video stream bandwidth latch switch when the target port enables the audio - video traffic reservation function, including:
[0074] S41. If the first queue is not empty or the value of the credit counter of the first queue is less than 0, increase the credit of the first queue at the configured rate every fixed time period.
[0075] Optionally, the configured rate can be flexibly set according to the actual situation, and this embodiment does not clearly limit it.
[0076] S42, if the first queue is empty and the value of the credit counter of the first queue is greater than 0, then add the remaining value of the credit counter of the first queue to the credit counter of the second queue, and clear the value of the credit counter of the first queue.
[0077] Optionally, when the packets in the first queue are output at the port bandwidth, the slope of the credit reduction in the first queue is the first slope. The slope of the credit reduction is the rate of change of the credit over time, and the value of the credit counter refers to the value counted by the credit counter.
[0078] Optionally, the first slope is expressed as:
[0079] L1 = -portrate + rateA
[0080] where 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 value of the credit counter of the first queue is 0, then add the increment of the first queue to the credit counter of the second queue. When the second queue is not empty, the value of the credit incremented each time in the second queue 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 value of the credit counter of the second queue is greater than 0, then clear the credit counter of the second queue.
[0083] Optionally, when the packets in the second queue are output at the port bandwidth and the credit in the first queue is less than 0, the slope of the credit reduction in the second queue is the second slope; when the packets in the second queue are output at the port bandwidth and the credit in the first queue is 0, the slope of the credit reduction in the second queue is the third slope.
[0084] Optionally, the second slope is expressed as:
[0085] L2 = -portrate + rateB
[0086] where L2 represents the second slope and rateB represents the shaping rate of the second queue;
[0087] The third slope is expressed as:
[0088] L3 = -portrate + rateA + rateB
[0089] Among them, L3 represents the third slope, and portrate in L1, L2, and L3 can represent the maximum bandwidth of the ports where the first queue and the second queue are located.
[0090] In an embodiment of the present disclosure, the in-vehicle system clock is 125Mhz (megahertz). For the traffic shaping based on credit amount provided in this embodiment, its shaping accuracy is 50kbps (kilobit rate). Its characteristic is that the credit amount is increased once every 200ns (nanoseconds), and each increase of 1 represents 0.01bit (bit). Then, when the shaping rate rate is known, the value of the credit amount to be increased each time is:
[0091] credit = rate / 50000bps
[0092] Among them, the unit of rate is bps (bit rate), credit represents credit, and the shaping rate can refer to the shaping rate of the queue.
[0093] For the token bucket traffic shaping algorithm provided in this embodiment, its shaping accuracy is 8kbps. The token bucket is filled once every 2us (microseconds), and each increase of 1 represents 0.016bit. It supports traffic calibration once every 20us. Then, when the shaping rate rate is known, the filling bucket granularity each time is:
[0094] grty = rate / 8000bps + delt * t2
[0095] Among them, the unit of rate is bps, t2 is valid once every 20us, t2 represents the time of traffic calibration, delt can refer to the change value of calibration, grty represents the filling bucket granularity, and delt can be flexibly set according to actual situations, and this embodiment does not clearly limit this.
[0096] To support the above two types of traffic shaping simultaneously, a counter with a 24-bit width is allocated for each queue to record the real-time credit or token situation of the queue. In the case of the same number of bits in chip design, the area occupied by a random access memory is much smaller than that of a multi-bit width flip-flop. Therefore, to save resources as much as possible, this design samples one or more dual-port random access memories to store the counters of all queues. The counters of 8 queues within one port are placed at the same address in the dual-port random access memory. Each time an address is accessed, the counters of all queues within the corresponding port are read out simultaneously. When any counter needs to be updated, whether it is incremented or decremented, the random access memory needs to be read first to obtain the original value of the counter. Then, an increment or decrement operation is performed on the queue that needs to be updated, and the original value is maintained for the queues that do not need to be updated. Finally, it is written back to the original address. Then 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 and can support both read and write simultaneously. If it is necessary to increment the credit / token for one address and decrement the credit / token for another address at the same time, then there will be a situation where two different addresses need to be read at the same time, but there is only one set of read interfaces. To avoid this conflict situation, the read operations for incrementing the credit / token and decrementing the credit / token need to be separated in time. Then, within 200 ns, at most 10 ports can have their credit / token incremented. Therefore, when the number of ports in the system is greater than 10, multiple random access memories need to be divided. Each block supports up to 10 ports, and the last block is the actual number of ports. Since the time for incrementing the credit / token for each port has been divided, even if some ports do not need to have their credit / token incremented within a certain time period, they will still be read in sequence, but they will not participate in the calculation and write-back operations. As long as the traffic shaping enable of one queue within a port is turned on, the random access memory needs to be accessed.
[0098] To ensure that all ports can be processed within 200 ns, an indication signal is pulled high every 200 ns in the design. When the credit processing of all queues within all ports is completed, the indication signal is pulled low. After another 200 ns, it is pulled high again, and so on. When a port is accessed, its 8 queues will be processed together. Only the queues that meet the conditions will have their credit incremented, and the queues that do not meet the conditions need to write back the original credit value unchanged to the original position.
[0099] This system supports the independence of the traffic shaping switch for each queue, and when each queue enables traffic shaping, it can select credit-based traffic shaping and token bucket traffic shaping.
[0100] Therefore, for a system with N supported ports, the number of random access memories required is N / 10 or N / 10 + 1. When there are multiple random access memories, logical sharding needs to be performed according to the port number.
[0101] In this system, a queue request signal with an input width of [N*8 - 1:0] is used to indicate whether there is a message in each queue within each port applying for processing. At a certain moment, multiple queues within a port may initiate requests simultaneously, but only one queue will be responded to.
[0102] Figure 7 On the right side, the time is divided into time instants T0 and T1. At time instant T0, a read operation for increasing the credit amount / token will be fixedly performed; a read operation for deducting the credit amount / token is only allowed to occur at time instant T1. At time instant T0, multiple random access memories will be processed together. Among them, the ATU is an address translation unit, which will generate corresponding random access memory numbers and address numbers according to the actual queue number.
[0103] This system supports that when there is remaining bandwidth for any high-priority traffic, it can be used by a low-priority queue. Each port needs to provide the following three configurations:
[0104] One port is an audio-video stream port, and this port has an audio-video stream bandwidth latch switch, which is used to determine whether the bandwidth of a certain high-priority traffic class is shared with a certain low-priority traffic class; when it is 0, it means that the bandwidth can be shared; when the stream bandwidth latch switch is 1, it means that the bandwidth allocated to the high-priority is locked, and even if there is remaining bandwidth for this queue, the remaining bandwidth will not be given to the low-high priority.
[0105] One high-priority queue A, which means that when the bandwidth allocated to this queue is greater than the actual traffic of this queue, its remaining bandwidth can be given to the low-priority queue; this queue must select traffic shaping based on the credit amount;
[0106] One low-priority queue number B, which is the queue that can receive the remaining bandwidth of the high-priority queue A. This queue must select traffic shaping based on the credit amount;
[0107] If the above conditions are met and the audio-video stream bandwidth latch switch is configured to 0, then the effect of bandwidth sharing acts on the two configured queues A and B. As long as 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 with 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 method is as follows: when there is a queue request for a port and the port allows packets to be sent out, read the random access memory to obtain the credit counter values of 8 queues or the token values in the token bucket. If it is determined that the three conditions in the above conditions are met and the audio and video stream bandwidth latch switch is configured to 0, determine whether there are packets waiting to be sent in queue A and whether its credit counter value is greater than 0.
[0110] If queue A is not empty or the credit counter value is less than 0, increase the credit according to the configured rate.
[0111] If queue A is empty and its 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 queue A is cleared.
[0112] If queue A is empty and its credit counter value is 0, the increment of queue A also needs to be added to the credit counter of queue B. Then the value increased by B each time is the increment of queue A plus the increment of queue B.
[0113] If queue B is empty and its counter is greater than 0, clear the credit counter of queue B.
[0114] The deduction and increase of the credit counters of the two queues are as follows Figure 8 shown. The slope of L0 represents the credit increment situation of queue A (Qa), which represents the traffic shaping bandwidth of queue A, so L0 = rateA; L1 is the credit decline slope of queue A. Because when a packet is scheduled for output, it is output at the port bandwidth, but at the same time the credit is increased, so L1 = -portrate + rateA, which is a negative value. Frame1, Frame2, and Frame3 represent frame 1, frame 2, and frame 3 respectively, wait represents waiting, send represents sending, Qc represents queue C, Credit represents credit, CreditA represents the credit of queue A, and CreditA represents the credit of queue B. The slope of L2 represents the credit increment situation of queue B (Qb), which represents the traffic shaping bandwidth of queue B, and its slope L2 = rateB; L5 is the credit decline slope of queue B. When the packet is output at the port bandwidth, the credit is increased at the same time, so L5 = -portrate + rateB, which is a negative value.
[0115] At time T2, the transmission of the low-priority queue C ends. Both queue A and queue B have frames to send, but the priority of queue A is higher, so the frames of queue A are sent first.
[0116] At time T3, the frames in queue A are completely scheduled, the queue becomes empty, and there is remaining credit. At this time, the remaining amount is given to queue B. During the output of the frames in queue B, that is, in the time period from T3 to T4, queue A is empty. Therefore, the credit increment of A is also added to queue B. So the slope of L4 is the output according to the port bandwidth, and at the same time, the credit increments of queue B and queue A are added. L4 = -portrate + rateA + rateB.
[0117] At time T4, queue B is empty, and there is remaining credit, which needs to be cleared.
[0118] During the period from T10 to T11, because the credit of queue A is negative, its increment cannot be given to queue B. At this time, the rising slope of the credit of queue B is the same as that of L2. During the period from T11 to T12, queue A is empty and its credit is not negative. Therefore, its increment needs to be given to queue B. At this time, the rising slope of the credit of B is L3 = rateB + rateA.
[0119] If a port does not enable the audio - video traffic reservation function, then when traffic shaping is required, the traffic shaping algorithm of the token - bucket algorithm needs to be used. Or a port enables the audio - video traffic reservation function, but some queues enable the traffic shaping of the token - bucket algorithm, then the queues will achieve the shaping effect of the token - bucket. The token - bucket algorithm supports deficits. The difference from the credit - based traffic shaping is that when the queue is empty, the bucket will be continuously filled until the bucket depth is reached and no more tokens will be added, and the bucket depth will be maintained. When the queue is not empty, because there are more tokens accumulated in the bucket, frames can be continuously sent in a short period of time until the bucket becomes negative. Then this forms a traffic burst in a short period of time. The larger the bucket depth is set, the larger the supported traffic burst is. In this system, the bucket depths of all queues can be set and can be adjusted according to actual requirements.
[0120] The protection scope of the vehicle - mounted system traffic shaping method described in the embodiments of the present disclosure is not limited to the execution order of the steps listed in this embodiment. Any solution achieved by adding or reducing steps of the prior art and replacing steps according to the principles of the present disclosure is included in the protection scope of the present disclosure.
[0121] Figure 9 It is a schematic structural diagram showing the vehicle - mounted system traffic shaping device in the embodiments of the present disclosure. As Figure 9 shown, this embodiment provides a vehicle - mounted system traffic shaping device 90. The vehicle - mounted system traffic shaping device 90 includes:
[0122] A signal acquisition module 910, configured to acquire queue request signals.
[0123] A signal processing module 920 is 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 stores counters of each queue in the vehicle-mounted system port, and the counters are used to record the credit amount or tokens of the queues.
[0124] A traffic shaping module 930 is configured to perform traffic shaping on the queues in the vehicle-mounted system port based on the random access memory number and the address number.
[0125] The signal acquisition module in the vehicle-mounted system traffic shaping device corresponds to step S11 in the vehicle-mounted system traffic shaping method, the signal processing module corresponds to step S12, and the traffic shaping module corresponds to step S13.
[0126] In several embodiments provided by the present disclosure, it should be understood that the disclosed device or method can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of modules / units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple modules or units can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection between each other can be through some interfaces. The indirect coupling or communication connection of devices or modules or units can be in an electrical, mechanical or other form.
[0127] The modules / units described as separate components may or may not be physically separated. The components shown as modules / units may or may not be physical modules, that is, they can be located in one place, or distributed to multiple network units. Some or all of the modules / units can be selected according to actual needs to achieve the purpose of the embodiments of the present disclosure. For example, in each embodiment of the present disclosure, the functional modules / units can be integrated in a processing module, or each module / unit can exist physically alone, or two or more modules / units can be integrated in one module / unit.
[0128] Those of ordinary skill in the art should also be further aware that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described according to their functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present disclosure.
[0129] Figure 10 is a schematic block diagram of an electronic terminal provided by an embodiment of the present application. As Figure 10 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. Each component in the device is coupled together through a bus system 1004. It can be understood that the bus system 1004 is used to implement the connection and communication between these components. In addition to the data bus, the bus system 1004 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, in Figure 10 all kinds of buses are labeled as the bus system.
[0130] Among them, the user interface 1005 may include a display, a keyboard, a mouse, a trackball, a click gun, a button, a touchpad, or a touch screen, etc.
[0131] It can be understood that the memory 1002 may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM, Read Only Memory), a programmable read-only memory (PROM, Programmable Read-Only Memory), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM, Static Random Access Memory), synchronous static random access memory (SSRAM, Synchronous Static Random Access Memory). The memory described in the embodiments of the present invention is intended to include but not limited to these and any other suitable categories of memories.
[0132] The memory 1002 in the embodiments of the present invention is used to store various categories of data to support the operation of the electronic terminal 1000. Examples of these data include: any executable program for operating on the electronic terminal 1000, such as an operating system 10021 and an application program 10022; the operating system 10021 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks. The application program 10022 may include various application programs, such as a media player (Media Player), a browser (Browser), etc., for implementing various application services. Implementing the probability table update method provided by the embodiments of the present invention may be included in the application program 10022.
[0133] The method disclosed in the embodiments of the present invention above can be applied to the processor 1001 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 in hardware or instructions in software form in the processor 1001. The above-mentioned 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 various 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. Combining the steps of the accessory optimization method provided in the embodiments of the present invention can be directly embodied as being completed by a hardware decoding processor, or completed by a combination of hardware and software modules in the decoding processor. The software module may be located in a storage medium, and this storage medium is located in the memory. The processor reads the information in the memory and combines its hardware to complete the steps of the foregoing method.
[0134] In an exemplary embodiment, the electronic terminal 1000 may be an application-specific integrated circuit (ASIC), a DSP, a programmable logic device (PLD), or a complex programmable logic device (CPLD) for executing the foregoing method.
[0135] The embodiments of the present disclosure also provide a computer-readable storage medium. Those of ordinary skill in the art can understand that all or part of the steps of implementing the methods in the above embodiments can be completed by instructing a processor through a program. The program can be stored in a computer-readable storage medium, and the storage medium 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 disc, and any combination thereof. The above storage medium can be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more integrated available media. The available medium can be a magnetic medium (such as a floppy disk, a hard disk, or a magnetic tape), an optical medium (such as a digital video disc (DVD)), or a semiconductor medium (such as a solid-state disk (SSD)), etc.
[0136] Embodiments of the present disclosure may also provide a computer program product, which includes one or more computer instructions. When the computer instructions are loaded and executed on a computing device, they wholly or partially generate the processes or functions described in the embodiments of the present disclosure. 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 a website, computer, or data center to another website, computer, or data center in a wired manner (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or a wireless manner (such as infrared, wireless, microwave, etc.).
[0137] When the computer program product is executed by a computer, the computer executes the method described in the foregoing method embodiments. The computer program product may be a software installation package. In the case where the foregoing method is required, the computer program product may be downloaded and executed on the computer.
[0138] The descriptions of the processes or structures corresponding to the above respective drawings each have their own focuses. For parts not detailed in a certain process or structure, reference may be made to the relevant descriptions of other processes or structures.
[0139] The above embodiments merely illustrate the principles and effects of the present disclosure and are not intended to limit the present disclosure. Any person familiar with this technology may make modifications or changes to the above embodiments without departing from the spirit and scope of the present disclosure. Therefore, all equivalent modifications or changes made by those with ordinary knowledge in the technical field to which the present disclosure pertains without departing from the spirit and technical ideas disclosed by the present disclosure should still be covered by the claims of the present disclosure.
Claims
1. A method for shaping the traffic of a vehicle-mounted system, characterized in that, Including: Obtain a queue request signal; 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 counters for each queue in the in-vehicle system port, and the counters are used to record the credit amount or tokens of the queues; Perform traffic shaping on the queues in the in-vehicle system port based on the random access memory number and the address number.
2. The traffic shaping method according to claim 1, wherein The implementation method of performing traffic shaping on the queues in the in-vehicle system port based on the random access memory number and the address number includes: Every fixed time period, increase the credit amount or tokens of the non-empty queues in the in-vehicle system port once based on the random access memory number and the address number; Read the counter that needs to increase the credit amount or tokens at the first moment within the fixed time period, and write back the increased credit amount or tokens to the counter within the fixed time period; Read the counter that needs to deduct the credit amount or tokens at the second moment within the fixed time period, and write back the deducted credit amount or tokens to the counter within the fixed time period.
3. The traffic shaping method according to claim 1, wherein The implementation method of performing traffic shaping on the queues in the in-vehicle system port based on the random access memory number and the address number includes: Based on the random access memory number and the address number, obtain the target port associated with the queue request signal; When the target port enables the audio-video traffic reservation function, perform traffic shaping on the queues in the target port based on the audio-video stream bandwidth latch switch; When the target port does not enable the audio-video traffic reservation function, perform token bucket traffic shaping on the queues in the target port.
4. The traffic shaping method according to claim 3, wherein: When the audio-video stream bandwidth latch 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 allocated bandwidth of the queue is greater than the actual traffic of the queue, the remaining bandwidth can be given to the low-priority queue. 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.
5. The traffic shaping method according to claim 4, wherein The audio-video stream bandwidth latch switch is off. When the target port enables the audio-video traffic reservation function, the implementation method of performing traffic shaping on the queues in the target port based on the audio-video stream bandwidth latch switch includes: 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; If the first queue is not empty or the value of the credit counter of the first queue is less than 0, increase the credit amount of the first queue at the 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, then add the remaining credit counter value of the first queue to the credit counter of the second queue, and clear 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, then add the increment of the first queue to the credit counter of the second queue. When the second queue is not empty, the credit increment value of the second queue each time 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, then clear the credit counter of the second queue.
6. The traffic shaping method according to claim 5, wherein: When the packets in the first queue are output according to the port bandwidth, the credit decrease slope in the first queue is the first slope; When the packets in the second queue are output according to the port bandwidth and the credit in the first queue is less than 0, the credit decrease slope in the second queue is the second slope; When the packets in the second queue are output according to the port bandwidth and the credit in the first queue is 0, the credit decrease slope in the second queue is the third slope.
7. The traffic shaping method according to claim 6, characterized in that Further comprising: The first slope is expressed 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 expressed as: L2 = -portrate + rateB Wherein, L2 represents the second slope, and rateB represents the shaping rate of the second queue; The third slope is expressed as: L3 = -portrate + rateA + rateB Wherein, L3 represents the third slope.
8. An in-vehicle system traffic shaping device, characterized in that 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 the random access memory number and address number associated with the queue request signal. The random access memory stores counters of each queue in the in-vehicle system port, and the counters are used to record the credit or tokens of the queue; A traffic shaping module, configured to perform traffic shaping on the queues in the in-vehicle system port based on the random access memory number and the address number.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the traffic shaping method according to any one of claims 1-7.
10. 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 implement the traffic shaping method according to claims 1-7.
Citation Information
Patent Citations
Flow scheduling method and system based on dynamic priority
CN116489104A
Traffic shaping and barrel filling processing method, control module, network chip and equipment
CN118138537A
Flow shaping data access method, control module, network chip and equipment
CN118276780A
Priorty-based scheduling method and scheduler performing the method
US20240241768A1
Cited By
Flow control method, device and equipment
CN121418360A
