Skip to contentSkip to conversation

atl1c: move tx cleanup processing out of interrupt

PATCH Superseded Gatis Peisenieks 1 participant 1 message Apr 2, 2021

Subsystems (3)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 atl1c: move tx cleanup processing out of interrupt

Tx queue cleanup happens in interrupt handler on same core as rx queue processing. Both can take considerable amount of processing in high packet-per-second scenarios.

Sending big amounts of packets can stall the rx processing which is unfair and also can lead to to out-of-memory condition since __dev_kfree_skb_irq queues the skbs for later kfree in softirq which is not allowed to happen with heavy load in interrupt handler.

This puts tx cleanup in its own napi and enables threaded napi to allow the rx/tx queue processing to happen on different cores. Also as the first in-driver user of dev_set_threaded API, need to add EXPORT_SYMBOL for it.

The ability to sustain equal amounts of tx/rx traffic increased:
from 280Kpps to 1130Kpps on Threadripper 3960X with upcoming Mikrotik 10/25G NIC, from 520Kpps to 850Kpps on Intel i3-3320 with Mikrotik RB44Ge adapter.

---
 drivers/net/ethernet/atheros/atl1c/atl1c.h    |  2 +
 .../net/ethernet/atheros/atl1c/atl1c_main.c   | 44 ++++++++++++++-----
 net/core/dev.c                                |  1 +
 3 files changed, 37 insertions(+), 10 deletions(-)
drivers/net/ethernet/atheros/atl1c/atl1c.h +2 -0
index a0562a90fb6d..4404fa44d719 100644
@@ -506,6 +506,7 @@ struct atl1c_adapter {
 	struct net_device   *netdev;
 	struct pci_dev      *pdev;
 	struct napi_struct  napi;
+	struct napi_struct  tx_napi;
 	struct page         *rx_page;
 	unsigned int	    rx_page_offset;
 	unsigned int	    rx_frag_size;
@@ -529,6 +530,7 @@ struct atl1c_adapter {
 	u16 link_duplex;
 
 	spinlock_t mdio_lock;
+	spinlock_t irq_mask_lock;
 	atomic_t irq_sem;
 
 	struct work_struct common_task;
drivers/net/ethernet/atheros/atl1c/atl1c_main.c +34 -10

113 lines not on this page · raw message

net/core/dev.c +1 -0
index 0f72ff5d34ba..489ac60b530c 100644
@@ -6789,6 +6789,7 @@ int dev_set_threaded(struct net_device *dev, bool threaded)
 
 	return err;
 }
+EXPORT_SYMBOL(dev_set_threaded);
 
 void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
 		    int (*poll)(struct napi_struct *, int), int weight)
Signature · 5 lines
2.28.0

---

More improvements as suggested by Eric Dumazet.