linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH rdma-rc 0/3] Batch of mlx5_ib fixes
@ 2025-06-16  9:14 Leon Romanovsky
  2025-06-16  9:14 ` [PATCH rdma-rc 1/3] RDMA/mlx5: Fix HW counters query for non-representor devices Leon Romanovsky
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Leon Romanovsky @ 2025-06-16  9:14 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: linux-rdma, Maher Sanalla, Mark Bloch, Michael Guralnik,
	Parav Pandit, Patrisious Haddad

The batch of different mlx5_ib fixes from Patrisious.

Patrisious Haddad (3):
  RDMA/mlx5: Fix HW counters query for non-representor devices
  RDMA/mlx5: Fix CC counters query for MPV
  RDMA/mlx5: Fix vport loopback for MPV device

 drivers/infiniband/hw/mlx5/counters.c |  4 ++--
 drivers/infiniband/hw/mlx5/main.c     | 33 +++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 2 deletions(-)

-- 
2.49.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH rdma-rc 1/3] RDMA/mlx5: Fix HW counters query for non-representor devices
  2025-06-16  9:14 [PATCH rdma-rc 0/3] Batch of mlx5_ib fixes Leon Romanovsky
@ 2025-06-16  9:14 ` Leon Romanovsky
  2025-06-16  9:14 ` [PATCH rdma-rc 2/3] RDMA/mlx5: Fix CC counters query for MPV Leon Romanovsky
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Leon Romanovsky @ 2025-06-16  9:14 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Patrisious Haddad, linux-rdma, Maher Sanalla, Mark Bloch,
	Michael Guralnik, Parav Pandit

From: Patrisious Haddad <phaddad@nvidia.com>

To get the device HW counters, a non-representor switchdev device
should use the mlx5_ib_query_q_counters() function and query all of
the available counters. While a representor device in switchdev mode
should use the mlx5_ib_query_q_counters_vport() function and query only
the Q_Counters without the PPCNT counters and congestion control counters,
since they aren't relevant for a representor device.

Currently a non-representor switchdev device skips querying the PPCNT
counters and congestion control counters, leaving them unupdated.
Fix that by properly querying those counters for non-representor devices.

Fixes: d22467a71ebe ("RDMA/mlx5: Expand switchdev Q-counters to expose representor statistics")
Signed-off-by: Patrisious Haddad <phaddad@nvidia.com>
Reviewed-by: Maher Sanalla <msanalla@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
 drivers/infiniband/hw/mlx5/counters.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/mlx5/counters.c b/drivers/infiniband/hw/mlx5/counters.c
index b847084dcd99..943e9eb2ad20 100644
--- a/drivers/infiniband/hw/mlx5/counters.c
+++ b/drivers/infiniband/hw/mlx5/counters.c
@@ -398,7 +398,7 @@ static int do_get_hw_stats(struct ib_device *ibdev,
 		return ret;
 
 	/* We don't expose device counters over Vports */
-	if (is_mdev_switchdev_mode(dev->mdev) && port_num != 0)
+	if (is_mdev_switchdev_mode(dev->mdev) && dev->is_rep && port_num != 0)
 		goto done;
 
 	if (MLX5_CAP_PCAM_FEATURE(dev->mdev, rx_icrc_encapsulated_counter)) {
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH rdma-rc 2/3] RDMA/mlx5: Fix CC counters query for MPV
  2025-06-16  9:14 [PATCH rdma-rc 0/3] Batch of mlx5_ib fixes Leon Romanovsky
  2025-06-16  9:14 ` [PATCH rdma-rc 1/3] RDMA/mlx5: Fix HW counters query for non-representor devices Leon Romanovsky
