From: Ido Schimmel <idosch@nvidia.com>
To: Guillaume Nault <gnault@redhat.com>
Cc: David Miller <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@google.com>,
netdev@vger.kernel.org, Simon Horman <horms@kernel.org>,
Taehee Yoo <ap420073@gmail.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
Saeed Mahameed <saeedm@nvidia.com>,
Leon Romanovsky <leon@kernel.org>,
Tariq Toukan <tariqt@nvidia.com>, Mark Bloch <mbloch@nvidia.com>,
Edward Cree <ecree.xilinx@gmail.com>,
Pablo Neira Ayuso <pablo@netfilter.org>,
Harald Welte <laforge@gnumonks.org>,
David Ahern <dsahern@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Martin KaFai Lau <martin.lau@linux.dev>,
Daniel Borkmann <daniel@iogearbox.net>,
John Fastabend <john.fastabend@gmail.com>,
Stanislav Fomichev <sdf@fomichev.me>,
Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
KP Singh <kpsingh@kernel.org>, Hao Luo <haoluo@google.com>,
Jiri Olsa <jolsa@kernel.org>,
Jozsef Kadlecsik <kadlec@netfilter.org>,
Florian Westphal <fw@strlen.de>,
Steffen Klassert <steffen.klassert@secunet.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>,
Xin Long <lucien.xin@gmail.com>
Subject: Re: [PATCH v2 net-next] ipv4: Convert ->flowi4_tos to dscp_t.
Date: Tue, 26 Aug 2025 08:56:46 +0300 [thread overview]
Message-ID: <aK1MnoX4eNw4Ql-1@shredder> (raw)
In-Reply-To: <29acecb45e911d17446b9a3dbdb1ab7b821ea371.1756128932.git.gnault@redhat.com>
On Mon, Aug 25, 2025 at 03:37:43PM +0200, Guillaume Nault wrote:
> Convert the ->flowic_tos field of struct flowi_common from __u8 to
> dscp_t, rename it ->flowic_dscp and propagate these changes to struct
> flowi and struct flowi4.
>
> We've had several bugs in the past where ECN bits could interfere with
> IPv4 routing, because these bits were not properly cleared when setting
> ->flowi4_tos. These bugs should be fixed now and the dscp_t type has
> been introduced to ensure that variables carrying DSCP values don't
> accidentally have any ECN bits set. Several variables and structure
> fields have been converted to dscp_t already, but the main IPv4 routing
> structure, struct flowi4, is still using a __u8. To avoid any future
> regression, this patch converts it to dscp_t.
>
> There are many users to convert at once. Fortunately, around half of
> ->flowi4_tos users already have a dscp_t value at hand, which they
> currently convert to __u8 using inet_dscp_to_dsfield(). For all of
> these users, we just need to drop that conversion.
>
> But, although we try to do the __u8 <-> dscp_t conversions at the
> boundaries of the network or of user space, some places still store
> TOS/DSCP variables as __u8 in core networking code. Those can hardly be
> converted either because the data structure is part of UAPI or because
> the same variable or field is also used for handling ECN in other parts
> of the code. In all of these cases where we don't have a dscp_t
> variable at hand, we need to use inet_dsfield_to_dscp() when
> interacting with ->flowi4_dscp.
>
> Changes since v1:
> * Fix space alignment in __bpf_redirect_neigh_v4() (Ido).
>
> Signed-off-by: Guillaume Nault <gnault@redhat.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
next prev parent reply other threads:[~2025-08-26 5:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-25 13:37 [PATCH v2 net-next] ipv4: Convert ->flowi4_tos to dscp_t Guillaume Nault
2025-08-26 5:56 ` Ido Schimmel [this message]
2025-08-27 1:00 ` patchwork-bot+netdevbpf
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=aK1MnoX4eNw4Ql-1@shredder \
--to=idosch@nvidia.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrii@kernel.org \
--cc=ap420073@gmail.com \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=ecree.xilinx@gmail.com \
--cc=eddyz87@gmail.com \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=gnault@redhat.com \
--cc=haoluo@google.com \
--cc=herbert@gondor.apana.org.au \
--cc=horms@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kadlec@netfilter.org \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=laforge@gnumonks.org \
--cc=leon@kernel.org \
--cc=lucien.xin@gmail.com \
--cc=marcelo.leitner@gmail.com \
--cc=martin.lau@linux.dev \
--cc=mathieu.desnoyers@efficios.com \
--cc=mbloch@nvidia.com \
--cc=mhiramat@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
--cc=rostedt@goodmis.org \
--cc=saeedm@nvidia.com \
--cc=sdf@fomichev.me \
--cc=song@kernel.org \
--cc=steffen.klassert@secunet.com \
--cc=tariqt@nvidia.com \
--cc=yonghong.song@linux.dev \
/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