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 <liew.s.piaw@gmail.com>
This commit is contained in:
Sieng-Piaw Liew 2022-07-08 09:03:53 +08:00 committed by Christian Marangi
parent ba7da73680
commit 3acd2ea148
No known key found for this signature in database
GPG Key ID: AC001D09ADBFEAD7

View File

@ -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);