From 194dc9e2f97933d2606a724b61f5aae546cc9365 Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Mon, 24 Jan 2022 03:53:48 +0000 Subject: [PATCH] Revert "nvme_rdma: Continue even if we receive a normal WC when qpair is disconnected" This reverts commit b9518a554016ccc65903ce961cd2f8be437ed58c. Reason for revert: Fix a degradation for adminq Change-Id: I0e2c5e48a5ca34171fa98fa68216da4354b5d262 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10879 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Ben Walker Reviewed-by: Aleksey Marchuk --- lib/nvme/nvme_rdma.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/nvme/nvme_rdma.c b/lib/nvme/nvme_rdma.c index b75e267a93..7ea5b0a090 100644 --- a/lib/nvme/nvme_rdma.c +++ b/lib/nvme/nvme_rdma.c @@ -2191,6 +2191,13 @@ nvme_rdma_log_wc_status(struct nvme_rdma_qpair *rqpair, struct ibv_wc *wc) } } +static inline bool +nvme_rdma_is_rxe_device(struct ibv_device_attr *dev_attr) +{ + return dev_attr->vendor_id == SPDK_RDMA_RXE_VENDOR_ID_OLD || + dev_attr->vendor_id == SPDK_RDMA_RXE_VENDOR_ID_NEW; +} + static int nvme_rdma_cq_process_completions(struct ibv_cq *cq, uint32_t batch_size, struct nvme_rdma_poll_group *group, @@ -2281,11 +2288,15 @@ nvme_rdma_cq_process_completions(struct ibv_cq *cq, uint32_t batch_size, struct ibv_device_attr dev_attr; int query_status; - /* We may receive a completion without error status when qpair is disconnected/destroyed. */ + /* Bug in Soft Roce - we may receive a completion without error status when qpair is disconnected/destroyed. + * As sanity check - log an error if we use a real HW (it should never happen) */ query_status = ibv_query_device(cq->context, &dev_attr); if (query_status == 0) { - SPDK_INFOLOG(nvme, "Received malformed completion: request 0x%"PRIx64" type %d\n", - wc->wr_id, rdma_wr->type); + if (!nvme_rdma_is_rxe_device(&dev_attr)) { + SPDK_ERRLOG("Received malformed completion: request 0x%"PRIx64" type %d\n", wc->wr_id, + rdma_wr->type); + assert(0); + } } else { SPDK_ERRLOG("Failed to query ib device\n"); assert(0);