Skip to content

mlx5: Add netdev-genl queue stats

Joe Damato linux-rdma lkml netdev 5 versions – Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest2 patches 8 repliesApplied 2/2
  2. v4 RFC2 patches 11 repliesSuperseded
  3. v3 RFC2 patches 19 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v21 patch9 repliesSuperseded
v11 patch19 repliesSuperseded

Patches in v5 All 2 applied

#Subject and filesSizeRepliesApplied
1/2net/mlx5e: Add txq to sq stats mappingdrivers/net/ethernet/mellanox/mlx5/core/en.h drivers/net/ethernet/mellanox/mlx5/core/en/qos.c drivers/net/ethernet/mellanox/mlx5/core/en_main.c+23 -31 replyApplied
2/2net/mlx5e: Add per queue netdev-genl statsdrivers/net/ethernet/mellanox/mlx5/core/en_main.c+132 -07 repliesApplied

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchTariq Toukan
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v5 thread

Cover letter [net-next v5 0/2] mlx5: Add netdev-genl queue stats

Greetings:

Welcome to v5.

Switched from RFC to just a v5, because I think this is pretty close. Minor changes from v4 summarized below in the changelog.

Note that my NIC does not seem to support PTP and I couldn't get the mlnx-tools mlnx_qos script to work, so I was only able to test the following cases:

- device up at boot
- adjusting queue counts
- device down (e.g. ip link set dev eth4 down)

Please see the commit message of patch 2/2 for more details on output and test cases.

rfcv4 thread:
https://lore.kernel.org/linux-kernel/[email protected]/T/

Thanks,
Joe

rfcv4 -> v5:
- Patch 1/2: change variable name 'mlx5e_qid' to 'txq_ix'.
- Patch 2/2:
- remove logic in mlx5e_get_queue_stats_rx for PTP. PTP RX are always reported in base.
- report PTP TX in mlx5e_get_base_stats only if:
- PTP has ever been opened, and
- either PTP is NULL (closed) or the MLX5E_PTP_STATE_TX bit in its state is not set

Otherwise, PTP TX will be reported when the txq_ix is passed into mlx5e_get_queue_stats_tx

rfcv3 -> rfcv4:
- Patch 1/2 now creates a mapping (priv->txq2sq_stats) which maps txq indices to sq_stats structures so stats can be accessed directly. This mapping is kept up to date along side txq2sq.

- Patch 2/2:
- All mutex_lock/unlock on state_lock has been dropped.
- mlx5e_get_queue_stats_rx now uses ASSERT_RTNL() and has a special case for PTP. If PTP was ever opened, is currently opened, and the channel index matches, stats for PTP RX are output.
- mlx5e_get_queue_stats_tx rewritten to use priv->txq2sq_stats. No corner cases are needed here because any txq idx (passed in as i) will have an up to date mapping in priv->txq2sq_stats.
- mlx5e_get_base_stats:
- in the RX case:
- iterates from [params.num_channels, stats_nch) collecting stats.
- if ptp was ever opened but is currently closed, add the PTP stats.
- in the TX case:
- handle 2 cases:
- the channel is available, so sum only the unavailable TCs [mlx5e_get_dcb_num_tc, max_opened_tc).
- the channel is unavailable, so sum all TCs [0, max_opened_tc).
- if ptp was ever opened but is currently closed, add the PTP sq stats.

v2 -> rfcv3:
- Added patch 1/2 which creates some helpers for computing the txq_ix and ch_ix/tc_ix.

- Patch 2/2 modified in several ways:
- Fixed variable declarations in mlx5e_get_queue_stats_rx to be at the start of the function.
- mlx5e_get_queue_stats_tx rewritten to access sq stats directly by using the helpers added in the previous patch.
- mlx5e_get_base_stats modified in several ways:
- Took the state_lock when accessing priv->channels.
- For the base RX stats, code was simplified to call mlx5e_get_queue_stats_rx instead of repeating the same code.
- For the base TX stats, I attempted to implement what I think Tariq suggested in the previous thread:
- for available channels, only unavailable TC stats are summed
- for unavailable channels, all stats for TCs up to max_opened_tc are summed.

v1 - > v2:
- Essentially a full rewrite after comments from Jakub, Tariq, and Zhu.

Joe Damato (2):
net/mlx5e: Add txq to sq stats mapping
net/mlx5e: Add per queue netdev-genl stats

 drivers/net/ethernet/mellanox/mlx5/core/en.h  |   2 +
 .../net/ethernet/mellanox/mlx5/core/en/qos.c  |  13 +-
 .../net/ethernet/mellanox/mlx5/core/en_main.c | 143 +++++++++++++++++-
 3 files changed, 155 insertions(+), 3 deletions(-)
Signature · 1 line
2.25.1