All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [MPTCP] [PATCH 05/18] tcp6: Prepare for maximum TCP option-space
@ 2017-10-05  7:41 Christoph Paasch
  0 siblings, 0 replies; 3+ messages in thread
From: Christoph Paasch @ 2017-10-05  7:41 UTC (permalink / raw)
  To: mptcp 

[-- Attachment #1: Type: text/plain, Size: 2684 bytes --]

On 04/10/17 - 15:33:35, Mat Martineau wrote:
> 
> On Tue, 3 Oct 2017, Christoph Paasch wrote:
> 
> > With a generic TCP-option framework we don't know in advance how much
> > space will be used. So, estimate the worst and allocate the maximum.
> > Later on, we pull skb->tail back in again.
> 
> v2 of the option registration patch will conflict with this. The prepare
> callback does figure out the number of option bytes required before writing
> to the outgoing skb, so that can happen before the alloc_skb().

No worries, I will take care of the conflicts.

Will be working on a v2 of my patchset to handle the incoming data path as
well.


Christoph

> 
> 
> Mat
> 
> 
> > 
> > Signed-off-by: Christoph Paasch <cpaasch(a)apple.com>
> > ---
> > net/ipv6/tcp_ipv6.c | 16 ++++++++--------
> > 1 file changed, 8 insertions(+), 8 deletions(-)
> > 
> > diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
> > index 64d94afa427f..17f7e0cd8755 100644
> > --- a/net/ipv6/tcp_ipv6.c
> > +++ b/net/ipv6/tcp_ipv6.c
> > @@ -784,17 +784,11 @@ static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32
> > 	struct flowi6 fl6;
> > 	struct net *net = sk ? sock_net(sk) : dev_net(skb_dst(skb)->dev);
> > 	struct sock *ctl_sk = net->ipv6.tcp_sk;
> > -	unsigned int tot_len = sizeof(struct tcphdr);
> > +	unsigned int tot_len = sizeof(struct tcphdr) + MAX_TCP_OPTION_SPACE;
> > +	unsigned int reduce = 0; /* By how much to pull skb->tail back in? */
> > 	struct dst_entry *dst;
> > 	__be32 *topt;
> > 
> > -	if (tsecr)
> > -		tot_len += TCPOLEN_TSTAMP_ALIGNED;
> > -#ifdef CONFIG_TCP_MD5SIG
> > -	if (key)
> > -		tot_len += TCPOLEN_MD5SIG_ALIGNED;
> > -#endif
> > -
> > 	buff = alloc_skb(MAX_HEADER + sizeof(struct ipv6hdr) + tot_len,
> > 			 GFP_ATOMIC);
> > 	if (!buff)
> > @@ -823,6 +817,8 @@ static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32
> > 				(TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP);
> > 		*topt++ = htonl(tsval);
> > 		*topt++ = htonl(tsecr);
> > +
> > +		reduce += TCPOLEN_TSTAMP_ALIGNED;
> > 	}
> > 
> > #ifdef CONFIG_TCP_MD5SIG
> > @@ -832,9 +828,13 @@ static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32
> > 		tcp_v6_md5_hash_hdr((__u8 *)topt, key,
> > 				    &ipv6_hdr(skb)->saddr,
> > 				    &ipv6_hdr(skb)->daddr, t1);
> > +
> > +		reduce += TCPOLEN_MD5SIG_ALIGNED;
> > 	}
> > #endif
> > 
> > +	buff->tail -= reduce;
> > +
> > 	memset(&fl6, 0, sizeof(fl6));
> > 	fl6.daddr = ipv6_hdr(skb)->saddr;
> > 	fl6.saddr = ipv6_hdr(skb)->daddr;
> > -- 
> > 2.14.1
> > 
> > 
> 
> --
> Mat Martineau
> Intel OTC

^ permalink raw reply	[flat|nested] 3+ messages in thread
* Re: [MPTCP] [PATCH 05/18] tcp6: Prepare for maximum TCP option-space
@ 2017-10-04 22:33 Mat Martineau
  0 siblings, 0 replies; 3+ messages in thread
From: Mat Martineau @ 2017-10-04 22:33 UTC (permalink / raw)
  To: mptcp 

