diff mbox

[RFC,v6,net-next,2/4] tcp: refactor struct tcp_skb_cb

Message ID 1440545634-3901299-3-git-send-email-brakmo@fb.com
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

Lawrence Brakmo Aug. 25, 2015, 11:33 p.m. UTC
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>
---
 include/net/tcp.h | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Comments

Yuchung Cheng Aug. 27, 2015, 9:53 p.m. UTC | #1
On Tue, Aug 25, 2015 at 4:33 PM, Lawrence Brakmo <brakmo@fb.com> wrote:
>
> 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>

> ---
>  include/net/tcp.h | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/include/net/tcp.h b/include/net/tcp.h
> index 0121529..a086a98 100644
> --- a/include/net/tcp.h
> +++ b/include/net/tcp.h
> @@ -755,11 +755,16 @@ struct tcp_skb_cb {
>         /* 1 byte hole */
>         __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]))
> --
> 1.8.1
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/net/tcp.h b/include/net/tcp.h
index 0121529..a086a98 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -755,11 +755,16 @@  struct tcp_skb_cb {
 	/* 1 byte hole */
 	__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]))