public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Gang Li <gang.li@linux.dev>
To: mkubecek@suse.cz
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	kuba@kernel.org, Gang Li <gang.li@linux.dev>
Subject: [PATCH RESEND ethtool] netlink: Allow nl_sset return -EOPNOTSUPP to fallback to do_sset
Date: Mon, 21 Aug 2023 11:34:19 +0800	[thread overview]
Message-ID: <20230821033419.59095-1-gang.li@linux.dev> (raw)

Currently, nl_sset treats any negative value returned by nl_parser
(including -EOPNOTSUPP) as `1`. Consequently, netlink_run_handler
directly calls exit without returning to main and invoking do_sset
through ioctl_init.

To fallback to do_sset, this commit allows nl_sset return -EOPNOTSUPP.

Fixes: 392b12e ("netlink: add netlink handler for sset (-s)")
Signed-off-by: Gang Li <gang.li@linux.dev>
---
 netlink/settings.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/netlink/settings.c b/netlink/settings.c
index dda4ac9..2af933d 100644
--- a/netlink/settings.c
+++ b/netlink/settings.c
@@ -1244,6 +1244,9 @@ int nl_sset(struct cmd_context *ctx)
 	nlctx->devname = ctx->devname;
 
 	ret = nl_parser(nlctx, sset_params, NULL, PARSER_GROUP_MSG, msgbuffs);
+	if (ret == -EOPNOTSUPP)
+		return ret;
+
 	if (ret < 0) {
 		ret = 1;
 		goto out_free;
-- 
2.20.1


             reply	other threads:[~2023-08-21  3:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-21  3:34 Gang Li [this message]
2023-08-27 23:23 ` [PATCH RESEND ethtool] netlink: Allow nl_sset return -EOPNOTSUPP to fallback to do_sset Michal Kubecek

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=20230821033419.59095-1-gang.li@linux.dev \
    --to=gang.li@linux.dev \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkubecek@suse.cz \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox