| 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 |
int i; |
| 17 |
|
| 18 |
/* When a steering anchor is created, a special flow table is also |
| 19 |
* created for the user to reference. Since the user can reference it, |
| 20 |
* the kernel cannot trust that when the user destroys the steering |
| 21 |
* anchor, they no longer reference the flow table. |
| 22 |
* |
| 23 |
* To address this issue, when a user destroys a steering anchor, only |
| 24 |
* the flow steering rule in the table is destroyed, but the table |
| 25 |
* itself is kept to deal with the above scenario. The remaining |
| 26 |
* resources are only removed when the RDMA device is destroyed, which |
| 27 |
* is a safe assumption that all references are gone. |
| 28 |
*/ |
| 29 |
mlx5_ib_fs_cleanup_anchor(dev); |
| 30 |
for (i = 0; i < MLX5_RDMA_TRANSPORT_BYPASS_PRIO; i++) |
| 31 |
kfree(dev->flow_db->rdma_transport_tx[i]); |
| 32 |
for (i = 0; i < MLX5_RDMA_TRANSPORT_BYPASS_PRIO; i++) |
| 33 |
kfree(dev->flow_db->rdma_transport_rx[i]); |
| 34 |
kfree(dev->flow_db); |
| 35 |
} |
| 36 |
#endif /* _MLX5_IB_FS_H */ |