Re: [PATCH net-next] dccp: Prepare dccp_v4_route_skb() to .flowi4_tos conversion.
Eric Dumazet <[email protected]> Tue, 14 Jan 2025 18:43:15 +0100
| Newsgroups | org.kernel.vger.dccp,org.kernel.vger.netdev |
|---|---|
| Message-ID | <CANn89iJQus-pqLta39df06DJLES8KgytN5iaVz9xv_HAz3F6Vw@mail.gmail.com> |
On Tue, Jan 14, 2025 at 4:46=E2=80=AFPM Guillaume Nault <[email protected]>= wrote: > > Use inet_sk_dscp() to get the socket DSCP value as dscp_t, instead of > ip_sock_rt_tos() which returns a __u8. This will ease the conversion > of fl4->flowi4_tos to dscp_t, as it will just require to drop the > inet_dscp_to_dsfield() call. > > Signed-off-by: Guillaume Nault <[email protected]> > --- > net/dccp/ipv4.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c > index 5926159a6f20..9e64dbd38cd7 100644 > --- a/net/dccp/ipv4.c > +++ b/net/dccp/ipv4.c > @@ -15,6 +15,7 @@ > > #include <net/icmp.h> > #include <net/inet_common.h> > +#include <net/inet_dscp.h> > #include <net/inet_hashtables.h> > #include <net/inet_sock.h> > #include <net/protocol.h> > @@ -473,7 +474,7 @@ static struct dst_entry* dccp_v4_route_skb(struct net= *net, struct sock *sk, > .flowi4_oif =3D inet_iif(skb), > .daddr =3D iph->saddr, > .saddr =3D iph->daddr, > - .flowi4_tos =3D ip_sock_rt_tos(sk), > + .flowi4_tos =3D inet_dscp_to_dsfield(inet_sk_dscp((inet_s= k(sk)))), You probably can replace ((X)) with (X) ? -> .flowi4_tos =3D inet_dscp_to_dsfield(inet_sk_dscp(inet_sk(sk))), > .flowi4_scope =3D ip_sock_rt_scope(sk), > .flowi4_proto =3D sk->sk_protocol, > .fl4_sport =3D dccp_hdr(skb)->dccph_dport, > -- > 2.39.2 >