Re: [PATCH net v3 1/1] net: macb: rate limit netdev error info print in the data path
From: Jacob Keller
Date: Tue Oct 06 2026 - 17:25:49 EST
On 10/4/2026 6:39 AM, taozj888@xxxxxxx wrote:
> From: taozijin <taozj888@xxxxxxx>
>
> 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 exceeding the MTU 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 having received a large number of packets without
> RX_EOF flag set, especially with unknown packet
> type that would penetrate the hardware offload for the IP packets.
>
> The unlimited prints here would greatly bother and delay
> the system booting process unless the source stop sending
> packets since they occupy the console output bandwidth and
> other processes have to wait for the completion of printing those
> messages.
>
> So rate limit the netdev error information print in the receive
> and transmit data path.
>
> Fixes: 89e5785fc8a6 ("[PATCH] Atmel MACB ethernet driver")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Zijin Tao <taozj888@xxxxxxx>
> ---
> drivers/net/ethernet/cadence/macb_main.c | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index 8e5c034dc3a4..ca60960bec36 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");
I am surprised that there is no equivalent of netdev_err_ratelimited
like there is for dev_err_ratelimited.
Reviewed-by: Jacob Keller <jacob.e.keller@xxxxxxxxx>