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; };
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?
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.
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.
linux-stable-mirror@lists.linaro.org