#include <linux/etherdevice.h>
#include <linux/debugfs.h>
#include <linux/mlx5/driver.h>
#include <linux/mlx5/mlx5_ifc.h>
#include <linux/mlx5/vport.h>
#include <linux/mlx5/fs.h>
#include <linux/mlx5/mpfs.h>
#include "esw/acl/lgcy.h"
#include "esw/legacy.h"
#include "esw/qos.h"
#include "mlx5_core.h"
#include "lib/eq.h"
#include "lag/lag.h"
#include "eswitch.h"
#include "fs_core.h"
#include "devlink.h"
#include "ecpf.h"
#include "en/mod_hdr.h"
#include "en_accel/ipsec.h"
enum { … };
struct vport_addr { … };
static int mlx5_eswitch_check(const struct mlx5_core_dev *dev)
{ … }
static struct mlx5_eswitch *__mlx5_devlink_eswitch_get(struct devlink *devlink, bool check)
{ … }
struct mlx5_eswitch *__must_check
mlx5_devlink_eswitch_get(struct devlink *devlink)
{ … }
struct mlx5_eswitch *mlx5_devlink_eswitch_nocheck_get(struct devlink *devlink)
{ … }
struct mlx5_vport *__must_check
mlx5_eswitch_get_vport(struct mlx5_eswitch *esw, u16 vport_num)
{ … }
static int arm_vport_context_events_cmd(struct mlx5_core_dev *dev, u16 vport,
u32 events_mask)
{ … }
int mlx5_eswitch_modify_esw_vport_context(struct mlx5_core_dev *dev, u16 vport,
bool other_vport, void *in)
{ … }
static int modify_esw_vport_cvlan(struct mlx5_core_dev *dev, u16 vport,
u16 vlan, u8 qos, u8 set_flags)
{ … }
static struct mlx5_flow_handle *
__esw_fdb_set_vport_rule(struct mlx5_eswitch *esw, u16 vport, bool rx_rule,
u8 mac_c[ETH_ALEN], u8 mac_v[ETH_ALEN])
{ … }
static struct mlx5_flow_handle *
esw_fdb_set_vport_rule(struct mlx5_eswitch *esw, u8 mac[ETH_ALEN], u16 vport)
{ … }
static struct mlx5_flow_handle *
esw_fdb_set_vport_allmulti_rule(struct mlx5_eswitch *esw, u16 vport)
{ … }
static struct mlx5_flow_handle *
esw_fdb_set_vport_promisc_rule(struct mlx5_eswitch *esw, u16 vport)
{ … }
vport_addr_action;
static int esw_add_uc_addr(struct mlx5_eswitch *esw, struct vport_addr *vaddr)
{ … }
static int esw_del_uc_addr(struct mlx5_eswitch *esw, struct vport_addr *vaddr)
{ … }
static void update_allmulti_vports(struct mlx5_eswitch *esw,
struct vport_addr *vaddr,
struct esw_mc_addr *esw_mc)
{ … }
static int esw_add_mc_addr(struct mlx5_eswitch *esw, struct vport_addr *vaddr)
{ … }
static int esw_del_mc_addr(struct mlx5_eswitch *esw, struct vport_addr *vaddr)
{ … }
static void esw_apply_vport_addr_list(struct mlx5_eswitch *esw,
struct mlx5_vport *vport, int list_type)
{ … }
static void esw_update_vport_addr_list(struct mlx5_eswitch *esw,
struct mlx5_vport *vport, int list_type)
{ … }
static void esw_update_vport_mc_promisc(struct mlx5_eswitch *esw,
struct mlx5_vport *vport)
{ … }
static void esw_apply_vport_rx_mode(struct mlx5_eswitch *esw,
struct mlx5_vport *vport,
bool promisc, bool mc_promisc)
{ … }
static void esw_update_vport_rx_mode(struct mlx5_eswitch *esw,
struct mlx5_vport *vport)
{ … }
void esw_vport_change_handle_locked(struct mlx5_vport *vport)
{ … }
static void esw_vport_change_handler(struct work_struct *work)
{ … }
static void node_guid_gen_from_mac(u64 *node_guid, const u8 *mac)
{ … }
static int esw_vport_setup_acl(struct mlx5_eswitch *esw,
struct mlx5_vport *vport)
{ … }
static void esw_vport_cleanup_acl(struct mlx5_eswitch *esw,
struct mlx5_vport *vport)
{ … }
static int mlx5_esw_vport_caps_get(struct mlx5_eswitch *esw, struct mlx5_vport *vport)
{ … }
static int esw_vport_setup(struct mlx5_eswitch *esw, struct mlx5_vport *vport)
{ … }
static void esw_vport_cleanup(struct mlx5_eswitch *esw, struct mlx5_vport *vport)
{ … }
int mlx5_esw_vport_enable(struct mlx5_eswitch *esw, struct mlx5_vport *vport,
enum mlx5_eswitch_vport_event enabled_events)
{ … }
void mlx5_esw_vport_disable(struct mlx5_eswitch *esw, struct mlx5_vport *vport)
{ … }
static int eswitch_vport_event(struct notifier_block *nb,
unsigned long type, void *data)
{ … }
const u32 *mlx5_esw_query_functions(struct mlx5_core_dev *dev)
{ … }
static void mlx5_eswitch_event_handler_register(struct mlx5_eswitch *esw)
{ … }
static void mlx5_eswitch_event_handler_unregister(struct mlx5_eswitch *esw)
{ … }
static void mlx5_eswitch_clear_vf_vports_info(struct mlx5_eswitch *esw)
{ … }
static void mlx5_eswitch_clear_ec_vf_vports_info(struct mlx5_eswitch *esw)
{ … }
static int mlx5_eswitch_load_vport(struct mlx5_eswitch *esw, struct mlx5_vport *vport,
enum mlx5_eswitch_vport_event enabled_events)
{ … }
static void mlx5_eswitch_unload_vport(struct mlx5_eswitch *esw, struct mlx5_vport *vport)
{ … }
static int mlx5_eswitch_load_pf_vf_vport(struct mlx5_eswitch *esw, u16 vport_num,
enum mlx5_eswitch_vport_event enabled_events)
{ … }
static void mlx5_eswitch_unload_pf_vf_vport(struct mlx5_eswitch *esw, u16 vport_num)
{ … }
int mlx5_eswitch_load_sf_vport(struct mlx5_eswitch *esw, u16 vport_num,
enum mlx5_eswitch_vport_event enabled_events,
struct mlx5_devlink_port *dl_port, u32 controller, u32 sfnum)
{ … }
void mlx5_eswitch_unload_sf_vport(struct mlx5_eswitch *esw, u16 vport_num)
{ … }
void mlx5_eswitch_unload_vf_vports(struct mlx5_eswitch *esw, u16 num_vfs)
{ … }
static void mlx5_eswitch_unload_ec_vf_vports(struct mlx5_eswitch *esw,
u16 num_ec_vfs)
{ … }
int mlx5_eswitch_load_vf_vports(struct mlx5_eswitch *esw, u16 num_vfs,
enum mlx5_eswitch_vport_event enabled_events)
{ … }
static int mlx5_eswitch_load_ec_vf_vports(struct mlx5_eswitch *esw, u16 num_ec_vfs,
enum mlx5_eswitch_vport_event enabled_events)
{ … }
static int host_pf_enable_hca(struct mlx5_core_dev *dev)
{ … }
static void host_pf_disable_hca(struct mlx5_core_dev *dev)
{ … }
int
mlx5_eswitch_enable_pf_vf_vports(struct mlx5_eswitch *esw,
enum mlx5_eswitch_vport_event enabled_events)
{ … }
void mlx5_eswitch_disable_pf_vf_vports(struct mlx5_eswitch *esw)
{ … }
static void mlx5_eswitch_get_devlink_param(struct mlx5_eswitch *esw)
{ … }
static void
mlx5_eswitch_update_num_of_vfs(struct mlx5_eswitch *esw, int num_vfs)
{ … }
static void mlx5_esw_mode_change_notify(struct mlx5_eswitch *esw, u16 mode)
{ … }
static int mlx5_esw_acls_ns_init(struct mlx5_eswitch *esw)
{ … }
static void mlx5_esw_acls_ns_cleanup(struct mlx5_eswitch *esw)
{ … }
int mlx5_eswitch_enable_locked(struct mlx5_eswitch *esw, int num_vfs)
{ … }
int mlx5_eswitch_enable(struct mlx5_eswitch *esw, int num_vfs)
{ … }
void mlx5_eswitch_disable_sriov(struct mlx5_eswitch *esw, bool clear_vf)
{ … }
void mlx5_eswitch_disable_locked(struct mlx5_eswitch *esw)
{ … }
void mlx5_eswitch_disable(struct mlx5_eswitch *esw)
{ … }
static int mlx5_query_hca_cap_host_pf(struct mlx5_core_dev *dev, void *out)
{ … }
int mlx5_esw_sf_max_hpf_functions(struct mlx5_core_dev *dev, u16 *max_sfs, u16 *sf_base_id)
{ … }
static int mlx5_esw_vport_alloc(struct mlx5_eswitch *esw,
int index, u16 vport_num)
{ … }
static void mlx5_esw_vport_free(struct mlx5_eswitch *esw, struct mlx5_vport *vport)
{ … }
static void mlx5_esw_vports_cleanup(struct mlx5_eswitch *esw)
{ … }
static int mlx5_esw_vports_init(struct mlx5_eswitch *esw)
{ … }
static int mlx5_devlink_esw_multiport_set(struct devlink *devlink, u32 id,
struct devlink_param_gset_ctx *ctx,
struct netlink_ext_ack *extack)
{ … }
static int mlx5_devlink_esw_multiport_get(struct devlink *devlink, u32 id,
struct devlink_param_gset_ctx *ctx)
{ … }
static const struct devlink_param mlx5_eswitch_params[] = …;
int mlx5_eswitch_init(struct mlx5_core_dev *dev)
{ … }
void mlx5_eswitch_cleanup(struct mlx5_eswitch *esw)
{ … }
static int
mlx5_esw_set_vport_mac_locked(struct mlx5_eswitch *esw,
struct mlx5_vport *evport, const u8 *mac)
{ … }
int mlx5_eswitch_set_vport_mac(struct mlx5_eswitch *esw,
u16 vport, const u8 *mac)
{ … }
static bool mlx5_esw_check_port_type(struct mlx5_eswitch *esw, u16 vport_num, xa_mark_t mark)
{ … }
bool mlx5_eswitch_is_vf_vport(struct mlx5_eswitch *esw, u16 vport_num)
{ … }
bool mlx5_eswitch_is_pf_vf_vport(struct mlx5_eswitch *esw, u16 vport_num)
{ … }
bool mlx5_esw_is_sf_vport(struct mlx5_eswitch *esw, u16 vport_num)
{ … }
int mlx5_eswitch_set_vport_state(struct mlx5_eswitch *esw,
u16 vport, int link_state)
{ … }
int mlx5_eswitch_get_vport_config(struct mlx5_eswitch *esw,
u16 vport, struct ifla_vf_info *ivi)
{ … }
int __mlx5_eswitch_set_vport_vlan(struct mlx5_eswitch *esw,
u16 vport, u16 vlan, u8 qos, u8 set_flags)
{ … }
int mlx5_eswitch_get_vport_stats(struct mlx5_eswitch *esw,
u16 vport_num,
struct ifla_vf_stats *vf_stats)
{ … }
u8 mlx5_eswitch_mode(const struct mlx5_core_dev *dev)
{ … }
EXPORT_SYMBOL_GPL(…);
enum devlink_eswitch_encap_mode
mlx5_eswitch_get_encap_mode(const struct mlx5_core_dev *dev)
{ … }
EXPORT_SYMBOL(…);
bool mlx5_esw_multipath_prereq(struct mlx5_core_dev *dev0,
struct mlx5_core_dev *dev1)
{ … }
int mlx5_esw_event_notifier_register(struct mlx5_eswitch *esw, struct notifier_block *nb)
{ … }
void mlx5_esw_event_notifier_unregister(struct mlx5_eswitch *esw, struct notifier_block *nb)
{ … }
bool mlx5_esw_hold(struct mlx5_core_dev *mdev)
{ … }
void mlx5_esw_release(struct mlx5_core_dev *mdev)
{ … }
void mlx5_esw_get(struct mlx5_core_dev *mdev)
{ … }
void mlx5_esw_put(struct mlx5_core_dev *mdev)
{ … }
int mlx5_esw_try_lock(struct mlx5_eswitch *esw)
{ … }
int mlx5_esw_lock(struct mlx5_eswitch *esw)
{ … }
void mlx5_esw_unlock(struct mlx5_eswitch *esw)
{ … }
u16 mlx5_eswitch_get_total_vports(const struct mlx5_core_dev *dev)
{ … }
EXPORT_SYMBOL_GPL(…);
struct mlx5_core_dev *mlx5_eswitch_get_core_dev(struct mlx5_eswitch *esw)
{ … }
EXPORT_SYMBOL(…);
bool mlx5_eswitch_block_ipsec(struct mlx5_core_dev *dev)
{ … }
void mlx5_eswitch_unblock_ipsec(struct mlx5_core_dev *dev)
{ … }