summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
diff options
context:
space:
mode:
authorJiri Pirko <jiri@nvidia.com>2023-05-26 15:01:47 +0200
committerSaeed Mahameed <saeedm@nvidia.com>2023-08-22 21:34:16 -0700
commite855afd715656a9f25cf62fa68d99c33213b83b7 (patch)
tree049c6f19817d4b3a62ea137bc6cba7c78b96f4ec /drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
parent382fe5747b8a2f5057f515ee67bdcc2d0ccd9240 (diff)
net/mlx5: Introduce mlx5_eswitch_load/unload_sf_vport() and use it from SF code
Similar to the PF/VF helpers, introduce a set of load/unload helpers for SF vports. From there, call mlx5_eswitch_load/unload_vport() which are common for PFs/VFs and newly introduced SF helpers. Signed-off-by: Jiri Pirko <jiri@nvidia.com> Reviewed-by: Shay Drory <shayd@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx5/core/eswitch.c')
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/eswitch.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
index 76d05e233770..f77237401ee9 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
@@ -1119,6 +1119,33 @@ static void mlx5_eswitch_unload_pf_vf_vport(struct mlx5_eswitch *esw, u16 vport_
mlx5_esw_offloads_cleanup_pf_vf_rep(esw, vport_num);
}
+int mlx5_eswitch_load_sf_vport(struct mlx5_eswitch *esw, u16 vport_num,
+ enum mlx5_eswitch_vport_event enabled_events,
+ struct devlink_port *dl_port, u32 controller, u32 sfnum)
+{
+ int err;
+
+ err = mlx5_esw_offloads_init_sf_rep(esw, vport_num, dl_port, controller, sfnum);
+ if (err)
+ return err;
+
+ err = mlx5_eswitch_load_vport(esw, vport_num, enabled_events);
+ if (err)
+ goto err_load;
+
+ return 0;
+
+err_load:
+ mlx5_esw_offloads_cleanup_sf_rep(esw, vport_num);
+ return err;
+}
+
+void mlx5_eswitch_unload_sf_vport(struct mlx5_eswitch *esw, u16 vport_num)
+{
+ mlx5_eswitch_unload_vport(esw, vport_num);
+ mlx5_esw_offloads_cleanup_sf_rep(esw, vport_num);
+}
+
void mlx5_eswitch_unload_vf_vports(struct mlx5_eswitch *esw, u16 num_vfs)
{
struct mlx5_vport *vport;