History

net: ethernet: cortina: Finish RX updates before NAPI completion

napi_complete_done() releases ownership of the NAPI instance, but the Gemini poll keeps the RX statistics writer section open and updates the free queue after calling it. A new poll can therefore start while the old writer is still active. Finish the statistics and free queue updates before releasing ownership. Only re-enable RX interrupts when napi_complete_done() reports successful completion.

Linus Walleij committed 2 months ago

Commit baa26841 parent a0de06d1 file · +6 −6Browse files

Unified · Split

drivers/net/ethernet/cortina/gemini.c+6−6
@@ -1581,12 +1581,10 @@ static int gmac_napi_poll(struct napi_struct *napi, int budget) · 1580 unmodified lines
15811581 u64_stats_update_begin(&port->rx_stats_syncp);
15821582
15831583 received = gmac_rx(napi->dev, budget);
1584− if (received < budget) {
1585− napi_gro_flush(napi, false);
1586− napi_complete_done(napi, received);
1587− gmac_enable_rx_irq(napi->dev, 1);
1584+ if (received < budget)
15881585 ++port->rx_napi_exits;
1589− }
1586+
1587+ u64_stats_update_end(&port->rx_stats_syncp);
15901588
15911589 port->freeq_refill += received;
15921590 if (port->freeq_refill > freeq_threshold) {
@@ -1594,7 +1592,9 @@ static int gmac_napi_poll(struct napi_struct *napi, int budget) · 1 unmodified line
15941592 geth_fill_freeq(geth, true);
15951593 }
15961594
1597− u64_stats_update_end(&port->rx_stats_syncp);
1595+ if (received < budget && napi_complete_done(napi, received))
1596+ gmac_enable_rx_irq(napi->dev, 1);
1597+
15981598 return received;
15991599 }
16001600