From: Ido Schimmel <idosch@idosch.org>
To: Alce Lafranque <alce@lafranque.net>
Cc: netdev@vger.kernel.org, stephen@networkplumber.org,
Vincent Bernat <vincent@bernat.ch>,
dsahern@gmail.com
Subject: Re: [PATCH iproute2] vxlan: add support for flowlab inherit
Date: Mon, 22 Jan 2024 14:24:43 +0200 [thread overview]
Message-ID: <Za5eizfgzl5mwt50@shredder> (raw)
In-Reply-To: <20240120124418.26117-1-alce@lafranque.net>
s/flowlab/flowlabel/ in subject
My understanding is that new features should be targeted at
iproute2-next. See the README.
On Sat, Jan 20, 2024 at 06:44:18AM -0600, Alce Lafranque wrote:
> @@ -214,10 +214,16 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
> NEXT_ARG();
> check_duparg(&attrs, IFLA_VXLAN_LABEL, "flowlabel",
> *argv);
> - if (get_u32(&uval, *argv, 0) ||
> - (uval & ~LABEL_MAX_MASK))
> - invarg("invalid flowlabel", *argv);
> - addattr32(n, 1024, IFLA_VXLAN_LABEL, htonl(uval));
> + if (strcmp(*argv, "inherit") == 0) {
> + addattr32(n, 1024, IFLA_VXLAN_LABEL_POLICY, VXLAN_LABEL_INHERIT);
> + } else {
> + if (get_u32(&uval, *argv, 0) ||
> + (uval & ~LABEL_MAX_MASK))
> + invarg("invalid flowlabel", *argv);
> + addattr32(n, 1024, IFLA_VXLAN_LABEL_POLICY, VXLAN_LABEL_FIXED);
I think I mentioned this during the review of the kernel patch, but the
current approach relies on old kernels ignoring the
'IFLA_VXLAN_LABEL_POLICY' attribute which is not nice. My personal
preference would be to add a new keyword for the new attribute:
# ip link set dev vx0 type vxlan flowlabel_policy inherit
# ip link set dev vx0 type vxlan flowlabel_policy fixed flowlabel 10
But let's see what David thinks.
> + addattr32(n, 1024, IFLA_VXLAN_LABEL,
> + htonl(uval));
> + }
> } else if (!matches(*argv, "ageing")) {
> __u32 age;
>
> @@ -580,12 +586,25 @@ static void vxlan_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
> print_string(PRINT_ANY, "df", "df %s ", "inherit");
> }
>
> - if (tb[IFLA_VXLAN_LABEL]) {
> - __u32 label = rta_getattr_u32(tb[IFLA_VXLAN_LABEL]);
> -
> - if (label)
> - print_0xhex(PRINT_ANY, "label",
> - "flowlabel %#llx ", ntohl(label));
> + enum ifla_vxlan_label_policy policy = VXLAN_LABEL_FIXED;
> + if (tb[IFLA_VXLAN_LABEL_POLICY]) {
> + policy = rta_getattr_u32(tb[IFLA_VXLAN_LABEL_POLICY]);
> + }
Checkpatch says:
WARNING: Missing a blank line after declarations
#112: FILE: ip/iplink_vxlan.c:590:
+ enum ifla_vxlan_label_policy policy = VXLAN_LABEL_FIXED;
+ if (tb[IFLA_VXLAN_LABEL_POLICY]) {
WARNING: braces {} are not necessary for single statement blocks
#112: FILE: ip/iplink_vxlan.c:590:
+ if (tb[IFLA_VXLAN_LABEL_POLICY]) {
+ policy = rta_getattr_u32(tb[IFLA_VXLAN_LABEL_POLICY]);
+ }
> + switch (policy) {
> + case VXLAN_LABEL_FIXED:
> + if (tb[IFLA_VXLAN_LABEL]) {
> + __u32 label = rta_getattr_u32(tb[IFLA_VXLAN_LABEL]);
> +
> + if (label)
> + print_0xhex(PRINT_ANY, "label",
> + "flowlabel %#llx ", ntohl(label));
> + }
> + break;
> + case VXLAN_LABEL_INHERIT:
> + print_string(PRINT_FP, NULL, "flowlabel %s ", "inherit");
> + break;
> + default:
> + break;
> }
>
> if (tb[IFLA_VXLAN_AGEING]) {
> --
> 2.39.2
>
>
next prev parent reply other threads:[~2024-01-22 12:24 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-20 12:44 [PATCH iproute2] vxlan: add support for flowlab inherit Alce Lafranque
2024-01-22 12:24 ` Ido Schimmel [this message]
2024-01-22 21:11 ` Vincent Bernat
2024-01-23 0:10 ` Stephen Hemminger
2024-01-23 0:29 ` David Ahern
2024-01-23 0:41 ` David Ahern
2024-01-23 7:58 ` Vincent Bernat
2024-01-23 16:19 ` David Ahern
2024-01-24 22:00 ` Vincent Bernat
2024-01-25 15:50 ` David Ahern
2024-01-26 6:28 ` Vincent Bernat
2024-01-26 17:17 ` David Ahern
2024-01-28 12:35 ` Ido Schimmel
2024-01-28 14:28 ` Vincent Bernat
2024-01-29 18:44 ` David Ahern
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=Za5eizfgzl5mwt50@shredder \
--to=idosch@idosch.org \
--cc=alce@lafranque.net \
--cc=dsahern@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
--cc=vincent@bernat.ch \
/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.