Commit 6ce367e9 authored by Aaro Koskinen's avatar Aaro Koskinen Committed by Kleber Sacilotto de Souza

net: stmmac: don't stop NAPI processing when dropping a packet

BugLink: https://bugs.launchpad.net/bugs/1858489

commit 07b39753 upstream.

Currently, if we drop a packet, we exit from NAPI loop before the budget
is consumed. In some situations this will make the RX processing stall
e.g. when flood pinging the system with oversized packets, as the
errorneous packets are not dropped efficiently.

If we drop a packet, we should just continue to the next one as long as
the budget allows.
Signed-off-by: default avatarAaro Koskinen <aaro.koskinen@nokia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
[acj: backport v4.4 -stable
-adjust context]
Signed-off-by: default avatarAviraj CJ <acj@cisco.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarConnor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 119ecf15
......@@ -2176,8 +2176,7 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv)
static int stmmac_rx(struct stmmac_priv *priv, int limit)
{
unsigned int rxsize = priv->dma_rx_size;
unsigned int entry = priv->cur_rx % rxsize;
unsigned int next_entry;
unsigned int next_entry = priv->cur_rx % rxsize;
unsigned int count = 0;
int coe = priv->hw->rx_csum;
......@@ -2189,9 +2188,11 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit)
stmmac_display_ring((void *)priv->dma_rx, rxsize, 0);
}
while (count < limit) {
int status;
int status, entry;
struct dma_desc *p;
entry = next_entry;
if (priv->extend_desc)
p = (struct dma_desc *)(priv->dma_erx + entry);
else
......@@ -2239,7 +2240,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit)
/* check if frame_len fits the preallocated memory */
if (frame_len > priv->dma_buf_sz) {
priv->dev->stats.rx_length_errors++;
break;
continue;
}
/* ACS is set; GMAC core strips PAD/FCS for IEEE 802.3
......@@ -2260,7 +2261,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit)
pr_err("%s: Inconsistent Rx descriptor chain\n",
priv->dev->name);
priv->dev->stats.rx_dropped++;
break;
continue;
}
prefetch(skb->data - NET_IP_ALIGN);
priv->rx_skbuff[entry] = NULL;
......@@ -2291,7 +2292,6 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit)
priv->dev->stats.rx_packets++;
priv->dev->stats.rx_bytes += frame_len;
}
entry = next_entry;
}
stmmac_rx_refill(priv);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment