ipv4: Prepare fib_compute_spec_dst() to future .flowi4_tos conversion.
authorGuillaume Nault <gnault@redhat.com>
Tue, 22 Oct 2024 09:48:00 +0000 (11:48 +0200)
committerJakub Kicinski <kuba@kernel.org>
Tue, 29 Oct 2024 18:21:05 +0000 (11:21 -0700)
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>
Link: https://patch.msgid.link/a0eba69cce94f747e4c7516184a85ffd0abbe3f0.1729530028.git.gnault@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv4/fib_frontend.c

index 53bd263..0c9ce93 100644 (file)
@@ -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,
                };