1 From c35847181c2176108d0fae1570d86bf88e953c16 Mon Sep 17 00:00:00 2001
2 From: Aaro Koskinen <aaro.koskinen@nokia.com>
3 Date: Wed, 27 Mar 2019 22:35:37 +0200
4 Subject: net: stmmac: don't stop NAPI processing when dropping a packet
6 [ Upstream commit 07b3975352374c3f5ebb4a42ef0b253fe370542d ]
8 Currently, if we drop a packet, we exit from NAPI loop before the budget
9 is consumed. In some situations this will make the RX processing stall
10 e.g. when flood pinging the system with oversized packets, as the
11 errorneous packets are not dropped efficiently.
13 If we drop a packet, we should just continue to the next one as long as
16 Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
17 Signed-off-by: David S. Miller <davem@davemloft.net>
18 Signed-off-by: Sasha Levin (Microsoft) <sashal@kernel.org>
20 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 14 +++++++-------
21 1 file changed, 7 insertions(+), 7 deletions(-)
23 diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
24 index 0ccf91a08290..f0e0593e54f3 100644
25 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
26 +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
27 @@ -3328,9 +3328,8 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
29 struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
30 struct stmmac_channel *ch = &priv->channel[queue];
31 - unsigned int entry = rx_q->cur_rx;
32 + unsigned int next_entry = rx_q->cur_rx;
33 int coe = priv->hw->rx_csum;
34 - unsigned int next_entry;
35 unsigned int count = 0;
38 @@ -3348,10 +3347,12 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
39 stmmac_display_ring(priv, rx_head, DMA_RX_SIZE, true);
41 while (count < limit) {
49 if (priv->extend_desc)
50 p = (struct dma_desc *)(rx_q->dma_erx + entry);
52 @@ -3412,7 +3413,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
53 "len %d larger than size (%d)\n",
54 frame_len, priv->dma_buf_sz);
55 priv->dev->stats.rx_length_errors++;
60 /* ACS is set; GMAC core strips PAD/FCS for IEEE 802.3
61 @@ -3447,7 +3448,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
62 dev_warn(priv->device,
64 priv->dev->stats.rx_dropped++;
69 dma_sync_single_for_cpu(priv->device,
70 @@ -3472,7 +3473,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
71 "%s: Inconsistent Rx chain\n",
73 priv->dev->stats.rx_dropped++;
77 prefetch(skb->data - NET_IP_ALIGN);
78 rx_q->rx_skbuff[entry] = NULL;
79 @@ -3507,7 +3508,6 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
80 priv->dev->stats.rx_packets++;
81 priv->dev->stats.rx_bytes += frame_len;
86 stmmac_rx_refill(priv, queue);