diff options
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r-- | net/ipv4/tcp_input.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index b3def0df14fb..3f884cea14ff 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -935,7 +935,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_ | |||
935 | const struct inet_connection_sock *icsk = inet_csk(sk); | 935 | const struct inet_connection_sock *icsk = inet_csk(sk); |
936 | struct tcp_sock *tp = tcp_sk(sk); | 936 | struct tcp_sock *tp = tcp_sk(sk); |
937 | unsigned char *ptr = ack_skb->h.raw + TCP_SKB_CB(ack_skb)->sacked; | 937 | unsigned char *ptr = ack_skb->h.raw + TCP_SKB_CB(ack_skb)->sacked; |
938 | struct tcp_sack_block *sp = (struct tcp_sack_block *)(ptr+2); | 938 | struct tcp_sack_block_wire *sp = (struct tcp_sack_block_wire *)(ptr+2); |
939 | int num_sacks = (ptr[1] - TCPOLEN_SACK_BASE)>>3; | 939 | int num_sacks = (ptr[1] - TCPOLEN_SACK_BASE)>>3; |
940 | int reord = tp->packets_out; | 940 | int reord = tp->packets_out; |
941 | int prior_fackets; | 941 | int prior_fackets; |
@@ -2239,13 +2239,12 @@ static int tcp_tso_acked(struct sock *sk, struct sk_buff *skb, | |||
2239 | return acked; | 2239 | return acked; |
2240 | } | 2240 | } |
2241 | 2241 | ||
2242 | static u32 tcp_usrtt(const struct sk_buff *skb) | 2242 | static u32 tcp_usrtt(struct timeval *tv) |
2243 | { | 2243 | { |
2244 | struct timeval tv, now; | 2244 | struct timeval now; |
2245 | 2245 | ||
2246 | do_gettimeofday(&now); | 2246 | do_gettimeofday(&now); |
2247 | skb_get_timestamp(skb, &tv); | 2247 | return (now.tv_sec - tv->tv_sec) * 1000000 + (now.tv_usec - tv->tv_usec); |
2248 | return (now.tv_sec - tv.tv_sec) * 1000000 + (now.tv_usec - tv.tv_usec); | ||
2249 | } | 2248 | } |
2250 | 2249 | ||
2251 | /* Remove acknowledged frames from the retransmission queue. */ | 2250 | /* Remove acknowledged frames from the retransmission queue. */ |
@@ -2260,6 +2259,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p) | |||
2260 | u32 pkts_acked = 0; | 2259 | u32 pkts_acked = 0; |
2261 | void (*rtt_sample)(struct sock *sk, u32 usrtt) | 2260 | void (*rtt_sample)(struct sock *sk, u32 usrtt) |
2262 | = icsk->icsk_ca_ops->rtt_sample; | 2261 | = icsk->icsk_ca_ops->rtt_sample; |
2262 | struct timeval tv; | ||
2263 | 2263 | ||
2264 | while ((skb = skb_peek(&sk->sk_write_queue)) && | 2264 | while ((skb = skb_peek(&sk->sk_write_queue)) && |
2265 | skb != sk->sk_send_head) { | 2265 | skb != sk->sk_send_head) { |
@@ -2308,8 +2308,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p) | |||
2308 | seq_rtt = -1; | 2308 | seq_rtt = -1; |
2309 | } else if (seq_rtt < 0) { | 2309 | } else if (seq_rtt < 0) { |
2310 | seq_rtt = now - scb->when; | 2310 | seq_rtt = now - scb->when; |
2311 | if (rtt_sample) | 2311 | skb_get_timestamp(skb, &tv); |
2312 | (*rtt_sample)(sk, tcp_usrtt(skb)); | ||
2313 | } | 2312 | } |
2314 | if (sacked & TCPCB_SACKED_ACKED) | 2313 | if (sacked & TCPCB_SACKED_ACKED) |
2315 | tp->sacked_out -= tcp_skb_pcount(skb); | 2314 | tp->sacked_out -= tcp_skb_pcount(skb); |
@@ -2322,8 +2321,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p) | |||
2322 | } | 2321 | } |
2323 | } else if (seq_rtt < 0) { | 2322 | } else if (seq_rtt < 0) { |
2324 | seq_rtt = now - scb->when; | 2323 | seq_rtt = now - scb->when; |
2325 | if (rtt_sample) | 2324 | skb_get_timestamp(skb, &tv); |
2326 | (*rtt_sample)(sk, tcp_usrtt(skb)); | ||
2327 | } | 2325 | } |
2328 | tcp_dec_pcount_approx(&tp->fackets_out, skb); | 2326 | tcp_dec_pcount_approx(&tp->fackets_out, skb); |
2329 | tcp_packets_out_dec(tp, skb); | 2327 | tcp_packets_out_dec(tp, skb); |
@@ -2335,6 +2333,8 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p) | |||
2335 | if (acked&FLAG_ACKED) { | 2333 | if (acked&FLAG_ACKED) { |
2336 | tcp_ack_update_rtt(sk, acked, seq_rtt); | 2334 | tcp_ack_update_rtt(sk, acked, seq_rtt); |
2337 | tcp_ack_packets_out(sk, tp); | 2335 | tcp_ack_packets_out(sk, tp); |
2336 | if (rtt_sample && !(acked & FLAG_RETRANS_DATA_ACKED)) | ||
2337 | (*rtt_sample)(sk, tcp_usrtt(&tv)); | ||
2338 | 2338 | ||
2339 | if (icsk->icsk_ca_ops->pkts_acked) | 2339 | if (icsk->icsk_ca_ops->pkts_acked) |
2340 | icsk->icsk_ca_ops->pkts_acked(sk, pkts_acked); | 2340 | icsk->icsk_ca_ops->pkts_acked(sk, pkts_acked); |
@@ -2629,7 +2629,7 @@ void tcp_parse_options(struct sk_buff *skb, struct tcp_options_received *opt_rx, | |||
2629 | switch(opcode) { | 2629 | switch(opcode) { |
2630 | case TCPOPT_MSS: | 2630 | case TCPOPT_MSS: |
2631 | if(opsize==TCPOLEN_MSS && th->syn && !estab) { | 2631 | if(opsize==TCPOLEN_MSS && th->syn && !estab) { |
2632 | u16 in_mss = ntohs(get_unaligned((__u16 *)ptr)); | 2632 | u16 in_mss = ntohs(get_unaligned((__be16 *)ptr)); |
2633 | if (in_mss) { | 2633 | if (in_mss) { |
2634 | if (opt_rx->user_mss && opt_rx->user_mss < in_mss) | 2634 | if (opt_rx->user_mss && opt_rx->user_mss < in_mss) |
2635 | in_mss = opt_rx->user_mss; | 2635 | in_mss = opt_rx->user_mss; |
@@ -2657,8 +2657,8 @@ void tcp_parse_options(struct sk_buff *skb, struct tcp_options_received *opt_rx, | |||
2657 | if ((estab && opt_rx->tstamp_ok) || | 2657 | if ((estab && opt_rx->tstamp_ok) || |
2658 | (!estab && sysctl_tcp_timestamps)) { | 2658 | (!estab && sysctl_tcp_timestamps)) { |
2659 | opt_rx->saw_tstamp = 1; | 2659 | opt_rx->saw_tstamp = 1; |
2660 | opt_rx->rcv_tsval = ntohl(get_unaligned((__u32 *)ptr)); | 2660 | opt_rx->rcv_tsval = ntohl(get_unaligned((__be32 *)ptr)); |
2661 | opt_rx->rcv_tsecr = ntohl(get_unaligned((__u32 *)(ptr+4))); | 2661 | opt_rx->rcv_tsecr = ntohl(get_unaligned((__be32 *)(ptr+4))); |
2662 | } | 2662 | } |
2663 | } | 2663 | } |
2664 | break; | 2664 | break; |
@@ -2695,8 +2695,8 @@ static int tcp_fast_parse_options(struct sk_buff *skb, struct tcphdr *th, | |||
2695 | return 0; | 2695 | return 0; |
2696 | } else if (tp->rx_opt.tstamp_ok && | 2696 | } else if (tp->rx_opt.tstamp_ok && |
2697 | th->doff == (sizeof(struct tcphdr)>>2)+(TCPOLEN_TSTAMP_ALIGNED>>2)) { | 2697 | th->doff == (sizeof(struct tcphdr)>>2)+(TCPOLEN_TSTAMP_ALIGNED>>2)) { |
2698 | __u32 *ptr = (__u32 *)(th + 1); | 2698 | __be32 *ptr = (__be32 *)(th + 1); |
2699 | if (*ptr == ntohl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | 2699 | if (*ptr == htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
2700 | | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)) { | 2700 | | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)) { |
2701 | tp->rx_opt.saw_tstamp = 1; | 2701 | tp->rx_opt.saw_tstamp = 1; |
2702 | ++ptr; | 2702 | ++ptr; |
@@ -3911,10 +3911,10 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb, | |||
3911 | 3911 | ||
3912 | /* Check timestamp */ | 3912 | /* Check timestamp */ |
3913 | if (tcp_header_len == sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED) { | 3913 | if (tcp_header_len == sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED) { |
3914 | __u32 *ptr = (__u32 *)(th + 1); | 3914 | __be32 *ptr = (__be32 *)(th + 1); |
3915 | 3915 | ||
3916 | /* No? Slow path! */ | 3916 | /* No? Slow path! */ |
3917 | if (*ptr != ntohl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | 3917 | if (*ptr != htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
3918 | | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)) | 3918 | | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)) |
3919 | goto slow_path; | 3919 | goto slow_path; |
3920 | 3920 | ||