Commit d7aba644 authored by Lendacky, Thomas's avatar Lendacky, Thomas Committed by David S. Miller

amd-xgbe: Enable IRQs only if napi_complete_done() is true

Depending on the hardware, the amd-xgbe driver may use disable_irq_nosync()
and enable_irq() when an interrupt is received to process Rx packets. If
the napi_complete_done() return value isn't checked an unbalanced enable
for the IRQ could result, generating a warning stack trace.

Update the driver to only enable interrupts if napi_complete_done() returns
true.
Reported-by: default avatarJeremy Linton <jeremy.linton@arm.com>
Signed-off-by: default avatarTom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6fc166d6
...@@ -2272,10 +2272,7 @@ static int xgbe_one_poll(struct napi_struct *napi, int budget) ...@@ -2272,10 +2272,7 @@ static int xgbe_one_poll(struct napi_struct *napi, int budget)
processed = xgbe_rx_poll(channel, budget); processed = xgbe_rx_poll(channel, budget);
/* If we processed everything, we are done */ /* If we processed everything, we are done */
if (processed < budget) { if ((processed < budget) && napi_complete_done(napi, processed)) {
/* Turn off polling */
napi_complete_done(napi, processed);
/* Enable Tx and Rx interrupts */ /* Enable Tx and Rx interrupts */
if (pdata->channel_irq_mode) if (pdata->channel_irq_mode)
xgbe_enable_rx_tx_int(pdata, channel); xgbe_enable_rx_tx_int(pdata, channel);
...@@ -2317,10 +2314,7 @@ static int xgbe_all_poll(struct napi_struct *napi, int budget) ...@@ -2317,10 +2314,7 @@ static int xgbe_all_poll(struct napi_struct *napi, int budget)
} while ((processed < budget) && (processed != last_processed)); } while ((processed < budget) && (processed != last_processed));
/* If we processed everything, we are done */ /* If we processed everything, we are done */
if (processed < budget) { if ((processed < budget) && napi_complete_done(napi, processed)) {
/* Turn off polling */
napi_complete_done(napi, processed);
/* Enable Tx and Rx interrupts */ /* Enable Tx and Rx interrupts */
xgbe_enable_rx_tx_ints(pdata); xgbe_enable_rx_tx_ints(pdata);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment