Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tcp: rename inet_csk_{delete|reset}_keepalive_timer()

inet_csk_delete_keepalive_timer() and inet_csk_reset_keepalive_timer()
are only used from core TCP, there is no need to export them.

Replace their prefix by tcp.

Move them to net/ipv4/tcp_timer.c and make tcp_delete_keepalive_timer()
static.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Jason Xing <kerneljasonxing@gmail.com>
Reviewed-by: Joe Damato <jdamato@fastly.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://patch.msgid.link/20250206094605.2694118-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Eric Dumazet and committed by
Jakub Kicinski
be258f65 d876ec8d

+22 -28
-3
include/net/inet_connection_sock.h
··· 189 189 memset(&inet_csk(sk)->icsk_ack, 0, sizeof(inet_csk(sk)->icsk_ack)); 190 190 } 191 191 192 - void inet_csk_delete_keepalive_timer(struct sock *sk); 193 - void inet_csk_reset_keepalive_timer(struct sock *sk, unsigned long timeout); 194 - 195 192 static inline void inet_csk_clear_xmit_timer(struct sock *sk, const int what) 196 193 { 197 194 struct inet_connection_sock *icsk = inet_csk(sk);
+1
include/net/tcp.h
··· 415 415 sockptr_t optval, unsigned int optlen); 416 416 int tcp_setsockopt(struct sock *sk, int level, int optname, sockptr_t optval, 417 417 unsigned int optlen); 418 + void tcp_reset_keepalive_timer(struct sock *sk, unsigned long timeout); 418 419 void tcp_set_keepalive(struct sock *sk, int val); 419 420 void tcp_syn_ack_timeout(const struct request_sock *req); 420 421 int tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
-12
net/ipv4/inet_connection_sock.c
··· 799 799 sk_stop_timer_sync(sk, &sk->sk_timer); 800 800 } 801 801 802 - void inet_csk_delete_keepalive_timer(struct sock *sk) 803 - { 804 - sk_stop_timer(sk, &sk->sk_timer); 805 - } 806 - EXPORT_SYMBOL(inet_csk_delete_keepalive_timer); 807 - 808 - void inet_csk_reset_keepalive_timer(struct sock *sk, unsigned long len) 809 - { 810 - sk_reset_timer(sk, &sk->sk_timer, jiffies + len); 811 - } 812 - EXPORT_SYMBOL(inet_csk_reset_keepalive_timer); 813 - 814 802 struct dst_entry *inet_csk_route_req(const struct sock *sk, 815 803 struct flowi4 *fl4, 816 804 const struct request_sock *req)
+2 -2
net/ipv4/tcp.c
··· 3179 3179 const int tmo = tcp_fin_time(sk); 3180 3180 3181 3181 if (tmo > TCP_TIMEWAIT_LEN) { 3182 - inet_csk_reset_keepalive_timer(sk, 3182 + tcp_reset_keepalive_timer(sk, 3183 3183 tmo - TCP_TIMEWAIT_LEN); 3184 3184 } else { 3185 3185 tcp_time_wait(sk, TCP_FIN_WAIT2, tmo); ··· 3632 3632 elapsed = tp->keepalive_time - elapsed; 3633 3633 else 3634 3634 elapsed = 0; 3635 - inet_csk_reset_keepalive_timer(sk, elapsed); 3635 + tcp_reset_keepalive_timer(sk, elapsed); 3636 3636 } 3637 3637 3638 3638 return 0;
+3 -3
net/ipv4/tcp_input.c
··· 6346 6346 tp->lsndtime = tcp_jiffies32; 6347 6347 6348 6348 if (sock_flag(sk, SOCK_KEEPOPEN)) 6349 - inet_csk_reset_keepalive_timer(sk, keepalive_time_when(tp)); 6349 + tcp_reset_keepalive_timer(sk, keepalive_time_when(tp)); 6350 6350 6351 6351 if (!tp->rx_opt.snd_wscale) 6352 6352 __tcp_fast_path_on(tp, tp->snd_wnd); ··· 6921 6921 6922 6922 tmo = tcp_fin_time(sk); 6923 6923 if (tmo > TCP_TIMEWAIT_LEN) { 6924 - inet_csk_reset_keepalive_timer(sk, tmo - TCP_TIMEWAIT_LEN); 6924 + tcp_reset_keepalive_timer(sk, tmo - TCP_TIMEWAIT_LEN); 6925 6925 } else if (th->fin || sock_owned_by_user(sk)) { 6926 6926 /* Bad case. We could lose such FIN otherwise. 6927 6927 * It is not a big problem, but it looks confusing ··· 6929 6929 * if it spins in bh_lock_sock(), but it is really 6930 6930 * marginal case. 6931 6931 */ 6932 - inet_csk_reset_keepalive_timer(sk, tmo); 6932 + tcp_reset_keepalive_timer(sk, tmo); 6933 6933 } else { 6934 6934 tcp_time_wait(sk, TCP_FIN_WAIT2, tmo); 6935 6935 goto consume;
+1 -2
net/ipv4/tcp_minisocks.c
··· 566 566 WRITE_ONCE(newtp->write_seq, newtp->pushed_seq = treq->snt_isn + 1); 567 567 568 568 if (sock_flag(newsk, SOCK_KEEPOPEN)) 569 - inet_csk_reset_keepalive_timer(newsk, 570 - keepalive_time_when(newtp)); 569 + tcp_reset_keepalive_timer(newsk, keepalive_time_when(newtp)); 571 570 572 571 newtp->rx_opt.tstamp_ok = ireq->tstamp_ok; 573 572 newtp->rx_opt.sack_ok = ireq->sack_ok;
+15 -6
net/ipv4/tcp_timer.c
··· 751 751 } 752 752 EXPORT_SYMBOL(tcp_syn_ack_timeout); 753 753 754 + void tcp_reset_keepalive_timer(struct sock *sk, unsigned long len) 755 + { 756 + sk_reset_timer(sk, &sk->sk_timer, jiffies + len); 757 + } 758 + 759 + static void tcp_delete_keepalive_timer(struct sock *sk) 760 + { 761 + sk_stop_timer(sk, &sk->sk_timer); 762 + } 763 + 754 764 void tcp_set_keepalive(struct sock *sk, int val) 755 765 { 756 766 if ((1 << sk->sk_state) & (TCPF_CLOSE | TCPF_LISTEN)) 757 767 return; 758 768 759 769 if (val && !sock_flag(sk, SOCK_KEEPOPEN)) 760 - inet_csk_reset_keepalive_timer(sk, keepalive_time_when(tcp_sk(sk))); 770 + tcp_reset_keepalive_timer(sk, keepalive_time_when(tcp_sk(sk))); 761 771 else if (!val) 762 - inet_csk_delete_keepalive_timer(sk); 772 + tcp_delete_keepalive_timer(sk); 763 773 } 764 774 EXPORT_SYMBOL_GPL(tcp_set_keepalive); 765 775 766 - 767 - static void tcp_keepalive_timer (struct timer_list *t) 776 + static void tcp_keepalive_timer(struct timer_list *t) 768 777 { 769 778 struct sock *sk = from_timer(sk, t, sk_timer); 770 779 struct inet_connection_sock *icsk = inet_csk(sk); ··· 784 775 bh_lock_sock(sk); 785 776 if (sock_owned_by_user(sk)) { 786 777 /* Try again later. */ 787 - inet_csk_reset_keepalive_timer (sk, HZ/20); 778 + tcp_reset_keepalive_timer(sk, HZ/20); 788 779 goto out; 789 780 } 790 781 ··· 850 841 } 851 842 852 843 resched: 853 - inet_csk_reset_keepalive_timer (sk, elapsed); 844 + tcp_reset_keepalive_timer(sk, elapsed); 854 845 goto out; 855 846 856 847 death: