diff options
author | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2005-12-14 02:26:10 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-01-03 16:10:58 -0500 |
commit | d83d8461f902c672bc1bd8fbc6a94e19f092da97 (patch) | |
tree | 0534c553ab92baa2eb9dbb5bba64f2c4540b1e89 /net/ipv4/tcp_output.c | |
parent | 22712813620fa8e682dbfb253a60ca0131da1e07 (diff) |
[IP_SOCKGLUE]: Remove most of the tcp specific calls
As DCCP needs to be called in the same spots.
Now we have a member in inet_sock (is_icsk), set at sock creation time from
struct inet_protosw->flags (if INET_PROTOSW_ICSK is set, like for TCP and
DCCP) to see if a struct sock instance is a inet_connection_sock for places
like the ones in ip_sockglue.c (v4 and v6) where we previously were looking if
sk_type was SOCK_STREAM, that is insufficient because we now use the same code
for DCCP, that has sk_type SOCK_DCCP.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_output.c')
-rw-r--r-- | net/ipv4/tcp_output.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index af1946c52c37..3a0a914de917 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -621,7 +621,7 @@ int tcp_trim_head(struct sock *sk, struct sk_buff *skb, u32 len) | |||
621 | It is minimum of user_mss and mss received with SYN. | 621 | It is minimum of user_mss and mss received with SYN. |
622 | It also does not include TCP options. | 622 | It also does not include TCP options. |
623 | 623 | ||
624 | tp->pmtu_cookie is last pmtu, seen by this function. | 624 | inet_csk(sk)->icsk_pmtu_cookie is last pmtu, seen by this function. |
625 | 625 | ||
626 | tp->mss_cache is current effective sending mss, including | 626 | tp->mss_cache is current effective sending mss, including |
627 | all tcp options except for SACKs. It is evaluated, | 627 | all tcp options except for SACKs. It is evaluated, |
@@ -631,17 +631,18 @@ int tcp_trim_head(struct sock *sk, struct sk_buff *skb, u32 len) | |||
631 | NOTE1. rfc1122 clearly states that advertised MSS | 631 | NOTE1. rfc1122 clearly states that advertised MSS |
632 | DOES NOT include either tcp or ip options. | 632 | DOES NOT include either tcp or ip options. |
633 | 633 | ||
634 | NOTE2. tp->pmtu_cookie and tp->mss_cache are READ ONLY outside | 634 | NOTE2. inet_csk(sk)->icsk_pmtu_cookie and tp->mss_cache |
635 | this function. --ANK (980731) | 635 | are READ ONLY outside this function. --ANK (980731) |
636 | */ | 636 | */ |
637 | 637 | ||
638 | unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu) | 638 | unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu) |
639 | { | 639 | { |
640 | struct tcp_sock *tp = tcp_sk(sk); | 640 | struct tcp_sock *tp = tcp_sk(sk); |
641 | struct inet_connection_sock *icsk = inet_csk(sk); | ||
641 | /* Calculate base mss without TCP options: | 642 | /* Calculate base mss without TCP options: |
642 | It is MMS_S - sizeof(tcphdr) of rfc1122 | 643 | It is MMS_S - sizeof(tcphdr) of rfc1122 |
643 | */ | 644 | */ |
644 | int mss_now = (pmtu - inet_csk(sk)->icsk_af_ops->net_header_len - | 645 | int mss_now = (pmtu - icsk->icsk_af_ops->net_header_len - |
645 | sizeof(struct tcphdr)); | 646 | sizeof(struct tcphdr)); |
646 | 647 | ||
647 | /* Clamp it (mss_clamp does not include tcp options) */ | 648 | /* Clamp it (mss_clamp does not include tcp options) */ |
@@ -649,7 +650,7 @@ unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu) | |||
649 | mss_now = tp->rx_opt.mss_clamp; | 650 | mss_now = tp->rx_opt.mss_clamp; |
650 | 651 | ||
651 | /* Now subtract optional transport overhead */ | 652 | /* Now subtract optional transport overhead */ |
652 | mss_now -= tp->ext_header_len; | 653 | mss_now -= icsk->icsk_ext_hdr_len; |
653 | 654 | ||
654 | /* Then reserve room for full set of TCP options and 8 bytes of data */ | 655 | /* Then reserve room for full set of TCP options and 8 bytes of data */ |
655 | if (mss_now < 48) | 656 | if (mss_now < 48) |
@@ -663,7 +664,7 @@ unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu) | |||
663 | mss_now = max((tp->max_window>>1), 68U - tp->tcp_header_len); | 664 | mss_now = max((tp->max_window>>1), 68U - tp->tcp_header_len); |
664 | 665 | ||
665 | /* And store cached results */ | 666 | /* And store cached results */ |
666 | tp->pmtu_cookie = pmtu; | 667 | icsk->icsk_pmtu_cookie = pmtu; |
667 | tp->mss_cache = mss_now; | 668 | tp->mss_cache = mss_now; |
668 | 669 | ||
669 | return mss_now; | 670 | return mss_now; |
@@ -693,7 +694,7 @@ unsigned int tcp_current_mss(struct sock *sk, int large_allowed) | |||
693 | 694 | ||
694 | if (dst) { | 695 | if (dst) { |
695 | u32 mtu = dst_mtu(dst); | 696 | u32 mtu = dst_mtu(dst); |
696 | if (mtu != tp->pmtu_cookie) | 697 | if (mtu != inet_csk(sk)->icsk_pmtu_cookie) |
697 | mss_now = tcp_sync_mss(sk, mtu); | 698 | mss_now = tcp_sync_mss(sk, mtu); |
698 | } | 699 | } |
699 | 700 | ||
@@ -706,7 +707,8 @@ unsigned int tcp_current_mss(struct sock *sk, int large_allowed) | |||
706 | if (doing_tso) { | 707 | if (doing_tso) { |
707 | xmit_size_goal = (65535 - | 708 | xmit_size_goal = (65535 - |
708 | inet_csk(sk)->icsk_af_ops->net_header_len - | 709 | inet_csk(sk)->icsk_af_ops->net_header_len - |
709 | tp->ext_header_len - tp->tcp_header_len); | 710 | inet_csk(sk)->icsk_ext_hdr_len - |
711 | tp->tcp_header_len); | ||
710 | 712 | ||
711 | if (tp->max_window && | 713 | if (tp->max_window && |
712 | (xmit_size_goal > (tp->max_window >> 1))) | 714 | (xmit_size_goal > (tp->max_window >> 1))) |