nvmf/rdma: Check device max_srq_wr when creating SRQ

Some devices may support SRQ depth lower than defaulut
value 4096

Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Change-Id: I58da0ac268a6d4c4a7e3b500ae37b8fad4810e17
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10654
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Alexey Marchuk 2021-12-13 18:32:39 +03:00 committed by Tomasz Zawadzki
parent 2b565885f3
commit 3838d4d2c5

View File

@ -3274,7 +3274,11 @@ nvmf_rdma_poll_group_create(struct spdk_nvmf_transport *transport)
TAILQ_INSERT_TAIL(&rgroup->pollers, poller, link);
if (rtransport->rdma_opts.no_srq == false && device->num_srq < device->attr.max_srq) {
poller->max_srq_depth = rtransport->rdma_opts.max_srq_depth;
if ((int)rtransport->rdma_opts.max_srq_depth > device->attr.max_srq_wr) {
SPDK_WARNLOG("Requested SRQ depth %u, max supported by dev %s is %d\n",
rtransport->rdma_opts.max_srq_depth, device->context->device->name, device->attr.max_srq_wr);
}
poller->max_srq_depth = spdk_min((int)rtransport->rdma_opts.max_srq_depth, device->attr.max_srq_wr);
device->num_srq++;
memset(&srq_init_attr, 0, sizeof(srq_init_attr));