Skip to content

Commit 710d9bb

Browse files
author
Benjamin Poirier
committed
RDMA/mlx5: Compile fs.c regardless of INFINIBAND_USER_ACCESS config
JIRA: https://issues.redhat.com/browse/RHEL-72227 JIRA: https://issues.redhat.com/browse/RHEL-73520 Upstream-status: v6.15-rc1 commit 36e0d43 Author: Patrisious Haddad <phaddad@nvidia.com> Date: Thu Mar 13 16:18:45 2025 +0200 RDMA/mlx5: Compile fs.c regardless of INFINIBAND_USER_ACCESS config Change mlx5 Makefile, fs.c and fs.h to support fs compilation regardless of INFINIBAND_USER_ACCESS config. In addition allow optional counters support regardless of the config. Signed-off-by: Patrisious Haddad <phaddad@nvidia.com> Link: https://patch.msgid.link/b8dd220456a91538b22c3aff150ab021d7b9e1bf.1741875070.git.leon@kernel.org Signed-off-by: Leon Romanovsky <leon@kernel.org> Signed-off-by: Benjamin Poirier <bpoirier@redhat.com>
1 parent acd0554 commit 710d9bb

File tree

4 files changed

+7
-22
lines changed

4 files changed

+7
-22
lines changed

drivers/infiniband/hw/mlx5/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ mlx5_ib-y := ah.o \
99
data_direct.o \
1010
dm.o \
1111
doorbell.o \
12+
fs.o \
1213
gsi.o \
1314
ib_virt.o \
1415
mad.o \
@@ -26,7 +27,6 @@ mlx5_ib-y := ah.o \
2627
mlx5_ib-$(CONFIG_INFINIBAND_ON_DEMAND_PAGING) += odp.o
2728
mlx5_ib-$(CONFIG_MLX5_ESWITCH) += ib_rep.o
2829
mlx5_ib-$(CONFIG_INFINIBAND_USER_ACCESS) += devx.o \
29-
fs.o \
3030
qos.o \
3131
std_types.o
3232
mlx5_ib-$(CONFIG_MLX5_MACSEC) += macsec.o

drivers/infiniband/hw/mlx5/counters.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -853,9 +853,8 @@ static void mlx5_ib_dealloc_counters(struct mlx5_ib_dev *dev)
853853
dev->port[i].cnts.opfcs, j, &in_use_opfc))
854854
goto skip;
855855

856-
if (IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS))
857-
mlx5_ib_fs_remove_op_fc(dev,
858-
&dev->port[i].cnts.opfcs[j], j);
856+
mlx5_ib_fs_remove_op_fc(dev,
857+
&dev->port[i].cnts.opfcs[j], j);
859858
mlx5_fc_destroy(dev->mdev,
860859
dev->port[i].cnts.opfcs[j].fc);
861860
skip:
@@ -1119,8 +1118,7 @@ static const struct ib_device_ops hw_stats_ops = {
11191118
.counter_dealloc = mlx5_ib_counter_dealloc,
11201119
.counter_alloc_stats = mlx5_ib_counter_alloc_stats,
11211120
.counter_update_stats = mlx5_ib_counter_update_stats,
1122-
.modify_hw_stat = IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS) ?
1123-
mlx5_ib_modify_stat : NULL,
1121+
.modify_hw_stat = mlx5_ib_modify_stat,
11241122
.counter_init = mlx5_ib_counter_init,
11251123

11261124
INIT_RDMA_OBJ_SIZE(rdma_counter, mlx5_rdma_counter, rdma_counter),

drivers/infiniband/hw/mlx5/fs.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ enum flow_table_type {
679679
#define MLX5_FS_MAX_TYPES 6
680680
#define MLX5_FS_MAX_ENTRIES BIT(16)
681681

682-
static bool mlx5_ib_shared_ft_allowed(struct ib_device *device)
682+
static bool __maybe_unused mlx5_ib_shared_ft_allowed(struct ib_device *device)
683683
{
684684
struct mlx5_ib_dev *dev = to_mdev(device);
685685

@@ -3030,6 +3030,7 @@ DECLARE_UVERBS_NAMED_OBJECT(
30303030
&UVERBS_METHOD(MLX5_IB_METHOD_STEERING_ANCHOR_DESTROY));
30313031

30323032
const struct uapi_definition mlx5_ib_flow_defs[] = {
3033+
#if IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS)
30333034
UAPI_DEF_CHAIN_OBJ_TREE_NAMED(
30343035
MLX5_IB_OBJECT_FLOW_MATCHER),
30353036
UAPI_DEF_CHAIN_OBJ_TREE(
@@ -3040,6 +3041,7 @@ const struct uapi_definition mlx5_ib_flow_defs[] = {
30403041
UAPI_DEF_CHAIN_OBJ_TREE_NAMED(
30413042
MLX5_IB_OBJECT_STEERING_ANCHOR,
30423043
UAPI_DEF_IS_OBJ_SUPPORTED(mlx5_ib_shared_ft_allowed)),
3044+
#endif
30433045
{},
30443046
};
30453047

drivers/infiniband/hw/mlx5/fs.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,8 @@
88

99
#include "mlx5_ib.h"
1010

11-
#if IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS)
1211
int mlx5_ib_fs_init(struct mlx5_ib_dev *dev);
1312
void mlx5_ib_fs_cleanup_anchor(struct mlx5_ib_dev *dev);
14-
#else
15-
static inline int mlx5_ib_fs_init(struct mlx5_ib_dev *dev)
16-
{
17-
dev->flow_db = kzalloc(sizeof(*dev->flow_db), GFP_KERNEL);
18-
19-
if (!dev->flow_db)
20-
return -ENOMEM;
21-
22-
mutex_init(&dev->flow_db->lock);
23-
return 0;
24-
}
25-
26-
inline void mlx5_ib_fs_cleanup_anchor(struct mlx5_ib_dev *dev) {}
27-
#endif
2813

2914
static inline void mlx5_ib_fs_cleanup(struct mlx5_ib_dev *dev)
3015
{

0 commit comments

Comments
 (0)