diff options
author | Yan Markman <ymarkman@marvell.com> | 2018-05-17 10:34:27 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-05-17 16:18:55 -0400 |
commit | 934e0f8330a483a582805c640ef9885b4e69aa63 (patch) | |
tree | f385024e504281d55137eaf4ebc3af7264ebe495 /drivers | |
parent | 5b0ab2f41d7593d87762dce1cbaf548f988a2917 (diff) | |
download | linux-stable-934e0f8330a483a582805c640ef9885b4e69aa63.tar.gz linux-stable-934e0f8330a483a582805c640ef9885b4e69aa63.tar.bz2 linux-stable-934e0f8330a483a582805c640ef9885b4e69aa63.zip |
net: mvpp2: print rx error with rate-limit
Prevent flood of RX error prints during heavy traffic with weak signal
in link by checking net_ratelimit() before using netdev_err().
Signed-off-by: Yan Markman <ymarkman@marvell.com>
[Antoine: small rework, commit message]
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/marvell/mvpp2.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c index 8c9496002bd7..7ba7e5938c2e 100644 --- a/drivers/net/ethernet/marvell/mvpp2.c +++ b/drivers/net/ethernet/marvell/mvpp2.c @@ -6381,21 +6381,23 @@ static void mvpp2_rx_error(struct mvpp2_port *port, { u32 status = mvpp2_rxdesc_status_get(port, rx_desc); size_t sz = mvpp2_rxdesc_size_get(port, rx_desc); + char *err_str = NULL; switch (status & MVPP2_RXD_ERR_CODE_MASK) { case MVPP2_RXD_ERR_CRC: - netdev_err(port->dev, "bad rx status %08x (crc error), size=%zu\n", - status, sz); + err_str = "crc"; break; case MVPP2_RXD_ERR_OVERRUN: - netdev_err(port->dev, "bad rx status %08x (overrun error), size=%zu\n", - status, sz); + err_str = "overrun"; break; case MVPP2_RXD_ERR_RESOURCE: - netdev_err(port->dev, "bad rx status %08x (resource error), size=%zu\n", - status, sz); + err_str = "resource"; break; } + if (err_str && net_ratelimit()) + netdev_err(port->dev, + "bad rx status %08x (%s error), size=%zu\n", + status, err_str, sz); } /* Handle RX checksum offload */ |