From nobody Mon Sep 16 19:16:50 2024 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7876617ADD for ; Tue, 29 Aug 2023 15:39:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693323572; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=14dkQh8lOMiabHZDfzKW3tl3Zj9V96jFPZ5MkZ9twqI=; b=bU1a+9CXE2cjxxqIjSSxd33TAx/hOBJqhQRl+3D/qLyDN0Wy1KWTxtqhl6WFzDoLWRQT/H fF0oU5Ixm/gChGJjtVALF56jVgj43QBOab1TKObulo/xsfxDSyKdXhw51PgYx3pQtyjiun NjP5imvmryKDHwjLXA+eSMGsoK0+EsU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-459-7U64NHiiNeyLpnpPfNWP1g-1; Tue, 29 Aug 2023 11:39:30 -0400 X-MC-Unique: 7U64NHiiNeyLpnpPfNWP1g-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7D1CA8EF063 for ; Tue, 29 Aug 2023 15:39:30 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.45.226.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id D019140C2063 for ; Tue, 29 Aug 2023 15:39:29 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH mptcp-next v2 1/2] mptcp: rename timer related helper to less confusing names Date: Tue, 29 Aug 2023 17:39:20 +0200 Message-ID: <6b14b1e72b7d18cc7ca0f3a591032ddbc25a5ad4.1693322440.git.pabeni@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8"; x-default="true" The msk socket uses to different timeout to track close related events and retransmissions. The existing helpers do not indicate clearly which timer they actually touch, making the related code quite confusing. Change the existing helpers name to avoid such confusion. No functional change intended. Signed-off-by: Paolo Abeni --- net/mptcp/protocol.c | 42 +++++++++++++++++++++--------------------- net/mptcp/protocol.h | 2 +- net/mptcp/subflow.c | 2 +- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 357030f40cef..33093ed87077 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -399,7 +399,7 @@ static bool __mptcp_move_skb(struct mptcp_sock *msk, st= ruct sock *ssk, return false; } =20 -static void mptcp_stop_timer(struct sock *sk) +static void mptcp_stop_rtx_timer(struct sock *sk) { struct inet_connection_sock *icsk =3D inet_csk(sk); =20 @@ -905,12 +905,12 @@ static void __mptcp_flush_join_list(struct sock *sk, = struct list_head *join_list } } =20 -static bool mptcp_timer_pending(struct sock *sk) +static bool mptcp_rtx_timer_pending(struct sock *sk) { return timer_pending(&inet_csk(sk)->icsk_retransmit_timer); } =20 -static void mptcp_reset_timer(struct sock *sk) +static void mptcp_reset_rtx_timer(struct sock *sk) { struct inet_connection_sock *icsk =3D inet_csk(sk); unsigned long tout; @@ -1044,10 +1044,10 @@ static void __mptcp_clean_una(struct sock *sk) out: if (snd_una =3D=3D READ_ONCE(msk->snd_nxt) && snd_una =3D=3D READ_ONCE(msk->write_seq)) { - if (mptcp_timer_pending(sk) && !mptcp_data_fin_enabled(msk)) - mptcp_stop_timer(sk); + if (mptcp_rtx_timer_pending(sk) && !mptcp_data_fin_enabled(msk)) + mptcp_stop_rtx_timer(sk); } else { - mptcp_reset_timer(sk); + mptcp_reset_rtx_timer(sk); } } =20 @@ -1620,8 +1620,8 @@ void __mptcp_push_pending(struct sock *sk, unsigned i= nt flags) mptcp_push_release(ssk, &info); =20 /* ensure the rtx timer is running */ - if (!mptcp_timer_pending(sk)) - mptcp_reset_timer(sk); + if (!mptcp_rtx_timer_pending(sk)) + mptcp_reset_rtx_timer(sk); if (do_check_data_fin) mptcp_check_send_data_fin(sk); } @@ -1684,8 +1684,8 @@ static void __mptcp_subflow_push_pending(struct sock = *sk, struct sock *ssk, bool if (copied) { tcp_push(ssk, 0, info.mss_now, tcp_sk(ssk)->nonagle, info.size_goal); - if (!mptcp_timer_pending(sk)) - mptcp_reset_timer(sk); + if (!mptcp_rtx_timer_pending(sk)) + mptcp_reset_rtx_timer(sk); =20 if (msk->snd_data_fin_enable && msk->snd_nxt + 1 =3D=3D msk->write_seq) @@ -2254,7 +2254,7 @@ static void mptcp_retransmit_timer(struct timer_list = *t) sock_put(sk); } =20 -static void mptcp_timeout_timer(struct timer_list *t) +static void mptcp_tout_timer(struct timer_list *t) { struct sock *sk =3D from_timer(sk, t, sk_timer); =20 @@ -2623,14 +2623,14 @@ static void __mptcp_retrans(struct sock *sk) reset_timer: mptcp_check_and_set_pending(sk); =20 - if (!mptcp_timer_pending(sk)) - mptcp_reset_timer(sk); + if (!mptcp_rtx_timer_pending(sk)) + mptcp_reset_rtx_timer(sk); } =20 /* schedule the timeout timer for the relevant event: either close timeout * or mp_fail timeout. The close timeout takes precedence on the mp_fail o= ne */ -void mptcp_reset_timeout(struct mptcp_sock *msk, unsigned long fail_tout) +void mptcp_reset_tout_timer(struct mptcp_sock *msk, unsigned long fail_tou= t) { struct sock *sk =3D (struct sock *)msk; unsigned long timeout, close_timeout; @@ -2663,7 +2663,7 @@ static void mptcp_mp_fail_no_response(struct mptcp_so= ck *msk) WRITE_ONCE(mptcp_subflow_ctx(ssk)->fail_tout, 0); unlock_sock_fast(ssk, slow); =20 - mptcp_reset_timeout(msk, 0); + mptcp_reset_tout_timer(msk, 0); } =20 static void mptcp_do_fastclose(struct sock *sk) @@ -2752,7 +2752,7 @@ static void __mptcp_init_sock(struct sock *sk) =20 /* re-use the csk retrans timer for MPTCP-level retrans */ timer_setup(&msk->sk.icsk_retransmit_timer, mptcp_retransmit_timer, 0); - timer_setup(&sk->sk_timer, mptcp_timeout_timer, 0); + timer_setup(&sk->sk_timer, mptcp_tout_timer, 0); } =20 static void mptcp_ca_reset(struct sock *sk) @@ -2843,8 +2843,8 @@ void mptcp_subflow_shutdown(struct sock *sk, struct s= ock *ssk, int how) } else { pr_debug("Sending DATA_FIN on subflow %p", ssk); tcp_send_ack(ssk); - if (!mptcp_timer_pending(sk)) - mptcp_reset_timer(sk); + if (!mptcp_rtx_timer_pending(sk)) + mptcp_reset_rtx_timer(sk); } break; } @@ -2927,7 +2927,7 @@ static void __mptcp_destroy_sock(struct sock *sk) =20 might_sleep(); =20 - mptcp_stop_timer(sk); + mptcp_stop_rtx_timer(sk); sk_stop_timer(sk, &sk->sk_timer); msk->pm.status =3D 0; mptcp_release_sched(msk); @@ -3047,7 +3047,7 @@ bool __mptcp_close(struct sock *sk, long timeout) __mptcp_destroy_sock(sk); do_cancel_work =3D true; } else { - mptcp_reset_timeout(msk, 0); + mptcp_reset_tout_timer(msk, 0); } =20 return do_cancel_work; @@ -3110,7 +3110,7 @@ static int mptcp_disconnect(struct sock *sk, int flag= s) mptcp_check_listen_stop(sk); inet_sk_state_store(sk, TCP_CLOSE); =20 - mptcp_stop_timer(sk); + mptcp_stop_rtx_timer(sk); sk_stop_timer(sk, &sk->sk_timer); =20 if (msk->token) diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 12d70ce24843..4fcce9ad7d04 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -725,7 +725,7 @@ void mptcp_get_options(const struct sk_buff *skb, =20 void mptcp_finish_connect(struct sock *sk); void __mptcp_set_connected(struct sock *sk); -void mptcp_reset_timeout(struct mptcp_sock *msk, unsigned long fail_tout); +void mptcp_reset_tout_timer(struct mptcp_sock *msk, unsigned long fail_tou= t); static inline bool mptcp_is_fully_established(struct sock *sk) { return inet_sk_state_load(sk) =3D=3D TCP_ESTABLISHED && diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index 2f40c23fdb0d..433f290984c8 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -1226,7 +1226,7 @@ static void mptcp_subflow_fail(struct mptcp_sock *msk= , struct sock *ssk) WRITE_ONCE(subflow->fail_tout, fail_tout); tcp_send_ack(ssk); =20 - mptcp_reset_timeout(msk, subflow->fail_tout); + mptcp_reset_tout_timer(msk, subflow->fail_tout); } =20 static bool subflow_check_data_avail(struct sock *ssk) --=20 2.41.0