netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] pktgen: set correct max and min in pktgen_setup_inject()
@ 2012-01-06 13:13 Dan Carpenter
  2012-01-06 17:29 ` Jesse Brandeburg
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2012-01-06 13:13 UTC (permalink / raw)
  To: Jesse Brandeburg; +Cc: netdev

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. */

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

* Re: [RFC] pktgen: set correct max and min in pktgen_setup_inject()
  2012-01-06 13:13 [RFC] pktgen: set correct max and min in pktgen_setup_inject() Dan Carpenter
@ 2012-01-06 17:29 ` Jesse Brandeburg
  2012-01-07 20:25   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Jesse Brandeburg @ 2012-01-06 17:29 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: netdev

On Fri, 6 Jan 2012 05:13:47 -0800
Dan Carpenter <dan.carpenter@oracle.com> 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.

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

* Re: [RFC] pktgen: set correct max and min in pktgen_setup_inject()
  2012-01-06 17:29 ` Jesse Brandeburg
@ 2012-01-07 20:25   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2012-01-07 20:25 UTC (permalink / raw)
  To: jesse.brandeburg; +Cc: dan.carpenter, netdev

From: Jesse Brandeburg <jesse.brandeburg@intel.com>
Date: Fri, 6 Jan 2012 09:29:12 -0800

> On Fri, 6 Jan 2012 05:13:47 -0800
> Dan Carpenter <dan.carpenter@oracle.com> 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.

Looks good to me too, applied, thanks everyone.

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

end of thread, other threads:[~2012-01-07 20:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-06 13:13 [RFC] pktgen: set correct max and min in pktgen_setup_inject() Dan Carpenter
2012-01-06 17:29 ` Jesse Brandeburg
2012-01-07 20:25   ` David Miller

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