Skip to content

Commit 1cc3bd8

Browse files
Alexander DuyckJeff Kirsher
authored andcommitted
igb: Remove multi_tx_table and simplify igb_xmit_frame
Instead of using the multi_tx_table to map possible Tx queues to Tx rings we can just do simple subtraction for the unlikely event that the Tx queue provided exceeds the number of Tx rings. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
1 parent 6013690 commit 1cc3bd8

2 files changed

Lines changed: 23 additions & 17 deletions

File tree

‎drivers/net/ethernet/intel/igb/igb.h‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ struct igb_adapter;
6363
/* Transmit and receive queues */
6464
#define IGB_MAX_RX_QUEUES (adapter->vfs_allocated_count ? 2 : \
6565
(hw->mac.type > e1000_82575 ? 8 : 4))
66-
#define IGB_ABS_MAX_TX_QUEUES 8
67-
#define IGB_MAX_TX_QUEUES IGB_MAX_RX_QUEUES
66+
#define IGB_MAX_TX_QUEUES 16
6867

6968
#define IGB_MAX_VF_MC_ENTRIES 30
7069
#define IGB_MAX_VF_FUNCTIONS 8
@@ -324,7 +323,6 @@ struct igb_adapter {
324323
/* to not mess up cache alignment, always add to the bottom */
325324
u32 eeprom_wol;
326325

327-
struct igb_ring *multi_tx_table[IGB_ABS_MAX_TX_QUEUES];
328326
u16 tx_ring_count;
329327
u16 rx_ring_count;
330328
unsigned int vfs_allocated_count;

‎drivers/net/ethernet/intel/igb/igb_main.c‎

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1875,7 +1875,7 @@ static int __devinit igb_probe(struct pci_dev *pdev,
18751875

18761876
err = -ENOMEM;
18771877
netdev = alloc_etherdev_mq(sizeof(struct igb_adapter),
1878-
IGB_ABS_MAX_TX_QUEUES);
1878+
IGB_MAX_TX_QUEUES);
18791879
if (!netdev)
18801880
goto err_alloc_etherdev;
18811881

@@ -2620,10 +2620,6 @@ static int igb_setup_all_tx_resources(struct igb_adapter *adapter)
26202620
}
26212621
}
26222622

2623-
for (i = 0; i < IGB_ABS_MAX_TX_QUEUES; i++) {
2624-
int r_idx = i % adapter->num_tx_queues;
2625-
adapter->multi_tx_table[i] = adapter->tx_ring[r_idx];
2626-
}
26272623
return err;
26282624
}
26292625

@@ -4363,12 +4359,21 @@ netdev_tx_t igb_xmit_frame_ring(struct sk_buff *skb,
43634359
return NETDEV_TX_OK;
43644360
}
43654361

4362+
static inline struct igb_ring *igb_tx_queue_mapping(struct igb_adapter *adapter,
4363+
struct sk_buff *skb)
4364+
{
4365+
unsigned int r_idx = skb->queue_mapping;
4366+
4367+
if (r_idx >= adapter->num_tx_queues)
4368+
r_idx = r_idx % adapter->num_tx_queues;
4369+
4370+
return adapter->tx_ring[r_idx];
4371+
}
4372+
43664373
static netdev_tx_t igb_xmit_frame(struct sk_buff *skb,
43674374
struct net_device *netdev)
43684375
{
43694376
struct igb_adapter *adapter = netdev_priv(netdev);
4370-
struct igb_ring *tx_ring;
4371-
int r_idx = 0;
43724377

43734378
if (test_bit(__IGB_DOWN, &adapter->state)) {
43744379
dev_kfree_skb_any(skb);
@@ -4380,14 +4385,17 @@ static netdev_tx_t igb_xmit_frame(struct sk_buff *skb,
43804385
return NETDEV_TX_OK;
43814386
}
43824387

4383-
r_idx = skb->queue_mapping & (IGB_ABS_MAX_TX_QUEUES - 1);
4384-
tx_ring = adapter->multi_tx_table[r_idx];
4388+
/*
4389+
* The minimum packet size with TCTL.PSP set is 17 so pad the skb
4390+
* in order to meet this minimum size requirement.
4391+
*/
4392+
if (skb->len < 17) {
4393+
if (skb_padto(skb, 17))
4394+
return NETDEV_TX_OK;
4395+
skb->len = 17;
4396+
}
43854397

4386-
/* This goes back to the question of how to logically map a tx queue
4387-
* to a flow. Right now, performance is impacted slightly negatively
4388-
* if using multiple tx queues. If the stack breaks away from a
4389-
* single qdisc implementation, we can look at this again. */
4390-
return igb_xmit_frame_ring(skb, tx_ring);
4398+
return igb_xmit_frame_ring(skb, igb_tx_queue_mapping(adapter, skb));
43914399
}
43924400

43934401
/**

0 commit comments

Comments
 (0)