* [PATCH net-next 1/4] ipv4: Unmask upper DSCP bits in __ip_queue_xmit()
2024-09-03 13:53 [PATCH net-next 0/4] Unmask upper DSCP bits - part 3 Ido Schimmel
@ 2024-09-03 13:53 ` Ido Schimmel
2024-09-03 15:52 ` Guillaume Nault
2024-09-03 13:53 ` [PATCH net-next 2/4] ipv4: ipmr: Unmask upper DSCP bits in ipmr_queue_xmit() Ido Schimmel
` (4 subsequent siblings)
5 siblings, 1 reply; 11+ messages in thread
From: Ido Schimmel @ 2024-09-03 13:53 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, edumazet, pabeni, dsahern, gnault, Ido Schimmel
The function is passed the full DS field in its 'tos' argument by its
two callers. It then masks the upper DSCP bits using RT_TOS() when
passing it to ip_route_output_ports().
Unmask the upper DSCP bits when passing 'tos' to ip_route_output_ports()
so that in the future it could perform the FIB lookup according to the
full DSCP value.
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
net/ipv4/ip_output.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index eea443b7f65e..49811c9281d4 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -494,7 +494,7 @@ int __ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
inet->inet_dport,
inet->inet_sport,
sk->sk_protocol,
- RT_TOS(tos),
+ tos & INET_DSCP_MASK,
sk->sk_bound_dev_if);
if (IS_ERR(rt))
goto no_route;
--
2.46.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH net-next 2/4] ipv4: ipmr: Unmask upper DSCP bits in ipmr_queue_xmit()
2024-09-03 13:53 [PATCH net-next 0/4] Unmask upper DSCP bits - part 3 Ido Schimmel
2024-09-03 13:53 ` [PATCH net-next 1/4] ipv4: Unmask upper DSCP bits in __ip_queue_xmit() Ido Schimmel
@ 2024-09-03 13:53 ` Ido Schimmel
2024-09-03 15:54 ` Guillaume Nault
2024-09-03 13:53 ` [PATCH net-next 3/4] ip6_tunnel: Unmask upper DSCP bits in ip4ip6_err() Ido Schimmel
` (3 subsequent siblings)
5 siblings, 1 reply; 11+ messages in thread
From: Ido Schimmel @ 2024-09-03 13:53 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, edumazet, pabeni, dsahern, gnault, Ido Schimmel
Unmask the upper DSCP bits when calling ip_route_output_ports() so that
in the future it could perform the FIB lookup according to the full DSCP
value.
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
net/ipv4/ipmr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index f1a43199551b..089864c6a35e 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -1869,7 +1869,7 @@ static void ipmr_queue_xmit(struct net *net, struct mr_table *mrt,
vif->remote, vif->local,
0, 0,
IPPROTO_IPIP,
- RT_TOS(iph->tos), vif->link);
+ iph->tos & INET_DSCP_MASK, vif->link);
if (IS_ERR(rt))
goto out_free;
encap = sizeof(struct iphdr);
@@ -1877,7 +1877,7 @@ static void ipmr_queue_xmit(struct net *net, struct mr_table *mrt,
rt = ip_route_output_ports(net, &fl4, NULL, iph->daddr, 0,
0, 0,
IPPROTO_IPIP,
- RT_TOS(iph->tos), vif->link);
+ iph->tos & INET_DSCP_MASK, vif->link);
if (IS_ERR(rt))
goto out_free;
}
--
2.46.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH net-next 3/4] ip6_tunnel: Unmask upper DSCP bits in ip4ip6_err()
2024-09-03 13:53 [PATCH net-next 0/4] Unmask upper DSCP bits - part 3 Ido Schimmel
2024-09-03 13:53 ` [PATCH net-next 1/4] ipv4: Unmask upper DSCP bits in __ip_queue_xmit() Ido Schimmel
2024-09-03 13:53 ` [PATCH net-next 2/4] ipv4: ipmr: Unmask upper DSCP bits in ipmr_queue_xmit() Ido Schimmel
@ 2024-09-03 13:53 ` Ido Schimmel
2024-09-03 15:59 ` Guillaume Nault
2024-09-03 13:53 ` [PATCH net-next 4/4] ipv6: sit: Unmask upper DSCP bits in ipip6_tunnel_bind_dev() Ido Schimmel
` (2 subsequent siblings)
5 siblings, 1 reply; 11+ messages in thread
From: Ido Schimmel @ 2024-09-03 13:53 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, edumazet, pabeni, dsahern, gnault, Ido Schimmel
Unmask the upper DSCP bits when calling ip_route_output_ports() so that
in the future it could perform the FIB lookup according to the full DSCP
value.
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
net/ipv6/ip6_tunnel.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index ec51ab5063e8..b60e13c42bca 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -53,6 +53,7 @@
#include <net/net_namespace.h>
#include <net/netns/generic.h>
#include <net/dst_metadata.h>
+#include <net/inet_dscp.h>
MODULE_AUTHOR("Ville Nuorvala");
MODULE_DESCRIPTION("IPv6 tunneling device");
@@ -608,7 +609,8 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
/* Try to guess incoming interface */
rt = ip_route_output_ports(dev_net(skb->dev), &fl4, NULL, eiph->saddr,
- 0, 0, 0, IPPROTO_IPIP, RT_TOS(eiph->tos), 0);
+ 0, 0, 0, IPPROTO_IPIP,
+ eiph->tos & INET_DSCP_MASK, 0);
if (IS_ERR(rt))
goto out;
@@ -619,7 +621,8 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
if (rt->rt_flags & RTCF_LOCAL) {
rt = ip_route_output_ports(dev_net(skb->dev), &fl4, NULL,
eiph->daddr, eiph->saddr, 0, 0,
- IPPROTO_IPIP, RT_TOS(eiph->tos), 0);
+ IPPROTO_IPIP,
+ eiph->tos & INET_DSCP_MASK, 0);
if (IS_ERR(rt) || rt->dst.dev->type != ARPHRD_TUNNEL6) {
if (!IS_ERR(rt))
ip_rt_put(rt);
--
2.46.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH net-next 4/4] ipv6: sit: Unmask upper DSCP bits in ipip6_tunnel_bind_dev()
2024-09-03 13:53 [PATCH net-next 0/4] Unmask upper DSCP bits - part 3 Ido Schimmel
` (2 preceding siblings ...)
2024-09-03 13:53 ` [PATCH net-next 3/4] ip6_tunnel: Unmask upper DSCP bits in ip4ip6_err() Ido Schimmel
@ 2024-09-03 13:53 ` Ido Schimmel
2024-09-03 16:02 ` Guillaume Nault
2024-09-03 14:45 ` [PATCH net-next 0/4] Unmask upper DSCP bits - part 3 David Ahern
2024-09-05 0:00 ` patchwork-bot+netdevbpf
5 siblings, 1 reply; 11+ messages in thread
From: Ido Schimmel @ 2024-09-03 13:53 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, edumazet, pabeni, dsahern, gnault, Ido Schimmel
Unmask the upper DSCP bits when calling ip_route_output_ports() so that
in the future it could perform the FIB lookup according to the full DSCP
value.
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
net/ipv6/sit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 16b90a24c9ba..39bd8951bfca 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -1112,7 +1112,7 @@ static void ipip6_tunnel_bind_dev(struct net_device *dev)
iph->daddr, iph->saddr,
0, 0,
IPPROTO_IPV6,
- RT_TOS(iph->tos),
+ iph->tos & INET_DSCP_MASK,
tunnel->parms.link);
if (!IS_ERR(rt)) {
--
2.46.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH net-next 0/4] Unmask upper DSCP bits - part 3
2024-09-03 13:53 [PATCH net-next 0/4] Unmask upper DSCP bits - part 3 Ido Schimmel
` (3 preceding siblings ...)
2024-09-03 13:53 ` [PATCH net-next 4/4] ipv6: sit: Unmask upper DSCP bits in ipip6_tunnel_bind_dev() Ido Schimmel
@ 2024-09-03 14:45 ` David Ahern
2024-09-05 0:00 ` patchwork-bot+netdevbpf
5 siblings, 0 replies; 11+ messages in thread
From: David Ahern @ 2024-09-03 14:45 UTC (permalink / raw)
To: Ido Schimmel, netdev; +Cc: davem, kuba, edumazet, pabeni, gnault
On 9/3/24 7:53 AM, Ido Schimmel wrote:
> tl;dr - This patchset continues to unmask the upper DSCP bits in the
> IPv4 flow key in preparation for allowing IPv4 FIB rules to match on
> DSCP. No functional changes are expected.
>
> The TOS field in the IPv4 flow key ('flowi4_tos') is used during FIB
> lookup to match against the TOS selector in FIB rules and routes.
>
> It is currently impossible for user space to configure FIB rules that
> match on the DSCP value as the upper DSCP bits are either masked in the
> various call sites that initialize the IPv4 flow key or along the path
> to the FIB core.
>
> In preparation for adding a DSCP selector to IPv4 and IPv6 FIB rules, we
> need to make sure the entire DSCP value is present in the IPv4 flow key.
> This patchset continues to unmask the upper DSCP bits, but this time in
> the output route path, specifically in the callers of
> ip_route_output_ports().
>
> The next patchset (last) will handle the callers of
> ip_route_output_key(). Split from this patchset to avoid going over the
> 15 patches limit.
>
> No functional changes are expected as commit 1fa3314c14c6 ("ipv4:
> Centralize TOS matching") moved the masking of the upper DSCP bits to
> the core where 'flowi4_tos' is matched against the TOS selector.
>
> Ido Schimmel (4):
> ipv4: Unmask upper DSCP bits in __ip_queue_xmit()
> ipv4: ipmr: Unmask upper DSCP bits in ipmr_queue_xmit()
> ip6_tunnel: Unmask upper DSCP bits in ip4ip6_err()
> ipv6: sit: Unmask upper DSCP bits in ipip6_tunnel_bind_dev()
>
> net/ipv4/ip_output.c | 2 +-
> net/ipv4/ipmr.c | 4 ++--
> net/ipv6/ip6_tunnel.c | 7 +++++--
> net/ipv6/sit.c | 2 +-
> 4 files changed, 9 insertions(+), 6 deletions(-)
>
For the set:
Reviewed-by: David Ahern <dsahern@kernel.org>
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH net-next 0/4] Unmask upper DSCP bits - part 3
2024-09-03 13:53 [PATCH net-next 0/4] Unmask upper DSCP bits - part 3 Ido Schimmel
` (4 preceding siblings ...)
2024-09-03 14:45 ` [PATCH net-next 0/4] Unmask upper DSCP bits - part 3 David Ahern
@ 2024-09-05 0:00 ` patchwork-bot+netdevbpf
5 siblings, 0 replies; 11+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-09-05 0:00 UTC (permalink / raw)
To: Ido Schimmel; +Cc: netdev, davem, kuba, edumazet, pabeni, dsahern, gnault
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 3 Sep 2024 16:53:23 +0300 you wrote:
> tl;dr - This patchset continues to unmask the upper DSCP bits in the
> IPv4 flow key in preparation for allowing IPv4 FIB rules to match on
> DSCP. No functional changes are expected.
>
> The TOS field in the IPv4 flow key ('flowi4_tos') is used during FIB
> lookup to match against the TOS selector in FIB rules and routes.
>
> [...]
Here is the summary with links:
- [net-next,1/4] ipv4: Unmask upper DSCP bits in __ip_queue_xmit()
https://git.kernel.org/netdev/net-next/c/71f1fea4f65d
- [net-next,2/4] ipv4: ipmr: Unmask upper DSCP bits in ipmr_queue_xmit()
https://git.kernel.org/netdev/net-next/c/97edbbaad303
- [net-next,3/4] ip6_tunnel: Unmask upper DSCP bits in ip4ip6_err()
https://git.kernel.org/netdev/net-next/c/de1fb3e8b053
- [net-next,4/4] ipv6: sit: Unmask upper DSCP bits in ipip6_tunnel_bind_dev()
https://git.kernel.org/netdev/net-next/c/c9a1e2629d10
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] 11+ messages in thread