sched: make RED scaling configurable
PATCH v5 1/1 sched: make RED scaling configurable
In reply to a message not in the archiveFrom: Alan Dewar <[email protected]>
The RED code stores the weighted moving average in a 32-bit integer as a pseudo fixed-point floating number with 10 fractional bits. Twelve other bits are used to encode the filter weight, leaving just 10 bits for the queue length. This limits the maximum queue length supported by RED queues to 1024 packets.
Introduce a new API to allow the RED scaling factor to be configured based upon maximum queue length. If this API is not called, the RED scaling factor remains at its default value.
Added some new RED scaling unit-tests to test with RED queue-lengths up to 8192 packets long.
--- lib/librte_sched/rte_red.c | 53 ++++++- lib/librte_sched/rte_red.h | 61 ++++++-- lib/librte_sched/rte_sched_version.map | 7 + test/test/test_red.c | 274 ++++++++++++++++++++++++++++++++- 4 files changed, 373 insertions(+), 22 deletions(-)
lib/librte_sched/rte_red.c +48 -5
@@ -43,6 +43,8 @@static int rte_red_init_done =0 ;/**< Flag to indicate that global initialisation is done */ uint32_t rte_red_rand_val =0 ;/**< Random value cache */ uint32_t rte_red_rand_seed =0 ;/**< Seed for random number generation */ +uint8_t rte_red_scaling =RTE_RED_SCALING ; +uint16_t rte_red_max_threshold =RTE_RED_DEFAULT_QUEUE_LENGTH -1 ;/** * table[i] = log2(1-Wq) * Scale * -1
@@ -66,7 +68,7 @@ __rte_red_init_tables(void)double scale =0.0 ;double table_size =0.0 ; - scale = (double )(1 <<RTE_RED_SCALING ); + scale = (double )(1 << rte_red_scaling); table_size = (double )(RTE_DIM (rte_red_pow2_frac_inv));for (i =0 ; i <RTE_DIM (rte_red_pow2_frac_inv); i++) {
@@ -119,7 +121,7 @@ rte_red_config_init(struct rte_red_config *red_cfg,if (red_cfg ==NULL ) {return -1 ; } -if (max_th >RTE_RED_MAX_TH_MAX ) { +if (max_th > rte_red_max_threshold) {return -2 ; }if (min_th >= max_th) {
@@ -148,11 +150,52 @@ rte_red_config_init(struct rte_red_config *red_cfg, rte_red_init_done =1 ; } - red_cfg->min_th = ((uint32_t ) min_th) << (wq_log2 +RTE_RED_SCALING ); - red_cfg->max_th = ((uint32_t ) max_th) << (wq_log2 +RTE_RED_SCALING ); - red_cfg->pa_const = (2 * (max_th - min_th) * maxp_inv) <<RTE_RED_SCALING ; + red_cfg->min_th = ((uint32_t ) min_th) << (wq_log2 + rte_red_scaling); + red_cfg->max_th = ((uint32_t ) max_th) << (wq_log2 + rte_red_scaling); + red_cfg->pa_const = (2 * (max_th - min_th) * maxp_inv) << + rte_red_scaling; red_cfg->maxp_inv = maxp_inv; red_cfg->wq_log2 = wq_log2;return 0 ; } + +int +rte_red_set_scaling (uint16_t max_red_queue_length) +{ +int8_t count; + +if (rte_red_init_done) +/** +* Can't change the scaling once the red table has been +* computed. +*/ +return -1 ; + +if (max_red_queue_length <RTE_RED_MIN_QUEUE_LENGTH ) +return -2 ; + +if (max_red_queue_length >RTE_RED_MAX_QUEUE_LENGTH ) +return -3 ; + +if (!rte_is_power_of_2 (max_red_queue_length)) +return -4 ; + + count =0 ; +while (max_red_queue_length !=0 ) { + max_red_queue_length >>=1 ; + count++; + } + + rte_red_scaling -= count -RTE_RED_SCALING ; + rte_red_max_threshold = max_red_queue_length -1 ; +return 0 ; +} + +void +__rte_red_reset (void ) +{ + rte_red_init_done =0 ; + rte_red_scaling =RTE_RED_SCALING ; + rte_red_max_threshold =RTE_RED_DEFAULT_QUEUE_LENGTH -1 ; +}
lib/librte_sched/rte_red.h +50 -11
97 lines not on this page · raw message
lib/librte_sched/rte_sched_version.map +7 -0
@@ -29,3 +29,10 @@ DPDK_2.1 { rte_sched_port_pkt_read_color; } DPDK_2.0; + +DPDK_17.08 { + global; + + __rte_red_reset; + rte_red_set_scaling; +} DPDK_2.1;
test/test/test_red.c +268 -6
432 lines not on this page · raw message
Signature · 1 line
2.7.4
Hi Alan,
More issues and questions below:
...<snip>
lib/librte_sched/rte_red.h
Quoted 1 line
lib/librte_sched/rte_red.h renamed from lib/librte_sched/rte_red.c +0
-0
I suggest we use uint32_t for rte_red_scaling and rte_red_max_threshold, even though their values can fit into uint8_t and uint16_t respectively.
lib/librte_sched/rte_red.c rte_red_config_init(struct rte_red_config *red_cfg, · line 173
Quoted 12 lines
lib/librte_sched/rte_red.c +11
-0+int +rte_red_set_scaling (uint16_t max_red_queue_length) +{ +int8_t count; + +if (rte_red_init_done) +/** +* Can't change the scaling once the red table has been +* computed. +*/ +return -1 ;
Is there a reason why we cannot simply reset the scaling here?
Quoted 5 lines
lib/librte_sched/rte_red.c +5
-0+ +if (max_red_queue_length <RTE_RED_MIN_QUEUE_LENGTH ) +return -2 ; + +if (max_red_queue_length >RTE_RED_MAX_QUEUE_LENGTH )
lib/librte_sched/rte_red.c rte_red_config_init(struct rte_red_config *red_cfg, · line 188
Quoted 10 lines
lib/librte_sched/rte_red.c +10
-0+return -3 ; + +if (!rte_is_power_of_2 (max_red_queue_length)) +return -4 ; + + count =0 ; +while (max_red_queue_length !=0 ) { + max_red_queue_length >>=1 ; + count++; + }
This does not look right to me. I think you want to compute the log2 of max_red_queue_length here, but your result (count) is bigger by 1 than it should be, right? When max_red_queue_length = RTE_RED_DEFAULT_QUEUE_LENGTH = 1024, the result should be: count = RTE_RED_SCALING = 10, not 11.
I suggest you use rte_bsf32() function for this purpose.
lib/librte_sched/rte_red.c
Quoted 2 lines
lib/librte_sched/rte_red.c +2
-0+ + rte_red_scaling -= count -RTE_RED_SCALING ;
Why not simply: rte_red_scaling = count?
Quoted 11 lines
lib/librte_sched/rte_red.c +4
-0+ rte_red_max_threshold = max_red_queue_length -1 ; +return 0 ; +} +lib/librte_sched/rte_sched_version.map +0
-0
lib/librte_sched/rte_sched_version.map DPDK_2.1 { · line 38
Quoted 10 lines
lib/librte_sched/rte_sched_version.map +7
-0@@ -29,3 +29,10 @@ DPDK_2.1 { rte_sched_port_pkt_read_color; } DPDK_2.0; + +DPDK_17.08 { + global; + + __rte_red_reset; + rte_red_set_scaling; +} DPDK_2.1;
You need to put the correct DPDK release number here.
You also need to do more work to make sure the share library support is not broken:
-need to increase LIBABIVER in Makefile
-need to update the library .so number in release notes
-need to check that build does not fail for shared libraries
(You can use this patch as example: https://dpdk.org/dev/patchwork/patch/33109/ )
test/test/test_red.c
Quoted 1 line
test/test/test_red.c +0
-0
The RED test code fails to link, please fix:
export RTE_TARGET=x86_64-native-linuxapp-gcc
[ ]$ ~/git_dpdk_red/dpdk$ make -C test/test
make: Entering directory 'dpdk/test/test'
...<snip>
LD test
test_red.o: In function `test_rte_red_init':
test_red.c:(.text+0x2cd): undefined reference to __rte_red_reset' test_red.c:(.text+0x2da): undefined reference to rte_red_set_scaling' test_red.c:(.text+0x2ed): undefined reference to rte_red_max_threshold' test_red.o: In function increase_actual_qsize':
test_red.c:(.text+0x48c): undefined reference to rte_red_scaling' test_red.c:(.text+0x533): undefined reference to rte_red_scaling' test_red.o: In function `enqueue_dequeue_func':
test_red.c:(.text+0x70c): undefined reference to rte_red_scaling' test_red.c:(.text+0x7a5): undefined reference to rte_red_scaling' test_red.o: In function `increase_average_qsize':
test_red.c:(.text+0x95c): undefined reference to rte_red_scaling' test_red.o:test_red.c:(.text+0x9f1): more undefined references to rte_red_scaling' follow
collect2: error: ld returned 1 exit statusdpdk/mk/rte.app.mk:306: recipe for target 'test' failed
make: *** [test] Error 1
make: Leaving directory 'dpdk/test/test'
Regards,
Cristian
Hi Cristian,
Responses inline below.
Regards
Alan
Quoted 7 lines
-----Original Message-----
From: Dumitrescu, Cristian [mailto:[email protected]]
Sent: Thursday, January 11, 2018 1:11 PM
To: [email protected]
Cc: [email protected]; Alan Dewar <[email protected]>; Kantecki, Tomasz <[email protected]>; Singh, Jasvinder <[email protected]>
Subject: RE: [PATCH v5] sched: make RED scaling configurable
Quoted 8 lines
Hi Alan,
More issues and questions below:
...<snip>
lib/librte_sched/rte_red.h
Quoted 1 line
lib/librte_sched/rte_red.h renamed from lib/librte_sched/rte_red.c +0
-0I suggest we use
uint32_tforrte_red_scalingandrte_red_max_threshold, even though their values can fit intouint8_tanduint16_trespectively.
Will do.
Quoted 5 lines
Quoted 5 lines
lib/librte_sched/rte_red.c +4
-0+int +rte_red_set_scaling (uint16_t max_red_queue_length) { +int8_t count; +
Quoted 8 lines
lib/librte_sched/rte_red.c rte_red_config_init(struct rte_red_config *red_cfg, · line 173
Quoted 6 lines
lib/librte_sched/rte_red.c +6
-0+if (rte_red_init_done) +/** +* Can't change the scaling once the red table has been +* computed. +*/ +return -1 ;Is there a reason why we cannot simply reset the scaling here?
Actually we could, but I was originally thinking that you might be happier keeping with a one-time RED initialization function, but then had to introduce the rte_reset_red_scaling function for the unit-tests. I'm happy to do RED reinitialization here, if you are.
Quoted 10 lines
Quoted 10 lines
lib/librte_sched/rte_red.c +10
-0+ +if (max_red_queue_length <RTE_RED_MIN_QUEUE_LENGTH ) +return -2 ; + +if (max_red_queue_length >RTE_RED_MAX_QUEUE_LENGTH ) +return -3 ; + +if (!rte_is_power_of_2 (max_red_queue_length)) +return -4 ; +
Quoted 9 lines
lib/librte_sched/rte_red.c rte_red_config_init(struct rte_red_config *red_cfg, · line 188
Quoted 5 lines
lib/librte_sched/rte_red.c +5
-0+ count =0 ; +while (max_red_queue_length !=0 ) { + max_red_queue_length >>=1 ; + count++; + }This does not look right to me. I think you want to compute the log2 of
max_red_queue_lengthhere, but your result (count) is bigger by 1 than it should be, right? Whenmax_red_queue_length=RTE_RED_DEFAULT_QUEUE_LENGTH= 1024, the result should be: count =RTE_RED_SCALING= 10, not 11.
Well spotted.
Quoted 1 line
I suggest you use
rte_bsf32()function for this purpose.
I wasn't aware of this function, it appears to do the necessary so will do.
Quoted 4 lines
lib/librte_sched/rte_red.c
Quoted 2 lines
lib/librte_sched/rte_red.c +2
-0+ + rte_red_scaling -= count -RTE_RED_SCALING ;Why not simply:
rte_red_scaling= count?
Stupidity on my part! - Will do.
Quoted 13 lines
Quoted 13 lines
lib/librte_sched/rte_red.c +4
-0+ rte_red_max_threshold = max_red_queue_length -1 ; +return 0 ; +} +lib/librte_sched/rte_sched_version.map +0
-0@@ -29,3 +29,10 @@ DPDK_2.1 { rte_sched_port_pkt_read_color;
Quoted 10 lines
lib/librte_sched/rte_sched_version.map DPDK_2.1 { · line 38
Quoted 8 lines
lib/librte_sched/rte_sched_version.map +7
-0} DPDK_2.0; + +DPDK_17.08 { + global; + + __rte_red_reset; + rte_red_set_scaling; +} DPDK_2.1;You need to put the correct DPDK release number here.
Will do.
Quoted 5 lines
You also need to do more work to make sure the share library support is not broken:
(quoted diff) +0
-2-need to increase LIBABIVER in Makefile -need to update the library .so number in release notes -need to check that build does not fail for shared libraries(You can use this patch as example: https://urldefense.proofpoint.com/v2/url?u=https-3A__dpdk.org_dev_patchwork_patch_33109_&d=DwIFAg&c=LFYZ-o9_HUMeMTSQicvjIg&r=MSobi4bsl2plY_3b1jvY6kXt-SHzSxMj5YhuyxfTjJE&m=D7OTgDyX27pcg-xs8N7FQzX4lAkkcPqbPAhJp_IyrNI&s=mCvsqitq8Y6vD3UC-r1WEGtrRp17bsmJaEHGby97zYw&e= )
Okay, I need to look into this stuff - I'll come back with some questions if anything isn't clear.
Quoted 2 lines
test/test/test_red.c
Quoted 1 line
test/test/test_red.c +0
-0The RED test code fails to link, please fix:
Yes - will do.
Quoted 26 lines
export RTE_TARGET=x86_64-native-linuxapp-gcc
[ ]$ ~/git_dpdk_red/dpdk$ make -C test/test
make: Entering directory 'dpdk/test/test'
...<snip>
LD test
test_red.o: In function `test_rte_red_init':
test_red.c:(.text+0x2cd): undefined reference to__rte_red_reset' test_red.c:(.text+0x2da): undefined reference torte_red_set_scaling' test_red.c:(.text+0x2ed): undefined reference torte_red_max_threshold' test_red.o: In functionincrease_actual_qsize':
test_red.c:(.text+0x48c): undefined reference torte_red_scaling' test_red.c:(.text+0x533): undefined reference torte_red_scaling' test_red.o: In function `enqueue_dequeue_func':
test_red.c:(.text+0x70c): undefined reference torte_red_scaling' test_red.c:(.text+0x7a5): undefined reference torte_red_scaling' test_red.o: In function `increase_average_qsize':
test_red.c:(.text+0x95c): undefined reference torte_red_scaling' test_red.o:test_red.c:(.text+0x9f1): more undefined references torte_red_scaling' follow
collect2: error: ld returned 1 exit statusdpdk/mk/rte.app.mk:306: recipe for target 'test' failed
make: *** [test] Error 1
make: Leaving directory 'dpdk/test/test'Regards,
Cristian
Hi Cristian,
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ + rte_red_scaling -= count - RTE_RED_SCALING;Why not simply:
rte_red_scaling= count?
The RED code stores the moving average in a uint32_t as a pseudo floating point number with a fixed sized fractional part of 10 bits.
This allows a maximum queue length of 1024. To support larger queues, the size of the fixed size fractional part needs to be reduced.
To support a maximum queue length of 2048, we need to reduce the size of the fractional part to nine bits, for 4096 reduce the fractional part to eight bits etc.
Hence the "rte_red_scaling -= count - RTE_RED_SCALING;"
It is just coincidence that RTE_RED_SCALING is 10 and 1024 = 2**10.
I hope that's clear, it took me a time to get my head around it again.
Regards
Alan
...<snip>
Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
lib/librte_sched/rte_red.c +4
-0+int +rte_red_set_scaling (uint16_t max_red_queue_length) { +int8_t count; +Quoted 8 lines
lib/librte_sched/rte_red.c rte_red_config_init(struct rte_red_config *red_cfg, · line 173
Quoted 6 lines
lib/librte_sched/rte_red.c +6
-0+if (rte_red_init_done) +/** +* Can't change the scaling once the red table has been +* computed. +*/ +return -1 ;Is there a reason why we cannot simply reset the scaling here?
Quoted 5 lines
Actually we could, but I was originally thinking that you might be happier keeping with a one-time RED initialization function, but then had to introduce the
rte_reset_red_scalingfunction for the unit-tests. I'm happy to do RED reinitialization here, if you are.
Hi Alan,
What is the intention of the new rte_red_set_scaling() function?
1. Is it to be called only once, before any RED object gets created?
2. Is it possible to call it post-init, but in this case any RED object already created are not impacted (they continue to work)?
If the answer is 2, then yes, we could simply drop the __rte_red_reset() and do the RED globals reset as part of the rte_red_set_scaling() function transparently.
If the answer is 1, then we probably need to keep your approach: we need a global rte_red_init_done flag, and rte_red_set_scaling() could only be called at init time before any red objects are created.
I probably need to spend more time assessing all the code implications.
Regards,
Cristian
Quoted 28 lines
-----Original Message-----
From: Dewar, Alan [mailto:[email protected]]
Sent: Friday, January 12, 2018 10:45 AM
To: Dumitrescu, Cristian <[email protected]>; '[email protected]' <[email protected]>
Cc: '[email protected]' <[email protected]>; 'Alan Dewar' <[email protected]>; Kantecki, Tomasz <[email protected]>; Singh, Jasvinder <[email protected]>
Subject: RE: [PATCH v5] sched: make RED scaling configurableHi Cristian,
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ + rte_red_scaling -= count - RTE_RED_SCALING;Why not simply:
rte_red_scaling= count?The RED code stores the moving average in a
uint32_tas a pseudo floating point number with a fixed sized fractional part of 10 bits.
This allows a maximum queue length of 1024. To support larger queues,
the size of the fixed size fractional part needs to be reduced.To support a maximum queue length of 2048, we need to reduce the size of the fractional part to nine bits, for 4096 reduce the fractional part to eight bits etc.
Quoted 8 lines
Hence the "
rte_red_scaling-= count -RTE_RED_SCALING;"It is just coincidence that
RTE_RED_SCALINGis 10 and 1024 = 2**10.I hope that's clear, it took me a time to get my head around it again.
Regards
Alan
Hi Alan,
After taking to Tomasz, I can also confirm you're right, so let's keep your initial proposal here.
This line of code will only work if this function is called once at most (this was my rationale to suggest the change), but this is fine, as this is enforced by testing the red_init flag when this function starts.
Regards,
Cristian
Quoted 47 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Dumitrescu, Cristian
Sent: Friday, January 12, 2018 11:09 AM
To: Dewar, Alan <[email protected]>; '[email protected]' <[email protected]>
Cc: '[email protected]' <[email protected]>; 'Alan Dewar' <[email protected]>; Kantecki, Tomasz <[email protected]>; Singh, Jasvinder <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v5] sched: make RED scaling configurable...<snip>
Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
lib/librte_sched/rte_red.c +4
-0+int +rte_red_set_scaling (uint16_t max_red_queue_length) { +int8_t count; +Quoted 8 lines
lib/librte_sched/rte_red.c rte_red_config_init(struct rte_red_config *red_cfg, · line 173
Quoted 6 lines
lib/librte_sched/rte_red.c +6
-0+if (rte_red_init_done) +/** +* Can't change the scaling once the red table has been +* computed. +*/ +return -1 ;Is there a reason why we cannot simply reset the scaling here?
Quoted 3 lines
Actually we could, but I was originally thinking that you might be happier keeping with a one-time RED initialization function, but then had to introduce the
rte_reset_red_scalingfunction for the unit-tests. I'm happyto
Quoted 2 lines
do RED reinitialization here, if you are.
Hi Alan,
What is the intention of the new
rte_red_set_scaling()function?
1. Is it to be called only once, before any RED object gets created?
2. Is it possible to call it post-init, but in this case any RED object
already created are not impacted (they continue to work)?If the answer is 2, then yes, we could simply drop the
__rte_red_reset()and do the RED globals reset as part of therte_red_set_scaling()function transparently.
Quoted 8 lines
If the answer is 1, then we probably need to keep your approach: we need a global
rte_red_init_doneflag, andrte_red_set_scaling()could only be called at init time before any red objects are created.I probably need to spend more time assessing all the code implications.
Regards,
Cristian
Hi Alan,
After talking to Tomasz, we agreed that 2. Is not an option, as any previously created red object will be broken.
So 1. Is the right answer, therefore this function can be called only once and only before any red objects are created. So, IMO we should do this:
-when rte_red_init_done is true, we need to return error
-when rte_red_init_done is false, we need to perform red initialization and set this flag
Agree?
Please also add a comment in the Doxygen description of rte_red_set_caling() in the rte_red.h file, stating that this function can be called only once and only before any red objects are created.
Regards,
Cristian
Quoted 40 lines
Quoted 40 lines
Quoted 15 lines
Quoted 6 lines
Quoted 6 lines
lib/librte_sched/rte_red.c +4
-0+int +rte_red_set_scaling (uint16_t max_red_queue_length) { +int8_t count; +Quoted 8 lines
lib/librte_sched/rte_red.c rte_red_config_init(struct rte_red_config *red_cfg, · line 173
Quoted 6 lines
lib/librte_sched/rte_red.c +6
-0+if (rte_red_init_done) +/** +* Can't change the scaling once the red table has been +* computed. +*/ +return -1 ;Is there a reason why we cannot simply reset the scaling here?
Quoted 4 lines
Actually we could, but I was originally thinking that you might be happier keeping with a one-time RED initialization function, but then had to introduce the
rte_reset_red_scalingfunction for the unit-tests. I'm happyto
Quoted 2 lines
do RED reinitialization here, if you are.
Hi Alan,
What is the intention of the new
rte_red_set_scaling()function?
1. Is it to be called only once, before any RED object gets created?
2. Is it possible to call it post-init, but in this case any RED
object already created are not impacted (they continue to work)?If the answer is 2, then yes, we could simply drop the
__rte_red_reset()and do the RED globals reset as part of therte_red_set_scaling()function transparently.If the answer is 1, then we probably need to keep your approach: we need a global
rte_red_init_doneflag, andrte_red_set_scaling()could only be called at init time before any red objects are created.I probably need to spend more time assessing all the code implications.
Quoted 8 lines
Quoted 2 lines
Regards,
CristianHi Alan,
After talking to Tomasz, we agreed that 2. Is not an option, as any previously created red object will be broken.
So 1. Is the right answer, therefore this function can be called only once and only before any red objects are created. So, IMO we should do this:
-when rte_red_init_done is true, we need to return error -when rte_red_init_done is false, we need to perform red initialization and set this flag
Quoted 2 lines
Agree?
Yes, as long as you're happy with keeping __rte_red_reset for the unit-tests.
Quoted 1 line
Please also add a comment in the Doxygen description of
rte_red_set_caling()in therte_red.hfile, stating that this function can be called only once and only before any red objects are created.
Will do.
Quoted 2 lines
Regards,
Cristian
PATCH v6 1/1 sched: make RED scaling configurable
In reply to [email protected]From: Alan Dewar <[email protected]>
The RED code stores the weighted moving average in a 32-bit integer as a pseudo fixed-point floating number with 10 fractional bits. Twelve other bits are used to encode the filter weight, leaving just 10 bits for the queue length. This limits the maximum queue length supported by RED queues to 1024 packets.
Introduce a new API to allow the RED scaling factor to be configured based upon maximum queue length. If this API is not called, the RED scaling factor remains at its default value.
Added some new RED scaling unit-tests to test with RED queue-lengths up to 8192 packets long.
--- doc/guides/rel_notes/release_18_02.rst | 2 +- lib/librte_sched/Makefile | 2 +- lib/librte_sched/rte_red.c | 47 +++++- lib/librte_sched/rte_red.h | 63 ++++++-- lib/librte_sched/rte_sched_version.map | 7 + test/test/test_red.c | 274 ++++++++++++++++++++++++++++++++- 6 files changed, 371 insertions(+), 24 deletions(-)
doc/guides/rel_notes/release_18_02.rst +1 -1
@@ -158,7 +158,7 @@ The libraries prepended with a plus sign were incremented in this version. librte_power.so.1 librte_reorder.so.1 librte_ring.so.1 - librte_sched.so.1 + librte_sched.so.2 librte_security.so.1 librte_table.so.3 librte_timer.so.1
lib/librte_sched/Makefile +1 -1
@@ -48,7 +48,7 @@ LDLIBS += -lrte_timer EXPORT_MAP := rte_sched_version.map -LIBABIVER := 1 +LIBABIVER := 2 # # all source are stored in SRCS-y
lib/librte_sched/rte_red.c +42 -5
73 lines not on this page · raw message
lib/librte_sched/rte_red.h +52 -11
99 lines not on this page · raw message
lib/librte_sched/rte_sched_version.map +7 -0
@@ -29,3 +29,10 @@ DPDK_2.1 { rte_sched_port_pkt_read_color; } DPDK_2.0; + +DPDK_18.02 { + global; + + rte_red_set_scaling; + __rte_red_reset_scaling; +} DPDK_2.1;
test/test/test_red.c +268 -6
432 lines not on this page · raw message
Signature · 1 line
2.7.4
On Mon, 15 Jan 2018 16:16:09 +0000
[email protected] wrote:
Looks like a good idea, minor editing feedback.
lib/librte_sched/rte_red.c rte_red_config_init(struct rte_red_config *red_cfg, · line 154
Quoted 5 lines
lib/librte_sched/rte_red.c +2
-3- red_cfg->min_th = ((uint32_t ) min_th) << (wq_log2 +RTE_RED_SCALING ); - red_cfg->max_th = ((uint32_t ) max_th) << (wq_log2 +RTE_RED_SCALING ); - red_cfg->pa_const = (2 * (max_th - min_th) * maxp_inv) <<RTE_RED_SCALING ; + red_cfg->min_th = ((uint32_t ) min_th) << (wq_log2 + rte_red_scaling); + red_cfg->max_th = ((uint32_t ) max_th) << (wq_log2 + rte_red_scaling);
While you are at it remove unnecessary parenthesis here.
lib/librte_sched/rte_red.c rte_red_config_init(struct rte_red_config *red_cfg, · line 156
Quoted 2 lines
lib/librte_sched/rte_red.c +2
-0+ red_cfg->pa_const = (2 * (max_th - min_th) * maxp_inv) << + rte_red_scaling;
It reads easier if the the shift operator on the next line
red_cfg->pa_const = (2 * (max_th - min_th) * maxp_inv) << rte_red_scaling;
Why do functional tests have to be in same file and clutter the code?
Quoted 26 lines
Quoted 15 lines
Quoted 15 lines
Hi Alan,
What is the intention of the new
rte_red_set_scaling()function?
1. Is it to be called only once, before any RED object gets created?
2. Is it possible to call it post-init, but in this case any RED
object already created are not impacted (they continue to work)?If the answer is 2, then yes, we could simply drop the
__rte_red_reset()and do the RED globals reset as part of therte_red_set_scaling()function transparently.If the answer is 1, then we probably need to keep your approach: we need a global
rte_red_init_doneflag, andrte_red_set_scaling()could only be called at init time before any red objects are created.Quoted 8 lines
Quoted 4 lines
I probably need to spend more time assessing all the code implications.
Regards,
CristianHi Alan,
After talking to Tomasz, we agreed that 2. Is not an option, as any
previously created red object will be broken.
Quoted 2 lines
So 1. Is the right answer, therefore this function can be called only once
Quoted 9 lines
and only before any red objects are created. So, IMO we should do this:
-whenrte_red_init_doneis true, we need to return error -whenrte_red_init_doneis false, we need to perform red initialization and set this flagQuoted 2 lines
Agree?
Yes, as long as you're happy with keeping
__rte_red_resetfor the unit-tests.
OK
Quoted 7 lines · Stephen Hemminger
On Mon, 15 Jan 2018 16:16:09 +0000
[email protected] wrote:Looks like a good idea, minor editing feedback.
Quoted 8 lines
lib/librte_sched/rte_red.c rte_red_config_init(struct rte_red_config *red_cfg, · line 154
Quoted 5 lines
lib/librte_sched/rte_red.c +2
-3- red_cfg->min_th = ((uint32_t ) min_th) << (wq_log2 +RTE_RED_SCALING ); - red_cfg->max_th = ((uint32_t ) max_th) << (wq_log2 +RTE_RED_SCALING ); - red_cfg->pa_const = (2 * (max_th - min_th) * maxp_inv) <<RTE_RED_SCALING ; + red_cfg->min_th = ((uint32_t ) min_th) << (wq_log2 + rte_red_scaling); + red_cfg->max_th = ((uint32_t ) max_th) << (wq_log2 + rte_red_scaling);While you are at it remove unnecessary parenthesis here.
Okay will do.
Quoted 8 lines
lib/librte_sched/rte_red.c rte_red_config_init(struct rte_red_config *red_cfg, · line 156
Quoted 2 lines
lib/librte_sched/rte_red.c +2
-0+ red_cfg->pa_const = (2 * (max_th - min_th) * maxp_inv) << + rte_red_scaling;It reads easier if the the shift operator on the next line
red_cfg->pa_const = (2 * (max_th - min_th) * maxp_inv) << rte_red_scaling;
Okay will do.
Quoted 1 line
Why do functional tests have to be in same file and clutter the code?
Do you mean the same patch file or the same unit-test file?
I received feedback previously (might not have been this patch) where I had split the functional changes and the new unit-tests into separate patches and was asked to combine them into a single patch. I like the idea of if you have the fix you also have the new unit-tests.
As for having the new tests in the same file as existing tests, the red tests are table driven so most of the changes to the unit-test code are just adding new table entries to exercise the RED code with a different scaling factor.
Quoted 15 lines · Alan Dewar
Quoted 13 lines · Stephen Hemminger
On Mon, 15 Jan 2018 16:16:09 +0000
[email protected] wrote:Looks like a good idea, minor editing feedback.
Quoted 5 lines
lib/librte_sched/rte_red.c +2
-3- red_cfg->min_th = ((uint32_t ) min_th) << (wq_log2 +RTE_RED_SCALING ); - red_cfg->max_th = ((uint32_t ) max_th) << (wq_log2 +RTE_RED_SCALING ); - red_cfg->pa_const = (2 * (max_th - min_th) * maxp_inv) <<RTE_RED_SCALING ; + red_cfg->min_th = ((uint32_t ) min_th) << (wq_log2 + rte_red_scaling); + red_cfg->max_th = ((uint32_t ) max_th) << (wq_log2 + rte_red_scaling);
Quoted 4 lines
Quoted 2 lines
While you are at it remove unnecessary parenthesis here.
Okay will do.
Ah - the compiler doesn't like it if I remove all the unnecessary parenthesis. it gives the following error:
/home/adewar/git-repos/dpdk/lib/librte_sched/rte_red.c:153:49: error:
suggest parentheses around ‘+’ inside ‘<<’ [-Werror=parentheses]
red_cfg->min_th = (uint32_t) min_th << wq_log2 + rte_red_scaling;
I'll reinstate the ones around the addition.
Quoted 25 lines
Quoted 9 lines
lib/librte_sched/rte_red.c rte_red_config_init(struct rte_red_config *red_cfg, · line 156
Quoted 3 lines
lib/librte_sched/rte_red.c +2
-0+ red_cfg->pa_const = (2 * (max_th - min_th) * maxp_inv) << + rte_red_scaling;It reads easier if the the shift operator on the next line
red_cfg->pa_const = (2 * (max_th - min_th) * maxp_inv) << rte_red_scaling;Okay will do.
Quoted 1 line
Why do functional tests have to be in same file and clutter the code?
Do you mean the same patch file or the same unit-test file?
I received feedback previously (might not have been this patch) where I had split the functional changes and the new unit-tests into separate patches and was asked to combine them into a single patch. I like the idea of if you have the fix you also have the new unit-tests.
As for having the new tests in the same file as existing tests, the red tests are table driven so most of the changes to the unit-test code are just adding new table entries to exercise the RED code with a different scaling factor.
PATCH v7 1/1 sched: make RED scaling configurable
In reply to [email protected]From: Alan Dewar <[email protected]>
The RED code stores the weighted moving average in a 32-bit integer as a pseudo fixed-point floating number with 10 fractional bits. Twelve other bits are used to encode the filter weight, leaving just 10 bits for the queue length. This limits the maximum queue length supported by RED queues to 1024 packets.
Introduce a new API to allow the RED scaling factor to be configured based upon maximum queue length. If this API is not called, the RED scaling factor remains at its default value.
Added some new RED scaling unit-tests to test with RED queue-lengths up to 8192 packets long.
--- doc/guides/rel_notes/release_18_02.rst | 2 +- lib/librte_sched/Makefile | 2 +- lib/librte_sched/rte_red.c | 47 +++++- lib/librte_sched/rte_red.h | 63 ++++++-- lib/librte_sched/rte_sched_version.map | 7 + test/test/test_red.c | 274 ++++++++++++++++++++++++++++++++- 6 files changed, 371 insertions(+), 24 deletions(-)
doc/guides/rel_notes/release_18_02.rst +1 -1
@@ -158,7 +158,7 @@ The libraries prepended with a plus sign were incremented in this version. librte_power.so.1 librte_reorder.so.1 librte_ring.so.1 - librte_sched.so.1 + librte_sched.so.2 librte_security.so.1 librte_table.so.3 librte_timer.so.1
lib/librte_sched/Makefile +1 -1
@@ -48,7 +48,7 @@ LDLIBS += -lrte_timer EXPORT_MAP := rte_sched_version.map -LIBABIVER := 1 +LIBABIVER := 2 # # all source are stored in SRCS-y
lib/librte_sched/rte_red.c +42 -5
73 lines not on this page · raw message
lib/librte_sched/rte_red.h +52 -11
99 lines not on this page · raw message
lib/librte_sched/rte_sched_version.map +7 -0
@@ -29,3 +29,10 @@ DPDK_2.1 { rte_sched_port_pkt_read_color; } DPDK_2.0; + +DPDK_18.02 { + global; + + rte_red_set_scaling; + __rte_red_reset_scaling; +} DPDK_2.1;
test/test/test_red.c +268 -6
432 lines not on this page · raw message
Signature · 1 line
2.7.4
Quoted 39 lines
-----Original Message-----
From: Alan Dewar [mailto:[email protected]]
Sent: Tuesday, January 16, 2018 3:58 PM
To: Stephen Hemminger <[email protected]>
Cc: Dumitrescu, Cristian <[email protected]>; Kantecki, Tomasz <[email protected]>; Singh, Jasvinder <[email protected]>; [email protected]; Alan Dewar <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v6] sched: make RED scaling configurableQuoted 10 lines · Alan Dewar
Quoted 8 lines · Stephen Hemminger
On Mon, 15 Jan 2018 16:16:09 +0000
[email protected] wrote:Looks like a good idea, minor editing feedback.
Quoted 1 line
-
red_cfg->min_th= ((uint32_t)min_th) << (wq_log2+
RTE_RED_SCALING);Quoted 1 line
Quoted 1 line
Quoted 1 line
-
red_cfg->max_th= ((uint32_t)max_th) << (wq_log2+
RTE_RED_SCALING);Quoted 1 line
Quoted 1 line
Quoted 1 line
-
red_cfg->pa_const= (2 * (max_th-min_th) *maxp_inv) <<
RTE_RED_SCALING;Quoted 1 line
Quoted 1 line
Quoted 1 line
+
red_cfg->min_th= ((uint32_t)min_th) << (wq_log2+
rte_red_scaling);Quoted 1 line
Quoted 1 line
Quoted 1 line
+
red_cfg->max_th= ((uint32_t)max_th) << (wq_log2+
rte_red_scaling);Quoted 5 lines
Quoted 3 lines
While you are at it remove unnecessary parenthesis here.
Okay will do.
Quoted 8 lines
Ah - the compiler doesn't like it if I remove all the unnecessary parenthesis. it gives the following error:
/home/adewar/git-repos/dpdk/lib/librte_sched/rte_red.c:153:49: error:
suggest parentheses around ‘+’ inside ‘<<’ [-Werror=parentheses]
red_cfg->min_th= (uint32_t)min_th<<wq_log2+rte_red_scaling;I'll reinstate the ones around the addition.
Alan,
I have a different view here, I suggest we keep the parenthesis as they are, as the code is easier to read and maintain. RED is not the code where you want to play with compiler typecasts and arithmetic.
Regards,
Cristian
Quoted 8 lines · On 1/16/2018 4:07 PM, [email protected] wrote:
From: Alan Dewar <[email protected]>
The RED code stores the weighted moving average in a 32-bit integer as a pseudo fixed-point floating number with 10 fractional bits. Twelve other bits are used to encode the filter weight, leaving just 10 bits for the queue length. This limits the maximum queue length supported by RED queues to 1024 packets.
Quoted 8 lines
Introduce a new API to allow the RED scaling factor to be configured based upon maximum queue length. If this API is not called, the RED scaling factor remains at its default value.
Added some new RED scaling unit-tests to test with RED queue-lengths up to 8192 packets long.
Signed-off-by Alan Dewar <[email protected]>
Hi Cristian, Alan,
The v7 of this patch is sting without any comment for more than a year. What is the status of this patch? Is it still valid? What is blocking it?
For reference patch:
https://patches.dpdk.org/patch/33837/
Hi Ferruh,
We are still using this patch against DPDK 17.11 and 18.11 as part of
the AT&T Vyatta NOS. It is needed to make WRED queues longer than
1024 packets work correctly. I'm afraid that I have no idea what is holding it up from being merged.
Regards
Alan
Quoted 26 lines · Ferruh Yigit
Quoted 8 lines · On 1/16/2018 4:07 PM, [email protected] wrote:
From: Alan Dewar <[email protected]>
The RED code stores the weighted moving average in a 32-bit integer as a pseudo fixed-point floating number with 10 fractional bits. Twelve other bits are used to encode the filter weight, leaving just 10 bits for the queue length. This limits the maximum queue length supported by RED queues to 1024 packets.
Quoted 8 lines
Introduce a new API to allow the RED scaling factor to be configured based upon maximum queue length. If this API is not called, the RED scaling factor remains at its default value.
Added some new RED scaling unit-tests to test with RED queue-lengths up to 8192 packets long.
Signed-off-by Alan Dewar <[email protected]>Hi Cristian, Alan,
The v7 of this patch is sting without any comment for more than a year. What is the status of this patch? Is it still valid? What is blocking it?
For reference patch:
https://patches.dpdk.org/patch/33837/
08/04/2019 10:24, Alan Dewar:
Quoted 24 lines · Ferruh Yigit
Quoted 23 lines · On 1/16/2018 4:07 PM, [email protected] wrote:
Quoted 8 lines
From: Alan Dewar <[email protected]>
The RED code stores the weighted moving average in a 32-bit integer as a pseudo fixed-point floating number with 10 fractional bits. Twelve other bits are used to encode the filter weight, leaving just 10 bits for the queue length. This limits the maximum queue length supported by RED queues to 1024 packets.
Quoted 8 lines
Introduce a new API to allow the RED scaling factor to be configured based upon maximum queue length. If this API is not called, the RED scaling factor remains at its default value.
Added some new RED scaling unit-tests to test with RED queue-lengths up to 8192 packets long.
Signed-off-by Alan Dewar <[email protected]>Hi Cristian, Alan,
The v7 of this patch is sting without any comment for more than a year. What is the status of this patch? Is it still valid? What is blocking it?
Quoted 7 lines
Quoted 2 lines
For reference patch:
https://patches.dpdk.org/patch/33837/We are still using this patch against DPDK 17.11 and 18.11 as part of
the AT&T Vyatta NOS. It is needed to make WRED queues longer than
1024 packets work correctly. I'm afraid that I have no idea what is holding it up from being merged.
It will be in a release when it will be merged in the git tree dpdk-next-qos, managed by Cristian.
Quoted 41 lines
-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Monday, April 8, 2019 9:53 AM
To: Alan Dewar <[email protected]>
Cc: Yigit, Ferruh <[email protected]>; Dumitrescu, Cristian <[email protected]>; Kantecki, Tomasz <[email protected]>; Stephen Hemminger <[email protected]>; [email protected]; Alan Dewar <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v7] sched: make RED scaling configurable08/04/2019 10:24, Alan Dewar:
Quoted 27 lines · Ferruh Yigit
Quoted 25 lines · On 1/16/2018 4:07 PM, [email protected] wrote:
Quoted 8 lines
From: Alan Dewar <[email protected]>
The RED code stores the weighted moving average in a 32-bit integer as a pseudo fixed-point floating number with 10 fractional bits. Twelve other bits are used to encode the filter weight, leaving just 10 bits for the queue length. This limits the maximum queue length supported by RED queues to 1024 packets.
Quoted 8 lines
Introduce a new API to allow the RED scaling factor to be configured based upon maximum queue length. If this API is not called, the RED scaling factor remains at its default value.
Added some new RED scaling unit-tests to test with RED queue-lengths up to 8192 packets long.
Signed-off-by Alan Dewar <[email protected]>Hi Cristian, Alan,
The v7 of this patch is sting without any comment for more than a year. What is the status of this patch? Is it still valid? What is blocking it?
For reference patch:
https://patches.dpdk.org/patch/33837/
Quoted 8 lines
Quoted 4 lines
We are still using this patch against DPDK 17.11 and 18.11 as part of
the AT&T Vyatta NOS. It is needed to make WRED queues longer than
1024 packets work correctly. I'm afraid that I have no idea what is holding it up from being merged.It will be in a release when it will be merged in the git tree dpdk-next-qos, managed by Cristian.
I was hoping to get a review & ACK from Tomasz Kantecki, the author of the WRED code in DPDK, hence the lack of progress on this patch.
08/04/2019 15:29, Dumitrescu, Cristian:
Quoted 34 lines
From: Thomas Monjalon [mailto:[email protected]]
Quoted 33 lines
08/04/2019 10:24, Alan Dewar:
Quoted 31 lines · Ferruh Yigit
Quoted 18 lines · On 1/16/2018 4:07 PM, [email protected] wrote:
Quoted 8 lines
From: Alan Dewar <[email protected]>
The RED code stores the weighted moving average in a 32-bit integer as a pseudo fixed-point floating number with 10 fractional bits. Twelve other bits are used to encode the filter weight, leaving just 10 bits for the queue length. This limits the maximum queue length supported by RED queues to 1024 packets.
Quoted 8 lines
Introduce a new API to allow the RED scaling factor to be configured based upon maximum queue length. If this API is not called, the RED scaling factor remains at its default value.
Added some new RED scaling unit-tests to test with RED queue-lengths up to 8192 packets long.
Signed-off-by Alan Dewar <[email protected]>Quoted 7 lines
Hi Cristian, Alan,
The v7 of this patch is sting without any comment for more than a year. What is the status of this patch? Is it still valid? What is blocking it?
For reference patch:
https://patches.dpdk.org/patch/33837/We are still using this patch against DPDK 17.11 and 18.11 as part of
the AT&T Vyatta NOS. It is needed to make WRED queues longer than
1024 packets work correctly. I'm afraid that I have no idea what is holding it up from being merged.
Quoted 4 lines
Quoted 2 lines
It will be in a release when it will be merged in the git tree dpdk-next-qos, managed by Cristian.
I was hoping to get a review & ACK from Tomasz Kantecki, the author of the WRED code in DPDK, hence the lack of progress on this patch.
It seems nobody was able to provide an feedback after two years, and it was never merged in the QoS git tree.
The handling of this patch is really a shame.
Alan, please rebase this patch.
If nothing is wrong in CI (including ABI check),
I will merge the next version.