Skip to content

Commit 818ad9c

Browse files
LorenzoBianconiPaolo Abeni
authored andcommitted
net: veth: fix ethtool stats reporting
Fix a possible misalignment between page_pool stats and tx xdp_stats reported in veth_get_ethtool_stats routine. The issue can be reproduced configuring the veth pair with the following tx/rx queues: $ip link add v0 numtxqueues 2 numrxqueues 4 type veth peer name v1 \ numtxqueues 1 numrxqueues 1 and loading a simple XDP program on v0 that just returns XDP_PASS. In this case on v0 the page_pool stats overwrites tx xdp_stats for queue 1. Fix the issue incrementing pp_idx of dev->real_num_tx_queues * VETH_TQ_STATS_LEN since we always report xdp_stats for all tx queues in ethtool. Fixes: 4fc4180 ("net: veth: add page_pool stats") Signed-off-by: Lorenzo Bianconi <[email protected]> Link: https://lore.kernel.org/r/c5b5d0485016836448453f12846c7c4ab75b094a.1700593593.git.lorenzo@kernel.org Signed-off-by: Paolo Abeni <[email protected]>
1 parent 4aa1d8f commit 818ad9c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/veth.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,8 @@ static void veth_get_ethtool_stats(struct net_device *dev,
236236
data[tx_idx + j] += *(u64 *)(base + offset);
237237
}
238238
} while (u64_stats_fetch_retry(&rq_stats->syncp, start));
239-
pp_idx = tx_idx + VETH_TQ_STATS_LEN;
240239
}
240+
pp_idx = idx + dev->real_num_tx_queues * VETH_TQ_STATS_LEN;
241241

242242
page_pool_stats:
243243
veth_get_page_pool_stats(dev, &data[pp_idx]);

0 commit comments

Comments
 (0)