Re: [PATCH rdma-next v1 04/13] IB/core: Honor port_num while resolving GID for IB link layer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 13, 2018 at 07:03:54PM +0200, Yuval Shaia wrote:
> On Tue, Mar 13, 2018 at 04:06:14PM +0200, Leon Romanovsky wrote:
> > From: Parav Pandit <parav@xxxxxxxxxxxx>
> > 
> > Currently initialized ah_attr contains the port number to which cm_id is
> > bound. However, while searching for GID table for matching GID entry,
> > port number is ignored.
> > It is better to honor the port number of the cm_id while searching GID
> > table for IB link layer as well.
> > 
> > Reviewed-by: Daniel Jurgens <danielj@xxxxxxxxxxxx>
> > Signed-off-by: Parav Pandit <parav@xxxxxxxxxxxx>
> > Signed-off-by: Leon Romanovsky <leon@xxxxxxxxxx>
> >  drivers/infiniband/core/multicast.c | 26 ++++++++++++--------------
> >  1 file changed, 12 insertions(+), 14 deletions(-)
> > 
> > diff --git a/drivers/infiniband/core/multicast.c b/drivers/infiniband/core/multicast.c
> > index 45f2f095f793..4eb72ff539fc 100644
> > +++ b/drivers/infiniband/core/multicast.c
> > @@ -724,21 +724,19 @@ int ib_init_ah_from_mcmember(struct ib_device *device, u8 port_num,
> >  {
> >  	int ret;
> >  	u16 gid_index;
> > -	u8 p;
> > -
> > -	if (rdma_protocol_roce(device, port_num)) {
> > -		ret = ib_find_cached_gid_by_port(device, &rec->port_gid,
> > -						 gid_type, port_num,
> > -						 ndev,
> > -						 &gid_index);
> > -	} else if (rdma_protocol_ib(device, port_num)) {
> > -		ret = ib_find_cached_gid(device, &rec->port_gid,
> > -					 IB_GID_TYPE_IB, NULL, &p,
> > -					 &gid_index);
> > -	} else {
> > -		ret = -EINVAL;
> > -	}
> >  
> > +	/* GID table is not based on the netdevice for IB link layer,
> > +	 * so ignore ndev during search.
> > +	 */
> > +	if (rdma_protocol_ib(device, port_num))
> > +		ndev = NULL;
> > +	else if (!rdma_protocol_roce(device, port_num))
> > +		return -EINVAL;
> > +
> > +	ret = ib_find_cached_gid_by_port(device, &rec->port_gid,
> > +					 gid_type, port_num,
> > +					 ndev,
> > +					 &gid_index);
> 
> It is unclear from commit message why for IB we are no longer using
> ib_find_cached_gid().

You mean vs ib_find_cached_gid_by_port()? Isn't that explained by
this:

 It is better to honor the port number of the cm_id while searching GID
 table for IB link layer as well.

'better' is a bit of an understatement..

If the the AH is supposed to be used on a specific port then it must
be used with the gid_index for the port and not accidently get
switched over to the gid_index for some other port.

So the gid must be present on the provided port or
ib_init_ah_from_mcmember must fail.. It was a bug to not check it.

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux