Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cda4985a authored by Jose Abreu's avatar Jose Abreu Committed by David S. Miller
Browse files

net: stmmac: Fix the packet count in stmmac_rx()



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: ec222003 ("net: stmmac: Prepare to add Split Header support")
Signed-off-by: default avatarJose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent aeb18dd0
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -3506,8 +3506,6 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
		if (unlikely(status & dma_own))
		if (unlikely(status & dma_own))
			break;
			break;


		count++;

		rx_q->cur_rx = STMMAC_GET_ENTRY(rx_q->cur_rx, DMA_RX_SIZE);
		rx_q->cur_rx = STMMAC_GET_ENTRY(rx_q->cur_rx, DMA_RX_SIZE);
		next_entry = rx_q->cur_rx;
		next_entry = rx_q->cur_rx;


@@ -3534,6 +3532,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
			goto read_again;
			goto read_again;
		if (unlikely(error)) {
		if (unlikely(error)) {
			dev_kfree_skb(skb);
			dev_kfree_skb(skb);
			count++;
			continue;
			continue;
		}
		}


@@ -3573,6 +3572,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
			skb = napi_alloc_skb(&ch->rx_napi, len);
			skb = napi_alloc_skb(&ch->rx_napi, len);
			if (!skb) {
			if (!skb) {
				priv->dev->stats.rx_dropped++;
				priv->dev->stats.rx_dropped++;
				count++;
				continue;
				continue;
			}
			}


@@ -3638,6 +3638,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)


		priv->dev->stats.rx_packets++;
		priv->dev->stats.rx_packets++;
		priv->dev->stats.rx_bytes += len;
		priv->dev->stats.rx_bytes += len;
		count++;
	}
	}


	if (status & rx_not_ls) {
	if (status & rx_not_ls) {