Skip to content

Commit 5718458

Browse files
shimodaydavem330
authored andcommitted
net: renesas: ravb: Fix a stuck issue when a lot of frames are received
When a lot of frames were received in the short term, the driver caused a stuck of receiving until a new frame was received. For example, the following command from other device could cause this issue. $ sudo ping -f -l 1000 -c 1000 <this driver's ipaddress> The previous code always cleared the interrupt flag of RX but checks the interrupt flags in ravb_poll(). So, ravb_poll() could not call ravb_rx() in the next time until a new RX frame was received if ravb_rx() returned true. To fix the issue, always calls ravb_rx() regardless the interrupt flags condition. Fixes: c156633 ("Renesas Ethernet AVB driver proper") Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 5e6038b commit 5718458

File tree

1 file changed

+12
-23
lines changed

1 file changed

+12
-23
lines changed

drivers/net/ethernet/renesas/ravb_main.c

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -911,31 +911,20 @@ static int ravb_poll(struct napi_struct *napi, int budget)
911911
int q = napi - priv->napi;
912912
int mask = BIT(q);
913913
int quota = budget;
914-
u32 ris0, tis;
915914

916-
for (;;) {
917-
tis = ravb_read(ndev, TIS);
918-
ris0 = ravb_read(ndev, RIS0);
919-
if (!((ris0 & mask) || (tis & mask)))
920-
break;
915+
/* Processing RX Descriptor Ring */
916+
/* Clear RX interrupt */
917+
ravb_write(ndev, ~(mask | RIS0_RESERVED), RIS0);
918+
if (ravb_rx(ndev, &quota, q))
919+
goto out;
921920

922-
/* Processing RX Descriptor Ring */
923-
if (ris0 & mask) {
924-
/* Clear RX interrupt */
925-
ravb_write(ndev, ~(mask | RIS0_RESERVED), RIS0);
926-
if (ravb_rx(ndev, &quota, q))
927-
goto out;
928-
}
929-
/* Processing TX Descriptor Ring */
930-
if (tis & mask) {
931-
spin_lock_irqsave(&priv->lock, flags);
932-
/* Clear TX interrupt */
933-
ravb_write(ndev, ~(mask | TIS_RESERVED), TIS);
934-
ravb_tx_free(ndev, q, true);
935-
netif_wake_subqueue(ndev, q);
936-
spin_unlock_irqrestore(&priv->lock, flags);
937-
}
938-
}
921+
/* Processing RX Descriptor Ring */
922+
spin_lock_irqsave(&priv->lock, flags);
923+
/* Clear TX interrupt */
924+
ravb_write(ndev, ~(mask | TIS_RESERVED), TIS);
925+
ravb_tx_free(ndev, q, true);
926+
netif_wake_subqueue(ndev, q);
927+
spin_unlock_irqrestore(&priv->lock, flags);
939928

940929
napi_complete(napi);
941930

0 commit comments

Comments
 (0)