Commit 36e0d433 authored by Patrisious Haddad's avatar Patrisious Haddad Committed by Leon Romanovsky
Browse files

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: default avatarPatrisious Haddad <phaddad@nvidia.com>
Link: https://patch.msgid.link/b8dd220456a91538b22c3aff150ab021d7b9e1bf.1741875070.git.leon@kernel.org


Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
parent 88ae02fe
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ mlx5_ib-y := ah.o \
	     data_direct.o \
	     dm.o \
	     doorbell.o \
	     fs.o \
	     gsi.o \
	     ib_virt.o \
	     mad.o \
@@ -26,7 +27,6 @@ mlx5_ib-y := ah.o \
mlx5_ib-$(CONFIG_INFINIBAND_ON_DEMAND_PAGING) += odp.o
mlx5_ib-$(CONFIG_MLX5_ESWITCH) += ib_rep.o
mlx5_ib-$(CONFIG_INFINIBAND_USER_ACCESS) += devx.o \
					    fs.o \
					    qos.o \
					    std_types.o
mlx5_ib-$(CONFIG_MLX5_MACSEC) += macsec.o
+3 −5
Original line number Diff line number Diff line
@@ -849,7 +849,6 @@ static void mlx5_ib_dealloc_counters(struct mlx5_ib_dev *dev)
				    dev->port[i].cnts.opfcs, j, &in_use_opfc))
				goto skip;

			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,
@@ -1115,8 +1114,7 @@ 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 = IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS) ?
			  mlx5_ib_modify_stat : NULL,
	.modify_hw_stat = mlx5_ib_modify_stat,
	.counter_init = mlx5_ib_counter_init,

	INIT_RDMA_OBJ_SIZE(rdma_counter, mlx5_rdma_counter, rdma_counter),
+3 −1
Original line number Diff line number Diff line
@@ -679,7 +679,7 @@ enum flow_table_type {
#define MLX5_FS_MAX_TYPES	 6
#define MLX5_FS_MAX_ENTRIES	 BIT(16)

static bool mlx5_ib_shared_ft_allowed(struct ib_device *device)
static bool __maybe_unused mlx5_ib_shared_ft_allowed(struct ib_device *device)
{
	struct mlx5_ib_dev *dev = to_mdev(device);

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

const struct uapi_definition mlx5_ib_flow_defs[] = {
#if IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS)
	UAPI_DEF_CHAIN_OBJ_TREE_NAMED(
		MLX5_IB_OBJECT_FLOW_MATCHER),
	UAPI_DEF_CHAIN_OBJ_TREE(
@@ -3040,6 +3041,7 @@ const struct uapi_definition mlx5_ib_flow_defs[] = {
	UAPI_DEF_CHAIN_OBJ_TREE_NAMED(
		MLX5_IB_OBJECT_STEERING_ANCHOR,
		UAPI_DEF_IS_OBJ_SUPPORTED(mlx5_ib_shared_ft_allowed)),
#endif
	{},
};

+0 −15
Original line number Diff line number Diff line
@@ -8,23 +8,8 @@

#include "mlx5_ib.h"

#if IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS)
int mlx5_ib_fs_init(struct mlx5_ib_dev *dev);
void mlx5_ib_fs_cleanup_anchor(struct mlx5_ib_dev *dev);
#else
static inline int mlx5_ib_fs_init(struct mlx5_ib_dev *dev)
{
	dev->flow_db = kzalloc(sizeof(*dev->flow_db), GFP_KERNEL);

	if (!dev->flow_db)
		return -ENOMEM;

	mutex_init(&dev->flow_db->lock);
	return 0;
}

inline void mlx5_ib_fs_cleanup_anchor(struct mlx5_ib_dev *dev) {}
#endif

static inline void mlx5_ib_fs_cleanup(struct mlx5_ib_dev *dev)
{