diff mbox

IB/srpt: Increase port count

Message ID 20180510223209.10277-1-bart.vanassche@wdc.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

Bart Van Assche May 10, 2018, 10:32 p.m. UTC
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(-)

Comments

Christoph Hellwig May 14, 2018, 12:03 p.m. UTC | #1
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?
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bart Van Assche May 14, 2018, 2:23 p.m. UTC | #2
T24gTW9uLCAyMDE4LTA1LTE0IGF0IDA1OjAzIC0wNzAwLCBDaHJpc3RvcGggSGVsbHdpZyB3cm90
ZToNCj4gT24gVGh1LCBNYXkgMTAsIDIwMTggYXQgMDM6MzI6MDlQTSAtMDcwMCwgQmFydCBWYW4g
QXNzY2hlIHdyb3RlOg0KPiA+IFNpbmNlIHRoZXJlIGFyZSBhZGFwdGVycyB0aGF0IGhhdmUgZm91
ciBwb3J0cywgaW5jcmVhc2UgdGhlIHNpemUgb2YNCj4gPiB0aGUgc3JwdF9kZXZpY2UucG9ydFtd
IGFycmF5LiBUaGlzIHBhdGNoIGF2b2lkcyB0aGF0IHRoZSBmb2xsb3dpbmcNCj4gPiB3YXJuaW5n
IGlzIGhpdCB3aXRoIHF1YWQgcG9ydCBDaGVsc2lvIGFkYXB0ZXJzOg0KPiA+IA0KPiA+ICAgICBX
QVJOX09OKHNkZXYtPmRldmljZS0+cGh5c19wb3J0X2NudCA+IEFSUkFZX1NJWkUoc2Rldi0+cG9y
dCkpOw0KPiANCj4gU2hvdWxkIHdlIGFkZCBhIElCX01BWF9QT1JUUyBkZWZpbmUgdGhhdCBVTFBz
IGNhbiByZWx5IG9uIGluIHRoZSBjb3JlPw0KDQpIb3cgbWFueSBkcml2ZXJzIHdvdWxkIGJlbmVm
aXQgZnJvbSB0aGUgaW50cm9kdWN0aW9uIG9mIHN1Y2ggYSBjb25zdGFudD8NCkEgdGhpcmQgcG9z
c2libGUgYWx0ZXJuYXRpdmUgaXMgdGhhdCBJIGNoYW5nZSB0aGUgcG9ydCBhcnJheSBpbiB0aGUg
aWJfc3JwdA0KZHJpdmVyIHN1Y2ggdGhhdCBpdCBpcyBhbGxvY2F0ZWQgZHluYW1pY2FsbHkuIFRo
YXQgd291bGQgYWxsb3cgdG8gZWxpbWluYXRlDQp0aGUgV0FSTl9PTigpIHN0YXRlbWVudCBtZW50
aW9uZWQgYWJvdmUuDQoNCkJhcnQuDQoNCg0K
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Christoph Hellwig May 14, 2018, 2:24 p.m. UTC | #3
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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;
 };