[dpdk-dev] (no subject)

Message ID 20141208193629.92BD18043@dpdk.org (mailing list archive)
State Not Applicable, archived
Headers

Commit Message

dev-bounces@dpdk.org Dec. 8, 2014, 7:36 p.m. UTC
  From stephen@networkplumber.org Mon Dec  8 09:46:51 2014
Message-Id: <20141208174651.181685914@networkplumber.org>
User-Agent: quilt/0.63-1
Date: Mon, 08 Dec 2014 09:45:57 -0800
From: Stephen Hemminger <stephen@networkplumber.org>
To: Thomas Monjalon <thomas.monjalon@6wind.com>
Cc: dev@dpdk.org,
 Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH 3/6] qos: make RED optional
References: <20141208174554.889069531@networkplumber.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-15
Content-Disposition: inline; filename=qos-optional-red.patch

We want to be able to build with RTE_SCHED_RED enabled but
allow disabling RED on a per-queue basis at runtime. This is
handled by allowing RED min/max to be zero to indicate that
RED is not being used.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
  

Patch

--- a/lib/librte_sched/rte_sched.c	2014-12-08 09:28:20.782545529 -0800
+++ b/lib/librte_sched/rte_sched.c	2014-12-08 09:28:20.782545529 -0800
@@ -636,6 +636,12 @@  rte_sched_port_config(struct rte_sched_p
 		uint32_t j;
 
 		for (j = 0; j < e_RTE_METER_COLORS; j++) {
+			/* if min/max are both zero, then RED is disabled */
+			if ((params->red_params[i][j].min_th |
+			     params->red_params[i][j].max_th) == 0) {
+				continue;
+			}
+
 			if (rte_red_config_init(&port->red_config[i][j],
 				params->red_params[i][j].wq_log2,
 				params->red_params[i][j].min_th,
@@ -1069,6 +1075,9 @@  rte_sched_port_red_drop(struct rte_sched
 	color = rte_sched_port_pkt_read_color(pkt);
 	red_cfg = &port->red_config[tc_index][color];
 
+	if ( (red_cfg->min_th | red_cfg->max_th) == 0)
+		return 0;
+
 	qe = port->queue_extra + qindex;
 	red = &qe->red;