From: Sieng-Piaw Liew Date: Fri, 8 Jul 2022 01:03:53 +0000 (+0800) Subject: ath79: fix Tx cleanup when NAPI poll budget is zero X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=3acd2ea14802aa39a8a25a2f20b1a6a20efca3f2;p=openwrt%2Fstaging%2Fjogo.git ath79: fix Tx cleanup when NAPI poll budget is zero NAPI poll() function may be passed a budget value of zero, i.e. during netpoll, which isn't NAPI context. Therefore, napi_consume_skb() must be given budget value instead of !flush to truly discern netpoll-like scenarios. https://lore.kernel.org/netdev/20220707141056.2644-1-liew.s.piaw@gmail.com/t/#m470f5c20225e76fb08c44d6cfa2f1b739ffaaea4 Signed-off-by: Sieng-Piaw Liew --- diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c index d6e8dd20c8..d553c62401 100644 --- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c +++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c @@ -34,7 +34,7 @@ MODULE_PARM_DESC(msg_level, "Message level (-1=defaults,0=none,...,16=all)"); #define ETH_SWITCH_HEADER_LEN 2 -static int ag71xx_tx_packets(struct ag71xx *ag, bool flush); +static int ag71xx_tx_packets(struct ag71xx *ag, bool flush, int budget); static inline unsigned int ag71xx_max_frame_len(unsigned int mtu) { @@ -478,7 +478,7 @@ static void ag71xx_fast_reset(struct ag71xx *ag) mii_reg = ag71xx_rr(ag, AG71XX_REG_MII_CFG); rx_ds = ag71xx_rr(ag, AG71XX_REG_RX_DESC); - ag71xx_tx_packets(ag, true); + ag71xx_tx_packets(ag, true, 0); reset_control_assert(ag->mac_reset); udelay(10); @@ -1245,7 +1245,7 @@ static bool ag71xx_check_dma_stuck(struct ag71xx *ag) return false; } -static int ag71xx_tx_packets(struct ag71xx *ag, bool flush) +static int ag71xx_tx_packets(struct ag71xx *ag, bool flush, int budget) { struct ag71xx_ring *ring = &ag->tx_ring; bool dma_stuck = false; @@ -1278,7 +1278,7 @@ static int ag71xx_tx_packets(struct ag71xx *ag, bool flush) if (!skb) continue; - napi_consume_skb(skb, !flush); + napi_consume_skb(skb, budget); ring->buf[i].skb = NULL; bytes_compl += ring->buf[i].len; @@ -1404,7 +1404,7 @@ static int ag71xx_poll(struct napi_struct *napi, int limit) int tx_done; int rx_done; - tx_done = ag71xx_tx_packets(ag, false); + tx_done = ag71xx_tx_packets(ag, false, limit); DBG("%s: processing RX ring\n", dev->name); rx_done = ag71xx_rx_packets(ag, limit);