From 6fe417f78723331c24ba812134786532a0f38900 Mon Sep 17 00:00:00 2001 From: Alexander Grissik Date: Tue, 12 Sep 2023 09:00:20 +0300 Subject: [PATCH] issue: 3604175 Fixing stuck empty rx ring cleanup When the ring is destroyed and the RQ is empty the termination loop becomes infinte. It waits for the last_posted_wqe to be retrieved. but since it is empty the last posted wqe was already retrieved. Signed-off-by: Alexander Grissik --- src/vma/dev/qp_mgr.cpp | 3 ++- src/vma/dev/qp_mgr.h | 1 + src/vma/dev/qp_mgr_eth_mlx5.h | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/vma/dev/qp_mgr.cpp b/src/vma/dev/qp_mgr.cpp index 949075675..316bb0a67 100644 --- a/src/vma/dev/qp_mgr.cpp +++ b/src/vma/dev/qp_mgr.cpp @@ -412,7 +412,8 @@ void qp_mgr::release_rx_buffers() qp_logdbg("draining rx cq_mgr %p (last_posted_rx_wr_id = %lu)", m_p_cq_mgr_rx, m_last_posted_rx_wr_id); uintptr_t last_polled_rx_wr_id = 0; while (m_p_cq_mgr_rx && last_polled_rx_wr_id != m_last_posted_rx_wr_id && - errno != EIO && !m_p_ib_ctx_handler->is_removed()) { + errno != EIO && !m_p_ib_ctx_handler->is_removed() && + !is_rq_empty()) { // Process the FLUSH'ed WQE's int ret = m_p_cq_mgr_rx->drain_and_proccess(&last_polled_rx_wr_id); diff --git a/src/vma/dev/qp_mgr.h b/src/vma/dev/qp_mgr.h index ee903d99f..a4c5bf7af 100644 --- a/src/vma/dev/qp_mgr.h +++ b/src/vma/dev/qp_mgr.h @@ -188,6 +188,7 @@ friend class cq_mgr_mp; virtual int send_to_wire(vma_ibv_send_wr* p_send_wqe, vma_wr_tx_packet_attr attr, bool request_comp); virtual bool is_completion_need() { return !m_n_unsignaled_count; }; + virtual bool is_rq_empty() const { return false; } }; class qp_mgr_eth : public qp_mgr diff --git a/src/vma/dev/qp_mgr_eth_mlx5.h b/src/vma/dev/qp_mgr_eth_mlx5.h index 083047229..f7d4fa9c9 100644 --- a/src/vma/dev/qp_mgr_eth_mlx5.h +++ b/src/vma/dev/qp_mgr_eth_mlx5.h @@ -66,6 +66,8 @@ friend class cq_mgr_mlx5; void trigger_completion_for_all_sent_packets(); void init_sq(); + virtual bool is_rq_empty() const { return (m_mlx5_qp.rq.head == m_mlx5_qp.rq.tail); } + uint64_t* m_sq_wqe_idx_to_wrid; uint64_t m_rq_wqe_counter; private: