From: William Tu <witu@nvidia.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: netdev@vger.kernel.org, jiri@nvidia.com, bodong@nvidia.com,
tariqt@nvidia.com, yossiku@nvidia.com, kuba@kernel.org
Subject: Re: [PATCH RFC v2 iproute2-next] devlink: Add eswitch attr option for shared descriptors
Date: Fri, 1 Mar 2024 17:29:14 -0800 [thread overview]
Message-ID: <a70812b5-63d4-461c-8458-b31e1ad25910@nvidia.com> (raw)
In-Reply-To: <20240229193933.38e0bf32@hermes.local>
On 2/29/24 7:39 PM, Stephen Hemminger wrote:
> External email: Use caution opening links or attachments
>
>
> On Fri, 1 Mar 2024 04:02:14 +0200
> William Tu <witu@nvidia.com> wrote:
>
>> + } else if ((dl_argv_match(dl, "shrdesc-mode")) &&
> So devlink has its own match problem.
>
> We stopped allowing new match arguments because they create
> ordering conflicts. For example in your new code if "shrdesc" is
> passed it matches the mode field.
Hi Stephen,
Thanks! in this case how do I introduce new argments?
Should I introduce dl_argv_exact_match like below, or should I handle it
specifically in "cmd_dev_eswitch_set(struct dl *dl)".
Thanks
William
diff --git a/devlink/devlink.c b/devlink/devlink.c
index affc29eb7cad..1521c2c24acf 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -466,6 +466,14 @@ static bool dl_argv_match(struct dl *dl, const char
*pattern)
return strcmpx(dl_argv(dl), pattern) == 0;
}
+static bool dl_argv_exact_match(struct dl *dl, const char *pattern)
+{
+ if (dl_argc(dl) == 0 || strlen(dl_argv(dl)) != strlen(pattern))
+ return false;
+
+ return strcmpx(dl_argv(dl), pattern) == 0;
+}
+
static bool dl_no_arg(struct dl *dl)
{
return dl_argc(dl) == 0;
@@ -1921,7 +1929,7 @@ static int dl_argv_parse(struct dl *dl, uint64_t
o_required,
if (err)
return err;
o_found |= DL_OPT_ESWITCH_ENCAP_MODE;
- } else if ((dl_argv_match(dl, "shrdesc-mode")) &&
+ } else if ((dl_argv_exact_match(dl, "shrdesc-mode")) &&
(o_all & DL_OPT_ESWITCH_SHRDESC_MODE)) {
const char *typestr;
@@ -1934,7 +1942,7 @@ static int dl_argv_parse(struct dl *dl, uint64_t
o_required,
if (err)
return err;
o_found |= DL_OPT_ESWITCH_SHRDESC_MODE;
- } else if (dl_argv_match(dl, "shrdesc-count") &&
+ } else if (dl_argv_exact_match(dl, "shrdesc-count") &&
(o_all & DL_OPT_ESWITCH_SHRDESC_COUNT)) {
dl_arg_inc(dl);
err = dl_argv_uint32_t(dl,
&opts->eswitch_shrdesc_count);
prev parent reply other threads:[~2024-03-02 1:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-01 2:02 [PATCH RFC v2 iproute2-next] devlink: Add eswitch attr option for shared descriptors William Tu
2024-03-01 3:39 ` Stephen Hemminger
2024-03-02 1:29 ` William Tu [this message]
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=a70812b5-63d4-461c-8458-b31e1ad25910@nvidia.com \
--to=witu@nvidia.com \
--cc=bodong@nvidia.com \
--cc=jiri@nvidia.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
--cc=tariqt@nvidia.com \
--cc=yossiku@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.