All of lore.kernel.org
 help / color / mirror / Atom feed
From: Przemek Kitszel <przemyslaw.kitszel@intel.com>
To: Tariq Toukan <tariqt@nvidia.com>, Oren Sidi <osidi@nvidia.com>
Cc: Aya Levin <ayal@nvidia.com>, Gal Pressman <gal@nvidia.com>,
	Jiri Pirko <jiri@nvidia.com>, Jiri Pirko <jiri@resnulli.us>,
	<linux-kernel@vger.kernel.org>, Simon Horman <horms@kernel.org>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, <netdev@vger.kernel.org>,
	Paolo Abeni <pabeni@redhat.com>
Subject: Re: [PATCH net-next] devlink: prevent function configuration when port is active
Date: Mon, 10 Aug 2026 15:52:16 +0200	[thread overview]
Message-ID: <8f6d577a-659a-4cea-ac0e-554cdd36c076@intel.com> (raw)
In-Reply-To: <20260810103245.3162004-1-tariqt@nvidia.com>

On 8/10/26 12:32, Tariq Toukan wrote:
> From: Oren Sidi <osidi@nvidia.com>
> 
> Reject port function parameter changes when the port is active.
> Enforcing this insures configuration integrity and consistency.
> 
> Signed-off-by: Oren Sidi <osidi@nvidia.com>
> Reviewed-by: Aya Levin <ayal@nvidia.com>
> Reviewed-by: Jiri Pirko <jiri@nvidia.com>
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
> ---
>   net/devlink/port.c | 17 +++++++++++++++++
>   1 file changed, 17 insertions(+)
> 
> diff --git a/net/devlink/port.c b/net/devlink/port.c
> index 1528f2d148df..6a9857bf79da 100644
> --- a/net/devlink/port.c
> +++ b/net/devlink/port.c
> @@ -708,7 +708,10 @@ static int devlink_port_function_validate(struct devlink_port *devlink_port,
>   					  struct netlink_ext_ack *extack)
>   {
>   	const struct devlink_port_ops *ops = devlink_port->ops;
> +	enum devlink_port_fn_opstate opstate;
> +	enum devlink_port_fn_state state;
>   	struct nlattr *attr;
> +	int err;
>   
>   	if (tb[DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR] &&
>   	    !ops->port_fn_hw_addr_set) {
> @@ -721,6 +724,20 @@ static int devlink_port_function_validate(struct devlink_port *devlink_port,
>   				    "Function does not support state setting");
>   		return -EOPNOTSUPP;
>   	}
> +	if (devlink_port->attrs.flavour == DEVLINK_PORT_FLAVOUR_PCI_SF &&

nit: this is the only place that marks the logic only for SUBFUNCTION,
would be good to amend commit message/subject line:
s/function/subfunction/ # for the subject

with or without the above:
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>

> +	    ops->port_fn_state_get && !tb[DEVLINK_PORT_FN_ATTR_STATE]) {
> +		err = ops->port_fn_state_get(devlink_port, &state,
> +					     &opstate, extack);
> +		if (err)
> +			return err;
> +
> +		if (state == DEVLINK_PORT_FN_STATE_ACTIVE) {
> +			NL_SET_ERR_MSG(extack,
> +				       "port function parameters can't be configured when port is up");
> +			return -EINVAL;
> +		}
> +	}
> +
>   	attr = tb[DEVLINK_PORT_FN_ATTR_CAPS];
>   	if (attr) {
>   		struct nla_bitfield32 caps;
> 
> base-commit: 001b5d347d8ba39b2dccaefcc57967b18caec8fe


  reply	other threads:[~2026-08-10 13:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-10 10:32 [PATCH net-next] devlink: prevent function configuration when port is active Tariq Toukan
2026-08-10 13:52 ` Przemek Kitszel [this message]
2026-08-12  1:38 ` Jakub Kicinski

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=8f6d577a-659a-4cea-ac0e-554cdd36c076@intel.com \
    --to=przemyslaw.kitszel@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=ayal@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gal@nvidia.com \
    --cc=horms@kernel.org \
    --cc=jiri@nvidia.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=osidi@nvidia.com \
    --cc=pabeni@redhat.com \
    --cc=tariqt@nvidia.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 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.