public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Dust Li <dust.li@linux.alibaba.com>
To: Karsten Graul <kgraul@linux.ibm.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Cc: linux-s390@vger.kernel.org, netdev@vger.kernel.org,
	Wen Gu <guwen@linux.alibaba.com>,
	Tony Lu <tonylu@linux.alibaba.com>
Subject: [PATCH net] net/smc: add comments for smc_link_{usable|sendable}
Date: Fri, 31 Dec 2021 14:08:53 +0800	[thread overview]
Message-ID: <20211231060853.8106-1-dust.li@linux.alibaba.com> (raw)
In-Reply-To: <20211228090325.27263-2-dust.li@linux.alibaba.com>

Add comments for both smc_link_sendable() and smc_link_usable()
to help better distinguish and use them.

No function changes.

Signed-off-by: Dust Li <dust.li@linux.alibaba.com>
---
 net/smc/smc_core.h | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/net/smc/smc_core.h b/net/smc/smc_core.h
index d63b08274197..1e2926760eb0 100644
--- a/net/smc/smc_core.h
+++ b/net/smc/smc_core.h
@@ -407,7 +407,13 @@ static inline struct smc_connection *smc_lgr_find_conn(
 	return res;
 }
 
-/* returns true if the specified link is usable */
+/*
+ * Returns true if the specified link is usable.
+ *
+ * usable means the link is ready to receive RDMA messages, map memory
+ * on the link, etc. This doesn't ensure we are able to send RDMA messages
+ * on this link, if sending RDMA messages is needed, use smc_link_sendable()
+ */
 static inline bool smc_link_usable(struct smc_link *lnk)
 {
 	if (lnk->state == SMC_LNK_UNUSED || lnk->state == SMC_LNK_INACTIVE)
@@ -415,6 +421,15 @@ static inline bool smc_link_usable(struct smc_link *lnk)
 	return true;
 }
 
+/*
+ * Returns true if the specified link is ready to receive AND send RDMA
+ * messages.
+ *
+ * For the client side in first contact, the underlying QP may still in
+ * RESET or RTR when the link state is ACTIVATING, checks in smc_link_usable()
+ * is not strong enough. For those places that need to send any CDC or LLC
+ * messages, use smc_link_sendable(), otherwise, use smc_link_usable() instead
+ */
 static inline bool smc_link_sendable(struct smc_link *lnk)
 {
 	return smc_link_usable(lnk) &&
-- 
2.19.1.3.ge56e4f7


  parent reply	other threads:[~2021-12-31  6:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-28  9:03 [PATCH net 0/2] net/smc: fix kernel panic caused by race of smc_sock Dust Li
2021-12-28  9:03 ` [PATCH net 1/2] net/smc: don't send CDC/LLC message if link not ready Dust Li
2021-12-29 12:36   ` Karsten Graul
2021-12-30  3:02     ` dust.li
2021-12-30 18:55       ` Karsten Graul
2021-12-31  3:15         ` dust.li
2022-01-03 10:40           ` Karsten Graul
2021-12-31  6:08   ` Dust Li [this message]
2022-01-02 16:20     ` [PATCH net] net/smc: add comments for smc_link_{usable|sendable} patchwork-bot+netdevbpf
2021-12-28  9:03 ` [PATCH net 2/2] net/smc: fix kernel panic caused by race of smc_sock Dust Li
2021-12-29 12:33   ` Karsten Graul
2021-12-30  3:46     ` dust.li
2021-12-28 12:50 ` [PATCH net 0/2] " patchwork-bot+netdevbpf

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=20211231060853.8106-1-dust.li@linux.alibaba.com \
    --to=dust.li@linux.alibaba.com \
    --cc=davem@davemloft.net \
    --cc=guwen@linux.alibaba.com \
    --cc=kgraul@linux.ibm.com \
    --cc=kuba@kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tonylu@linux.alibaba.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox