From: Stephen Hemminger Date: Fri, 13 Nov 2015 17:58:33 +0000 (-0800) Subject: sched: cleanup defined constants X-Git-Tag: spdx-start~7967 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=47865a03e18ca9d9f75f8d6187ba71915096166f;p=dpdk.git sched: cleanup defined constants 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 --- diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c index 1f8d3f8eaa..a98c757e0c 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;