From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f53.google.com (mail-pa0-f53.google.com [209.85.220.53]) by dpdk.org (Postfix) with ESMTP id 32B529AA3 for ; Tue, 10 Mar 2015 17:13:48 +0100 (CET) Received: by paceu11 with SMTP id eu11so3476296pac.1 for ; Tue, 10 Mar 2015 09:13:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zY4OKx9KK3ogLREx83eH6uh6LXP0duDtPKDJg8vnZVg=; b=TfBXIliQddIgH1Pda105voCLr8uxvJX/JRk4RyeHbAsMnHX7yn4xPL1ZVsOZUm1f7Q rFwxdcaMRhwxoXbRkMKTAg1QuBh9XuTZsdWCZG3rPcBsJQ15A+Fj7E06Pn/ggAr5veWX e4yJlsmG+J2mN+c/MrfD26i/NQel4VfT0OlPxB8hV1O/d53hCbGloqXVwauUgnhOlXOm fSH6khUKieW2HbM9bZCSBpCYgUzAG5GYGssCS7Mp2vd/3T5Xio6DRYJGf9nN24TrnU0Z fAr9cStCFYkADvgELGlnj0uiixKHdiAoG95ptLyQDdrZ2Z1rjq5kSzoDYxU2suDXtZWk 4UfA== X-Gm-Message-State: ALoCoQlkRV63vdec1SGngpTKPc/tcentWzEAudEqNp82DIRBLoDaMnYV+sfdWAbKDf4LsKu4FClw X-Received: by 10.70.135.106 with SMTP id pr10mr66751893pdb.144.1426004026569; Tue, 10 Mar 2015 09:13:46 -0700 (PDT) Received: from urahara.brocade.com (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by mx.google.com with ESMTPSA id c8sm1836209pds.5.2015.03.10.09.13.45 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Mar 2015 09:13:45 -0700 (PDT) From: Stephen Hemminger To: cristian.dumitrescu@intel.com Date: Tue, 10 Mar 2015 09:13:34 -0700 Message-Id: <1426004018-25948-3-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1426004018-25948-1-git-send-email-stephen@networkplumber.org> References: <1426004018-25948-1-git-send-email-stephen@networkplumber.org> Cc: dev@dpdk.org, Stephen Hemminger Subject: [dpdk-dev] [PATCH v2 2/6] 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, 10 Mar 2015 16:13:48 -0000 From: Stephen Hemminger Want to be able to build with RTE_SCHED_RED enabled but allow disabling RED on a per-queue basis at runtime. RED is disabled unless min/max thresholds set. Signed-off-by: Stephen Hemmminger --- v2 -- no changes lib/librte_sched/rte_sched.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c index 8249dbb..1fd2cce 100644 --- a/lib/librte_sched/rte_sched.c +++ b/lib/librte_sched/rte_sched.c @@ -636,6 +636,12 @@ rte_sched_port_config(struct rte_sched_port_params *params) 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_port *port, struct rte_mbuf *pkt, uint3 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; -- 2.1.4