]> www.infradead.org Git - nvme.git/commitdiff
ice: update representor when VSI is ready
authorMichal Swiatkowski <michal.swiatkowski@linux.intel.com>
Mon, 10 Jun 2024 07:44:34 +0000 (09:44 +0200)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Fri, 21 Jun 2024 15:51:58 +0000 (08:51 -0700)
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 <michal.swiatkowski@linux.intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Tested-by: Sujai Buvaneswaran <sujai.buvaneswaran@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/ice/ice_eswitch.c
drivers/net/ethernet/intel/ice/ice_eswitch.h
drivers/net/ethernet/intel/ice/ice_vf_lib.c

index 3f73f46111fcc8a3b3f20be78f91f8787f2dc086..4f539b1c77810e8dfb7ce6328ba67a326f4e4c6c 100644 (file)
@@ -178,16 +178,16 @@ void ice_eswitch_decfg_vsi(struct ice_vsi *vsi, const u8 *mac)
  * @repr_id: representor ID
  * @vsi: VSI for which port representor is configured
  */
-void ice_eswitch_update_repr(unsigned long repr_id, struct ice_vsi *vsi)
+void ice_eswitch_update_repr(unsigned long *repr_id, struct ice_vsi *vsi)
 {
        struct ice_pf *pf = vsi->back;
        struct ice_repr *repr;
-       int ret;
+       int err;
 
        if (!ice_is_switchdev_running(pf))
                return;
 
-       repr = xa_load(&pf->eswitch.reprs, repr_id);
+       repr = xa_load(&pf->eswitch.reprs, *repr_id);
        if (!repr)
                return;
 
@@ -197,12 +197,19 @@ void ice_eswitch_update_repr(unsigned long repr_id, struct ice_vsi *vsi)
        if (repr->br_port)
                repr->br_port->vsi = vsi;
 
-       ret = ice_vsi_update_security(vsi, ice_vsi_ctx_clear_antispoof);
-       if (ret) {
-               ice_fltr_add_mac_and_broadcast(vsi, repr->parent_mac,
-                                              ICE_FWD_TO_VSI);
+       err = ice_eswitch_cfg_vsi(vsi, repr->parent_mac);
+       if (err)
                dev_err(ice_pf_to_dev(pf), "Failed to update VSI of port representor %d",
                        repr->id);
+
+       /* The VSI number is different, reload the PR with new id */
+       if (repr->id != vsi->vsi_num) {
+               xa_erase(&pf->eswitch.reprs, repr->id);
+               repr->id = vsi->vsi_num;
+               if (xa_insert(&pf->eswitch.reprs, repr->id, repr, GFP_KERNEL))
+                       dev_err(ice_pf_to_dev(pf), "Failed to reload port representor %d",
+                               repr->id);
+               *repr_id = repr->id;
        }
 }
 
index 9a25606e97400b5a6dbf47cfdb234eaa52ca6db6..09194d514f9b1de3d3493ab90c22f8012c3ebcaa 100644 (file)
@@ -18,7 +18,7 @@ ice_eswitch_mode_set(struct devlink *devlink, u16 mode,
                     struct netlink_ext_ack *extack);
 bool ice_is_eswitch_mode_switchdev(struct ice_pf *pf);
 
-void ice_eswitch_update_repr(unsigned long repr_id, struct ice_vsi *vsi);
+void ice_eswitch_update_repr(unsigned long *repr_id, struct ice_vsi *vsi);
 
 void ice_eswitch_stop_all_tx_queues(struct ice_pf *pf);
 
@@ -47,7 +47,7 @@ ice_eswitch_set_target_vsi(struct sk_buff *skb,
                           struct ice_tx_offload_params *off) { }
 
 static inline void
-ice_eswitch_update_repr(unsigned long repr_id, struct ice_vsi *vsi) { }
+ice_eswitch_update_repr(unsigned long *repr_id, struct ice_vsi *vsi) { }
 
 static inline int ice_eswitch_configure(struct ice_pf *pf)
 {
index 48a8d462d76ac98fd0cc827d6b9c5a5952e6812f..5635e9da2212ba8d5f847e4e2bc149731bbd87c5 100644 (file)
@@ -948,7 +948,7 @@ int ice_reset_vf(struct ice_vf *vf, u32 flags)
                goto out_unlock;
        }
 
-       ice_eswitch_update_repr(vf->repr_id, vsi);
+       ice_eswitch_update_repr(&vf->repr_id, vsi);
 
        /* if the VF has been reset allow it to come up again */
        ice_mbx_clear_malvf(&vf->mbx_info);