All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Marcin Szycik <marcin.szycik@linux.intel.com>
Cc: netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org
Subject: Re: [Intel-wired-lan] [PATCH iwl-net] ice: Block switchdev mode when ADQ is acvite and vice versa
Date: Thu, 3 Aug 2023 16:11:26 +0300	[thread overview]
Message-ID: <20230803131126.GD53714@unreal> (raw)
In-Reply-To: <20230801115235.67343-1-marcin.szycik@linux.intel.com>

On Tue, Aug 01, 2023 at 01:52:35PM +0200, Marcin Szycik wrote:
> ADQ and switchdev are not supported simultaneously. Enabling both at the
> same time can result in nullptr dereference.
> 
> To prevent this, check if ADQ is active when changing devlink mode to
> switchdev mode, and check if switchdev is active when enabling ADQ.
> 
> Fixes: fbc7b27af0f9 ("ice: enable ndo_setup_tc support for mqprio_qdisc")
> Signed-off-by: Marcin Szycik <marcin.szycik@linux.intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_eswitch.c | 5 +++++
>  drivers/net/ethernet/intel/ice/ice_main.c    | 6 ++++++
>  2 files changed, 11 insertions(+)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_eswitch.c b/drivers/net/ethernet/intel/ice/ice_eswitch.c
> index ad0a007b7398..2ea5aaceee11 100644
> --- a/drivers/net/ethernet/intel/ice/ice_eswitch.c
> +++ b/drivers/net/ethernet/intel/ice/ice_eswitch.c
> @@ -538,6 +538,11 @@ ice_eswitch_mode_set(struct devlink *devlink, u16 mode,
>  		break;
>  	case DEVLINK_ESWITCH_MODE_SWITCHDEV:
>  	{
> +		if (ice_is_adq_active(pf)) {
> +			dev_err(ice_pf_to_dev(pf), "switchdev cannot be configured - ADQ is active. Delete ADQ configs using TC and try again\n");

It needs to be reported through netlink extack.

> +			return -EOPNOTSUPP;
> +		}
> +
>  		dev_info(ice_pf_to_dev(pf), "PF %d changed eswitch mode to switchdev",
>  			 pf->hw.pf_id);
>  		NL_SET_ERR_MSG_MOD(extack, "Changed eswitch mode to switchdev");

Thanks
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

WARNING: multiple messages have this Message-ID (diff)
From: Leon Romanovsky <leon@kernel.org>
To: Marcin Szycik <marcin.szycik@linux.intel.com>
Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org
Subject: Re: [PATCH iwl-net] ice: Block switchdev mode when ADQ is acvite and vice versa
Date: Thu, 3 Aug 2023 16:11:26 +0300	[thread overview]
Message-ID: <20230803131126.GD53714@unreal> (raw)
In-Reply-To: <20230801115235.67343-1-marcin.szycik@linux.intel.com>

On Tue, Aug 01, 2023 at 01:52:35PM +0200, Marcin Szycik wrote:
> ADQ and switchdev are not supported simultaneously. Enabling both at the
> same time can result in nullptr dereference.
> 
> To prevent this, check if ADQ is active when changing devlink mode to
> switchdev mode, and check if switchdev is active when enabling ADQ.
> 
> Fixes: fbc7b27af0f9 ("ice: enable ndo_setup_tc support for mqprio_qdisc")
> Signed-off-by: Marcin Szycik <marcin.szycik@linux.intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_eswitch.c | 5 +++++
>  drivers/net/ethernet/intel/ice/ice_main.c    | 6 ++++++
>  2 files changed, 11 insertions(+)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_eswitch.c b/drivers/net/ethernet/intel/ice/ice_eswitch.c
> index ad0a007b7398..2ea5aaceee11 100644
> --- a/drivers/net/ethernet/intel/ice/ice_eswitch.c
> +++ b/drivers/net/ethernet/intel/ice/ice_eswitch.c
> @@ -538,6 +538,11 @@ ice_eswitch_mode_set(struct devlink *devlink, u16 mode,
>  		break;
>  	case DEVLINK_ESWITCH_MODE_SWITCHDEV:
>  	{
> +		if (ice_is_adq_active(pf)) {
> +			dev_err(ice_pf_to_dev(pf), "switchdev cannot be configured - ADQ is active. Delete ADQ configs using TC and try again\n");

It needs to be reported through netlink extack.

> +			return -EOPNOTSUPP;
> +		}
> +
>  		dev_info(ice_pf_to_dev(pf), "PF %d changed eswitch mode to switchdev",
>  			 pf->hw.pf_id);
>  		NL_SET_ERR_MSG_MOD(extack, "Changed eswitch mode to switchdev");

Thanks

  parent reply	other threads:[~2023-08-03 13:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-01 11:52 [Intel-wired-lan] [PATCH iwl-net] ice: Block switchdev mode when ADQ is acvite and vice versa Marcin Szycik
2023-08-01 11:52 ` Marcin Szycik
2023-08-01 12:06 ` [Intel-wired-lan] " Przemek Kitszel
2023-08-01 12:06   ` Przemek Kitszel
2023-08-03 13:11 ` Leon Romanovsky [this message]
2023-08-03 13:11   ` Leon Romanovsky
2023-08-03 13:26   ` [Intel-wired-lan] " Jiri Pirko
2023-08-03 13:26     ` Jiri Pirko
2023-08-03 15:11     ` [Intel-wired-lan] " Marcin Szycik
2023-08-03 15:11       ` Marcin Szycik
2023-08-03 17:43       ` [Intel-wired-lan] " Jiri Pirko
2023-08-03 17:43         ` Jiri Pirko
2023-08-03 14:58   ` [Intel-wired-lan] " Marcin Szycik
2023-08-03 14:58     ` Marcin Szycik

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=20230803131126.GD53714@unreal \
    --to=leon@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=marcin.szycik@linux.intel.com \
    --cc=netdev@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.