Skip to content

Commit 129c6cd

Browse files
edumazetdavem330
authored andcommitted
8139too: revisit napi_complete_done() usage
It seems we have to be more careful in napi_complete_done() use. This patch is not a revert, as it seems we can avoid bug that Ville reported by moving the napi_complete_done() test in the spinlock section. Many thanks to Ville for detective work and all tests. Fixes: 617f012 ("8139too: use napi_complete_done()") Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Tested-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 4c71244 commit 129c6cd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/net/ethernet/realtek/8139too.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2135,11 +2135,12 @@ static int rtl8139_poll(struct napi_struct *napi, int budget)
21352135
if (likely(RTL_R16(IntrStatus) & RxAckBits))
21362136
work_done += rtl8139_rx(dev, tp, budget);
21372137

2138-
if (work_done < budget && napi_complete_done(napi, work_done)) {
2138+
if (work_done < budget) {
21392139
unsigned long flags;
21402140

21412141
spin_lock_irqsave(&tp->lock, flags);
2142-
RTL_W16_F(IntrMask, rtl8139_intr_mask);
2142+
if (napi_complete_done(napi, work_done))
2143+
RTL_W16_F(IntrMask, rtl8139_intr_mask);
21432144
spin_unlock_irqrestore(&tp->lock, flags);
21442145
}
21452146
spin_unlock(&tp->rx_lock);

0 commit comments

Comments
 (0)