提交 808cf9e3 编写于 作者: I Ilya Lesokhin 提交者: David S. Miller

tcp: Honor the eor bit in tcp_mtu_probe

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

Fixes: c134ecb8 ("tcp: Make use of MSG_EOR in tcp_sendmsg")
Signed-off-by: NIlya Lesokhin <ilyal@mellanox.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 fb234035
...@@ -2027,6 +2027,24 @@ static inline void tcp_mtu_check_reprobe(struct sock *sk) ...@@ -2027,6 +2027,24 @@ static inline void tcp_mtu_check_reprobe(struct sock *sk)
} }
} }
static bool tcp_can_coalesce_send_queue_head(struct sock *sk, int len)
{
struct sk_buff *skb, *next;
skb = tcp_send_head(sk);
tcp_for_write_queue_from_safe(skb, next, sk) {
if (len <= skb->len)
break;
if (unlikely(TCP_SKB_CB(skb)->eor))
return false;
len -= skb->len;
}
return true;
}
/* Create a new MTU probe if we are ready. /* Create a new MTU probe if we are ready.
* MTU probe is regularly attempting to increase the path MTU by * MTU probe is regularly attempting to increase the path MTU by
* deliberately sending larger packets. This discovers routing * deliberately sending larger packets. This discovers routing
...@@ -2099,6 +2117,9 @@ static int tcp_mtu_probe(struct sock *sk) ...@@ -2099,6 +2117,9 @@ static int tcp_mtu_probe(struct sock *sk)
return 0; return 0;
} }
if (!tcp_can_coalesce_send_queue_head(sk, probe_size))
return -1;
/* We're allowed to probe. Build it now. */ /* We're allowed to probe. Build it now. */
nskb = sk_stream_alloc_skb(sk, probe_size, GFP_ATOMIC, false); nskb = sk_stream_alloc_skb(sk, probe_size, GFP_ATOMIC, false);
if (!nskb) if (!nskb)
...@@ -2134,6 +2155,10 @@ static int tcp_mtu_probe(struct sock *sk) ...@@ -2134,6 +2155,10 @@ static int tcp_mtu_probe(struct sock *sk)
/* We've eaten all the data from this skb. /* We've eaten all the data from this skb.
* Throw it away. */ * Throw it away. */
TCP_SKB_CB(nskb)->tcp_flags |= TCP_SKB_CB(skb)->tcp_flags; TCP_SKB_CB(nskb)->tcp_flags |= TCP_SKB_CB(skb)->tcp_flags;
/* If this is the last SKB we copy and eor is set
* we need to propagate it to the new skb.
*/
TCP_SKB_CB(nskb)->eor = TCP_SKB_CB(skb)->eor;
tcp_unlink_write_queue(skb, sk); tcp_unlink_write_queue(skb, sk);
sk_wmem_free_skb(sk, skb); sk_wmem_free_skb(sk, skb);
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册