DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jasvinder Singh <jasvinder.singh@intel.com>
To: dev@dpdk.org
Cc: cristian.dumitrescu@intel.com,
	Lukasz Krakowiak <lukaszx.krakowiak@intel.com>
Subject: [dpdk-dev] [PATCH v2 09/15] sched: update pkt dequeue for flexible config
Date: Mon,  9 Sep 2019 11:05:24 +0100	[thread overview]
Message-ID: <20190909100530.86020-10-jasvinder.singh@intel.com> (raw)
In-Reply-To: <20190909100530.86020-1-jasvinder.singh@intel.com>

Modify scheduler packet dequeue operation to allow different
subports of the same port to have different configuration in terms
of number of pipes, pipe queue sizes, etc.

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Lukasz Krakowiak <lukaszx.krakowiak@intel.com>
---
 lib/librte_sched/rte_sched.c | 51 ++++++++++++++++++++++++++++--------
 1 file changed, 40 insertions(+), 11 deletions(-)

diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
index 0451e10ea..e0ef86f40 100644
--- a/lib/librte_sched/rte_sched.c
+++ b/lib/librte_sched/rte_sched.c
@@ -245,6 +245,7 @@ struct rte_sched_port {
 	uint32_t busy_grinders;
 	struct rte_mbuf **pkts_out;
 	uint32_t n_pkts_out;
+	uint32_t subport_id;
 
 	/* Queue base calculation */
 	uint32_t qsize_add[RTE_SCHED_QUEUES_PER_PIPE];
@@ -911,6 +912,7 @@ rte_sched_port_config(struct rte_sched_port_params *params)
 	/* Grinders */
 	port->pkts_out = NULL;
 	port->n_pkts_out = 0;
+	port->subport_id = 0;
 
 	return port;
 }
@@ -2616,9 +2618,9 @@ grinder_prefetch_mbuf(struct rte_sched_subport *subport, uint32_t pos)
 }
 
 static inline uint32_t
