From 49b8ef074695f349737591f76ef24d98ac7e65f6 Mon Sep 17 00:00:00 2001 From: Changcheng Liu Date: Fri, 28 Jun 2019 14:26:41 +0800 Subject: [PATCH] msg/async/rdma: fix error argument to get right qp state 1. It's wrong to use "-1" as argument to query queue state. In rdma library, ibv_query_qp will call ibv_cmd_query_qp to query queue state. If "-1" is used as attr_mask, ibv_cmd_query_qp will return error EOPNOTSUPP which means query failed. 2. In class QueuePair, is_error() could use member function get_state() to get the queue pair state. 3. It's better to use qp_state as queue pair state according to ibv_query_qp manual guide. struct ibv_qp_attr { enum ibv_qp_state qp_state; /* Current QP state */ enum ibv_qp_state cur_qp_state; /* Current QP state - irrelevant for ibv_query_qp */ ... Signed-off-by: Changcheng Liu --- src/msg/async/rdma/Infiniband.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/msg/async/rdma/Infiniband.cc b/src/msg/async/rdma/Infiniband.cc index 1fab149aa45..0631d8c1490 100644 --- a/src/msg/async/rdma/Infiniband.cc +++ b/src/msg/async/rdma/Infiniband.cc @@ -353,15 +353,14 @@ int Infiniband::QueuePair::get_state() const bool Infiniband::QueuePair::is_error() const { ibv_qp_attr qpa; - ibv_qp_init_attr qpia; - int r = ibv_query_qp(qp, &qpa, -1, &qpia); + int r = get_state(); if (r) { lderr(cct) << __func__ << " failed to get state: " << cpp_strerror(errno) << dendl; return true; } - return qpa.cur_qp_state == IBV_QPS_ERR; + return qpa.qp_state == IBV_QPS_ERR; } -- 2.39.5