[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6uzvaczuh6vpflpwnyknmq32ogcw52u35djzab7yd7jlgwasdc@paq2c2yznfti>
Date: Thu, 16 Oct 2025 11:16:49 +0200
From: Jiri Pirko <jiri@...nulli.us>
To: Saeed Mahameed <saeed@...nel.org>
Cc: "David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Eric Dumazet <edumazet@...gle.com>, Saeed Mahameed <saeedm@...dia.com>, netdev@...r.kernel.org,
Tariq Toukan <tariqt@...dia.com>, Gal Pressman <gal@...dia.com>,
Leon Romanovsky <leonro@...dia.com>, mbloch@...dia.com, Parav Pandit <parav@...dia.com>,
Adithya Jayachandran <ajayachandra@...dia.com>
Subject: Re: [PATCH net-next 1/3] devlink: Introduce devlink eswitch state
Thu, Oct 16, 2025 at 03:36:16AM +0200, saeed@...nel.org wrote:
>From: Parav Pandit <parav@...dia.com>
[...]
>@@ -722,6 +734,24 @@ int devlink_nl_eswitch_set_doit(struct sk_buff *skb, struct genl_info *info)
> return err;
> }
>
>+ state = DEVLINK_ESWITCH_STATE_ACTIVE;
>+ if (info->attrs[DEVLINK_ATTR_ESWITCH_STATE]) {
>+ if (!ops->eswitch_state_set)
>+ return -EOPNOTSUPP;
>+ state = nla_get_u8(info->attrs[DEVLINK_ATTR_ESWITCH_STATE]);
>+ }
>+ /* If user did not supply the state attribute, the default is
>+ * active state. If the state was not explicitly set, set the default
>+ * state for drivers that support eswitch state.
>+ * Keep this after mode-set as state handling can be dependent on
>+ * the eswitch mode.
>+ */
>+ if (ops->eswitch_state_set) {
>+ err = ops->eswitch_state_set(devlink, state, info->extack);
Calling state_set() upon every DEVLINK_CMD_ESWITCH_SET call,
even if STATE attr is not present, is plain wrong. Don't do it.
I don't really understand why you do so.
>+ if (err)
>+ return err;
>+ }
>+
> if (info->attrs[DEVLINK_ATTR_ESWITCH_INLINE_MODE]) {
> if (!ops->eswitch_inline_mode_set)
> return -EOPNOTSUPP;
[...]
Powered by blists - more mailing lists