Commit adf07569 authored by David S. Miller's avatar David S. Miller

[TCP]: Fix tcp_set_skb_tso_factor() calcs.

We divide by the wrong MSS.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cc982e41
...@@ -1468,7 +1468,7 @@ tcp_nagle_check(struct tcp_opt *tp, struct sk_buff *skb, unsigned mss_now, int n ...@@ -1468,7 +1468,7 @@ tcp_nagle_check(struct tcp_opt *tp, struct sk_buff *skb, unsigned mss_now, int n
tcp_minshall_check(tp)))); tcp_minshall_check(tp))));
} }
extern void tcp_set_skb_tso_factor(struct sk_buff *, unsigned int, unsigned int); extern void tcp_set_skb_tso_factor(struct sk_buff *, unsigned int);
/* This checks if the data bearing packet SKB (usually sk->sk_send_head) /* This checks if the data bearing packet SKB (usually sk->sk_send_head)
* should be put on the wire right now. * should be put on the wire right now.
...@@ -1479,7 +1479,7 @@ static __inline__ int tcp_snd_test(struct tcp_opt *tp, struct sk_buff *skb, ...@@ -1479,7 +1479,7 @@ static __inline__ int tcp_snd_test(struct tcp_opt *tp, struct sk_buff *skb,
int pkts = TCP_SKB_CB(skb)->tso_factor; int pkts = TCP_SKB_CB(skb)->tso_factor;
if (!pkts) { if (!pkts) {
tcp_set_skb_tso_factor(skb, cur_mss, tp->mss_cache_std); tcp_set_skb_tso_factor(skb, tp->mss_cache_std);
pkts = TCP_SKB_CB(skb)->tso_factor; pkts = TCP_SKB_CB(skb)->tso_factor;
} }
......
...@@ -422,8 +422,7 @@ void tcp_push_one(struct sock *sk, unsigned cur_mss) ...@@ -422,8 +422,7 @@ void tcp_push_one(struct sock *sk, unsigned cur_mss)
} }
} }
void tcp_set_skb_tso_factor(struct sk_buff *skb, unsigned int mss, void tcp_set_skb_tso_factor(struct sk_buff *skb, unsigned int mss_std)
unsigned int mss_std)
{ {
if (skb->len <= mss_std) { if (skb->len <= mss_std) {
/* Avoid the costly divide in the normal /* Avoid the costly divide in the normal
...@@ -434,7 +433,7 @@ void tcp_set_skb_tso_factor(struct sk_buff *skb, unsigned int mss, ...@@ -434,7 +433,7 @@ void tcp_set_skb_tso_factor(struct sk_buff *skb, unsigned int mss,
unsigned int factor; unsigned int factor;
factor = skb->len + (mss_std - 1); factor = skb->len + (mss_std - 1);
factor /= mss; factor /= mss_std;
TCP_SKB_CB(skb)->tso_factor = factor; TCP_SKB_CB(skb)->tso_factor = factor;
} }
} }
...@@ -501,8 +500,8 @@ static int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len) ...@@ -501,8 +500,8 @@ static int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len)
TCP_SKB_CB(buff)->when = TCP_SKB_CB(skb)->when; TCP_SKB_CB(buff)->when = TCP_SKB_CB(skb)->when;
/* Fix up tso_factor for both original and new SKB. */ /* Fix up tso_factor for both original and new SKB. */
tcp_set_skb_tso_factor(skb, tp->mss_cache, tp->mss_cache_std); tcp_set_skb_tso_factor(skb, tp->mss_cache_std);
tcp_set_skb_tso_factor(buff, tp->mss_cache, tp->mss_cache_std); tcp_set_skb_tso_factor(buff, tp->mss_cache_std);
/* Link BUFF into the send queue. */ /* Link BUFF into the send queue. */
__skb_append(skb, buff); __skb_append(skb, buff);
...@@ -1561,7 +1560,7 @@ int tcp_write_wakeup(struct sock *sk) ...@@ -1561,7 +1560,7 @@ int tcp_write_wakeup(struct sock *sk)
tp->mss_cache = tp->mss_cache_std; tp->mss_cache = tp->mss_cache_std;
} }
} else if (!TCP_SKB_CB(skb)->tso_factor) } else if (!TCP_SKB_CB(skb)->tso_factor)
tcp_set_skb_tso_factor(skb, mss, tp->mss_cache_std); tcp_set_skb_tso_factor(skb, tp->mss_cache_std);
TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_PSH; TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_PSH;
TCP_SKB_CB(skb)->when = tcp_time_stamp; TCP_SKB_CB(skb)->when = tcp_time_stamp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment