diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/net/tcp.h | 424 |
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 @@ | |||
50 | extern struct inet_hashinfo tcp_hashinfo; | 50 | extern struct inet_hashinfo tcp_hashinfo; |
51 | 51 | ||
52 | extern struct percpu_counter tcp_orphan_count; | 52 | extern struct percpu_counter tcp_orphan_count; |
53 | extern void tcp_time_wait(struct sock *sk, int state, int timeo); | 53 | void 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 | ||
328 | extern bool tcp_check_oom(struct sock *sk, int shift); | 328 | bool 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 */ |
331 | static inline void tcp_synq_overflow(struct sock *sk) | 331 | static 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 | ||
351 | extern void tcp_init_mem(struct net *net); | 351 | void tcp_init_mem(struct net *net); |
352 | 352 | ||
353 | extern void tcp_tasklet_init(void); | 353 | void tcp_tasklet_init(void); |
354 | 354 | ||
355 | extern void tcp_v4_err(struct sk_buff *skb, u32); | 355 | void tcp_v4_err(struct sk_buff *skb, u32); |
356 | 356 | ||
357 | extern void tcp_shutdown (struct sock *sk, int how); | 357 | void tcp_shutdown(struct sock *sk, int how); |
358 | 358 | ||
359 | extern void tcp_v4_early_demux(struct sk_buff *skb); | 359 | void tcp_v4_early_demux(struct sk_buff *skb); |
360 | extern int tcp_v4_rcv(struct sk_buff *skb); | 360 | int tcp_v4_rcv(struct sk_buff *skb); |
361 | 361 | ||
362 | extern int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw); | 362 | int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw); |
363 | extern int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | 363 | int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, |
364 | size_t size); | 364 | size_t size); |
365 | extern int tcp_sendpage(struct sock *sk, struct page *page, int offset, | 365 | int tcp_sendpage(struct sock *sk, struct page *page, int offset, size_t size, |
366 | size_t size, int flags); | 366 | int flags); |
367 | extern void tcp_release_cb(struct sock *sk); | 367 | void tcp_release_cb(struct sock *sk); |
368 | extern void tcp_wfree(struct sk_buff *skb); | 368 | void tcp_wfree(struct sk_buff *skb); |
369 | extern void tcp_write_timer_handler(struct sock *sk); | 369 | void tcp_write_timer_handler(struct sock *sk); |
370 | extern void tcp_delack_timer_handler(struct sock *sk); | 370 | void tcp_delack_timer_handler(struct sock *sk); |
371 | extern int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg); | 371 | int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg); |
372 | extern int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | 372 | int 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); |
374 | extern void tcp_rcv_established(struct sock *sk, struct sk_buff *skb, | 374 | void 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); |
376 | extern void tcp_rcv_space_adjust(struct sock *sk); | 376 | void tcp_rcv_space_adjust(struct sock *sk); |
377 | extern void tcp_cleanup_rbuf(struct sock *sk, int copied); | 377 | void tcp_cleanup_rbuf(struct sock *sk, int copied); |
378 | extern int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp); | 378 | int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp); |
379 | extern void tcp_twsk_destructor(struct sock *sk); | 379 | void tcp_twsk_destructor(struct sock *sk); |
380 | extern ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos, | 380 | ssize_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 | ||
384 | static inline void tcp_dec_quickack_mode(struct sock *sk, | 384 | static 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 | ||
412 | extern enum tcp_tw_status tcp_timewait_state_process(struct inet_timewait_sock *tw, | 412 | enum 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); |
415 | extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb, | 415 | struct 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); | 418 | int tcp_child_process(struct sock *parent, struct sock *child, |
419 | extern int tcp_child_process(struct sock *parent, struct sock *child, | 419 | struct sk_buff *skb); |
420 | struct sk_buff *skb); | 420 | void tcp_enter_loss(struct sock *sk, int how); |
421 | extern void tcp_enter_loss(struct sock *sk, int how); | 421 | void tcp_clear_retrans(struct tcp_sock *tp); |
422 | extern void tcp_clear_retrans(struct tcp_sock *tp); | 422 | void tcp_update_metrics(struct sock *sk); |
423 | extern void tcp_update_metrics(struct sock *sk); | 423 | void tcp_init_metrics(struct sock *sk); |
424 | extern void tcp_init_metrics(struct sock *sk); | 424 | void tcp_metrics_init(void); |
425 | extern void tcp_metrics_init(void); | 425 | bool tcp_peer_is_proven(struct request_sock *req, struct dst_entry *dst, |
426 | extern bool tcp_peer_is_proven(struct request_sock *req, struct dst_entry *dst, bool paws_check); | 426 | bool paws_check); |
427 | extern bool tcp_remember_stamp(struct sock *sk); | 427 | bool tcp_remember_stamp(struct sock *sk); |
428 | extern bool tcp_tw_remember_stamp(struct inet_timewait_sock *tw); | 428 | bool tcp_tw_remember_stamp(struct inet_timewait_sock *tw); |
429 | extern void tcp_fetch_timewait_stamp(struct sock *sk, struct dst_entry *dst); | 429 | void tcp_fetch_timewait_stamp(struct sock *sk, struct dst_entry *dst); |
430 | extern void tcp_disable_fack(struct tcp_sock *tp); | 430 | void tcp_disable_fack(struct tcp_sock *tp); |
431 | extern void tcp_close(struct sock *sk, long timeout); | 431 | void tcp_close(struct sock *sk, long timeout); |
432 | extern void tcp_init_sock(struct sock *sk); | 432 | void tcp_init_sock(struct sock *sk); |
433 | extern unsigned int tcp_poll(struct file * file, struct socket *sock, | 433 | unsigned int tcp_poll(struct file *file, struct socket *sock, |
434 | struct poll_table_struct *wait); | 434 | struct poll_table_struct *wait); |
435 | extern int tcp_getsockopt(struct sock *sk, int level, int optname, | 435 | int tcp_getsockopt(struct sock *sk, int level, int optname, |
436 | char __user *optval, int __user *optlen); | ||
437 | int tcp_setsockopt(struct sock *sk, int level, int optname, | ||
438 | char __user *optval, unsigned int optlen); | ||
439 | int compat_tcp_getsockopt(struct sock *sk, int level, int optname, | ||
436 | char __user *optval, int __user *optlen); | 440 | char __user *optval, int __user *optlen); |
437 | extern int tcp_setsockopt(struct sock *sk, int level, int optname, | 441 | int compat_tcp_setsockopt(struct sock *sk, int level, int optname, |
438 | char __user *optval, unsigned int optlen); | 442 | char __user *optval, unsigned int optlen); |
439 | extern int compat_tcp_getsockopt(struct sock *sk, int level, int optname, | 443 | void tcp_set_keepalive(struct sock *sk, int val); |
440 | char __user *optval, int __user *optlen); | 444 | void tcp_syn_ack_timeout(struct sock *sk, struct request_sock *req); |
441 | extern int compat_tcp_setsockopt(struct sock *sk, int level, int optname, | 445 | int 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); |
443 | extern void tcp_set_keepalive(struct sock *sk, int val); | 447 | void tcp_parse_options(const struct sk_buff *skb, |
444 | extern void tcp_syn_ack_timeout(struct sock *sk, struct request_sock *req); | 448 | struct tcp_options_received *opt_rx, |
445 | extern 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); | 450 | const u8 *tcp_parse_md5sig_option(const struct tcphdr *th); |
447 | extern void tcp_parse_options(const struct sk_buff *skb, | ||
448 | struct tcp_options_received *opt_rx, | ||
449 | int estab, struct tcp_fastopen_cookie *foc); | ||
450 | extern 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 | ||
456 | extern void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb); | 456 | void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb); |
457 | extern int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb); | 457 | int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb); |
458 | extern struct sock * tcp_create_openreq_child(struct sock *sk, | 458 | struct 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); |
461 | extern struct sock * tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | 461 | struct 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); |
464 | extern int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb); | 464 | int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb); |
465 | extern int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, | 465 | int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len); |
466 | int addr_len); | 466 | int tcp_connect(struct sock *sk); |
467 | extern int tcp_connect(struct sock *sk); | 467 | struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst, |
468 | extern 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); | 470 | int tcp_disconnect(struct sock *sk, int flags); |
471 | extern int tcp_disconnect(struct sock *sk, int flags); | ||
472 | 471 | ||
473 | void tcp_connect_init(struct sock *sk); | 472 | void tcp_connect_init(struct sock *sk); |
474 | void tcp_finish_connect(struct sock *sk, struct sk_buff *skb); | 473 | void 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 */ |
479 | extern __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS]; | 478 | extern __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS]; |
480 | extern int __cookie_v4_check(const struct iphdr *iph, const struct tcphdr *th, | 479 | int __cookie_v4_check(const struct iphdr *iph, const struct tcphdr *th, |
481 | u32 cookie); | 480 | u32 cookie); |
482 | extern struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, | 481 | struct 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 |
485 | extern u32 __cookie_v4_init_sequence(const struct iphdr *iph, | 484 | u32 __cookie_v4_init_sequence(const struct iphdr *iph, const struct tcphdr *th, |
486 | const struct tcphdr *th, u16 *mssp); | 485 | u16 *mssp); |
487 | extern __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 |
490 | static inline __u32 cookie_v4_init_sequence(struct sock *sk, | 488 | static 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 | ||
498 | extern __u32 cookie_init_timestamp(struct request_sock *req); | 496 | __u32 cookie_init_timestamp(struct request_sock *req); |
499 | extern bool cookie_check_timestamp(struct tcp_options_received *opt, | 497 | bool 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 */ |
503 | extern int __cookie_v6_check(const struct ipv6hdr *iph, const struct tcphdr *th, | 501 | int __cookie_v6_check(const struct ipv6hdr *iph, const struct tcphdr *th, |
504 | u32 cookie); | 502 | u32 cookie); |
505 | extern struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb); | 503 | struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb); |
506 | #ifdef CONFIG_SYN_COOKIES | 504 | #ifdef CONFIG_SYN_COOKIES |
507 | extern u32 __cookie_v6_init_sequence(const struct ipv6hdr *iph, | 505 | u32 __cookie_v6_init_sequence(const struct ipv6hdr *iph, |
508 | const struct tcphdr *th, u16 *mssp); | 506 | const struct tcphdr *th, u16 *mssp); |
509 | extern __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 |
512 | static inline __u32 cookie_v6_init_sequence(struct sock *sk, | 510 | static 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 | ||
521 | extern void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss, | 519 | void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss, |
522 | int nonagle); | 520 | int nonagle); |
523 | extern bool tcp_may_send_now(struct sock *sk); | 521 | bool tcp_may_send_now(struct sock *sk); |
524 | extern int __tcp_retransmit_skb(struct sock *, struct sk_buff *); | 522 | int __tcp_retransmit_skb(struct sock *, struct sk_buff *); |
525 | extern int tcp_retransmit_skb(struct sock *, struct sk_buff *); | 523 | int tcp_retransmit_skb(struct sock *, struct sk_buff *); |
526 | extern void tcp_retransmit_timer(struct sock *sk); | 524 | void tcp_retransmit_timer(struct sock *sk); |
527 | extern void tcp_xmit_retransmit_queue(struct sock *); | 525 | void tcp_xmit_retransmit_queue(struct sock *); |
528 | extern void tcp_simple_retransmit(struct sock *); | 526 | void tcp_simple_retransmit(struct sock *); |
529 | extern int tcp_trim_head(struct sock *, struct sk_buff *, u32); | 527 | int tcp_trim_head(struct sock *, struct sk_buff *, u32); |
530 | extern int tcp_fragment(struct sock *, struct sk_buff *, u32, unsigned int); | 528 | int tcp_fragment(struct sock *, struct sk_buff *, u32, unsigned int); |
531 | 529 | ||
532 | extern void tcp_send_probe0(struct sock *); | 530 | void tcp_send_probe0(struct sock *); |
533 | extern void tcp_send_partial(struct sock *); | 531 | void tcp_send_partial(struct sock *); |
534 | extern int tcp_write_wakeup(struct sock *); | 532 | int tcp_write_wakeup(struct sock *); |
535 | extern void tcp_send_fin(struct sock *sk); | 533 | void tcp_send_fin(struct sock *sk); |
536 | extern void tcp_send_active_reset(struct sock *sk, gfp_t priority); | 534 | void tcp_send_active_reset(struct sock *sk, gfp_t priority); |
537 | extern int tcp_send_synack(struct sock *); | 535 | int tcp_send_synack(struct sock *); |
538 | extern bool tcp_syn_flood_action(struct sock *sk, | 536 | bool 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); | 538 | void tcp_push_one(struct sock *, unsigned int mss_now); |
541 | extern void tcp_push_one(struct sock *, unsigned int mss_now); | 539 | void tcp_send_ack(struct sock *sk); |
542 | extern void tcp_send_ack(struct sock *sk); | 540 | void tcp_send_delayed_ack(struct sock *sk); |
543 | extern void tcp_send_delayed_ack(struct sock *sk); | 541 | void tcp_send_loss_probe(struct sock *sk); |
544 | extern void tcp_send_loss_probe(struct sock *sk); | 542 | bool tcp_schedule_loss_probe(struct sock *sk); |
545 | 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 | void tcp_cwnd_application_limited(struct sock *sk); |
549 | extern void tcp_resume_early_retransmit(struct sock *sk); | 546 | void tcp_resume_early_retransmit(struct sock *sk); |
550 | extern void tcp_rearm_rto(struct sock *sk); | 547 | void tcp_rearm_rto(struct sock *sk); |
551 | extern void tcp_reset(struct sock *sk); | 548 | void tcp_reset(struct sock *sk); |
552 | 549 | ||
553 | /* tcp_timer.c */ | 550 | /* tcp_timer.c */ |
554 | extern void tcp_init_xmit_timers(struct sock *); | 551 | void tcp_init_xmit_timers(struct sock *); |
555 | static inline void tcp_clear_xmit_timers(struct sock *sk) | 552 | static 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 | ||
560 | extern unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu); | 557 | unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu); |
561 | extern unsigned int tcp_current_mss(struct sock *sk); | 558 | unsigned 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 */ |
564 | static inline int tcp_bound_to_half_wnd(struct tcp_sock *tp, int pktsize) | 561 | static 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 */ |
587 | extern void tcp_get_info(const struct sock *, struct tcp_info *); | 584 | void 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 */ |
590 | typedef int (*sk_read_actor_t)(read_descriptor_t *, struct sk_buff *, | 587 | typedef int (*sk_read_actor_t)(read_descriptor_t *, struct sk_buff *, |
591 | unsigned int, size_t); | 588 | unsigned int, size_t); |
592 | extern int tcp_read_sock(struct sock *sk, read_descriptor_t *desc, | 589 | int 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 | ||
595 | extern void tcp_initialize_rcv_mss(struct sock *sk); | 592 | void tcp_initialize_rcv_mss(struct sock *sk); |
596 | 593 | ||
597 | extern int tcp_mtu_to_mss(struct sock *sk, int pmtu); | 594 | int tcp_mtu_to_mss(struct sock *sk, int pmtu); |
598 | extern int tcp_mss_to_mtu(struct sock *sk, int mss); | 595 | int tcp_mss_to_mtu(struct sock *sk, int mss); |
599 | extern void tcp_mtup_init(struct sock *sk); | 596 | void tcp_mtup_init(struct sock *sk); |
600 | extern void tcp_init_buffer_space(struct sock *sk); | 597 | void tcp_init_buffer_space(struct sock *sk); |
601 | 598 | ||
602 | static inline void tcp_bound_rto(const struct sock *sk) | 599 | static 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 | ||
613 | extern void tcp_set_rto(struct sock *sk); | 610 | void tcp_set_rto(struct sock *sk); |
614 | 611 | ||
615 | static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd) | 612 | static 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 | */ |
666 | extern u32 __tcp_select_window(struct sock *sk); | 663 | u32 __tcp_select_window(struct sock *sk); |
667 | 664 | ||
668 | void tcp_send_window_probe(struct sock *sk); | 665 | void 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 | ||
803 | extern int tcp_register_congestion_control(struct tcp_congestion_ops *type); | 800 | int tcp_register_congestion_control(struct tcp_congestion_ops *type); |
804 | extern void tcp_unregister_congestion_control(struct tcp_congestion_ops *type); | 801 | void tcp_unregister_congestion_control(struct tcp_congestion_ops *type); |
805 | 802 | ||
806 | extern void tcp_init_congestion_control(struct sock *sk); | 803 | void tcp_init_congestion_control(struct sock *sk); |
807 | extern void tcp_cleanup_congestion_control(struct sock *sk); | 804 | void tcp_cleanup_congestion_control(struct sock *sk); |
808 | extern int tcp_set_default_congestion_control(const char *name); | 805 | int tcp_set_default_congestion_control(const char *name); |
809 | extern void tcp_get_default_congestion_control(char *name); | 806 | void tcp_get_default_congestion_control(char *name); |
810 | extern void tcp_get_available_congestion_control(char *buf, size_t len); | 807 | void tcp_get_available_congestion_control(char *buf, size_t len); |
811 | extern void tcp_get_allowed_congestion_control(char *buf, size_t len); | 808 | void tcp_get_allowed_congestion_control(char *buf, size_t len); |
812 | extern int tcp_set_allowed_congestion_control(char *allowed); | 809 | int tcp_set_allowed_congestion_control(char *allowed); |
813 | extern int tcp_set_congestion_control(struct sock *sk, const char *name); | 810 | int tcp_set_congestion_control(struct sock *sk, const char *name); |
814 | extern void tcp_slow_start(struct tcp_sock *tp); | 811 | void tcp_slow_start(struct tcp_sock *tp); |
815 | extern void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w); | 812 | void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w); |
816 | 813 | ||
817 | extern struct tcp_congestion_ops tcp_init_congestion_ops; | 814 | extern struct tcp_congestion_ops tcp_init_congestion_ops; |
818 | extern u32 tcp_reno_ssthresh(struct sock *sk); | 815 | u32 tcp_reno_ssthresh(struct sock *sk); |
819 | extern void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 in_flight); | 816 | void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 in_flight); |
820 | extern u32 tcp_reno_min_cwnd(const struct sock *sk); | 817 | u32 tcp_reno_min_cwnd(const struct sock *sk); |
821 | extern struct tcp_congestion_ops tcp_reno; | 818 | extern struct tcp_congestion_ops tcp_reno; |
822 | 819 | ||
823 | static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state) | 820 | static 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 | ||
939 | extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh); | 936 | void tcp_enter_cwr(struct sock *sk, const int set_ssthresh); |
940 | extern __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 | } |
966 | extern bool tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight); | 963 | bool tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight); |
967 | 964 | ||
968 | static inline void tcp_minshall_update(struct tcp_sock *tp, unsigned int mss, | 965 | static 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 | ||
1031 | extern bool tcp_prequeue(struct sock *sk, struct sk_buff *skb); | 1028 | bool 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 |
1042 | extern void tcp_set_state(struct sock *sk, int state); | 1039 | void tcp_set_state(struct sock *sk, int state); |
1043 | 1040 | ||
1044 | extern void tcp_done(struct sock *sk); | 1041 | void tcp_done(struct sock *sk); |
1045 | 1042 | ||
1046 | static inline void tcp_sack_reset(struct tcp_options_received *rx_opt) | 1043 | static 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 | ||
1052 | extern u32 tcp_default_init_rwnd(u32 mss); | 1049 | u32 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. */ |
1055 | extern void tcp_select_initial_window(int __space, __u32 mss, | 1052 | void 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 | ||
1060 | static inline int tcp_win_from_space(int space) | 1056 | static 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 | ||
1102 | extern void tcp_enter_memory_pressure(struct sock *sk); | 1098 | void tcp_enter_memory_pressure(struct sock *sk); |
1103 | 1099 | ||
1104 | static inline int keepalive_intvl_when(const struct tcp_sock *tp) | 1100 | static 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 */ |
1255 | extern int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key, | 1251 | int 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); | 1254 | int tcp_md5_do_add(struct sock *sk, const union tcp_md5_addr *addr, |
1259 | extern 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, | 1256 | int tcp_md5_do_del(struct sock *sk, const union tcp_md5_addr *addr, |
1261 | u8 newkeylen, gfp_t gfp); | 1257 | int family); |
1262 | extern int tcp_md5_do_del(struct sock *sk, const union tcp_md5_addr *addr, | 1258 | struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk, |
1263 | int family); | ||
1264 | extern 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 |
1268 | extern struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk, | 1262 | struct 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 |
1272 | static inline struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk, | 1267 | static 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 | ||
1281 | extern bool tcp_alloc_md5sig_pool(void); | 1276 | bool tcp_alloc_md5sig_pool(void); |
1282 | 1277 | ||
1283 | extern struct tcp_md5sig_pool *tcp_get_md5sig_pool(void); | 1278 | struct tcp_md5sig_pool *tcp_get_md5sig_pool(void); |
1284 | static inline void tcp_put_md5sig_pool(void) | 1279 | static inline void tcp_put_md5sig_pool(void) |
1285 | { | 1280 | { |
1286 | local_bh_enable(); | 1281 | local_bh_enable(); |
1287 | } | 1282 | } |
1288 | 1283 | ||
1289 | extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, const struct tcphdr *); | 1284 | int tcp_md5_hash_header(struct tcp_md5sig_pool *, const struct tcphdr *); |
1290 | extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, const struct sk_buff *, | 1285 | int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, const struct sk_buff *, |
1291 | unsigned int header_len); | 1286 | unsigned int header_len); |
1292 | extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp, | 1287 | int 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 */ |
1296 | extern void tcp_fastopen_cache_get(struct sock *sk, u16 *mss, | 1291 | void 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); |
1299 | extern void tcp_fastopen_cache_set(struct sock *sk, u16 mss, | 1294 | void 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); | ||
1302 | struct tcp_fastopen_request { | 1296 | struct 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 | ||
1310 | extern struct tcp_fastopen_context __rcu *tcp_fastopen_ctx; | 1304 | extern struct tcp_fastopen_context __rcu *tcp_fastopen_ctx; |
1311 | int tcp_fastopen_reset_cipher(void *key, unsigned int len); | 1305 | int tcp_fastopen_reset_cipher(void *key, unsigned int len); |
1312 | extern void tcp_fastopen_cookie_gen(__be32 src, __be32 dst, | 1306 | void 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 | ||
1532 | extern int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo); | 1526 | int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo); |
1533 | extern void tcp_proc_unregister(struct net *net, struct tcp_seq_afinfo *afinfo); | 1527 | void tcp_proc_unregister(struct net *net, struct tcp_seq_afinfo *afinfo); |
1534 | 1528 | ||
1535 | extern struct request_sock_ops tcp_request_sock_ops; | 1529 | extern struct request_sock_ops tcp_request_sock_ops; |
1536 | extern struct request_sock_ops tcp6_request_sock_ops; | 1530 | extern struct request_sock_ops tcp6_request_sock_ops; |
1537 | 1531 | ||
1538 | extern void tcp_v4_destroy_sock(struct sock *sk); | 1532 | void tcp_v4_destroy_sock(struct sock *sk); |
1539 | 1533 | ||
1540 | extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, | 1534 | struct sk_buff *tcp_tso_segment(struct sk_buff *skb, |
1541 | netdev_features_t features); | 1535 | netdev_features_t features); |
1542 | extern struct sk_buff **tcp_gro_receive(struct sk_buff **head, | 1536 | struct sk_buff **tcp_gro_receive(struct sk_buff **head, struct sk_buff *skb); |
1543 | struct sk_buff *skb); | 1537 | int tcp_gro_complete(struct sk_buff *skb); |
1544 | extern int tcp_gro_complete(struct sk_buff *skb); | ||
1545 | 1538 | ||
1546 | extern void __tcp_v4_send_check(struct sk_buff *skb, __be32 saddr, | 1539 | void __tcp_v4_send_check(struct sk_buff *skb, __be32 saddr, __be32 daddr); |
1547 | __be32 daddr); | ||
1548 | 1540 | ||
1549 | static inline u32 tcp_notsent_lowat(const struct tcp_sock *tp) | 1541 | static 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 |
1563 | extern int tcp4_proc_init(void); | 1555 | int tcp4_proc_init(void); |
1564 | extern void tcp4_proc_exit(void); | 1556 | void 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 | ||
1595 | extern int tcpv4_offload_init(void); | 1587 | int tcpv4_offload_init(void); |
1596 | 1588 | ||
1597 | extern void tcp_v4_init(void); | 1589 | void tcp_v4_init(void); |
1598 | extern void tcp_init(void); | 1590 | void tcp_init(void); |
1599 | 1591 | ||
1600 | #endif /* _TCP_H */ | 1592 | #endif /* _TCP_H */ |