linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [RFC] RDMA/mlx5: fix build error with INFINIBAND_USER_ACCESS=n
@ 2021-10-19  6:15 Arnd Bergmann
  2021-10-21  9:23 ` Leon Romanovsky
  2021-10-25 17:35 ` Jason Gunthorpe
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2021-10-19  6:15 UTC (permalink / raw)
  To: Leon Romanovsky, Mark Zhang, Aharon Landau
  Cc: Arnd Bergmann, Doug Ledford, Jason Gunthorpe, Mark Bloch,
	linux-rdma, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

The mlx5_ib_fs_add_op_fc/mlx5_ib_fs_remove_op_fc functions are
only available when user access is enabled, without that we
run into a link error:

ERROR: modpost: "mlx5_ib_fs_add_op_fc" [drivers/infiniband/hw/mlx5/mlx5_ib.ko] undefined!
ERROR: modpost: "mlx5_ib_fs_remove_op_fc" [drivers/infiniband/hw/mlx5/mlx5_ib.ko] undefined!

Conditionally compiling the newly added code section makes
it build, though this is probably not a correct fix.

Fixes: a29b934ceb4c ("RDMA/mlx5: Add modify_op_stat() support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/infiniband/hw/mlx5/counters.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/hw/mlx5/counters.c b/drivers/infiniband/hw/mlx5/counters.c
index 6f1c4b57110e..945758f39523 100644
--- a/drivers/infiniband/hw/mlx5/counters.c
+++ b/drivers/infiniband/hw/mlx5/counters.c
@@ -641,9 +641,9 @@ static void mlx5_ib_dealloc_counters(struct mlx5_ib_dev *dev)
 			if (!dev->port[i].cnts.opfcs[j].fc)
 				continue;
 
-			mlx5_ib_fs_remove_op_fc(dev,
-						&dev->port[i].cnts.opfcs[j],
-						j);
+			if (IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS))
+				mlx5_ib_fs_remove_op_fc(dev,
+					&dev->port[i].cnts.opfcs[j], j);
 			mlx5_fc_destroy(dev->mdev,
 					dev->port[i].cnts.opfcs[j].fc);
 			dev->port[i].cnts.opfcs[j].fc = NULL;
@@ -885,7 +885,8 @@ static const struct ib_device_ops hw_stats_ops = {
 	.counter_dealloc = mlx5_ib_counter_dealloc,
 	.counter_alloc_stats = mlx5_ib_counter_alloc_stats,
 	.counter_update_stats = mlx5_ib_counter_update_stats,
-	.modify_hw_stat = mlx5_ib_modify_stat,
+	.modify_hw_stat = IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS) ?
+			  mlx5_ib_modify_stat : NULL,
 };
 
 static const struct ib_device_ops hw_switchdev_stats_ops = {
-- 
2.29.2


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

* Re: [PATCH] [RFC] RDMA/mlx5: fix build error with INFINIBAND_USER_ACCESS=n
  2021-10-19  6:15 [PATCH] [RFC] RDMA/mlx5: fix build error with INFINIBAND_USER_ACCESS=n Arnd Bergmann
@ 2021-10-21  9:23 ` Leon Romanovsky
  2021-10-25 17:35 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2021-10-21  9:23 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Mark Zhang, Aharon Landau, Arnd Bergmann, Doug Ledford,
	Jason Gunthorpe, Mark Bloch, linux-rdma, linux-kernel

On Tue, Oct 19, 2021 at 08:15:45AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The mlx5_ib_fs_add_op_fc/mlx5_ib_fs_remove_op_fc functions are
> only available when user access is enabled, without that we
> run into a link error:
> 
> ERROR: modpost: "mlx5_ib_fs_add_op_fc" [drivers/infiniband/hw/mlx5/mlx5_ib.ko] undefined!
> ERROR: modpost: "mlx5_ib_fs_remove_op_fc" [drivers/infiniband/hw/mlx5/mlx5_ib.ko] undefined!
> 
> Conditionally compiling the newly added code section makes
> it build, though this is probably not a correct fix.
> 
> Fixes: a29b934ceb4c ("RDMA/mlx5: Add modify_op_stat() support")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  drivers/infiniband/hw/mlx5/counters.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 

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

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

* Re: [PATCH] [RFC] RDMA/mlx5: fix build error with INFINIBAND_USER_ACCESS=n
  2021-10-19  6:15 [PATCH] [RFC] RDMA/mlx5: fix build error with INFINIBAND_USER_ACCESS=n Arnd Bergmann
  2021-10-21  9:23 ` Leon Romanovsky
@ 2021-10-25 17:35 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2021-10-25 17:35 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Leon Romanovsky, Mark Zhang, Aharon Landau, Arnd Bergmann,
	Doug Ledford, Mark Bloch, linux-rdma, linux-kernel

On Tue, Oct 19, 2021 at 08:15:45AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The mlx5_ib_fs_add_op_fc/mlx5_ib_fs_remove_op_fc functions are
> only available when user access is enabled, without that we
> run into a link error:
> 
> ERROR: modpost: "mlx5_ib_fs_add_op_fc" [drivers/infiniband/hw/mlx5/mlx5_ib.ko] undefined!
> ERROR: modpost: "mlx5_ib_fs_remove_op_fc" [drivers/infiniband/hw/mlx5/mlx5_ib.ko] undefined!
> 
> Conditionally compiling the newly added code section makes
> it build, though this is probably not a correct fix.
> 
> Fixes: a29b934ceb4c ("RDMA/mlx5: Add modify_op_stat() support")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Acked-by: Leon Romanovsky <leonro@nvidia.com>
> ---
>  drivers/infiniband/hw/mlx5/counters.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)

Applied to for-next, thanks

Jason

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

end of thread, other threads:[~2021-10-25 17:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-19  6:15 [PATCH] [RFC] RDMA/mlx5: fix build error with INFINIBAND_USER_ACCESS=n Arnd Bergmann
2021-10-21  9:23 ` Leon Romanovsky
2021-10-25 17:35 ` Jason Gunthorpe

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).