ipv4: Prepare bpf helpers to .flowi4_tos conversion.
Subsystems (4)
cover ipv4: Prepare bpf helpers to .flowi4_tos conversion.
Continue the process of making a dscp_t variable available when setting .flowi4_tos. This series focuses on the BPF helpers that initialise a struct flowi4 manually.
The objective is to eventually convert .flowi4_tos to dscp_t, (to get type annotation and prevent ECN bits from interfering with DSCP).
Guillaume Nault (2):
ipv4: Prepare __bpf_redirect_neigh_v4() to future .flowi4_tos
conversion.
ipv4: Prepare bpf_lwt_xmit_reroute() to future .flowi4_tos conversion.
net/core/filter.c | 2 +- net/core/lwt_bpf.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.39.2
PATCH 1/2 bpf: ipv4: Prepare __bpf_redirect_neigh_v4() 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/core/filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/filter.c +1 -1
@@ -2355,7 +2355,7 @@ static int __bpf_redirect_neigh_v4(struct sk_buff *skb, struct net_device *dev,struct flowi4 fl4 = { .flowi4_flags =FLOWI_FLAG_ANYSRC , .flowi4_mark = skb->mark, - .flowi4_tos = ip4h->tos &INET_DSCP_MASK , + .flowi4_tos =inet_dscp_to_dsfield (ip4h_dscp (ip4h)), .flowi4_oif = dev->ifindex, .flowi4_proto = ip4h->protocol, .daddr = ip4h->daddr,
Signature · 1 line
2.39.2
Re: [PATCH net-next 1/2] bpf: ipv4: Prepare __bpf_redirect_neigh_v4() 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/2 bpf: lwtunnel: Prepare bpf_lwt_xmit_reroute() 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/core/lwt_bpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/lwt_bpf.c +1 -1
@@ -207,7 +207,7 @@ static int bpf_lwt_xmit_reroute(struct sk_buff *skb) fl4.flowi4_oif = oif; fl4.flowi4_mark = skb->mark; fl4.flowi4_uid =sock_net_uid (net, sk); - fl4.flowi4_tos = iph->tos &INET_DSCP_MASK ; + fl4.flowi4_tos =inet_dscp_to_dsfield (ip4h_dscp (iph)); fl4.flowi4_flags =FLOWI_FLAG_ANYSRC ; fl4.flowi4_proto = iph->protocol; fl4.daddr = iph->daddr;
Signature · 1 line
2.39.2
Re: [PATCH net-next 2/2] bpf: lwtunnel: Prepare bpf_lwt_xmit_reroute() 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]>
Jakub Kicinski
maintainerQuoted 6 lines · On Fri, 8 Nov 2024 17:47:09 +0100 Guillaume Nault wrote:
Continue the process of making a
dscp_tvariable available when setting .flowi4_tos. This series focuses on the BPF helpers that initialise a struct flowi4 manually.The objective is to eventually convert .flowi4_tos to
dscp_t, (to get type annotation and prevent ECN bits from interfering with DSCP).
Daniel, feel free to take this or we can take with your ack..
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 8 lines · On Fri, 8 Nov 2024 17:47:09 +0100 you wrote:
Continue the process of making a
dscp_tvariable available when setting .flowi4_tos. This series focuses on the BPF helpers that initialise a struct flowi4 manually.The objective is to eventually convert .flowi4_tos to
dscp_t, (to get type annotation and prevent ECN bits from interfering with DSCP).[...]
Here is the summary with links:
- [net-next,1/2] bpf: ipv4: Prepare __bpf_redirect_neigh_v4() to future .flowi4_tos conversion.
https://git.kernel.org/netdev/net-next/c/bfe086be5c4c - [net-next,2/2] bpf: lwtunnel: Prepare bpf_lwt_xmit_reroute() to future .flowi4_tos conversion. https://git.kernel.org/netdev/net-next/c/dab9c6307161
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html