From: Wen Gu <guwen@linux.alibaba.com>
To: kgraul@linux.ibm.com, wenjia@linux.ibm.com, jaka@linux.ibm.com,
wintera@linux.ibm.com, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com
Cc: linux-s390@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [RFC PATCH net-next v4 3/9] net/smc: Extract v2 check helper from SMC-D device registration
Date: Mon, 27 Mar 2023 11:28:13 +0800 [thread overview]
Message-ID: <1679887699-54797-4-git-send-email-guwen@linux.alibaba.com> (raw)
In-Reply-To: <1679887699-54797-1-git-send-email-guwen@linux.alibaba.com>
This patch extracts v2-capable logic from the process of registering the
ISM device as an SMC-D device, so that the registration process of other
underlying devices can reuse it.
Signed-off-by: Wen Gu <guwen@linux.alibaba.com>
---
net/smc/smc_ism.c | 27 +++++++++++++++++----------
net/smc/smc_ism.h | 1 +
2 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/net/smc/smc_ism.c b/net/smc/smc_ism.c
index d4709ca..8ad4c71 100644
--- a/net/smc/smc_ism.c
+++ b/net/smc/smc_ism.c
@@ -69,6 +69,22 @@ bool smc_ism_is_v2_capable(void)
return smc_ism_v2_capable;
}
+/* must be called under smcd_dev_list.mutex lock */
+void smc_ism_check_v2_capable(struct smcd_dev *smcd)
+{
+ u8 *system_eid = NULL;
+
+ if (!list_empty(&smcd_dev_list.list))
+ return;
+
+ system_eid = smcd->ops->get_system_eid();
+ if (smcd->ops->supports_v2()) {
+ smc_ism_v2_capable = true;
+ memcpy(smc_ism_v2_system_eid, system_eid,
+ SMC_MAX_EID_LEN);
+ }
+}
+
/* Set a connection using this DMBE. */
void smc_ism_set_conn(struct smc_connection *conn)
{
@@ -422,16 +438,7 @@ static void smcd_register_dev(struct ism_dev *ism)
smc_pnetid_by_table_smcd(smcd);
mutex_lock(&smcd_dev_list.mutex);
- if (list_empty(&smcd_dev_list.list)) {
- u8 *system_eid = NULL;
-
- system_eid = smcd->ops->get_system_eid();
- if (smcd->ops->supports_v2()) {
- smc_ism_v2_capable = true;
- memcpy(smc_ism_v2_system_eid, system_eid,
- SMC_MAX_EID_LEN);
- }
- }
+ smc_ism_check_v2_capable(smcd);
/* sort list: devices without pnetid before devices with pnetid */
if (smcd->pnetid[0])
list_add_tail(&smcd->list, &smcd_dev_list.list);
diff --git a/net/smc/smc_ism.h b/net/smc/smc_ism.h
index 832b2f4..14d2e77 100644
--- a/net/smc/smc_ism.h
+++ b/net/smc/smc_ism.h
@@ -42,6 +42,7 @@ int smc_ism_register_dmb(struct smc_link_group *lgr, int buf_size,
void smc_ism_get_system_eid(u8 **eid);
u16 smc_ism_get_chid(struct smcd_dev *dev);
bool smc_ism_is_v2_capable(void);
+void smc_ism_check_v2_capable(struct smcd_dev *dev);
int smc_ism_init(void);
void smc_ism_exit(void);
int smcd_nl_get_device(struct sk_buff *skb, struct netlink_callback *cb);
--
1.8.3.1
next prev parent reply other threads:[~2023-03-27 3:28 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-27 3:28 [RFC PATCH net-next v4 0/9] net/smc: Introduce SMC-D-based OS internal communication acceleration Wen Gu
2023-03-27 3:28 ` [RFC PATCH net-next v4 1/9] net/smc: Decouple ism_dev from SMC-D device dump Wen Gu
2023-03-27 3:28 ` [RFC PATCH net-next v4 2/9] net/smc: Decouple ism_dev from SMC-D DMB registration Wen Gu
2023-03-27 3:28 ` Wen Gu [this message]
2023-03-27 3:28 ` [RFC PATCH net-next v4 4/9] net/smc: Introduce SMC-D loopback device Wen Gu
2023-03-27 3:28 ` [RFC PATCH net-next v4 5/9] net/smc: Introduce an interface for getting DMB attribute Wen Gu
2023-03-27 3:28 ` [RFC PATCH net-next v4 6/9] net/smc: Introudce interfaces for DMB attach and detach Wen Gu
2023-03-27 3:28 ` [RFC PATCH net-next v4 7/9] net/smc: Avoid data copy from sndbuf to peer RMB in SMC-D Wen Gu
2023-03-27 3:28 ` [RFC PATCH net-next v4 8/9] net/smc: Modify cursor update logic when using mappable DMB Wen Gu
2023-03-27 3:28 ` [RFC PATCH net-next v4 9/9] net/smc: Add interface implementation of loopback device Wen Gu
2023-04-05 14:48 ` [RFC PATCH net-next v4 0/9] net/smc: Introduce SMC-D-based OS internal communication acceleration Wenjia Zhang
2023-04-10 14:31 ` Wen Gu
2023-04-05 17:04 ` Niklas Schnelle
2023-04-06 11:14 ` Alexandra Winter
2023-04-06 14:27 ` Niklas Schnelle
2023-04-10 14:30 ` Wen Gu
2023-04-10 14:30 ` Wen Gu
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=1679887699-54797-4-git-send-email-guwen@linux.alibaba.com \
--to=guwen@linux.alibaba.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jaka@linux.ibm.com \
--cc=kgraul@linux.ibm.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=wenjia@linux.ibm.com \
--cc=wintera@linux.ibm.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