From 4a2c27f717b545711b8316b585240a0f73d84af9 Mon Sep 17 00:00:00 2001 From: Alexey Marchuk Date: Tue, 26 Jan 2021 19:59:13 +0300 Subject: [PATCH] nvmf/rdma: Handle CQ resize for iWARP transport Since iWARP doesn't support CQ resize, we can't accept new qpairs when CQ size is insufficient. In other case if we accept new qpairs we can et CQ overrun and receive IBV_EVENT_CQ_ERR ibv async event. In that case we will have to close all qpairs that use this CQ. Part of the fix for issue #1747 Signed-off-by: Alexey Marchuk Change-Id: I30b9163a7c8abb8651f8813c6bbdb80000741c9c Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6106 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Tomasz Zawadzki Reviewed-by: Ziye Yang --- lib/nvmf/rdma.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/nvmf/rdma.c b/lib/nvmf/rdma.c index d219d39f3b..ab538f7327 100644 --- a/lib/nvmf/rdma.c +++ b/lib/nvmf/rdma.c @@ -2,7 +2,7 @@ * BSD LICENSE * * Copyright (c) Intel Corporation. All rights reserved. - * Copyright (c) 2019, 2020 Mellanox Technologies LTD. All rights reserved. + * Copyright (c) 2019-2021 Mellanox Technologies LTD. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -944,6 +944,11 @@ nvmf_rdma_resize_cq(struct spdk_nvmf_rdma_qpair *rqpair, struct spdk_nvmf_rdma_d } if (rpoller->num_cqe != num_cqe) { + if (device->context->device->transport_type == IBV_TRANSPORT_IWARP) { + SPDK_ERRLOG("iWARP doesn't support CQ resize. Current capacity %u, required %u\n" + "Using CQ of insufficient size may lead to CQ overrun\n", rpoller->num_cqe, num_cqe); + return -1; + } if (required_num_wr > device->attr.max_cqe) { SPDK_ERRLOG("RDMA CQE requirement (%d) exceeds device max_cqe limitation (%d)\n", required_num_wr, device->attr.max_cqe);