netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/1] tcp: Honor the eor bit in tcp_mtu_probe
@ 2018-02-05 18:18 Ilya Lesokhin
  2018-02-05 18:44 ` Eric Dumazet
  2018-02-06 16:24 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Ilya Lesokhin @ 2018-02-05 18:18 UTC (permalink / raw)
  To: netdev, eric.dumazet, kafai; +Cc: borisp, Ilya Lesokhin

Avoid SKB coalescing if eor bit is set in one of the relevant
SKBs.

Fixes: c134ecb87817 ("tcp: Make use of MSG_EOR in tcp_sendmsg")
Signed-off-by: Ilya Lesokhin <ilyal@mellanox.com>
---
 net/ipv4/tcp_output.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index e9f985e42405..70c5bb4958c3 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2099,6 +2099,17 @@ static int tcp_mtu_probe(struct sock *sk)
 			return 0;
 	}
 
+	len = probe_size;
+	tcp_for_write_queue_from_safe(skb, next, sk) {
+		if (len <= skb->len)
+			break;
+
+		if (unlikely(TCP_SKB_CB(skb)->eor))
+			return -1;
+
+		len -= skb->len;
+	}
+
 	/* We're allowed to probe.  Build it now. */
 	nskb = sk_stream_alloc_skb(sk, probe_size, GFP_ATOMIC, false);
 	if (!nskb)
@@ -2134,6 +2145,7 @@ static int tcp_mtu_probe(struct sock *sk)
 			/* We've eaten all the data from this skb.
 			 * Throw it away. */
 			TCP_SKB_CB(nskb)->tcp_flags |= TCP_SKB_CB(skb)->tcp_flags;
+			TCP_SKB_CB(nskb)->eor = TCP_SKB_CB(skb)->eor;
 			tcp_unlink_write_queue(skb, sk);
 			sk_wmem_free_skb(sk, skb);
 		} else {
-- 
2.15.0.317.g14c63a9

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

* Re: [PATCH v2 1/1] tcp: Honor the eor bit in tcp_mtu_probe
  2018-02-05 18:18 [PATCH v2 1/1] tcp: Honor the eor bit in tcp_mtu_probe Ilya Lesokhin
@ 2018-02-05 18:44 ` Eric Dumazet
  2018-02-06 16:24 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2018-02-05 18:44 UTC (permalink / raw)
  To: Ilya Lesokhin, netdev, kafai; +Cc: borisp

On Mon, 2018-02-05 at 20:18 +0200, Ilya Lesokhin wrote:
> Avoid SKB coalescing if eor bit is set in one of the relevant
> SKBs.
> 
> Fixes: c134ecb87817 ("tcp: Make use of MSG_EOR in tcp_sendmsg")
> Signed-off-by: Ilya Lesokhin <ilyal@mellanox.com>
> ---
>  net/ipv4/tcp_output.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)

Reviewed-by: Eric Dumazet <edumazet@google.com>

Thanks Ilya

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

* Re: [PATCH v2 1/1] tcp: Honor the eor bit in tcp_mtu_probe
  2018-02-05 18:18 [PATCH v2 1/1] tcp: Honor the eor bit in tcp_mtu_probe Ilya Lesokhin
  2018-02-05 18:44 ` Eric Dumazet
@ 2018-02-06 16:24 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2018-02-06 16:24 UTC (permalink / raw)
  To: ilyal; +Cc: netdev, eric.dumazet, kafai, borisp

From: Ilya Lesokhin <ilyal@mellanox.com>
Date: Mon,  5 Feb 2018 20:18:32 +0200

> Avoid SKB coalescing if eor bit is set in one of the relevant
> SKBs.
> 
> Fixes: c134ecb87817 ("tcp: Make use of MSG_EOR in tcp_sendmsg")
> Signed-off-by: Ilya Lesokhin <ilyal@mellanox.com>

This adds a build warning, please fix:

  CC      net/ipv4/tcp_output.o
In file included from ./include/linux/tcp.h:21:0,
                 from ./include/net/tcp.h:24,
                 from net/ipv4/tcp_output.c:39:
net/ipv4/tcp_output.c: In function ‘tcp_write_xmit’:
./include/linux/skbuff.h:3196:12: warning: ‘skb’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   for (tmp = skb->next;      \
            ^
net/ipv4/tcp_output.c:2043:18: note: ‘skb’ was declared here
  struct sk_buff *skb, *nskb, *next;
                  ^~~

This is with:

[davem@dhcp-10-15-49-227 net]$ gcc --version
gcc (GCC) 7.3.1 20180130 (Red Hat 7.3.1-2)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[davem@dhcp-10-15-49-227 net]$

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

end of thread, other threads:[~2018-02-06 16:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-05 18:18 [PATCH v2 1/1] tcp: Honor the eor bit in tcp_mtu_probe Ilya Lesokhin
2018-02-05 18:44 ` Eric Dumazet
2018-02-06 16:24 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).