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 			     unsigned int *new_port_index);
25 int mlx5_devlink_sf_port_del(struct devlink *devlink, unsigned int port_index,
26 			     struct netlink_ext_ack *extack);
27 int mlx5_devlink_sf_port_fn_state_get(struct devlink_port *dl_port,
28 				      enum devlink_port_fn_state *state,
29 				      enum devlink_port_fn_opstate *opstate,
30 				      struct netlink_ext_ack *extack);
31 int mlx5_devlink_sf_port_fn_state_set(struct devlink_port *dl_port,
32 				      enum devlink_port_fn_state state,
33 				      struct netlink_ext_ack *extack);
34 #else
35 
mlx5_sf_hw_table_init(struct mlx5_core_dev * dev)36 static inline int mlx5_sf_hw_table_init(struct mlx5_core_dev *dev)
37 {
38 	return 0;
39 }
40 
mlx5_sf_hw_table_cleanup(struct mlx5_core_dev * dev)41 static inline void mlx5_sf_hw_table_cleanup(struct mlx5_core_dev *dev)
42 {
43 }
44 
mlx5_sf_hw_table_create(struct mlx5_core_dev * dev)45 static inline int mlx5_sf_hw_table_create(struct mlx5_core_dev *dev)
46 {
47 	return 0;
48 }
49 
mlx5_sf_hw_table_destroy(struct mlx5_core_dev * dev)50 static inline void mlx5_sf_hw_table_destroy(struct mlx5_core_dev *dev)
51 {
52 }
53 
mlx5_sf_table_init(struct mlx5_core_dev * dev)54 static inline int mlx5_sf_table_init(struct mlx5_core_dev *dev)
55 {
56 	return 0;
57 }
58 
mlx5_sf_table_cleanup(struct mlx5_core_dev * dev)59 static inline void mlx5_sf_table_cleanup(struct mlx5_core_dev *dev)
60 {
61 }
62 
63 #endif
64 
65 #endif
66