1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
3 * Copyright (c) 2013-2020, Mellanox Technologies inc. All rights reserved.
11 #if IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS)
12 int mlx5_ib_fs_init(struct mlx5_ib_dev *dev);
13 void mlx5_ib_fs_cleanup_anchor(struct mlx5_ib_dev *dev);
15 static inline int mlx5_ib_fs_init(struct mlx5_ib_dev *dev)
17 dev->flow_db = kzalloc(sizeof(*dev->flow_db), GFP_KERNEL);
22 mutex_init(&dev->flow_db->lock);
26 inline void mlx5_ib_fs_cleanup_anchor(struct mlx5_ib_dev *dev) {}
29 static inline void mlx5_ib_fs_cleanup(struct mlx5_ib_dev *dev)
31 /* When a steering anchor is created, a special flow table is also
32 * created for the user to reference. Since the user can reference it,
33 * the kernel cannot trust that when the user destroys the steering
34 * anchor, they no longer reference the flow table.
36 * To address this issue, when a user destroys a steering anchor, only
37 * the flow steering rule in the table is destroyed, but the table
38 * itself is kept to deal with the above scenario. The remaining
39 * resources are only removed when the RDMA device is destroyed, which
40 * is a safe assumption that all references are gone.
42 mlx5_ib_fs_cleanup_anchor(dev);
45 #endif /* _MLX5_IB_FS_H */