Skip to content

Commit 43b59e0

Browse files
Michal SwiatkowskiNipaLocal
authored andcommitted
ice: update representor when VSI is ready
In case of reset of VF VSI can be reallocated. To handle this case it should be properly updated. Reload representor as vsi->vsi_num can be different than the one stored when representor was created. Instead of only changing antispoof do whole VSI configuration for eswitch. Signed-off-by: Michal Swiatkowski <[email protected]> Tested-by: Sujai Buvaneswaran <[email protected]> Reviewed-by: Jiri Pirko <[email protected]> Signed-off-by: Jacob Keller <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent 30cdda9 commit 43b59e0

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

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

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -178,16 +178,16 @@ void ice_eswitch_decfg_vsi(struct ice_vsi *vsi, const u8 *mac)
178178
* @repr_id: representor ID
179179
* @vsi: VSI for which port representor is configured
180180
*/
181-
void ice_eswitch_update_repr(unsigned long repr_id, struct ice_vsi *vsi)
181+
void ice_eswitch_update_repr(unsigned long *repr_id, struct ice_vsi *vsi)
182182
{
183183
struct ice_pf *pf = vsi->back;
184184
struct ice_repr *repr;
185-
int ret;
185+
int err;
186186

187187
if (!ice_is_switchdev_running(pf))
188188
return;
189189

190-
repr = xa_load(&pf->eswitch.reprs, repr_id);
190+
repr = xa_load(&pf->eswitch.reprs, *repr_id);
191191
if (!repr)
192192
return;
193193

@@ -197,12 +197,19 @@ void ice_eswitch_update_repr(unsigned long repr_id, struct ice_vsi *vsi)
197197
if (repr->br_port)
198198
repr->br_port->vsi = vsi;
199199

200-
ret = ice_vsi_update_security(vsi, ice_vsi_ctx_clear_antispoof);
201-
if (ret) {
202-
ice_fltr_add_mac_and_broadcast(vsi, repr->parent_mac,
203-
ICE_FWD_TO_VSI);
200+
err = ice_eswitch_cfg_vsi(vsi, repr->parent_mac);
201+
if (err)
204202
dev_err(ice_pf_to_dev(pf), "Failed to update VSI of port representor %d",
205203
repr->id);
204+
205+
/* The VSI number is different, reload the PR with new id */
206+
if (repr->id != vsi->vsi_num) {
207+
xa_erase(&pf->eswitch.reprs, repr->id);
208+
repr->id = vsi->vsi_num;
209+
if (xa_insert(&pf->eswitch.reprs, repr->id, repr, GFP_KERNEL))
210+
dev_err(ice_pf_to_dev(pf), "Failed to reload port representor %d",
211+
repr->id);
212+
*repr_id = repr->id;
206213
}
207214
}
208215

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ ice_eswitch_mode_set(struct devlink *devlink, u16 mode,
1818
struct netlink_ext_ack *extack);
1919
bool ice_is_eswitch_mode_switchdev(struct ice_pf *pf);
2020

21-
void ice_eswitch_update_repr(unsigned long repr_id, struct ice_vsi *vsi);
21+
void ice_eswitch_update_repr(unsigned long *repr_id, struct ice_vsi *vsi);
2222

2323
void ice_eswitch_stop_all_tx_queues(struct ice_pf *pf);
2424

@@ -47,7 +47,7 @@ ice_eswitch_set_target_vsi(struct sk_buff *skb,
4747
struct ice_tx_offload_params *off) { }
4848

4949
static inline void
50-
ice_eswitch_update_repr(unsigned long repr_id, struct ice_vsi *vsi) { }
50+
ice_eswitch_update_repr(unsigned long *repr_id, struct ice_vsi *vsi) { }
5151

5252
static inline int ice_eswitch_configure(struct ice_pf *pf)
5353
{

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ int ice_reset_vf(struct ice_vf *vf, u32 flags)
948948
goto out_unlock;
949949
}
950950

951-
ice_eswitch_update_repr(vf->repr_id, vsi);
951+
ice_eswitch_update_repr(&vf->repr_id, vsi);
952952

953953
/* if the VF has been reset allow it to come up again */
954954
ice_mbx_clear_malvf(&vf->mbx_info);

0 commit comments

Comments
 (0)