From patchwork Fri Jan 6 18:57:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mat Martineau X-Patchwork-Id: 13091695 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC173C678D5 for ; Fri, 6 Jan 2023 18:58:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236055AbjAFS6F (ORCPT ); Fri, 6 Jan 2023 13:58:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236007AbjAFS5j (ORCPT ); Fri, 6 Jan 2023 13:57:39 -0500 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F3CD78A45 for ; Fri, 6 Jan 2023 10:57:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673031457; x=1704567457; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aYY8FrSZ5gw/YuCtSkKF0F9kPFE+0CLA5mrE49wzgUA=; b=frVnjAyKIXNztwh8zoVEsdG8aXRpdVQvygVVWbLE5cCL7OvqdGmNDE7k 24HeuKyO3hQGc615kd9aYNDg9g54eBhhg7oP4GF5oLYz/1ygLC/cw74lR nvMMxLALmNA6VBnDfhNq5m4Q/Qvv9aqhB32dT89TzDuZ/3oJ2QFV+Ds4J CQd206r55z67AABq5Q+ViKMIU5tcZcpWPZynqd8w5h2ic+nLaYmdefZTm ARRe191Xx+SFemBzlcjO9coOMmgrxQCbdleXuL0BzplCDmS2uzRV7/FqJ lm9v0Mtl0JrXgihwk+OqGvlRZJJ1t0ydHCw6V46PuyqdG/qKOlv/GdWxF Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10582"; a="322611224" X-IronPort-AV: E=Sophos;i="5.96,306,1665471600"; d="scan'208";a="322611224" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jan 2023 10:57:34 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10582"; a="688383430" X-IronPort-AV: E=Sophos;i="5.96,306,1665471600"; d="scan'208";a="688383430" Received: from mechevar-mobl.amr.corp.intel.com (HELO mjmartin-desk2.intel.com) ([10.209.66.63]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jan 2023 10:57:33 -0800 From: Mat Martineau To: netdev@vger.kernel.org Cc: Menglong Dong , davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, matthieu.baerts@tessares.net, mptcp@lists.linux.dev, Mat Martineau Subject: [PATCH net-next 4/9] mptcp: introduce 'sk' to replace 'sock->sk' in mptcp_listen() Date: Fri, 6 Jan 2023 10:57:20 -0800 Message-Id: <20230106185725.299977-5-mathew.j.martineau@linux.intel.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230106185725.299977-1-mathew.j.martineau@linux.intel.com> References: <20230106185725.299977-1-mathew.j.martineau@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Menglong Dong 'sock->sk' is used frequently in mptcp_listen(). Therefore, we can introduce the 'sk' and replace 'sock->sk' with it. Acked-by: Paolo Abeni Signed-off-by: Menglong Dong Signed-off-by: Mat Martineau --- net/mptcp/protocol.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 62c140f96d77..1ce003f15d70 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -3638,12 +3638,13 @@ static int mptcp_stream_connect(struct socket *sock, struct sockaddr *uaddr, static int mptcp_listen(struct socket *sock, int backlog) { struct mptcp_sock *msk = mptcp_sk(sock->sk); + struct sock *sk = sock->sk; struct socket *ssock; int err; pr_debug("msk=%p", msk); - lock_sock(sock->sk); + lock_sock(sk); ssock = __mptcp_nmpc_socket(msk); if (!ssock) { err = -EINVAL; @@ -3651,18 +3652,18 @@ static int mptcp_listen(struct socket *sock, int backlog) } mptcp_token_destroy(msk); - inet_sk_state_store(sock->sk, TCP_LISTEN); - sock_set_flag(sock->sk, SOCK_RCU_FREE); + inet_sk_state_store(sk, TCP_LISTEN); + sock_set_flag(sk, SOCK_RCU_FREE); err = ssock->ops->listen(ssock, backlog); - inet_sk_state_store(sock->sk, inet_sk_state_load(ssock->sk)); + inet_sk_state_store(sk, inet_sk_state_load(ssock->sk)); if (!err) - mptcp_copy_inaddrs(sock->sk, ssock->sk); + mptcp_copy_inaddrs(sk, ssock->sk); mptcp_event_pm_listener(ssock->sk, MPTCP_EVENT_LISTENER_CREATED); unlock: - release_sock(sock->sk); + release_sock(sk); return err; }