From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f52.google.com (mail-pa0-f52.google.com [209.85.220.52]) by dpdk.org (Postfix) with ESMTP id B531BC338 for ; Fri, 13 Nov 2015 18:58:31 +0100 (CET) Received: by pacdm15 with SMTP id dm15so106440295pac.3 for ; Fri, 13 Nov 2015 09:58:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6OH+X6NtH0ZO1BZJ7KXf7JCGcRVYk5KL74MTuiA0NzM=; b=KMnT7VKTH52yJ9Ko9m6zx78WjenBy0RV5jM6WUW52xoJSBWLRKwLIs1BnbXXqw4UFL Suiu9CgmaoGly8k0KQLYRbLDru4FLQNRrYUTBroBuptun5iYMJIF+FniOJrqoNJJQeqL oxT4epPIS1uJrW6MtpgX3yZiPwxuB2jPK798gDTwlgn/2Z992RRcjcbYanjFBWhrVS0C jjMOeyMfkWhlM8L+MIj/EeHfZ0tXYDpHXbTmdG/+/VOsAkFjU9TfXq4Xfm8LXGUuCWHn KOdZ5xLrO6qPiVqajZNlCrMmtH+FTd/vNuJ8L/RMaOHfj0se6liKzLarMlqnDnfiQ6ZR HdsA== 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=6OH+X6NtH0ZO1BZJ7KXf7JCGcRVYk5KL74MTuiA0NzM=; b=kFz1zUgaV4dOl4fAiqhZBLPuKWQ8nr6AudsUv1CaujN1zEAx6f420hWz/Nij7m+WTu HmO3dlIfcGh2NUSDLx7VzmY0mI3wMsonOZFOmZ0aae+/99rIai29Z+nWMh+FKSWpREdY sQBLweHAJmZ8nO1y3KQrUJ2IAkdCgSMbWjnvi/cKiL7QprwLjZqtNF7i1HnPtg6c696o u7Kz2LH0s0rD1KuUSQWsBpddUcYrVHHnYoxzFdUTxItxTJfwH00CtYvLUTQUBMUpVLnu l9G8gkV4UB11tx6Qienz/fovZBWEMIcCgl2dJZbt1MxfozX2JHXfSuuO+8Gnd+ZZBQWG NdQA== X-Gm-Message-State: ALoCoQnnxOlKk4eLKo7v9kjLMPwYLur4LAIz7RWczeczkITVDYthYY/rskDaKoCVfExw1XqGeZ/A X-Received: by 10.68.165.34 with SMTP id yv2mr33802283pbb.153.1447437511146; Fri, 13 Nov 2015 09:58:31 -0800 (PST) Received: from xeon-e3.home.lan (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by smtp.gmail.com with ESMTPSA id bd10sm21603143pbd.29.2015.11.13.09.58.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Nov 2015 09:58:30 -0800 (PST) From: Stephen Hemminger To: cristian.dumitrescu@intel.com Date: Fri, 13 Nov 2015 09:58:33 -0800 Message-Id: <1447437516-19152-8-git-send-email-stephen@networkplumber.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1447437516-19152-1-git-send-email-stephen@networkplumber.org> References: <1447437516-19152-1-git-send-email-stephen@networkplumber.org> Cc: dev@dpdk.org, Stephen Hemminger Subject: [dpdk-dev] [PATCH v2 07/10] sched: cleanup defined constants 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: Fri, 13 Nov 2015 17:58:32 -0000 From: Stephen Hemminger Only use RTE_SCHED_PORT_N_GRINDERS from config. Use RTE_BUILD_BUG_ON for errors. The remaining implementation constants can be put together. Signed-off-by: Stephen Hemminger --- lib/librte_sched/rte_sched.c | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c index 1f8d3f8..a98c757 100644 --- a/lib/librte_sched/rte_sched.c +++ b/lib/librte_sched/rte_sched.c @@ -60,28 +60,10 @@ #include #endif -#ifndef RTE_SCHED_TB_RATE_CONFIG_ERR #define RTE_SCHED_TB_RATE_CONFIG_ERR (1e-7) -#endif - -#ifndef RTE_SCHED_WRR_SHIFT #define RTE_SCHED_WRR_SHIFT 3 -#endif - -#ifndef RTE_SCHED_PORT_N_GRINDERS -#define RTE_SCHED_PORT_N_GRINDERS 8 -#endif -#if (RTE_SCHED_PORT_N_GRINDERS == 0) || (RTE_SCHED_PORT_N_GRINDERS & (RTE_SCHED_PORT_N_GRINDERS - 1)) -#error Number of grinders must be non-zero and a power of 2 -#endif -#if (RTE_SCHED_OPTIMIZATIONS && (RTE_SCHED_PORT_N_GRINDERS != 8)) -#error Number of grinders must be 8 when RTE_SCHED_OPTIMIZATIONS is set -#endif - #define RTE_SCHED_GRINDER_PCACHE_SIZE (64 / RTE_SCHED_QUEUES_PER_PIPE) - #define RTE_SCHED_PIPE_INVALID UINT32_MAX - #define RTE_SCHED_BMP_POS_INVALID UINT32_MAX struct rte_sched_subport { @@ -621,6 +603,10 @@ rte_sched_port_config(struct rte_sched_port_params *params) return NULL; } + /* compile time checks */ + RTE_BUILD_BUG_ON(RTE_SCHED_PORT_N_GRINDERS == 0); + RTE_BUILD_BUG_ON(RTE_SCHED_PORT_N_GRINDERS & (RTE_SCHED_PORT_N_GRINDERS - 1)); + /* User parameters */ port->n_subports_per_port = params->n_subports_per_port; port->n_pipes_per_subport = params->n_pipes_per_subport; -- 2.1.4