[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1708412505-34470-5-git-send-email-alibuda@linux.alibaba.com>
Date: Tue, 20 Feb 2024 15:01:29 +0800
From: "D. Wythe" <alibuda@...ux.alibaba.com>
To: kgraul@...ux.ibm.com,
wenjia@...ux.ibm.com,
jaka@...ux.ibm.com,
wintera@...ux.ibm.com,
guwen@...ux.alibaba.com
Cc: kuba@...nel.org,
davem@...emloft.net,
netdev@...r.kernel.org,
linux-s390@...r.kernel.org,
linux-rdma@...r.kernel.org,
tonylu@...ux.alibaba.com,
pabeni@...hat.com,
edumazet@...gle.com
Subject: [RFC net-next 04/20] net/smc: refactor smc_accept_poll
From: "D. Wythe" <alibuda@...ux.alibaba.com>
Refactoring smc_accept_poll to extract a common function for
determining whether the accept_queue is empty.
Signed-off-by: D. Wythe <alibuda@...ux.alibaba.com>
---
net/smc/af_smc.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index e87af68..7966d06 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -2832,17 +2832,16 @@ static int smc_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
return rc;
}
-static __poll_t smc_accept_poll(struct sock *parent)
+static inline bool smc_accept_queue_empty(struct sock *sk)
{
- struct smc_sock *isk = smc_sk(parent);
- __poll_t mask = 0;
-
- spin_lock(&isk->accept_q_lock);
- if (!list_empty(&isk->accept_q))
- mask = EPOLLIN | EPOLLRDNORM;
- spin_unlock(&isk->accept_q_lock);
+ return list_empty(&smc_sk(sk)->accept_q);
+}
- return mask;
+static __poll_t smc_accept_poll(struct sock *parent)
+{
+ if (!smc_accept_queue_empty(parent))
+ return EPOLLIN | EPOLLRDNORM;
+ return 0;
}
static __poll_t smc_poll(struct file *file, struct socket *sock,
--
1.8.3.1
Powered by blists - more mailing lists