@ 2025-06-16  9:14 ` Leon Romanovsky
  2025-06-16  9:14 ` [PATCH rdma-rc 3/3] RDMA/mlx5: Fix vport loopback for MPV device Leon Romanovsky
  2025-06-25  7:45 ` [PATCH rdma-rc 0/3] Batch of mlx5_ib fixes Leon Romanovsky
  3 siblings, 0 replies; 5+ messages in thread
From: Leon Romanovsky @ 2025-06-16  9:14 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Patrisious Haddad, linux-rdma, Maher Sanalla, Mark Bloch,
	Michael Guralnik, Parav Pandit

From: Patrisious Haddad <phaddad@nvidia.com>

In case, CC counters are querying for the second port use the correct
core device for the query instead of always using the master core device.

Fixes: aac4492ef23a ("IB/mlx5: Update counter implementation for dual port RoCE")
Signed-off-by: Patrisious Haddad <phaddad@nvidia.com>
Reviewed-by: Michael Guralnik <michaelgur@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
 drivers/infiniband/hw/mlx5/counters.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/mlx5/counters.c b/drivers/infiniband/hw/mlx5/counters.c
index 943e9eb2ad20..a506fafd2b15 100644
--- a/drivers/infiniband/hw/mlx5/counters.c
+++ b/drivers/infiniband/hw/mlx5/counters.c
@@ -418,7 +418,7 @@ static int do_get_hw_stats(struct ib_device *ibdev,
 			 */
 			goto done;
 		}
-		ret = mlx5_lag_query_cong_counters(dev->mdev,
+		ret = mlx5_lag_query_cong_counters(mdev,
 						   stats->value +
 						   cnts->num_q_counters,
 						   cnts->num_cong_counters,
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH rdma-rc 3/3] RDMA/mlx5: Fix vport loopback for MPV device
  2025-06-16  9:14 [PATCH rdma-rc 0/3] Batch of mlx5_ib fixes Leon Romanovsky
  2025-06-16  9:14 ` [PATCH rdma-rc 1/3] RDMA/mlx5: Fix HW counters query for non-representor devices Leon Romanovsky
  2025-06-16  9:14 ` [PATCH rdma-rc 2/3] RDMA/mlx5: Fix CC counters query for MPV Leon Romanovsky
@ 2025-06-16  9:14 ` Leon Romanovsky
  2025-06-25  7:45 ` [PATCH rdma-rc 0/3] Batch of mlx5_ib fixes Leon Romanovsky
  3 siblings, 0 replies; 5+ messages in thread
From: Leon Romanovsky @ 2025-06-16  9:14 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Patrisious Haddad, linux-rdma, Maher Sanalla, Mark Bloch,
	Michael Guralnik, Parav Pandit

From: Patrisious Haddad <phaddad@nvidia.com>

Always enable vport loopback for both MPV devices on driver start.

Previously in some cases related to MPV RoCE, packets weren't correctly
executing loopback check at vport in FW, since it was disabled.
Due to complexity of identifying such cases for MPV always enable vport
loopback for both GVMIs when binding the slave to the master port.

Fixes: 0042f9e458a5 ("RDMA/mlx5: Enable vport loopback when user context or QP mandate")
Signed-off-by: Patrisious Haddad <phaddad@nvidia.com>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
 drivers/infiniband/hw/mlx5/main.c | 33 +++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index ce7610740412..df6557ddbdfc 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -1791,6 +1791,33 @@ static void deallocate_uars(struct mlx5_ib_dev *dev,
 					     context->devx_uid);
 }
 
+static int mlx5_ib_enable_lb_mp(struct mlx5_core_dev *master,
+				struct mlx5_core_dev *slave)
+{
+	int err;
+
+	err = mlx5_nic_vport_update_local_lb(master, true);
+	if (err)
+		return err;
+
+	err = mlx5_nic_vport_update_local_lb(slave, true);
+	if (err)
+		goto out;
+
+	return 0;
+
+out:
+	mlx5_nic_vport_update_local_lb(master, false);
+	return err;
+}
+
+static void mlx5_ib_disable_lb_mp(struct mlx5_core_dev *master,
+				  struct mlx5_core_dev *slave)
+{
+	mlx5_nic_vport_update_local_lb(slave, false);
+	mlx5_nic_vport_update_local_lb(master, false);
+}
+
 int mlx5_ib_enable_lb(struct mlx5_ib_dev *dev, bool td, bool qp)
 {
 	int err = 0;
@@ -3495,6 +3522,8 @@ static void mlx5_ib_unbind_slave_port(struct mlx5_ib_dev *ibdev,
 
 	lockdep_assert_held(&mlx5_ib_multiport_mutex);
 
+	mlx5_ib_disable_lb_mp(ibdev->mdev, mpi->mdev);
+
 	mlx5_core_mp_event_replay(ibdev->mdev,
 				  MLX5_DRIVER_EVENT_AFFILIATION_REMOVED,
 				  NULL);
@@ -3590,6 +3619,10 @@ static bool mlx5_ib_bind_slave_port(struct mlx5_ib_dev *ibdev,
 				  MLX5_DRIVER_EVENT_AFFILIATION_DONE,
 				  &key);
 
+	err = mlx5_ib_enable_lb_mp(ibdev->mdev, mpi->mdev);
+	if (err)
+		goto unbind;
+
 	return true;
 
 unbind:
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH rdma-rc 0/3] Batch of mlx5_ib fixes
  2025-06-16  9:14 [PATCH rdma-rc 0/3] Batch of mlx5_ib fixes Leon Romanovsky
                   ` (2 preceding siblings ...)
  2025-06-16  9:14 ` [PATCH rdma-rc 3/3] RDMA/mlx5: Fix vport loopback for MPV device Leon Romanovsky
@ 2025-06-25  7:45 ` Leon Romanovsky
  3 siblings, 0 replies; 5+ messages in thread
From: Leon Romanovsky @ 2025-06-25  7:45 UTC (permalink / raw)
  To: Jason Gunthorpe, Leon Romanovsky
  Cc: linux-rdma, Maher Sanalla, Mark Bloch, Michael Guralnik,
	Parav Pandit, Patrisious Haddad


On Mon, 16 Jun 2025 12:14:51 +0300, Leon Romanovsky wrote:
> The batch of different mlx5_ib fixes from Patrisious.
> 
> Patrisious Haddad (3):
>   RDMA/mlx5: Fix HW counters query for non-representor devices
>   RDMA/mlx5: Fix CC counters query for MPV
>   RDMA/mlx5: Fix vport loopback for MPV device
> 
> [...]

Applied, thanks!

[1/3] RDMA/mlx5: Fix HW counters query for non-representor devices
      https://git.kernel.org/rdma/rdma/c/3cc1dbfddf88dc
[2/3] RDMA/mlx5: Fix CC counters query for MPV
      https://git.kernel.org/rdma/rdma/c/acd245b1e33fc4
[3/3] RDMA/mlx5: Fix vport loopback for MPV device
      https://git.kernel.org/rdma/rdma/c/a9a9e68954f29b

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-06-25  7:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-16  9:14 [PATCH rdma-rc 0/3] Batch of mlx5_ib fixes Leon Romanovsky
2025-06-16  9:14 ` [PATCH rdma-rc 1/3] RDMA/mlx5: Fix HW counters query for non-representor devices Leon Romanovsky
2025-06-16  9:14 ` [PATCH rdma-rc 2/3] RDMA/mlx5: Fix CC counters query for MPV Leon Romanovsky
2025-06-16  9:14 ` [PATCH rdma-rc 3/3] RDMA/mlx5: Fix vport loopback for MPV device Leon Romanovsky
2025-06-25  7:45 ` [PATCH rdma-rc 0/3] Batch of mlx5_ib fixes Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).