]> www.infradead.org Git - users/hch/misc.git/commitdiff
ipv6: reorganise struct ipv6_pinfo
authorEric Dumazet <edumazet@google.com>
Tue, 16 Sep 2025 16:09:45 +0000 (16:09 +0000)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 18 Sep 2025 08:17:09 +0000 (10:17 +0200)
Move fields used in tx fast path at the beginning of the structure,
and seldom used ones at the end.

Note that rxopt is also in the first cache line.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20250916160951.541279-5-edumazet@google.com
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
include/linux/ipv6.h

index 8e6d9f8b3dc80c3904ff13e1d218b9527a554e35..43b7bb82873881b38a461031b784f55c740a0741 100644 (file)
@@ -214,18 +214,21 @@ struct inet6_cork {
 
 /* struct ipv6_pinfo - ipv6 private area */
 struct ipv6_pinfo {
+       /* Used in tx path (inet6_csk_route_socket(), ip6_xmit()) */
        struct in6_addr         saddr;
-       struct in6_pktinfo      sticky_pktinfo;
+       __be32                  flow_label;
+       u32                     dst_cookie;
+       struct ipv6_txoptions __rcu     *opt;
+       s16                     hop_limit;
+       u8                      pmtudisc;
+       u8                      tclass;
 #ifdef CONFIG_IPV6_SUBTREES
        bool                    saddr_cache;
 #endif
        bool                    daddr_cache;
 
-       __be32                  flow_label;
-       __u32                   frag_size;
-
-       s16                     hop_limit;
        u8                      mcast_hops;
+       u32                     frag_size;
 
        int                     ucast_oif;
        int                     mcast_oif;
@@ -233,7 +236,7 @@ struct ipv6_pinfo {
        /* pktoption flags */
        union {
                struct {
-                       __u16   srcrt:1,
+                       u16     srcrt:1,
                                osrcrt:1,
                                rxinfo:1,
                                rxoinfo:1,
@@ -250,29 +253,25 @@ struct ipv6_pinfo {
                                recvfragsize:1;
                                /* 1 bits hole */
                } bits;
-               __u16           all;
+               u16             all;
        } rxopt;
 
        /* sockopt flags */
-       __u8                    srcprefs;       /* 001: prefer temporary address
+       u8                      srcprefs;       /* 001: prefer temporary address
                                                 * 010: prefer public address
                                                 * 100: prefer care-of address
                                                 */
-       __u8                    pmtudisc;
-       __u8                    min_hopcount;
-       __u8                    tclass;
+       u8                      min_hopcount;
        __be32                  rcv_flowinfo;
+       struct in6_pktinfo      sticky_pktinfo;
 
-       __u32                   dst_cookie;
+       struct sk_buff          *pktoptions;
+       struct sk_buff          *rxpmtu;
+       struct inet6_cork       cork;
 
        struct ipv6_mc_socklist __rcu *ipv6_mc_list;
        struct ipv6_ac_socklist *ipv6_ac_list;
        struct ipv6_fl_socklist __rcu *ipv6_fl_list;
-
-       struct ipv6_txoptions __rcu     *opt;
-       struct sk_buff          *pktoptions;
-       struct sk_buff          *rxpmtu;
-       struct inet6_cork       cork;
 };
 
 /* We currently use available bits from inet_sk(sk)->inet_flags,