tcp: refactor struct tcp_skb_cb
authorLawrence Brakmo <brakmo@fb.com>
Sat, 7 May 2016 03:35:35 +0000 (20:35 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 9 May 2016 04:03:26 +0000 (00:03 -0400)
Refactor tcp_skb_cb to create two overlaping areas to store
state for incoming or outgoing skbs based on comments by
Neal Cardwell to tcp_nv patch:

   AFAICT this patch would not require an increase in the size of
   sk_buff cb[] if it were to take advantage of the fact that the
   tcp_skb_cb header.h4 and header.h6 fields are only used in the packet
   reception code path, and this in_flight field is only used on the
   transmit side.

Signed-off-by: Lawrence Brakmo <brakmo@fb.com>
Acked-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/tcp.h

index 24ec80483805fb76e58b917eb9ceefb1025b1c86..4775a1bba7f7a77670594b6b0c7b838634bc1ab6 100644 (file)
@@ -765,11 +765,16 @@ struct tcp_skb_cb {
                        unused:6;
        __u32           ack_seq;        /* Sequence number ACK'd        */
        union {
-               struct inet_skb_parm    h4;
+               struct {
+                       /* There is space for up to 20 bytes */
+               } tx;   /* only used for outgoing skbs */
+               union {
+                       struct inet_skb_parm    h4;
 #if IS_ENABLED(CONFIG_IPV6)
-               struct inet6_skb_parm   h6;
+                       struct inet6_skb_parm   h6;
 #endif
-       } header;       /* For incoming frames          */
+               } header;       /* For incoming skbs */
+       };
 };
 
 #define TCP_SKB_CB(__skb)      ((struct tcp_skb_cb *)&((__skb)->cb[0]))