linux-next: manual merge of the net-next tree with the rdma tree

11 messages, 4 authors, 2018-08-01 · open the first message on its own page

linux-next: manual merge of the net-next tree with the rdma tree

From: Stephen Rothwell <hidden>
Date: 2018-07-27 02:33:12

Hi all,

Today's linux-next merge of the net-next tree got conflicts in:

  net/smc/smc_core.c
  net/smc/smc_ib.c

between commit:

  ddb457c6993b ("net/smc: Replace ib_query_gid with rdma_get_gid_attr")

from the rdma tree and commit:

  7005ada68d17 ("net/smc: use correct vlan gid of RoCE device")
(and maybe others)

from the net-next tree.

I fixed it up (I wasn't sure how to fix this up as so much has changed
in the net-next tree and both modified functions had been (re)moved,
so I effectively reverted the rdma tree commit) and can carry the fix
as necessary.  Please come to some arrangement about this.

-- 
Cheers,
Stephen Rothwell

Re: linux-next: manual merge of the net-next tree with the rdma tree

From: Jason Gunthorpe <hidden>
Date: 2018-07-27 02:48:48

On Fri, Jul 27, 2018 at 12:33:01PM +1000, Stephen Rothwell wrote:
I fixed it up (I wasn't sure how to fix this up as so much has changed
in the net-next tree and both modified functions had been (re)moved,
so I effectively reverted the rdma tree commit) and can carry the fix
as necessary.  Please come to some arrangement about this.
How does that still compile? We removed ib_query_gid() from the rdma
tree and replaced it with rdma_get_gid_attr()..

I think the merge resolution is going to be a bit nasty to absorb
that much changing..

Perhaps we should add a compatability ib_query_gid back to the RDMA
tree and then send DaveM a commit to fix SMC and remove it during the
next cycle? Linus can resolve smc_ib.c by using the net version

Does someone else have a better idea?

Thanks,
Jason

Re: linux-next: manual merge of the net-next tree with the rdma tree

From: Stephen Rothwell <hidden>
Date: 2018-07-27 03:29:05

Hi Jason,

On Thu, 26 Jul 2018 20:48:32 -0600 Jason Gunthorpe [off-list ref] wrote:
On Fri, Jul 27, 2018 at 12:33:01PM +1000, Stephen Rothwell wrote:
quoted
I fixed it up (I wasn't sure how to fix this up as so much has changed
in the net-next tree and both modified functions had been (re)moved,
so I effectively reverted the rdma tree commit) and can carry the fix
as necessary.  Please come to some arrangement about this.  
How does that still compile? We removed ib_query_gid() from the rdma
tree and replaced it with rdma_get_gid_attr()..
Yeah, it doesn't :-(
I think the merge resolution is going to be a bit nasty to absorb
that much changing..

Perhaps we should add a compatability ib_query_gid back to the RDMA
tree and then send DaveM a commit to fix SMC and remove it during the
next cycle? Linus can resolve smc_ib.c by using the net version

Does someone else have a better idea?
I applied this merge fix patch:

From: Stephen Rothwell <redacted>
Date: Fri, 27 Jul 2018 13:19:31 +1000
Subject: [PATCH] net/smc: fixups for ip_query_gid API removal

Signed-off-by: Stephen Rothwell <redacted>
---
 net/smc/smc_ib.c | 47 +++++++++++++++++++++++++----------------------
 1 file changed, 25 insertions(+), 22 deletions(-)
diff --git a/net/smc/smc_ib.c b/net/smc/smc_ib.c
index 2cc64bc8ae20..debc6e44f738 100644
--- a/net/smc/smc_ib.c
+++ b/net/smc/smc_ib.c
@@ -16,6 +16,7 @@
 #include <linux/workqueue.h>
 #include <linux/scatterlist.h>
 #include <rdma/ib_verbs.h>
+#include <rdma/ib_cache.h>
 
 #include "smc_pnet.h"
 #include "smc_ib.h"
