Skip to content

Commit

Permalink
tcp: make mtu probe failure to not break gso'ed skbs unnecessarily
Browse files Browse the repository at this point in the history
I noticed that since skb->len has nothing to do with actual segment
length with gso, we need to figure it out separately, reuse
a function from the recent shifting stuff (generalize it).

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ilpo Järvinen authored and David S. Miller committed Dec 6, 2008
1 parent 9969ca5 commit 775ffab
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions net/ipv4/tcp_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -1445,14 +1445,9 @@ static int tcp_shifted_skb(struct sock *sk, struct sk_buff *prev,
/* I wish gso_size would have a bit more sane initialization than
* something-or-zero which complicates things
*/
static int tcp_shift_mss(struct sk_buff *skb)
static int tcp_skb_seglen(struct sk_buff *skb)
{
int mss = tcp_skb_mss(skb);

if (!mss)
mss = skb->len;

return mss;
return tcp_skb_pcount(skb) == 1 ? skb->len : tcp_skb_mss(skb);
}

/* Shifting pages past head area doesn't work */
Expand Down Expand Up @@ -1503,12 +1498,12 @@ static struct sk_buff *tcp_shift_skb_data(struct sock *sk, struct sk_buff *skb,
if (in_sack) {
len = skb->len;
pcount = tcp_skb_pcount(skb);
mss = tcp_shift_mss(skb);
mss = tcp_skb_seglen(skb);

/* TODO: Fix DSACKs to not fragment already SACKed and we can
* drop this restriction as unnecessary
*/
if (mss != tcp_shift_mss(prev))
if (mss != tcp_skb_seglen(prev))
goto fallback;
} else {
if (!after(TCP_SKB_CB(skb)->end_seq, start_seq))
Expand Down Expand Up @@ -1549,7 +1544,7 @@ static struct sk_buff *tcp_shift_skb_data(struct sock *sk, struct sk_buff *skb,
/* TODO: Fix DSACKs to not fragment already SACKed and we can
* drop this restriction as unnecessary
*/
if (mss != tcp_shift_mss(prev))
if (mss != tcp_skb_seglen(prev))
goto fallback;

if (len == mss) {
Expand Down Expand Up @@ -1578,7 +1573,7 @@ static struct sk_buff *tcp_shift_skb_data(struct sock *sk, struct sk_buff *skb,
if (!skb_can_shift(skb) ||
(skb == tcp_send_head(sk)) ||
((TCP_SKB_CB(skb)->sacked & TCPCB_TAGBITS) != TCPCB_SACKED_ACKED) ||
(mss != tcp_shift_mss(skb)))
(mss != tcp_skb_seglen(skb)))
goto out;

len = skb->len;
Expand Down Expand Up @@ -2853,7 +2848,7 @@ void tcp_simple_retransmit(struct sock *sk)
tcp_for_write_queue(skb, sk) {
if (skb == tcp_send_head(sk))
break;
if (skb->len > mss &&
if (tcp_skb_seglen(skb) > mss &&
!(TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED)) {
if (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_RETRANS) {
TCP_SKB_CB(skb)->sacked &= ~TCPCB_SACKED_RETRANS;
Expand Down

0 comments on commit 775ffab

Please sign in to comment.