Re: [PATCH v2 net-next 2/5] net: dsa: microchip: add eth ctrl grouping for ethtool statistics

From: Vladimir Oltean
Date: Fri Feb 17 2023 - 12:08:33 EST


On Fri, Feb 17, 2023 at 04:32:08PM +0530, Rakesh Sankaranarayanan wrote:
> +void ksz8_get_eth_ctrl_stats(struct ksz_device *dev, int port,
> + struct ethtool_eth_ctrl_stats *ctrl_stats)
> +{
> + struct ksz_port_mib *mib;
> + u64 *cnt;
> +
> + mib = &dev->ports[port].mib;
> +
> + mutex_lock(&mib->cnt_mutex);
> +
> + cnt = &mib->counters[KSZ8_TX_PAUSE];
> + dev->dev_ops->r_mib_pkt(dev, port, KSZ8_TX_PAUSE, NULL, cnt);
> + ctrl_stats->MACControlFramesTransmitted = *cnt;
> +
> + cnt = &mib->counters[KSZ8_RX_PAUSE];
> + dev->dev_ops->r_mib_pkt(dev, port, KSZ8_RX_PAUSE, NULL, cnt);
> + ctrl_stats->MACControlFramesReceived = *cnt;
> +
> + mutex_unlock(&mib->cnt_mutex);
> +}

These should be reported as standard pause stats as well (ethtool -I --show-pause swpN).