bfin_mac: convert bfin Ethernet driver to NAPI framework
Subsystems (2)
PATCH v9 1/1 bfin_mac: convert bfin Ethernet driver to NAPI framework
From: Sonic Zhang <[email protected]>
Ethernet RX DMA buffers are polled in NAPI work queue other than received directly in DMA RX interrupt handler.
---
v2-changes:
- avoid test NAPI_STATE_NPSVC bit in net device driver
v3-changes:
- use tabs while indenting the code
v4-changes:
- unconditionally complete the NAPI poll and re-enable the MAC_RX IRQ
v5-changes:
- should match open parenthesis
v6-changes:
- keep a count of bfin_mac_interrupt disabled mac_rx irq in the device private area then call enable_irq in bfin_mac_poll
v7-changes:
- only IRQ disable when rx_irq_disabled is zero before the increment and only do the IRQ enable when decrementing rx_irq_disabled will cause it to become zero
v8-changes:
- disable mac rx irq for each call to napi poll in net poll loop and keep irq balanced if netpoll scavenges between napi_schedule_prep and lp->rx_irq_disabled++ on a different CPU, bfin_mac_interrupt may later __napi_schedule while already napi_completed in netpoll...bfin_mac_poll(): bfin_mac_poll won't be run in net_rx_action and IRQ_MAC_RX will stay disabled.
v9-changes:
- Limit rx buffers <= NAPI_POLL_WEIGHT 64.
- Remove useless budget parameter in bfin_mac_rx()
- Remove redundant parenthesis
--- drivers/net/ethernet/adi/Kconfig | 3 +- drivers/net/ethernet/adi/bfin_mac.c | 79 +++++++++++++++++++++++-------------- drivers/net/ethernet/adi/bfin_mac.h | 3 ++ 3 files changed, 53 insertions(+), 32 deletions(-)
drivers/net/ethernet/adi/Kconfig +1 -2
@@ -52,8 +52,7 @@ config BFIN_TX_DESC_NUM config BFIN_RX_DESC_NUM int "Number of receive buffer packets" depends on BFIN_MAC - range 20 100 if BFIN_MAC_USE_L1 - range 20 800 + range 20 64 default "20" ---help--- Set the number of buffer packets used in driver.
drivers/net/ethernet/adi/bfin_mac.c +49 -30
166 lines not on this page · raw message
drivers/net/ethernet/adi/bfin_mac.h +3 -0
@@ -26,6 +26,7 @@#endif #define TX_RECLAIM_JIFFIES (HZ / 5) +#define BFIN_MAC_RX_IRQ_DISABLED 1struct dma_descriptor {struct dma_descriptor *next_dma_desc;
@@ -80,6 +81,8 @@ struct bfin_mac_local {int irq_wake_requested;struct timer_list tx_reclaim_timer;struct net_device *ndev; +struct napi_struct napi; +unsigned long flags;/* Data for EMAC_VLAN1 regs */ u16 vlan1_mask, vlan2_mask;
Signature · 1 line
1.8.2.3
From: Sonic Zhang <[email protected]>
Date: Thu, 24 Jul 2014 17:52:59 +0800
Quoted 6 lines
From: Sonic Zhang <[email protected]>
Ethernet RX DMA buffers are polled in NAPI work queue other than received directly in DMA RX interrupt handler.
Signed-off-by Sonic Zhang <[email protected]>
Applied, thanks.