From: Zijin Tao <taozj888@163.com>
To: maintainer@kernel.org
Cc: linux-kernel@vger.kernel.org, theo.lebrun@bootlin.com,
conor.dooley@microchip.com, andrew+netdev@lunn.ch,
netdev@vger.kernel.org, Zijin Tao <taozj888@163.com>
Subject: [PATCH] net: macb: rate limit netdev error info print in the data path
Date: Sun, 20 Sep 2026 17:58:39 +0800 [thread overview]
Message-ID: <20260920095839.62852-1-taozj888@163.com> (raw)
Now the MACB ethernet driver print the netdev error information
directly by netdev_err(), which would lead to a large number of
error information print if there was a significant number of
error or just jumbo packets received when booting.
For example, it would print a large number of:
macb PHYT0036:00 eth0: not whole frame pointed by descriptor
macb PHYT0036:00 eth0: not whole frame pointed by descriptor
...
in gem_rx() by received a large number of packets without
RX_SOF or RX_EOF flag set.
The unlimited print here would greatly bother and delay
the system booting process unless the source stop sending
packets.
So rate limit the netdev error information print in the receive
and transmit data path.
Signed-off-by: Zijin Tao <taozj888@163.com>
---
drivers/net/ethernet/cadence/macb_main.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index b8234ac4b602..c32d48d03008 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -1617,16 +1617,16 @@ static int gem_rx(struct macb_queue *queue, struct napi_struct *napi,
count++;
if (!(ctrl & MACB_BIT(RX_SOF) && ctrl & MACB_BIT(RX_EOF))) {
- netdev_err(bp->netdev,
- "not whole frame pointed by descriptor\n");
+ if (net_ratelimit())
+ netdev_err(bp->netdev, "not whole frame pointed by descriptor\n");
bp->netdev->stats.rx_dropped++;
queue->stats.rx_dropped++;
break;
}
skb = queue->rx_skbuff[entry];
if (unlikely(!skb)) {
- netdev_err(bp->netdev,
- "inconsistent Rx descriptor chain\n");
+ if (net_ratelimit())
+ netdev_err(bp->netdev, "inconsistent Rx descriptor chain\n");
bp->netdev->stats.rx_dropped++;
queue->stats.rx_dropped++;
break;
@@ -1829,7 +1829,8 @@ static int macb_rx(struct macb_queue *queue, struct napi_struct *napi,
unsigned long flags;
u32 ctrl;
- netdev_err(bp->netdev, "RX queue corruption: reset it\n");
+ if (net_ratelimit())
+ netdev_err(bp->netdev, "RX queue corruption: reset it\n");
spin_lock_irqsave(&bp->lock, flags);
@@ -2102,7 +2103,8 @@ static int macb_interrupt_misc(struct macb_queue *queue, u32 status)
if (status & MACB_BIT(HRESP)) {
queue_work(system_bh_wq, &bp->hresp_err_bh_work);
- netdev_err(netdev, "DMA bus error: HRESP not OK\n");
+ if (net_ratelimit())
+ netdev_err(netdev, "DMA bus error: HRESP not OK\n");
macb_queue_isr_clear(bp, queue, MACB_BIT(HRESP));
}
@@ -2511,7 +2513,8 @@ static netdev_tx_t macb_start_xmit(struct sk_buff *skb,
else
hdrlen = skb_tcp_all_headers(skb);
if (skb_headlen(skb) < hdrlen) {
- netdev_err(bp->netdev, "Error - LSO headers fragmented!!!\n");
+ if (net_ratelimit())
+ netdev_err(bp->netdev, "Error - LSO headers fragmented!!!\n");
/* if this is required, would need to copy to single buffer */
return NETDEV_TX_BUSY;
}
--
2.34.1
next reply other threads:[~2026-09-20 9:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-20 9:58 Zijin Tao [this message]
2026-09-21 8:58 ` [PATCH] net: macb: rate limit netdev error info print in the data path Théo Lebrun
2026-09-21 9:01 ` Théo Lebrun
2026-09-21 10:01 ` netdev-bot+sashiko
-- strict thread matches above, loose matches on Subject: below --
2026-09-20 10:06 Zijin Tao
2026-09-20 10:09 Zijin Tao
2026-09-24 1:17 ` Jakub Kicinski
2026-09-24 9:02 ` Théo Lebrun
2026-09-29 3:56 ` taozj888
2026-09-29 7:45 ` Théo Lebrun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260920095839.62852-1-taozj888@163.com \
--to=taozj888@163.com \
--cc=andrew+netdev@lunn.ch \
--cc=conor.dooley@microchip.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maintainer@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=theo.lebrun@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox