* [PATCH net-next 1/4] ipv4: Prepare fib_compute_spec_dst() to future .flowi4_tos conversion.
2024-10-22 9:47 [PATCH net-next 0/4] ipv4: Prepare core ipv4 files to future .flowi4_tos conversion Guillaume Nault
@ 2024-10-22 9:48 ` Guillaume Nault
2024-10-22 12:35 ` Ido Schimmel
2024-10-22 9:48 ` [PATCH net-next 2/4] ipv4: Prepare icmp_reply() " Guillaume Nault
` (3 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Guillaume Nault @ 2024-10-22 9:48 UTC (permalink / raw)
To: David Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
Cc: netdev, David Ahern, Ido Schimmel
Use ip4h_dscp() to get the DSCP from the IPv4 header, then convert the
dscp_t value to __u8 with inet_dscp_to_dsfield().
Then, when we'll convert .flowi4_tos to dscp_t, we'll just have to drop
the inet_dscp_to_dsfield() call.
Signed-off-by: Guillaume Nault <gnault@redhat.com>
---
net/ipv4/fib_frontend.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 53bd26315df5..0c9ce934b490 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -293,7 +293,7 @@ __be32 fib_compute_spec_dst(struct sk_buff *skb)
.flowi4_iif = LOOPBACK_IFINDEX,
.flowi4_l3mdev = l3mdev_master_ifindex_rcu(dev),
.daddr = ip_hdr(skb)->saddr,
- .flowi4_tos = ip_hdr(skb)->tos & INET_DSCP_MASK,
+ .flowi4_tos = inet_dscp_to_dsfield(ip4h_dscp(ip_hdr(skb))),
.flowi4_scope = scope,
.flowi4_mark = vmark ? skb->mark : 0,
};
--
2.39.2
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH net-next 1/4] ipv4: Prepare fib_compute_spec_dst() to future .flowi4_tos conversion.
2024-10-22 9:48 ` [PATCH net-next 1/4] ipv4: Prepare fib_compute_spec_dst() " Guillaume Nault
@ 2024-10-22 12:35 ` Ido Schimmel
0 siblings, 0 replies; 10+ messages in thread
From: Ido Schimmel @ 2024-10-22 12:35 UTC (permalink / raw)
To: Guillaume Nault
Cc: David Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet, netdev,
David Ahern
On Tue, Oct 22, 2024 at 11:48:00AM +0200, Guillaume Nault wrote:
> Use ip4h_dscp() to get the DSCP from the IPv4 header, then convert the
> dscp_t value to __u8 with inet_dscp_to_dsfield().
>
> Then, when we'll convert .flowi4_tos to dscp_t, we'll just have to drop
> the inet_dscp_to_dsfield() call.
>
> Signed-off-by: Guillaume Nault <gnault@redhat.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH net-next 2/4] ipv4: Prepare icmp_reply() to future .flowi4_tos conversion.
2024-10-22 9:47 [PATCH net-next 0/4] ipv4: Prepare core ipv4 files to future .flowi4_tos conversion Guillaume Nault
2024-10-22 9:48 ` [PATCH net-next 1/4] ipv4: Prepare fib_compute_spec_dst() " Guillaume Nault
@ 2024-10-22 9:48 ` Guillaume Nault
2024-10-22 12:36 ` Ido Schimmel
2024-10-22 9:48 ` [PATCH net-next 3/4] ipv4: Prepare ipmr_rt_fib_lookup() " Guillaume Nault
` (2 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Guillaume Nault @ 2024-10-22 9:48 UTC (permalink / raw)
To: David Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
Cc: netdev, David Ahern, Ido Schimmel
Use ip4h_dscp() to get the DSCP from the IPv4 header, then convert the
dscp_t value to __u8 with inet_dscp_to_dsfield().
Then, when we'll convert .flowi4_tos to dscp_t, we'll just have to drop
the inet_dscp_to_dsfield() call.
Signed-off-by: Guillaume Nault <gnault@redhat.com>
---
net/ipv4/icmp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 23664434922e..33eec844a5a0 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -445,7 +445,7 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb)
fl4.saddr = saddr;
fl4.flowi4_mark = mark;
fl4.flowi4_uid = sock_net_uid(net, NULL);
- fl4.flowi4_tos = ip_hdr(skb)->tos & INET_DSCP_MASK;
+ fl4.flowi4_tos = inet_dscp_to_dsfield(ip4h_dscp(ip_hdr(skb)));
fl4.flowi4_proto = IPPROTO_ICMP;
fl4.flowi4_oif = l3mdev_master_ifindex(skb->dev);
security_skb_classify_flow(skb, flowi4_to_flowi_common(&fl4));
--
2.39.2
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH net-next 2/4] ipv4: Prepare icmp_reply() to future .flowi4_tos conversion.
2024-10-22 9:48 ` [PATCH net-next 2/4] ipv4: Prepare icmp_reply() " Guillaume Nault
@ 2024-10-22 12:36 ` Ido Schimmel
0 siblings, 0 replies; 10+ messages in thread
From: Ido Schimmel @ 2024-10-22 12:36 UTC (permalink / raw)
To: Guillaume Nault
Cc: David Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet, netdev,
David Ahern
On Tue, Oct 22, 2024 at 11:48:08AM +0200, Guillaume Nault wrote:
> Use ip4h_dscp() to get the DSCP from the IPv4 header, then convert the
> dscp_t value to __u8 with inet_dscp_to_dsfield().
>
> Then, when we'll convert .flowi4_tos to dscp_t, we'll just have to drop
> the inet_dscp_to_dsfield() call.
>
> Signed-off-by: Guillaume Nault <gnault@redhat.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH net-next 3/4] ipv4: Prepare ipmr_rt_fib_lookup() to future .flowi4_tos conversion.
2024-10-22 9:47 [PATCH net-next 0/4] ipv4: Prepare core ipv4 files to future .flowi4_tos conversion Guillaume Nault
2024-10-22 9:48 ` [PATCH net-next 1/4] ipv4: Prepare fib_compute_spec_dst() " Guillaume Nault
2024-10-22 9:48 ` [PATCH net-next 2/4] ipv4: Prepare icmp_reply() " Guillaume Nault
@ 2024-10-22 9:48 ` Guillaume Nault
2024-10-22 12:37 ` Ido Schimmel
2024-10-22 9:48 ` [PATCH net-next 4/4] ipv4: Prepare ip_rt_get_source() " Guillaume Nault
2024-10-29 18:50 ` [PATCH net-next 0/4] ipv4: Prepare core ipv4 files " patchwork-bot+netdevbpf
4 siblings, 1 reply; 10+ messages in thread
From: Guillaume Nault @ 2024-10-22 9:48 UTC (permalink / raw)
To: David Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
Cc: netdev, David Ahern, Ido Schimmel
Use ip4h_dscp() to get the DSCP from the IPv4 header, then convert the
dscp_t value to __u8 with inet_dscp_to_dsfield().
Then, when we'll convert .flowi4_tos to dscp_t, we'll just have to drop
the inet_dscp_to_dsfield() call.
Signed-off-by: Guillaume Nault <gnault@redhat.com>
---
net/ipv4/ipmr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index b4fc443481ce..99e7cd0531d9 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -2081,7 +2081,7 @@ static struct mr_table *ipmr_rt_fib_lookup(struct net *net, struct sk_buff *skb)
struct flowi4 fl4 = {
.daddr = iph->daddr,
.saddr = iph->saddr,
- .flowi4_tos = iph->tos & INET_DSCP_MASK,
+ .flowi4_tos = inet_dscp_to_dsfield(ip4h_dscp(iph)),
.flowi4_oif = (rt_is_output_route(rt) ?
skb->dev->ifindex : 0),
.flowi4_iif = (rt_is_output_route(rt) ?
--
2.39.2
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH net-next 3/4] ipv4: Prepare ipmr_rt_fib_lookup() to future .flowi4_tos conversion.
2024-10-22 9:48 ` [PATCH net-next 3/4] ipv4: Prepare ipmr_rt_fib_lookup() " Guillaume Nault
@ 2024-10-22 12:37 ` Ido Schimmel
0 siblings, 0 replies; 10+ messages in thread
From: Ido Schimmel @ 2024-10-22 12:37 UTC (permalink / raw)
To: Guillaume Nault
Cc: David Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet, netdev,
David Ahern
On Tue, Oct 22, 2024 at 11:48:15AM +0200, Guillaume Nault wrote:
> Use ip4h_dscp() to get the DSCP from the IPv4 header, then convert the
> dscp_t value to __u8 with inet_dscp_to_dsfield().
>
> Then, when we'll convert .flowi4_tos to dscp_t, we'll just have to drop
> the inet_dscp_to_dsfield() call.
>
> Signed-off-by: Guillaume Nault <gnault@redhat.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH net-next 4/4] ipv4: Prepare ip_rt_get_source() to future .flowi4_tos conversion.
2024-10-22 9:47 [PATCH net-next 0/4] ipv4: Prepare core ipv4 files to future .flowi4_tos conversion Guillaume Nault
` (2 preceding siblings ...)
2024-10-22 9:48 ` [PATCH net-next 3/4] ipv4: Prepare ipmr_rt_fib_lookup() " Guillaume Nault
@ 2024-10-22 9:48 ` Guillaume Nault
2024-10-22 12:37 ` Ido Schimmel
2024-10-29 18:50 ` [PATCH net-next 0/4] ipv4: Prepare core ipv4 files " patchwork-bot+netdevbpf
4 siblings, 1 reply; 10+ messages in thread
From: Guillaume Nault @ 2024-10-22 9:48 UTC (permalink / raw)
To: David Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet
Cc: netdev, David Ahern, Ido Schimmel
Use ip4h_dscp() to get the DSCP from the IPv4 header, then convert the
dscp_t value to __u8 with inet_dscp_to_dsfield().
Then, when we'll convert .flowi4_tos to dscp_t, we'll just have to drop
the inet_dscp_to_dsfield() call.
Signed-off-by: Guillaume Nault <gnault@redhat.com>
---
net/ipv4/route.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 18a08b4f4a5a..763398e08b7d 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1263,7 +1263,7 @@ void ip_rt_get_source(u8 *addr, struct sk_buff *skb, struct rtable *rt)
struct flowi4 fl4 = {
.daddr = iph->daddr,
.saddr = iph->saddr,
- .flowi4_tos = iph->tos & INET_DSCP_MASK,
+ .flowi4_tos = inet_dscp_to_dsfield(ip4h_dscp(iph)),
.flowi4_oif = rt->dst.dev->ifindex,
.flowi4_iif = skb->dev->ifindex,
.flowi4_mark = skb->mark,
--
2.39.2
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [PATCH net-next 4/4] ipv4: Prepare ip_rt_get_source() to future .flowi4_tos conversion.
2024-10-22 9:48 ` [PATCH net-next 4/4] ipv4: Prepare ip_rt_get_source() " Guillaume Nault
@ 2024-10-22 12:37 ` Ido Schimmel
0 siblings, 0 replies; 10+ messages in thread
From: Ido Schimmel @ 2024-10-22 12:37 UTC (permalink / raw)
To: Guillaume Nault
Cc: David Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet, netdev,
David Ahern
On Tue, Oct 22, 2024 at 11:48:23AM +0200, Guillaume Nault wrote:
> Use ip4h_dscp() to get the DSCP from the IPv4 header, then convert the
> dscp_t value to __u8 with inet_dscp_to_dsfield().
>
> Then, when we'll convert .flowi4_tos to dscp_t, we'll just have to drop
> the inet_dscp_to_dsfield() call.
>
> Signed-off-by: Guillaume Nault <gnault@redhat.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net-next 0/4] ipv4: Prepare core ipv4 files to future .flowi4_tos conversion.
2024-10-22 9:47 [PATCH net-next 0/4] ipv4: Prepare core ipv4 files to future .flowi4_tos conversion Guillaume Nault
` (3 preceding siblings ...)
2024-10-22 9:48 ` [PATCH net-next 4/4] ipv4: Prepare ip_rt_get_source() " Guillaume Nault
@ 2024-10-29 18:50 ` patchwork-bot+netdevbpf
4 siblings, 0 replies; 10+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-10-29 18:50 UTC (permalink / raw)
To: Guillaume Nault; +Cc: davem, kuba, pabeni, edumazet, netdev, dsahern, idosch
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 22 Oct 2024 11:47:52 +0200 you wrote:
> Continue preparing users of ->flowi4_tos (struct flowi4) to the future
> conversion of this field (from __u8 to dscp_t). The objective is to
> have type annotation to properly separate DSCP bits from ECN ones. This
> way we'll ensure that ECN doesn't interfere with DSCP and avoid
> regressions where it break routing descisions (fib rules in particular).
>
> This series concentrates on some easy IPv4 conversions where
> ->flowi4_tos is set directly from an IPv4 header, so we can get the
> DSCP value using the ip4h_dscp() helper function.
>
> [...]
Here is the summary with links:
- [net-next,1/4] ipv4: Prepare fib_compute_spec_dst() to future .flowi4_tos conversion.
https://git.kernel.org/netdev/net-next/c/b76ebf22c578
- [net-next,2/4] ipv4: Prepare icmp_reply() to future .flowi4_tos conversion.
https://git.kernel.org/netdev/net-next/c/0ed373390c5c
- [net-next,3/4] ipv4: Prepare ipmr_rt_fib_lookup() to future .flowi4_tos conversion.
https://git.kernel.org/netdev/net-next/c/6ab04392dd08
- [net-next,4/4] ipv4: Prepare ip_rt_get_source() to future .flowi4_tos conversion.
https://git.kernel.org/netdev/net-next/c/85ef52e8693c
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 10+ messages in thread