1 | /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ |
2 | /* Copyright (c) 2020 Mellanox Technologies Ltd */ |
3 | |
4 | #ifndef __MLX5_SF_H__ |
5 | #define __MLX5_SF_H__ |
6 | |
7 | #include <linux/mlx5/driver.h> |
8 | #include "lib/sf.h" |
9 | |
10 | #ifdef CONFIG_MLX5_SF_MANAGER |
11 | |
12 | int mlx5_sf_hw_table_init(struct mlx5_core_dev *dev); |
13 | void mlx5_sf_hw_table_cleanup(struct mlx5_core_dev *dev); |
14 | |
15 | int mlx5_sf_hw_table_create(struct mlx5_core_dev *dev); |
16 | void mlx5_sf_hw_table_destroy(struct mlx5_core_dev *dev); |
17 | |
18 | int mlx5_sf_table_init(struct mlx5_core_dev *dev); |
19 | void mlx5_sf_table_cleanup(struct mlx5_core_dev *dev); |
20 | |
21 | int mlx5_devlink_sf_port_new(struct devlink *devlink, |
22 | const struct devlink_port_new_attrs *add_attr, |
23 | struct netlink_ext_ack *extack, |
24 | struct devlink_port **dl_port); |
25 | int mlx5_devlink_sf_port_del(struct devlink *devlink, |
26 | struct devlink_port *dl_port, |
27 | struct netlink_ext_ack *extack); |
28 | int mlx5_devlink_sf_port_fn_state_get(struct devlink_port *dl_port, |
29 | enum devlink_port_fn_state *state, |
30 | enum devlink_port_fn_opstate *opstate, |
31 | struct netlink_ext_ack *extack); |
32 | int mlx5_devlink_sf_port_fn_state_set(struct devlink_port *dl_port, |
33 | enum devlink_port_fn_state state, |
34 | struct netlink_ext_ack *extack); |
35 | #else |
36 | |
37 | static inline int mlx5_sf_hw_table_init(struct mlx5_core_dev *dev) |
38 | { |
39 | return 0; |
40 | } |
41 | |
42 | static inline void mlx5_sf_hw_table_cleanup(struct mlx5_core_dev *dev) |
43 | { |
44 | } |
45 | |
46 | static inline int mlx5_sf_hw_table_create(struct mlx5_core_dev *dev) |
47 | { |
48 | return 0; |
49 | } |
50 | |
51 | static inline void mlx5_sf_hw_table_destroy(struct mlx5_core_dev *dev) |
52 | { |
53 | } |
54 | |
55 | static inline int mlx5_sf_table_init(struct mlx5_core_dev *dev) |
56 | { |
57 | return 0; |
58 | } |
59 | |
60 | static inline void mlx5_sf_table_cleanup(struct mlx5_core_dev *dev) |
61 | { |
62 | } |
63 | |
64 | #endif |
65 | |
66 | #endif |
67 | |