| 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_notifier_init(struct mlx5_core_dev *dev); |
| 16 |
void mlx5_sf_hw_notifier_cleanup(struct mlx5_core_dev *dev); |
| 17 |
void mlx5_sf_hw_table_destroy(struct mlx5_core_dev *dev); |
| 18 |
|
| 19 |
int mlx5_sf_notifiers_init(struct mlx5_core_dev *dev); |
| 20 |
int mlx5_sf_table_init(struct mlx5_core_dev *dev); |
| 21 |
void mlx5_sf_notifiers_cleanup(struct mlx5_core_dev *dev); |
| 22 |
void mlx5_sf_table_cleanup(struct mlx5_core_dev *dev); |
| 23 |
bool mlx5_sf_table_empty(const struct mlx5_core_dev *dev); |
| 24 |
|
| 25 |
int mlx5_devlink_sf_port_new(struct devlink *devlink, |
| 26 |
const struct devlink_port_new_attrs *add_attr, |
| 27 |
struct netlink_ext_ack *extack, |
| 28 |
struct devlink_port **dl_port); |
| 29 |
int mlx5_devlink_sf_port_del(struct devlink *devlink, |
| 30 |
struct devlink_port *dl_port, |
| 31 |
struct netlink_ext_ack *extack); |
| 32 |
int mlx5_devlink_sf_port_fn_state_get(struct devlink_port *dl_port, |
| 33 |
enum devlink_port_fn_state *state, |
| 34 |
enum devlink_port_fn_opstate *opstate, |
| 35 |
struct netlink_ext_ack *extack); |
| 36 |
int mlx5_devlink_sf_port_fn_state_set(struct devlink_port *dl_port, |
| 37 |
enum devlink_port_fn_state state, |
| 38 |
struct netlink_ext_ack *extack); |
| 39 |
#else |
| 40 |
|
| 41 |
static inline int mlx5_sf_hw_table_init(struct mlx5_core_dev *dev) |
| 42 |
{ |
| 43 |
return 0; |
| 44 |
} |
| 45 |
|
| 46 |
static inline void mlx5_sf_hw_table_cleanup(struct mlx5_core_dev *dev) |
| 47 |
{ |
| 48 |
} |
| 49 |
|
| 50 |
static inline int mlx5_sf_hw_notifier_init(struct mlx5_core_dev *dev) |
| 51 |
{ |
| 52 |
return 0; |
| 53 |
} |
| 54 |
|
| 55 |
static inline void mlx5_sf_hw_notifier_cleanup(struct mlx5_core_dev *dev) |
| 56 |
{ |
| 57 |
} |
| 58 |
|
| 59 |
static inline void mlx5_sf_hw_table_destroy(struct mlx5_core_dev *dev) |
| 60 |
{ |
| 61 |
} |
| 62 |
|
| 63 |
static inline int mlx5_sf_notifiers_init(struct mlx5_core_dev *dev) |
| 64 |
{ |
| 65 |
return 0; |
| 66 |
} |
| 67 |
|
| 68 |
static inline int mlx5_sf_table_init(struct mlx5_core_dev *dev) |
| 69 |
{ |
| 70 |
return 0; |
| 71 |
} |
| 72 |
|
| 73 |
static inline void mlx5_sf_notifiers_cleanup(struct mlx5_core_dev *dev) |
| 74 |
{ |
| 75 |
} |
| 76 |
|
| 77 |
static inline void mlx5_sf_table_cleanup(struct mlx5_core_dev *dev) |
| 78 |
{ |
| 79 |
} |
| 80 |
|
| 81 |
static inline bool mlx5_sf_table_empty(const struct mlx5_core_dev *dev) |
| 82 |
{ |
| 83 |
return true; |
| 84 |
} |
| 85 |
|
| 86 |
#endif |
| 87 |
|
| 88 |
#endif |