All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Mateusz Polchlopek <mateusz.polchlopek@intel.com>
Cc: Tony Nguyen <anthony.l.nguyen@intel.com>, <davem@davemloft.net>,
	<kuba@kernel.org>, <pabeni@redhat.com>, <edumazet@google.com>,
	<netdev@vger.kernel.org>, Jiri Pirko <jiri@nvidia.com>,
	Przemek Kitszel <przemyslaw.kitszel@intel.com>
Subject: Re: [PATCH net-next 1/6] devlink: extend devlink_param *set pointer
Date: Wed, 24 Apr 2024 11:05:58 +0200	[thread overview]
Message-ID: <cdd3d9d7-1b21-4dc2-be21-ef137682b1ea@intel.com> (raw)
In-Reply-To: <20240422203913.225151-2-anthony.l.nguyen@intel.com>

From: Tony Nguyen <anthony.l.nguyen@intel.com>
Date: Mon, 22 Apr 2024 13:39:06 -0700

> From: Mateusz Polchlopek <mateusz.polchlopek@intel.com>
> 
> Extend devlink_param *set function pointer to take extack as a param.
> Sometimes it is needed to pass information to the end user from set
> function. It is more proper to use for that netlink instead of passing
> message to dmesg.
> 
> Reviewed-by: Jiri Pirko <jiri@nvidia.com>
> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> Signed-off-by: Mateusz Polchlopek <mateusz.polchlopek@intel.com>
> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>

[...]

> diff --git a/include/net/devlink.h b/include/net/devlink.h
> index d31769a116ce..35eb0f884386 100644
> --- a/include/net/devlink.h
> +++ b/include/net/devlink.h
> @@ -483,7 +483,8 @@ struct devlink_param {
>  	int (*get)(struct devlink *devlink, u32 id,
>  		   struct devlink_param_gset_ctx *ctx);
>  	int (*set)(struct devlink *devlink, u32 id,
> -		   struct devlink_param_gset_ctx *ctx);
> +		   struct devlink_param_gset_ctx *ctx,
> +		   struct netlink_ext_ack *extack);

Sorry for the late comment. Can't we embed extack to
devlink_param_gset_ctx instead? It would take much less lines.

>  	int (*validate)(struct devlink *devlink, u32 id,
>  			union devlink_param_value val,
>  			struct netlink_ext_ack *extack);
> diff --git a/include/net/dsa.h b/include/net/dsa.h
> index 7edfd8de8882..a6ef7e4c503f 100644
> --- a/include/net/dsa.h
> +++ b/include/net/dsa.h
> @@ -1258,7 +1258,8 @@ struct dsa_switch_ops {
>  int dsa_devlink_param_get(struct devlink *dl, u32 id,
>  			  struct devlink_param_gset_ctx *ctx);
>  int dsa_devlink_param_set(struct devlink *dl, u32 id,
> -			  struct devlink_param_gset_ctx *ctx);
> +			  struct devlink_param_gset_ctx *ctx,
> +			  struct netlink_ext_ack *extack);
>  int dsa_devlink_params_register(struct dsa_switch *ds,
>  				const struct devlink_param *params,
>  				size_t params_count);
> diff --git a/net/devlink/param.c b/net/devlink/param.c
> index 22bc3b500518..dcf0d1ccebba 100644
> --- a/net/devlink/param.c
> +++ b/net/devlink/param.c
> @@ -158,11 +158,12 @@ static int devlink_param_get(struct devlink *devlink,
>  
>  static int devlink_param_set(struct devlink *devlink,
>  			     const struct devlink_param *param,
> -			     struct devlink_param_gset_ctx *ctx)
> +			     struct devlink_param_gset_ctx *ctx,
> +			     struct netlink_ext_ack *extack)
>  {
>  	if (!param->set)
>  		return -EOPNOTSUPP;
> -	return param->set(devlink, param->id, ctx);
> +	return param->set(devlink, param->id, ctx, extack);
>  }
>  
>  static int
> @@ -571,7 +572,7 @@ static int __devlink_nl_cmd_param_set_doit(struct devlink *devlink,
>  			return -EOPNOTSUPP;
>  		ctx.val = value;
>  		ctx.cmode = cmode;
> -		err = devlink_param_set(devlink, param, &ctx);
> +		err = devlink_param_set(devlink, param, &ctx, info->extack);
>  		if (err)
>  			return err;
>  	}
> diff --git a/net/dsa/devlink.c b/net/dsa/devlink.c
> index 431bf52290a1..0aac887d0098 100644
> --- a/net/dsa/devlink.c
> +++ b/net/dsa/devlink.c
> @@ -194,7 +194,8 @@ int dsa_devlink_param_get(struct devlink *dl, u32 id,
>  EXPORT_SYMBOL_GPL(dsa_devlink_param_get);
>  
>  int dsa_devlink_param_set(struct devlink *dl, u32 id,
> -			  struct devlink_param_gset_ctx *ctx)
> +			  struct devlink_param_gset_ctx *ctx,
> +			  struct netlink_ext_ack *extack)
>  {
>  	struct dsa_switch *ds = dsa_devlink_to_ds(dl);

Thanks,
Olek

  reply	other threads:[~2024-04-24  9:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-22 20:39 [PATCH net-next 0/6][pull request] ice: Support 5 layer Tx scheduler topology Tony Nguyen
2024-04-22 20:39 ` [PATCH net-next 1/6] devlink: extend devlink_param *set pointer Tony Nguyen
2024-04-24  9:05   ` Alexander Lobakin [this message]
2024-04-24  9:20     ` Przemek Kitszel
2024-04-24  9:24       ` Alexander Lobakin
2024-04-24  9:40         ` Przemek Kitszel
2024-04-24  9:52         ` Mateusz Polchlopek
2024-04-25  3:08     ` Jakub Kicinski
2024-04-22 20:39 ` [PATCH net-next 2/6] ice: Support 5 layer topology Tony Nguyen
2024-04-22 20:39 ` [PATCH net-next 3/6] ice: Adjust the VSI/Aggregator layers Tony Nguyen
2024-04-22 20:39 ` [PATCH net-next 4/6] ice: Enable switching default Tx scheduler topology Tony Nguyen
2024-04-22 20:39 ` [PATCH net-next 5/6] ice: Add tx_scheduling_layers devlink param Tony Nguyen
2024-04-22 20:39 ` [PATCH net-next 6/6] ice: Document tx_scheduling_layers parameter Tony Nguyen
2024-04-23 12:37   ` Bagas Sanjaya
2024-04-24  9:54     ` Mateusz Polchlopek
2024-04-24 10:47       ` Bagas Sanjaya
2024-04-25  3:10 ` [PATCH net-next 0/6][pull request] ice: Support 5 layer Tx scheduler topology 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=cdd3d9d7-1b21-4dc2-be21-ef137682b1ea@intel.com \
    --to=aleksander.lobakin@intel.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jiri@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=mateusz.polchlopek@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@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 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.