* Re: linux-next: manual merge of the net-next tree with the rdma tree
[not found] <20180727123301.3ac97ddc@canb.auug.org.au>
@ 2018-07-27 2:48 ` Jason Gunthorpe
2018-07-27 3:28 ` Stephen Rothwell
0 siblings, 1 reply; 10+ messages in thread
From: Jason Gunthorpe @ 2018-07-27 2:48 UTC (permalink / raw)
To: Stephen Rothwell
Cc: David Miller, Networking, Doug Ledford, Linux-Next Mailing List,
Linux Kernel Mailing List, Parav Pandit, Ursula Braun,
Leon Romanovsky, linux-rdma
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: linux-next: manual merge of the net-next tree with the rdma tree
2018-07-27 2:48 ` linux-next: manual merge of the net-next tree with the rdma tree Jason Gunthorpe
@ 2018-07-27 3:28 ` Stephen Rothwell
2018-07-27 3:45 ` Stephen Rothwell
2018-07-27 4:57 ` Parav Pandit
0 siblings, 2 replies; 10+ messages in thread
From: Stephen Rothwell @ 2018-07-27 3:28 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: David Miller, Networking, Doug Ledford, Linux-Next Mailing List,
Linux Kernel Mailing List, Parav Pandit, Ursula Braun,
Leon Romanovsky, linux-rdma
[-- Attachment #1: Type: text/plain, Size: 3940 bytes --]
Hi Jason,
On Thu, 26 Jul 2018 20:48:32 -0600 Jason Gunthorpe <jgg@mellanox.com> wrote:
>
> 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()..
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 <sfr@canb.auug.org.au>
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 <sfr@canb.auug.org.au>
---
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
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: linux-next: manual merge of the net-next tree with the rdma tree
2018-07-27 3:28 ` Stephen Rothwell
@ 2018-07-27 3:45 ` Stephen Rothwell
2018-07-27 5:03 ` Parav Pandit
2018-07-27 4:57 ` Parav Pandit
1 sibling, 1 reply; 10+ messages in thread
From: Stephen Rothwell @ 2018-07-27 3:45 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: David Miller, Networking, Doug Ledford, Linux-Next Mailing List,
Linux Kernel Mailing List, Parav Pandit, Ursula Braun,
Leon Romanovsky, linux-rdma
[-- Attachment #1: Type: text/plain, Size: 4213 bytes --]
Hi all,
On Fri, 27 Jul 2018 13:28:47 +1000 Stephen Rothwell <sfr@canb.auug.org.au> 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
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: linux-next: manual merge of the net-next tree with the rdma tree
2018-07-27 3:28 ` Stephen Rothwell
2018-07-27 3:45 ` Stephen Rothwell
@ 2018-07-27 4:57 ` Parav Pandit
2018-07-27 5:09 ` Stephen Rothwell
1 sibling, 1 reply; 10+ messages in thread
From: Parav Pandit @ 2018-07-27 4:57 UTC (permalink / raw)
To: Stephen Rothwell, Jason Gunthorpe
Cc: David Miller, Networking, Doug Ledford, Linux-Next Mailing List,
Linux Kernel Mailing List, Ursula Braun, Leon Romanovsky,
linux-rdma@vger.kernel.org
> -----Original Message-----
> From: linux-rdma-owner@vger.kernel.org <linux-rdma-owner@vger.kernel.org>
> On Behalf Of Stephen Rothwell
> Sent: Thursday, July 26, 2018 10:29 PM
> To: Jason Gunthorpe <jgg@mellanox.com>
> Cc: David Miller <davem@davemloft.net>; Networking
> <netdev@vger.kernel.org>; Doug Ledford <dledford@redhat.com>; Linux-Next
> Mailing List <linux-next@vger.kernel.org>; Linux Kernel Mailing List <linux-
> kernel@vger.kernel.org>; Parav Pandit <parav@mellanox.com>; Ursula Braun
> <ubraun@linux.ibm.com>; Leon Romanovsky <leonro@mellanox.com>; 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 <jgg@mellanox.com>
> wrote:
> >
> > 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()..
>
> 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 <sfr@canb.auug.org.au>
> 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 <sfr@canb.auug.org.au>
> ---
> 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: linux-next: manual merge of the net-next tree with the rdma tree
2018-07-27 3:45 ` Stephen Rothwell
@ 2018-07-27 5:03 ` Parav Pandit
0 siblings, 0 replies; 10+ messages in thread
From: Parav Pandit @ 2018-07-27 5:03 UTC (permalink / raw)
To: Stephen Rothwell, Jason Gunthorpe
Cc: David Miller, Networking, Doug Ledford, Linux-Next Mailing List,
Linux Kernel Mailing List, Ursula Braun, Leon Romanovsky,
linux-rdma@vger.kernel.org
> -----Original Message-----
> From: linux-rdma-owner@vger.kernel.org <linux-rdma-owner@vger.kernel.org>
> On Behalf Of Stephen Rothwell
> Sent: Thursday, July 26, 2018 10:45 PM
> To: Jason Gunthorpe <jgg@mellanox.com>
> Cc: David Miller <davem@davemloft.net>; Networking
> <netdev@vger.kernel.org>; Doug Ledford <dledford@redhat.com>; Linux-Next
> Mailing List <linux-next@vger.kernel.org>; Linux Kernel Mailing List <linux-
> kernel@vger.kernel.org>; Parav Pandit <parav@mellanox.com>; Ursula Braun
> <ubraun@linux.ibm.com>; Leon Romanovsky <leonro@mellanox.com>; 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 <sfr@canb.auug.org.au>
> 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;
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: linux-next: manual merge of the net-next tree with the rdma tree
2018-07-27 4:57 ` Parav Pandit
@ 2018-07-27 5:09 ` Stephen Rothwell
2018-07-31 21:12 ` Parav Pandit
0 siblings, 1 reply; 10+ messages in thread
From: Stephen Rothwell @ 2018-07-27 5:09 UTC (permalink / raw)
To: Parav Pandit
Cc: Jason Gunthorpe, David Miller, Networking, Doug Ledford,
Linux-Next Mailing List, Linux Kernel Mailing List, Ursula Braun,
Leon Romanovsky, linux-rdma@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 673 bytes --]
Hi Parav,
On Fri, 27 Jul 2018 04:57:41 +0000 Parav Pandit <parav@mellanox.com> wrote:
>
> > 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
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: linux-next: manual merge of the net-next tree with the rdma tree
2018-07-27 5:09 ` Stephen Rothwell
@ 2018-07-31 21:12 ` Parav Pandit
2018-08-01 5:33 ` Stephen Rothwell
0 siblings, 1 reply; 10+ messages in thread
From: Parav Pandit @ 2018-07-31 21:12 UTC (permalink / raw)
To: Stephen Rothwell
Cc: Jason Gunthorpe, David Miller, Networking, Doug Ledford,
Linux-Next Mailing List, Linux Kernel Mailing List, Ursula Braun,
Leon Romanovsky, linux-rdma@vger.kernel.org
Hi Stephen,
> -----Original Message-----
> From: linux-rdma-owner@vger.kernel.org <linux-rdma-owner@vger.kernel.org>
> On Behalf Of Stephen Rothwell
> Sent: Friday, July 27, 2018 12:09 AM
> To: Parav Pandit <parav@mellanox.com>
> Cc: Jason Gunthorpe <jgg@mellanox.com>; David Miller
> <davem@davemloft.net>; Networking <netdev@vger.kernel.org>; Doug
> Ledford <dledford@redhat.com>; Linux-Next Mailing List <linux-
> next@vger.kernel.org>; Linux Kernel Mailing List <linux-
> kernel@vger.kernel.org>; Ursula Braun <ubraun@linux.ibm.com>; Leon
> Romanovsky <leonro@mellanox.com>; 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 <parav@mellanox.com> wrote:
> >
> > > 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: linux-next: manual merge of the net-next tree with the rdma tree
2018-07-31 21:12 ` Parav Pandit
@ 2018-08-01 5:33 ` Stephen Rothwell
2018-08-01 17:13 ` Jason Gunthorpe
0 siblings, 1 reply; 10+ messages in thread
From: Stephen Rothwell @ 2018-08-01 5:33 UTC (permalink / raw)
To: Parav Pandit
Cc: Jason Gunthorpe, David Miller, Networking, Doug Ledford,
Linux-Next Mailing List, Linux Kernel Mailing List, Ursula Braun,
Leon Romanovsky, linux-rdma@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 635 bytes --]
Hi Parav,
On Tue, 31 Jul 2018 21:12:00 +0000 Parav Pandit <parav@mellanox.com> 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
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: linux-next: manual merge of the net-next tree with the rdma tree
2018-08-01 5:33 ` Stephen Rothwell
@ 2018-08-01 17:13 ` Jason Gunthorpe
2018-08-01 18:30 ` Parav Pandit
0 siblings, 1 reply; 10+ messages in thread
From: Jason Gunthorpe @ 2018-08-01 17:13 UTC (permalink / raw)
To: Stephen Rothwell
Cc: Parav Pandit, David Miller, Networking, Doug Ledford,
Linux-Next Mailing List, Linux Kernel Mailing List, Ursula Braun,
Leon Romanovsky, linux-rdma@vger.kernel.org
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 <parav@mellanox.com> 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.
Oh, that means I put the compat inline in the wrong header? Sigh.
Jason
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: linux-next: manual merge of the net-next tree with the rdma tree
2018-08-01 17:13 ` Jason Gunthorpe
@ 2018-08-01 18:30 ` Parav Pandit
0 siblings, 0 replies; 10+ messages in thread
From: Parav Pandit @ 2018-08-01 18:30 UTC (permalink / raw)
To: Jason Gunthorpe, Stephen Rothwell
Cc: David Miller, Networking, Doug Ledford, Linux-Next Mailing List,
Linux Kernel Mailing List, Ursula Braun, Leon Romanovsky,
linux-rdma@vger.kernel.org
> -----Original Message-----
> From: Jason Gunthorpe <jgg@ziepe.ca>
> Sent: Wednesday, August 1, 2018 12:14 PM
> To: Stephen Rothwell <sfr@canb.auug.org.au>
> Cc: Parav Pandit <parav@mellanox.com>; David Miller
> <davem@davemloft.net>; Networking <netdev@vger.kernel.org>; Doug
> Ledford <dledford@redhat.com>; Linux-Next Mailing List <linux-
> next@vger.kernel.org>; Linux Kernel Mailing List <linux-
> kernel@vger.kernel.org>; Ursula Braun <ubraun@linux.ibm.com>; Leon
> Romanovsky <leonro@mellanox.com>; 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:
> > Hi Parav,
> >
> > On Tue, 31 Jul 2018 21:12:00 +0000 Parav Pandit <parav@mellanox.com>
> 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.
>
> 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.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2018-08-01 18:30 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20180727123301.3ac97ddc@canb.auug.org.au>
2018-07-27 2:48 ` linux-next: manual merge of the net-next tree with the rdma tree Jason Gunthorpe
2018-07-27 3:28 ` Stephen Rothwell
2018-07-27 3:45 ` Stephen Rothwell
2018-07-27 5:03 ` Parav Pandit
2018-07-27 4:57 ` Parav Pandit
2018-07-27 5:09 ` Stephen Rothwell
2018-07-31 21:12 ` Parav Pandit
2018-08-01 5:33 ` Stephen Rothwell
2018-08-01 17:13 ` Jason Gunthorpe
2018-08-01 18:30 ` Parav Pandit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox