[dpdk-dev] [PATCH 3/3] rte_sched: fix grinder bug

Stephen Hemminger stephen at networkplumber.org
Wed May 14 18:25:27 CEST 2014


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 at 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;
 		}
 	}



More information about the dev mailing list