From: Simon Horman <horms@kernel.org>
To: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
jacob.e.keller@intel.com, michal.kubiak@intel.com,
maciej.fijalkowski@intel.com, sridhar.samudrala@intel.com,
przemyslaw.kitszel@intel.com, wojciech.drewek@intel.com,
pio.raczynski@gmail.com, jiri@nvidia.com,
mateusz.polchlopek@intel.com, shayd@nvidia.com, kuba@kernel.org
Subject: Re: [iwl-next v3 4/4] ice: update representor when VSI is ready
Date: Fri, 14 Jun 2024 13:47:16 +0100 [thread overview]
Message-ID: <20240614124716.GN8447@kernel.org> (raw)
In-Reply-To: <20240610074434.1962735-5-michal.swiatkowski@linux.intel.com>
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@linux.intel.com>
Thanks Michal,
My comment below notwithstanding, this looks good to me.
Reviewed-by: Simon Horman <horms@kernel.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.
...
next prev parent reply other threads:[~2024-06-14 12:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-10 7:44 [iwl-next v3 0/4] ice: prepare representor for SF support Michal Swiatkowski
2024-06-10 7:44 ` [iwl-next v3 1/4] ice: store representor ID in bridge port Michal Swiatkowski
2024-06-14 12:43 ` Simon Horman
2024-06-10 7:44 ` [iwl-next v3 2/4] ice: move devlink locking outside the port creation Michal Swiatkowski
2024-06-14 12:48 ` Simon Horman
2024-06-10 7:44 ` [iwl-next v3 3/4] ice: move VSI configuration outside repr setup Michal Swiatkowski
2024-06-14 12:43 ` Simon Horman
2024-06-21 4:16 ` Michal Swiatkowski
2024-06-10 7:44 ` [iwl-next v3 4/4] ice: update representor when VSI is ready Michal Swiatkowski
2024-06-14 12:47 ` Simon Horman [this message]
2024-06-21 4:32 ` Michal Swiatkowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240614124716.GN8447@kernel.org \
--to=horms@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jacob.e.keller@intel.com \
--cc=jiri@nvidia.com \
--cc=kuba@kernel.org \
--cc=maciej.fijalkowski@intel.com \
--cc=mateusz.polchlopek@intel.com \
--cc=michal.kubiak@intel.com \
--cc=michal.swiatkowski@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=pio.raczynski@gmail.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=shayd@nvidia.com \
--cc=sridhar.samudrala@intel.com \
--cc=wojciech.drewek@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).