diff options
author | Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> | 2008-12-06 01:48:55 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-12-06 01:56:06 -0500 |
commit | d5dd9175bc12015ea4d2c1a9b6b15dfa645a3db9 (patch) | |
tree | 6cf6f64eb1c3e51b0ee0e2a31a2b962e676b1954 | |
parent | 730c30ec646bd252a9448a66ecd51d794853513f (diff) |
tcp: use tcp_write_xmit also in tcp_push_one
tcp_minshall_update is not significant difference since it only
checks for not full-sized skb which is BUG'ed on the push_one
path anyway.
tcp_snd_test is tcp_nagle_test+tcp_cwnd_test+tcp_snd_wnd_test,
just the order changed slightly.
net/ipv4/tcp_output.c:
tcp_snd_test | -89
tcp_mss_split_point | -91
tcp_may_send_now | +53
tcp_cwnd_validate | -98
tso_fragment | -239
__tcp_push_pending_frames | -1340
tcp_push_one | -146
7 functions changed, 53 bytes added, 2003 bytes removed, diff: -1950
net/ipv4/tcp_output.c:
tcp_write_xmit | +1772
1 function changed, 1772 bytes added, diff: +1772
tcp_output.o.new:
8 functions changed, 1825 bytes added, 2003 bytes removed, diff: -178
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv4/tcp_output.c | 54 |
1 files changed, 17 insertions, 37 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 59505ce0c8fd..e65c114feea2 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -1519,7 +1519,8 @@ static int tcp_mtu_probe(struct sock *sk) | |||
1519 | * Returns 1, if no segments are in flight and we have queued segments, but | 1519 | * Returns 1, if no segments are in flight and we have queued segments, but |
1520 | * cannot send anything now because of SWS or another problem. | 1520 | * cannot send anything now because of SWS or another problem. |
1521 | */ | 1521 | */ |
1522 | static int tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle) | 1522 | static int tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle, |
1523 | int push_one, gfp_t gfp) | ||
1523 | { | 1524 | { |
1524 | struct tcp_sock *tp = tcp_sk(sk); | 1525 | struct tcp_sock *tp = tcp_sk(sk); |
1525 | struct sk_buff *skb; | 1526 | struct sk_buff *skb; |
@@ -1529,11 +1530,14 @@ static int tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle) | |||
1529 | 1530 | ||
1530 | sent_pkts = 0; | 1531 | sent_pkts = 0; |
1531 | 1532 | ||
1532 | /* Do MTU probing. */ | 1533 | if (!push_one) { |
1533 | if ((result = tcp_mtu_probe(sk)) == 0) { | 1534 | /* Do MTU probing. */ |
1534 | return 0; | 1535 | result = tcp_mtu_probe(sk); |
1535 | } else if (result > 0) { | 1536 | if (!result) { |
1536 | sent_pkts = 1; | 1537 | return 0; |
1538 | } else if (result > 0) { | ||
1539 | sent_pkts = 1; | ||
1540 | } | ||
1537 | } | 1541 | } |
1538 | 1542 | ||
1539 | while ((skb = tcp_send_head(sk))) { | 1543 | while ((skb = tcp_send_head(sk))) { |
@@ -1555,7 +1559,7 @@ static int tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle) | |||
1555 | nonagle : TCP_NAGLE_PUSH)))) | 1559 | nonagle : TCP_NAGLE_PUSH)))) |
1556 | break; | 1560 | break; |
1557 | } else { | 1561 | } else { |
1558 | if (tcp_tso_should_defer(sk, skb)) | 1562 | if (!push_one && tcp_tso_should_defer(sk, skb)) |
1559 | break; | 1563 | break; |
1560 | } | 1564 | } |
1561 | 1565 | ||
@@ -1570,7 +1574,7 @@ static int tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle) | |||
1570 | 1574 | ||
1571 | TCP_SKB_CB(skb)->when = tcp_time_stamp; | 1575 | TCP_SKB_CB(skb)->when = tcp_time_stamp; |
1572 | 1576 | ||
1573 | if (unlikely(tcp_transmit_skb(sk, skb, 1, GFP_ATOMIC))) | 1577 | if (unlikely(tcp_transmit_skb(sk, skb, 1, gfp))) |
1574 | break; | 1578 | break; |
1575 | 1579 | ||
1576 | /* Advance the send_head. This one is sent out. | 1580 | /* Advance the send_head. This one is sent out. |
@@ -1580,6 +1584,9 @@ static int tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle) | |||
1580 | 1584 | ||
1581 | tcp_minshall_update(tp, mss_now, skb); | 1585 | tcp_minshall_update(tp, mss_now, skb); |
1582 | sent_pkts++; | 1586 | sent_pkts++; |
1587 | |||
1588 | if (push_one) | ||
1589 | break; | ||
1583 | } | 1590 | } |
1584 | 1591 | ||
1585 | if (likely(sent_pkts)) { | 1592 | if (likely(sent_pkts)) { |
@@ -1608,7 +1615,7 @@ void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss, | |||
1608 | if (unlikely(sk->sk_state == TCP_CLOSE)) | 1615 | if (unlikely(sk->sk_state == TCP_CLOSE)) |
1609 | return; | 1616 | return; |
1610 | 1617 | ||
1611 | if (tcp_write_xmit(sk, cur_mss, nonagle)) | 1618 | if (tcp_write_xmit(sk, cur_mss, nonagle, 0, GFP_ATOMIC)) |
1612 | tcp_check_probe_timer(sk); | 1619 | tcp_check_probe_timer(sk); |
1613 | } | 1620 | } |
1614 | 1621 | ||
@@ -1617,38 +1624,11 @@ void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss, | |||
1617 | */ | 1624 | */ |
1618 | void tcp_push_one(struct sock *sk, unsigned int mss_now) | 1625 | void tcp_push_one(struct sock *sk, unsigned int mss_now) |
1619 | { | 1626 | { |
1620 | struct tcp_sock *tp = tcp_sk(sk); | ||
1621 | struct sk_buff *skb = tcp_send_head(sk); | 1627 | struct sk_buff *skb = tcp_send_head(sk); |
1622 | unsigned int tso_segs, cwnd_quota; | ||
1623 | 1628 | ||
1624 | BUG_ON(!skb || skb->len < mss_now); | 1629 | BUG_ON(!skb || skb->len < mss_now); |
1625 | 1630 | ||
1626 | tso_segs = tcp_init_tso_segs(sk, skb, mss_now); | 1631 | tcp_write_xmit(sk, mss_now, TCP_NAGLE_PUSH, 1, sk->sk_allocation); |
1627 | cwnd_quota = tcp_snd_test(sk, skb, mss_now, TCP_NAGLE_PUSH); | ||
1628 | |||
1629 | if (likely(cwnd_quota)) { | ||
1630 | unsigned int limit; | ||
1631 | |||
1632 | BUG_ON(!tso_segs); | ||
1633 | |||
1634 | limit = mss_now; | ||
1635 | if (tso_segs > 1 && !tcp_urg_mode(tp)) | ||
1636 | limit = tcp_mss_split_point(sk, skb, mss_now, | ||
1637 | cwnd_quota); | ||
1638 | |||
1639 | if (skb->len > limit && | ||
1640 | unlikely(tso_fragment(sk, skb, limit, mss_now))) | ||
1641 | return; | ||
1642 | |||
1643 | /* Send it out now. */ | ||
1644 | TCP_SKB_CB(skb)->when = tcp_time_stamp; | ||
1645 | |||
1646 | if (likely(!tcp_transmit_skb(sk, skb, 1, sk->sk_allocation))) { | ||
1647 | tcp_event_new_data_sent(sk, skb); | ||
1648 | tcp_cwnd_validate(sk); | ||
1649 | return; | ||
1650 | } | ||
1651 | } | ||
1652 | } | 1632 | } |
1653 | 1633 | ||
1654 | /* This function returns the amount that we can raise the | 1634 | /* This function returns the amount that we can raise the |