]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net: stmmac: Fix the packet count in stmmac_rx()
authorJose Abreu <Jose.Abreu@synopsys.com>
Wed, 6 Nov 2019 15:03:03 +0000 (16:03 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 7 Nov 2019 05:22:55 +0000 (21:22 -0800)
Currently, stmmac_rx() is counting the number of descriptors but it
should count the number of packets as specified by the NAPI limit.

Fix this.

Fixes: ec222003bd94 ("net: stmmac: Prepare to add Split Header support")
Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

index 4e9c848c67ccc93477839c34959cb6f3760e7e35..1ab1eea1556adf1153b66c7a82b674c60042e3af 100644 (file)
@@ -3506,8 +3506,6 @@ read_again:
                if (unlikely(status & dma_own))
                        break;
 
-               count++;
-
                rx_q->cur_rx = STMMAC_GET_ENTRY(rx_q->cur_rx, DMA_RX_SIZE);
                next_entry = rx_q->cur_rx;
 
@@ -3534,6 +3532,7 @@ read_again:
                        goto read_again;
                if (unlikely(error)) {
                        dev_kfree_skb(skb);
+                       count++;
                        continue;
                }
 
@@ -3573,6 +3572,7 @@ read_again:
                        skb = napi_alloc_skb(&ch->rx_napi, len);
                        if (!skb) {
                                priv->dev->stats.rx_dropped++;
+                               count++;
                                continue;
                        }
 
@@ -3638,6 +3638,7 @@ read_again:
 
                priv->dev->stats.rx_packets++;
                priv->dev->stats.rx_bytes += len;
+               count++;
        }
 
        if (status & rx_not_ls) {