Traffic shaping method, apparatus, medium, and electronic terminal
By using credits and token counters for traffic shaping in the vehicle system, the problem of low traffic shaping accuracy in the vehicle Ethernet system is solved, achieving more efficient bandwidth utilization and lower latency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- JLSEMI LTD
- Filing Date
- 2025-04-30
- Publication Date
- 2026-07-03
AI Technical Summary
In automotive Ethernet systems, existing traffic shaping methods suffer from low traffic shaping accuracy, resulting in low bandwidth utilization and high latency.
Traffic shaping is performed using credit counters and token counters. The counters accurately shape the queue request signals, supporting traffic shaping methods based on credit and tokens. A bandwidth latch switch controls bandwidth sharing between the highest and second-highest priority traffic classes.
It improves the accuracy and flexibility of traffic shaping, optimizes bandwidth utilization, reduces queue waiting latency, and enhances the traffic management capabilities of the vehicle system.
Smart Images

Figure CN120358200B_ABST
Abstract
Description
Technical Field
[0001] This disclosure pertains to the field of vehicular Ethernet and relates to traffic shaping methods, particularly to traffic shaping methods, apparatus, media, and electronic terminals. Background Technology
[0002] In automotive Ethernet technology, traffic reservation is a key technology, primarily used to reserve bandwidth for critical audio and video streams. For ports supporting audio and video streams, the system must be able to allocate bandwidth across the eight queues within that port to ensure that the traffic passing through each queue meets expectations. Credit-based traffic shaping is a necessary bandwidth control method within traffic reservation technology. Its function is to limit specific types of traffic to their allocated bandwidth and prevent these specific traffic bursts. To prevent these specific types of traffic from consuming all the bandwidth of a port, the protocol stipulates that the bandwidth allocation for reserved traffic cannot exceed 75% of the port's bandwidth. In automotive systems, it is also necessary to support the forwarding and processing of ordinary streams, such as entertainment-type audio and video streams. This type of traffic has a lower priority and is allocated relatively less bandwidth; the system uses a token bucket algorithm for its traffic shaping. For critical audio and video streams, to ensure successful transmission between terminals in the bridge, the system often allocates a large amount of bandwidth. Sometimes, this bandwidth cannot be fully utilized for a certain period of time or even throughout the entire process, resulting in a waste of the total port bandwidth. To improve the utilization of port bandwidth, the flow reservation protocol allows the system to decide whether to allocate the remaining traffic to the next lower priority queue when there is remaining traffic in a high-priority queue of the port.
[0003] In vehicular Ethernet systems, precise timing of the arrival of each packet in the audio / video stream at network nodes is crucial, along with low latency during transmission between nodes. Credit-based traffic shaping requires extremely fine time granularity when increasing credits. Smaller time granularity introduces less error, but current traffic shaping methods suffer from low accuracy. Summary of the Invention
[0004] The purpose of this disclosure is to provide a flow shaping method, apparatus, medium, and electronic terminal to address the current problem of low flow shaping accuracy.
[0005] In a first aspect, embodiments of this disclosure provide a traffic shaping method applied to an in-vehicle system. The traffic shaping method includes: acquiring a queue request signal; allocating a counter corresponding to the traffic shaping mode to the queue based on the traffic shaping mode of the queue within the port of the in-vehicle system, wherein the counter is a credit counter or a token counter, the counter supports deficits and can store several maximum packet lengths supported by the in-vehicle system; and performing traffic shaping on the request queue associated with the queue request signal based on the counter, wherein the credit increment or token increment of the request queue is increased at fixed time intervals by a flag signal.
[0006] In the described traffic shaping method, traffic shaping accuracy can be improved by performing traffic shaping based on the counter. Furthermore, the in-vehicle system supports both credit-based and token-based traffic shaping methods, making the in-vehicle system more flexible.
[0007] In one embodiment of this 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 closed, 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 open, it means that the bandwidth allocated to the highest priority traffic class is not shared with the second highest priority traffic class.
[0008] In one embodiment of this disclosure, the method for traffic shaping of 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 traffic shaping on the request queue associated with the queue request signal based on the counter; and 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 one embodiment of this disclosure, when the port enables audio / video traffic reservation and the bandwidth latch switch is closed, a 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, includes: the request queue includes a first queue and a second queue, the first queue being the queue mapped to the highest priority traffic class, and the second queue being 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 being used to record the credit value available to the first queue, and the second credit counter being used to record the credit value available to the first queue and the second credit counter being used to record the credit value available to the first queue and the second credit counter being used to record the credit value available to the second highest priority traffic class. The second queue can use the following credit values: When the first queue is not empty, the credit increment of the first queue is simultaneously increased on both the first credit counter and the second credit counter; when the second queue is not empty, the credit increment of the second queue is increased on the second credit counter; when a message in the first queue is scheduled, the values of both the first and second credit counters are decreased; when a message in the second queue is scheduled, the value of the second credit counter is decreased; when neither the first nor the second credit counter is negative, the first queue is allowed to output; when the second credit counter is not negative, the second queue is allowed to output.
[0010] In one embodiment of this disclosure, when the port enables the audio / video traffic reservation function and the bandwidth latch switch is turned on, the request queue includes a first queue and a second queue, the first queue being the queue mapped to the highest priority traffic class and the second queue being 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 being used to record the credit value that the first queue can use and the fourth credit counter being used to record the credit value that the second queue can use.
[0011] In one embodiment of this disclosure, when a message in the first queue is scheduled, the credit value of the first credit counter decreases at a first slope, and the credit value of the second credit counter decreases at a second slope; when the first queue is not empty, the credit value of the second credit counter increases at a third slope.
[0012] In one embodiment of this disclosure, the first slope is expressed as:
[0013] L1 = -portrate + rate1 =
[0014] Where L1 represents the first slope, portrate represents the maximum port bandwidth, and rate1 represents the shaping rate of the first queue.
[0015] The second slope is expressed as:
[0016] L2 = -portrate + rate1 + rate2 =
[0017] Where 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] Secondly, embodiments of this disclosure provide a traffic shaping device, comprising: a signal acquisition module for acquiring a queue request signal; a counter allocation module for allocating a counter corresponding to the traffic shaping mode to the queue based on the traffic shaping mode of the queue within the port of the vehicle system, wherein 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; and a traffic shaping module for performing traffic shaping on the request queue associated with the queue request signal based on the counter, wherein the credit increment or token bucket increment of the request queue is increased within a fixed period by a flag signal.
[0022] Thirdly, this disclosure provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the flow shaping method described in the first aspect.
[0023] Fourthly, this disclosure provides an electronic terminal, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the traffic shaping method according to any one of the first aspects.
[0024] As described above, the flow shaping method, apparatus, medium, and electronic terminal described in this application have the following beneficial effects:
[0025] In the described traffic shaping method, traffic shaping accuracy can be improved by performing traffic shaping based on the counter. Furthermore, the in-vehicle system supports both credit-based and token-based traffic shaping methods, making traffic shaping in the in-vehicle system more flexible. Attached Figure Description
[0026] Figure 1 The diagram shown is a structural schematic of an in-vehicle system according to an embodiment of this disclosure.
[0027] Figure 2 The flowchart shown is a flow chart of a flow shaping method according to an embodiment of this disclosure.
[0028] Figure 3 The flowchart shown is an embodiment of the present disclosure of a method for traffic shaping of the request queue associated with the queue request signal based on the counter.
[0029] Figure 4 This is a flowchart illustrating a 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 turned on, according to an embodiment of this disclosure.
[0030] Figure 5 The diagram shows traffic shaping when queues 7 and 6 share bandwidth according to an embodiment of this disclosure.
[0031] Figure 6 This diagram illustrates traffic shaping when queues 7 and 6 do not share bandwidth, as shown in an embodiment of this disclosure.
[0032] Figure 7 The diagram shows a token bucket-based traffic shaping of queues 7 and 6 according to an embodiment of this disclosure.
[0033] Figure 8 The diagram shown is a structural schematic of the flow shaping device according to an embodiment of this disclosure.
[0034] Figure 9 The diagram shown is a structural schematic of an electronic terminal according to an embodiment of this disclosure. Detailed Implementation
[0035] The following specific examples illustrate the implementation of this disclosure. Those skilled in the art can easily understand other advantages and effects of this disclosure from the content disclosed in this specification. This disclosure can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this disclosure. It should be noted that, unless otherwise specified, the following embodiments and features in the embodiments can be combined with each other.
[0036] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of this disclosure. Therefore, the illustrations only show the components related to this disclosure and are not drawn according to the number, shape and size of the components in actual implementation. In actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.
[0037] The technical solutions of the present disclosure will be described in detail below with reference to the accompanying drawings.
[0038] The principles and implementation methods of the flow shaping method and flow shaping device of this disclosure will be described in detail below, so that those skilled in the art can understand the flow shaping method and flow shaping device of this disclosure without creative effort.
[0039] Figure 1 This is a schematic diagram illustrating the structure of 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 using the input unit 20 and the display unit 10.
[0040] The display unit is a touch screen display, a tablet computer, or an LCD screen without touch control functionality. The input unit includes a touch screen display, a mouse, a knob, or buttons.
[0041] In this embodiment, the display unit and input unit are integrated into the same touchscreen display. Signal input and display are performed solely using the touchscreen display. One end of the I / O switching interface 30 is connected to the touchscreen display, and the other end is connected to the vehicle hardware system 40. Since signal input is entirely handled by the touchscreen display, fewer knobs or buttons are needed, maximizing the use of the vehicle panel for display.
[0042] In other embodiments, the input unit may also include a mouse, a knob, or a button, with the mouse moved using a metal touch panel, or the contents of the vehicle hardware system operated via a knob or button.
[0043] In this embodiment, the I / O switching interface includes a switching controller, a display signal switcher, and an input signal switcher. The switching controller is connected to the display signal switcher and the input signal switcher respectively, and is used to control the display signal switcher and the input signal switcher to switch. The display signal switcher connects the display signal output terminal of the vehicle hardware system to the display unit, and the input signal switcher connects the input signal input terminal of the vehicle hardware system to the input unit respectively, and switches between the two vehicle hardware systems through a switching trigger.
[0044] Figure 2 This is a flowchart illustrating a flow shaping method according to an embodiment of the present disclosure. Figure 1 As shown, this embodiment provides a flow shaping method applied to an in-vehicle system. The flow shaping method includes:
[0045] S11, Get 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 each queue in each port of the vehicle system has a message request for processing, where N is the number of ports of the vehicle system.
[0047] S12, based on the traffic shaping mode of the queue within the port of the vehicle system, allocate a counter corresponding to the traffic shaping mode to the queue. The counter is a credit counter or a token counter. The counter supports deficits and can store several of the maximum packet lengths supported by the vehicle system.
[0048] Optionally, the port includes 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 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. The bandwidth latch switch being on can be represented by 1, meaning the switch is in the on state, and the bandwidth latch switch being off can be represented by 0, meaning the switch is in the off state.
[0049] Optionally, the traffic shaping mode can be credit-based traffic shaping (i.e., credit-based 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-based traffic shaping, the counter corresponding to the traffic shaping mode is a token counter.
[0050] Optionally, the fact that the counter supports deficits may mean that the counter is able to record negative values.
[0051] Optionally, the maximum packet length supported by the vehicle system can be 2000 bytes, and the bit width of the counter can be 28 bits.
[0052] S13, based on the counter, perform traffic shaping on the request queue associated with the queue request signal, wherein the credit increment or token bucket increment of the request queue is increased once every fixed time period by a flag signal.
[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, and the request queue may refer to the queue with message requests for processing. The flag signal may be a binary signal. When the binary signal is 1, it can represent a high level, indicating that the queue is not empty, that is, there is a request to be processed. When the binary signal is 0, it can represent a low level, indicating that the queue is empty, that is, there is no request to be processed.
[0054] Optionally, the fixed time period can be 128 ns. The credit increment can be flexibly set according to the queue's shaping rate. This embodiment does not explicitly limit this; each increment of 1 credit represents 0.002048 bits. This embodiment updates the credit counter every 128 ns, which can reduce the waiting latency of frames in the queue and improve the accuracy of traffic shaping.
[0055] Optionally, during message transmission in the request queue, when the traffic shaping of the request queue is credit-based traffic shaping, credits are increased while credits are decreased. The credit 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, credits can be replaced with tokens. The bucket filling time granularity remains 128ns, and the shaping rate step remains 16Kbps. The difference from credit-based traffic shaping is that token bucket traffic shaping does not clear tokens when the queue is empty, while credit-based traffic shaping can clear credits when the queue is empty. Therefore, token bucket traffic shaping can support large traffic bursts.
[0056] As described above, the traffic shaping method includes: acquiring a queue request signal; allocating a counter corresponding to the traffic shaping mode to the queue based on the traffic shaping mode of the queue within the port of the vehicle system, wherein 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; and performing traffic shaping on the request queue associated with the queue request signal based on the counter, wherein the credit increment or token bucket increment of the request queue is increased within a fixed period through a flag signal.
[0057] In the described traffic shaping method, traffic shaping accuracy can be improved by performing traffic shaping based on the counter. Furthermore, the in-vehicle system supports both credit-based and token-based traffic shaping methods, making the in-vehicle system more flexible.
[0058] Figure 2This is a flowchart illustrating an embodiment of the present disclosure of a method for traffic shaping of a request queue associated with the queue request signal based on the counter. Figure 2 As shown, this embodiment provides a method for traffic shaping of the request queue associated with the queue request signal based on the counter, including:
[0059] S21, when the port enables the audio and video traffic reservation function and the bandwidth latching switch is closed, traffic shaping is performed 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, and the second highest priority traffic class can be mapped to the second queue. The shared bandwidth of the highest priority traffic class and the second highest priority traffic class can refer to the bandwidth shared with the best priority traffic class of the second highest priority traffic class. Specifically, it can be achieved by sharing credits between the first queue and the second queue. The traffic shaping can be credit traffic shaping, which will not be elaborated further in this embodiment.
[0061] For example, a port can have 8 queues, with the priority of queues 0 to 7 increasing in order, 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 queue 6.
[0062] Optionally, traffic shaping of the request queue associated with the queue request signal may refer to traffic shaping of the request queue associated with the queue request signal based on credit score.
[0063] S22, when the port enables the audio and video traffic reservation function and the bandwidth latch switch is turned on, the credit traffic is shaped based on the counter for the request queue associated with the queue request signal.
[0064] Optionally, when the port enables the audio / video traffic reservation function and the bandwidth latch switch is turned on, the method for performing credit 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 turned on, performing credit 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 / video traffic reservation function and the bandwidth latching switch is turned on, the request queue includes a first queue and a second queue, the first queue being the queue mapped to the highest priority traffic class and the second queue being 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 being used to record the credit value that the first queue can use and the fourth credit counter being 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, token bucket traffic shaping is performed on the request queue associated with the queue request signal based on the counter.
[0067] Optionally, when the port does not enable the audio / video traffic reservation function, the method for implementing token bucket traffic shaping of the request queue associated with the queue request signal based on the counter includes: when the port does not enable the audio / video traffic reservation function, performing token bucket traffic shaping of the request queue associated with the queue request signal based on the token counter.
[0068] Figure 3 This is a flowchart illustrating an embodiment of the present disclosure of a method for traffic shaping of a request queue associated with a 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 is enabled for audio / video traffic reservation and the bandwidth latch switch is closed. Figure 3 As shown, this embodiment provides a 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 audio / video traffic reservation and the bandwidth latch switch is closed. The method includes:
[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, the credit increment of the first queue is simultaneously added to the first credit counter and the second credit counter.
[0071] Optionally, the credit increment of the first queue may refer to the credit increment that the first queue increases once every fixed time period through a flag signal.
[0072] Optionally, the first credit count counter, the second credit count counter, the third credit count counter, and the fourth credit count counter are used to distinguish the counting mode of the credit count counter when the bandwidth latch switch is turned on or off. The first credit count counter and the third credit count counter can be the same counter, and the second credit count counter and the fourth credit count counter can be the same counter.
[0073] S32, when the second queue is not empty, increase the credit amount increment of the second queue on the second credit amount counter.
[0074] Optionally, the credit increment of the second queue may refer to the credit increment that the second queue increases once every fixed time period through a flag signal.
[0075] S33, when a message in the first queue is scheduled, the values of both the first credit counter and the second credit counter decrease.
[0076] Optionally, when a message in the first queue is scheduled, the credit value of the first credit counter decreases at a first slope, and the credit value of the second credit counter decreases at a second slope; when the first queue is not empty, the credit value of the second credit counter increases at a 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] Where L3 represents the third slope, and portrate in L1, L2 and L3 can represent the maximum bandwidth of the port where the first queue and the second queue are located.
[0086] S34, when a message in the second queue is scheduled, the value of the second credit counter is decremented.
[0087] S35, when both the first credit counter and the second credit counter are not negative, the first queue is allowed to output.
[0088] S36, when the second credit counter is not negative, the second queue is allowed to output.
[0089] In one embodiment of this disclosure, the vehicle system clock is 125 MHz, and a flag signal is raised every 128 ns (nanoseconds) to simultaneously evaluate all queues. Queues that meet the criteria have their credit increased. That is, each increase of 1 credit represents 0.002048 bits. Therefore, given the shaping rate *rate*, the credit increase each time is: *credit* = *rate* / 16 bps, where *rate* is in bps (bit rate) and *credit* represents 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 each queue is allocated a counter bit width of 28 bits.
[0091] This design updates the credit counter every 128ns. In the previous 128ns, a queue's credit counter might still be negative, even though there are packets waiting to be output. Because the credit counter is negative, they cannot be output. However, after the next 128ns, the credit counter increments to 0 or a positive value, allowing the waiting packets in that queue to be output as quickly as possible, reducing the packet latency to within 128ns and lowering the overall line latency. However, each queue is allocated a 28-bit counter, so the more ports there are, the more bits are used, consuming more resources. Therefore, this design is suitable for systems with a small number of ports.
[0092] This system supports independent traffic shaping switches for each queue, and allows each queue to choose between credit-based traffic shaping and token bucket traffic shaping when traffic shaping is enabled. When a queue is configured for token bucket traffic shaping mode, the counter assigned to that queue is the token bucket. The bucket filling granularity remains 128ns, and the shaping rate step remains 16Kbps (kilobits per second). Compared to credit-based traffic shaping, token bucket traffic shaping does not clear tokens when the queue is empty, thus supporting large traffic bursts.
[0093] This system requires queue request signals with a width of [N*8-1:0] to indicate whether each queue within each port has a message request for processing. At any given time, multiple queues within a port may initiate requests simultaneously, but only one queue will respond.
[0094] This system supports allocating bandwidth to the next highest priority queue when available for the highest priority traffic. The system maps the highest priority traffic class to queue 7 and the next 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 next highest priority traffic class. When the value is 0, bandwidth can be shared; when the stream bandwidth latch switch is 1, the bandwidth allocated to the highest priority is locked, and even if there is bandwidth available in that queue, the remaining bandwidth will not be allocated to the next highest priority.
[0095] The implementation is as follows: When the port supports audio / video traffic reservation, to reduce design complexity, traffic reservation class A is mapped to queue 7, and traffic reservation class B is mapped to queue 6. Both queues 7 and 6 enable credit-based traffic shaping. If the bandwidth latch switch is configured to 0, credit counter A7 records the available credit value for queue 7, and credit counter A6 records the available credit values for both queues 7 and 6. When a packet is scheduled in queue 7, credit is deducted from both A7 and A6 simultaneously; when a packet is scheduled out of queue 6, only credit is deducted from A6. Queue 7 is allowed to output only when both A7 and A6 are non-negative; queue 6 is allowed to output as long as A6 is non-negative.
[0096] If queue 7 is not empty, the credit increment C7 of queue 7 needs to be added to both A7 and A6. If queue 6 is not empty, the credit increment C6 of queue 6 needs to be added to A6. The credit counter deduction and increase for the two queues are as follows: Figure 1 Where L0 represents the increase in credit value for queue 6, L0 = rate7 + rate6. L2 represents the increase in credit value for queue 7, L2 = rate7. During message transmission, credit value is increased while deducting it. L3 represents the slope of the decrease in credit value for queue 7, L3 = -portrate + rate7. L1 represents the decrease in credit value for queue 6, L1 = -portrate + rate7 + rate6. Figure 1 In this model, all light gray lines have the same upward slope, and all light gray lines have the same downward slope. Similarly, all dark gray lines have the same upward slope, and all dark gray lines have the same downward slope. This reduces computational complexity while achieving bandwidth sharing.
[0097] When the port supports audio / video traffic reservation, both queues 7 and 6 enable credit-based traffic shaping, mapping traffic reservation class A to queue 7 and 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. In this case, queue 7 uses A7 to record credits, and queue 6 uses A6. The credit counters of A7 and A6 exhibit the effect of credit-based traffic shaping.
[0098] from Figure 5 and Figure 6 A comparison of the two figures shows that when queue 7 (Q7) does not share the remaining bandwidth with queue 6 (Q6), Figure 6 During the time interval from T3 to T5, the bandwidth of queue 7 is wasted. Other queues that enable credit-based traffic shaping will exhibit the same effect as queues 7 and 6 in the diagram. Frame1, Frame2, Frame3, and Frame4 represent frames 1, 2, 3, and 4 respectively; wait means wait; send means send; Q5 represents queue 5; and Credit represents credit.
[0099] If a port does not enable audio / video traffic reservation, then a token bucket-based traffic shaping algorithm must be used when traffic shaping is required. The token bucket algorithm supports deficits. It continuously fills the bucket, and once the bucket depth is reached, no more tokens are added to maintain that depth. The larger the bucket depth, the larger the supported traffic bursts. Token bucket-based traffic shaping for queues 7 and 6 can be implemented as follows: Figure 7 As shown, Token represents a token, which will not be elaborated further in this embodiment.
[0100] The scope of protection for the flow shaping method described in this disclosure is not limited to the execution order of the steps listed in this embodiment. Any solution implemented by adding, subtracting, or replacing steps in the prior art based on the principles of this disclosure is included within the scope of protection of this disclosure.
[0101] Figure 8 This is a schematic diagram illustrating the structure of a flow shaping device according to an embodiment of the present disclosure. Figure 8 As shown, this embodiment provides a flow shaping device 80, which includes:
[0102] The signal acquisition module 810 is used to acquire queue request signals.
[0103] The counter allocation module 820 is used to allocate a counter corresponding to the traffic shaping mode to the queue based on the traffic shaping mode of the queue in the port of the vehicle system. The counter is a credit counter or a token counter. The counter supports deficit and can store several of the maximum packet lengths supported by the vehicle system.
[0104] The traffic shaping module 830 is 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 within a fixed period by a flag signal.
[0105] The signal acquisition module 810 corresponds one-to-one with step S11, the counter allocation module 820 corresponds one-to-one with step S12, and the flow shaping module 830 corresponds one-to-one with step S13.
[0106] In the several embodiments provided in this disclosure, it should be understood that the disclosed apparatus or method can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of modules / units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or units may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection of apparatuses or modules or units may be electrical, mechanical, or other forms.
[0107] The modules / units described as separate components may or may not be physically separate. The components shown as modules / units may or may not be physical modules; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules / units can be selected to achieve the objectives of the embodiments of this disclosure, depending on actual needs. For example, the functional modules / units in the various embodiments of this disclosure may be integrated into one processing module, or each module / unit may exist physically separately, or two or more modules / units may be integrated into one module / unit.
[0108] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this disclosure.
[0109] Figure 9 This is a schematic block diagram of the electronic terminal provided in an embodiment of this application. 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. The various components in the device are coupled together via a bus system 904. It is understood that the bus system 904 is used to implement communication between these components. In addition to a data bus, the bus system 904 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in… Figure 9 The general will label all buses as bus systems.
[0110] The user interface 905 may include a monitor, keyboard, mouse, trackball, clicker, button, touchpad, or touch screen.
[0111] It is understood that memory 902 can be volatile memory or non-volatile memory, or both. Non-volatile memory can be read-only memory (ROM) or programmable read-only memory (PROM), 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) and synchronous static random access memory (SSRAM). The memories described in the embodiments of this invention are intended to include, but are not limited to, these and any other suitable categories of memory.
[0112] In this embodiment of the invention, the memory 902 is used to store various types of data to support the operation of the electronic terminal 900. Examples of this data include: any executable program for operation on the electronic terminal 900, such as the operating system 9021 and application programs 9022; the operating system 9021 contains various system programs, such as the framework layer, core library layer, driver layer, etc., for implementing various basic services and handling hardware-based tasks. The application program 9022 may contain various applications, such as a media player, browser, etc., for implementing various application services. The probability table update method provided in this embodiment of the invention can be included in the application program 9022.
[0113] The methods disclosed in the above embodiments of the present invention can be applied to or implemented by processor 901. Processor 901 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in processor 901 or by instructions in software form. The 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. Processor 901 can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. General-purpose processor 901 may be a microprocessor or any conventional processor, etc. The steps of the accessory optimization method provided in the embodiments of the present invention can be directly reflected as being executed by a hardware decoding processor, or being executed by a combination of hardware and software modules in the decoding processor. The software module may be located in a storage medium, which is located in memory. The processor reads the information in the memory and combines it with its hardware to complete the steps of the aforementioned method.
[0114] In an exemplary embodiment, the electronic terminal 900 may be used by one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), or complex programmable logic devices (CPLDs) to execute the aforementioned method.
[0115] This disclosure also provides a computer-readable storage medium. Those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing a processor. The program can be stored in a computer-readable storage medium, which is a non-transitory medium, such as random access memory, read-only memory, flash memory, hard disk, solid-state drive, magnetic tape, floppy disk, optical disk, and any combination thereof. The storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., digital video disc (DVD)), or a semiconductor medium (e.g., solid-state drive (SSD)).
[0116] This disclosure also provides a computer program product comprising one or more computer instructions. When the computer instructions are loaded and executed on a computing device, all or part of the processes or functions described in this disclosure are generated. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means.
[0117] When the computer program product is executed by a computer, the computer performs the method described in the foregoing method embodiments. The computer program product can be a software installation package; when the foregoing method is required, the computer program product can be downloaded and executed on the computer.
[0118] The descriptions of the processes or structures corresponding to the above figures each have their own emphasis. For parts of a process or structure that are not described in detail, please refer to the relevant descriptions of other processes or structures.
[0119] The above embodiments are merely illustrative of the principles and effects of this disclosure and are not intended to limit this disclosure. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of this disclosure. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in this disclosure should still be covered by the claims of this disclosure.
Claims
1. A flow shaping method, characterized in that, The flow shaping method, applied to an in-vehicle system, includes: Get queue request signal; Based on the traffic shaping mode of the in-port queue in the vehicle system, a counter corresponding to the traffic shaping mode is allocated to the queue. The counter is a credit counter or a token counter. The counter supports deficits and can store several of the maximum packet lengths supported by the vehicle system. Based on the counter, traffic shaping is performed on the request queue associated with the queue request signal, and the credit increment or token bucket increment of the request queue is increased once every fixed time period by a flag signal. The port has an audio / video stream bandwidth latch switch, which controls 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 closed, 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 open, it means that the bandwidth allocated to the highest priority traffic class is not shared with the second highest priority traffic class. The method for traffic shaping of 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, traffic shaping is performed 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 counter; when the port enables the audio / video traffic reservation function and the bandwidth latch switch is on, credit traffic shaping is performed 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, token bucket traffic shaping is performed on the request queue associated with the queue request signal based on the counter. When the port enables audio / video traffic reservation and the bandwidth latching switch is off, the 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 counter, includes: the request queue includes a first queue and a second queue, the first queue being the queue mapped to the highest priority traffic class, and the second queue being 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 being used to record the credit value that the first queue can use, and the second credit counter being used to record the credit value that the first queue and the second queue can use. The credit value used; when the first queue is not empty, the credit increment of the first queue is simultaneously increased on both the first credit counter and the second credit counter; when the second queue is not empty, the credit increment of the second queue is increased on the second credit counter; when a message in the first queue is scheduled, the values of both the first and second credit counters are decreased; when a message in the second queue is scheduled, the value of the second credit counter is decreased; when both the first and second credit counters are not negative, the first queue is allowed to output; when the second credit counter is not negative, the second queue is allowed to output. When a message in the first queue is scheduled, the credit value of the first credit counter decreases at a first slope, and the credit value of the second credit counter decreases at a second slope; when the first queue is not empty, the credit value of the second credit counter increases at a third slope. 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 Wherein, L3 represents the third slope; When the port enables the audio / video traffic reservation function and the bandwidth latch switch is turned on. The request queue includes a first queue and a second queue, wherein 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 counters include a third credit value counter and a fourth credit value counter. The third credit value counter is used to record the credit value that the first queue can use, and the fourth credit value counter is used to record the credit value that the second queue can use.
2. A flow shaping device, characterized in that, The flow shaping device, applied to an in-vehicle system, includes: The signal acquisition module is used to acquire queue request signals; The counter allocation module is used to allocate a counter corresponding to the traffic shaping mode to the queue based on the traffic shaping mode of the queue in the port of the vehicle system. The counter is a credit counter or a token counter. The counter supports deficit and can store several of the maximum packet lengths supported by the vehicle system. The traffic shaping module is 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 within a fixed period by a flag signal. The port has an audio / video stream bandwidth latch switch, which controls 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 closed, 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 open, it means that the bandwidth allocated to the highest priority traffic class is not shared with the second highest priority traffic class. The method for traffic shaping of 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, traffic shaping is performed 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 counter; when the port enables the audio / video traffic reservation function and the bandwidth latch switch is on, credit traffic shaping is performed 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, token bucket traffic shaping is performed on the request queue associated with the queue request signal based on the counter. When the port enables audio / video traffic reservation and the bandwidth latching switch is off, the 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 counter, includes: the request queue includes a first queue and a second queue, the first queue being the queue mapped to the highest priority traffic class, and the second queue being 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 being used to record the credit value that the first queue can use, and the second credit counter being used to record the credit value that the first queue and the second queue can use. The credit value used; when the first queue is not empty, the credit increment of the first queue is simultaneously increased on both the first credit counter and the second credit counter; when the second queue is not empty, the credit increment of the second queue is increased on the second credit counter; when a message in the first queue is scheduled, the values of both the first and second credit counters are decreased; when a message in the second queue is scheduled, the value of the second credit counter is decreased; when both the first and second credit counters are not negative, the first queue is allowed to output; when the second credit counter is not negative, the second queue is allowed to output. When a message in the first queue is scheduled, the credit value of the first credit counter decreases at a first slope, and the credit value of the second credit counter decreases at a second slope; when the first queue is not empty, the credit value of the second credit counter increases at a third slope. 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 Wherein, L3 represents the third slope; When the port enables the audio / video traffic reservation function and the bandwidth latch switch is turned on. The request queue includes a first queue and a second queue, wherein 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 counters include a third credit value counter and a fourth credit value counter. The third credit value counter is used to record the credit value that the first queue can use, and the fourth credit value counter is used to record the credit value that the second queue can use.
3. 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 flow shaping method according to any one of claims 1.
4. An electronic terminal, comprising a memory, a processor, and a computer program stored in the memory, characterized in that, The processor executes the computer program to implement the flow shaping method of claim 1.