Re: [PATCH for-next] RDMA/core: Assign the name of device when allocating ib_device

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

 



On Wed, Apr 29, 2020 at 10:33:19AM -0400, Dennis Dalessandro wrote:
> > > The issue is hfi1 calls into rvt_alloc_device() which then calls
> > > _ib_alloc_device(). We don't have the name set at that point. So the obvious
> > > thing to do is move the rvt_set_ibdev_name(). However there is a catch.
> > > 
> > > The name gets set after allocating the device and the device table because
> > > we get the unit number as part of the xa_alloc_irq(hfi1_dev_table) call
> > > which needs the pointer to the devdata.
> > > 
> > > One solution would be to pass in the pointer for the driver's dev table and
> > > let rvt_alloc_device() do the xa_alloc_irq().
> > 
> > Just do:
> > 
> > 	ret = xa_alloc_irq(&hfi1_dev_table, &unit, NULL, xa_limit_32b,
> > 			GFP_KERNEL);
> >          if (ret)
> >                  return ERR_PTR(ret);
> > 
> > 	dd = (struct hfi1_devdata *)rvt_alloc_device(sizeof(*dd) + extra,
> > 						     nports, unit);
> > 	if (!dd) {
> > 		xa_erase(&hfi1_dev_table, unit);
> > 		return ERR_PTR(-ENOMEM);
> > 	}
> > 	xa_store(&hfi1_dev_table, unit, dd, GFP_KERNEL);
> 
> That works too.

I don't understand why this xarray exists anyhow? Why can't the core
code assign the name with its internal algorithm?

There are several places that iterate over the xarray, but that
doesn't need a unit #, could be a linked list or use the core device
list.

The only actual lookup in hfi1_reset_device() looks pointless, the
caller already has the dd??

Jason



[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