Subject: bug fix for out-of-tree igb driver

From: Ben Greear <[email-masked]>
Date: Wed, 04 May 2011 11:06:19 -0700

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 <[email-masked]>
Candela Technologies Inc  http://www.candelatech.com