Skip to content

Commit b2b0000

Browse files
haiyangzPaolo Abeni
authored andcommitted
net: mana: Fix TX CQE error handling
For an unknown TX CQE error type (probably from a newer hardware), still free the SKB, update the queue tail, etc., otherwise the accounting will be wrong. Also, TX errors can be triggered by injecting corrupted packets, so replace the WARN_ONCE to ratelimited error logging. Cc: [email protected] Fixes: ca9c54d ("net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)") Signed-off-by: Haiyang Zhang <[email protected]> Reviewed-by: Simon Horman <[email protected]> Reviewed-by: Shradha Gupta <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
1 parent d0f9589 commit b2b0000

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

drivers/net/ethernet/microsoft/mana/mana_en.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,19 +1317,23 @@ static void mana_poll_tx_cq(struct mana_cq *cq)
13171317
case CQE_TX_VPORT_IDX_OUT_OF_RANGE:
13181318
case CQE_TX_VPORT_DISABLED:
13191319
case CQE_TX_VLAN_TAGGING_VIOLATION:
1320-
WARN_ONCE(1, "TX: CQE error %d: ignored.\n",
1321-
cqe_oob->cqe_hdr.cqe_type);
1320+
if (net_ratelimit())
1321+
netdev_err(ndev, "TX: CQE error %d\n",
1322+
cqe_oob->cqe_hdr.cqe_type);
1323+
13221324
apc->eth_stats.tx_cqe_err++;
13231325
break;
13241326

13251327
default:
1326-
/* If the CQE type is unexpected, log an error, assert,
1327-
* and go through the error path.
1328+
/* If the CQE type is unknown, log an error,
1329+
* and still free the SKB, update tail, etc.
13281330
*/
1329-
WARN_ONCE(1, "TX: Unexpected CQE type %d: HW BUG?\n",
1330-
cqe_oob->cqe_hdr.cqe_type);
1331+
if (net_ratelimit())
1332+
netdev_err(ndev, "TX: unknown CQE type %d\n",
1333+
cqe_oob->cqe_hdr.cqe_type);
1334+
13311335
apc->eth_stats.tx_cqe_unknown_type++;
1332-
return;
1336+
break;
13331337
}
13341338

13351339
if (WARN_ON_ONCE(txq->gdma_txq_id != completions[i].wq_num))

0 commit comments

Comments
 (0)