From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f176.google.com (mail-pd0-f176.google.com [209.85.192.176]) by dpdk.org (Postfix) with ESMTP id 1D7BBC97C for ; Wed, 29 Apr 2015 19:04:41 +0200 (CEST) Received: by pdbnk13 with SMTP id nk13so33701589pdb.0 for ; Wed, 29 Apr 2015 10:04:40 -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=aAQJn4I2QDno/H8c0Va8SmPANwJih5KubtH08mVAMpM=; b=dN3Q/3SUiqZ8FEaoGzFLdAr7imu9aluX1x23fyz3/kLr6ClNpbbFOJl5m2fcbwovKB 9CHyaMhxjGteZt8pHXF/z3+xtjJ7I6qtacpSzhGX4li1HvHGnCR0Mz63dbM66wSHHCDA MX98LOGt6KVIprnWkJ3od3er0djmxQWjtme/2BgLn/uv/nJzVaq4lK6/uNhRsO9ZSNOh EADKLpdTYSYA/dcfugjG1VsCdstwPxGHcIu6XVq0/+jFIAlibvodMqtbA6KoA1aVPh9g j+8dlpCmIFCKpoj0jrqn9v2dchg+9YiHMs7N27rYjs7hfO1gc6T5+wVYZXiqPsezIBDw 9hUg== X-Gm-Message-State: ALoCoQnwA4orZ4t7PHMO2rpEi8fUGLGusjB3n5pZVji4Gw+MBmkXlus7iaoUF+Pml1jaPn4MlF85 X-Received: by 10.70.90.209 with SMTP id by17mr178565pdb.2.1430327080187; Wed, 29 Apr 2015 10:04:40 -0700 (PDT) Received: from urahara.home.lan (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by mx.google.com with ESMTPSA id i9sm25995113pdj.27.2015.04.29.10.04.39 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Apr 2015 10:04:39 -0700 (PDT) From: Stephen Hemminger To: cristian.dumitrescu@intel.com Date: Wed, 29 Apr 2015 10:04:35 -0700 Message-Id: <1430327080-12642-2-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1430327080-12642-1-git-send-email-stephen@networkplumber.org> References: <1430327080-12642-1-git-send-email-stephen@networkplumber.org> Cc: dev@dpdk.org, Stephen Hemminger Subject: [dpdk-dev] [PATCH 1/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: Wed, 29 Apr 2015 17:04:41 -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 --- 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 95dee27..3b5acd1 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