public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] IB/srpt: Increase port count
@ 2018-05-10 22:32 Bart Van Assche
  2018-05-14 12:03 ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Van Assche @ 2018-05-10 22:32 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Doug Ledford, linux-rdma, Bart Van Assche, Steve Wise, stable

Since there are adapters that have four ports, increase the size of
the srpt_device.port[] array. This patch avoids that the following
warning is hit with quad port Chelsio adapters:

    WARN_ON(sdev->device->phys_port_cnt > ARRAY_SIZE(sdev->port));

Reported-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Steve Wise <swise@opengridcomputing.com>
Cc: <stable@vger.kernel.org>
---
 drivers/infiniband/ulp/srpt/ib_srpt.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.h b/drivers/infiniband/ulp/srpt/ib_srpt.h
index 2361483476a0..b72f1f4066fa 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.h
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.h
@@ -410,7 +410,7 @@ struct srpt_device {
 	struct mutex		sdev_mutex;
 	bool			use_srq;
 	struct srpt_recv_ioctx	**ioctx_ring;
-	struct srpt_port	port[2];
+	struct srpt_port	port[4];
 	struct ib_event_handler	event_handler;
 	struct list_head	list;
 };
-- 
2.16.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] IB/srpt: Increase port count
  2018-05-10 22:32 [PATCH] IB/srpt: Increase port count Bart Van Assche
@ 2018-05-14 12:03 ` Christoph Hellwig
  2018-05-14 14:23   ` Bart Van Assche
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2018-05-14 12:03 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Jason Gunthorpe, Doug Ledford, linux-rdma, Steve Wise, stable

On Thu, May 10, 2018 at 03:32:09PM -0700, Bart Van Assche wrote:
> Since there are adapters that have four ports, increase the size of
> the srpt_device.port[] array. This patch avoids that the following
> warning is hit with quad port Chelsio adapters:
> 
>     WARN_ON(sdev->device->phys_port_cnt > ARRAY_SIZE(sdev->port));

Should we add a IB_MAX_PORTS define that ULPs can rely on in the core?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] IB/srpt: Increase port count
  2018-05-14 12:03 ` Christoph Hellwig
@ 2018-05-14 14:23   ` Bart Van Assche
  2018-05-14 14:24     ` hch
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Van Assche @ 2018-05-14 14:23 UTC (permalink / raw)
  To: hch@infradead.org
  Cc: jgg@ziepe.ca, linux-rdma@vger.kernel.org, dledford@redhat.com,
	swise@opengridcomputing.com, stable@vger.kernel.org

On Mon, 2018-05-14 at 05:03 -0700, Christoph Hellwig wrote:
> On Thu, May 10, 2018 at 03:32:09PM -0700, Bart Van Assche wrote:
> > Since there are adapters that have four ports, increase the size of
> > the srpt_device.port[] array. This patch avoids that the following
> > warning is hit with quad port Chelsio adapters:
> > 
> >     WARN_ON(sdev->device->phys_port_cnt > ARRAY_SIZE(sdev->port));
> 
> Should we add a IB_MAX_PORTS define that ULPs can rely on in the core?

How many drivers would benefit from the introduction of such a constant?
A third possible alternative is that I change the port array in the ib_srpt
driver such that it is allocated dynamically. That would allow to eliminate
the WARN_ON() statement mentioned above.

Bart.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] IB/srpt: Increase port count
  2018-05-14 14:23   ` Bart Van Assche
@ 2018-05-14 14:24     ` hch
  0 siblings, 0 replies; 4+ messages in thread
From: hch @ 2018-05-14 14:24 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: hch@infradead.org, jgg@ziepe.ca, linux-rdma@vger.kernel.org,
	dledford@redhat.com, swise@opengridcomputing.com,
	stable@vger.kernel.org

On Mon, May 14, 2018 at 02:23:16PM +0000, Bart Van Assche wrote:
> > >     WARN_ON(sdev->device->phys_port_cnt > ARRAY_SIZE(sdev->port));
> > 
> > Should we add a IB_MAX_PORTS define that ULPs can rely on in the core?
> 
> How many drivers would benefit from the introduction of such a constant?
> A third possible alternative is that I change the port array in the ib_srpt
> driver such that it is allocated dynamically. That would allow to eliminate
> the WARN_ON() statement mentioned above.

No idea how many benefit.  But either we have an upper limit, or
ULPs should be able to deal with any possible number, e.g. by using
your dynamic allocation idea.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-05-14 14:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-10 22:32 [PATCH] IB/srpt: Increase port count Bart Van Assche
2018-05-14 12:03 ` Christoph Hellwig
2018-05-14 14:23   ` Bart Van Assche
2018-05-14 14:24     ` hch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox