Skip to content

Commit

Permalink
snull: use napi_schedule_prep() to prevent packet loss
Browse files Browse the repository at this point in the history
By using napi_schedule_prep() and __napi_schedule(), ensure NAPI polls
are scheduled before disabling interrupts. This prevents dropped polls
and ensures rx_int_enabled is properly updated, fixing 100% packet loss
during state changes.

Authored-by: Leon <[email protected]>
Signed-off-by: Iman Seyed <[email protected]>
  • Loading branch information
ImanSeyed committed Oct 20, 2024
1 parent 5fb7f9c commit a0ebff1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions snull/snull.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,9 @@ static void snull_napi_interrupt(int irq, void *dev_id, struct pt_regs *regs)
/* retrieve statusword: real netdevices use I/O instructions */
statusword = priv->status;
priv->status = 0;
if (statusword & SNULL_RX_INTR) {
if (statusword & SNULL_RX_INTR && napi_schedule_prep(&priv->napi)) {
snull_rx_ints(dev, 0); /* Disable further interrupts */
napi_schedule(&priv->napi);
__napi_schedule(&priv->napi);
}
if (statusword & SNULL_TX_INTR) {
/* a transmission is over: free the skb */
Expand Down

0 comments on commit a0ebff1

Please sign in to comment.