Commit c9663f79 authored by Michal Swiatkowski's avatar Michal Swiatkowski Committed by Tony Nguyen

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: default avatarWojciech Drewek <wojciech.drewek@intel.com>
Signed-off-by: default avatarMichal Swiatkowski <michal.swiatkowski@linux.intel.com>
Tested-by: default avatarSujai Buvaneswaran <sujai.buvaneswaran@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent fff292b4
...@@ -406,19 +406,6 @@ ice_eswitch_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi) ...@@ -406,19 +406,6 @@ ice_eswitch_vsi_setup(struct ice_pf *pf, struct ice_port_info *pi)
return ice_vsi_setup(pf, &params); return ice_vsi_setup(pf, &params);
} }
/**
* ice_eswitch_napi_del - remove NAPI handle for all port representors
* @reprs: xarray of reprs
*/
static void ice_eswitch_napi_del(struct xarray *reprs)
{
struct ice_repr *repr;
unsigned long id;
xa_for_each(reprs, id, repr)
netif_napi_del(&repr->q_vector->napi);
}
/** /**
* ice_eswitch_napi_enable - enable NAPI for all port representors * ice_eswitch_napi_enable - enable NAPI for all port representors
* @reprs: xarray of reprs * @reprs: xarray of reprs
...@@ -624,36 +611,6 @@ static void ice_eswitch_start_reprs(struct ice_pf *pf) ...@@ -624,36 +611,6 @@ static void ice_eswitch_start_reprs(struct ice_pf *pf)
ice_eswitch_add_sp_rules(pf); ice_eswitch_add_sp_rules(pf);
} }
/**
* ice_eswitch_rebuild - rebuild eswitch
* @pf: pointer to PF structure
*/
int ice_eswitch_rebuild(struct ice_pf *pf)
{
struct ice_vsi *ctrl_vsi = pf->eswitch.control_vsi;
int status;
ice_eswitch_napi_disable(&pf->eswitch.reprs);
ice_eswitch_napi_del(&pf->eswitch.reprs);
status = ice_eswitch_setup_env(pf);
if (status)
return status;
ice_eswitch_remap_rings_to_vectors(&pf->eswitch);
ice_replay_tc_fltrs(pf);
status = ice_vsi_open(ctrl_vsi);
if (status)
return status;
ice_eswitch_napi_enable(&pf->eswitch.reprs);
ice_eswitch_start_all_tx_queues(pf);
return 0;
}
static void static void
ice_eswitch_cp_change_queues(struct ice_eswitch *eswitch, int change) ice_eswitch_cp_change_queues(struct ice_eswitch *eswitch, int change)
{ {
...@@ -752,3 +709,26 @@ void ice_eswitch_detach(struct ice_pf *pf, struct ice_vf *vf) ...@@ -752,3 +709,26 @@ void ice_eswitch_detach(struct ice_pf *pf, struct ice_vf *vf)
ice_eswitch_start_reprs(pf); ice_eswitch_start_reprs(pf);
} }
} }
/**
* ice_eswitch_rebuild - rebuild eswitch
* @pf: pointer to PF structure
*/
int ice_eswitch_rebuild(struct ice_pf *pf)
{
struct ice_repr *repr;
unsigned long id;
int err;
if (!ice_is_switchdev_running(pf))
return 0;
err = ice_vsi_rebuild(pf->eswitch.control_vsi, ICE_VSI_FLAG_INIT);
if (err)
return err;
xa_for_each(&pf->eswitch.reprs, id, repr)
ice_eswitch_detach(pf, repr->vf);
return 0;
}
...@@ -7412,9 +7412,9 @@ static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type) ...@@ -7412,9 +7412,9 @@ static void ice_rebuild(struct ice_pf *pf, enum ice_reset_req reset_type)
ice_ptp_cfg_timestamp(pf, true); ice_ptp_cfg_timestamp(pf, true);
} }
err = ice_vsi_rebuild_by_type(pf, ICE_VSI_SWITCHDEV_CTRL); err = ice_eswitch_rebuild(pf);
if (err) { if (err) {
dev_err(dev, "Switchdev CTRL VSI rebuild failed: %d\n", err); dev_err(dev, "Switchdev rebuild failed: %d\n", err);
goto err_vsi_rebuild; goto err_vsi_rebuild;
} }
......
...@@ -760,6 +760,7 @@ void ice_reset_all_vfs(struct ice_pf *pf) ...@@ -760,6 +760,7 @@ void ice_reset_all_vfs(struct ice_pf *pf)
ice_for_each_vf(pf, bkt, vf) { ice_for_each_vf(pf, bkt, vf) {
mutex_lock(&vf->cfg_lock); mutex_lock(&vf->cfg_lock);
ice_eswitch_detach(pf, vf);
vf->driver_caps = 0; vf->driver_caps = 0;
ice_vc_set_default_allowlist(vf); ice_vc_set_default_allowlist(vf);
...@@ -775,13 +776,11 @@ void ice_reset_all_vfs(struct ice_pf *pf) ...@@ -775,13 +776,11 @@ void ice_reset_all_vfs(struct ice_pf *pf)
ice_vf_rebuild_vsi(vf); ice_vf_rebuild_vsi(vf);
ice_vf_post_vsi_rebuild(vf); ice_vf_post_vsi_rebuild(vf);
ice_eswitch_attach(pf, vf);
mutex_unlock(&vf->cfg_lock); mutex_unlock(&vf->cfg_lock);
} }
if (ice_is_eswitch_mode_switchdev(pf))
if (ice_eswitch_rebuild(pf))
dev_warn(dev, "eswitch rebuild failed\n");
ice_flush(hw); ice_flush(hw);
clear_bit(ICE_VF_DIS, pf->state); clear_bit(ICE_VF_DIS, pf->state);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment