The netdev TX queue-statistics callback reports packets and bytes from the ENIC work queue. Stack skb transmit updates these counters, but native XDP and AF_XDP transmit do not. The XDP driver selftest therefore sees fewer TX packets than the XDP program transmitted. Count successfully queued XDP frames, XSK RX-to-TX frames, and AF_XDP TX descriptors under the existing work-queue lock. Keep the XSK-specific counters for AF_XDP diagnostics. Signed-off-by: Satish Kharat --- drivers/net/ethernet/cisco/enic/enic_xdp.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ethernet/cisco/enic/enic_xdp.c b/drivers/net/ethernet/cisco/enic/enic_xdp.c index b6989a4dd79b..f9d3090251ec 100644 --- a/drivers/net/ethernet/cisco/enic/enic_xdp.c +++ b/drivers/net/ethernet/cisco/enic/enic_xdp.c @@ -114,6 +114,8 @@ static int enic_xdp_xmit_frame(struct enic *enic, unsigned int wq_index, enic_queue_wq_desc(vwq, xdpf, dma_addr, xdpf->len, 0, 0, 1, 0); buf->type = VNIC_WQ_BUF_XDP; buf->xdp_dma_mapped = dma_mapped; + wq->stats.packets++; + wq->stats.bytes += xdpf->len; WRITE_ONCE(wq->xdp_tx_pending, true); spin_unlock(&wq->lock); @@ -145,6 +147,8 @@ static int enic_xdp_xmit_xsk_rx(struct enic *enic, unsigned int wq_index, buf = wq->vwq.to_use; enic_queue_wq_desc(&wq->vwq, xdp, dma_addr, len, 0, 0, 1, 0); buf->type = VNIC_WQ_BUF_XSK_RX; + wq->stats.packets++; + wq->stats.bytes += len; WRITE_ONCE(wq->xdp_tx_pending, true); spin_unlock(&wq->lock); @@ -480,6 +484,8 @@ bool enic_xsk_tx_service(struct enic *enic, unsigned int wq_index) 0, 0, 1, 0); buf->type = VNIC_WQ_BUF_XSK; buf->xsk_pool = pool; + wq->stats.packets++; + wq->stats.bytes += descs[i].len; wq->stats.xsk_tx_pkts++; wq->stats.xsk_tx_bytes += descs[i].len; } -- 2.43.0