[dpdk-dev,v3] sched: make RED scaling configurable

Message ID 1505913120-5521-1-git-send-email-alan.dewar@att.com (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Alan Dewar Sept. 20, 2017, 1:12 p.m. UTC
  From: Alan Dewar <alan.dewar@att.com>

The RED code stores the maximum threshold is 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 as 1024 packets.

Move the "hard" definitions from red.h into config/common_base so that
RED scaling can be configured during build.

Modified the RED unit-tests to use the new "soft" definition of
maximum-threshold from config/common_base in tests where it previously
used a hard coded limit of 1023.

The RED unit-tests all successfully pass when the maximum-threshold is
configured as 8191 and the RED scaling factor is dropped to seven.

Real-world testing has involved RED queue lengths of 8192 with multiple
different settings of the RED config parameters: min_th, max_th, wq_log2
and maxp_inv.

Signed-off-by: Alan Dewar <alan.dewar@att.com>
Acked-by: Tomasz Kantecki <tomasz.kantecki@intel.com>
---
 config/common_base         |  7 +++++++
 lib/librte_sched/rte_red.h |  3 +--
 test/test/test_red.c       | 20 ++++++++++----------
 3 files changed, 18 insertions(+), 12 deletions(-)
  

Comments

Cristian Dumitrescu Sept. 25, 2017, 10:36 a.m. UTC | #1
<snip>...
 
> diff --git a/config/common_base b/config/common_base
> index 5e97a08..2626557 100644
> --- a/config/common_base
> +++ b/config/common_base
> @@ -666,6 +666,13 @@ CONFIG_RTE_SCHED_COLLECT_STATS=n
>  CONFIG_RTE_SCHED_SUBPORT_TC_OV=n
>  CONFIG_RTE_SCHED_PORT_N_GRINDERS=8
>  CONFIG_RTE_SCHED_VECTOR=n
> +#
> +# RTE_RED_SCALING - number of fractional bits used for RED's moving
> average
> +# For every bit that RTE_RED_SCALING is reduced, the max-queue size can
> doubled
> +# RTE_RED_MAX_TH_MAX = (max-queue size - 1), max-queue size must be
> power of two
> +#
> +CONFIG_RTE_RED_SCALING=10
> +CONFIG_RTE_RED_MAX_TH_MAX=1023
> 

Alan, Tomasz,

Thank you for your work!

We generally want to avoid build-time configuration in favour of run-time configuration. Can you please rework this as run-time configuration?

I suggest we add a new API function to configure these parameters globally for all the RED objects (as opposed to per RED object), with the default values as the current values when this function is not called.

So NACK for now.

Regards,
Cristian
  
Dewar, Alan Sept. 26, 2017, 8:02 a.m. UTC | #2
Hi Cristian,

No problem,  it doesn't sounds like it will be too difficult. 

Unfortunately I'm in the middle of another piece of work, so it will probably be a couple of weeks before I get around to it.

Regards
Alan

-----Original Message-----
From: Dumitrescu, Cristian [mailto:cristian.dumitrescu@intel.com] 
Sent: Monday, September 25, 2017 11:37 AM
To: alangordondewar@gmail.com; Kantecki, Tomasz <tomasz.kantecki@intel.com>
Cc: dev@dpdk.org; Alan Dewar <alan.dewar@att.com>
Subject: RE: [dpdk-dev] [PATCH v3] sched: make RED scaling configurable

<snip>...
 
> diff --git a/config/common_base b/config/common_base index 
> 5e97a08..2626557 100644
> --- a/config/common_base
> +++ b/config/common_base
> @@ -666,6 +666,13 @@ CONFIG_RTE_SCHED_COLLECT_STATS=n  
> CONFIG_RTE_SCHED_SUBPORT_TC_OV=n
>  CONFIG_RTE_SCHED_PORT_N_GRINDERS=8
>  CONFIG_RTE_SCHED_VECTOR=n
> +#
> +# RTE_RED_SCALING - number of fractional bits used for RED's moving
> average
> +# For every bit that RTE_RED_SCALING is reduced, the max-queue size 
> +can
> doubled
> +# RTE_RED_MAX_TH_MAX = (max-queue size - 1), max-queue size must be
> power of two
> +#
> +CONFIG_RTE_RED_SCALING=10
> +CONFIG_RTE_RED_MAX_TH_MAX=1023
> 

Alan, Tomasz,

Thank you for your work!

We generally want to avoid build-time configuration in favour of run-time configuration. Can you please rework this as run-time configuration?

I suggest we add a new API function to configure these parameters globally for all the RED objects (as opposed to per RED object), with the default values as the current values when this function is not called.

So NACK for now.

Regards,
Cristian
  

Patch

diff --git a/config/common_base b/config/common_base
index 5e97a08..2626557 100644
--- a/config/common_base
+++ b/config/common_base
@@ -666,6 +666,13 @@  CONFIG_RTE_SCHED_COLLECT_STATS=n
 CONFIG_RTE_SCHED_SUBPORT_TC_OV=n
 CONFIG_RTE_SCHED_PORT_N_GRINDERS=8
 CONFIG_RTE_SCHED_VECTOR=n
+#
+# RTE_RED_SCALING - number of fractional bits used for RED's moving average
+# For every bit that RTE_RED_SCALING is reduced, the max-queue size can doubled
+# RTE_RED_MAX_TH_MAX = (max-queue size - 1), max-queue size must be power of two
+#
+CONFIG_RTE_RED_SCALING=10
+CONFIG_RTE_RED_MAX_TH_MAX=1023
 
 #
 # Compile the distributor library
diff --git a/lib/librte_sched/rte_red.h b/lib/librte_sched/rte_red.h
index ca12227..49d3379 100644
--- a/lib/librte_sched/rte_red.h
+++ b/lib/librte_sched/rte_red.h
@@ -51,10 +51,9 @@  extern "C" {
 #include <rte_debug.h>
 #include <rte_cycles.h>
 #include <rte_branch_prediction.h>
+#include <rte_config.h>
 
-#define RTE_RED_SCALING                     10         /**< Fraction size for fixed-point */
 #define RTE_RED_S                           (1 << 22)  /**< Packet size multiplied by number of leaf queues */
-#define RTE_RED_MAX_TH_MAX                  1023       /**< Max threshold limit in fixed point format */
 #define RTE_RED_WQ_LOG2_MIN                 1          /**< Min inverse filter weight value */
 #define RTE_RED_WQ_LOG2_MAX                 12         /**< Max inverse filter weight value */
 #define RTE_RED_MAXP_INV_MIN                1          /**< Min inverse mark probability value */
diff --git a/test/test/test_red.c b/test/test/test_red.c
index 348075d..70e8cfe 100644
--- a/test/test/test_red.c
+++ b/test/test/test_red.c
@@ -653,14 +653,14 @@  static enum test_result func_test2(struct test_config *tcfg)
 /**
  * Test F3: functional test 3
  */
-static uint32_t ft3_tlevel[] = {1022};
+static uint32_t ft3_tlevel[] = {RTE_RED_MAX_TH_MAX-1};
 
 static struct test_rte_red_config ft3_tconfig =  {
 	.rconfig = ft_wrconfig,
 	.num_cfg = RTE_DIM(ft_wrconfig),
 	.wq_log2 = ft_wq_log2,
 	.min_th = 32,
-	.max_th = 1023,
+	.max_th = RTE_RED_MAX_TH_MAX,
 	.maxp_inv = ft_maxp_inv,
 };
 
@@ -766,14 +766,14 @@  static enum test_result func_test3(struct test_config *tcfg)
 /**
  * Test F4: functional test 4
  */
-static uint32_t ft4_tlevel[] = {1022};
+static uint32_t ft4_tlevel[] = {RTE_RED_MAX_TH_MAX-1};
 static uint8_t ft4_wq_log2[] = {11};
 
 static struct test_rte_red_config ft4_tconfig =  {
 	.rconfig = ft_wrconfig,
 	.num_cfg = RTE_DIM(ft_wrconfig),
 	.min_th = 32,
-	.max_th = 1023,
+	.max_th = RTE_RED_MAX_TH_MAX,
 	.wq_log2 = ft4_wq_log2,
 	.maxp_inv = ft_maxp_inv,
 };
@@ -1048,7 +1048,7 @@  static enum test_result func_test5(struct test_config *tcfg)
 /**
  * Test F6: functional test 6
  */
-static uint32_t ft6_tlevel[] = {1022};
+static uint32_t ft6_tlevel[] = {RTE_RED_MAX_TH_MAX-1};
 static uint8_t ft6_wq_log2[] = {9, 8};
 static uint8_t ft6_maxp_inv[] = {10, 20};
 static struct rte_red_config ft6_config[2];
@@ -1059,7 +1059,7 @@  static struct test_rte_red_config ft6_tconfig =  {
 	.rconfig = ft6_config,
 	.num_cfg = RTE_DIM(ft6_config),
 	.min_th = 32,
-	.max_th = 1023,
+	.max_th = RTE_RED_MAX_TH_MAX,
 	.wq_log2 = ft6_wq_log2,
 	.maxp_inv = ft6_maxp_inv,
 };
@@ -1547,7 +1547,7 @@  static uint32_t ovfl_qconfig[] = {0, 0, 1, 1};
 static uint32_t ovfl_q[] ={0};
 static uint32_t ovfl_dropped[] ={0};
 static uint32_t ovfl_enqueued[] ={0};
-static uint32_t ovfl_tlevel[] = {1023};
+static uint32_t ovfl_tlevel[] = {RTE_RED_MAX_TH_MAX};
 static uint8_t ovfl_wq_log2[] = {12};
 
 static struct test_rte_red_config ovfl_tconfig =  {
@@ -1555,7 +1555,7 @@  static struct test_rte_red_config ovfl_tconfig =  {
 	.num_cfg = RTE_DIM(ovfl_wrconfig),
 	.wq_log2 = ovfl_wq_log2,
 	.min_th = 32,
-	.max_th = 1023,
+	.max_th = RTE_RED_MAX_TH_MAX,
 	.maxp_inv = ovfl_maxp_inv,
 };
 
@@ -1595,10 +1595,10 @@  static void ovfl_check_avg(uint32_t avg)
 }
 
 static struct test_config ovfl_test1_config = {
-	.ifname = "queue avergage overflow test interface",
+	.ifname = "queue average overflow test interface",
 	.msg = "overflow test 1 : use one RED configuration,\n"
 	"		  increase average queue size to target level,\n"
-	"		  check maximum number of bits requirte_red to represent avg_s\n\n",
+	"		  check maximum number of bits required to represent avg_s\n\n",
 	.htxt = "avg queue size  "
 	"wq_log2  "
 	"fraction bits  "