diff mbox

[rdma-rc,1/7] IB/core: Fix query port failure in RoCE

Message ID 1465042524-25852-2-git-send-email-leon@kernel.org (mailing list archive)
State Accepted
Headers show

Commit Message

Leon Romanovsky June 4, 2016, 12:15 p.m. UTC
From: Eli Cohen <eli@mellanox.com>

Currently ib_query_port always attempts to to read the subnet prefix by
calling ib_query_gid(). For RoCE there is no subnet manager and no
subnet prefix. Fix this by querying GID[0] only for IB networks.

Fixes: fad61ad4e755 ('IB/core: Add subnet prefix to port info')
Signed-off-by: Eli Cohen <eli@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
---
 drivers/infiniband/core/device.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Steve Wise June 6, 2016, 3:43 p.m. UTC | #1
> 
> From: Eli Cohen <eli@mellanox.com>
> 
> Currently ib_query_port always attempts to to read the subnet prefix by
> calling ib_query_gid(). For RoCE there is no subnet manager and no
> subnet prefix. Fix this by querying GID[0] only for IB networks.
> 
> Fixes: fad61ad4e755 ('IB/core: Add subnet prefix to port info')
> Signed-off-by: Eli Cohen <eli@mellanox.com>
> Signed-off-by: Leon Romanovsky <leon@kernel.org>
> ---
>  drivers/infiniband/core/device.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/infiniband/core/device.c
b/drivers/infiniband/core/device.c
> index 5516fb0..05e25a3 100644
> --- a/drivers/infiniband/core/device.c
> +++ b/drivers/infiniband/core/device.c
> @@ -661,6 +661,9 @@ int ib_query_port(struct ib_device *device,
>  	if (err || port_attr->subnet_prefix)
>  		return err;
> 
> +	if (rdma_port_get_link_layer(device, port_num) !=
> IB_LINK_LAYER_INFINIBAND)
> +		return 0;
> +
>  	err = ib_query_gid(device, port_num, 0, &gid, NULL);
>  	if (err)
>  		return err;

This change assumes IB_LINK_LAYER_ETHERNET == RoCE, which isn't true for iWARP
devices.  Still, the change is good for iWARP too, but the comment should
perhaps reflect this.

Reviewed-by: Steve Wise <swise@opengridcomputing.com>

Steve.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Leon Romanovsky June 7, 2016, 7:22 a.m. UTC | #2
Resending to the ML.

On Mon, Jun 06, 2016 at 10:13:50PM +0300, Leon Romanovsky wrote:
> Sent from mobile.
> On Jun 6, 2016 6:43 PM, "Steve Wise" <swise@opengridcomputing.com> wrote:
> >
> > >
> > > From: Eli Cohen <eli@mellanox.com>
> > >
> > > Currently ib_query_port always attempts to to read the subnet prefix by
> > > calling ib_query_gid(). For RoCE there is no subnet manager and no
> > > subnet prefix. Fix this by querying GID[0] only for IB networks.
> > >
> > > Fixes: fad61ad4e755 ('IB/core: Add subnet prefix to port info')
> > > Signed-off-by: Eli Cohen <eli@mellanox.com>
> > > Signed-off-by: Leon Romanovsky <leon@kernel.org>
> > > ---
> > >  drivers/infiniband/core/device.c | 3 +++
> > >  1 file changed, 3 insertions(+)
> > >
> > > diff --git a/drivers/infiniband/core/device.c
> > b/drivers/infiniband/core/device.c
> > > index 5516fb0..05e25a3 100644
> > > --- a/drivers/infiniband/core/device.c
> > > +++ b/drivers/infiniband/core/device.c
> > > @@ -661,6 +661,9 @@ int ib_query_port(struct ib_device *device,
> > >       if (err || port_attr->subnet_prefix)
> > >               return err;
> > >
> > > +     if (rdma_port_get_link_layer(device, port_num) !=
> > > IB_LINK_LAYER_INFINIBAND)
> > > +             return 0;
> > > +
> > >       err = ib_query_gid(device, port_num, 0, &gid, NULL);
> > >       if (err)
> > >               return err;
> >
> > This change assumes IB_LINK_LAYER_ETHERNET == RoCE, which isn't true for
> iWARP
> > devices.  Still, the change is good for iWARP too,
> 
> Thanks Steve,
> We spotted it during internal review too. We wanted to see this patch is
> accepted before sending followup patch which will remove such check from
> iwarp drivers.
> 
> > but the comment should
> > perhaps reflect this.
> >
> > Reviewed-by: Steve Wise <swise@opengridcomputing.com>
> >
> > Steve.
> >
diff mbox

Patch

diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 5516fb0..05e25a3 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -661,6 +661,9 @@  int ib_query_port(struct ib_device *device,
 	if (err || port_attr->subnet_prefix)
 		return err;
 
+	if (rdma_port_get_link_layer(device, port_num) != IB_LINK_LAYER_INFINIBAND)
+		return 0;
+
 	err = ib_query_gid(device, port_num, 0, &gid, NULL);
 	if (err)
 		return err;