Re: [PATCH net-next v1] mlxbf_gige: add support to display pause frame counters

From: Jakub Kicinski
Date: Tue Mar 05 2024 - 13:34:54 EST


On Tue, 5 Mar 2024 10:18:51 -0500 David Thompson wrote:
> + /* Read LLU counters only if they are enabled */
> + if (mlxbf_gige_llu_counters_enabled(priv)) {
> + data_lo = readl(priv->llu_base + MLXBF_GIGE_TX_PAUSE_CNT_LO);
> + data_hi = readl(priv->llu_base + MLXBF_GIGE_TX_PAUSE_CNT_HI);
> + pause_stats->tx_pause_frames = (data_hi << 32) | data_lo;
> +
> + data_lo = readl(priv->llu_base + MLXBF_GIGE_RX_PAUSE_CNT_LO);
> + data_hi = readl(priv->llu_base + MLXBF_GIGE_RX_PAUSE_CNT_HI);
> + pause_stats->rx_pause_frames = (data_hi << 32) | data_lo;
> + } else {
> + pause_stats->tx_pause_frames = 0;
> + pause_stats->rx_pause_frames = 0;

Counters are not enabled, meaning we don't know how many frames were
sent? Or pause frames are not enabled, therefore we know it's 0?

If the latter we should add a comment clarifying that, if the former:

* @get_pause_stats: Report pause frame statistics. Drivers must not zero
* statistics which they don't report. The stats structure is initialized
* to ETHTOOL_STAT_NOT_SET indicating driver does not report statistics.
--
pw-bot: cr