Message ID | a0eba69cce94f747e4c7516184a85ffd0abbe3f0.1729530028.git.gnault@redhat.com (mailing list archive) |
---|---|
State | Accepted |
Commit | b76ebf22c578375e69b35061b5d47149efd957f9 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | ipv4: Prepare core ipv4 files to future .flowi4_tos conversion. | expand |
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>
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, };
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(-)