-grinder_handle(struct rte_sched_port *port, uint32_t pos)
+grinder_handle(struct rte_sched_port *port,
+	struct rte_sched_subport *subport, uint32_t pos)
 {
-	struct rte_sched_subport *subport = port->subport;
 	struct rte_sched_grinder *grinder = subport->grinder + pos;
 
 	switch (grinder->state) {
@@ -2717,6 +2719,7 @@ rte_sched_port_time_resync(struct rte_sched_port *port)
 	uint64_t cycles = rte_get_tsc_cycles();
 	uint64_t cycles_diff = cycles - port->time_cpu_cycles;
 	uint64_t bytes_diff;
+	uint32_t i;
 
 	/* Compute elapsed time in bytes */
 	bytes_diff = rte_reciprocal_divide(cycles_diff << RTE_SCHED_TIME_SHIFT,
@@ -2729,20 +2732,21 @@ rte_sched_port_time_resync(struct rte_sched_port *port)
 		port->time = port->time_cpu_bytes;
 
 	/* Reset pipe loop detection */
-	port->pipe_loop = RTE_SCHED_PIPE_INVALID;
+	for (i = 0; i < port->n_subports_per_port; i++)
+		port->subports[i]->pipe_loop = RTE_SCHED_PIPE_INVALID;
 }
 
 static inline int
-rte_sched_port_exceptions(struct rte_sched_port *port, int second_pass)
+rte_sched_port_exceptions(struct rte_sched_subport *subport, int second_pass)
 {
 	int exceptions;
 
 	/* Check if any exception flag is set */
-	exceptions = (second_pass && port->busy_grinders == 0) ||
-		(port->pipe_exhaustion == 1);
+	exceptions = (second_pass && subport->busy_grinders == 0) ||
+		(subport->pipe_exhaustion == 1);
 
 	/* Clear exception flags */
-	port->pipe_exhaustion = 0;
+	subport->pipe_exhaustion = 0;
 
 	return exceptions;
 }
@@ -2750,7 +2754,9 @@ rte_sched_port_exceptions(struct rte_sched_port *port, int second_pass)
 int
 rte_sched_port_dequeue(struct rte_sched_port *port, struct rte_mbuf **pkts, uint32_t n_pkts)
 {
-	uint32_t i, count;
+	struct rte_sched_subport *subport;
+	uint32_t subport_id = port->subport_id;
+	uint32_t i, n_subports = 0, count;
 
 	port->pkts_out = pkts;
 	port->n_pkts_out = 0;
@@ -2759,9 +2765,32 @@ rte_sched_port_dequeue(struct rte_sched_port *port, struct rte_mbuf **pkts, uint
 
 	/* Take each queue in the grinder one step further */
 	for (i = 0, count = 0; ; i++)  {
-		count += grinder_handle(port, i & (RTE_SCHED_PORT_N_GRINDERS - 1));
-		if ((count == n_pkts) ||
-		    rte_sched_port_exceptions(port, i >= RTE_SCHED_PORT_N_GRINDERS)) {
+		subport = port->subports[subport_id];
+
+		count += grinder_handle(port, subport,
+				i & (RTE_SCHED_PORT_N_GRINDERS - 1));
+
+		if (count == n_pkts) {
+			subport_id++;
+
+			if (subport_id == port->n_subports_per_port)
+				subport_id = 0;
+
+			port->subport_id = subport_id;
+			break;
+		}
+
+		if (rte_sched_port_exceptions(subport, i >= RTE_SCHED_PORT_N_GRINDERS)) {
+			i = 0;
+			subport_id++;
+			n_subports++;
+		}
+
+		if (subport_id == port->n_subports_per_port)
+			subport_id = 0;
+
+		if (n_subports == port->n_subports_per_port) {
+			port->subport_id = subport_id;
 			break;
 		}
 	}
-- 
2.21.0


  parent reply	other threads:[~2019-09-09 10:07 UTC|newest]

Thread overview: 121+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-23 14:45 [dpdk-dev] [PATCH 00/15] sched: subport level configuration of pipe nodes Jasvinder Singh
2019-08-23 14:45 ` [dpdk-dev] [PATCH 01/15] sched: add pipe config params to subport struct Jasvinder Singh
2019-08-23 14:45 ` [dpdk-dev] [PATCH 02/15] sched: modify internal structs for subport config Jasvinder Singh
2019-08-23 14:45 ` [dpdk-dev] [PATCH 03/15] sched: remove pipe params config from port level Jasvinder Singh
2019-08-23 14:45 ` [dpdk-dev] [PATCH 04/15] shced: add pipe config to subport level Jasvinder Singh
2019-08-23 14:45 ` [dpdk-dev] [PATCH 05/15] sched: modify pipe functions for config flexibility Jasvinder Singh
2019-08-23 14:45 ` [dpdk-dev] [PATCH 06/15] sched: modify pkt enqueue for subport " Jasvinder Singh
2019-08-23 14:45 ` [dpdk-dev] [PATCH 07/15] sched: update memory compute to support flexiblity Jasvinder Singh
2019-08-23 14:45 ` [dpdk-dev] [PATCH 08/15] sched: update grinder functions for config flexibility Jasvinder Singh
2019-08-23 14:45 ` [dpdk-dev] [PATCH 09/15] sched: update pkt dequeue for subport " Jasvinder Singh
2019-08-23 14:45 ` [dpdk-dev] [PATCH 10/15] sched: update queue stats read for " Jasvinder Singh
2019-08-23 14:45 ` [dpdk-dev] [PATCH 11/15] test/sched: modify tests for subport " Jasvinder Singh
2019-08-23 14:45 ` [dpdk-dev] [PATCH 12/15] net/softnic: add subport config flexibility to TM function Jasvinder Singh
2019-08-23 14:46 ` [dpdk-dev] [PATCH 13/15] ip_pipeline: " Jasvinder Singh
2019-08-23 14:46 ` [dpdk-dev] [PATCH 14/15] examples/qos_sched: add subport configuration flexibility Jasvinder Singh
2019-08-23 14:46 ` [dpdk-dev] [PATCH 15/15] sched: remove redundant code Jasvinder Singh
2019-09-09 10:05 ` [dpdk-dev] [PATCH v2 00/15] sched: subport level configuration of pipe nodes Jasvinder Singh
2019-09-09 10:05   ` [dpdk-dev] [PATCH v2 01/15] sched: add pipe config params to subport struct Jasvinder Singh
2019-09-09 10:05   ` [dpdk-dev] [PATCH v2 02/15] sched: modify internal structs for config flexibility Jasvinder Singh
2019-09-09 10:05   ` [dpdk-dev] [PATCH v2 03/15] sched: remove pipe params config from port level Jasvinder Singh
2019-09-09 10:05   ` [dpdk-dev] [PATCH v2 04/15] shced: add pipe config to subport level Jasvinder Singh
2019-09-09 10:05   ` [dpdk-dev] [PATCH v2 05/15] sched: modify pipe functions for config flexibility Jasvinder Singh
2019-09-09 10:05   ` [dpdk-dev] [PATCH v2 06/15] sched: modify pkt enqueue " Jasvinder Singh
2019-09-09 10:05   ` [dpdk-dev] [PATCH v2 07/15] sched: update memory compute to support flexiblity Jasvinder Singh
2019-09-09 10:05   ` [dpdk-dev] [PATCH v2 08/15] sched: update grinder functions for config flexibility Jasvinder Singh
2019-09-09 10:05   ` Jasvinder Singh [this message]
2019-09-09 10:05   ` [dpdk-dev] [PATCH v2 10/15] sched: update queue stats read " Jasvinder Singh
2019-09-09 10:05   ` [dpdk-dev] [PATCH v2 11/15] test/sched: modify tests for subport " Jasvinder Singh
2019-09-09 10:05   ` [dpdk-dev] [PATCH v2 12/15] net/softnic: add subport config flexibility to TM Jasvinder Singh
2019-09-09 10:05   ` [dpdk-dev] [PATCH v2 13/15] ip_pipeline: " Jasvinder Singh
2019-09-09 10:05   ` [dpdk-dev] [PATCH v2 14/15] examples/qos_sched: add subport configuration flexibility Jasvinder Singh
2019-09-09 10:05   ` [dpdk-dev] [PATCH v2 15/15] sched: remove redundant code Jasvinder Singh
2019-09-23 13:06   ` [dpdk-dev] [PATCH v2 00/15] sched: subport level configuration of pipe nodes Dumitrescu, Cristian
2019-09-24 20:01     ` Singh, Jasvinder
2019-09-26  8:52   ` [dpdk-dev] [PATCH v3 " Jasvinder Singh
2019-09-26  8:52     ` [dpdk-dev] [PATCH v3 01/15] sched: add pipe config params to subport struct Jasvinder Singh
2019-09-26  8:52     ` [dpdk-dev] [PATCH v3 02/15] sched: modify internal structs for config flexibility Jasvinder Singh
2019-09-26  8:52     ` [dpdk-dev] [PATCH v3 03/15] sched: remove pipe params config from port level Jasvinder Singh
2019-09-26  8:52     ` [dpdk-dev] [PATCH v3 04/15] sched: add pipe config to subport level Jasvinder Singh
2019-09-26  8:52     ` [dpdk-dev] [PATCH v3 05/15] sched: modify pipe functions for config flexibility Jasvinder Singh
2019-09-26  8:52     ` [dpdk-dev] [PATCH v3 06/15] sched: modify pkt enqueue " Jasvinder Singh
2019-09-26  8:52     ` [dpdk-dev] [PATCH v3 07/15] sched: update memory compute to support flexiblity Jasvinder Singh
2019-09-26  8:52     ` [dpdk-dev] [PATCH v3 08/15] sched: update grinder functions for config flexibility Jasvinder Singh
2019-09-26  8:52     ` [dpdk-dev] [PATCH v3 09/15] sched: update pkt dequeue for flexible config Jasvinder Singh
2019-09-26  8:52     ` [dpdk-dev] [PATCH v3 10/15] sched: update queue stats read for config flexibility Jasvinder Singh
2019-09-26  8:52     ` [dpdk-dev] [PATCH v3 11/15] test/sched: modify tests for subport " Jasvinder Singh
2019-09-26  8:52     ` [dpdk-dev] [PATCH v3 12/15] net/softnic: add subport config flexibility to TM Jasvinder Singh
2019-09-26  8:52     ` [dpdk-dev] [PATCH v3 13/15] ip_pipeline: " Jasvinder Singh
2019-09-26  8:52     ` [dpdk-dev] [PATCH v3 14/15] examples/qos_sched: add subport configuration flexibility Jasvinder Singh
2019-09-26  8:52     ` [dpdk-dev] [PATCH v3 15/15] sched: remove redundant code Jasvinder Singh
2019-10-14 12:09     ` [dpdk-dev] [PATCH v4 00/17] sched: subport level configuration of pipe nodes Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 01/17] sched: add pipe config params to subport struct Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 02/17] sched: modify internal structs for config flexibility Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 03/17] sched: remove pipe params config from port level Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 04/17] sched: add pipe config to subport level Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 05/17] sched: modify pipe functions for config flexibility Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 06/17] sched: modify pkt enqueue " Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 07/17] sched: update memory compute to support flexiblity Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 08/17] sched: update grinder functions for config flexibility Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 09/17] sched: update pkt dequeue for flexible config Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 10/17] sched: update queue stats read for config flexibility Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 11/17] test/sched: modify tests for subport " Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 12/17] net/softnic: add subport config flexibility to TM Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 13/17] ip_pipeline: " Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 14/17] examples/qos_sched: add subport configuration flexibility Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 15/17] sched: remove redundant code Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 16/17] sched: add support for 64 bit values Jasvinder Singh
2019-10-14 12:09       ` [dpdk-dev] [PATCH v4 17/17] sched: modify internal structs and functions " Jasvinder Singh
2019-10-14 14:23       ` [dpdk-dev] [PATCH v4 00/17] sched: subport level configuration of pipe nodes Dumitrescu, Cristian
2019-10-14 16:26         ` Singh, Jasvinder
2019-10-14 17:23       ` [dpdk-dev] [PATCH v5 00/15] " Jasvinder Singh
2019-10-14 17:23         ` [dpdk-dev] [PATCH v5 01/15] sched: add pipe config params to subport struct Jasvinder Singh
2019-10-14 17:23         ` [dpdk-dev] [PATCH v5 02/15] sched: modify internal structs for config flexibility Jasvinder Singh
2019-10-14 17:23         ` [dpdk-dev] [PATCH v5 03/15] sched: remove pipe params config from port level Jasvinder Singh
2019-10-14 17:23         ` [dpdk-dev] [PATCH v5 04/15] sched: add pipe config to subport level Jasvinder Singh
2019-10-14 17:23         ` [dpdk-dev] [PATCH v5 05/15] sched: modify pipe functions for config flexibility Jasvinder Singh
2019-10-14 17:23         ` [dpdk-dev] [PATCH v5 06/15] sched: modify pkt enqueue " Jasvinder Singh
2019-10-24 16:44           ` Thomas Monjalon
2019-10-24 17:47             ` Singh, Jasvinder
2019-10-14 17:23         ` [dpdk-dev] [PATCH v5 07/15] sched: update memory compute to support flexiblity Jasvinder Singh
2019-10-14 17:23         ` [dpdk-dev] [PATCH v5 08/15] sched: update grinder functions for config flexibility Jasvinder Singh
2019-10-14 17:23         ` [dpdk-dev] [PATCH v5 09/15] sched: update pkt dequeue for flexible config Jasvinder Singh
2019-10-14 17:23         ` [dpdk-dev] [PATCH v5 10/15] sched: update queue stats read for config flexibility Jasvinder Singh
2019-10-14 17:23         ` [dpdk-dev] [PATCH v5 11/15] test/sched: modify tests for subport " Jasvinder Singh
2019-10-14 17:23         ` [dpdk-dev] [PATCH v5 12/15] net/softnic: add subport config flexibility to TM Jasvinder Singh
2019-10-14 17:23         ` [dpdk-dev] [PATCH v5 13/15] ip_pipeline: " Jasvinder Singh
2019-10-14 17:23         ` [dpdk-dev] [PATCH v5 14/15] examples/qos_sched: add subport configuration flexibility Jasvinder Singh
2019-10-14 17:23         ` [dpdk-dev] [PATCH v5 15/15] sched: remove redundant code Jasvinder Singh
2019-10-24 18:46         ` [dpdk-dev] [PATCH v6 00/15] sched: subport level configuration of pipe nodes Jasvinder Singh
2019-10-24 18:46           ` [dpdk-dev] [PATCH v6 01/15] sched: add pipe config params to subport struct Jasvinder Singh
2019-10-24 18:46           ` [dpdk-dev] [PATCH v6 02/15] sched: modify internal structs for config flexibility Jasvinder Singh
2019-10-24 18:46           ` [dpdk-dev] [PATCH v6 03/15] sched: remove pipe params config from port level Jasvinder Singh
2019-10-24 18:46           ` [dpdk-dev] [PATCH v6 04/15] sched: add pipe config to subport level Jasvinder Singh
2019-10-24 18:46           ` [dpdk-dev] [PATCH v6 05/15] sched: modify pipe functions for config flexibility Jasvinder Singh
2019-10-24 18:46           ` [dpdk-dev] [PATCH v6 06/15] sched: modify pkt enqueue " Jasvinder Singh
2019-10-24 18:46           ` [dpdk-dev] [PATCH v6 07/15] sched: update memory compute to support flexiblity Jasvinder Singh
2019-10-24 18:46           ` [dpdk-dev] [PATCH v6 08/15] sched: update grinder functions for config flexibility Jasvinder Singh
2019-10-24 18:46           ` [dpdk-dev] [PATCH v6 09/15] sched: update pkt dequeue for flexible config Jasvinder Singh
2019-10-24 18:46           ` [dpdk-dev] [PATCH v6 10/15] sched: update queue stats read for config flexibility Jasvinder Singh
2019-10-24 18:46           ` [dpdk-dev] [PATCH v6 11/15] test/sched: modify tests for subport " Jasvinder Singh
2019-10-24 18:46           ` [dpdk-dev] [PATCH v6 12/15] net/softnic: add subport config flexibility to TM Jasvinder Singh
2019-10-24 18:46           ` [dpdk-dev] [PATCH v6 13/15] ip_pipeline: " Jasvinder Singh
2019-10-24 18:46           ` [dpdk-dev] [PATCH v6 14/15] examples/qos_sched: add subport configuration flexibility Jasvinder Singh
2019-10-24 18:46           ` [dpdk-dev] [PATCH v6 15/15] sched: remove redundant code Jasvinder Singh
2019-10-25 10:51           ` [dpdk-dev] [PATCH v7 00/15] sched: subport level configuration of pipe nodes Jasvinder Singh
2019-10-25 10:51             ` [dpdk-dev] [PATCH v7 01/15] sched: add pipe config params to subport struct Jasvinder Singh
2019-10-25 10:51             ` [dpdk-dev] [PATCH v7 02/15] sched: modify internal structs for config flexibility Jasvinder Singh
2019-10-25 10:51             ` [dpdk-dev] [PATCH v7 03/15] sched: remove pipe params config from port level Jasvinder Singh
2019-10-25 10:51             ` [dpdk-dev] [PATCH v7 04/15] sched: add pipe config to subport level Jasvinder Singh
2019-10-25 10:51             ` [dpdk-dev] [PATCH v7 05/15] sched: modify pipe functions for config flexibility Jasvinder Singh
2019-10-25 10:51             ` [dpdk-dev] [PATCH v7 06/15] sched: modify pkt enqueue " Jasvinder Singh
2019-10-25 10:51             ` [dpdk-dev] [PATCH v7 07/15] sched: update memory compute to support flexiblity Jasvinder Singh
2019-10-25 10:51             ` [dpdk-dev] [PATCH v7 08/15] sched: update grinder functions for config flexibility Jasvinder Singh
2019-10-25 10:51             ` [dpdk-dev] [PATCH v7 09/15] sched: update pkt dequeue for flexible config Jasvinder Singh
2019-10-25 10:51             ` [dpdk-dev] [PATCH v7 10/15] sched: update queue stats read for config flexibility Jasvinder Singh
2019-10-25 10:51             ` [dpdk-dev] [PATCH v7 11/15] test/sched: modify tests for subport " Jasvinder Singh
2019-10-25 10:51             ` [dpdk-dev] [PATCH v7 12/15] net/softnic: add subport config flexibility to TM Jasvinder Singh
2019-10-25 10:51             ` [dpdk-dev] [PATCH v7 13/15] ip_pipeline: " Jasvinder Singh
2019-10-25 10:51             ` [dpdk-dev] [PATCH v7 14/15] examples/qos_sched: add subport configuration flexibility Jasvinder Singh
2019-10-25 10:51             ` [dpdk-dev] [PATCH v7 15/15] sched: remove redundant code Jasvinder Singh
2019-10-25 15:54             ` [dpdk-dev] [PATCH v7 00/15] sched: subport level configuration of pipe nodes 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=20190909100530.86020-10-jasvinder.singh@intel.com \
    --to=jasvinder.singh@intel.com \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    --cc=lukaszx.krakowiak@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).