Re: [PATCH rdma-next 3/3] RDMA/nldev: Return device protocol

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

 



On Fri, Mar 29, 2019 at 10:18:42PM +0300, Leon Romanovsky wrote:
> On Fri, Mar 29, 2019 at 03:31:29PM -0300, Jason Gunthorpe wrote:
> > On Sun, Mar 10, 2019 at 05:27:47PM +0200, Leon Romanovsky wrote:
> > > From: Leon Romanovsky <leonro@xxxxxxxxxxxx>
> > >
> > > Reuse existing RDMA_NLDEV_ATTR_LINK_TYPE to give ability for stable
> > > names UDEV rule create Ib device stable names based on link type
> > > protocol. The assumption that devices like mlx4 with duality in their
> > > link type under one IB device struct won't be allowed in the future.
> > >
> > > Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx>
> > >  drivers/infiniband/core/nldev.c | 24 ++++++++++++++++++++++++
> > >  1 file changed, 24 insertions(+)
> > >
> > > diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
> > > index ccf84142acd0..f07b1bce9ee8 100644
> > > +++ b/drivers/infiniband/core/nldev.c
> > > @@ -200,6 +200,7 @@ static int fill_nldev_handle(struct sk_buff *msg, struct ib_device *device)
> > >  static int fill_dev_info(struct sk_buff *msg, struct ib_device *device)
> > >  {
> > >  	char fw[IB_FW_VERSION_NAME_MAX];
> > > +	u8 port;
> > >
> > >  	if (fill_nldev_handle(msg, device))
> > >  		return -EMSGSIZE;
> > > @@ -228,6 +229,29 @@ static int fill_dev_info(struct sk_buff *msg, struct ib_device *device)
> > >  		return -EMSGSIZE;
> > >  	if (nla_put_u8(msg, RDMA_NLDEV_ATTR_DEV_NODE_TYPE, device->node_type))
> > >  		return -EMSGSIZE;
> > > +
> > > +	/*
> > > +	 * Link type is determined on first port and mlx4 device
> > > +	 * which can potentialy have two different link type for the same
> > > +	 * IB device is considered as better to be avoided in the future,
> > > +	 */
> > > +	port = rdma_start_port(device);
> > > +	if (rdma_protocol_ib(device, port) &&
> > > +	    nla_put_string(msg, RDMA_NLDEV_ATTR_LINK_TYPE, "ib"))
> > > +		return -EMSGSIZE;
> > > +	if (rdma_protocol_iwarp(device, port) &&
> > > +	    nla_put_string(msg, RDMA_NLDEV_ATTR_LINK_TYPE, "iw"))
> > > +		return -EMSGSIZE;
> > > +	if (rdma_protocol_roce(device, port) &&
> > > +	    nla_put_string(msg, RDMA_NLDEV_ATTR_LINK_TYPE, "roce"))
> > > +		return -EMSGSIZE;
> > > +	if (rdma_protocol_usnic(device, port) &&
> > > +	    nla_put_string(msg, RDMA_NLDEV_ATTR_LINK_TYPE, "usnic"))
> > > +		return -EMSGSIZE;
> > > +	if (rdma_cap_opa_mad(device, port) &&
> > > +	    nla_put_string(msg, RDMA_NLDEV_ATTR_LINK_TYPE, "opa"))
> > > +		return -EMSGSIZE;
> >
> > This needs to use a different enum name, RDMA_NLDEV_ATTR_LINK_TYPE is
> > a 'rdma-link-X' value (ie rxe), not a link technology name.
> >
> > If we do return RDMA_NLDEV_ATTR_LINK_TYPE during a get it should
> > mirror the value that was supplied during RDMA_NLDEV_CMD_NEWLINK and
> > not something else.
>
> Why exactly? It is our decision what to return and because for real
> devices we won't support multiple protocols at the same time, we will
> return real link type for them, e.g. ib, iwarp e.t.c.
>
> We already discussed it in this thread and agreed that rxe is just an
> name which can be wired to be roce in kernel.

And if you insist, we can return "rxe" instead of "roce" for RXE.

Thanks

>
> Thanks
>
> >
> > Jason


Attachment: signature.asc
Description: PGP signature


[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