public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* bug fix for out-of-tree igb driver
@ 2011-05-04 18:06 Ben Greear
  2011-05-04 18:12 ` Jeff Kirsher
  2011-05-04 18:36 ` Wyborny, Carolyn
  0 siblings, 2 replies; 3+ messages in thread
From: Ben Greear @ 2011-05-04 18:06 UTC (permalink / raw)
  To: netdev

Just in case someone is using the out-of-tree igb driver, I
think I found a bug.

The tx_queue_mapping method should have r_idx >= adapter->num_tx_queues
as shown below.  The driver had: r_idx > adapter->num_tx_queues originally.

Its possible my code is buggy for sending queue_mapping of 1
when num_tx_queues is 1, but either way, the driver
shouldn't crash.

Upstream igb driver in mainline kernels does not have this problem.

static inline struct igb_ring *igb_tx_queue_mapping(struct igb_adapter *adapter,
                                                     struct sk_buff *skb)
{
	unsigned int r_idx = skb->queue_mapping & (IGB_MAX_TX_QUEUES - 1);

	if (r_idx >= adapter->num_tx_queues)
		r_idx = r_idx % adapter->num_tx_queues;

	return adapter->tx_ring[r_idx];
}

Thanks,
Ben

-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


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

* Re: bug fix for out-of-tree igb driver
  2011-05-04 18:06 bug fix for out-of-tree igb driver Ben Greear
@ 2011-05-04 18:12 ` Jeff Kirsher
  2011-05-04 18:36 ` Wyborny, Carolyn
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Kirsher @ 2011-05-04 18:12 UTC (permalink / raw)
  To: Ben Greear, Carolyn Wyborny; +Cc: netdev

On Wed, May 4, 2011 at 11:06, Ben Greear <greearb@candelatech.com> wrote:
> Just in case someone is using the out-of-tree igb driver, I
> think I found a bug.
>
> The tx_queue_mapping method should have r_idx >= adapter->num_tx_queues
> as shown below.  The driver had: r_idx > adapter->num_tx_queues originally.
>
> Its possible my code is buggy for sending queue_mapping of 1
> when num_tx_queues is 1, but either way, the driver
> shouldn't crash.
>
> Upstream igb driver in mainline kernels does not have this problem.
>
> static inline struct igb_ring *igb_tx_queue_mapping(struct igb_adapter
> *adapter,
>                                                    struct sk_buff *skb)
> {
>        unsigned int r_idx = skb->queue_mapping & (IGB_MAX_TX_QUEUES - 1);
>
>        if (r_idx >= adapter->num_tx_queues)
>                r_idx = r_idx % adapter->num_tx_queues;
>
>        return adapter->tx_ring[r_idx];
> }
>
> Thanks,
> Ben
>

Thanks Ben, I have copied Carolyn so that she is aware of it.

-- 
Cheers,
Jeff

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

* RE: bug fix for out-of-tree igb driver
  2011-05-04 18:06 bug fix for out-of-tree igb driver Ben Greear
  2011-05-04 18:12 ` Jeff Kirsher
@ 2011-05-04 18:36 ` Wyborny, Carolyn
  1 sibling, 0 replies; 3+ messages in thread
From: Wyborny, Carolyn @ 2011-05-04 18:36 UTC (permalink / raw)
  To: Ben Greear, netdev



>-----Original Message-----
>From: netdev-owner@vger.kernel.org [mailto:netdev-owner@vger.kernel.org]
>On Behalf Of Ben Greear
>Sent: Wednesday, May 04, 2011 11:06 AM
>To: netdev
>Subject: bug fix for out-of-tree igb driver
>
>Just in case someone is using the out-of-tree igb driver, I
>think I found a bug.
>
>The tx_queue_mapping method should have r_idx >= adapter->num_tx_queues
>as shown below.  The driver had: r_idx > adapter->num_tx_queues
>originally.
>
>Its possible my code is buggy for sending queue_mapping of 1
>when num_tx_queues is 1, but either way, the driver
>shouldn't crash.
>
>Upstream igb driver in mainline kernels does not have this problem.
>
>static inline struct igb_ring *igb_tx_queue_mapping(struct igb_adapter
>*adapter,
>                                                     struct sk_buff
>*skb)
>{
>	unsigned int r_idx = skb->queue_mapping & (IGB_MAX_TX_QUEUES - 1);
>
>	if (r_idx >= adapter->num_tx_queues)
>		r_idx = r_idx % adapter->num_tx_queues;
>
>	return adapter->tx_ring[r_idx];
>}
>
>Thanks,
>Ben
>
>--
>Ben Greear <greearb@candelatech.com>
>Candela Technologies Inc  http://www.candelatech.com
>
>--
>To unsubscribe from this list: send the line "unsubscribe netdev" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html

Thanks Ben,

I'll be fixing that ASAP and updating the driver version there.

Carolyn

Carolyn Wyborny
Linux Development
LAN Access Division
Intel Corporation




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

end of thread, other threads:[~2011-05-04 18:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-04 18:06 bug fix for out-of-tree igb driver Ben Greear
2011-05-04 18:12 ` Jeff Kirsher
2011-05-04 18:36 ` Wyborny, Carolyn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox