diff options
Diffstat (limited to 'include/net/tcp.h')
-rw-r--r-- | include/net/tcp.h | 146 |
1 files changed, 7 insertions, 139 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index cf0694d4ad60..5bba80fbd1d9 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -179,7 +179,6 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo); | |||
179 | #define TCPOPT_SACK 5 /* SACK Block */ | 179 | #define TCPOPT_SACK 5 /* SACK Block */ |
180 | #define TCPOPT_TIMESTAMP 8 /* Better RTT estimations/PAWS */ | 180 | #define TCPOPT_TIMESTAMP 8 /* Better RTT estimations/PAWS */ |
181 | #define TCPOPT_MD5SIG 19 /* MD5 Signature (RFC2385) */ | 181 | #define TCPOPT_MD5SIG 19 /* MD5 Signature (RFC2385) */ |
182 | #define TCPOPT_COOKIE 253 /* Cookie extension (experimental) */ | ||
183 | #define TCPOPT_EXP 254 /* Experimental */ | 182 | #define TCPOPT_EXP 254 /* Experimental */ |
184 | /* Magic number to be after the option value for sharing TCP | 183 | /* Magic number to be after the option value for sharing TCP |
185 | * experimental options. See draft-ietf-tcpm-experimental-options-00.txt | 184 | * experimental options. See draft-ietf-tcpm-experimental-options-00.txt |
@@ -273,7 +272,6 @@ extern int sysctl_tcp_app_win; | |||
273 | extern int sysctl_tcp_adv_win_scale; | 272 | extern int sysctl_tcp_adv_win_scale; |
274 | extern int sysctl_tcp_tw_reuse; | 273 | extern int sysctl_tcp_tw_reuse; |
275 | extern int sysctl_tcp_frto; | 274 | extern int sysctl_tcp_frto; |
276 | extern int sysctl_tcp_frto_response; | ||
277 | extern int sysctl_tcp_low_latency; | 275 | extern int sysctl_tcp_low_latency; |
278 | extern int sysctl_tcp_dma_copybreak; | 276 | extern int sysctl_tcp_dma_copybreak; |
279 | extern int sysctl_tcp_nometrics_save; | 277 | extern int sysctl_tcp_nometrics_save; |
@@ -284,7 +282,6 @@ extern int sysctl_tcp_base_mss; | |||
284 | extern int sysctl_tcp_workaround_signed_windows; | 282 | extern int sysctl_tcp_workaround_signed_windows; |
285 | extern int sysctl_tcp_slow_start_after_idle; | 283 | extern int sysctl_tcp_slow_start_after_idle; |
286 | extern int sysctl_tcp_max_ssthresh; | 284 | extern int sysctl_tcp_max_ssthresh; |
287 | extern int sysctl_tcp_cookie_size; | ||
288 | extern int sysctl_tcp_thin_linear_timeouts; | 285 | extern int sysctl_tcp_thin_linear_timeouts; |
289 | extern int sysctl_tcp_thin_dupack; | 286 | extern int sysctl_tcp_thin_dupack; |
290 | extern int sysctl_tcp_early_retrans; | 287 | extern int sysctl_tcp_early_retrans; |
@@ -373,6 +370,7 @@ extern int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
373 | extern int tcp_sendpage(struct sock *sk, struct page *page, int offset, | 370 | extern int tcp_sendpage(struct sock *sk, struct page *page, int offset, |
374 | size_t size, int flags); | 371 | size_t size, int flags); |
375 | extern void tcp_release_cb(struct sock *sk); | 372 | extern void tcp_release_cb(struct sock *sk); |
373 | extern void tcp_wfree(struct sk_buff *skb); | ||
376 | extern void tcp_write_timer_handler(struct sock *sk); | 374 | extern void tcp_write_timer_handler(struct sock *sk); |
377 | extern void tcp_delack_timer_handler(struct sock *sk); | 375 | extern void tcp_delack_timer_handler(struct sock *sk); |
378 | extern int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg); | 376 | extern int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg); |
@@ -425,8 +423,6 @@ extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb, | |||
425 | bool fastopen); | 423 | bool fastopen); |
426 | extern int tcp_child_process(struct sock *parent, struct sock *child, | 424 | extern int tcp_child_process(struct sock *parent, struct sock *child, |
427 | struct sk_buff *skb); | 425 | struct sk_buff *skb); |
428 | extern bool tcp_use_frto(struct sock *sk); | ||
429 | extern void tcp_enter_frto(struct sock *sk); | ||
430 | extern void tcp_enter_loss(struct sock *sk, int how); | 426 | extern void tcp_enter_loss(struct sock *sk, int how); |
431 | extern void tcp_clear_retrans(struct tcp_sock *tp); | 427 | extern void tcp_clear_retrans(struct tcp_sock *tp); |
432 | extern void tcp_update_metrics(struct sock *sk); | 428 | extern void tcp_update_metrics(struct sock *sk); |
@@ -454,7 +450,7 @@ extern void tcp_syn_ack_timeout(struct sock *sk, struct request_sock *req); | |||
454 | extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | 450 | extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, |
455 | size_t len, int nonblock, int flags, int *addr_len); | 451 | size_t len, int nonblock, int flags, int *addr_len); |
456 | extern void tcp_parse_options(const struct sk_buff *skb, | 452 | extern void tcp_parse_options(const struct sk_buff *skb, |
457 | struct tcp_options_received *opt_rx, const u8 **hvpp, | 453 | struct tcp_options_received *opt_rx, |
458 | int estab, struct tcp_fastopen_cookie *foc); | 454 | int estab, struct tcp_fastopen_cookie *foc); |
459 | extern const u8 *tcp_parse_md5sig_option(const struct tcphdr *th); | 455 | extern const u8 *tcp_parse_md5sig_option(const struct tcphdr *th); |
460 | 456 | ||
@@ -476,7 +472,6 @@ extern int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, | |||
476 | extern int tcp_connect(struct sock *sk); | 472 | extern int tcp_connect(struct sock *sk); |
477 | extern struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst, | 473 | extern struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst, |
478 | struct request_sock *req, | 474 | struct request_sock *req, |
479 | struct request_values *rvp, | ||
480 | struct tcp_fastopen_cookie *foc); | 475 | struct tcp_fastopen_cookie *foc); |
481 | extern int tcp_disconnect(struct sock *sk, int flags); | 476 | extern int tcp_disconnect(struct sock *sk, int flags); |
482 | 477 | ||
@@ -543,6 +538,8 @@ extern bool tcp_syn_flood_action(struct sock *sk, | |||
543 | extern void tcp_push_one(struct sock *, unsigned int mss_now); | 538 | extern void tcp_push_one(struct sock *, unsigned int mss_now); |
544 | extern void tcp_send_ack(struct sock *sk); | 539 | extern void tcp_send_ack(struct sock *sk); |
545 | extern void tcp_send_delayed_ack(struct sock *sk); | 540 | extern void tcp_send_delayed_ack(struct sock *sk); |
541 | extern void tcp_send_loss_probe(struct sock *sk); | ||
542 | extern bool tcp_schedule_loss_probe(struct sock *sk); | ||
546 | 543 | ||
547 | /* tcp_input.c */ | 544 | /* tcp_input.c */ |
548 | extern void tcp_cwnd_application_limited(struct sock *sk); | 545 | extern void tcp_cwnd_application_limited(struct sock *sk); |
@@ -756,7 +753,6 @@ enum tcp_ca_event { | |||
756 | CA_EVENT_TX_START, /* first transmit when no packets in flight */ | 753 | CA_EVENT_TX_START, /* first transmit when no packets in flight */ |
757 | CA_EVENT_CWND_RESTART, /* congestion window restart */ | 754 | CA_EVENT_CWND_RESTART, /* congestion window restart */ |
758 | CA_EVENT_COMPLETE_CWR, /* end of congestion recovery */ | 755 | CA_EVENT_COMPLETE_CWR, /* end of congestion recovery */ |
759 | CA_EVENT_FRTO, /* fast recovery timeout */ | ||
760 | CA_EVENT_LOSS, /* loss timeout */ | 756 | CA_EVENT_LOSS, /* loss timeout */ |
761 | CA_EVENT_FAST_ACK, /* in sequence ack */ | 757 | CA_EVENT_FAST_ACK, /* in sequence ack */ |
762 | CA_EVENT_SLOW_ACK, /* other ack */ | 758 | CA_EVENT_SLOW_ACK, /* other ack */ |
@@ -873,8 +869,8 @@ static inline void tcp_enable_fack(struct tcp_sock *tp) | |||
873 | static inline void tcp_enable_early_retrans(struct tcp_sock *tp) | 869 | static inline void tcp_enable_early_retrans(struct tcp_sock *tp) |
874 | { | 870 | { |
875 | tp->do_early_retrans = sysctl_tcp_early_retrans && | 871 | tp->do_early_retrans = sysctl_tcp_early_retrans && |
876 | !sysctl_tcp_thin_dupack && sysctl_tcp_reordering == 3; | 872 | sysctl_tcp_early_retrans < 4 && !sysctl_tcp_thin_dupack && |
877 | tp->early_retrans_delayed = 0; | 873 | sysctl_tcp_reordering == 3; |
878 | } | 874 | } |
879 | 875 | ||
880 | static inline void tcp_disable_early_retrans(struct tcp_sock *tp) | 876 | static inline void tcp_disable_early_retrans(struct tcp_sock *tp) |
@@ -1030,50 +1026,7 @@ static inline void tcp_prequeue_init(struct tcp_sock *tp) | |||
1030 | #endif | 1026 | #endif |
1031 | } | 1027 | } |
1032 | 1028 | ||
1033 | /* Packet is added to VJ-style prequeue for processing in process | 1029 | extern bool tcp_prequeue(struct sock *sk, struct sk_buff *skb); |
1034 | * context, if a reader task is waiting. Apparently, this exciting | ||
1035 | * idea (VJ's mail "Re: query about TCP header on tcp-ip" of 07 Sep 93) | ||
1036 | * failed somewhere. Latency? Burstiness? Well, at least now we will | ||
1037 | * see, why it failed. 8)8) --ANK | ||
1038 | * | ||
1039 | * NOTE: is this not too big to inline? | ||
1040 | */ | ||
1041 | static inline bool tcp_prequeue(struct sock *sk, struct sk_buff *skb) | ||
1042 | { | ||
1043 | struct tcp_sock *tp = tcp_sk(sk); | ||
1044 | |||
1045 | if (sysctl_tcp_low_latency || !tp->ucopy.task) | ||
1046 | return false; | ||
1047 | |||
1048 | if (skb->len <= tcp_hdrlen(skb) && | ||
1049 | skb_queue_len(&tp->ucopy.prequeue) == 0) | ||
1050 | return false; | ||
1051 | |||
1052 | __skb_queue_tail(&tp->ucopy.prequeue, skb); | ||
1053 | tp->ucopy.memory += skb->truesize; | ||
1054 | if (tp->ucopy.memory > sk->sk_rcvbuf) { | ||
1055 | struct sk_buff *skb1; | ||
1056 | |||
1057 | BUG_ON(sock_owned_by_user(sk)); | ||
1058 | |||
1059 | while ((skb1 = __skb_dequeue(&tp->ucopy.prequeue)) != NULL) { | ||
1060 | sk_backlog_rcv(sk, skb1); | ||
1061 | NET_INC_STATS_BH(sock_net(sk), | ||
1062 | LINUX_MIB_TCPPREQUEUEDROPPED); | ||
1063 | } | ||
1064 | |||
1065 | tp->ucopy.memory = 0; | ||
1066 | } else if (skb_queue_len(&tp->ucopy.prequeue) == 1) { | ||
1067 | wake_up_interruptible_sync_poll(sk_sleep(sk), | ||
1068 | POLLIN | POLLRDNORM | POLLRDBAND); | ||
1069 | if (!inet_csk_ack_scheduled(sk)) | ||
1070 | inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK, | ||
1071 | (3 * tcp_rto_min(sk)) / 4, | ||
1072 | TCP_RTO_MAX); | ||
1073 | } | ||
1074 | return true; | ||
1075 | } | ||
1076 | |||
1077 | 1030 | ||
1078 | #undef STATE_TRACE | 1031 | #undef STATE_TRACE |
1079 | 1032 | ||
@@ -1630,91 +1583,6 @@ struct tcp_request_sock_ops { | |||
1630 | #endif | 1583 | #endif |
1631 | }; | 1584 | }; |
1632 | 1585 | ||
1633 | /* Using SHA1 for now, define some constants. | ||
1634 | */ | ||
1635 | #define COOKIE_DIGEST_WORDS (SHA_DIGEST_WORDS) | ||
1636 | #define COOKIE_MESSAGE_WORDS (SHA_MESSAGE_BYTES / 4) | ||
1637 | #define COOKIE_WORKSPACE_WORDS (COOKIE_DIGEST_WORDS + COOKIE_MESSAGE_WORDS) | ||
1638 | |||
1639 | extern int tcp_cookie_generator(u32 *bakery); | ||
1640 | |||
1641 | /** | ||
1642 | * struct tcp_cookie_values - each socket needs extra space for the | ||
1643 | * cookies, together with (optional) space for any SYN data. | ||
1644 | * | ||
1645 | * A tcp_sock contains a pointer to the current value, and this is | ||
1646 | * cloned to the tcp_timewait_sock. | ||
1647 | * | ||
1648 | * @cookie_pair: variable data from the option exchange. | ||
1649 | * | ||
1650 | * @cookie_desired: user specified tcpct_cookie_desired. Zero | ||
1651 | * indicates default (sysctl_tcp_cookie_size). | ||
1652 | * After cookie sent, remembers size of cookie. | ||
1653 | * Range 0, TCP_COOKIE_MIN to TCP_COOKIE_MAX. | ||
1654 | * | ||
1655 | * @s_data_desired: user specified tcpct_s_data_desired. When the | ||
1656 | * constant payload is specified (@s_data_constant), | ||
1657 | * holds its length instead. | ||
1658 | * Range 0 to TCP_MSS_DESIRED. | ||
1659 | * | ||
1660 | * @s_data_payload: constant data that is to be included in the | ||
1661 | * payload of SYN or SYNACK segments when the | ||
1662 | * cookie option is present. | ||
1663 | */ | ||
1664 | struct tcp_cookie_values { | ||
1665 | struct kref kref; | ||
1666 | u8 cookie_pair[TCP_COOKIE_PAIR_SIZE]; | ||
1667 | u8 cookie_pair_size; | ||
1668 | u8 cookie_desired; | ||
1669 | u16 s_data_desired:11, | ||
1670 | s_data_constant:1, | ||
1671 | s_data_in:1, | ||
1672 | s_data_out:1, | ||
1673 | s_data_unused:2; | ||
1674 | u8 s_data_payload[0]; | ||
1675 | }; | ||
1676 | |||
1677 | static inline void tcp_cookie_values_release(struct kref *kref) | ||
1678 | { | ||
1679 | kfree(container_of(kref, struct tcp_cookie_values, kref)); | ||
1680 | } | ||
1681 | |||
1682 | /* The length of constant payload data. Note that s_data_desired is | ||
1683 | * overloaded, depending on s_data_constant: either the length of constant | ||
1684 | * data (returned here) or the limit on variable data. | ||
1685 | */ | ||
1686 | static inline int tcp_s_data_size(const struct tcp_sock *tp) | ||
1687 | { | ||
1688 | return (tp->cookie_values != NULL && tp->cookie_values->s_data_constant) | ||
1689 | ? tp->cookie_values->s_data_desired | ||
1690 | : 0; | ||
1691 | } | ||
1692 | |||
1693 | /** | ||
1694 | * struct tcp_extend_values - tcp_ipv?.c to tcp_output.c workspace. | ||
1695 | * | ||
1696 | * As tcp_request_sock has already been extended in other places, the | ||
1697 | * only remaining method is to pass stack values along as function | ||
1698 | * parameters. These parameters are not needed after sending SYNACK. | ||
1699 | * | ||
1700 | * @cookie_bakery: cryptographic secret and message workspace. | ||
1701 | * | ||
1702 | * @cookie_plus: bytes in authenticator/cookie option, copied from | ||
1703 | * struct tcp_options_received (above). | ||
1704 | */ | ||
1705 | struct tcp_extend_values { | ||
1706 | struct request_values rv; | ||
1707 | u32 cookie_bakery[COOKIE_WORKSPACE_WORDS]; | ||
1708 | u8 cookie_plus:6, | ||
1709 | cookie_out_never:1, | ||
1710 | cookie_in_always:1; | ||
1711 | }; | ||
1712 | |||
1713 | static inline struct tcp_extend_values *tcp_xv(struct request_values *rvp) | ||
1714 | { | ||
1715 | return (struct tcp_extend_values *)rvp; | ||
1716 | } | ||
1717 | |||
1718 | extern void tcp_v4_init(void); | 1586 | extern void tcp_v4_init(void); |
1719 | extern void tcp_init(void); | 1587 | extern void tcp_init(void); |
1720 | 1588 | ||