diff mbox series

[net-next] dccp: Prepare dccp_v4_route_skb() to .flowi4_tos conversion.

Message ID ed399406a6ffad5097fa618c3bc7a4ac59546c62.1736869543.git.gnault@redhat.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [net-next] dccp: Prepare dccp_v4_route_skb() to .flowi4_tos conversion. | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1 this patch: 1
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 3 maintainers not CCed: luoxuanqiang@kylinos.cn kuniyu@amazon.com kernelxing@tencent.com
netdev/build_clang success Errors and warnings before: 2 this patch: 2
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 15 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 1 this patch: 1
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2025-01-14--18-00 (tests: 884)

Commit Message

Guillaume Nault Jan. 14, 2025, 3:46 p.m. UTC
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 <gnault@redhat.com>
---
 net/dccp/ipv4.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Eric Dumazet Jan. 14, 2025, 5:43 p.m. UTC | #1
On Tue, Jan 14, 2025 at 4:46 PM Guillaume Nault <gnault@redhat.com> 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 <gnault@redhat.com>
> ---
>  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 = inet_iif(skb),
>                 .daddr = iph->saddr,
>                 .saddr = iph->daddr,
> -               .flowi4_tos = ip_sock_rt_tos(sk),
> +               .flowi4_tos = inet_dscp_to_dsfield(inet_sk_dscp((inet_sk(sk)))),

You probably can replace ((X)) with (X) ?
->
 .flowi4_tos = inet_dscp_to_dsfield(inet_sk_dscp(inet_sk(sk))),


>                 .flowi4_scope = ip_sock_rt_scope(sk),
>                 .flowi4_proto = sk->sk_protocol,
>                 .fl4_sport = dccp_hdr(skb)->dccph_dport,
> --
> 2.39.2
>
Guillaume Nault Jan. 14, 2025, 10:32 p.m. UTC | #2
On Tue, Jan 14, 2025 at 06:43:15PM +0100, Eric Dumazet wrote:
> On Tue, Jan 14, 2025 at 4:46 PM Guillaume Nault <gnault@redhat.com> 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 <gnault@redhat.com>
> > ---
> >  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 = inet_iif(skb),
> >                 .daddr = iph->saddr,
> >                 .saddr = iph->daddr,
> > -               .flowi4_tos = ip_sock_rt_tos(sk),
> > +               .flowi4_tos = inet_dscp_to_dsfield(inet_sk_dscp((inet_sk(sk)))),
> 
> You probably can replace ((X)) with (X) ?
> ->
>  .flowi4_tos = inet_dscp_to_dsfield(inet_sk_dscp(inet_sk(sk))),

Indeed, I'll change that in v2.

> >                 .flowi4_scope = ip_sock_rt_scope(sk),
> >                 .flowi4_proto = sk->sk_protocol,
> >                 .fl4_sport = dccp_hdr(skb)->dccph_dport,
> > --
> > 2.39.2
> >
>
diff mbox series

Patch

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 = inet_iif(skb),
 		.daddr = iph->saddr,
 		.saddr = iph->daddr,
-		.flowi4_tos = ip_sock_rt_tos(sk),
+		.flowi4_tos = inet_dscp_to_dsfield(inet_sk_dscp((inet_sk(sk)))),
 		.flowi4_scope = ip_sock_rt_scope(sk),
 		.flowi4_proto = sk->sk_protocol,
 		.fl4_sport = dccp_hdr(skb)->dccph_dport,