[-- Attachment #1: Type: text/plain, Size: 2329 bytes --]


On Tue, 3 Oct 2017, Christoph Paasch wrote:

> With a generic TCP-option framework we don't know in advance how much
> space will be used. So, estimate the worst and allocate the maximum.
> Later on, we pull skb->tail back in again.

v2 of the option registration patch will conflict with this. The prepare 
callback does figure out the number of option bytes required before 
writing to the outgoing skb, so that can happen before the alloc_skb().


Mat


>
> Signed-off-by: Christoph Paasch <cpaasch(a)apple.com>
> ---
> net/ipv6/tcp_ipv6.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
> index 64d94afa427f..17f7e0cd8755 100644
> --- a/net/ipv6/tcp_ipv6.c
> +++ b/net/ipv6/tcp_ipv6.c
> @@ -784,17 +784,11 @@ static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32
> 	struct flowi6 fl6;
> 	struct net *net = sk ? sock_net(sk) : dev_net(skb_dst(skb)->dev);
> 	struct sock *ctl_sk = net->ipv6.tcp_sk;
> -	unsigned int tot_len = sizeof(struct tcphdr);
> +	unsigned int tot_len = sizeof(struct tcphdr) + MAX_TCP_OPTION_SPACE;
> +	unsigned int reduce = 0; /* By how much to pull skb->tail back in? */
> 	struct dst_entry *dst;
> 	__be32 *topt;
>
> -	if (tsecr)
> -		tot_len += TCPOLEN_TSTAMP_ALIGNED;
> -#ifdef CONFIG_TCP_MD5SIG
> -	if (key)
> -		tot_len += TCPOLEN_MD5SIG_ALIGNED;
> -#endif
> -
> 	buff = alloc_skb(MAX_HEADER + sizeof(struct ipv6hdr) + tot_len,
> 			 GFP_ATOMIC);
> 	if (!buff)
> @@ -823,6 +817,8 @@ static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32
> 				(TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP);
> 		*topt++ = htonl(tsval);
> 		*topt++ = htonl(tsecr);
> +
> +		reduce += TCPOLEN_TSTAMP_ALIGNED;
> 	}
>
> #ifdef CONFIG_TCP_MD5SIG
> @@ -832,9 +828,13 @@ static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32
> 		tcp_v6_md5_hash_hdr((__u8 *)topt, key,
> 				    &ipv6_hdr(skb)->saddr,
> 				    &ipv6_hdr(skb)->daddr, t1);
> +
> +		reduce += TCPOLEN_MD5SIG_ALIGNED;
> 	}
> #endif
>
> +	buff->tail -= reduce;
> +
> 	memset(&fl6, 0, sizeof(fl6));
> 	fl6.daddr = ipv6_hdr(skb)->saddr;
> 	fl6.saddr = ipv6_hdr(skb)->daddr;
> -- 
> 2.14.1
>
>

--
Mat Martineau
Intel OTC

^ permalink raw reply	[flat|nested] 3+ messages in thread
* [MPTCP] [PATCH 05/18] tcp6: Prepare for maximum TCP option-space
@ 2017-10-03 16:21 Christoph Paasch
  0 siblings, 0 replies; 3+ messages in thread
From: Christoph Paasch @ 2017-10-03 16:21 UTC (permalink / raw)
  To: mptcp 

[-- Attachment #1: Type: text/plain, Size: 1926 bytes --]

With a generic TCP-option framework we don't know in advance how much
space will be used. So, estimate the worst and allocate the maximum.
Later on, we pull skb->tail back in again.

Signed-off-by: Christoph Paasch <cpaasch(a)apple.com>
---
 net/ipv6/tcp_ipv6.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 64d94afa427f..17f7e0cd8755 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -784,17 +784,11 @@ static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32
 	struct flowi6 fl6;
 	struct net *net = sk ? sock_net(sk) : dev_net(skb_dst(skb)->dev);
 	struct sock *ctl_sk = net->ipv6.tcp_sk;
-	unsigned int tot_len = sizeof(struct tcphdr);
+	unsigned int tot_len = sizeof(struct tcphdr) + MAX_TCP_OPTION_SPACE;
+	unsigned int reduce = 0; /* By how much to pull skb->tail back in? */
 	struct dst_entry *dst;
 	__be32 *topt;
 
-	if (tsecr)
-		tot_len += TCPOLEN_TSTAMP_ALIGNED;
-#ifdef CONFIG_TCP_MD5SIG
-	if (key)
-		tot_len += TCPOLEN_MD5SIG_ALIGNED;
-#endif
-
 	buff = alloc_skb(MAX_HEADER + sizeof(struct ipv6hdr) + tot_len,
 			 GFP_ATOMIC);
 	if (!buff)
@@ -823,6 +817,8 @@ static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32
 				(TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP);
 		*topt++ = htonl(tsval);
 		*topt++ = htonl(tsecr);
+
+		reduce += TCPOLEN_TSTAMP_ALIGNED;
 	}
 
 #ifdef CONFIG_TCP_MD5SIG
@@ -832,9 +828,13 @@ static void tcp_v6_send_response(const struct sock *sk, struct sk_buff *skb, u32
 		tcp_v6_md5_hash_hdr((__u8 *)topt, key,
 				    &ipv6_hdr(skb)->saddr,
 				    &ipv6_hdr(skb)->daddr, t1);
+
+		reduce += TCPOLEN_MD5SIG_ALIGNED;
 	}
 #endif
 
+	buff->tail -= reduce;
+
 	memset(&fl6, 0, sizeof(fl6));
 	fl6.daddr = ipv6_hdr(skb)->saddr;
 	fl6.saddr = ipv6_hdr(skb)->daddr;
-- 
2.14.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-10-05  7:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-05  7:41 [MPTCP] [PATCH 05/18] tcp6: Prepare for maximum TCP option-space Christoph Paasch
  -- strict thread matches above, loose matches on Subject: below --
2017-10-04 22:33 Mat Martineau
2017-10-03 16:21 Christoph Paasch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.