RDMA/mlx5: fix linking with CONFIG_INFINIBAND_USER_ACCESS=n
Subsystems (2)
PATCH 1/1 RDMA/mlx5: fix linking with CONFIG_INFINIBAND_USER_ACCESS=n
From: Arnd Bergmann <[email protected]>
The check for rdma_uattrs_has_raw_cap() is not possible if user access is disabled:
ERROR: modpost: "rdma_uattrs_has_raw_cap" [drivers/infiniband/hw/mlx5/mlx5_ib.ko] undefined!
Limit the check to configurations that have the option enabled and instead assume the capability is not there otherwise.
From what I can tell, the UVERBS code in fs.c is not actually called when INFINIBAND_USER_ACCESS is turned off, so this haz no effect other than fixing the link error. A better change might be to not build the code at all in that configuration, but I did not see an obvious way to do that.
---
If there is a better way of addressing the link failure, please just treat this as a bug report
--- drivers/infiniband/hw/mlx5/fs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/fs.c +2 -1
@@ -2459,7 +2459,8 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_CREATE_FLOW)(struct mlx5_ib_dev *dev;u32 flags; -if (!rdma_uattrs_has_raw_cap (attrs)) +if (!IS_ENABLED (CONFIG_INFINIBAND_USER_ACCESS ) || + !rdma_uattrs_has_raw_cap (attrs))return -EPERM ; fs_matcher = uverbs_attr_get_obj(attrs,
Signature · 1 line
2.39.5
Quoted 6 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
The check for
rdma_uattrs_has_raw_cap()is not possible if user access is disabled:ERROR: modpost: "
rdma_uattrs_has_raw_cap" [drivers/infiniband/hw/mlx5/mlx5_ib.ko] undefined!
The issue you described seems to be the same as the one discussed in the link above. Could you try applying the commit from that link and see if the problem still persists?
Yanjun.Zhu
Quoted 33 lines
Limit the check to configurations that have the option enabled and instead assume the capability is not there otherwise.
From what I can tell, the UVERBS code in
fs.cis not actually called
whenINFINIBAND_USER_ACCESSis turned off, so this haz no effect other than fixing the link error. A better change might be to not build the code at all in that configuration, but I did not see an obvious way to do that.Fixes 95a89ec304c3 ("RDMA/mlx5: Check CAP_NET_RAW in user namespace for flow create")Signed-off-by Arnd Bergmann <[email protected]>---
If there is a better way of addressing the link failure, please just treat this as a bug report--- drivers/infiniband/hw/mlx5/fs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/infiniband/hw/mlx5/fs.c +2
-1@@ -2459,7 +2459,8 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_CREATE_FLOW)(struct mlx5_ib_dev *dev;u32 flags; -if (!rdma_uattrs_has_raw_cap (attrs)) +if (!IS_ENABLED (CONFIG_INFINIBAND_USER_ACCESS ) || + !rdma_uattrs_has_raw_cap (attrs))return -EPERM ; fs_matcher = uverbs_attr_get_obj(attrs,
Quoted 6 lines · yanjun.zhu
Quoted 5 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
The check for
rdma_uattrs_has_raw_cap()is not possible if user access is disabled:
Quoted 7 lines
Quoted 1 line
ERROR: modpost: "
rdma_uattrs_has_raw_cap" [drivers/infiniband/hw/mlx5/mlx5_ib.ko] undefined!The issue you described seems to be the same as the one discussed in the link above. Could you try applying the commit from that link and see if the problem still persists?
That one looks fine, I'm sure it's sufficient without my patch.
Arnd