Traffic shaping method and device, medium and electronic terminal
By using credit counters and token counters in the on-board system for traffic shaping, combined with bandwidth latch switches, the problem of low traffic shaping accuracy in the on-board Ethernet system is solved, and more efficient bandwidth utilization and stable transmission of audio and video streams are achieved.
Patent Information
- Application Number
- CN202510567444.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-30
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2045-04-30
AI Technical Summary
The low traffic shaping accuracy in vehicle-mounted Ethernet systems leads to low bandwidth utilization, especially the unbalanced bandwidth allocation between audio and video streams and ordinary streams, resulting in wasted total port bandwidth.
The credit counter and token counter are used for traffic shaping. By performing traffic shaping on the counter, it supports the traffic shaping method based on credit and tokens, and combines the bandwidth latch switch to control bandwidth sharing of the highest priority and second-higher priority traffic, achieving flexible traffic management.
It improves the traffic shaping accuracy, enhances the bandwidth utilization of the on-board system, ensures the stable transmission of audio and video streams, and reduces bandwidth waste.
Smart Images

Figure CN120358200A_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 a traffic shaping method, device, medium and electronic terminal. Background Art
[0002] In in-vehicle Ethernet technology, traffic reservation is a key technology, mainly used to reserve bandwidth for some key audio and video streams in automotive Ethernet. For ports supporting audio and video streams, the system should be able to allocate the traffic bandwidth of 8 queues within the port to achieve the purpose that the traffic passing through each queue meets the expectation. And credit-based traffic shaping is a traffic shaping means for controlling bandwidth that must be supported in traffic reservation technology. Its function is to limit specific types of traffic within the allocated bandwidth range and prevent these specific traffic from bursting as much as possible. To prevent these specific types of traffic from occupying all the bandwidth of a port, the protocol stipulates that the maximum bandwidth allocation for reserved traffic cannot exceed 75% of the port bandwidth. In an in-vehicle system, it is also necessary to support the forwarding and processing of ordinary flows, such as those entertainment-type audio and video streams. The priority of this kind of traffic is relatively low, and the allocated bandwidth is also relatively small. The traffic shaping method of this system uses the token bucket algorithm. For those crucial audio and video streams, in order to ensure successful transmission among terminals in the bridge, the system often allocates a large amount of bandwidth for them. And sometimes this bandwidth cannot be fully used during a certain period of time or even throughout the process, which results in waste of the total port bandwidth. To improve the utilization rate of the port bandwidth, the flow reservation protocol supports that when there is remaining traffic in a high-priority queue of the port, the system can decide whether to use this remaining traffic for a lower-priority queue.
[0003] In an in-vehicle Ethernet system, the arrival time of each packet in the audio and video stream at the network node needs to be accurate, and the transmission delay between network nodes is required to be low. For credit-based traffic shaping, a very small time granularity is required when increasing the credit. The smaller the time granularity, the smaller the introduced error. The current traffic shaping method has the problem of low traffic shaping accuracy. Summary of the Invention
[0004] The purpose of the present disclosure is to provide a traffic shaping method, device, medium and electronic terminal, which are used to solve the problem of low current traffic shaping accuracy.
[0005] In a first aspect, an embodiment of the present disclosure provides a traffic shaping method, which is applied to a vehicle-mounted system. The traffic shaping method includes: obtaining a queue request signal; based on the traffic shaping mode of the queue in the port of the vehicle-mounted system, allocating a counter corresponding to the traffic shaping mode to the queue, where the counter is a credit counter or a token counter, and the counter supports deficits and can store several maximum packet lengths supported by the vehicle-mounted system; based on the counter, performing traffic shaping on the request queue associated with the queue request signal, and the credit increment or token increment of the request queue is increased by a flag signal every fixed time period.
[0006] In the traffic shaping method, traffic shaping accuracy can be improved by performing traffic shaping based on the counter. And both credit-based and token-based traffic shaping methods are supported in the vehicle-mounted system, making the vehicle-mounted system more flexible.
[0007] In an embodiment of the present disclosure, the port has an audio-video stream bandwidth latch switch for controlling whether the bandwidth allocated to the highest-priority traffic class is shared with the second-highest-priority traffic class; when the bandwidth latch switch is off, it means that the bandwidth allocated to the highest-priority traffic class can be shared with the second-highest-priority traffic class; when the bandwidth latch switch is on, it means that the bandwidth allocated to the highest-priority traffic class is not shared with the second-highest-priority traffic class.
[0008] In an embodiment of the present disclosure, the implementation method of performing traffic shaping on the request queue associated with the queue request signal based on the counter includes: when the port enables the audio-video traffic reservation function and the bandwidth latch switch is off, performing traffic shaping on the request queue associated with the queue request signal based on the shared bandwidth of the highest-priority traffic class and the second-highest-priority traffic class and the timer; when the port enables the audio-video traffic reservation function and the bandwidth latch switch is on, performing credit-based traffic shaping on the request queue associated with the queue request signal based on the counter; when the port does not enable the audio-video traffic reservation function, performing token bucket traffic shaping on the request queue associated with the queue request signal based on the counter.
[0009] In an embodiment of the present disclosure, when the port enables the audio and video traffic reservation function and the bandwidth latch switch is off, the implementation method of traffic shaping for the request queue associated with the queue request signal based on the shared bandwidth of the highest priority traffic class and the second highest priority traffic class and the timer includes: the request queue includes a first queue and a second queue, the first queue is the queue mapped by the highest priority traffic class, and the second queue is the queue mapped by the second highest priority traffic class; the counter includes a first credit counter and a second credit counter, the first credit counter is used to record the credit value that the first queue can use, and the second credit counter is used to record the credit value that the first queue and the second queue can use; when the first queue is not empty, the credit increment of the first queue is increased on both the first credit counter and the second credit counter at the same time; when the second queue is not empty, the credit increment of the second queue is increased on the second credit counter; when the packet in the first queue is scheduled, the values of the first credit counter and the second credit counter are both decreased; when the packet in the second queue is scheduled, the value of the second credit counter is decreased; when both the first credit counter and the second credit counter are non-negative, the first queue is allowed to output; when the second credit counter is non-negative, the second queue is allowed to output.
[0010] In an embodiment of the present disclosure, when the port enables the audio and video traffic reservation function and the bandwidth latch switch is on, the request queue includes a first queue and a second queue, the first queue is the queue mapped by the highest priority traffic class, and the second queue is the queue mapped by the second highest priority traffic class; the counter includes a third credit counter and a fourth credit counter, the third credit counter is used to record the credit value that the first queue can use, and the fourth credit counter is used to record the credit value that the second queue can use.
[0011] In an embodiment of the present disclosure, when the packet in the first queue is scheduled, the credit decrease slope of the value of the first credit counter is the first slope, and the credit decrease slope of the value of the second credit counter is the second slope; when the first queue is not empty, the credit increment slope of the value of the second credit counter is the third slope.
[0012] In an embodiment of the present disclosure, the first slope is expressed as:
[0013] L1 = -portrate + rate1 =
[0014] Wherein, L1 represents the first slope, portrate represents the maximum bandwidth of the port, and rate1 represents the shaping rate of the first queue;
[0015] The second slope is expressed as:
[0016] L2 = -portrate + rate1 + rate2 =
[0017] Wherein, L2 represents the second slope, and rate2 represents the shaping rate of the second queue;
[0018] The third slope is expressed as:
[0019] L3 = rate1 + rate2
[0020] Wherein, L3 represents the third slope.
[0021] In a second aspect, an embodiment of the present disclosure provides a traffic shaping device, including: a signal acquisition module, configured to acquire a queue request signal; a counter allocation module, configured to allocate a counter corresponding to the traffic shaping mode to the queue based on the traffic shaping mode of the queues in the port of the vehicle-mounted system, where the counter is a credit counter or a token counter, and the counter supports deficits and can store a plurality of maximum packet lengths supported by the vehicle-mounted system; a traffic shaping module, configured to perform traffic shaping on the request queue associated with the queue request signal based on the counter, and the credit increment or token bucket increment of the request queue is increased through a flag signal within a fixed period.
[0022] 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.
[0023] 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 described in any item of the first aspect.
[0024] As described above, the traffic shaping method, device, medium, and electronic terminal of the present application have the following beneficial effects:
[0025] In the traffic shaping method, traffic shaping accuracy can be improved by performing traffic shaping based on the counter. And in the vehicle-mounted system, traffic shaping methods based on credit and tokens are supported, making the traffic shaping of the vehicle-mounted system more flexible. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 It shows a schematic structural diagram of a vehicle-mounted system according to an embodiment of the present disclosure.
[0027] Figure 2 It shows a flowchart of the traffic shaping method according to an embodiment of the present disclosure.
[0028] Figure 3 It shows a flowchart of an implementation method for traffic shaping of the request queue associated with the queue request signal based on the counter according to an embodiment of the present disclosure.
[0029] Figure 4 It shows a flowchart of an implementation method for traffic shaping of the request queue associated with the queue request signal based on the shared bandwidth of the highest priority traffic class and the second highest priority traffic class and the timer when the port enables the audio - video traffic reservation function and the bandwidth latch switch is on according to an embodiment of the present disclosure.
[0030] Figure 5 It shows a schematic diagram of traffic shaping when queue 7 and queue 6 share bandwidth according to an embodiment of the present disclosure.
[0031] Figure 6 It shows a schematic diagram of traffic shaping when queue 7 and queue 6 do not share bandwidth according to an embodiment of the present disclosure.
[0032] Figure 7 It shows a schematic diagram of traffic shaping of queue 7 and queue 6 based on a token bucket according to an embodiment of the present disclosure.
[0033] Figure 8 It shows a schematic diagram of the structure of the traffic shaping device according to an embodiment of the present disclosure.
[0034] Figure 9 It shows a schematic diagram of the structure of an electronic terminal according to 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 in a schematic manner. 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 types, quantities, and proportions of the components in actual implementation can be arbitrarily changed, and the component layout type may also be more complex.
[0037] The following describes in detail the technical solutions in the embodiments of the present disclosure with reference to the accompanying drawings in the embodiments of the present disclosure.
[0038] The principles and implementation manners of the traffic shaping method and traffic shaping device in the embodiments of the present disclosure will be elaborated in detail below, so that those skilled in the art can understand the traffic shaping method and traffic shaping device in the embodiments of the present disclosure without creative labor.
[0039] Figure 1 It is a schematic structural diagram of a vehicle-mounted system according to an embodiment of the present disclosure. The vehicle-mounted system includes: 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 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 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, 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 respectively connected to the vehicle-mounted hardware system 40. Since the signal input is completely performed by the touch screen display and does not require too many knobs or buttons, the vehicle-mounted 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 vehicle-mounted 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 vehicle-mounted hardware system to the display unit, and the input signal switch connects the input signal input end of the vehicle-mounted hardware system to the input unit respectively, and switches between two vehicle-mounted hardware systems through a switching trigger.
[0044] Figure 2 It is a flowchart showing the traffic shaping method according to an embodiment of the present disclosure. As Figure 1 shown, this embodiment provides a traffic shaping method applied to a vehicle-mounted system. The traffic shaping method includes:
[0045] S11, obtaining a queue request signal.
[0046] Optionally, the width of the queue request signal can be [N*8-1:0], and the queue request signal is used to indicate whether there is a message application for processing in each queue within each port in the vehicle-mounted system, where N is the number of ports in the vehicle-mounted system.
[0047] S12. Based on the traffic shaping mode of the queues within the ports in the vehicle-mounted system, allocate a counter corresponding to the traffic shaping mode to the queue. The counter is a credit counter or a token counter, and the counter supports deficits and can store several maximum packet lengths supported by the vehicle-mounted system.
[0048] Optionally, the port has an audio-video stream bandwidth latch switch for controlling whether the bandwidth allocated to the highest-priority traffic class is shared with the second-highest-priority traffic class. When the bandwidth latch switch is off, it means that the bandwidth allocated to the highest-priority traffic class can be shared with the second-highest-priority traffic class. When the bandwidth latch switch is on, it means that the bandwidth allocated to the highest-priority traffic class is not shared with the second-highest-priority traffic class. When the bandwidth latch switch is on, it can be represented by 1, that is, the switch is in the on state. When the bandwidth latch switch is off, it can be represented by 0, that is, the switch is in the off state.
[0049] Optionally, the traffic shaping mode can be credit-based traffic shaping, i.e., credit traffic shaping, or token-based traffic shaping, i.e., token bucket traffic shaping. When the traffic shaping mode is credit-based traffic shaping, the counter corresponding to the traffic shaping mode is a credit counter. When the traffic shaping mode is token bucket traffic shaping, the counter corresponding to the traffic shaping mode is a token counter.
[0050] Optionally, the counter supporting deficits can mean that the counter can record negative values.
[0051] Optionally, the maximum packet length supported by the vehicle-mounted system can be 2000 bytes, and the bit width of the counter can be 28 bit.
[0052] S13. Based on the counter, perform traffic shaping on the request queue associated with the queue request signal. The credit increment or token bucket increment of the request queue is increased by a flag signal every fixed time period.
[0053] Optionally, the request queue associated with the queue request signal may refer to the request queue determined according to the indication of the queue request signal. The request queue may refer to a queue with packet applications to be processed. The flag signal may be a binary signal. When the binary signal is 1, it may represent a high level, indicating that the queue is not empty, that is, there are requests to be processed. When the binary signal is 0, it may represent a low level, indicating that the queue is empty, that is, there are no requests to be processed.
[0054] Optionally, the fixed time period may be 128 ns. The increment of the credit amount for each increase can be flexibly set according to the shaping rate of the queue. This embodiment does not clearly limit this. Each increase of 1 in the credit amount represents 0.002048 bit. In this embodiment, the credit amount counter is updated every 128 ns, which can reduce the waiting delay of the frame in the queue and improve the accuracy of traffic shaping.
[0055] Optionally, during the packet sending of the request queue, when the traffic shaping of the request queue is credit-based traffic shaping, the credit amount is deducted while the credit amount is increased. The credit amount change slope can be expressed as L = -portrate + rate, where portrate represents the maximum bandwidth of the port where the request queue is located, and rate represents the shaping rate of the request queue. When the traffic shaping of the request queue is token bucket traffic shaping, the credit amount can be replaced by tokens. The bucket filling time granularity is still 128 ns, and the shaping rate step is still 16 Kbps. The difference from credit-based traffic shaping is that token bucket traffic shaping does not empty the tokens when the queue is empty, while credit-based traffic shaping can empty the credit amount when the queue is empty. Therefore, token bucket traffic shaping can support large traffic bursts.
[0056] According to the above description, the traffic shaping method includes: obtaining a queue request signal; based on the traffic shaping mode of the queue in the port of the vehicle-mounted system, allocating a counter corresponding to the traffic shaping mode to the queue. The counter is a credit amount counter or a token counter, and the counter supports deficit and can store several maximum packet lengths supported by the vehicle-mounted system; based on the counter, perform traffic shaping on the request queue associated with the queue request signal. The credit amount increment or token bucket increment of the request queue is increased through a flag signal within a fixed period.
[0057] In the traffic shaping method, traffic shaping based on the counter can improve the accuracy of traffic shaping. And the vehicle-mounted system supports credit-based and token-based traffic shaping methods, making the vehicle-mounted system more flexible.
[0058] Figure 2It is a flowchart showing an implementation method for shaping the traffic of the request queue associated with the queue request signal based on the counter according to an embodiment of the present disclosure. As Figure 2 shown, this embodiment provides an implementation method for shaping the traffic of the request queue associated with the queue request signal based on the counter, including:
[0059] S21. When the port enables the audio - video traffic reservation function and the bandwidth latch switch is off, perform traffic shaping on the request queue associated with the queue request signal based on the shared bandwidth of the highest - priority traffic class and the second - highest - priority traffic class and the timer.
[0060] Optionally, the highest - priority traffic class can be mapped to the first queue, the second - highest - priority traffic class can be mapped to the second queue, and the shared bandwidth of the highest - priority traffic class and the second - highest - priority traffic class can refer to the bandwidth of the optimal - priority traffic class shared with the second - highest - priority traffic class, which can be specifically implemented through credit sharing between the first queue and the second queue. The traffic shaping can be credit - based traffic shaping, and this embodiment will not elaborate on this.
[0061] For example, a port can have 8 queues, and the priorities of queues 0 to 7 are in an increasing relationship. Queue 7 has the highest priority, and queue 0 has the lowest priority. The first queue can be queue 7, and the second queue can be queue 6.
[0062] Optionally, performing traffic shaping on the request queue associated with the queue request signal can refer to performing credit - based traffic shaping on the request queue associated with the queue request signal.
[0063] S22. When the port enables the audio - video traffic reservation function and the bandwidth latch switch is on, perform credit - based traffic shaping on the request queue associated with the queue request signal based on the counter.
[0064] Optionally, when the port enables the audio - video traffic reservation function and the bandwidth latch switch is on, the implementation method for performing credit - based traffic shaping on the request queue associated with the queue request signal based on the counter includes: when the port enables the audio - video traffic reservation function and the bandwidth latch switch is on, perform credit - based traffic shaping on the request queue associated with the queue request signal based on the credit counter.
[0065] Optionally, when the port enables the audio and video traffic reservation function and the bandwidth latch switch is on, the request queue includes a first queue and a second queue. The first queue is the queue mapped to the highest priority traffic class, and the second queue is the queue mapped to the second highest priority traffic class. The counter includes a third credit counter and a fourth credit counter. The third credit counter is used to record the credit value that the first queue can use, and the fourth credit counter is used to record the credit value that the second queue can use.
[0066] S23. When the port does not enable the audio and video traffic reservation function, perform token bucket traffic shaping on the request queue associated with the queue request signal based on the counter.
[0067] Optionally, when the port does not enable the audio and video traffic reservation function, the implementation method of performing token bucket traffic shaping on the request queue associated with the queue request signal based on the counter includes: when the port does not enable the audio and video traffic reservation function, perform token bucket traffic shaping on the request queue associated with the queue request signal based on the token counter.
[0068] Figure 3 is a flowchart showing the implementation method of traffic shaping on the request queue associated with the queue request signal based on the shared bandwidth of the highest priority traffic class and the second highest priority traffic class and the timer when the port enables the audio and video traffic reservation function and the bandwidth latch switch is off in an embodiment of the present disclosure. As Figure 3 shown, this embodiment provides an implementation method of traffic shaping on the request queue associated with the queue request signal based on the shared bandwidth of the highest priority traffic class and the second highest priority traffic class and the timer when the port enables the audio and video traffic reservation function and the bandwidth latch switch is off, including:
[0069] The request queue includes a first queue and a second queue. The first queue is the queue mapped to the highest priority traffic class, and the second queue is the queue mapped to the second highest priority traffic class. The counter includes a first credit counter and a second credit counter. The first credit counter is used to record the credit value that the first queue can use, and the second credit counter is used to record the credit value that the first queue and the second queue can use.
[0070] S31. When the first queue is not empty, increase the credit increment of the first queue on both the first credit counter and the second credit counter at the same time.
[0071] Optionally, the credit increment of the first queue may refer to the credit increment that the first queue increases every fixed time period through a flag signal.
[0072] Optionally, the first credit counter, the second credit counter, the third credit counter, and the fourth credit counter are used to distinguish the counting methods of the credit counters when the bandwidth latch switch is turned on or off. The first credit counter and the third credit counter may be the same counter, and the second credit counter and the fourth credit counter may be the same counter.
[0073] S32. When the second queue is not empty, increase the credit increment of the second queue on the second credit counter.
[0074] Optionally, the credit increment of the second queue may refer to the credit increment that the second queue increases every fixed time period through a flag signal.
[0075] S33. When the packet in the first queue is scheduled, the values of the first credit counter and the second credit counter both decrease.
[0076] Optionally, when the packet in the first queue is scheduled, the credit decrease slope of the value of the first credit counter is the first slope, and the credit decrease slope of the value of the second credit counter is the second slope; when the first queue is not empty, the credit increment slope of the value of the second credit counter is the third slope.
[0077] Optionally, the first slope is expressed as:
[0078] L1 = -portrate + rate1
[0079] where L1 represents the first slope, portrate represents the maximum bandwidth of the port, and rate1 represents the shaping rate of the first queue.
[0080] The second slope is expressed as:
[0081] L2 = -portrate + rate1 + rate2
[0082] where L2 represents the second slope, and rate2 represents the shaping rate of the second queue;
[0083] The third slope is expressed as:
[0084] L3 = rate1 + rate2s
[0085] Wherein, 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.
[0086] S34, when the packets in the second queue are scheduled, the value of the second credit counter decreases.
[0087] S35, when both the first credit counter and the second credit counter are non - negative, the first queue is allowed to output.
[0088] S36, when the second credit counter is non - negative, the second queue is allowed to output.
[0089] In an embodiment of the present disclosure, the in - vehicle system clock is 125Mhz (megahertz), and the flag signal is pulled high every 128ns (nanoseconds) to simultaneously judge all queues, and the queues that meet the conditions increase the credit. That is, each increase of 1 in the credit represents 0.002048bit (bit). Then, when the known shaping rate is rate, the value of the credit to be increased each time is: credit = rate / 16bps, where the unit of rate is bps (bit rate), and credit represents the credit.
[0090] The system supports a maximum packet length of 2000 bytes, allows multiple maximum packet lengths to be stored in the counter, and supports counter deficits, so the counter bit - width allocated to each queue is 28bit.
[0091] In this design method, the credit counter is updated in time every 128ns. Then, it is possible that at the previous 128ns, the credit counter of a queue is still negative, but at this time, there are packets in the queue waiting to be output. Because the credit counter is negative, the packets cannot be output. But until the next 128ns, the credit counter accumulates to 0 or a positive value, then the packets waiting in the queue will be output as soon as possible, reducing the delay of the packets waiting within 128ns and reducing the total line delay of the packets. However, since each queue is allocated a 28bit counter, when the number of ports is larger, the number of counter bits used is more, and the occupied resources are larger. Therefore, this design is suitable for systems with a small number of ports.
[0092] 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. When the queue is configured in the token - bucket traffic shaping mode, the counter allocated to the queue is the token bucket. The bucket - filling time granularity is still 128ns, and the shaping rate step is still 16Kbps (kilobit rate). Compared with credit - based traffic shaping, token - bucket traffic shaping does not empty the tokens when the queue is empty, so it can support a large traffic burst.
[0093] In this system, a queue request signal with a width of [N*8-1:0] is required to indicate whether there is a packet application to be processed for each queue within each port. At a certain moment, multiple queues within a port may initiate requests simultaneously, but only one queue will be responded to.
[0094] This system supports that when there is remaining bandwidth for the highest-priority traffic class, it can be used by the second-highest-priority queue. The system is set to map the highest-priority traffic class to queue 7 and the second-highest-priority traffic class to queue 6. Each port has an audio-video stream bandwidth latch switch to control whether the bandwidth allocated to the highest-priority traffic class is shared with the second-highest-priority traffic class. When it is 0, it means the bandwidth can be shared; when the stream bandwidth latch switch is 1, it means the bandwidth allocated to the highest priority is locked, and even if there is remaining bandwidth in this queue, the remaining bandwidth will not be given to the second-highest priority.
[0095] The implementation method is that when the port supports the audio-video traffic reservation function, to reduce the design complexity, it is set to map traffic reservation class A to queue 7 and traffic reservation class B to queue 6. Both queue 7 and queue 6 enable credit-based traffic shaping. If the value of the configured bandwidth latch switch is 0, then the credit counter A7 records the available credit value for queue 7, and the credit counter A6 records the available credit values for queue 7 and queue 6. When a packet in queue 7 is scheduled, both A7 and A6 will deduct credit. When a packet in queue 6 is scheduled out, only the credit of A6 is deducted. Only when both A7 and A6 are non-negative, queue 7 is allowed to output; as long as A6 is non-negative, queue 6 is allowed to output.
[0096] As long as queue 7 is not empty, the credit increment C7 of queue 7 needs to be added to both A7 and A6 simultaneously. If queue 6 is not empty, then the credit increment C6 of queue 6 needs to be added to A6. Then the deduction and increase situations of the credit counters of the two queues are as Figure 1 shown. Among them, L0 represents the situation of the credit growth of queue 6, L0 = rate7 + rate6. L2 represents the situation of the credit growth of queue 7, L2 = rate7. During packet transmission, while deducting credit, credit also needs to be increased. L3 represents the slope of the credit decline of queue 7, L3 = -portrate + rate7. L1 represents the situation of the credit decline of queue 6, L1 = -portrate + rate7 + rate6. In Figure 1 the figure, the rising slopes of all the light gray lines are the same, and the falling slopes of all the light gray lines are the same. The rising slopes of all the dark gray lines are the same, and the falling slopes of all the dark gray lines are also the same. This can not only reduce the computational complexity but also achieve the purpose of bandwidth sharing.
[0097] When the port supports the audio - video traffic reservation function, both queue 7 and queue 6 enable credit - based traffic shaping, map traffic reservation class A to queue 7, and map traffic reservation class B to queue 6. If the bandwidth latch switch is configured to 1, the bandwidth of queue 7 will not be shared with queue 6. Then, queue 7 uses A7 to record the credit, and queue 6 uses A6 to record the credit. The credit counters of A7 and A6 exhibit the effect of credit - based traffic shaping.
[0098] From Figure 5 and Figure 6 As can be seen from the comparison between the two figures, when queue 7 (Q7) does not share the remaining bandwidth with queue 6 (Q6), Figure 6 the bandwidth of queue 7 is wasted during the period from T3 to T5. For other queues that enable credit - based traffic shaping, the presented effect is the same as that of queue 7 and queue 6 in the figure. Frame1, Frame2, Frame3, Frame4 represent frame 1, frame 2, frame 3, and frame 4 respectively, wait represents waiting, send represents sending, Q5 represents queue 5, and Credit represents credit.
[0099] If a port does not enable the audio - video traffic reservation function, then when traffic shaping is required, the token - bucket - based traffic shaping algorithm is used. The token - bucket algorithm supports deficits. The bucket will be continuously filled and will no longer increase the tokens to maintain the bucket depth after reaching the bucket depth. The larger the bucket depth is set, the larger the supported traffic burst is. The credit - based traffic shaping of queue 7 and queue 6 can be as Figure 7 shown, Token represents the token, and this embodiment will not elaborate on this.
[0100] The protection scope of the 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.
[0101] Figure 8 is a schematic structural diagram showing the traffic shaping device in the embodiments of the present disclosure. As Figure 8 shown, this embodiment provides a traffic shaping device 80, and the traffic shaping device 80 includes:
[0102] A signal acquisition module 810, configured to acquire a queue request signal.
[0103] A counter allocation module 820, configured to allocate a counter corresponding to the traffic shaping mode to the queue based on the traffic shaping mode of the queues in the port within the vehicle system. The counter is a credit counter or a token counter, the counter supports deficits and can store several maximum packet lengths supported by the vehicle system.
[0104] A traffic shaping module 830 is configured to perform traffic shaping on a request queue associated with the queue request signal based on the counter, and a credit increment or token bucket increment of the request queue is increased within a fixed period by a flag signal.
[0105] The signal acquisition module 810 corresponds to step S11 one by one, the counter allocation module 820 corresponds to step S12 one by one, and the traffic shaping module 830 corresponds to step S13 one by one.
[0106] 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 merely 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 mutual coupling or direct coupling or communication connection may be through some interfaces. The indirect coupling or communication connection of devices or modules or units can be in electrical, mechanical or other forms.
[0107] The modules / units described as separate components may or may not be physically separated. The components displayed as modules / units may or may not be physical modules, that is, they may be located in one place, or may be 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.
[0108] 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 composition and steps of each example have been generally described according to 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. 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 to exceed the scope of the present disclosure.
[0109] Figure 9 is a schematic block diagram of an electronic terminal provided by an embodiment of the present application. As Figure 9As shown, the electronic terminal 900 includes: at least one processor 901, a memory 902, at least one network interface 903, and a user interface 905. Each component in the device is coupled together through a bus system 904. It can be understood that the bus system 904 is used to implement the connection and communication between these components. In addition to the data bus, the bus system 904 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clear illustration, in Figure 9 all kinds of buses are labeled as the bus system.
[0110] Among them, the user interface 905 may include a display, a keyboard, a mouse, a trackball, a click gun, a key, a button, a touchpad, or a touch screen, etc.
[0111] It can be understood that the memory 902 can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can 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.
[0112] The memory 902 in the embodiments of the present invention is used to store various categories of data to support the operation of the electronic terminal 900. Examples of these data include: any executable program for operating on the electronic terminal 900, such as an operating system 9021 and application programs 9022; the operating system 9021 contains 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 programs 9022 can 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 can be included in the application programs 9022.
[0113] The method disclosed in the embodiments of the present invention described above can be applied to, or implemented by, the processor 901. The processor 901 may be an integrated circuit chip with the ability to process signals. During implementation, the steps of the above method can be completed by the integrated logic circuit in hardware in the processor 901 or by instructions in software form. The above-mentioned processor 901 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 901 can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor 901 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 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.
[0114] In an exemplary embodiment, the electronic terminal 900 may be one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), or complex programmable logic devices (CPLDs) for executing the foregoing method.
[0115] 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. 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 data center that includes one or more integrated 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 disk (SSD)), etc.
[0116] 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, the processes or functions according to the embodiments of the present disclosure are generated in whole or in part. 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 by wire (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wirelessly (such as infrared, wireless, microwave, etc.).
[0117] 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.
[0118] The descriptions of the processes or structures corresponding to the above respective drawings have their own emphases. For parts not detailed in a certain process or structure, reference may be made to the relevant descriptions of other processes or structures.
[0119] The above embodiments merely illustrate the principles and effects of the present disclosure, rather than limiting 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 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 traffic shaping method, characterized in that Applied to a vehicle-mounted system, the traffic shaping method includes: Obtain a queue request signal; Based on the traffic shaping mode of the queue in the port of the vehicle-mounted system, allocate a counter corresponding to the traffic shaping mode to the queue. The counter is a credit counter or a token counter, and the counter supports deficits and can store a number of the maximum packet lengths supported by the vehicle-mounted system; Based on the counter, perform traffic shaping on the request queue associated with the queue request signal. The credit increment or token bucket increment of the request queue is increased by a flag signal every fixed time period.
2. The traffic shaping method according to claim 1, wherein The port has an audio-video stream bandwidth latch switch for controlling whether the bandwidth allocated to the highest-priority traffic class is shared with the second-highest-priority traffic class; When the bandwidth latch switch is off, it means that the bandwidth allocated to the highest-priority traffic class can be shared with the second-highest-priority traffic class; When the bandwidth latch switch is on, it means that the bandwidth allocated to the highest-priority traffic class is not shared with the second-highest-priority traffic class.
3. The traffic shaping method according to claim 2, wherein The implementation method of performing traffic shaping on the request queue associated with the queue request signal based on the counter includes: When the port enables the audio-video traffic reservation function and the bandwidth latch switch is off, perform traffic shaping on the request queue associated with the queue request signal based on the shared bandwidth of the highest-priority traffic class and the second-highest-priority traffic class and the timer; When the port enables the audio-video traffic reservation function and the bandwidth latch switch is on, perform credit traffic shaping on the request queue associated with the queue request signal based on the counter; When the port does not enable the audio-video traffic reservation function, perform token bucket traffic shaping on the request queue associated with the queue request signal based on the counter.
4. The traffic shaping method according to claim 3, wherein When the port enables the audio-video traffic reservation function and the bandwidth latch switch is off, the implementation method of performing traffic shaping on the request queue associated with the queue request signal based on the shared bandwidth of the highest-priority traffic class and the second-highest-priority traffic class and the timer includes: The request queue includes a first queue and a second queue. The first queue is the queue mapped by the highest-priority traffic class, and the second queue is the queue mapped by the second-highest-priority traffic class; The counter includes a first credit counter and a second credit counter. The first credit counter is used to record the credit value that the first queue can use, and the second credit counter is used to record the credit value that the first queue and the second queue can use; When the first queue is not empty, increase the credit increment of the first queue on both the first credit counter and the second credit counter at the same time; When the second queue is not empty, increase the credit increment of the second queue on the second credit counter; When the packet in the first queue is scheduled, the values of both the first credit counter and the second credit counter decrease; When the packets in the second queue are scheduled, the value of the second credit counter decreases; When both the first credit counter and the second credit counter are non - negative, the first queue is allowed to output; When the second credit counter is non - negative, the second queue is allowed to output.
5. The traffic shaping method according to claim 4, wherein When the port enables the audio - video traffic reservation function and the bandwidth latch switch is on, The request queue includes a first queue and a second queue. The first queue is the queue mapped by the highest - priority traffic class, and the second queue is the queue mapped by the second - highest - priority traffic class; The counters include a third credit counter and a fourth credit counter. The third credit counter is used to record the credit value that the first queue can use, and the fourth credit counter is used to record the credit value that the second queue can use.
6. The traffic shaping method according to claim 4, characterized in that: When the packets in the first queue are scheduled, the credit reduction slope of the value of the first credit counter is the first slope, and the credit reduction slope of the value of the second credit counter is the second slope; When the first queue is not empty, the credit increment slope of the value of the second credit counter is the third slope.
7. The traffic shaping method according to claim 6, characterized in that: The first slope is expressed as: L1 = -portrate + rate1 where L1 represents the first slope, portrate represents the maximum port bandwidth, and rate1 represents the shaping rate of the first queue; The second slope is expressed as: L2 = -portrate + rate1 + rate2 where L2 represents the second slope, and rate2 represents the shaping rate of the second queue; The third slope is expressed as: L3 = rate1 + rate2 where L3 represents the third slope.
8. A traffic shaping device, characterized in that, It includes: A signal acquisition module, used to acquire queue request signals; A counter allocation module, used to allocate a counter corresponding to the traffic shaping mode to the queue based on the traffic shaping mode of the queues in the port of the vehicle system. The counter is a credit counter or a token counter, and the counter supports deficits and can store several maximum packet lengths supported by the vehicle system; A traffic shaping module, used to perform traffic shaping on the request queue associated with the queue request signal based on the counter. The credit increment or token bucket increment of the request queue is increased by a flag signal within a fixed period.
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
Method and apparatus for allocating reservation bandwidth of traffic
CN101808033A
Broadband management method and device and communication equipment
CN110290073A
Token updating system and method for traffic shaper
CN113645147A
Guaranteed bandwidth sharing in a traffic shaping system
US8032653B1