[RFC] pktgen: set correct max and min in pktgen_setup_inject()

Subsystems: networking [general], the rest

3 messages, 3 authors, 2012-01-07 · open the first message on its own page

[RFC] pktgen: set correct max and min in pktgen_setup_inject()

From: Dan Carpenter <hidden>
Date: 2012-01-06 13:13:57

In 882716604ec "pktgen: fix multiple queue warning" we added special
logic to handle the case where ntxq is zero.  It's not clear to me that
ntxq can actually be zero.  But if it were then we would set
->queue_map_min and ->queue_map_max to USHRT_MAX when probably we want
to set them to zero?
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 449fe0f..65f80c7 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2024,13 +2024,13 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev)
 		pr_warning("WARNING: Requested queue_map_min (zero-based) (%d) exceeds valid range [0 - %d] for (%d) queues on %s, resetting\n",
 			   pkt_dev->queue_map_min, (ntxq ?: 1) - 1, ntxq,
 			   pkt_dev->odevname);
-		pkt_dev->queue_map_min = ntxq - 1;
+		pkt_dev->queue_map_min = (ntxq ?: 1) - 1;
 	}
 	if (pkt_dev->queue_map_max >= ntxq) {
 		pr_warning("WARNING: Requested queue_map_max (zero-based) (%d) exceeds valid range [0 - %d] for (%d) queues on %s, resetting\n",
 			   pkt_dev->queue_map_max, (ntxq ?: 1) - 1, ntxq,
 			   pkt_dev->odevname);
-		pkt_dev->queue_map_max = ntxq - 1;
+		pkt_dev->queue_map_max = (ntxq ?: 1) - 1;
 	}
 
 	/* Default to the interface's mac if not explicitly set. */

Re: [RFC] pktgen: set correct max and min in pktgen_setup_inject()

From: Jesse Brandeburg <hidden>
Date: 2012-01-06 17:29:15

On Fri, 6 Jan 2012 05:13:47 -0800
Dan Carpenter [off-list ref] wrote:
In 882716604ec "pktgen: fix multiple queue warning" we added special
logic to handle the case where ntxq is zero.  It's not clear to me that
ntxq can actually be zero.  But if it were then we would set
->queue_map_min and ->queue_map_max to USHRT_MAX when probably we want
to set them to zero?
seems fine to me, esp since -1 seems like a bad value there.

Re: [RFC] pktgen: set correct max and min in pktgen_setup_inject()

From: David Miller <davem@davemloft.net>
Date: 2012-01-07 20:25:53

From: Jesse Brandeburg <redacted>
Date: Fri, 6 Jan 2012 09:29:12 -0800
On Fri, 6 Jan 2012 05:13:47 -0800
Dan Carpenter [off-list ref] wrote:
quoted
In 882716604ec "pktgen: fix multiple queue warning" we added special
logic to handle the case where ntxq is zero.  It's not clear to me that
ntxq can actually be zero.  But if it were then we would set
->queue_map_min and ->queue_map_max to USHRT_MAX when probably we want
to set them to zero?
seems fine to me, esp since -1 seems like a bad value there.
Looks good to me too, applied, thanks everyone.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help