DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/3] RTE scheduler fixes
@ 2014-05-14 16:25 Stephen Hemminger
  2014-05-14 16:25 ` [dpdk-dev] [PATCH 1/3] qos: use rte_zmalloc instead of memzone for allocation Stephen Hemminger
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Stephen Hemminger @ 2014-05-14 16:25 UTC (permalink / raw)
  To: dev

These patches address a number of issues found during development
and testing of QoS in Vyatta 5600 router.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH 1/3] qos: use rte_zmalloc instead of memzone for allocation
  2014-05-14 16:25 [dpdk-dev] [PATCH 0/3] RTE scheduler fixes Stephen Hemminger
@ 2014-05-14 16:25 ` Stephen Hemminger
  2014-05-14 16:25 ` [dpdk-dev] [PATCH 2/3] rte_sched: fix compile if DEBUG enabled Stephen Hemminger
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2014-05-14 16:25 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

[-- Attachment #1: sched-rte-malloc.patch --]
[-- Type: text/plain, Size: 3070 bytes --]

The existing rte scheduler can only be safely configured once per port
because a memory zone has a fixed size once it is created and can never
be freed or change in size.

This patch changes the scheduler to use rte_malloc instead. This allows
for a port to be reconfigured by doing rte_sched_port_free followed
rte_sched_port_config.

The patch also removes the now unused name parameter from the
port parameters structure.	

Signed-off-by: Stephen Hemminger <shemming@brocade.com>

---
 app/test/test_sched.c        |    2 --
 lib/librte_sched/rte_sched.c |   29 ++++++-----------------------
 2 files changed, 6 insertions(+), 25 deletions(-)

--- a/lib/librte_sched/rte_sched.c	2014-05-14 09:01:15.085164140 -0700
+++ b/lib/librte_sched/rte_sched.c	2014-05-14 09:05:16.078491725 -0700
@@ -37,7 +37,7 @@
 #include <rte_common.h>
 #include <rte_log.h>
 #include <rte_memory.h>
-#include <rte_memzone.h>
+#include <rte_malloc.h>
 #include <rte_cycles.h>
 #include <rte_prefetch.h>
 #include <rte_branch_prediction.h>
@@ -306,11 +306,6 @@ rte_sched_port_check_params(struct rte_s
 		return -1;
 	}
 	
-	/* name */
-	if (params->name == NULL) {
-		return -2;
-	}
-	
 	/* socket */
 	if ((params->socket < 0) || (params->socket >= RTE_MAX_NUMA_NODES)) {
 		return -3;
@@ -613,7 +608,6 @@ struct rte_sched_port *
 rte_sched_port_config(struct rte_sched_port_params *params)
 {
 	struct rte_sched_port *port = NULL;
-	const struct rte_memzone *mz = NULL;
 	uint32_t mem_size, bmp_mem_size, n_queues_per_port, i;
 	
 	/* Check user parameters. Determine the amount of memory to allocate */
@@ -623,21 +617,10 @@ rte_sched_port_config(struct rte_sched_p
 	}
 	
 	/* Allocate memory to store the data structures */
-	mz = rte_memzone_lookup(params->name);
-	if (mz) {
-		/* Use existing memzone, provided that its size is big enough */
-		if (mz->len < mem_size) {
-			return NULL;
-		}
-	} else {
-		/* Create new memzone */
-		mz = rte_memzone_reserve(params->name, mem_size, params->socket, 0);		
-		if (mz == NULL) {
-			return NULL;
-		}
+	port = rte_zmalloc("qos_params", mem_size, CACHE_LINE_SIZE);
+	if (port == NULL) {
+		return NULL;
 	}
-	memset(mz->addr, 0, mem_size);
-	port = (struct rte_sched_port *) mz->addr;
 
 	/* User parameters */
 	port->n_subports_per_port = params->n_subports_per_port;
@@ -716,9 +699,9 @@ rte_sched_port_free(struct rte_sched_por
 	if (port == NULL){
 		return;
 	}
+
 	rte_bitmap_free(port->bmp);
-	
-	return;
+	rte_free(port);
 }
 
 static void
--- a/app/test/test_sched.c	2014-05-14 09:08:34.067612152 -0700
+++ b/app/test/test_sched.c	2014-05-14 09:08:48.723695881 -0700
@@ -83,7 +83,6 @@ static struct rte_sched_pipe_params pipe
 };
 
 static struct rte_sched_port_params port_param = {
-	.name = "port_0",
 	.socket = 0, /* computed */
 	.rate = 0, /* computed */
 	.mtu = 1522,
@@ -172,7 +171,6 @@ test_sched(void)
 
 	port_param.socket = 0;
 	port_param.rate = (uint64_t) 10000 * 1000 * 1000 / 8;
-	port_param.name = "port_0";
 
 	port = rte_sched_port_config(&port_param);
 	VERIFY(port != NULL, "Error config sched port\n");

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH 2/3] rte_sched: fix compile if DEBUG enabled
  2014-05-14 16:25 [dpdk-dev] [PATCH 0/3] RTE scheduler fixes Stephen Hemminger
  2014-05-14 16:25 ` [dpdk-dev] [PATCH 1/3] qos: use rte_zmalloc instead of memzone for allocation Stephen Hemminger
