All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RDMA/mlx4: Do not fail the registration on port stats
@ 2021-11-15 10:15 Jack Wang
  2021-11-17 12:16 ` Leon Romanovsky
  2021-11-17 20:50 ` Jason Gunthorpe
  0 siblings, 2 replies; 4+ messages in thread
From: Jack Wang @ 2021-11-15 10:15 UTC (permalink / raw)
  To: linux-rdma; +Cc: bvanassche, leon, dledford, jgg, haris.iqbal, yishaih

If the FW doesn't support MLX4_DEV_CAP_FLAG2_DIAG_PER_PORT,
mlx4 driver will fail the ib_setup_port_attrs, which is called
from ib_register_device/enable_device_and_get, in the end leads
to device not detected[1][2]

To fix it, add a new mlx4_ib_hw_stats_ops1, w/o alloc_hw_port_stats
if FW does not support MLX4_DEV_CAP_FLAG2_DIAG_PER_PORT.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=2014094
[2] https://lore.kernel.org/linux-rdma/CAMGffEn2wvEnmzc0xe=xYiCLqpphiHDBxCxqAELrBofbUAMQxw@mail.gmail.com/T/#t

Fixes: 4b5f4d3fb408 ("RDMA: Split the alloc_hw_stats() ops to port and device variants")

Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
---
 drivers/infiniband/hw/mlx4/main.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index f367f4a4abff..2ad9c6d12ac0 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -2217,6 +2217,12 @@ static const struct ib_device_ops mlx4_ib_hw_stats_ops = {
 	.get_hw_stats = mlx4_ib_get_hw_stats,
 };
 
