mbox series

[rdma-next,0/5] Add optional-counters binding support

Message ID cover.1741097408.git.leonro@nvidia.com (mailing list archive)
Headers show
Series Add optional-counters binding support | expand

Message

Leon Romanovsky March 4, 2025, 2:15 p.m. UTC
From: Leon Romanovsky <leonro@nvidia.com>

From Patrisious,

Add optional-counters binding support together with new packets/bytes
counters. Previously optional-counters were on a per link basis, this
series allows users to bind optional-counters to a specific counter,
which allows tracking optional-counter over a specific QP group.

The support is added for both binding modes, automatic and manual,
in both cases the bound optional counters are those that are currently
configured over the link when trying to bind the QP.

In addition introduce four new optional-counters :
rdma_tx_bytes, rdma_tx_packets, rdma_rx_bytes, rdma_rx_packets
That just as their name implies allow tracking RDMA egress and ingress
traffic.

This is exposed to users through the iproute2 package which needs to be
updated as well to provide the support for this feature.

Example commands:
- rdma stat set link rocep8s0f0/1 optional-counters
  rdma_tx_bytes,rdma_rx_packets
	Enables rdma_tx_bytes and rdma_rx_packets optional-counters over
	the link.

- rdma stat qp set link rocep8s0f0/1 auto type on optional-counters on
	Enabled link automatic counter binding for QPs of same type,
	with optional-counter binding support.

- rdma stat qp bind link rocep8s0f0/1 lqpn 134
	Manually bind QP number 134 to all available counters.

- rdma stat qp bind link rocep8s0f0/1 lqpn 134 cntn 4
	Manually bind QP number 134 to counter number 4 depending on its
	configured counters.

Thanks

Patrisious Haddad (5):
  RDMA/mlx5: Add optional counters for RDMA_TX/RX_packets/bytes
  RDMA/core: Create and destroy rdma_counter using rdma_zalloc_drv_obj()
  RDMA/core: Add support to optional-counters binding configuration
  RDMA/core: Pass port to counter bind/unbind operations
  RDMA/mlx5: Support optional-counters binding for QPs

 drivers/infiniband/core/counters.c    |  52 +--
 drivers/infiniband/core/device.c      |   2 +
 drivers/infiniband/core/nldev.c       |  18 +-
 drivers/infiniband/core/verbs.c       |   2 +-
 drivers/infiniband/hw/mlx5/counters.c | 187 +++++++++-
 drivers/infiniband/hw/mlx5/counters.h |  20 ++
 drivers/infiniband/hw/mlx5/fs.c       | 474 +++++++++++++++++++++++++-
 drivers/infiniband/hw/mlx5/mlx5_ib.h  |  20 ++
 include/linux/mlx5/device.h           |   4 +-
 include/rdma/ib_verbs.h               |  11 +-
 include/rdma/rdma_counter.h           |   7 +-
 include/uapi/rdma/rdma_netlink.h      |   2 +
 12 files changed, 759 insertions(+), 40 deletions(-)

Comments

Leon Romanovsky March 8, 2025, 7:31 p.m. UTC | #1
On Tue, 04 Mar 2025 16:15:24 +0200, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@nvidia.com>
> 
> From Patrisious,
> 
> Add optional-counters binding support together with new packets/bytes
> counters. Previously optional-counters were on a per link basis, this
> series allows users to bind optional-counters to a specific counter,
> which allows tracking optional-counter over a specific QP group.
> 
> [...]

Applied, thanks!

[1/5] RDMA/mlx5: Add optional counters for RDMA_TX/RX_packets/bytes
      https://git.kernel.org/rdma/rdma/c/30c77a88e3ffe9
[2/5] RDMA/core: Create and destroy rdma_counter using rdma_zalloc_drv_obj()
      https://git.kernel.org/rdma/rdma/c/3644e21c005fcf
[3/5] RDMA/core: Add support to optional-counters binding configuration
      https://git.kernel.org/rdma/rdma/c/df5f4ff6319a6f
[4/5] RDMA/core: Pass port to counter bind/unbind operations
      https://git.kernel.org/rdma/rdma/c/d73531da19eb56
[5/5] RDMA/mlx5: Support optional-counters binding for QPs
      https://git.kernel.org/rdma/rdma/c/7bcd537adb21b5

Best regards,
Leon Romanovsky March 10, 2025, 7:54 a.m. UTC | #2
On Sat, Mar 08, 2025 at 02:31:33PM -0500, Leon Romanovsky wrote:
> 
> On Tue, 04 Mar 2025 16:15:24 +0200, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@nvidia.com>
> > 
> > From Patrisious,
> > 
> > Add optional-counters binding support together with new packets/bytes
> > counters. Previously optional-counters were on a per link basis, this
> > series allows users to bind optional-counters to a specific counter,
> > which allows tracking optional-counter over a specific QP group.
> > 
> > [...]
> 
> Applied, thanks!
> 
> [1/5] RDMA/mlx5: Add optional counters for RDMA_TX/RX_packets/bytes
>       https://git.kernel.org/rdma/rdma/c/30c77a88e3ffe9
> [2/5] RDMA/core: Create and destroy rdma_counter using rdma_zalloc_drv_obj()
>       https://git.kernel.org/rdma/rdma/c/3644e21c005fcf
> [3/5] RDMA/core: Add support to optional-counters binding configuration
>       https://git.kernel.org/rdma/rdma/c/df5f4ff6319a6f
> [4/5] RDMA/core: Pass port to counter bind/unbind operations
>       https://git.kernel.org/rdma/rdma/c/d73531da19eb56
> [5/5] RDMA/mlx5: Support optional-counters binding for QPs
>       https://git.kernel.org/rdma/rdma/c/7bcd537adb21b5a

Unfortunately, but I need to drop this series from our wip branches.
The reason to it is patch #5 which has layer violation of bringing
RDMA counters logic into flow steering code.

As such it caused to multiple kbuild errors, because fs.c is available
only when CONFIG_INFINIBAND_USER_ACCESS is set, while counters and
rdmatool (bind/unbind logic) is not limited to user space verbs only.

This series needs to be fixed:
1. RDMA counters logic need to stay in counter.c
2. Optional counters need to work on all type of QPs.

Thanks

> 
> Best regards,
> -- 
> Leon Romanovsky <leon@kernel.org>
>