All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] net/smc: updates 2020-10-02
@ 2020-10-02 15:09 Karsten Graul
  2020-10-02 15:09 ` [PATCH net-next 1/2] net/smc: send ISM devices with unique chid in CLC proposal Karsten Graul
  2020-10-02 15:09 ` [PATCH net-next 2/2] net/smc: use an array to check fields in system EID Karsten Graul
  0 siblings, 2 replies; 5+ messages in thread
From: Karsten Graul @ 2020-10-02 15:09 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-s390, heiko.carstens, raspl, ubraun

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(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH net-next 1/2] net/smc: send ISM devices with unique chid in CLC proposal
  2020-10-02 15:09 [PATCH net-next 0/2] net/smc: updates 2020-10-02 Karsten Graul
@ 2020-10-02 15:09 ` Karsten Graul
  2020-10-04  0:05   ` David Miller
  2020-10-02 15:09 ` [PATCH net-next 2/2] net/smc: use an array to check fields in system EID Karsten Graul
  1 sibling, 1 reply; 5+ messages in thread
From: Karsten Graul @ 2020-10-02 15:09 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-s390, heiko.carstens, raspl, ubraun

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.

Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
---
 net/smc/af_smc.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index e874d0e6267f..670e802a73cb 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -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++;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH net-next 2/2] net/smc: use an array to check fields in system EID
  2020-10-02 15:09 [PATCH net-next 0/2] net/smc: updates 2020-10-02 Karsten Graul
  2020-10-02 15:09 ` [PATCH net-next 1/2] net/smc: send ISM devices with unique chid in CLC proposal Karsten Graul
@ 2020-10-02 15:09 ` Karsten Graul
  1 sibling, 0 replies; 5+ messages in thread
From: Karsten Graul @ 2020-10-02 15:09 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-s390, heiko.carstens, raspl, ubraun

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

Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
---
 net/smc/smc_ism.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/smc/smc_ism.c b/net/smc/smc_ism.c
index e9a6487a42cb..6abbdd09a580 100644
--- a/net/smc/smc_ism.c
+++ b/net/smc/smc_ism.c
@@ -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 */
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next 1/2] net/smc: send ISM devices with unique chid in CLC proposal
  2020-10-02 15:09 ` [PATCH net-next 1/2] net/smc: send ISM devices with unique chid in CLC proposal Karsten Graul
@ 2020-10-04  0:05   ` David Miller
  2020-10-04 13:14     ` Karsten Graul
  0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2020-10-04  0:05 UTC (permalink / raw)
  To: kgraul; +Cc: netdev, linux-s390, heiko.carstens, raspl, ubraun

From: Karsten Graul <kgraul@linux.ibm.com>
Date: Fri,  2 Oct 2020 17:09:26 +0200

> 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.
> 
> Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next 1/2] net/smc: send ISM devices with unique chid in CLC proposal
  2020-10-04  0:05   ` David Miller
@ 2020-10-04 13:14     ` Karsten Graul
  0 siblings, 0 replies; 5+ messages in thread
From: Karsten Graul @ 2020-10-04 13:14 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-s390, heiko.carstens, raspl, ubraun

On Sat, 03 Oct 2020 17:05:38 -0700 (PDT)
David Miller <davem@davemloft.net> wrote:

> 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

-- 
Karsten Graul <kgraul@linux.ibm.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-10-04 13:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-02 15:09 [PATCH net-next 0/2] net/smc: updates 2020-10-02 Karsten Graul
2020-10-02 15:09 ` [PATCH net-next 1/2] net/smc: send ISM devices with unique chid in CLC proposal Karsten Graul
2020-10-04  0:05   ` David Miller
2020-10-04 13:14     ` Karsten Graul
2020-10-02 15:09 ` [PATCH net-next 2/2] net/smc: use an array to check fields in system EID Karsten Graul

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.