@ 2014-05-14 16:25 ` Stephen Hemminger
  2014-05-14 16:25 ` [dpdk-dev] [PATCH 3/3] rte_sched: fix grinder bug Stephen Hemminger
  2014-05-22 14:17 ` [dpdk-dev] [PATCH 0/3] RTE scheduler fixes Thomas Monjalon
  3 siblings, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2014-05-14 16:25 UTC (permalink / raw)
  To: dev

[-- Attachment #1: sched-debug-fix.patch --]
[-- Type: text/plain, Size: 629 bytes --]

Fix build error if RTE_SCHED_DEBUG is enabled.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>


---
 lib/librte_sched/rte_sched.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/lib/librte_sched/rte_sched.c	2014-05-14 09:13:57.377235388 -0700
+++ b/lib/librte_sched/rte_sched.c	2014-05-14 09:13:57.377235388 -0700
@@ -1001,7 +1001,7 @@ rte_sched_port_queue_is_full(struct rte_
 {
 	struct rte_sched_queue *queue = port->queue + qindex;
 	uint16_t qsize = rte_sched_port_qsize(port, qindex);
-	uint16_t qlen = q->qw - q->qr;
+	uint16_t qlen = queue->qw - queue->qr;
 	
 	return (qlen >= qsize);
 }

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH 3/3] rte_sched: fix grinder bug
  2014-05-14 16:25 [dpdk-dev] [PATCH 0/3] RTE scheduler fixes Stephen Hemminger
  2014-05-14 16:25 ` [dpdk-dev] [PATCH 1/3] qos: use rte_zmalloc instead of memzone for allocation Stephen Hemminger
  2014-05-14 16:25 ` [dpdk-dev] [PATCH 2/3] rte_sched: fix compile if DEBUG enabled Stephen Hemminger
@ 2014-05-14 16:25 ` Stephen Hemminger
  2014-05-22 14:17 ` [dpdk-dev] [PATCH 0/3] RTE scheduler fixes Thomas Monjalon
  3 siblings, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2014-05-14 16:25 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

[-- Attachment #1: sched-unstuck-grinder.patch --]
[-- Type: text/plain, Size: 1563 bytes --]

The rte_scheduler will get stuck and not deliver any more packets
if there are two active subports and then one of them stops enqueing
more packets. This is because of abug in how the grinder state machines
are managed.

If a non-zero grinder is assigned (but not yet active), then the dequeue
would miss it and always return zero packets. The cure is to always
do a first pass over all grinders.

Signed-off-by: Stephen Hemminger <shemming@brocade.com>


---
 lib/librte_sched/rte_sched.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- a/lib/librte_sched/rte_sched.c	2014-05-14 09:14:01.137253986 -0700
+++ b/lib/librte_sched/rte_sched.c	2014-05-14 09:14:01.137253986 -0700
@@ -2113,12 +2113,12 @@ rte_sched_port_time_resync(struct rte_sc
 }
 
 static inline int
-rte_sched_port_exceptions(struct rte_sched_port *port)
+rte_sched_port_exceptions(struct rte_sched_port *port, int second_pass)
 {
 	int exceptions;
 
 	/* Check if any exception flag is set */
-	exceptions = (port->busy_grinders == 0) ||
+	exceptions = (second_pass && port->busy_grinders == 0) ||
 		(port->pipe_exhaustion == 1);
 	
 	/* Clear exception flags */
@@ -2140,7 +2140,8 @@ rte_sched_port_dequeue(struct rte_sched_
 	/* 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)) {
+		if ((count == n_pkts) ||
+		    rte_sched_port_exceptions(port, i >= RTE_SCHED_PORT_N_GRINDERS)) {
 			break;
 		}
 	}

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH 0/3] RTE scheduler fixes
  2014-05-14 16:25 [dpdk-dev] [PATCH 0/3] RTE scheduler fixes Stephen Hemminger
                   ` (2 preceding siblings ...)
  2014-05-14 16:25 ` [dpdk-dev] [PATCH 3/3] rte_sched: fix grinder bug Stephen Hemminger
@ 2014-05-22 14:17 ` Thomas Monjalon
  3 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2014-05-22 14:17 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev

2014-05-14 09:25, Stephen Hemminger:
> These patches address a number of issues found during development
> and testing of QoS in Vyatta 5600 router.

Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>

Applied for version 1.7.0.

Thanks
-- 
Thomas

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-05-22 14:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-14 16:25 [dpdk-dev] [PATCH 0/3] RTE scheduler fixes Stephen Hemminger
2014-05-14 16:25 ` [dpdk-dev] [PATCH 1/3] qos: use rte_zmalloc instead of memzone for allocation Stephen Hemminger
2014-05-14 16:25 ` [dpdk-dev] [PATCH 2/3] rte_sched: fix compile if DEBUG enabled Stephen Hemminger
2014-05-14 16:25 ` [dpdk-dev] [PATCH 3/3] rte_sched: fix grinder bug Stephen Hemminger
2014-05-22 14:17 ` [dpdk-dev] [PATCH 0/3] RTE scheduler fixes Thomas Monjalon

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).