#include <linux/mlx5/driver.h>
#include "eswitch.h"
#include "priv.h"
#include "sf/dev/dev.h"
#include "mlx5_ifc_vhca_event.h"
#include "vhca_event.h"
#include "ecpf.h"
#define CREATE_TRACE_POINTS
#include "diag/sf_tracepoint.h"
struct mlx5_sf { … };
static void *mlx5_sf_by_dl_port(struct devlink_port *dl_port)
{ … }
struct mlx5_sf_table { … };
static struct mlx5_sf *
mlx5_sf_lookup_by_function_id(struct mlx5_sf_table *table, unsigned int fn_id)
{ … }
static int mlx5_sf_function_id_insert(struct mlx5_sf_table *table, struct mlx5_sf *sf)
{ … }
static void mlx5_sf_function_id_erase(struct mlx5_sf_table *table, struct mlx5_sf *sf)
{ … }
static struct mlx5_sf *
mlx5_sf_alloc(struct mlx5_sf_table *table, struct mlx5_eswitch *esw,
u32 controller, u32 sfnum, struct netlink_ext_ack *extack)
{ … }
static void mlx5_sf_free(struct mlx5_sf_table *table, struct mlx5_sf *sf)
{ … }
static enum devlink_port_fn_state mlx5_sf_to_devlink_state(u8 hw_state)
{ … }
static enum devlink_port_fn_opstate mlx5_sf_to_devlink_opstate(u8 hw_state)
{ … }
static bool mlx5_sf_is_active(const struct mlx5_sf *sf)
{ … }
int mlx5_devlink_sf_port_fn_state_get(struct devlink_port *dl_port,
enum devlink_port_fn_state *state,
enum devlink_port_fn_opstate *opstate,
struct netlink_ext_ack *extack)
{ … }
static int mlx5_sf_activate(struct mlx5_core_dev *dev, struct mlx5_sf *sf,
struct netlink_ext_ack *extack)
{ … }
static int mlx5_sf_deactivate(struct mlx5_core_dev *dev, struct mlx5_sf *sf)
{ … }
static int mlx5_sf_state_set(struct mlx5_core_dev *dev, struct mlx5_sf_table *table,
struct mlx5_sf *sf,
enum devlink_port_fn_state state,
struct netlink_ext_ack *extack)
{ … }
int mlx5_devlink_sf_port_fn_state_set(struct devlink_port *dl_port,
enum devlink_port_fn_state state,
struct netlink_ext_ack *extack)
{ … }
static int mlx5_sf_add(struct mlx5_core_dev *dev, struct mlx5_sf_table *table,
const struct devlink_port_new_attrs *new_attr,
struct netlink_ext_ack *extack,
struct devlink_port **dl_port)
{ … }
static int
mlx5_sf_new_check_attr(struct mlx5_core_dev *dev, const struct devlink_port_new_attrs *new_attr,
struct netlink_ext_ack *extack)
{ … }
static bool mlx5_sf_table_supported(const struct mlx5_core_dev *dev)
{ … }
int mlx5_devlink_sf_port_new(struct devlink *devlink,
const struct devlink_port_new_attrs *new_attr,
struct netlink_ext_ack *extack,
struct devlink_port **dl_port)
{ … }
static void mlx5_sf_dealloc(struct mlx5_sf_table *table, struct mlx5_sf *sf)
{ … }
static void mlx5_sf_del(struct mlx5_sf_table *table, struct mlx5_sf *sf)
{ … }
int mlx5_devlink_sf_port_del(struct devlink *devlink,
struct devlink_port *dl_port,
struct netlink_ext_ack *extack)
{ … }
static bool mlx5_sf_state_update_check(const struct mlx5_sf *sf, u8 new_state)
{ … }
static int mlx5_sf_vhca_event(struct notifier_block *nb, unsigned long opcode, void *data)
{ … }
static void mlx5_sf_del_all(struct mlx5_sf_table *table)
{ … }
static int mlx5_sf_esw_event(struct notifier_block *nb, unsigned long event, void *data)
{ … }
static int mlx5_sf_mdev_event(struct notifier_block *nb, unsigned long event, void *data)
{ … }
int mlx5_sf_table_init(struct mlx5_core_dev *dev)
{ … }
void mlx5_sf_table_cleanup(struct mlx5_core_dev *dev)
{ … }