net: ntb_netdev: Count packets dropped on RX refill failure

When replacement skb allocation fails, ntb_netdev drops a packet that
was received successfully and requeues the original buffer. The drop is
counted, but rx_packets and rx_bytes are not.

Count every good packet before allocating its replacement.

Fixes: d2121faf13 ("NTB: ntb_netdev: Preserve RX queue depth on allocation failure")
Cc: stable@vger.kernel.org
Signed-off-by: Koichiro Den <den@valinux.co.jp>
Link: https://patch.msgid.link/20260819172539.1450821-3-den@valinux.co.jp
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Koichiro Den 2026-08-20 02:25:39 +09:00 committed by Jakub Kicinski
parent 82e15be2d8
commit 31ded341c3

View File

@ -144,6 +144,9 @@ static void ntb_netdev_rx_handler(struct ntb_transport_qp *qp, void *qp_data,
goto enqueue_again;
}
ndev->stats.rx_packets++;
ndev->stats.rx_bytes += len;
new_skb = netdev_alloc_skb(ndev, ndev->mtu + ETH_HLEN);
if (!new_skb) {
ndev->stats.rx_dropped++;
@ -156,8 +159,6 @@ static void ntb_netdev_rx_handler(struct ntb_transport_qp *qp, void *qp_data,
skb_record_rx_queue(skb, q->qid);
netif_rx(skb);
ndev->stats.rx_packets++;
ndev->stats.rx_bytes += len;
skb = new_skb;