]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/5.0.14/net-stmmac-don-t-stop-napi-processing-when-dropping-.patch
Linux 4.19.41
[thirdparty/kernel/stable-queue.git] / releases / 5.0.14 / net-stmmac-don-t-stop-napi-processing-when-dropping-.patch
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
5
6 [ Upstream commit 07b3975352374c3f5ebb4a42ef0b253fe370542d ]
7
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.
12
13 If we drop a packet, we should just continue to the next one as long as
14 the budget allows.
15
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>
19 ---
20 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 14 +++++++-------
21 1 file changed, 7 insertions(+), 7 deletions(-)
22
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)
28 {
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;
36 bool xmac;
37
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);
40 }
41 while (count < limit) {
42 - int status;
43 + int entry, status;
44 struct dma_desc *p;
45 struct dma_desc *np;
46
47 + entry = next_entry;
48 +
49 if (priv->extend_desc)
50 p = (struct dma_desc *)(rx_q->dma_erx + entry);
51 else
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++;
56 - break;
57 + continue;
58 }
59
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,
63 "packet dropped\n");
64 priv->dev->stats.rx_dropped++;
65 - break;
66 + continue;
67 }
68
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",
72 priv->dev->name);
73 priv->dev->stats.rx_dropped++;
74 - break;
75 + continue;
76 }
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;
82 }
83 - entry = next_entry;
84 }
85
86 stmmac_rx_refill(priv, queue);
87 --
88 2.20.1
89