From: menglong8.dong@gmail.com
To: mathew.j.martineau@linux.intel.com
Cc: mptcp@lists.linux.dev, Menglong Dong <imagedong@tencent.com>
Subject: [PATCH mptcp-next v2 1/2] mptcp: introduce 'sk' to replace 'sock->sk' in mptcp_listen()
Date: Wed, 21 Sep 2022 20:04:41 +0800 [thread overview]
Message-ID: <20220921120442.320727-2-imagedong@tencent.com> (raw)
In-Reply-To: <20220921120442.320727-1-imagedong@tencent.com>
From: Menglong Dong <imagedong@tencent.com>
'sock->sk' is used frequently in mptcp_listen(). Therefore, we can
introduce the 'sk' and replace 'sock->sk' with it.
Signed-off-by: Menglong Dong <imagedong@tencent.com>
---
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 d6d3ebeb7c9b..1550455f7640 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -3548,12 +3548,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;
@@ -3561,16 +3562,16 @@ 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);
unlock:
- release_sock(sock->sk);
+ release_sock(sk);
return err;
}
--
2.37.2
next prev parent reply other threads:[~2022-09-21 12:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-21 12:04 [PATCH mptcp-next v2 0/2] mptcp: add statistics for mptcp socket in use menglong8.dong
2022-09-21 12:04 ` menglong8.dong [this message]
2022-09-21 12:04 ` [PATCH mptcp-next v2 2/2] " menglong8.dong
2022-09-21 12:42 ` Matthieu Baerts
2022-09-21 12:52 ` Menglong Dong
2022-09-21 13:37 ` mptcp: add statistics for mptcp socket in use: Tests Results MPTCP CI
2022-09-22 0:03 ` [PATCH mptcp-next v2 0/2] mptcp: add statistics for mptcp socket in use Mat Martineau
2022-09-22 3:48 ` Menglong Dong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220921120442.320727-2-imagedong@tencent.com \
--to=menglong8.dong@gmail.com \
--cc=imagedong@tencent.com \
--cc=mathew.j.martineau@linux.intel.com \
--cc=mptcp@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.