All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: cristian.dumitrescu@intel.com
Cc: dev@dpdk.org, Stephen Hemminger <shemming@brocade.com>
Subject: [PATCH v2 07/10] sched: cleanup defined constants
Date: Fri, 13 Nov 2015 09:58:33 -0800	[thread overview]
Message-ID: <1447437516-19152-8-git-send-email-stephen@networkplumber.org> (raw)
In-Reply-To: <1447437516-19152-1-git-send-email-stephen@networkplumber.org>

From: Stephen Hemminger <shemming@brocade.com>

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 <stephen@networkplumber.org>
---
 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 <immintrin.h>
 #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

  parent reply	other threads:[~2015-11-13 17:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-13 17:58 [PATCH v2 00/10] rte_sched: enhancements and cleanups Stephen Hemminger
2015-11-13 17:58 ` [PATCH v2 01/10] sched: drop deprecated port hierarchy structure Stephen Hemminger
2015-11-13 17:58 ` [PATCH v2 02/10] sched: cleanup comments Stephen Hemminger
2015-11-13 17:58 ` [PATCH v2 03/10] sched: make debugging configurable Stephen Hemminger
2015-11-13 17:58 ` [PATCH v2 04/10] sched: drop debug #ifdef's for credit check Stephen Hemminger
2015-11-13 17:58 ` [PATCH v2 05/10] sched: remove debug conditional code around ENQUEUE Stephen Hemminger
2015-11-13 17:58 ` [PATCH v2 06/10] sched: drop RTE_SCHED_WRR #define Stephen Hemminger
2015-11-13 17:58 ` Stephen Hemminger [this message]
2015-11-13 17:58 ` [PATCH v2 08/10] sched: allow enabling SSE optimizations in config Stephen Hemminger
2015-11-13 17:58 ` [PATCH v2 09/10] sched: fix coding style Stephen Hemminger
2015-11-13 17:58 ` [PATCH v2 10/10] sched: allow more subports Stephen Hemminger
2015-11-24 23:34 ` [PATCH v2 00/10] rte_sched: enhancements and cleanups Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1447437516-19152-8-git-send-email-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=shemming@brocade.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.