+
+static const struct ib_device_ops mlx4_ib_hw_stats_ops1 = {
+	.alloc_hw_device_stats = mlx4_ib_alloc_hw_device_stats,
+	.get_hw_stats = mlx4_ib_get_hw_stats,
+};
+
 static int mlx4_ib_alloc_diag_counters(struct mlx4_ib_dev *ibdev)
 {
 	struct mlx4_ib_diag_counters *diag = ibdev->diag_counters;
@@ -2229,9 +2235,15 @@ static int mlx4_ib_alloc_diag_counters(struct mlx4_ib_dev *ibdev)
 		return 0;
 
 	for (i = 0; i < MLX4_DIAG_COUNTERS_TYPES; i++) {
-		/* i == 1 means we are building port counters */
-		if (i && !per_port)
-			continue;
+		/* i == 1 means we are building port counters, set a different
+		 * stats ops without port stats callback.
+		 */
+		if (i && !per_port) {
+			ib_set_device_ops(&ibdev->ib_dev,
+					  &mlx4_ib_hw_stats_ops1);
+
+			return 0;
+		}
 
 		ret = __mlx4_ib_alloc_diag_counters(ibdev, &diag[i].name,
 						    &diag[i].offset,
-- 
2.25.1


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

* Re: [PATCH] RDMA/mlx4: Do not fail the registration on port stats
  2021-11-15 10:15 [PATCH] RDMA/mlx4: Do not fail the registration on port stats Jack Wang
@ 2021-11-17 12:16 ` Leon Romanovsky
  2021-11-17 12:18   ` Jinpu Wang
  2021-11-17 20:50 ` Jason Gunthorpe
  1 sibling, 1 reply; 4+ messages in thread
From: Leon Romanovsky @ 2021-11-17 12:16 UTC (permalink / raw)
  To: Jack Wang; +Cc: linux-rdma, bvanassche, dledford, jgg, haris.iqbal, yishaih

On Mon, Nov 15, 2021 at 11:15:19AM +0100, Jack Wang wrote:
> If the FW doesn't support MLX4_DEV_CAP_FLAG2_DIAG_PER_PORT,
> mlx4 driver will fail the ib_setup_port_attrs, which is called
> from ib_register_device/enable_device_and_get, in the end leads
> to device not detected[1][2]
> 
> To fix it, add a new mlx4_ib_hw_stats_ops1, w/o alloc_hw_port_stats
> if FW does not support MLX4_DEV_CAP_FLAG2_DIAG_PER_PORT.
> 
> [1] https://bugzilla.redhat.com/show_bug.cgi?id=2014094
> [2] https://lore.kernel.org/linux-rdma/CAMGffEn2wvEnmzc0xe=xYiCLqpphiHDBxCxqAELrBofbUAMQxw@mail.gmail.com/T/#t
> 
> Fixes: 4b5f4d3fb408 ("RDMA: Split the alloc_hw_stats() ops to port and device variants")
> 
> Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
> ---
>  drivers/infiniband/hw/mlx4/main.c | 18 +++++++++++++++---
>  1 file changed, 15 insertions(+), 3 deletions(-)

Just a nitpick, no need for a blank line between Fixes line and SOB.

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

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

* Re: [PATCH] RDMA/mlx4: Do not fail the registration on port stats
  2021-11-17 12:16 ` Leon Romanovsky
@ 2021-11-17 12:18   ` Jinpu Wang
  0 siblings, 0 replies; 4+ messages in thread
From: Jinpu Wang @ 2021-11-17 12:18 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: linux-rdma, bvanassche, dledford, jgg, haris.iqbal, yishaih

On Wed, Nov 17, 2021 at 1:17 PM Leon Romanovsky <leon@kernel.org> wrote:
>
> On Mon, Nov 15, 2021 at 11:15:19AM +0100, Jack Wang wrote:
> > If the FW doesn't support MLX4_DEV_CAP_FLAG2_DIAG_PER_PORT,
> > mlx4 driver will fail the ib_setup_port_attrs, which is called
> > from ib_register_device/enable_device_and_get, in the end leads
> > to device not detected[1][2]
> >
> > To fix it, add a new mlx4_ib_hw_stats_ops1, w/o alloc_hw_port_stats
> > if FW does not support MLX4_DEV_CAP_FLAG2_DIAG_PER_PORT.
> >
> > [1] https://bugzilla.redhat.com/show_bug.cgi?id=2014094
> > [2] https://lore.kernel.org/linux-rdma/CAMGffEn2wvEnmzc0xe=xYiCLqpphiHDBxCxqAELrBofbUAMQxw@mail.gmail.com/T/#t
> >
> > Fixes: 4b5f4d3fb408 ("RDMA: Split the alloc_hw_stats() ops to port and device variants")
> >
> > Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
> > ---
> >  drivers/infiniband/hw/mlx4/main.c | 18 +++++++++++++++---
> >  1 file changed, 15 insertions(+), 3 deletions(-)
>
> Just a nitpick, no need for a blank line between Fixes line and SOB.
>
> Thanks,
> Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Thanks for the review, I will remember not to add the blank line next time.

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

* Re: [PATCH] RDMA/mlx4: Do not fail the registration on port stats
  2021-11-15 10:15 [PATCH] RDMA/mlx4: Do not fail the registration on port stats Jack Wang
  2021-11-17 12:16 ` Leon Romanovsky
@ 2021-11-17 20:50 ` Jason Gunthorpe
  1 sibling, 0 replies; 4+ messages in thread
From: Jason Gunthorpe @ 2021-11-17 20:50 UTC (permalink / raw)
  To: Jack Wang; +Cc: linux-rdma, bvanassche, leon, dledford, haris.iqbal, yishaih

On Mon, Nov 15, 2021 at 11:15:19AM +0100, Jack Wang wrote:
> If the FW doesn't support MLX4_DEV_CAP_FLAG2_DIAG_PER_PORT,
> mlx4 driver will fail the ib_setup_port_attrs, which is called
> from ib_register_device/enable_device_and_get, in the end leads
> to device not detected[1][2]
> 
> To fix it, add a new mlx4_ib_hw_stats_ops1, w/o alloc_hw_port_stats
> if FW does not support MLX4_DEV_CAP_FLAG2_DIAG_PER_PORT.
> 
> [1] https://bugzilla.redhat.com/show_bug.cgi?id=2014094
> [2] https://lore.kernel.org/linux-rdma/CAMGffEn2wvEnmzc0xe=xYiCLqpphiHDBxCxqAELrBofbUAMQxw@mail.gmail.com/T/#t
> 
> Fixes: 4b5f4d3fb408 ("RDMA: Split the alloc_hw_stats() ops to port and device variants")
> 
> Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
> Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
> ---
>  drivers/infiniband/hw/mlx4/main.c | 18 +++++++++++++++---
>  1 file changed, 15 insertions(+), 3 deletions(-)

Applied to for-rc, thanks

Jason

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

end of thread, other threads:[~2021-11-17 20:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15 10:15 [PATCH] RDMA/mlx4: Do not fail the registration on port stats Jack Wang
2021-11-17 12:16 ` Leon Romanovsky
2021-11-17 12:18   ` Jinpu Wang
2021-11-17 20:50 ` Jason Gunthorpe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.