From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: "Asbjørn Sloth Tønnesen" <ast@fiberby.net>
Cc: <netdev@vger.kernel.org>, Davide Caratti <dcaratti@redhat.com>,
"Ilya Maximets" <i.maximets@ovn.org>,
Jamal Hadi Salim <jhs@mojatatu.com>,
Cong Wang <xiyou.wangcong@gmail.com>,
Jiri Pirko <jiri@resnulli.us>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
David Ahern <dsahern@kernel.org>, Simon Horman <horms@kernel.org>,
Ratheesh Kannoth <rkannoth@marvell.com>,
Florian Westphal <fw@strlen.de>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next 1/9] net/sched: flower: define new tunnel flags
Date: Wed, 3 Jul 2024 12:59:54 +0200 [thread overview]
Message-ID: <b501f628-695a-488e-8581-fa28f4c20923@intel.com> (raw)
In-Reply-To: <20240703104600.455125-2-ast@fiberby.net>
From: Asbjørn Sloth Tønnesen <ast@fiberby.net>
Date: Wed, 3 Jul 2024 10:45:50 +0000
> Define new TCA_FLOWER_KEY_FLAGS_* flags for use in struct
> flow_dissector_key_control, covering the same flags
> as currently exposed through TCA_FLOWER_KEY_ENC_FLAGS,
> but assign them new bit positions in so that they don't
> conflict with existing TCA_FLOWER_KEY_FLAGS_* flags.
>
> Synchronize FLOW_DIS_* flags, but put the new flags
> under FLOW_DIS_F_*. The idea is that we can later, move
> the existing flags under FLOW_DIS_F_* as well.
>
> Signed-off-by: Asbjørn Sloth Tønnesen <ast@fiberby.net>
> ---
> include/net/flow_dissector.h | 17 +++++++++++++----
> include/uapi/linux/pkt_cls.h | 5 +++++
> 2 files changed, 18 insertions(+), 4 deletions(-)
>
> diff --git a/include/net/flow_dissector.h b/include/net/flow_dissector.h
> index 3e47e123934d..f560e2c8d0e7 100644
> --- a/include/net/flow_dissector.h
> +++ b/include/net/flow_dissector.h
> @@ -16,7 +16,8 @@ struct sk_buff;
> * struct flow_dissector_key_control:
> * @thoff: Transport header offset
> * @addr_type: Type of key. One of FLOW_DISSECTOR_KEY_*
> - * @flags: Key flags. Any of FLOW_DIS_(IS_FRAGMENT|FIRST_FRAGENCAPSULATION)
> + * @flags: Key flags.
> + * Any of FLOW_DIS_(IS_FRAGMENT|FIRST_FRAG|ENCAPSULATION|F_*)
> */
> struct flow_dissector_key_control {
> u16 thoff;
> @@ -24,9 +25,17 @@ struct flow_dissector_key_control {
> u32 flags;
> };
>
> -#define FLOW_DIS_IS_FRAGMENT BIT(0)
> -#define FLOW_DIS_FIRST_FRAG BIT(1)
> -#define FLOW_DIS_ENCAPSULATION BIT(2)
> +/* Please keep these flags in sync with TCA_FLOWER_KEY_FLAGS_*
> + * in include/uapi/linux/pkt_cls.h, as these bit flags are exposed
> + * to userspace in some error paths, ie. unsupported flags.
> + */
> +#define FLOW_DIS_IS_FRAGMENT BIT(0)
> +#define FLOW_DIS_FIRST_FRAG BIT(1)
> +#define FLOW_DIS_ENCAPSULATION BIT(2)
> +#define FLOW_DIS_F_TUNNEL_CSUM BIT(3)
> +#define FLOW_DIS_F_TUNNEL_DONT_FRAGMENT BIT(4)
> +#define FLOW_DIS_F_TUNNEL_OAM BIT(5)
> +#define FLOW_DIS_F_TUNNEL_CRIT_OPT BIT(6)
1. enum? Then they will be included in BTF info, maybe they might come
handy later in BPF...
2. Maybe "sync" them automatically?
FLOW_DIS_FIRST_FRAG = TCA_FLOWER_KEY_FLAGS_FRAG_IS_FIRST,
...
(with the only exception for BIT(2))
>
> enum flow_dissect_ret {
> FLOW_DISSECT_RET_OUT_GOOD,
> diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
> index b6d38f5fd7c0..24795aad7651 100644
> --- a/include/uapi/linux/pkt_cls.h
> +++ b/include/uapi/linux/pkt_cls.h
> @@ -677,6 +677,11 @@ enum {
> enum {
> TCA_FLOWER_KEY_FLAGS_IS_FRAGMENT = (1 << 0),
> TCA_FLOWER_KEY_FLAGS_FRAG_IS_FIRST = (1 << 1),
> + /* FLOW_DIS_ENCAPSULATION (1 << 2) is not exposed to userspace */
Should uAPI header contain this comment? FLOW_DIS_ENCAPSULATION is an
internal kernel definition, so I believe its name shouldn't leak to the
userspace header.
> + TCA_FLOWER_KEY_FLAGS_TUNNEL_CSUM = (1 << 3),
> + TCA_FLOWER_KEY_FLAGS_TUNNEL_DONT_FRAGMENT = (1 << 4),
> + TCA_FLOWER_KEY_FLAGS_TUNNEL_OAM = (1 << 5),
> + TCA_FLOWER_KEY_FLAGS_TUNNEL_CRIT_OPT = (1 << 6),
> };
>
> enum {
Thanks,
Olek
next prev parent reply other threads:[~2024-07-03 11:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-03 10:45 [PATCH net-next 0/9] flower: rework TCA_FLOWER_KEY_ENC_FLAGS usage Asbjørn Sloth Tønnesen
2024-07-03 10:45 ` [PATCH net-next 1/9] net/sched: flower: define new tunnel flags Asbjørn Sloth Tønnesen
2024-07-03 10:59 ` Alexander Lobakin [this message]
2024-07-04 0:20 ` Jakub Kicinski
2024-07-04 21:45 ` Asbjørn Sloth Tønnesen
2024-07-05 2:05 ` Jakub Kicinski
2024-07-03 10:45 ` [PATCH net-next 2/9] net/sched: cls_flower: prepare fl_{set,dump}_key_flags() for ENC_FLAGS Asbjørn Sloth Tønnesen
2024-07-03 10:45 ` [PATCH net-next 3/9] net/sched: cls_flower: add policy for TCA_FLOWER_KEY_FLAGS Asbjørn Sloth Tønnesen
2024-07-03 10:45 ` [PATCH net-next 4/9] flow_dissector: prepare for encapsulated control flags Asbjørn Sloth Tønnesen
2024-07-03 10:45 ` [PATCH net-next 5/9] flow_dissector: set encapsulated control flags from tun_flags Asbjørn Sloth Tønnesen
2024-07-03 10:45 ` [PATCH net-next 6/9] net/sched: cls_flower: add tunnel flags to fl_{set,dump}_key_flags() Asbjørn Sloth Tønnesen
2024-07-03 10:45 ` [PATCH net-next 7/9] net/sched: cls_flower: rework TCA_FLOWER_KEY_ENC_FLAGS usage Asbjørn Sloth Tønnesen
2024-07-03 10:45 ` [PATCH net-next 8/9] flow_dissector: cleanup FLOW_DISSECTOR_KEY_ENC_FLAGS Asbjørn Sloth Tønnesen
2024-07-03 10:45 ` [PATCH net-next 9/9] flow_dissector: set encapsulation control flags for non-IP Asbjørn Sloth Tønnesen
2024-07-03 16:19 ` [PATCH net-next 0/9] flower: rework TCA_FLOWER_KEY_ENC_FLAGS usage Davide Caratti
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=b501f628-695a-488e-8581-fa28f4c20923@intel.com \
--to=aleksander.lobakin@intel.com \
--cc=ast@fiberby.net \
--cc=davem@davemloft.net \
--cc=dcaratti@redhat.com \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=horms@kernel.org \
--cc=i.maximets@ovn.org \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rkannoth@marvell.com \
--cc=xiyou.wangcong@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®