From 057e98ec7bb0e9dffaa92a293f0cb51ce43a56eb Mon Sep 17 00:00:00 2001 From: liting Date: Sat, 4 Jul 2026 17:01:26 +0800 Subject: [PATCH] net: vwifi: fix missing tx statistics in virtio mode In virtio mode, the vwifi_ndo_start_xmit() directly returns the result of vwifi_virtio_tx() without updating the transmission statistics. This patch adds the proper statistics accounting (tx_packets, tx_bytes, and tx_dropped) directly inside vwifi_virtio_tx(). Signed-off-by: liting --- vwifi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vwifi.c b/vwifi.c index 287e558..588fdd8 100644 --- a/vwifi.c +++ b/vwifi.c @@ -3143,6 +3143,7 @@ static netdev_tx_t vwifi_virtio_tx(struct vwifi_vif *vif, struct sk_buff *skb) struct virtio_net_hdr_mrg_rxbuf *hdr = (struct virtio_net_hdr_mrg_rxbuf *) skb->cb; struct scatterlist sg[2]; + unsigned int pkt_len = skb->len; int err; unsigned long flags; @@ -3168,11 +3169,14 @@ static netdev_tx_t vwifi_virtio_tx(struct vwifi_vif *vif, struct sk_buff *skb) pr_info("%s: virtqueue_kick fail\n", __func__); goto out_free; } + vif->stats.tx_packets++; + vif->stats.tx_bytes += pkt_len; spin_unlock_irqrestore(&vwifi_virtio_lock, flags); return NETDEV_TX_OK; out_free: + vif->stats.tx_dropped++; spin_unlock_irqrestore(&vwifi_virtio_lock, flags); dev_kfree_skb(skb); return err;