aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/net/tcp.h424
1 files changed, 208 insertions, 216 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h
index b1aa324c5e65..0e47551e9bdb 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -50,7 +50,7 @@
50extern struct inet_hashinfo tcp_hashinfo; 50extern struct inet_hashinfo tcp_hashinfo;
51 51
52extern struct percpu_counter tcp_orphan_count; 52extern struct percpu_counter tcp_orphan_count;
53extern void tcp_time_wait(struct sock *sk, int state, int timeo); 53void tcp_time_wait(struct sock *sk, int state, int timeo);
54 54
55#define MAX_TCP_HEADER (128 + MAX_HEADER) 55#define MAX_TCP_HEADER (128 + MAX_HEADER)
56#define MAX_TCP_OPTION_SPACE 40 56#define MAX_TCP_OPTION_SPACE 40
@@ -325,7 +325,7 @@ static inline bool tcp_too_many_orphans(struct sock *sk, int shift)
325 return false; 325 return false;
326} 326}
327 327
328extern bool tcp_check_oom(struct sock *sk, int shift); 328bool tcp_check_oom(struct sock *sk, int shift);
329 329
330/* syncookies: remember time of last synqueue overflow */ 330/* syncookies: remember time of last synqueue overflow */
331static inline void tcp_synq_overflow(struct sock *sk) 331static inline void tcp_synq_overflow(struct sock *sk)
@@ -348,38 +348,38 @@ extern struct proto tcp_prot;
348#define TCP_ADD_STATS_USER(net, field, val) SNMP_ADD_STATS_USER((net)->mib.tcp_statistics, field, val) 348#define TCP_ADD_STATS_USER(net, field, val) SNMP_ADD_STATS_USER((net)->mib.tcp_statistics, field, val)
349#define TCP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.tcp_statistics, field, val) 349#define TCP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.tcp_statistics, field, val)
350 350
351extern void tcp_init_mem(struct net *net); 351void tcp_init_mem(struct net *net);
352 352
353extern void tcp_tasklet_init(void); 353void tcp_tasklet_init(void);
354 354
355extern void tcp_v4_err(struct sk_buff *skb, u32); 355void tcp_v4_err(struct sk_buff *skb, u32);
356 356
357extern void tcp_shutdown (struct sock *sk, int how); 357void tcp_shutdown(struct sock *sk, int how);
358 358
359extern void tcp_v4_early_demux(struct sk_buff *skb); 359void tcp_v4_early_demux(struct sk_buff *skb);
360extern int tcp_v4_rcv(struct sk_buff *skb); 360int tcp_v4_rcv(struct sk_buff *skb);
361 361
362extern int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw); 362int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw);
363extern int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, 363int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
364 size_t size); 364 size_t size);
365extern int tcp_sendpage(struct sock *sk, struct page *page, int offset, 365int tcp_sendpage(struct sock *sk, struct page *page, int offset, size_t size,
366 size_t size, int flags); 366 int flags);
367extern void tcp_release_cb(struct sock *sk); 367void tcp_release_cb(struct sock *sk);
368extern void tcp_wfree(struct sk_buff *skb); 368void tcp_wfree(struct sk_buff *skb);
369extern void tcp_write_timer_handler(struct sock *sk); 369void tcp_write_timer_handler(struct sock *sk);
370extern void tcp_delack_timer_handler(struct sock *sk); 370void tcp_delack_timer_handler(struct sock *sk);
371extern int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg); 371int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg);
372extern int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, 372int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
373 const struct tcphdr *th, unsigned int len); 373 const struct tcphdr *th, unsigned int len);
374extern void tcp_rcv_established(struct sock *sk, struct sk_buff *skb, 374void tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
375 const struct tcphdr *th, unsigned int len); 375 const struct tcphdr *th, unsigned int len);
376extern void tcp_rcv_space_adjust(struct sock *sk); 376void tcp_rcv_space_adjust(struct sock *sk);
377extern void tcp_cleanup_rbuf(struct sock *sk, int copied); 377void tcp_cleanup_rbuf(struct sock *sk, int copied);
378extern int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp); 378int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp);
379extern void tcp_twsk_destructor(struct sock *sk); 379void tcp_twsk_destructor(struct sock *sk);
380extern ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos, 380ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos,
381 struct pipe_inode_info *pipe, size_t len, 381 struct pipe_inode_info *pipe, size_t len,
382 unsigned int flags); 382 unsigned int flags);
383 383
384static inline void tcp_dec_quickack_mode(struct sock *sk, 384static inline void tcp_dec_quickack_mode(struct sock *sk,
385 const unsigned int pkts) 385 const unsigned int pkts)
@@ -409,66 +409,65 @@ enum tcp_tw_status {
409}; 409};
410 410
411 411
412extern enum tcp_tw_status tcp_timewait_state_process(struct inet_timewait_sock *tw, 412enum tcp_tw_status tcp_timewait_state_process(struct inet_timewait_sock *tw,
413 struct sk_buff *skb, 413 struct sk_buff *skb,
414 const struct tcphdr *th); 414 const struct tcphdr *th);
415extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb, 415struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
416 struct request_sock *req, 416 struct request_sock *req, struct request_sock **prev,
417 struct request_sock **prev, 417 bool fastopen);
418 bool fastopen); 418int tcp_child_process(struct sock *parent, struct sock *child,
419extern int tcp_child_process(struct sock *parent, struct sock *child, 419 struct sk_buff *skb);
420 struct sk_buff *skb); 420void tcp_enter_loss(struct sock *sk, int how);
421extern void tcp_enter_loss(struct sock *sk, int how); 421void tcp_clear_retrans(struct tcp_sock *tp);
422extern void tcp_clear_retrans(struct tcp_sock *tp); 422void tcp_update_metrics(struct sock *sk);
423extern void tcp_update_metrics(struct sock *sk); 423void tcp_init_metrics(struct sock *sk);
424extern void tcp_init_metrics(struct sock *sk); 424void tcp_metrics_init(void);
425extern void tcp_metrics_init(void); 425bool tcp_peer_is_proven(struct request_sock *req, struct dst_entry *dst,
426extern bool tcp_peer_is_proven(struct request_sock *req, struct dst_entry *dst, bool paws_check); 426 bool paws_check);
427extern bool tcp_remember_stamp(struct sock *sk); 427bool tcp_remember_stamp(struct sock *sk);
428extern bool tcp_tw_remember_stamp(struct inet_timewait_sock *tw); 428bool tcp_tw_remember_stamp(struct inet_timewait_sock *tw);
429extern void tcp_fetch_timewait_stamp(struct sock *sk, struct dst_entry *dst); 429void tcp_fetch_timewait_stamp(struct sock *sk, struct dst_entry *dst);
430extern void tcp_disable_fack(struct tcp_sock *tp); 430void tcp_disable_fack(struct tcp_sock *tp);
431extern void tcp_close(struct sock *sk, long timeout); 431void tcp_close(struct sock *sk, long timeout);
432extern void tcp_init_sock(struct sock *sk); 432void tcp_init_sock(struct sock *sk);
433extern unsigned int tcp_poll(struct file * file, struct socket *sock, 433unsigned int tcp_poll(struct file *file, struct socket *sock,
434 struct poll_table_struct *wait); 434 struct poll_table_struct *wait);
435extern int tcp_getsockopt(struct sock *sk, int level, int optname, 435int tcp_getsockopt(struct sock *sk, int level, int optname,
436 char __user *optval, int __user *optlen);
437int tcp_setsockopt(struct sock *sk, int level, int optname,
438 char __user *optval, unsigned int optlen);
439int compat_tcp_getsockopt(struct sock *sk, int level, int optname,
436 char __user *optval, int __user *optlen); 440 char __user *optval, int __user *optlen);
437extern int tcp_setsockopt(struct sock *sk, int level, int optname, 441int compat_tcp_setsockopt(struct sock *sk, int level, int optname,
438 char __user *optval, unsigned int optlen); 442 char __user *optval, unsigned int optlen);
439extern int compat_tcp_getsockopt(struct sock *sk, int level, int optname, 443void tcp_set_keepalive(struct sock *sk, int val);
440 char __user *optval, int __user *optlen); 444void tcp_syn_ack_timeout(struct sock *sk, struct request_sock *req);
441extern int compat_tcp_setsockopt(struct sock *sk, int level, int optname, 445int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
442 char __user *optval, unsigned int optlen); 446 size_t len, int nonblock, int flags, int *addr_len);
443extern void tcp_set_keepalive(struct sock *sk, int val); 447void tcp_parse_options(const struct sk_buff *skb,
444extern void tcp_syn_ack_timeout(struct sock *sk, struct request_sock *req); 448 struct tcp_options_received *opt_rx,
445extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, 449 int estab, struct tcp_fastopen_cookie *foc);
446 size_t len, int nonblock, int flags, int *addr_len); 450const u8 *tcp_parse_md5sig_option(const struct tcphdr *th);
447extern void tcp_parse_options(const struct sk_buff *skb,
448 struct tcp_options_received *opt_rx,
449 int estab, struct tcp_fastopen_cookie *foc);
450extern const u8 *tcp_parse_md5sig_option(const struct tcphdr *th);
451 451
452/* 452/*
453 * TCP v4 functions exported for the inet6 API 453 * TCP v4 functions exported for the inet6 API
454 */ 454 */
455 455
456extern void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb); 456void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb);
457extern int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb); 457int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb);
458extern struct sock * tcp_create_openreq_child(struct sock *sk, 458struct sock *tcp_create_openreq_child(struct sock *sk,
459 struct request_sock *req, 459 struct request_sock *req,
460 struct sk_buff *skb); 460 struct sk_buff *skb);
461extern struct sock * tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb, 461struct sock *tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
462 struct request_sock *req, 462 struct request_sock *req,
463 struct dst_entry *dst); 463 struct dst_entry *dst);
464extern int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb); 464int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb);
465extern int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, 465int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len);
466 int addr_len); 466int tcp_connect(struct sock *sk);
467extern int tcp_connect(struct sock *sk); 467struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst,
468extern struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst, 468 struct request_sock *req,
469 struct request_sock *req, 469 struct tcp_fastopen_cookie *foc);
470 struct tcp_fastopen_cookie *foc); 470int tcp_disconnect(struct sock *sk, int flags);
471extern int tcp_disconnect(struct sock *sk, int flags);
472 471
473void tcp_connect_init(struct sock *sk); 472void tcp_connect_init(struct sock *sk);
474void tcp_finish_connect(struct sock *sk, struct sk_buff *skb); 473void tcp_finish_connect(struct sock *sk, struct sk_buff *skb);
@@ -477,15 +476,14 @@ void inet_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb);
477 476
478/* From syncookies.c */ 477/* From syncookies.c */
479extern __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS]; 478extern __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS];
480extern int __cookie_v4_check(const struct iphdr *iph, const struct tcphdr *th, 479int __cookie_v4_check(const struct iphdr *iph, const struct tcphdr *th,
481 u32 cookie); 480 u32 cookie);
482extern struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, 481struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
483 struct ip_options *opt); 482 struct ip_options *opt);
484#ifdef CONFIG_SYN_COOKIES 483#ifdef CONFIG_SYN_COOKIES
485extern u32 __cookie_v4_init_sequence(const struct iphdr *iph, 484u32 __cookie_v4_init_sequence(const struct iphdr *iph, const struct tcphdr *th,
486 const struct tcphdr *th, u16 *mssp); 485 u16 *mssp);
487extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, 486__u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, __u16 *mss);
488 __u16 *mss);
489#else 487#else
490static inline __u32 cookie_v4_init_sequence(struct sock *sk, 488static inline __u32 cookie_v4_init_sequence(struct sock *sk,
491 struct sk_buff *skb, 489 struct sk_buff *skb,
@@ -495,19 +493,19 @@ static inline __u32 cookie_v4_init_sequence(struct sock *sk,
495} 493}
496#endif 494#endif
497 495
498extern __u32 cookie_init_timestamp(struct request_sock *req); 496__u32 cookie_init_timestamp(struct request_sock *req);
499extern bool cookie_check_timestamp(struct tcp_options_received *opt, 497bool cookie_check_timestamp(struct tcp_options_received *opt, struct net *net,
500 struct net *net, bool *ecn_ok); 498 bool *ecn_ok);
501 499
502/* From net/ipv6/syncookies.c */ 500/* From net/ipv6/syncookies.c */
503extern int __cookie_v6_check(const struct ipv6hdr *iph, const struct tcphdr *th, 501int __cookie_v6_check(const struct ipv6hdr *iph, const struct tcphdr *th,
504 u32 cookie); 502 u32 cookie);
505extern struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb); 503struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb);
506#ifdef CONFIG_SYN_COOKIES 504#ifdef CONFIG_SYN_COOKIES
507extern u32 __cookie_v6_init_sequence(const struct ipv6hdr *iph, 505u32 __cookie_v6_init_sequence(const struct ipv6hdr *iph,
508 const struct tcphdr *th, u16 *mssp); 506 const struct tcphdr *th, u16 *mssp);
509extern __u32 cookie_v6_init_sequence(struct sock *sk, const struct sk_buff *skb, 507__u32 cookie_v6_init_sequence(struct sock *sk, const struct sk_buff *skb,
510 __u16 *mss); 508 __u16 *mss);
511#else 509#else
512static inline __u32 cookie_v6_init_sequence(struct sock *sk, 510static inline __u32 cookie_v6_init_sequence(struct sock *sk,
513 struct sk_buff *skb, 511 struct sk_buff *skb,
@@ -518,47 +516,46 @@ static inline __u32 cookie_v6_init_sequence(struct sock *sk,
518#endif 516#endif
519/* tcp_output.c */ 517/* tcp_output.c */
520 518
521extern void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss, 519void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss,
522 int nonagle); 520 int nonagle);
523extern bool tcp_may_send_now(struct sock *sk); 521bool tcp_may_send_now(struct sock *sk);
524extern int __tcp_retransmit_skb(struct sock *, struct sk_buff *); 522int __tcp_retransmit_skb(struct sock *, struct sk_buff *);
525extern int tcp_retransmit_skb(struct sock *, struct sk_buff *); 523int tcp_retransmit_skb(struct sock *, struct sk_buff *);
526extern void tcp_retransmit_timer(struct sock *sk); 524void tcp_retransmit_timer(struct sock *sk);
527extern void tcp_xmit_retransmit_queue(struct sock *); 525void tcp_xmit_retransmit_queue(struct sock *);
528extern void tcp_simple_retransmit(struct sock *); 526void tcp_simple_retransmit(struct sock *);
529extern int tcp_trim_head(struct sock *, struct sk_buff *, u32); 527int tcp_trim_head(struct sock *, struct sk_buff *, u32);
530extern int tcp_fragment(struct sock *, struct sk_buff *, u32, unsigned int); 528int tcp_fragment(struct sock *, struct sk_buff *, u32, unsigned int);
531 529
532extern void tcp_send_probe0(struct sock *); 530void tcp_send_probe0(struct sock *);
533extern void tcp_send_partial(struct sock *); 531void tcp_send_partial(struct sock *);
534extern int tcp_write_wakeup(struct sock *); 532int tcp_write_wakeup(struct sock *);
535extern void tcp_send_fin(struct sock *sk); 533void tcp_send_fin(struct sock *sk);
536extern void tcp_send_active_reset(struct sock *sk, gfp_t priority); 534void tcp_send_active_reset(struct sock *sk, gfp_t priority);
537extern int tcp_send_synack(struct sock *); 535int tcp_send_synack(struct sock *);
538extern bool tcp_syn_flood_action(struct sock *sk, 536bool tcp_syn_flood_action(struct sock *sk, const struct sk_buff *skb,
539 const struct sk_buff *skb, 537 const char *proto);
540 const char *proto); 538void tcp_push_one(struct sock *, unsigned int mss_now);
541extern void tcp_push_one(struct sock *, unsigned int mss_now); 539void tcp_send_ack(struct sock *sk);
542extern void tcp_send_ack(struct sock *sk); 540void tcp_send_delayed_ack(struct sock *sk);
543extern void tcp_send_delayed_ack(struct sock *sk); 541void tcp_send_loss_probe(struct sock *sk);
544extern void tcp_send_loss_probe(struct sock *sk); 542bool tcp_schedule_loss_probe(struct sock *sk);
545extern bool tcp_schedule_loss_probe(struct sock *sk);
546 543
547/* tcp_input.c */ 544/* tcp_input.c */
548extern void tcp_cwnd_application_limited(struct sock *sk); 545void tcp_cwnd_application_limited(struct sock *sk);
549extern void tcp_resume_early_retransmit(struct sock *sk); 546void tcp_resume_early_retransmit(struct sock *sk);
550extern void tcp_rearm_rto(struct sock *sk); 547void tcp_rearm_rto(struct sock *sk);
551extern void tcp_reset(struct sock *sk); 548void tcp_reset(struct sock *sk);
552 549
553/* tcp_timer.c */ 550/* tcp_timer.c */
554extern void tcp_init_xmit_timers(struct sock *); 551void tcp_init_xmit_timers(struct sock *);
555static inline void tcp_clear_xmit_timers(struct sock *sk) 552static inline void tcp_clear_xmit_timers(struct sock *sk)
556{ 553{
557 inet_csk_clear_xmit_timers(sk); 554 inet_csk_clear_xmit_timers(sk);
558} 555}
559 556
560extern unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu); 557unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu);
561extern unsigned int tcp_current_mss(struct sock *sk); 558unsigned int tcp_current_mss(struct sock *sk);
562 559
563/* Bound MSS / TSO packet size with the half of the window */ 560/* Bound MSS / TSO packet size with the half of the window */
564static inline int tcp_bound_to_half_wnd(struct tcp_sock *tp, int pktsize) 561static inline int tcp_bound_to_half_wnd(struct tcp_sock *tp, int pktsize)
@@ -584,20 +581,20 @@ static inline int tcp_bound_to_half_wnd(struct tcp_sock *tp, int pktsize)
584} 581}
585 582
586/* tcp.c */ 583/* tcp.c */
587extern void tcp_get_info(const struct sock *, struct tcp_info *); 584void tcp_get_info(const struct sock *, struct tcp_info *);
588 585
589/* Read 'sendfile()'-style from a TCP socket */ 586/* Read 'sendfile()'-style from a TCP socket */
590typedef int (*sk_read_actor_t)(read_descriptor_t *, struct sk_buff *, 587typedef int (*sk_read_actor_t)(read_descriptor_t *, struct sk_buff *,
591 unsigned int, size_t); 588 unsigned int, size_t);
592extern int tcp_read_sock(struct sock *sk, read_descriptor_t *desc, 589int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
593 sk_read_actor_t recv_actor); 590 sk_read_actor_t recv_actor);
594 591
595extern void tcp_initialize_rcv_mss(struct sock *sk); 592void tcp_initialize_rcv_mss(struct sock *sk);
596 593
597extern int tcp_mtu_to_mss(struct sock *sk, int pmtu); 594int tcp_mtu_to_mss(struct sock *sk, int pmtu);
598extern int tcp_mss_to_mtu(struct sock *sk, int mss); 595int tcp_mss_to_mtu(struct sock *sk, int mss);
599extern void tcp_mtup_init(struct sock *sk); 596void tcp_mtup_init(struct sock *sk);
600extern void tcp_init_buffer_space(struct sock *sk); 597void tcp_init_buffer_space(struct sock *sk);
601 598
602static inline void tcp_bound_rto(const struct sock *sk) 599static inline void tcp_bound_rto(const struct sock *sk)
603{ 600{
@@ -610,7 +607,7 @@ static inline u32 __tcp_set_rto(const struct tcp_sock *tp)
610 return (tp->srtt >> 3) + tp->rttvar; 607 return (tp->srtt >> 3) + tp->rttvar;
611} 608}
612 609
613extern void tcp_set_rto(struct sock *sk); 610void tcp_set_rto(struct sock *sk);
614 611
615static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd) 612static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd)
616{ 613{
@@ -663,7 +660,7 @@ static inline u32 tcp_receive_window(const struct tcp_sock *tp)
663 * scaling applied to the result. The caller does these things 660 * scaling applied to the result. The caller does these things
664 * if necessary. This is a "raw" window selection. 661 * if necessary. This is a "raw" window selection.
665 */ 662 */
666extern u32 __tcp_select_window(struct sock *sk); 663u32 __tcp_select_window(struct sock *sk);
667 664
668void tcp_send_window_probe(struct sock *sk); 665void tcp_send_window_probe(struct sock *sk);
669 666
@@ -800,24 +797,24 @@ struct tcp_congestion_ops {
800 struct module *owner; 797 struct module *owner;
801}; 798};
802 799
803extern int tcp_register_congestion_control(struct tcp_congestion_ops *type); 800int tcp_register_congestion_control(struct tcp_congestion_ops *type);
804extern void tcp_unregister_congestion_control(struct tcp_congestion_ops *type); 801void tcp_unregister_congestion_control(struct tcp_congestion_ops *type);
805 802
806extern void tcp_init_congestion_control(struct sock *sk); 803void tcp_init_congestion_control(struct sock *sk);
807extern void tcp_cleanup_congestion_control(struct sock *sk); 804void tcp_cleanup_congestion_control(struct sock *sk);
808extern int tcp_set_default_congestion_control(const char *name); 805int tcp_set_default_congestion_control(const char *name);
809extern void tcp_get_default_congestion_control(char *name); 806void tcp_get_default_congestion_control(char *name);
810extern void tcp_get_available_congestion_control(char *buf, size_t len); 807void tcp_get_available_congestion_control(char *buf, size_t len);
811extern void tcp_get_allowed_congestion_control(char *buf, size_t len); 808void tcp_get_allowed_congestion_control(char *buf, size_t len);
812extern int tcp_set_allowed_congestion_control(char *allowed); 809int tcp_set_allowed_congestion_control(char *allowed);
813extern int tcp_set_congestion_control(struct sock *sk, const char *name); 810int tcp_set_congestion_control(struct sock *sk, const char *name);
814extern void tcp_slow_start(struct tcp_sock *tp); 811void tcp_slow_start(struct tcp_sock *tp);
815extern void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w); 812void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w);
816 813
817extern struct tcp_congestion_ops tcp_init_congestion_ops; 814extern struct tcp_congestion_ops tcp_init_congestion_ops;
818extern u32 tcp_reno_ssthresh(struct sock *sk); 815u32 tcp_reno_ssthresh(struct sock *sk);
819extern void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 in_flight); 816void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 in_flight);
820extern u32 tcp_reno_min_cwnd(const struct sock *sk); 817u32 tcp_reno_min_cwnd(const struct sock *sk);
821extern struct tcp_congestion_ops tcp_reno; 818extern struct tcp_congestion_ops tcp_reno;
822 819
823static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state) 820static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state)
@@ -936,8 +933,8 @@ static inline __u32 tcp_current_ssthresh(const struct sock *sk)
936/* Use define here intentionally to get WARN_ON location shown at the caller */ 933/* Use define here intentionally to get WARN_ON location shown at the caller */
937#define tcp_verify_left_out(tp) WARN_ON(tcp_left_out(tp) > tp->packets_out) 934#define tcp_verify_left_out(tp) WARN_ON(tcp_left_out(tp) > tp->packets_out)
938 935
939extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh); 936void tcp_enter_cwr(struct sock *sk, const int set_ssthresh);
940extern __u32 tcp_init_cwnd(const struct tcp_sock *tp, const struct dst_entry *dst); 937__u32 tcp_init_cwnd(const struct tcp_sock *tp, const struct dst_entry *dst);
941 938
942/* The maximum number of MSS of available cwnd for which TSO defers 939/* The maximum number of MSS of available cwnd for which TSO defers
943 * sending if not using sysctl_tcp_tso_win_divisor. 940 * sending if not using sysctl_tcp_tso_win_divisor.
@@ -963,7 +960,7 @@ static inline u32 tcp_wnd_end(const struct tcp_sock *tp)
963{ 960{
964 return tp->snd_una + tp->snd_wnd; 961 return tp->snd_una + tp->snd_wnd;
965} 962}
966extern bool tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight); 963bool tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight);
967 964
968static inline void tcp_minshall_update(struct tcp_sock *tp, unsigned int mss, 965static inline void tcp_minshall_update(struct tcp_sock *tp, unsigned int mss,
969 const struct sk_buff *skb) 966 const struct sk_buff *skb)
@@ -1028,7 +1025,7 @@ static inline void tcp_prequeue_init(struct tcp_sock *tp)
1028#endif 1025#endif
1029} 1026}
1030 1027
1031extern bool tcp_prequeue(struct sock *sk, struct sk_buff *skb); 1028bool tcp_prequeue(struct sock *sk, struct sk_buff *skb);
1032 1029
1033#undef STATE_TRACE 1030#undef STATE_TRACE
1034 1031
@@ -1039,9 +1036,9 @@ static const char *statename[]={
1039 "Close Wait","Last ACK","Listen","Closing" 1036 "Close Wait","Last ACK","Listen","Closing"
1040}; 1037};
1041#endif 1038#endif
1042extern void tcp_set_state(struct sock *sk, int state); 1039void tcp_set_state(struct sock *sk, int state);
1043 1040
1044extern void tcp_done(struct sock *sk); 1041void tcp_done(struct sock *sk);
1045 1042
1046static inline void tcp_sack_reset(struct tcp_options_received *rx_opt) 1043static inline void tcp_sack_reset(struct tcp_options_received *rx_opt)
1047{ 1044{
@@ -1049,13 +1046,12 @@ static inline void tcp_sack_reset(struct tcp_options_received *rx_opt)
1049 rx_opt->num_sacks = 0; 1046 rx_opt->num_sacks = 0;
1050} 1047}
1051 1048
1052extern u32 tcp_default_init_rwnd(u32 mss); 1049u32 tcp_default_init_rwnd(u32 mss);
1053 1050
1054/* Determine a window scaling and initial window to offer. */ 1051/* Determine a window scaling and initial window to offer. */
1055extern void tcp_select_initial_window(int __space, __u32 mss, 1052void tcp_select_initial_window(int __space, __u32 mss, __u32 *rcv_wnd,
1056 __u32 *rcv_wnd, __u32 *window_clamp, 1053 __u32 *window_clamp, int wscale_ok,
1057 int wscale_ok, __u8 *rcv_wscale, 1054 __u8 *rcv_wscale, __u32 init_rcv_wnd);
1058 __u32 init_rcv_wnd);
1059 1055
1060static inline int tcp_win_from_space(int space) 1056static inline int tcp_win_from_space(int space)
1061{ 1057{
@@ -1099,7 +1095,7 @@ static inline void tcp_openreq_init(struct request_sock *req,
1099 ireq->loc_port = tcp_hdr(skb)->dest; 1095 ireq->loc_port = tcp_hdr(skb)->dest;
1100} 1096}
1101 1097
1102extern void tcp_enter_memory_pressure(struct sock *sk); 1098void tcp_enter_memory_pressure(struct sock *sk);
1103 1099
1104static inline int keepalive_intvl_when(const struct tcp_sock *tp) 1100static inline int keepalive_intvl_when(const struct tcp_sock *tp)
1105{ 1101{
@@ -1252,21 +1248,20 @@ struct tcp_md5sig_pool {
1252}; 1248};
1253 1249
1254/* - functions */ 1250/* - functions */
1255extern int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key, 1251int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key,
1256 const struct sock *sk, 1252 const struct sock *sk, const struct request_sock *req,
1257 const struct request_sock *req, 1253 const struct sk_buff *skb);
1258 const struct sk_buff *skb); 1254int tcp_md5_do_add(struct sock *sk, const union tcp_md5_addr *addr,
1259extern int tcp_md5_do_add(struct sock *sk, const union tcp_md5_addr *addr, 1255 int family, const u8 *newkey, u8 newkeylen, gfp_t gfp);
1260 int family, const u8 *newkey, 1256int tcp_md5_do_del(struct sock *sk, const union tcp_md5_addr *addr,
1261 u8 newkeylen, gfp_t gfp); 1257 int family);
1262extern int tcp_md5_do_del(struct sock *sk, const union tcp_md5_addr *addr, 1258struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk,
1263 int family);
1264extern struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk,
1265 struct sock *addr_sk); 1259 struct sock *addr_sk);
1266 1260
1267#ifdef CONFIG_TCP_MD5SIG 1261#ifdef CONFIG_TCP_MD5SIG
1268extern struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk, 1262struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk,
1269 const union tcp_md5_addr *addr, int family); 1263 const union tcp_md5_addr *addr,
1264 int family);
1270#define tcp_twsk_md5_key(twsk) ((twsk)->tw_md5_key) 1265#define tcp_twsk_md5_key(twsk) ((twsk)->tw_md5_key)
1271#else 1266#else
1272static inline struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk, 1267static inline struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk,
@@ -1278,27 +1273,26 @@ static inline struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk,
1278#define tcp_twsk_md5_key(twsk) NULL 1273#define tcp_twsk_md5_key(twsk) NULL
1279#endif 1274#endif
1280 1275
1281extern bool tcp_alloc_md5sig_pool(void); 1276bool tcp_alloc_md5sig_pool(void);
1282 1277
1283extern struct tcp_md5sig_pool *tcp_get_md5sig_pool(void); 1278struct tcp_md5sig_pool *tcp_get_md5sig_pool(void);
1284static inline void tcp_put_md5sig_pool(void) 1279static inline void tcp_put_md5sig_pool(void)
1285{ 1280{
1286 local_bh_enable(); 1281 local_bh_enable();
1287} 1282}
1288 1283
1289extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, const struct tcphdr *); 1284int tcp_md5_hash_header(struct tcp_md5sig_pool *, const struct tcphdr *);
1290extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, const struct sk_buff *, 1285int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, const struct sk_buff *,
1291 unsigned int header_len); 1286 unsigned int header_len);
1292extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp, 1287int tcp_md5_hash_key(struct tcp_md5sig_pool *hp,
1293 const struct tcp_md5sig_key *key); 1288 const struct tcp_md5sig_key *key);
1294 1289
1295/* From tcp_fastopen.c */ 1290/* From tcp_fastopen.c */
1296extern void tcp_fastopen_cache_get(struct sock *sk, u16 *mss, 1291void tcp_fastopen_cache_get(struct sock *sk, u16 *mss,
1297 struct tcp_fastopen_cookie *cookie, 1292 struct tcp_fastopen_cookie *cookie, int *syn_loss,
1298 int *syn_loss, unsigned long *last_syn_loss); 1293 unsigned long *last_syn_loss);
1299extern void tcp_fastopen_cache_set(struct sock *sk, u16 mss, 1294void tcp_fastopen_cache_set(struct sock *sk, u16 mss,
1300 struct tcp_fastopen_cookie *cookie, 1295 struct tcp_fastopen_cookie *cookie, bool syn_lost);
1301 bool syn_lost);
1302struct tcp_fastopen_request { 1296struct tcp_fastopen_request {
1303 /* Fast Open cookie. Size 0 means a cookie request */ 1297 /* Fast Open cookie. Size 0 means a cookie request */
1304 struct tcp_fastopen_cookie cookie; 1298 struct tcp_fastopen_cookie cookie;
@@ -1309,8 +1303,8 @@ void tcp_free_fastopen_req(struct tcp_sock *tp);
1309 1303
1310extern struct tcp_fastopen_context __rcu *tcp_fastopen_ctx; 1304extern struct tcp_fastopen_context __rcu *tcp_fastopen_ctx;
1311int tcp_fastopen_reset_cipher(void *key, unsigned int len); 1305int tcp_fastopen_reset_cipher(void *key, unsigned int len);
1312extern void tcp_fastopen_cookie_gen(__be32 src, __be32 dst, 1306void tcp_fastopen_cookie_gen(__be32 src, __be32 dst,
1313 struct tcp_fastopen_cookie *foc); 1307 struct tcp_fastopen_cookie *foc);
1314 1308
1315#define TCP_FASTOPEN_KEY_LENGTH 16 1309#define TCP_FASTOPEN_KEY_LENGTH 16
1316 1310
@@ -1529,22 +1523,20 @@ struct tcp_iter_state {
1529 loff_t last_pos; 1523 loff_t last_pos;
1530}; 1524};
1531 1525
1532extern int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo); 1526int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo);
1533extern void tcp_proc_unregister(struct net *net, struct tcp_seq_afinfo *afinfo); 1527void tcp_proc_unregister(struct net *net, struct tcp_seq_afinfo *afinfo);
1534 1528
1535extern struct request_sock_ops tcp_request_sock_ops; 1529extern struct request_sock_ops tcp_request_sock_ops;
1536extern struct request_sock_ops tcp6_request_sock_ops; 1530extern struct request_sock_ops tcp6_request_sock_ops;
1537 1531
1538extern void tcp_v4_destroy_sock(struct sock *sk); 1532void tcp_v4_destroy_sock(struct sock *sk);
1539 1533
1540extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, 1534struct sk_buff *tcp_tso_segment(struct sk_buff *skb,
1541 netdev_features_t features); 1535 netdev_features_t features);
1542extern struct sk_buff **tcp_gro_receive(struct sk_buff **head, 1536struct sk_buff **tcp_gro_receive(struct sk_buff **head, struct sk_buff *skb);
1543 struct sk_buff *skb); 1537int tcp_gro_complete(struct sk_buff *skb);
1544extern int tcp_gro_complete(struct sk_buff *skb);
1545 1538
1546extern void __tcp_v4_send_check(struct sk_buff *skb, __be32 saddr, 1539void __tcp_v4_send_check(struct sk_buff *skb, __be32 saddr, __be32 daddr);
1547 __be32 daddr);
1548 1540
1549static inline u32 tcp_notsent_lowat(const struct tcp_sock *tp) 1541static inline u32 tcp_notsent_lowat(const struct tcp_sock *tp)
1550{ 1542{
@@ -1560,8 +1552,8 @@ static inline bool tcp_stream_memory_free(const struct sock *sk)
1560} 1552}
1561 1553
1562#ifdef CONFIG_PROC_FS 1554#ifdef CONFIG_PROC_FS
1563extern int tcp4_proc_init(void); 1555int tcp4_proc_init(void);
1564extern void tcp4_proc_exit(void); 1556void tcp4_proc_exit(void);
1565#endif 1557#endif
1566 1558
1567/* TCP af-specific functions */ 1559/* TCP af-specific functions */
@@ -1592,9 +1584,9 @@ struct tcp_request_sock_ops {
1592#endif 1584#endif
1593}; 1585};
1594 1586
1595extern int tcpv4_offload_init(void); 1587int tcpv4_offload_init(void);
1596 1588
1597extern void tcp_v4_init(void); 1589void tcp_v4_init(void);
1598extern void tcp_init(void); 1590void tcp_init(void);
1599 1591
1600#endif /* _TCP_H */ 1592#endif /* _TCP_H */