All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Saleem, Shiraz" <shiraz.saleem@intel.com>
To: Weihang Li <liweihang@huawei.com>,
	"dledford@redhat.com" <dledford@redhat.com>,
	"jgg@ziepe.ca" <jgg@ziepe.ca>
Cc: "leon@kernel.org" <leon@kernel.org>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"linuxarm@huawei.com" <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>,
	"Latif, Faisal" <faisal.latif@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>,
	"Dalessandro, Dennis" <dennis.dalessandro@intel.com>
Subject: RE: [PATCH for-next] RDMA/core: Assign the name of device when allocating ib_device
Date: Mon, 27 Apr 2020 17:55:57 +0000	[thread overview]
Message-ID: <9DD61F30A802C4429A01CA4200E302A7DCD54BBA@fmsmsx124.amr.corp.intel.com> (raw)
In-Reply-To: <1587893517-11824-1-git-send-email-liweihang@huawei.com>

> Subject: [PATCH for-next] RDMA/core: Assign the name of device when allocating
> ib_device
> 
> If the name of a device is assigned during ib_register_device(), some drivers have
> to use dev_*() for printing before register device. Bring
> assign_name() into ib_alloc_device(), so that drivers can use ibdev_*() anywhere.
> 
> Signed-off-by: Weihang Li <liweihang@huawei.com>
> ---
>  drivers/infiniband/core/device.c               | 85 +++++++++++++-------------
>  drivers/infiniband/hw/bnxt_re/main.c           |  4 +-
>  drivers/infiniband/hw/cxgb4/device.c           |  2 +-
>  drivers/infiniband/hw/cxgb4/provider.c         |  2 +-
>  drivers/infiniband/hw/efa/efa_main.c           |  4 +-
>  drivers/infiniband/hw/hns/hns_roce_hw_v1.c     |  2 +-
>  drivers/infiniband/hw/hns/hns_roce_hw_v2.c     |  2 +-
>  drivers/infiniband/hw/hns/hns_roce_main.c      |  2 +-
>  drivers/infiniband/hw/i40iw/i40iw_verbs.c      |  4 +-
>  drivers/infiniband/hw/mlx4/main.c              |  4 +-
>  drivers/infiniband/hw/mlx5/ib_rep.c            |  8 ++-
>  drivers/infiniband/hw/mlx5/main.c              | 18 +++---
>  drivers/infiniband/hw/mthca/mthca_main.c       |  2 +-
>  drivers/infiniband/hw/mthca/mthca_provider.c   |  2 +-
>  drivers/infiniband/hw/ocrdma/ocrdma_main.c     |  4 +-
>  drivers/infiniband/hw/qedr/main.c              |  4 +-
>  drivers/infiniband/hw/usnic/usnic_ib_main.c    |  4 +-
>  drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c |  4 +-
>  drivers/infiniband/sw/rxe/rxe.c                |  4 +-
>  drivers/infiniband/sw/rxe/rxe.h                |  2 +-
>  drivers/infiniband/sw/rxe/rxe_net.c            |  4 +-
>  drivers/infiniband/sw/rxe/rxe_verbs.c          |  4 +-
>  drivers/infiniband/sw/rxe/rxe_verbs.h          |  2 +-
>  include/rdma/ib_verbs.h                        |  8 +--
>  24 files changed, 95 insertions(+), 86 deletions(-)

I think you ll need to update siw driver similarly.

rvt_register_device should be adapted to use the revised device registration API.
hfi1/qib also need some rework.
rvt_alloc_device needs to be adapted for the new one-shot 
name + device allocation scheme.
Hoping we can just use move the name setting from rvt_set_ibdev_name

A few more comments below.

[...]

>  /**
>   * _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
> + * cause a unique index to be added to the passed device name.
>   *
>   * Low-level drivers should use ib_alloc_device() to allocate &struct
>   * ib_device.  @size is the size of the structure to be allocated, @@ -567,7 +603,7
> @@ static void rdma_init_coredev(struct ib_core_device *coredev,
>   * ib_dealloc_device() must be used to free structures allocated with
>   * ib_alloc_device().
>   */
> -struct ib_device *_ib_alloc_device(size_t size)
> +struct ib_device *_ib_alloc_device(size_t size, const char *name)
>  {
>  	struct ib_device *device;
> 
> @@ -586,6 +622,11 @@ struct ib_device *_ib_alloc_device(size_t size)
>  	device->groups[0] = &ib_dev_attr_group;
>  	rdma_init_coredev(&device->coredev, device, &init_net);
> 
> +	if (assign_name(device, name)) {
> +		kfree(device);
Don't you need to do a rdma_restrack_clean here?


> +		return NULL;
> +	}
> +
>  	INIT_LIST_HEAD(&device->event_handler_list);
>  	spin_lock_init(&device->qp_open_list_lock);
>  	init_rwsem(&device->event_handler_rwsem);
> @@ -1132,40 +1173,6 @@ static __net_init int rdma_dev_init_net(struct net *net)
>  	return ret;
>  }
> 

[...]

> diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c
> b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
> index 1b6fb13..ccb0d70 100644
> --- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c
> +++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
> @@ -2692,7 +2692,7 @@ static struct i40iw_ib_device
> *i40iw_init_rdma_device(struct i40iw_device *iwdev
>  	struct net_device *netdev = iwdev->netdev;
>  	struct pci_dev *pcidev = (struct pci_dev *)iwdev->hw.dev_context;
> 
> -	iwibdev = ib_alloc_device(i40iw_ib_device, ibdev);
> +	iwibdev = ib_alloc_device(i40iw_ib_device, ibdev, "i40iw%d");
>  	if (!iwibdev) {
>  		i40iw_pr_err("iwdev == NULL\n");
>  		return NULL;
> @@ -2780,7 +2780,7 @@ int i40iw_register_rdma_device(struct i40iw_device
> *iwdev)
>  	if (ret)
>  		goto error;
> 
> -	ret = ib_register_device(&iwibdev->ibdev, "i40iw%d");
> +	ret = ib_register_device(&iwibdev->ibdev);
>  	if (ret)
>  		goto error;
> 

i40iw looks ok except for the missing underscore which I think was brought up already in another provider.

Thanks for this work!

Shiraz


  parent reply	other threads:[~2020-04-27 17:56 UTC|newest]

Thread overview: 24+ 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
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 [this message]
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-27 20:26   ` kbuild test robot
2020-04-28  6:29 ` 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=9DD61F30A802C4429A01CA4200E302A7DCD54BBA@fmsmsx124.amr.corp.intel.com \
    --to=shiraz.saleem@intel.com \
    --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=leon@kernel.org \
    --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=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.