@@ -144,17 +145,21 @@ int smc_ib_ready_link(struct smc_link *lnk)
 
 static int smc_ib_fill_mac(struct smc_ib_device *smcibdev, u8 ibport)
 {
-	struct ib_gid_attr gattr;
-	union ib_gid gid;
-	int rc;
+	const struct ib_gid_attr *gattr;
+	int rc = 0;
 
-	rc = ib_query_gid(smcibdev->ibdev, ibport, 0, &gid, &gattr);
-	if (rc || !gattr.ndev)
-		return -ENODEV;
+	gattr = rdma_get_gid_attr(smcibdev->ibdev, ibport, 0);
+	if (IS_ERR(gattr))
+		return PTR_ERR(gattr);
+	if (!gattr->ndev) {
+		rc = -ENODEV;
+		goto done;
+	}
 
-	memcpy(smcibdev->mac[ibport - 1], gattr.ndev->dev_addr, ETH_ALEN);
-	dev_put(gattr.ndev);
-	return 0;
+	memcpy(smcibdev->mac[ibport - 1], gattr->ndev->dev_addr, ETH_ALEN);
+done:
+	rdma_put_gid_attr(gattr);
+	return rc;
 }
 
 /* Create an identifier unique for this instance of SMC-R.
@@ -179,29 +184,27 @@ bool smc_ib_port_active(struct smc_ib_device *smcibdev, u8 ibport)
 int smc_ib_determine_gid(struct smc_ib_device *smcibdev, u8 ibport,
 			 unsigned short vlan_id, u8 gid[], u8 *sgid_index)
 {
-	struct ib_gid_attr gattr;
-	union ib_gid _gid;
+	const struct ib_gid_attr *gattr;
 	int i;
 
 	for (i = 0; i < smcibdev->pattr[ibport - 1].gid_tbl_len; i++) {
-		memset(&_gid, 0, SMC_GID_SIZE);
-		memset(&gattr, 0, sizeof(gattr));
-		if (ib_query_gid(smcibdev->ibdev, ibport, i, &_gid, &gattr))
+		gattr = rdma_get_gid_attr(smcibdev->ibdev, ibport, i);
+		if (IS_ERR(gattr))
 			continue;
-		if (!gattr.ndev)
+		if (!gattr->ndev)
 			continue;
-		if (((!vlan_id && !is_vlan_dev(gattr.ndev)) ||
-		     (vlan_id && is_vlan_dev(gattr.ndev) &&
-		      vlan_dev_vlan_id(gattr.ndev) == vlan_id)) &&
-		    gattr.gid_type == IB_GID_TYPE_IB) {
+		if (((!vlan_id && !is_vlan_dev(gattr->ndev)) ||
+		     (vlan_id && is_vlan_dev(gattr->ndev) &&
+		      vlan_dev_vlan_id(gattr->ndev) == vlan_id)) &&
+		    gattr->gid_type == IB_GID_TYPE_IB) {
 			if (gid)
-				memcpy(gid, &_gid, SMC_GID_SIZE);
+				memcpy(gid, &gattr->gid, SMC_GID_SIZE);
 			if (sgid_index)
 				*sgid_index = i;
-			dev_put(gattr.ndev);
+			rdma_put_gid_attr(gattr);
 			return 0;
 		}
-		dev_put(gattr.ndev);
+		rdma_put_gid_attr(gattr);
 	}
 	return -ENODEV;
 }
-- 
2.18.0

-- 
Cheers,
Stephen Rothwell

Re: linux-next: manual merge of the net-next tree with the rdma tree

From: Stephen Rothwell <hidden>
Date: 2018-07-27 03:45:30

Hi all,

On Fri, 27 Jul 2018 13:28:47 +1000 Stephen Rothwell [off-list ref] wrote:
I applied this merge fix patch:
The final conflict resolution actually looks like this:

(the rdma tree changes to net/smc/smc_core.c are dropped)

c1d4bb2af93573ee4a21538a1a97b568a2344499
diff --cc net/smc/smc_ib.c
index 74f29f814ec1,2cc64bc8ae20..debc6e44f738
--- a/net/smc/smc_ib.c
+++ b/net/smc/smc_ib.c
@@@ -144,6 -142,93 +143,95 @@@ out
  	return rc;
  }
  
+ static int smc_ib_fill_mac(struct smc_ib_device *smcibdev, u8 ibport)
+ {
 -	struct ib_gid_attr gattr;
 -	union ib_gid gid;
 -	int rc;
++	const struct ib_gid_attr *gattr;
++	int rc = 0;
+ 
 -	rc = ib_query_gid(smcibdev->ibdev, ibport, 0, &gid, &gattr);
 -	if (rc || !gattr.ndev)
 -		return -ENODEV;
++	gattr = rdma_get_gid_attr(smcibdev->ibdev, ibport, 0);
++	if (IS_ERR(gattr))
++		return PTR_ERR(gattr);
++	if (!gattr->ndev) {
++		rc = -ENODEV;
++		goto done;
++	}
+ 
 -	memcpy(smcibdev->mac[ibport - 1], gattr.ndev->dev_addr, ETH_ALEN);
 -	dev_put(gattr.ndev);
 -	return 0;
++	memcpy(smcibdev->mac[ibport - 1], gattr->ndev->dev_addr, ETH_ALEN);
++done:
++	rdma_put_gid_attr(gattr);
++	return rc;
+ }
+ 
+ /* Create an identifier unique for this instance of SMC-R.
+  * The MAC-address of the first active registered IB device
+  * plus a random 2-byte number is used to create this identifier.
+  * This name is delivered to the peer during connection initialization.
+  */
+ static inline void smc_ib_define_local_systemid(struct smc_ib_device *smcibdev,
+ 						u8 ibport)
+ {
+ 	memcpy(&local_systemid[2], &smcibdev->mac[ibport - 1],
+ 	       sizeof(smcibdev->mac[ibport - 1]));
+ 	get_random_bytes(&local_systemid[0], 2);
+ }
+ 
+ bool smc_ib_port_active(struct smc_ib_device *smcibdev, u8 ibport)
+ {
+ 	return smcibdev->pattr[ibport - 1].state == IB_PORT_ACTIVE;
+ }
+ 
+ /* determine the gid for an ib-device port and vlan id */
+ int smc_ib_determine_gid(struct smc_ib_device *smcibdev, u8 ibport,
+ 			 unsigned short vlan_id, u8 gid[], u8 *sgid_index)
+ {
 -	struct ib_gid_attr gattr;
 -	union ib_gid _gid;
++	const struct ib_gid_attr *gattr;
+ 	int i;
+ 
+ 	for (i = 0; i < smcibdev->pattr[ibport - 1].gid_tbl_len; i++) {
 -		memset(&_gid, 0, SMC_GID_SIZE);
 -		memset(&gattr, 0, sizeof(gattr));
 -		if (ib_query_gid(smcibdev->ibdev, ibport, i, &_gid, &gattr))
++		gattr = rdma_get_gid_attr(smcibdev->ibdev, ibport, i);
++		if (IS_ERR(gattr))
+ 			continue;
 -		if (!gattr.ndev)
++		if (!gattr->ndev)
+ 			continue;
 -		if (((!vlan_id && !is_vlan_dev(gattr.ndev)) ||
 -		     (vlan_id && is_vlan_dev(gattr.ndev) &&
 -		      vlan_dev_vlan_id(gattr.ndev) == vlan_id)) &&
 -		    gattr.gid_type == IB_GID_TYPE_IB) {
++		if (((!vlan_id && !is_vlan_dev(gattr->ndev)) ||
++		     (vlan_id && is_vlan_dev(gattr->ndev) &&
++		      vlan_dev_vlan_id(gattr->ndev) == vlan_id)) &&
++		    gattr->gid_type == IB_GID_TYPE_IB) {
+ 			if (gid)
 -				memcpy(gid, &_gid, SMC_GID_SIZE);
++				memcpy(gid, &gattr->gid, SMC_GID_SIZE);
+ 			if (sgid_index)
+ 				*sgid_index = i;
 -			dev_put(gattr.ndev);
++			rdma_put_gid_attr(gattr);
+ 			return 0;
+ 		}
 -		dev_put(gattr.ndev);
++		rdma_put_gid_attr(gattr);
+ 	}
+ 	return -ENODEV;
+ }
+ 
+ static int smc_ib_remember_port_attr(struct smc_ib_device *smcibdev, u8 ibport)
+ {
+ 	int rc;
+ 
+ 	memset(&smcibdev->pattr[ibport - 1], 0,
+ 	       sizeof(smcibdev->pattr[ibport - 1]));
+ 	rc = ib_query_port(smcibdev->ibdev, ibport,
+ 			   &smcibdev->pattr[ibport - 1]);
+ 	if (rc)
+ 		goto out;
+ 	/* the SMC protocol requires specification of the RoCE MAC address */
+ 	rc = smc_ib_fill_mac(smcibdev, ibport);
+ 	if (rc)
+ 		goto out;
+ 	if (!strncmp(local_systemid, SMC_LOCAL_SYSTEMID_RESET,
+ 		     sizeof(local_systemid)) &&
+ 	    smc_ib_port_active(smcibdev, ibport))
+ 		/* create unique system identifier */
+ 		smc_ib_define_local_systemid(smcibdev, ibport);
+ out:
+ 	return rc;
+ }
+ 
  /* process context wrapper for might_sleep smc_ib_remember_port_attr */
  static void smc_ib_port_event_work(struct work_struct *work)
  {

-- 
Cheers,
Stephen Rothwell

RE: linux-next: manual merge of the net-next tree with the rdma tree

From: Parav Pandit <hidden>
Date: 2018-07-27 04:57:58

quoted hunk
-----Original Message-----
From: linux-rdma-owner@vger.kernel.org <redacted>
On Behalf Of Stephen Rothwell
Sent: Thursday, July 26, 2018 10:29 PM
To: Jason Gunthorpe <redacted>
Cc: David Miller <davem@davemloft.net>; Networking
[off-list ref]; Doug Ledford [off-list ref]; Linux-Next
Mailing List [off-list ref]; Linux Kernel Mailing List <linux-
kernel@vger.kernel.org>; Parav Pandit [off-list ref]; Ursula Braun
[off-list ref]; Leon Romanovsky [off-list ref]; linux-
rdma@vger.kernel.org
Subject: Re: linux-next: manual merge of the net-next tree with the rdma tree

Hi Jason,

On Thu, 26 Jul 2018 20:48:32 -0600 Jason Gunthorpe [off-list ref]
wrote:
quoted
On Fri, Jul 27, 2018 at 12:33:01PM +1000, Stephen Rothwell wrote:
quoted
I fixed it up (I wasn't sure how to fix this up as so much has
changed in the net-next tree and both modified functions had been
(re)moved, so I effectively reverted the rdma tree commit) and can
carry the fix as necessary.  Please come to some arrangement about this.
How does that still compile? We removed ib_query_gid() from the rdma
tree and replaced it with rdma_get_gid_attr()..
Yeah, it doesn't :-(
quoted
I think the merge resolution is going to be a bit nasty to absorb that
much changing..

Perhaps we should add a compatability ib_query_gid back to the RDMA
tree and then send DaveM a commit to fix SMC and remove it during the
next cycle? Linus can resolve smc_ib.c by using the net version

Does someone else have a better idea?
I applied this merge fix patch:

From: Stephen Rothwell <redacted>
Date: Fri, 27 Jul 2018 13:19:31 +1000
Subject: [PATCH] net/smc: fixups for ip_query_gid API removal

Signed-off-by: Stephen Rothwell <redacted>
---
 net/smc/smc_ib.c | 47 +++++++++++++++++++++++++----------------------
 1 file changed, 25 insertions(+), 22 deletions(-)
diff --git a/net/smc/smc_ib.c b/net/smc/smc_ib.c index
2cc64bc8ae20..debc6e44f738 100644
--- a/net/smc/smc_ib.c
+++ b/net/smc/smc_ib.c
@@ -16,6 +16,7 @@
 #include <linux/workqueue.h>
 #include <linux/scatterlist.h>
 #include <rdma/ib_verbs.h>
+#include <rdma/ib_cache.h>

 #include "smc_pnet.h"
 #include "smc_ib.h"
@@ -144,17 +145,21 @@ int smc_ib_ready_link(struct smc_link *lnk)

 static int smc_ib_fill_mac(struct smc_ib_device *smcibdev, u8 ibport)  {
-	struct ib_gid_attr gattr;
-	union ib_gid gid;
-	int rc;
+	const struct ib_gid_attr *gattr;
+	int rc = 0;

-	rc = ib_query_gid(smcibdev->ibdev, ibport, 0, &gid, &gattr);
-	if (rc || !gattr.ndev)
-		return -ENODEV;
+	gattr = rdma_get_gid_attr(smcibdev->ibdev, ibport, 0);
+	if (IS_ERR(gattr))
+		return PTR_ERR(gattr);
+	if (!gattr->ndev) {
+		rc = -ENODEV;
+		goto done;
+	}

-	memcpy(smcibdev->mac[ibport - 1], gattr.ndev->dev_addr, ETH_ALEN);
-	dev_put(gattr.ndev);
-	return 0;
+	memcpy(smcibdev->mac[ibport - 1], gattr->ndev->dev_addr,
ETH_ALEN);
+done:
+	rdma_put_gid_attr(gattr);
+	return rc;
 }

 /* Create an identifier unique for this instance of SMC-R.
@@ -179,29 +184,27 @@ bool smc_ib_port_active(struct smc_ib_device
*smcibdev, u8 ibport)  int smc_ib_determine_gid(struct smc_ib_device
*smcibdev, u8 ibport,
 			 unsigned short vlan_id, u8 gid[], u8 *sgid_index)  {
-	struct ib_gid_attr gattr;
-	union ib_gid _gid;
+	const struct ib_gid_attr *gattr;
 	int i;

 	for (i = 0; i < smcibdev->pattr[ibport - 1].gid_tbl_len; i++) {
-		memset(&_gid, 0, SMC_GID_SIZE);
-		memset(&gattr, 0, sizeof(gattr));
-		if (ib_query_gid(smcibdev->ibdev, ibport, i, &_gid, &gattr))
+		gattr = rdma_get_gid_attr(smcibdev->ibdev, ibport, i);
+		if (IS_ERR(gattr))
 			continue;
-		if (!gattr.ndev)
+		if (!gattr->ndev)
 			continue;
This requires a small fix.
If (!gattr->ndev {
	rdma_put_gid_attr(gattr);
	continue;
}

-		if (((!vlan_id && !is_vlan_dev(gattr.ndev)) ||
-		     (vlan_id && is_vlan_dev(gattr.ndev) &&
-		      vlan_dev_vlan_id(gattr.ndev) == vlan_id)) &&
-		    gattr.gid_type == IB_GID_TYPE_IB) {
+		if (((!vlan_id && !is_vlan_dev(gattr->ndev)) ||
+		     (vlan_id && is_vlan_dev(gattr->ndev) &&
+		      vlan_dev_vlan_id(gattr->ndev) == vlan_id)) &&
+		    gattr->gid_type == IB_GID_TYPE_IB) {
 			if (gid)
-				memcpy(gid, &_gid, SMC_GID_SIZE);
+				memcpy(gid, &gattr->gid, SMC_GID_SIZE);
 			if (sgid_index)
 				*sgid_index = i;
-			dev_put(gattr.ndev);
+			rdma_put_gid_attr(gattr);
 			return 0;
 		}
-		dev_put(gattr.ndev);
+		rdma_put_gid_attr(gattr);
 	}
 	return -ENODEV;
 }
--
2.18.0

--
Cheers,
Stephen Rothwell

RE: linux-next: manual merge of the net-next tree with the rdma tree

From: Parav Pandit <hidden>
Date: 2018-07-27 05:07:10

quoted hunk
-----Original Message-----
From: linux-rdma-owner@vger.kernel.org <redacted>
On Behalf Of Stephen Rothwell
Sent: Thursday, July 26, 2018 10:45 PM
To: Jason Gunthorpe <redacted>
Cc: David Miller <davem@davemloft.net>; Networking
[off-list ref]; Doug Ledford [off-list ref]; Linux-Next
Mailing List [off-list ref]; Linux Kernel Mailing List <linux-
kernel@vger.kernel.org>; Parav Pandit [off-list ref]; Ursula Braun
[off-list ref]; Leon Romanovsky [off-list ref]; linux-
rdma@vger.kernel.org
Subject: Re: linux-next: manual merge of the net-next tree with the rdma tree

Hi all,

On Fri, 27 Jul 2018 13:28:47 +1000 Stephen Rothwell [off-list ref]
wrote:
quoted
I applied this merge fix patch:
The final conflict resolution actually looks like this:

(the rdma tree changes to net/smc/smc_core.c are dropped)

c1d4bb2af93573ee4a21538a1a97b568a2344499
diff --cc net/smc/smc_ib.c
index 74f29f814ec1,2cc64bc8ae20..debc6e44f738
--- a/net/smc/smc_ib.c
+++ b/net/smc/smc_ib.c
@@@ -144,6 -142,93 +143,95 @@@ out
  	return rc;
  }

+ static int smc_ib_fill_mac(struct smc_ib_device *smcibdev, u8 ibport)
+ {
 -	struct ib_gid_attr gattr;
 -	union ib_gid gid;
 -	int rc;
++	const struct ib_gid_attr *gattr;
++	int rc = 0;
+
 -	rc = ib_query_gid(smcibdev->ibdev, ibport, 0, &gid, &gattr);
 -	if (rc || !gattr.ndev)
 -		return -ENODEV;
++	gattr = rdma_get_gid_attr(smcibdev->ibdev, ibport, 0);
++	if (IS_ERR(gattr))
++		return PTR_ERR(gattr);
++	if (!gattr->ndev) {
++		rc = -ENODEV;
++		goto done;
++	}
+
 -	memcpy(smcibdev->mac[ibport - 1], gattr.ndev->dev_addr, ETH_ALEN);
 -	dev_put(gattr.ndev);
 -	return 0;
++	memcpy(smcibdev->mac[ibport - 1], gattr->ndev->dev_addr,
ETH_ALEN);
++done:
++	rdma_put_gid_attr(gattr);
++	return rc;
+ }
+
+ /* Create an identifier unique for this instance of SMC-R.
+  * The MAC-address of the first active registered IB device
+  * plus a random 2-byte number is used to create this identifier.
+  * This name is delivered to the peer during connection initialization.
+  */
+ static inline void smc_ib_define_local_systemid(struct smc_ib_device
*smcibdev,
+ 						u8 ibport)
+ {
+ 	memcpy(&local_systemid[2], &smcibdev->mac[ibport - 1],
+ 	       sizeof(smcibdev->mac[ibport - 1]));
+ 	get_random_bytes(&local_systemid[0], 2); }
+
+ bool smc_ib_port_active(struct smc_ib_device *smcibdev, u8 ibport) {
+ 	return smcibdev->pattr[ibport - 1].state == IB_PORT_ACTIVE; }
+
+ /* determine the gid for an ib-device port and vlan id */ int
+ smc_ib_determine_gid(struct smc_ib_device *smcibdev, u8 ibport,
+ 			 unsigned short vlan_id, u8 gid[], u8 *sgid_index) {
 -	struct ib_gid_attr gattr;
 -	union ib_gid _gid;
++	const struct ib_gid_attr *gattr;
+ 	int i;
+
+ 	for (i = 0; i < smcibdev->pattr[ibport - 1].gid_tbl_len; i++) {
 -		memset(&_gid, 0, SMC_GID_SIZE);
 -		memset(&gattr, 0, sizeof(gattr));
 -		if (ib_query_gid(smcibdev->ibdev, ibport, i, &_gid, &gattr))
++		gattr = rdma_get_gid_attr(smcibdev->ibdev, ibport, i);
++		if (IS_ERR(gattr))
+ 			continue;
 -		if (!gattr.ndev)
++		if (!gattr->ndev)
+ 			continue;
Seeing this updated patch, so for completeness same reply as the previous email.

If (!gattr->ndev) {
	rdma_put_gid_attr(gattr);
	continue;
}
Rest changes above and below looks fine to me.
Thanks for doing it, I am not part of netdev mailing list so didn't see the compile error until this patch came up.
 -		if (((!vlan_id && !is_vlan_dev(gattr.ndev)) ||
 -		     (vlan_id && is_vlan_dev(gattr.ndev) &&
 -		      vlan_dev_vlan_id(gattr.ndev) == vlan_id)) &&
 -		    gattr.gid_type == IB_GID_TYPE_IB) {
++		if (((!vlan_id && !is_vlan_dev(gattr->ndev)) ||
++		     (vlan_id && is_vlan_dev(gattr->ndev) &&
++		      vlan_dev_vlan_id(gattr->ndev) == vlan_id)) &&
++		    gattr->gid_type == IB_GID_TYPE_IB) {
+ 			if (gid)
 -				memcpy(gid, &_gid, SMC_GID_SIZE);
++				memcpy(gid, &gattr->gid, SMC_GID_SIZE);
+ 			if (sgid_index)
+ 				*sgid_index = i;
 -			dev_put(gattr.ndev);
++			rdma_put_gid_attr(gattr);
+ 			return 0;
+ 		}
 -		dev_put(gattr.ndev);
++		rdma_put_gid_attr(gattr);
+ 	}
+ 	return -ENODEV;
+ }
+
+ static int smc_ib_remember_port_attr(struct smc_ib_device *smcibdev,
+ u8 ibport) {
+ 	int rc;
+
+ 	memset(&smcibdev->pattr[ibport - 1], 0,
+ 	       sizeof(smcibdev->pattr[ibport - 1]));
+ 	rc = ib_query_port(smcibdev->ibdev, ibport,
+ 			   &smcibdev->pattr[ibport - 1]);
+ 	if (rc)
+ 		goto out;
+ 	/* the SMC protocol requires specification of the RoCE MAC address */
+ 	rc = smc_ib_fill_mac(smcibdev, ibport);
+ 	if (rc)
+ 		goto out;
+ 	if (!strncmp(local_systemid, SMC_LOCAL_SYSTEMID_RESET,
+ 		     sizeof(local_systemid)) &&
+ 	    smc_ib_port_active(smcibdev, ibport))
+ 		/* create unique system identifier */
+ 		smc_ib_define_local_systemid(smcibdev, ibport);
+ out:
+ 	return rc;
+ }
+
  /* process context wrapper for might_sleep smc_ib_remember_port_attr */
  static void smc_ib_port_event_work(struct work_struct *work)
  {

--
Cheers,
Stephen Rothwell

Re: linux-next: manual merge of the net-next tree with the rdma tree

From: Stephen Rothwell <hidden>
Date: 2018-07-27 05:09:09

Hi Parav,

On Fri, 27 Jul 2018 04:57:41 +0000 Parav Pandit [off-list ref] wrote:
quoted
 	for (i = 0; i < smcibdev->pattr[ibport - 1].gid_tbl_len; i++) {
-		memset(&_gid, 0, SMC_GID_SIZE);
-		memset(&gattr, 0, sizeof(gattr));
-		if (ib_query_gid(smcibdev->ibdev, ibport, i, &_gid, &gattr))
+		gattr = rdma_get_gid_attr(smcibdev->ibdev, ibport, i);
+		if (IS_ERR(gattr))
 			continue;
-		if (!gattr.ndev)
+		if (!gattr->ndev)
 			continue;  
This requires a small fix.
If (!gattr->ndev {
	rdma_put_gid_attr(gattr);
	continue;
}
Thanks, I have fixed this up for Monday.
-- 
Cheers,
Stephen Rothwell

RE: linux-next: manual merge of the net-next tree with the rdma tree

From: Parav Pandit <hidden>
Date: 2018-07-31 21:12:10

Hi Stephen,
-----Original Message-----
From: linux-rdma-owner@vger.kernel.org <redacted>
On Behalf Of Stephen Rothwell
Sent: Friday, July 27, 2018 12:09 AM
To: Parav Pandit <redacted>
Cc: Jason Gunthorpe <redacted>; David Miller
[off-list ref]; Networking [off-list ref]; Doug
Ledford [off-list ref]; Linux-Next Mailing List <linux-
next@vger.kernel.org>; Linux Kernel Mailing List <linux-
kernel@vger.kernel.org>; Ursula Braun [off-list ref]; Leon
Romanovsky [off-list ref]; linux-rdma@vger.kernel.org
Subject: Re: linux-next: manual merge of the net-next tree with the rdma tree

Hi Parav,

On Fri, 27 Jul 2018 04:57:41 +0000 Parav Pandit [off-list ref] wrote:
quoted
quoted
 	for (i = 0; i < smcibdev->pattr[ibport - 1].gid_tbl_len; i++) {
-		memset(&_gid, 0, SMC_GID_SIZE);
-		memset(&gattr, 0, sizeof(gattr));
-		if (ib_query_gid(smcibdev->ibdev, ibport, i, &_gid, &gattr))
+		gattr = rdma_get_gid_attr(smcibdev->ibdev, ibport, i);
+		if (IS_ERR(gattr))
 			continue;
-		if (!gattr.ndev)
+		if (!gattr->ndev)
 			continue;
This requires a small fix.
If (!gattr->ndev {
	rdma_put_gid_attr(gattr);
	continue;
}
Thanks, I have fixed this up for Monday.
You might want to consider this compatibility patch in Linux-rdma tree to avoid a merge conflict of smc.

https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git/commit/?h=for-next&id=7aaa1807e698f73094b78f0ef25b1a37a4409a55

Re: linux-next: manual merge of the net-next tree with the rdma tree

From: Stephen Rothwell <hidden>
Date: 2018-08-01 05:33:49

Hi Parav,

On Tue, 31 Jul 2018 21:12:00 +0000 Parav Pandit [off-list ref] wrote:
You might want to consider this compatibility patch in Linux-rdma
tree to avoid a merge conflict of smc.

https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git/commit/?h=for-next&id=7aaa1807e698f73094b78f0ef25b1a37a4409a55
Ok, since commit that is now in the rdma tree, my resolution of the
original conflicts comes down to dropping all the changes to
net/smc/smc_core.c net/smc/smc_ib.c that come from the rdma tree and
adding

#include <rdma/ib_cache.h>

to net/smc/smc_ib.c.

-- 
Cheers,
Stephen Rothwell

Re: linux-next: manual merge of the net-next tree with the rdma tree

From: Jason Gunthorpe <jgg@ziepe.ca>
Date: 2018-08-01 17:13:56

On Wed, Aug 01, 2018 at 03:33:45PM +1000, Stephen Rothwell wrote:
Hi Parav,

On Tue, 31 Jul 2018 21:12:00 +0000 Parav Pandit [off-list ref] wrote:
quoted
You might want to consider this compatibility patch in Linux-rdma
tree to avoid a merge conflict of smc.

https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git/commit/?h=for-next&id=7aaa1807e698f73094b78f0ef25b1a37a4409a55
Ok, since commit that is now in the rdma tree, my resolution of the
original conflicts comes down to dropping all the changes to
net/smc/smc_core.c net/smc/smc_ib.c that come from the rdma tree and
adding

#include <rdma/ib_cache.h>

to net/smc/smc_ib.c.
Oh, that means I put the compat inline in the wrong header? Sigh.

Jason

RE: linux-next: manual merge of the net-next tree with the rdma tree

From: Parav Pandit <hidden>
Date: 2018-08-01 18:30:43

-----Original Message-----
From: Jason Gunthorpe <jgg@ziepe.ca>
Sent: Wednesday, August 1, 2018 12:14 PM
To: Stephen Rothwell <redacted>
Cc: Parav Pandit <redacted>; David Miller
[off-list ref]; Networking [off-list ref]; Doug
Ledford [off-list ref]; Linux-Next Mailing List <linux-
next@vger.kernel.org>; Linux Kernel Mailing List <linux-
kernel@vger.kernel.org>; Ursula Braun [off-list ref]; Leon
Romanovsky [off-list ref]; linux-rdma@vger.kernel.org
Subject: Re: linux-next: manual merge of the net-next tree with the rdma tree

On Wed, Aug 01, 2018 at 03:33:45PM +1000, Stephen Rothwell wrote:
quoted
Hi Parav,

On Tue, 31 Jul 2018 21:12:00 +0000 Parav Pandit [off-list ref]
wrote:
quoted
quoted
You might want to consider this compatibility patch in Linux-rdma
tree to avoid a merge conflict of smc.

https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git/commit
/?h=for-next&id=7aaa1807e698f73094b78f0ef25b1a37a4409a55
Ok, since commit that is now in the rdma tree, my resolution of the
original conflicts comes down to dropping all the changes to
net/smc/smc_core.c net/smc/smc_ib.c that come from the rdma tree and
adding

#include <rdma/ib_cache.h>

to net/smc/smc_ib.c.
Oh, that means I put the compat inline in the wrong header? Sigh.
It was in wrong place originally in ib_verbs.h because lately it returned all the entries from the cache.
So ib_cache.h was/is correct place.
But devel happened at pace where we eventually deprecated it.
So from pure compat perspective, yeah, it should be in wrong file i.e. ib_verbs.h but otherwise its correct in ib_cache.h.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help