Skip to contentSkip to conversation

net/smc: updates 2020-10-02

PATCH In review Karsten Graul 2 participants 5 messages Oct 2, 2020 – Oct 4, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover net/smc: updates 2020-10-02

Please apply the following patch series for smc to netdev's net-next tree.

Patch 1 improves the ISM device payload of a CLC porposal message, patch 2 adds to use an array to access the system EID fields.

Karsten Graul (2):
net/smc: send ISM devices with unique chid in CLC proposal net/smc: use an array to check fields in system EID

 net/smc/af_smc.c  | 18 +++++++++++++++++-
 net/smc/smc_ism.c |  2 +-
 2 files changed, 18 insertions(+), 2 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/2 net/smc: send ISM devices with unique chid in CLC proposal

When building a CLC proposal message then the list of ISM devices does not need to contain multiple devices that have the same chid value, all these devices use the same function at the end.
Improve smc_find_ism_v2_device_clnt() to collect only ISM devices that have unique chid values.

---
 net/smc/af_smc.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
net/smc/af_smc.c +17 -1
index e874d0e6267f..670e802a73cb 100644
@@ -599,6 +599,18 @@ static int smc_find_ism_device(struct smc_sock *smc, struct smc_init_info *ini)
 	return 0;
 }
 
+/* is chid unique for the ism devices that are already determined? */
+static bool smc_find_ism_v2_is_unique_chid(u16 chid, struct smc_init_info *ini,
+					   int cnt)
+{
+	int i = (!ini->ism_dev[0]) ? 1 : 0;
+
+	for (; i < cnt; i++)
+		if (ini->ism_chid[i] == chid)
+			return false;
+	return true;
+}
+
 /* determine possible V2 ISM devices (either without PNETID or with PNETID plus
  * PNETID matching net_device)
  */
@@ -608,6 +620,7 @@ static int smc_find_ism_v2_device_clnt(struct smc_sock *smc,
 	int rc = SMC_CLC_DECL_NOSMCDDEV;
 	struct smcd_dev *smcd;
 	int i = 1;
+	u16 chid;
 
 	if (smcd_indicated(ini->smc_type_v1))
 		rc = 0;		/* already initialized for V1 */
@@ -615,10 +628,13 @@ static int smc_find_ism_v2_device_clnt(struct smc_sock *smc,
 	list_for_each_entry(smcd, &smcd_dev_list.list, list) {
 		if (smcd->going_away || smcd == ini->ism_dev[0])
 			continue;
+		chid = smc_ism_get_chid(smcd);
+		if (!smc_find_ism_v2_is_unique_chid(chid, ini, i))
+			continue;
 		if (!smc_pnet_is_pnetid_set(smcd->pnetid) ||
 		    smc_pnet_is_ndev_pnetid(sock_net(&smc->sk), smcd->pnetid)) {
 			ini->ism_dev[i] = smcd;
-			ini->ism_chid[i] = smc_ism_get_chid(ini->ism_dev[i]);
+			ini->ism_chid[i] = chid;
 			ini->is_smcd = true;
 			rc = 0;
 			i++;
Signature · 1 line
2.17.1
maintainer
#2 lore raw

Re: [PATCH net-next 1/2] net/smc: send ISM devices with unique chid in CLC proposal

From: Karsten Graul <[email protected]>
Date: Fri, 2 Oct 2020 17:09:26 +0200

Quoted 7 lines

When building a CLC proposal message then the list of ISM devices does not need to contain multiple devices that have the same chid value, all these devices use the same function at the end.
Improve smc_find_ism_v2_device_clnt() to collect only ISM devices that have unique chid values.

Series applied, but could you send a proper patch series in the future with a "[PATCH 0/N] ..." header posting? It must explain what the patch series does at a high level, how it is doing it, and why it is doing it that way.

Thank you.

#3 lore raw

Re: [PATCH net-next 1/2] net/smc: send ISM devices with unique chid in CLC proposal

Quoted 6 lines · On Sat, 03 Oct 2020 17:05:38 -0700 (PDT) David Miller <[email protected]>…

Series applied, but could you send a proper patch series in the future with a "[PATCH 0/N] ..." header posting? It must explain what the patch series does at a high level, how it is doing it, and why it is doing it that way.

Thank you.

Hi Dave, not sure what went wrong but I sent the header posting along with the patches, see https://lists.openwall.net/netdev/2020/10/02/197

Signature · 1 line
Karsten Graul <[email protected]>
#4 lore raw

PATCH 2/2 net/smc: use an array to check fields in system EID

In reply to Karsten Graul

The check for old hardware versions that did not have SMCDv2 support was using suspicious pointer magic. Address the fields using an array.

---
 net/smc/smc_ism.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/smc/smc_ism.c +1 -1
index e9a6487a42cb..6abbdd09a580 100644
@@ -335,7 +335,7 @@ int smcd_register_dev(struct smcd_dev *smcd)
 		u8 *system_eid = NULL;
 
 		smc_ism_get_system_eid(smcd, &system_eid);
-		if ((*system_eid) + 24 != '0' || (*system_eid) + 28 != '0')
+		if (system_eid[24] != '0' || system_eid[28] != '0')
 			smc_ism_v2_capable = true;
 	}
 	/* sort list: devices without pnetid before devices with pnetid */
Signature · 1 line
2.17.1