Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 4139
b: refs/heads/master
c: aa93466
h: refs/heads/master
i:
  4137: 5af3dc2
  4135: 6d211f8
v: v3
  • Loading branch information
David S. Miller committed Jul 5, 2005
1 parent 4b5a42e commit 3c20fd0
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7f4dd0a9438c73cbb1c240ece31390cf2c57294e
refs/heads/master: aa93466bdfd901b926e033801f0b82b3eaa67be2
40 changes: 31 additions & 9 deletions trunk/net/ipv4/tcp_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,7 @@ static int tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle)
{
struct tcp_sock *tp = tcp_sk(sk);
struct sk_buff *skb;
unsigned int tso_segs, cwnd_quota;
int sent_pkts;

/* If we are closed, the bytes will have to remain here.
Expand All @@ -896,19 +897,31 @@ static int tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle)
if (unlikely(sk->sk_state == TCP_CLOSE))
return 0;

skb = sk->sk_send_head;
if (unlikely(!skb))
return 0;

tso_segs = tcp_init_tso_segs(sk, skb);
cwnd_quota = tcp_cwnd_test(tp, skb);
sent_pkts = 0;
while ((skb = sk->sk_send_head) &&
tcp_snd_test(sk, skb, mss_now,
tcp_skb_is_last(sk, skb) ? nonagle :
TCP_NAGLE_PUSH)) {
if (skb->len > mss_now) {
if (tcp_fragment(sk, skb, mss_now))

while (cwnd_quota >= tso_segs) {
if (unlikely(!tcp_nagle_test(tp, skb, mss_now,
(tcp_skb_is_last(sk, skb) ?
nonagle : TCP_NAGLE_PUSH))))
break;

if (unlikely(!tcp_snd_wnd_test(tp, skb, mss_now)))
break;

if (unlikely(skb->len > mss_now)) {
if (unlikely(tcp_fragment(sk, skb, mss_now)))
break;
}

TCP_SKB_CB(skb)->when = tcp_time_stamp;
tcp_tso_set_push(skb);
if (tcp_transmit_skb(sk, skb_clone(skb, GFP_ATOMIC)))
if (unlikely(tcp_transmit_skb(sk, skb_clone(skb, GFP_ATOMIC))))
break;

/* Advance the send_head. This one is sent out.
Expand All @@ -917,10 +930,19 @@ static int tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle)
update_send_head(sk, tp, skb);

tcp_minshall_update(tp, mss_now, skb);
sent_pkts = 1;
sent_pkts++;

/* Do not optimize this to use tso_segs. If we chopped up
* the packet above, tso_segs will no longer be valid.
*/
cwnd_quota -= tcp_skb_pcount(skb);
skb = sk->sk_send_head;
if (!skb)
break;
tso_segs = tcp_init_tso_segs(sk, skb);
}

if (sent_pkts) {
if (likely(sent_pkts)) {
tcp_cwnd_validate(sk, tp);
return 0;
}
Expand Down

0 comments on commit 3c20fd0

Please sign in to comment.