From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f42.google.com (mail-pa0-f42.google.com [209.85.220.42]) by dpdk.org (Postfix) with ESMTP id AF70F7F50 for ; Tue, 9 Dec 2014 17:43:17 +0100 (CET) Received: by mail-pa0-f42.google.com with SMTP id et14so881137pad.15 for ; Tue, 09 Dec 2014 08:43:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:importance :mime-version:content-type:content-transfer-encoding; bh=dKuC/JnmYxfcOO9WySPgxCjZqcMF6S01aRbCZ7DzQVs=; b=GwmzEPcKr4jmFJF++muDD33O/NWhLWHoYIuc3q3BIG6lawNLrDmpM7iT9HMexb+YFm NrDZAbIsNHXbqb+bUw0VrvDrr2pYDwbsLhmkkMp4M1PE0QFA/d9D3AfzimHl8InTjV7K vqf+0D6UVJDbJf8jCzPrWTkXg1ctbTn8SX9QgeNpNaPBTDR0C1SIzlrBV/OEhWI/KBLD 0ebi2Cy4Ds7dhe7kczsh6miA/JQxsfsILmJB79/qDaTKbT2Yr3NvipWAbB4h5Qy6SVqw LRnBsMM4/RM1pW8ZCmEsQ9Mv2OPFx8R4NrAndfqTM+3Z3BG7NsCmkpn+fFbo70r5EmCn IlPQ== X-Gm-Message-State: ALoCoQmn6qgf+jZm9QE6zigcbzlP7qlPT/jKmuB5yTs7dry7gWaFgWvMDrcOl83wBvsOBhmAwzJl X-Received: by 10.70.103.141 with SMTP id fw13mr32742655pdb.148.1418143394941; Tue, 09 Dec 2014 08:43:14 -0800 (PST) Received: from urahara (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by mx.google.com with ESMTPSA id 1sm1895305pdw.87.2014.12.09.08.43.13 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Dec 2014 08:43:14 -0800 (PST) Date: Tue, 9 Dec 2014 08:40:26 -0800 From: Stephen Hemminger To: dev@dpdk.org Message-ID: <20141209084026.2895154e@urahara> Importance: high X-Priority: 1 (Highest) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: [dpdk-dev] [PATCH 1/4] rte_sched: make RED optional at runtime X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Dec 2014 16:43:18 -0000 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 --- 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;