> 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) May be in future more drivers can use the same APIs.