Skip to content

Commit 36e0d43

Browse files
PatrisiousHaddadrleon
authored andcommitted
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 <[email protected]> Link: https://patch.msgid.link/b8dd220456a91538b22c3aff150ab021d7b9e1bf.1741875070.git.leon@kernel.org Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 88ae02f commit 36e0d43

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
@@ -849,9 +849,8 @@ static void mlx5_ib_dealloc_counters(struct mlx5_ib_dev *dev)
849849
dev->port[i].cnts.opfcs, j, &in_use_opfc))
850850
goto skip;
851851

852-
if (IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS))
853-
mlx5_ib_fs_remove_op_fc(dev,
854-
&dev->port[i].cnts.opfcs[j], j);
852+
mlx5_ib_fs_remove_op_fc(dev,
853+
&dev->port[i].cnts.opfcs[j], j);
855854
mlx5_fc_destroy(dev->mdev,
856855
dev->port[i].cnts.opfcs[j].fc);
857856
skip:
@@ -1115,8 +1114,7 @@ static const struct ib_device_ops hw_stats_ops = {
11151114
.counter_dealloc = mlx5_ib_counter_dealloc,
11161115
.counter_alloc_stats = mlx5_ib_counter_alloc_stats,
11171116
.counter_update_stats = mlx5_ib_counter_update_stats,
1118-
.modify_hw_stat = IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS) ?
1119-
mlx5_ib_modify_stat : NULL,
1117+
.modify_hw_stat = mlx5_ib_modify_stat,
11201118
.counter_init = mlx5_ib_counter_init,
11211119

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