RE: [PATCH rdma-next 05/10] RDMA/core: Introduce and use API to read port immutable data

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

 




> From: Jason Gunthorpe <jgg@xxxxxxxxxx>
> Sent: Tuesday, February 2, 2021 11:44 PM
> 
> On Tue, Feb 02, 2021 at 06:05:48PM +0000, Parav Pandit wrote:
> >
> >
> > > From: Jason Gunthorpe <jgg@xxxxxxxxxx>
> > > Sent: Tuesday, February 2, 2021 10:20 PM
> > >
> > > On Wed, Jan 27, 2021 at 05:00:05PM +0200, Leon Romanovsky wrote:
> > > > + * ib_port_immutable_read() - Read rdma port's immutable data
> > > > + * @dev - IB device
> > > > + * @port - port number whose immutable data to read. It starts
> > > > + with
> > > index 1 and
> > > > + *         valid upto including rdma_end_port().
> > > > + */
> > > > +const struct ib_port_immutable*
> > > > +ib_port_immutable_read(struct ib_device *dev, unsigned int port) {
> > > > +	WARN_ON(!rdma_is_port_valid(dev, port));
> > > > +	return &dev->port_data[port].immutable; }
> > > > +EXPORT_SYMBOL(ib_port_immutable_read);
> > >
> > > Why add this function and only call it in one place?
> > >
> > A helper API from core helps
> > (a) to cut down mlx5 ib per port data structures and code around it
> > (b) it also avoids the need to maintain such driver internal data for
> > large port count (which is not done today)
> >
> I mean why not just access the pointer directly, is isn't in a private header or
> anything
Oh I see. Yes its accessible directly. An API just looked better to indicate that its RO for drivers by doing const*.





[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