1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ 2 /* 3 * Copyright (c) 2013-2020, Mellanox Technologies inc. All rights reserved. 4 */ 5 6 #ifndef _MLX5_IB_FS_H 7 #define _MLX5_IB_FS_H 8 9 #include "mlx5_ib.h" 10 11 int mlx5_ib_fs_init(struct mlx5_ib_dev *dev); 12 void mlx5_ib_fs_cleanup_anchor(struct mlx5_ib_dev *dev); 13 14 static inline void mlx5_ib_fs_cleanup(struct mlx5_ib_dev *dev) 15 { 16 /* When a steering anchor is created, a special flow table is also 17 * created for the user to reference. Since the user can reference it, 18 * the kernel cannot trust that when the user destroys the steering 19 * anchor, they no longer reference the flow table. 20 * 21 * To address this issue, when a user destroys a steering anchor, only 22 * the flow steering rule in the table is destroyed, but the table 23 * itself is kept to deal with the above scenario. The remaining 24 * resources are only removed when the RDMA device is destroyed, which 25 * is a safe assumption that all references are gone. 26 */ 27 mlx5_ib_fs_cleanup_anchor(dev); 28 kfree(dev->flow_db->rdma_transport_tx); 29 kfree(dev->flow_db->rdma_transport_rx); 30 kfree(dev->flow_db); 31 } 32 #endif /* _MLX5_IB_FS_H */ 33