Lines Matching refs:tp
383 struct tcp_sock *tp = tcp_sk(sk); in tcp_init_sock() local
385 tp->out_of_order_queue = RB_ROOT; in tcp_init_sock()
387 tcp_prequeue_init(tp); in tcp_init_sock()
388 INIT_LIST_HEAD(&tp->tsq_node); in tcp_init_sock()
391 tp->mdev_us = jiffies_to_usecs(TCP_TIMEOUT_INIT); in tcp_init_sock()
392 tp->rtt_min[0].rtt = ~0U; in tcp_init_sock()
399 tp->snd_cwnd = TCP_INIT_CWND; in tcp_init_sock()
404 tp->snd_ssthresh = TCP_INFINITE_SSTHRESH; in tcp_init_sock()
405 tp->snd_cwnd_clamp = ~0; in tcp_init_sock()
406 tp->mss_cache = TCP_MSS_DEFAULT; in tcp_init_sock()
407 u64_stats_init(&tp->syncp); in tcp_init_sock()
409 tp->reordering = sysctl_tcp_reordering; in tcp_init_sock()
410 tcp_enable_early_retrans(tp); in tcp_init_sock()
413 tp->tsoffset = 0; in tcp_init_sock()
454 const struct tcp_sock *tp = tcp_sk(sk); in tcp_poll() local
506 (state != TCP_SYN_RECV || tp->fastopen_rsk)) { in tcp_poll()
509 if (tp->urg_seq == tp->copied_seq && in tcp_poll()
511 tp->urg_data) in tcp_poll()
514 if (tp->rcv_nxt - tp->copied_seq >= target) in tcp_poll()
536 if (tp->urg_data & TCP_URG_VALID) in tcp_poll()
550 struct tcp_sock *tp = tcp_sk(sk); in tcp_ioctl() local
563 !tp->urg_data || in tcp_ioctl()
564 before(tp->urg_seq, tp->copied_seq) || in tcp_ioctl()
565 !before(tp->urg_seq, tp->rcv_nxt)) { in tcp_ioctl()
567 answ = tp->rcv_nxt - tp->copied_seq; in tcp_ioctl()
573 answ = tp->urg_seq - tp->copied_seq; in tcp_ioctl()
577 answ = tp->urg_data && tp->urg_seq == tp->copied_seq; in tcp_ioctl()
586 answ = tp->write_seq - tp->snd_una; in tcp_ioctl()
595 answ = tp->write_seq - tp->snd_nxt; in tcp_ioctl()
605 static inline void tcp_mark_push(struct tcp_sock *tp, struct sk_buff *skb) in tcp_mark_push() argument
608 tp->pushed_seq = tp->write_seq; in tcp_mark_push()
611 static inline bool forced_push(const struct tcp_sock *tp) in forced_push() argument
613 return after(tp->write_seq, tp->pushed_seq + (tp->max_window >> 1)); in forced_push()
618 struct tcp_sock *tp = tcp_sk(sk); in skb_entail() local
622 tcb->seq = tcb->end_seq = tp->write_seq; in skb_entail()
629 if (tp->nonagle & TCP_NAGLE_PUSH) in skb_entail()
630 tp->nonagle &= ~TCP_NAGLE_PUSH; in skb_entail()
635 static inline void tcp_mark_urg(struct tcp_sock *tp, int flags) in tcp_mark_urg() argument
638 tp->snd_up = tp->write_seq; in tcp_mark_urg()
663 struct tcp_sock *tp = tcp_sk(sk); in tcp_push() local
670 if (!(flags & MSG_MORE) || forced_push(tp)) in tcp_push()
671 tcp_mark_push(tp, skb); in tcp_push()
673 tcp_mark_urg(tp, flags); in tcp_push()
678 if (!test_bit(TSQ_THROTTLED, &tp->tsq_flags)) { in tcp_push()
680 set_bit(TSQ_THROTTLED, &tp->tsq_flags); in tcp_push()
863 struct tcp_sock *tp = tcp_sk(sk); in tcp_xmit_size_goal() local
871 new_size_goal = tcp_bound_to_half_wnd(tp, new_size_goal); in tcp_xmit_size_goal()
874 size_goal = tp->gso_segs * mss_now; in tcp_xmit_size_goal()
877 tp->gso_segs = min_t(u16, new_size_goal / mss_now, in tcp_xmit_size_goal()
879 size_goal = tp->gso_segs * mss_now; in tcp_xmit_size_goal()
898 struct tcp_sock *tp = tcp_sk(sk); in do_tcp_sendpages() local
949 tcp_mark_push(tp, skb); in do_tcp_sendpages()
969 tp->write_seq += copy; in do_tcp_sendpages()
987 if (forced_push(tp)) { in do_tcp_sendpages()
988 tcp_mark_push(tp, skb); in do_tcp_sendpages()
1009 tcp_push(sk, flags, mss_now, tp->nonagle, size_goal); in do_tcp_sendpages()
1041 const struct tcp_sock *tp = tcp_sk(sk); in select_size() local
1042 int tmp = tp->mss_cache; in select_size()
1062 void tcp_free_fastopen_req(struct tcp_sock *tp) in tcp_free_fastopen_req() argument
1064 if (tp->fastopen_req) { in tcp_free_fastopen_req()
1065 kfree(tp->fastopen_req); in tcp_free_fastopen_req()
1066 tp->fastopen_req = NULL; in tcp_free_fastopen_req()
1073 struct tcp_sock *tp = tcp_sk(sk); in tcp_sendmsg_fastopen() local
1081 if (tp->fastopen_req) in tcp_sendmsg_fastopen()
1084 tp->fastopen_req = kzalloc(sizeof(struct tcp_fastopen_request), in tcp_sendmsg_fastopen()
1086 if (unlikely(!tp->fastopen_req)) in tcp_sendmsg_fastopen()
1088 tp->fastopen_req->data = msg; in tcp_sendmsg_fastopen()
1089 tp->fastopen_req->size = size; in tcp_sendmsg_fastopen()
1094 *copied = tp->fastopen_req->copied; in tcp_sendmsg_fastopen()
1095 tcp_free_fastopen_req(tp); in tcp_sendmsg_fastopen()
1101 struct tcp_sock *tp = tcp_sk(sk); in tcp_sendmsg() local
1111 if ((flags & MSG_FASTOPEN) && !tp->repair) { in tcp_sendmsg()
1132 if (unlikely(tp->repair)) { in tcp_sendmsg()
1133 if (tp->repair_queue == TCP_RECV_QUEUE) { in tcp_sendmsg()
1139 if (tp->repair_queue == TCP_NO_QUEUE) in tcp_sendmsg()
1199 if (tp->repair) in tcp_sendmsg()
1225 tcp_mark_push(tp, skb); in tcp_sendmsg()
1257 tp->write_seq += copy; in tcp_sendmsg()
1267 if (skb->len < max || (flags & MSG_OOB) || unlikely(tp->repair)) in tcp_sendmsg()
1270 if (forced_push(tp)) { in tcp_sendmsg()
1271 tcp_mark_push(tp, skb); in tcp_sendmsg()
1293 tcp_push(sk, flags, mss_now, tp->nonagle, size_goal); in tcp_sendmsg()
1328 struct tcp_sock *tp = tcp_sk(sk); in tcp_recv_urg() local
1331 if (sock_flag(sk, SOCK_URGINLINE) || !tp->urg_data || in tcp_recv_urg()
1332 tp->urg_data == TCP_URG_READ) in tcp_recv_urg()
1338 if (tp->urg_data & TCP_URG_VALID) { in tcp_recv_urg()
1340 char c = tp->urg_data; in tcp_recv_urg()
1343 tp->urg_data = TCP_URG_READ; in tcp_recv_urg()
1396 struct tcp_sock *tp = tcp_sk(sk); in tcp_cleanup_rbuf() local
1401 WARN(skb && !before(tp->copied_seq, TCP_SKB_CB(skb)->end_seq), in tcp_cleanup_rbuf()
1403 tp->copied_seq, TCP_SKB_CB(skb)->end_seq, tp->rcv_nxt); in tcp_cleanup_rbuf()
1411 tp->rcv_nxt - tp->rcv_wup > icsk->icsk_ack.rcv_mss || in tcp_cleanup_rbuf()
1433 __u32 rcv_window_now = tcp_receive_window(tp); in tcp_cleanup_rbuf()
1436 if (2*rcv_window_now <= tp->window_clamp) { in tcp_cleanup_rbuf()
1455 struct tcp_sock *tp = tcp_sk(sk); in tcp_prequeue_process() local
1462 while ((skb = __skb_dequeue(&tp->ucopy.prequeue)) != NULL) in tcp_prequeue_process()
1467 tp->ucopy.memory = 0; in tcp_prequeue_process()
1507 struct tcp_sock *tp = tcp_sk(sk); in tcp_read_sock() local
1508 u32 seq = tp->copied_seq; in tcp_read_sock()
1521 if (tp->urg_data) { in tcp_read_sock()
1522 u32 urg_offset = tp->urg_seq - seq; in tcp_read_sock()
1560 tp->copied_seq = seq; in tcp_read_sock()
1562 tp->copied_seq = seq; in tcp_read_sock()
1586 struct tcp_sock *tp = tcp_sk(sk); in tcp_recvmsg() local
1617 if (unlikely(tp->repair)) { in tcp_recvmsg()
1622 if (tp->repair_queue == TCP_SEND_QUEUE) in tcp_recvmsg()
1626 if (tp->repair_queue == TCP_NO_QUEUE) in tcp_recvmsg()
1632 seq = &tp->copied_seq; in tcp_recvmsg()
1634 peek_seq = tp->copied_seq; in tcp_recvmsg()
1644 if (tp->urg_data && tp->urg_seq == *seq) { in tcp_recvmsg()
1663 *seq, TCP_SKB_CB(skb)->seq, tp->rcv_nxt, in tcp_recvmsg()
1676 *seq, TCP_SKB_CB(skb)->seq, tp->rcv_nxt, flags); in tcp_recvmsg()
1727 if (!sysctl_tcp_low_latency && tp->ucopy.task == user_recv) { in tcp_recvmsg()
1731 tp->ucopy.task = user_recv; in tcp_recvmsg()
1732 tp->ucopy.msg = msg; in tcp_recvmsg()
1735 tp->ucopy.len = len; in tcp_recvmsg()
1737 WARN_ON(tp->copied_seq != tp->rcv_nxt && in tcp_recvmsg()
1766 if (!skb_queue_empty(&tp->ucopy.prequeue)) in tcp_recvmsg()
1785 chunk = len - tp->ucopy.len; in tcp_recvmsg()
1792 if (tp->rcv_nxt == tp->copied_seq && in tcp_recvmsg()
1793 !skb_queue_empty(&tp->ucopy.prequeue)) { in tcp_recvmsg()
1797 chunk = len - tp->ucopy.len; in tcp_recvmsg()
1806 (peek_seq - copied - urg_hole != tp->copied_seq)) { in tcp_recvmsg()
1810 peek_seq = tp->copied_seq; in tcp_recvmsg()
1821 if (tp->urg_data) { in tcp_recvmsg()
1822 u32 urg_offset = tp->urg_seq - *seq; in tcp_recvmsg()
1855 if (tp->urg_data && after(tp->copied_seq, tp->urg_seq)) { in tcp_recvmsg()
1856 tp->urg_data = 0; in tcp_recvmsg()
1877 if (!skb_queue_empty(&tp->ucopy.prequeue)) { in tcp_recvmsg()
1880 tp->ucopy.len = copied > 0 ? len : 0; in tcp_recvmsg()
1884 if (copied > 0 && (chunk = len - tp->ucopy.len) != 0) { in tcp_recvmsg()
1891 tp->ucopy.task = NULL; in tcp_recvmsg()
1892 tp->ucopy.len = 0; in tcp_recvmsg()
2154 struct tcp_sock *tp = tcp_sk(sk); in tcp_close() local
2155 if (tp->linger2 < 0) { in tcp_close()
2217 struct tcp_sock *tp = tcp_sk(sk); in tcp_disconnect() local
2227 } else if (unlikely(tp->repair)) { in tcp_disconnect()
2230 (tp->snd_nxt != tp->write_seq && in tcp_disconnect()
2243 skb_rbtree_purge(&tp->out_of_order_queue); in tcp_disconnect()
2252 tp->srtt_us = 0; in tcp_disconnect()
2253 tp->write_seq += tp->max_window + 2; in tcp_disconnect()
2254 if (tp->write_seq == 0) in tcp_disconnect()
2255 tp->write_seq = 1; in tcp_disconnect()
2256 tp->snd_cwnd = 2; in tcp_disconnect()
2258 tp->packets_out = 0; in tcp_disconnect()
2259 tp->snd_ssthresh = TCP_INFINITE_SSTHRESH; in tcp_disconnect()
2260 tp->snd_cwnd_cnt = 0; in tcp_disconnect()
2261 tp->window_clamp = 0; in tcp_disconnect()
2266 tcp_clear_retrans(tp); in tcp_disconnect()
2267 tp->total_retrans = 0; in tcp_disconnect()
2274 memset(&tp->rx_opt, 0, sizeof(tp->rx_opt)); in tcp_disconnect()
2278 tcp_saved_syn_free(tp); in tcp_disconnect()
2279 tp->segs_in = 0; in tcp_disconnect()
2280 tp->segs_out = 0; in tcp_disconnect()
2281 tp->bytes_acked = 0; in tcp_disconnect()
2282 tp->bytes_received = 0; in tcp_disconnect()
2303 static int tcp_repair_options_est(struct tcp_sock *tp, in tcp_repair_options_est() argument
2317 tp->rx_opt.mss_clamp = opt.opt_val; in tcp_repair_options_est()
2327 tp->rx_opt.snd_wscale = snd_wscale; in tcp_repair_options_est()
2328 tp->rx_opt.rcv_wscale = rcv_wscale; in tcp_repair_options_est()
2329 tp->rx_opt.wscale_ok = 1; in tcp_repair_options_est()
2336 tp->rx_opt.sack_ok |= TCP_SACK_SEEN; in tcp_repair_options_est()
2338 tcp_enable_fack(tp); in tcp_repair_options_est()
2344 tp->rx_opt.tstamp_ok = 1; in tcp_repair_options_est()
2358 struct tcp_sock *tp = tcp_sk(sk); in do_tcp_setsockopt() local
2404 tp->rx_opt.user_mss = val; in do_tcp_setsockopt()
2417 tp->nonagle |= TCP_NAGLE_OFF|TCP_NAGLE_PUSH; in do_tcp_setsockopt()
2420 tp->nonagle &= ~TCP_NAGLE_OFF; in do_tcp_setsockopt()
2428 tp->thin_lto = val; in do_tcp_setsockopt()
2435 tp->thin_dupack = val; in do_tcp_setsockopt()
2436 if (tp->thin_dupack) in do_tcp_setsockopt()
2437 tcp_disable_early_retrans(tp); in do_tcp_setsockopt()
2445 tp->repair = 1; in do_tcp_setsockopt()
2447 tp->repair_queue = TCP_NO_QUEUE; in do_tcp_setsockopt()
2449 tp->repair = 0; in do_tcp_setsockopt()
2458 if (!tp->repair) in do_tcp_setsockopt()
2461 tp->repair_queue = val; in do_tcp_setsockopt()
2469 else if (tp->repair_queue == TCP_SEND_QUEUE) in do_tcp_setsockopt()
2470 tp->write_seq = val; in do_tcp_setsockopt()
2471 else if (tp->repair_queue == TCP_RECV_QUEUE) in do_tcp_setsockopt()
2472 tp->rcv_nxt = val; in do_tcp_setsockopt()
2478 if (!tp->repair) in do_tcp_setsockopt()
2481 err = tcp_repair_options_est(tp, in do_tcp_setsockopt()
2501 tp->nonagle |= TCP_NAGLE_CORK; in do_tcp_setsockopt()
2503 tp->nonagle &= ~TCP_NAGLE_CORK; in do_tcp_setsockopt()
2504 if (tp->nonagle&TCP_NAGLE_OFF) in do_tcp_setsockopt()
2505 tp->nonagle |= TCP_NAGLE_PUSH; in do_tcp_setsockopt()
2514 tp->keepalive_time = val * HZ; in do_tcp_setsockopt()
2518 u32 elapsed = keepalive_time_elapsed(tp); in do_tcp_setsockopt()
2519 if (tp->keepalive_time > elapsed) in do_tcp_setsockopt()
2520 elapsed = tp->keepalive_time - elapsed; in do_tcp_setsockopt()
2531 tp->keepalive_intvl = val * HZ; in do_tcp_setsockopt()
2537 tp->keepalive_probes = val; in do_tcp_setsockopt()
2550 tp->save_syn = val; in do_tcp_setsockopt()
2555 tp->linger2 = -1; in do_tcp_setsockopt()
2557 tp->linger2 = 0; in do_tcp_setsockopt()
2559 tp->linger2 = val * HZ; in do_tcp_setsockopt()
2575 tp->window_clamp = 0; in do_tcp_setsockopt()
2577 tp->window_clamp = val < SOCK_MIN_RCVBUF / 2 ? in do_tcp_setsockopt()
2599 err = tp->af_specific->md5_parse(sk, optval, optlen); in do_tcp_setsockopt()
2623 if (!tp->repair) in do_tcp_setsockopt()
2626 tp->tsoffset = val - tcp_time_stamp; in do_tcp_setsockopt()
2629 tp->notsent_lowat = val; in do_tcp_setsockopt()
2668 const struct tcp_sock *tp = tcp_sk(sk); /* iff sk_type == SOCK_STREAM */ in tcp_get_info() local
2686 if (tp->rx_opt.tstamp_ok) in tcp_get_info()
2688 if (tcp_is_sack(tp)) in tcp_get_info()
2690 if (tp->rx_opt.wscale_ok) { in tcp_get_info()
2692 info->tcpi_snd_wscale = tp->rx_opt.snd_wscale; in tcp_get_info()
2693 info->tcpi_rcv_wscale = tp->rx_opt.rcv_wscale; in tcp_get_info()
2696 if (tp->ecn_flags & TCP_ECN_OK) in tcp_get_info()
2698 if (tp->ecn_flags & TCP_ECN_SEEN) in tcp_get_info()
2700 if (tp->syn_data_acked) in tcp_get_info()
2705 info->tcpi_snd_mss = tp->mss_cache; in tcp_get_info()
2712 info->tcpi_unacked = tp->packets_out; in tcp_get_info()
2713 info->tcpi_sacked = tp->sacked_out; in tcp_get_info()
2715 info->tcpi_lost = tp->lost_out; in tcp_get_info()
2716 info->tcpi_retrans = tp->retrans_out; in tcp_get_info()
2717 info->tcpi_fackets = tp->fackets_out; in tcp_get_info()
2719 info->tcpi_last_data_sent = jiffies_to_msecs(now - tp->lsndtime); in tcp_get_info()
2721 info->tcpi_last_ack_recv = jiffies_to_msecs(now - tp->rcv_tstamp); in tcp_get_info()
2724 info->tcpi_rcv_ssthresh = tp->rcv_ssthresh; in tcp_get_info()
2725 info->tcpi_rtt = tp->srtt_us >> 3; in tcp_get_info()
2726 info->tcpi_rttvar = tp->mdev_us >> 2; in tcp_get_info()
2727 info->tcpi_snd_ssthresh = tp->snd_ssthresh; in tcp_get_info()
2728 info->tcpi_snd_cwnd = tp->snd_cwnd; in tcp_get_info()
2729 info->tcpi_advmss = tp->advmss; in tcp_get_info()
2730 info->tcpi_reordering = tp->reordering; in tcp_get_info()
2732 info->tcpi_rcv_rtt = jiffies_to_usecs(tp->rcv_rtt_est.rtt)>>3; in tcp_get_info()
2733 info->tcpi_rcv_space = tp->rcvq_space.space; in tcp_get_info()
2735 info->tcpi_total_retrans = tp->total_retrans; in tcp_get_info()
2746 start = u64_stats_fetch_begin_irq(&tp->syncp); in tcp_get_info()
2747 put_unaligned(tp->bytes_acked, &info->tcpi_bytes_acked); in tcp_get_info()
2748 put_unaligned(tp->bytes_received, &info->tcpi_bytes_received); in tcp_get_info()
2749 } while (u64_stats_fetch_retry_irq(&tp->syncp, start)); in tcp_get_info()
2750 info->tcpi_segs_out = tp->segs_out; in tcp_get_info()
2751 info->tcpi_segs_in = tp->segs_in; in tcp_get_info()
2759 struct tcp_sock *tp = tcp_sk(sk); in do_tcp_getsockopt() local
2772 val = tp->mss_cache; in do_tcp_getsockopt()
2774 val = tp->rx_opt.user_mss; in do_tcp_getsockopt()
2775 if (tp->repair) in do_tcp_getsockopt()
2776 val = tp->rx_opt.mss_clamp; in do_tcp_getsockopt()
2779 val = !!(tp->nonagle&TCP_NAGLE_OFF); in do_tcp_getsockopt()
2782 val = !!(tp->nonagle&TCP_NAGLE_CORK); in do_tcp_getsockopt()
2785 val = keepalive_time_when(tp) / HZ; in do_tcp_getsockopt()
2788 val = keepalive_intvl_when(tp) / HZ; in do_tcp_getsockopt()
2791 val = keepalive_probes(tp); in do_tcp_getsockopt()
2797 val = tp->linger2; in do_tcp_getsockopt()
2806 val = tp->window_clamp; in do_tcp_getsockopt()
2858 val = tp->thin_lto; in do_tcp_getsockopt()
2861 val = tp->thin_dupack; in do_tcp_getsockopt()
2865 val = tp->repair; in do_tcp_getsockopt()
2869 if (tp->repair) in do_tcp_getsockopt()
2870 val = tp->repair_queue; in do_tcp_getsockopt()
2876 if (tp->repair_queue == TCP_SEND_QUEUE) in do_tcp_getsockopt()
2877 val = tp->write_seq; in do_tcp_getsockopt()
2878 else if (tp->repair_queue == TCP_RECV_QUEUE) in do_tcp_getsockopt()
2879 val = tp->rcv_nxt; in do_tcp_getsockopt()
2893 val = tcp_time_stamp + tp->tsoffset; in do_tcp_getsockopt()
2896 val = tp->notsent_lowat; in do_tcp_getsockopt()
2899 val = tp->save_syn; in do_tcp_getsockopt()
2906 if (tp->saved_syn) { in do_tcp_getsockopt()
2907 if (len < tp->saved_syn[0]) { in do_tcp_getsockopt()
2908 if (put_user(tp->saved_syn[0], optlen)) { in do_tcp_getsockopt()
2915 len = tp->saved_syn[0]; in do_tcp_getsockopt()
2920 if (copy_to_user(optval, tp->saved_syn + 1, len)) { in do_tcp_getsockopt()
2924 tcp_saved_syn_free(tp); in do_tcp_getsockopt()
3053 const struct tcphdr *tp = tcp_hdr(skb); in tcp_md5_hash_skb_data() local
3063 sg_set_buf(&sg, ((u8 *) tp) + header_len, head_data_len); in tcp_md5_hash_skb_data()