From: Simon Horman <horms@kernel.org>
To: Tony Nguyen <anthony.l.nguyen@intel.com>
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
edumazet@google.com, netdev@vger.kernel.org,
Michal Swiatkowski <michal.swiatkowski@linux.intel.com>,
wojciech.drewek@intel.com, marcin.szycik@intel.com,
piotr.raczynski@intel.com,
Sujai Buvaneswaran <sujai.buvaneswaran@intel.com>
Subject: Re: [PATCH net-next 13/15] ice: add VF representors one by one
Date: Mon, 20 Nov 2023 19:54:47 +0000 [thread overview]
Message-ID: <20231120195447.GJ245676@kernel.org> (raw)
In-Reply-To: <20231114181449.1290117-14-anthony.l.nguyen@intel.com>
On Tue, Nov 14, 2023 at 10:14:33AM -0800, Tony Nguyen wrote:
> From: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
>
> Implement adding representors one by one. Always set switchdev
> environment when first representor is being added and clear environment
> when last one is being removed.
>
> Basic switchdev configuration remains the same. Code related to creating
> and configuring representor was changed.
>
> Instead of setting whole representors in one function handle only one
> representor in setup function. The same with removing representors.
>
> Stop representors when new one is being added or removed. Stop means,
> disabling napi, stopping traffic and removing slow path rule. It is
> needed because ::q_id will change after remapping, so each representor
> will need new rule.
>
> When representor are stopped rebuild control plane VSI with one more or
> one less queue. One more if new representor is being added, one less if
> representor is being removed.
>
> Bridge port is removed during unregister_netdev() call on PR, so there
> is no need to call it from driver side.
>
> After that do remap new queues to correct vector. At the end start all
> representors (napi enable, start queues, add slow path rule).
>
> Reviewed-by: Piotr Raczynski <piotr.raczynski@intel.com>
> Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
> Signed-off-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
> Tested-by: Sujai Buvaneswaran <sujai.buvaneswaran@intel.com>
> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
...
> diff --git a/drivers/net/ethernet/intel/ice/ice_eswitch.c b/drivers/net/ethernet/intel/ice/ice_eswitch.c
...
> +int
> +ice_eswitch_attach(struct ice_pf *pf, struct ice_vf *vf)
> +{
> + struct ice_repr *repr;
> + int change = 1;
> + int err;
> +
> + if (pf->eswitch_mode == DEVLINK_ESWITCH_MODE_LEGACY)
> + return 0;
> +
> + if (xa_empty(&pf->eswitch.reprs)) {
> + err = ice_eswitch_enable_switchdev(pf);
> + if (err)
> + return err;
> + /* Control plane VSI is created with 1 queue as default */
> + change = 0;
> + }
> +
> + ice_eswitch_stop_reprs(pf);
> +
> + repr = ice_repr_add_vf(vf);
> + if (IS_ERR(repr))
> + goto err_create_repr;
Hi Michal and Tony,
This branch will cause the function to return err,
but err is set to 0 here. Perhaps it should be set to PTR_ERR(repr)
instead?
Flagged by Smatch.
> +
> + err = ice_eswitch_setup_repr(pf, repr);
> + if (err)
> + goto err_setup_repr;
> +
> + err = xa_alloc(&pf->eswitch.reprs, &repr->id, repr,
> + XA_LIMIT(1, INT_MAX), GFP_KERNEL);
> + if (err)
> + goto err_xa_alloc;
> +
> + vf->repr_id = repr->id;
> +
> + ice_eswitch_cp_change_queues(&pf->eswitch, change);
> + ice_eswitch_start_reprs(pf);
> +
> + return 0;
> +
> +err_xa_alloc:
> + ice_eswitch_release_repr(pf, repr);
> +err_setup_repr:
> + ice_repr_rem_vf(repr);
> +err_create_repr:
> + if (xa_empty(&pf->eswitch.reprs))
> + ice_eswitch_disable_switchdev(pf);
> + ice_eswitch_start_reprs(pf);
> +
> + return err;
> +}
...
next prev parent reply other threads:[~2023-11-20 19:54 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-14 18:14 [PATCH net-next 00/15][pull request] ice: one by one port representors creation Tony Nguyen
2023-11-14 18:14 ` [PATCH net-next 01/15] ice: rename switchdev to eswitch Tony Nguyen
2023-11-14 18:14 ` [PATCH net-next 02/15] ice: remove redundant max_vsi_num variable Tony Nguyen
2023-11-14 18:14 ` [PATCH net-next 03/15] ice: remove unused control VSI parameter Tony Nguyen
2023-11-14 18:14 ` [PATCH net-next 04/15] ice: track q_id in representor Tony Nguyen
2023-11-14 18:14 ` [PATCH net-next 05/15] ice: use repr instead of vf->repr Tony Nguyen
2023-11-14 18:14 ` [PATCH net-next 06/15] ice: track port representors in xarray Tony Nguyen
2023-11-14 18:14 ` [PATCH net-next 07/15] ice: remove VF pointer reference in eswitch code Tony Nguyen
2023-11-14 18:14 ` [PATCH net-next 08/15] ice: make representor code generic Tony Nguyen
2023-11-14 18:14 ` [PATCH net-next 09/15] ice: return pointer to representor Tony Nguyen
2023-11-14 18:14 ` [PATCH net-next 10/15] ice: allow changing SWITCHDEV_CTRL VSI queues Tony Nguyen
2023-11-14 18:14 ` [PATCH net-next 11/15] ice: set Tx topology every time new repr is added Tony Nguyen
2023-11-14 18:14 ` [PATCH net-next 12/15] ice: realloc VSI stats arrays Tony Nguyen
2023-11-15 11:25 ` Przemek Kitszel
2023-11-14 18:14 ` [PATCH net-next 13/15] ice: add VF representors one by one Tony Nguyen
2023-11-20 19:54 ` Simon Horman [this message]
2023-11-14 18:14 ` [PATCH net-next 14/15] ice: adjust switchdev rebuild path Tony Nguyen
2023-11-14 18:14 ` [PATCH net-next 15/15] ice: reserve number of CP queues Tony Nguyen
2023-11-14 22:32 ` [PATCH net-next 00/15][pull request] ice: one by one port representors creation Jakub Kicinski
2023-11-14 23:06 ` Tony Nguyen
2023-11-19 3:50 ` patchwork-bot+netdevbpf
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=20231120195447.GJ245676@kernel.org \
--to=horms@kernel.org \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=marcin.szycik@intel.com \
--cc=michal.swiatkowski@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=piotr.raczynski@intel.com \
--cc=sujai.buvaneswaran@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).