Re: [PATCH net] net: ifb: clamp ethtool stats loops to num_tx_queues

From: Jakub Kicinski

Date: Wed May 13 2026 - 21:06:37 EST


On Mon, 11 May 2026 08:28:35 -0400 Michael Bommarito wrote:
> static void ifb_get_ethtool_stats(struct net_device *dev,
> struct ethtool_stats *stats, u64 *data)
> {
> struct ifb_dev_private *dp = netdev_priv(dev);
> struct ifb_q_private *txp;
> + unsigned int n_queues = dev->num_tx_queues;
> int i;
>
> for (i = 0; i < dev->real_num_rx_queues; i++) {
> - txp = dp->tx_private + i;
> - ifb_fill_stats_data(&data, &txp->rx_stats);
> + if (i >= n_queues) {
> + ifb_fill_empty_stats_data(&data);
> + continue;
> + }
> +
> + txp = dp->tx_private + i;
> + ifb_fill_stats_data(&data, &txp->rx_stats);
> }
>
> for (i = 0; i < dev->real_num_tx_queues; i++) {
> - txp = dp->tx_private + i;
> - ifb_fill_stats_data(&data, &txp->tx_stats);
> + if (i >= n_queues) {
> + ifb_fill_empty_stats_data(&data);
> + continue;
> + }
> +
> + txp = dp->tx_private + i;
> + ifb_fill_stats_data(&data, &txp->tx_stats);
> }

Take a look at ifb_stats64(), queues without Tx can't Rx here.
The use of real_* members is also not correct, the device
should report stats for all queues it has, not just active ones.
So please rewrite the ethtool stats code to dump rx and tx based
purely on dev->num_tx_queues
--
pw-bot: cr