ipv4: Prepare core ipv4 files to future .flowi4_tos conversion.
Subsystems (3)
cover ipv4: Prepare core ipv4 files to future .flowi4_tos conversion.
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.
Guillaume Nault (4):
ipv4: Prepare fib_compute_spec_dst() to future .flowi4_tos conversion.
ipv4: Prepare icmp_reply() to future .flowi4_tos conversion.
ipv4: Prepare ipmr_rt_fib_lookup() to future .flowi4_tos conversion.
ipv4: Prepare ip_rt_get_source() to future .flowi4_tos conversion.
net/ipv4/fib_frontend.c | 2 +- net/ipv4/icmp.c | 2 +- net/ipv4/ipmr.c | 2 +- net/ipv4/route.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
Signature · 1 line
2.39.2
PATCH 1/4 ipv4: Prepare fib_compute_spec_dst() to future .flowi4_tos conversion.
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.
--- net/ipv4/fib_frontend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/fib_frontend.c +1 -1
@@ -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, };
Signature · 1 line
2.39.2
Re: [PATCH net-next 1/4] ipv4: Prepare fib_compute_spec_dst() to future .flowi4_tos conversion.
Quoted 7 lines · Guillaume Nault
Use
ip4h_dscp()to get the DSCP from the IPv4 header, then convert thedscp_tvalue to__u8withinet_dscp_to_dsfield().Then, when we'll convert .flowi4_tos to
dscp_t, we'll just have to drop theinet_dscp_to_dsfield()call.Signed-off-by Guillaume Nault <[email protected]>
PATCH 2/4 ipv4: Prepare icmp_reply() to future .flowi4_tos conversion.
In reply to Guillaume NaultUse 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.
--- net/ipv4/icmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/icmp.c +1 -1
@@ -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));
Signature · 1 line
2.39.2
Re: [PATCH net-next 2/4] ipv4: Prepare icmp_reply() to future .flowi4_tos conversion.
Quoted 7 lines · Guillaume Nault
Use
ip4h_dscp()to get the DSCP from the IPv4 header, then convert thedscp_tvalue to__u8withinet_dscp_to_dsfield().Then, when we'll convert .flowi4_tos to
dscp_t, we'll just have to drop theinet_dscp_to_dsfield()call.Signed-off-by Guillaume Nault <[email protected]>
PATCH 3/4 ipv4: Prepare ipmr_rt_fib_lookup() to future .flowi4_tos conversion.
In reply to Guillaume NaultUse 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.
--- net/ipv4/ipmr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/ipmr.c +1 -1
@@ -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) ?
Signature · 1 line
2.39.2
Re: [PATCH net-next 3/4] ipv4: Prepare ipmr_rt_fib_lookup() to future .flowi4_tos conversion.
Quoted 7 lines · Guillaume Nault
Use
ip4h_dscp()to get the DSCP from the IPv4 header, then convert thedscp_tvalue to__u8withinet_dscp_to_dsfield().Then, when we'll convert .flowi4_tos to
dscp_t, we'll just have to drop theinet_dscp_to_dsfield()call.Signed-off-by Guillaume Nault <[email protected]>
PATCH 4/4 ipv4: Prepare ip_rt_get_source() to future .flowi4_tos conversion.
In reply to Guillaume NaultUse 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.
--- net/ipv4/route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/route.c +1 -1
@@ -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,
Signature · 1 line
2.39.2
Re: [PATCH net-next 4/4] ipv4: Prepare ip_rt_get_source() to future .flowi4_tos conversion.
Quoted 7 lines · Guillaume Nault
Use
ip4h_dscp()to get the DSCP from the IPv4 header, then convert thedscp_tvalue to__u8withinet_dscp_to_dsfield().Then, when we'll convert .flowi4_tos to
dscp_t, we'll just have to drop theinet_dscp_to_dsfield()call.Signed-off-by Guillaume Nault <[email protected]>
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 11 lines · 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
__u8todscp_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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html