Skip to content

Commit c9663f7

Browse files
Michal Swiatkowskianguy11
authored andcommitted
ice: adjust switchdev rebuild path
There is no need to use specific functions for rebuilding path. Let's use current implementation by removing all representors and as the result remove switchdev environment. It will be added in devices rebuild path. For example during adding VFs, port representors for them also will be created. Rebuild control plane VSI before removing representors with INIT_VSI flag set to reinit VSI in hardware after reset. Reviewed-by: Wojciech Drewek <[email protected]> Signed-off-by: Michal Swiatkowski <[email protected]> Tested-by: Sujai Buvaneswaran <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent fff292b commit c9663f7

File tree

3 files changed

+28
-49
lines changed

3 files changed

+28
-49
lines changed

drivers/net/ethernet/intel/ice/ice_eswitch.c

Lines changed: 23 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -406,19 +406,6 @@ ice_eswitch_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi)
406406
return ice_vsi_setup(pf, &params);
407407
}
408408

409-
/**
410-
* ice_eswitch_napi_del - remove NAPI handle for all port representors
411-
* @reprs: xarray of reprs
412-
*/
413-
static void ice_eswitch_napi_del(struct xarray *reprs)
414-
{
415-
struct ice_repr *repr;
416-
unsigned long id;
417-
418-
xa_for_each(reprs, id, repr)
419-
netif_napi_del(&repr->q_vector->napi);
420-
}
421-
422409
/**
423410
* ice_eswitch_napi_enable - enable NAPI for all port representors
424411
* @reprs: xarray of reprs
@@ -624,36 +611,6 @@ static void ice_eswitch_start_reprs(struct ice_pf *pf)
624611
ice_eswitch_add_sp_rules(pf);
625612
}
626613

627-
/**
628-
* ice_eswitch_rebuild - rebuild eswitch
629-
* @pf: pointer to PF structure
630-
*/
631-
int ice_eswitch_rebuild(struct ice_pf *pf)
632-
{
633-
struct ice_vsi *ctrl_vsi = pf->eswitch.control_vsi;
634-
int status;
635-
636-
ice_eswitch_napi_disable(&pf->eswitch.reprs);
637-
ice_eswitch_napi_del(&pf->eswitch.reprs);
638-
639-
status = ice_eswitch_setup_env(pf);
640-
if (status)
641-
return status;
642-
643-
ice_eswitch_remap_rings_to_vectors(&pf->eswitch);
644-
645-
ice_replay_tc_fltrs(pf);
646-
647-
status = ice_vsi_open(ctrl_vsi);
648-
if (status)
649-
return status;
650-
651-
ice_eswitch_napi_enable(&pf->eswitch.reprs);
652-
ice_eswitch_start_all_tx_queues(pf);
653-
654-
return 0;
655-
}
656-
657614
static void
658615
ice_eswitch_cp_change_queues(struct ice_eswitch *eswitch, int change)
659616
{
@@ -752,3 +709,26 @@ void ice_eswitch_detach(struct ice_pf *pf, struct ice_vf *vf)
752709
ice_eswitch_start_reprs(pf);
753710
}
754711
}
712+
713+
/**
714+
* ice_eswitch_rebuild - rebuild eswitch
715+
* @pf: pointer to PF structure
716+
*/
717+
int ice_eswitch_rebuild(struct ice_pf *pf)
718+
{
719+
struct ice_repr *repr;
720+
unsigned long id;
721+
int err;
722+
723+
if (!ice_is_switchdev_running(pf))
724+
return 0;
725+
726+
err = ice_vsi_rebuild(pf->eswitch.control_vsi, ICE_VSI_FLAG_INIT);
727+
if (err)
728+
return err;
729+
730+
xa_for_each(&pf->eswitch.reprs, id, repr)
731+
ice_eswitch_detach(pf, repr->vf);
732+
733+
return 0;
734+
}

drivers/net/ethernet/intel/ice/ice_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7412,9 +7412,9 @@ static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type)
74127412
ice_ptp_cfg_timestamp(pf, true);
74137413
}
74147414

7415-
err = ice_vsi_rebuild_by_type(pf, ICE_VSI_SWITCHDEV_CTRL);
7415+
err = ice_eswitch_rebuild(pf);
74167416
if (err) {
7417-
dev_err(dev, "Switchdev CTRL VSI rebuild failed: %d\n", err);
7417+
dev_err(dev, "Switchdev rebuild failed: %d\n", err);
74187418
goto err_vsi_rebuild;
74197419
}
74207420

drivers/net/ethernet/intel/ice/ice_vf_lib.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,7 @@ void ice_reset_all_vfs(struct ice_pf *pf)
760760
ice_for_each_vf(pf, bkt, vf) {
761761
mutex_lock(&vf->cfg_lock);
762762

763+
ice_eswitch_detach(pf, vf);
763764
vf->driver_caps = 0;
764765
ice_vc_set_default_allowlist(vf);
765766

@@ -775,13 +776,11 @@ void ice_reset_all_vfs(struct ice_pf *pf)
775776
ice_vf_rebuild_vsi(vf);
776777
ice_vf_post_vsi_rebuild(vf);
777778

779+
ice_eswitch_attach(pf, vf);
780+
778781
mutex_unlock(&vf->cfg_lock);
779782
}
780783

781-
if (ice_is_eswitch_mode_switchdev(pf))
782-
if (ice_eswitch_rebuild(pf))
783-
dev_warn(dev, "eswitch rebuild failed\n");
784-
785784
ice_flush(hw);
786785
clear_bit(ICE_VF_DIS, pf->state);
787786

0 commit comments

Comments
 (0)