Skip to content

Commit 20a1b6b

Browse files
Gatis Peiseniekskuba-moo
authored andcommitted
atl1c: move tx napi into tpd_ring
To get more performance from using multiple tx queues one needs a per tx queue napi. Move tx napi from per adapter struct into per tx queue struct. Patch that actually enables multiple tx queues will follow. Signed-off-by: Gatis Peisenieks <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent bf3be85 commit 20a1b6b

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

drivers/net/ethernet/atheros/atl1c/atl1c.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,13 +475,16 @@ struct atl1c_buffer {
475475

476476
/* transimit packet descriptor (tpd) ring */
477477
struct atl1c_tpd_ring {
478+
struct atl1c_adapter *adapter;
478479
void *desc; /* descriptor ring virtual address */
479480
dma_addr_t dma; /* descriptor ring physical address */
481+
u16 num;
480482
u16 size; /* descriptor ring length in bytes */
481483
u16 count; /* number of descriptors in the ring */
482484
u16 next_to_use;
483485
atomic_t next_to_clean;
484486
struct atl1c_buffer *buffer_info;
487+
struct napi_struct napi;
485488
};
486489

487490
/* receive free descriptor (rfd) ring */
@@ -510,7 +513,6 @@ struct atl1c_adapter {
510513
struct net_device *netdev;
511514
struct pci_dev *pdev;
512515
struct napi_struct napi;
513-
struct napi_struct tx_napi;
514516
struct page *rx_page;
515517
unsigned int rx_page_offset;
516518
unsigned int rx_frag_size;

drivers/net/ethernet/atheros/atl1c/atl1c_main.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -983,6 +983,8 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter)
983983
goto err_nomem;
984984

985985
for (i = 0; i < AT_MAX_TRANSMIT_QUEUE; i++) {
986+
tpd_ring[i].adapter = adapter;
987+
tpd_ring[i].num = i;
986988
tpd_ring[i].buffer_info =
987989
(tpd_ring->buffer_info + count);
988990
count += tpd_ring[i].count;
@@ -1533,9 +1535,9 @@ static inline void atl1c_clear_phy_int(struct atl1c_adapter *adapter)
15331535

15341536
static int atl1c_clean_tx(struct napi_struct *napi, int budget)
15351537
{
1536-
struct atl1c_adapter *adapter =
1537-
container_of(napi, struct atl1c_adapter, tx_napi);
1538-
struct atl1c_tpd_ring *tpd_ring = &adapter->tpd_ring[atl1c_trans_normal];
1538+
struct atl1c_tpd_ring *tpd_ring =
1539+
container_of(napi, struct atl1c_tpd_ring, napi);
1540+
struct atl1c_adapter *adapter = tpd_ring->adapter;
15391541
struct atl1c_buffer *buffer_info;
15401542
struct pci_dev *pdev = adapter->pdev;
15411543
u16 next_to_clean = atomic_read(&tpd_ring->next_to_clean);
@@ -1615,12 +1617,12 @@ static irqreturn_t atl1c_intr(int irq, void *data)
16151617
}
16161618
}
16171619
if (status & ISR_TX_PKT) {
1618-
if (napi_schedule_prep(&adapter->tx_napi)) {
1620+
if (napi_schedule_prep(&adapter->tpd_ring[0].napi)) {
16191621
spin_lock(&hw->intr_mask_lock);
16201622
hw->intr_mask &= ~ISR_TX_PKT;
16211623
AT_WRITE_REG(hw, REG_IMR, hw->intr_mask);
16221624
spin_unlock(&hw->intr_mask_lock);
1623-
__napi_schedule(&adapter->tx_napi);
1625+
__napi_schedule(&adapter->tpd_ring[0].napi);
16241626
}
16251627
}
16261628

@@ -2354,7 +2356,7 @@ static int atl1c_up(struct atl1c_adapter *adapter)
23542356
atl1c_check_link_status(adapter);
23552357
clear_bit(__AT_DOWN, &adapter->flags);
23562358
napi_enable(&adapter->napi);
2357-
napi_enable(&adapter->tx_napi);
2359+
napi_enable(&adapter->tpd_ring[0].napi);
23582360
atl1c_irq_enable(adapter);
23592361
netif_start_queue(netdev);
23602362
return err;
@@ -2375,7 +2377,7 @@ static void atl1c_down(struct atl1c_adapter *adapter)
23752377
set_bit(__AT_DOWN, &adapter->flags);
23762378
netif_carrier_off(netdev);
23772379
napi_disable(&adapter->napi);
2378-
napi_disable(&adapter->tx_napi);
2380+
napi_disable(&adapter->tpd_ring[0].napi);
23792381
atl1c_irq_disable(adapter);
23802382
atl1c_free_irq(adapter);
23812383
/* disable ASPM if device inactive */
@@ -2632,7 +2634,7 @@ static int atl1c_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
26322634
adapter->mii.reg_num_mask = MDIO_CTRL_REG_MASK;
26332635
dev_set_threaded(netdev, true);
26342636
netif_napi_add(netdev, &adapter->napi, atl1c_clean, 64);
2635-
netif_napi_add(netdev, &adapter->tx_napi, atl1c_clean_tx, 64);
2637+
netif_napi_add(netdev, &adapter->tpd_ring[0].napi, atl1c_clean_tx, 64);
26362638
timer_setup(&adapter->phy_config_timer, atl1c_phy_config, 0);
26372639
/* setup the private structure */
26382640
err = atl1c_sw_init(adapter);

0 commit comments

Comments
 (0)