Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: liweihang <liweihang@huawei.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>,
	"dledford@redhat.com" <dledford@redhat.com>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	Linuxarm <linuxarm@huawei.com>,
	"selvin.xavier@broadcom.com" <selvin.xavier@broadcom.com>,
	"devesh.sharma@broadcom.com" <devesh.sharma@broadcom.com>,
	"somnath.kotur@broadcom.com" <somnath.kotur@broadcom.com>,
	"sriharsha.basavapatna@broadcom.com" 
	<sriharsha.basavapatna@broadcom.com>,
	"bharat@chelsio.com" <bharat@chelsio.com>,
	"galpress@amazon.com" <galpress@amazon.com>,
	"sleybo@amazon.com" <sleybo@amazon.com>,
	"faisal.latif@intel.com" <faisal.latif@intel.com>,
	"shiraz.saleem@intel.com" <shiraz.saleem@intel.com>,
	"yishaih@mellanox.com" <yishaih@mellanox.com>,
	"mkalderon@marvell.com" <mkalderon@marvell.com>,
	"aelior@marvell.com" <aelior@marvell.com>,
	"benve@cisco.com" <benve@cisco.com>,
	"neescoba@cisco.com" <neescoba@cisco.com>,
	"pkaustub@cisco.com" <pkaustub@cisco.com>,
	"aditr@vmware.com" <aditr@vmware.com>,
	"pv-drivers@vmware.com" <pv-drivers@vmware.com>,
	"monis@mellanox.com" <monis@mellanox.com>,
	"kamalheib1@gmail.com" <kamalheib1@gmail.com>,
	"parav@mellanox.com" <parav@mellanox.com>,
	"markz@mellanox.com" <markz@mellanox.com>,
	"rd.dunlab@gmail.com" <rd.dunlab@gmail.com>,
	"dennis.dalessandro@intel.com" <dennis.dalessandro@intel.com>
Subject: Re: [PATCH for-next] RDMA/core: Assign the name of device when allocating ib_device
Date: Tue, 28 Apr 2020 14:19:07 +0300	[thread overview]
Message-ID: <20200428111907.GI134660@unreal> (raw)
In-Reply-To: <B82435381E3B2943AA4D2826ADEF0B3A0232A133@DGGEML522-MBX.china.huawei.com>

On Tue, Apr 28, 2020 at 08:00:29AM +0000, liweihang wrote:
> On 2020/4/27 20:03, Leon Romanovsky wrote:
> >>>>  /**
> >>>>   * _ib_alloc_device - allocate an IB device struct
> >>>>   * @size:size of structure to allocate
> >>>> + * @name: unique string device name. This may include a '%' which will
> >>> It looks like all drivers are setting "%" in their name and "name" can
> >>> be changed to be "prefix".
> >> Does hfi? I thought the name was forced there for some port swapped
> >> reason?
> > This patch doesn't touch HFI, nothing prohibits from us to make this
> > conversion work for all drivers except HFI and for the HFI add some
> > different callback. There is no need to make API harder just because
> > one driver needs it.
> >
> > Thanks
> >
> >> Jason
>
> Hi Jason and Leon,
>
> I missed some codes related to assign_name() in this series including
> hfi/qib as Shiraz pointed. And I found a "name" without a "%" in following
> funtions in core/nldev.c, and ibdev_name will be used for rxe/siw later.
>
> 	static int nldev_newlink(struct sk_buff *skb, struct nlmsghdr *nlh,
> 				  struct netlink_ext_ack *extack)
> 	{
> 		...
>
> 		nla_strlcpy(ibdev_name, tb[RDMA_NLDEV_ATTR_DEV_NAME],
> 			    sizeof(ibdev_name));
> 		if (strchr(ibdev_name, '%') || strlen(ibdev_name) == 0)
> 			return -EINVAL;
>
> 		...
> 	}
>
> I'm not familiar with these codes, but I think the judgment in assign_name()
> is for the situaion like above.
>
> 	if (strchr(name, '%'))
> 		ret = alloc_name(device, name);
> 	else
> 		ret = dev_set_name(&device->dev, name);
>
> So is it a better idea to keep using "name" instead of "prefix"?

nldev_newlink() doesn't call to ib_alloc_device() and alloc_name(). The
check pointed by you is for the user input.

>
> Thanks
> Weihang

  reply	other threads:[~2020-04-28 11:19 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-26  9:31 [PATCH for-next] RDMA/core: Assign the name of device when allocating ib_device Weihang Li
2020-04-27  8:45 ` Gal Pressman
2020-04-27  9:02   ` liweihang
2020-04-27 11:47 ` Leon Romanovsky
2020-04-27 11:52   ` Jason Gunthorpe
2020-04-27 12:03     ` Leon Romanovsky
2020-04-28  8:00       ` liweihang
2020-04-28 11:19         ` Leon Romanovsky [this message]
2020-04-28 12:39           ` liweihang
2020-04-29  8:37             ` Leon Romanovsky
2020-04-30  7:55               ` liweihang
2020-04-28  1:29   ` liweihang
2020-04-27 17:55 ` Saleem, Shiraz
2020-04-28  0:04   ` Jason Gunthorpe
2020-04-29 13:32     ` Dennis Dalessandro
2020-04-29 13:50       ` Jason Gunthorpe
2020-04-29 14:33         ` Dennis Dalessandro
2020-04-29 14:57           ` Jason Gunthorpe
2020-04-29 16:17             ` Dennis Dalessandro
2020-04-28  6:17   ` liweihang
2020-04-27 20:26 ` kbuild test robot
2020-04-28  6:29 ` kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200428111907.GI134660@unreal \
    --to=leon@kernel.org \
    --cc=aditr@vmware.com \
    --cc=aelior@marvell.com \
    --cc=benve@cisco.com \
    --cc=bharat@chelsio.com \
    --cc=dennis.dalessandro@intel.com \
    --cc=devesh.sharma@broadcom.com \
    --cc=dledford@redhat.com \
    --cc=faisal.latif@intel.com \
    --cc=galpress@amazon.com \
    --cc=jgg@ziepe.ca \
    --cc=kamalheib1@gmail.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=liweihang@huawei.com \
    --cc=markz@mellanox.com \
    --cc=mkalderon@marvell.com \
    --cc=monis@mellanox.com \
    --cc=neescoba@cisco.com \
    --cc=parav@mellanox.com \
    --cc=pkaustub@cisco.com \
    --cc=pv-drivers@vmware.com \
    --cc=rd.dunlab@gmail.com \
    --cc=selvin.xavier@broadcom.com \
    --cc=shiraz.saleem@intel.com \
    --cc=sleybo@amazon.com \
    --cc=somnath.kotur@broadcom.com \
    --cc=sriharsha.basavapatna@broadcom.com \
    --cc=yishaih@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox