Skip to contentSkip to conversation

bug fix for out-of-tree igb driver

DISCUSSION Ben Greear 3 participants 3 messages May 4, 2011

Subsystems (2)
lore
Share & tools
lore

Ben Greear

author
#0 lore raw

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

Signature · 2 lines
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com
#1 lore raw
Quoted 18 lines · Ben Greear

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

Quoted 9 lines

       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.

Signature · 2 lines
Cheers,
Jeff
#2 lore raw
In reply to Ben Greear
Quoted 38 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] 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

Quoted 8 lines

--
Ben Greear <[email protected]>
Candela Technologies Inc http://www.candelatech.com

--
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
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