Skip to contentSkip to conversation

RDMA/mlx5: fix build error with INFINIBAND_USER_ACCESS=n

RFC PATCH Applied Arnd Bergmann 3 participants 3 messages Oct 19, 2021 – Oct 25, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 RDMA/mlx5: fix build error with INFINIBAND_USER_ACCESS=n

From: Arnd Bergmann <[email protected]>

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")
---
 drivers/infiniband/hw/mlx5/counters.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/infiniband/hw/mlx5/counters.c +5 -4
index 6f1c4b57110e..945758f39523 100644
@@ -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 = {
Signature · 1 line
2.29.2
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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!

Quoted 9 lines

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")
---
 drivers/infiniband/hw/mlx5/counters.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Thanks,

maintainer Applied
#2 lore raw
In reply to Arnd Bergmann
Quoted 12 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

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.

Quoted 6 lines
Fixes a29b934ceb4c ("RDMA/mlx5: Add modify_op_stat() support")
---
 drivers/infiniband/hw/mlx5/counters.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Applied to for-next, thanks

Jason