[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240614124716.GN8447@kernel.org>
Date: Fri, 14 Jun 2024 13:47:16 +0100
From: Simon Horman <horms@...nel.org>
To: Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>
Cc: intel-wired-lan@...ts.osuosl.org, netdev@...r.kernel.org,
jacob.e.keller@...el.com, michal.kubiak@...el.com,
maciej.fijalkowski@...el.com, sridhar.samudrala@...el.com,
przemyslaw.kitszel@...el.com, wojciech.drewek@...el.com,
pio.raczynski@...il.com, jiri@...dia.com,
mateusz.polchlopek@...el.com, shayd@...dia.com, kuba@...nel.org
Subject: Re: [iwl-next v3 4/4] ice: update representor when VSI is ready
On Mon, Jun 10, 2024 at 09:44:34AM +0200, Michal Swiatkowski wrote:
> 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@...ux.intel.com>
Thanks Michal,
My comment below notwithstanding, this looks good to me.
Reviewed-by: Simon Horman <horms@...nel.org>
> ---
> drivers/net/ethernet/intel/ice/ice_eswitch.c | 21 +++++++++++++-------
> drivers/net/ethernet/intel/ice/ice_eswitch.h | 4 ++--
> drivers/net/ethernet/intel/ice/ice_vf_lib.c | 2 +-
> 3 files changed, 17 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_eswitch.c b/drivers/net/ethernet/intel/ice/ice_eswitch.c
> index 3f73f46111fc..4f539b1c7781 100644
> --- a/drivers/net/ethernet/intel/ice/ice_eswitch.c
> +++ b/drivers/net/ethernet/intel/ice/ice_eswitch.c
> @@ -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;
> }
> }
FWIIW, I think it would be nicer if ice_eswitch_decfg_vsi returned
the repr_id rather than passing repr_id by reference. This is because,
in general, I think it's nicer to reduce side-effects of functions.
...
Powered by blists - more mailing lists