From a2436c2e68020fcdb35068ecee081663380c5cdb Mon Sep 17 00:00:00 2001 From: Shi Jin Date: Fri, 14 Jun 2024 17:52:56 +0000 Subject: [PATCH] prov/efa: Fix the rx pkt post procedure. Currently, we only repost rx pkts when there is completion of IBV_WC_RECV and IBV_WC_RDMA_WRITE_IMM. This is wrong because the rx pkt can be resolved after being held for local read, which is a send or read completion. This patch fixes this issue by just checking the efa_rx_pkts_to_post counter in ep instead of checking the IBV op codes, which is safe and stable. Signed-off-by: Shi Jin --- prov/efa/src/rdm/efa_rdm_cq.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/prov/efa/src/rdm/efa_rdm_cq.c b/prov/efa/src/rdm/efa_rdm_cq.c index 09464d0e0c1..ca1c8e28d79 100644 --- a/prov/efa/src/rdm/efa_rdm_cq.c +++ b/prov/efa/src/rdm/efa_rdm_cq.c @@ -365,8 +365,6 @@ void efa_rdm_cq_poll_ibv_cq(ssize_t cqe_to_process, struct efa_ibv_cq *ibv_cq) break; case IBV_WC_RECV: /* fall through */ case IBV_WC_RECV_RDMA_WITH_IMM: - if (!dlist_find_first_match(&rx_progressed_ep_list, &efa_rdm_cq_match_ep, ep)) - dlist_insert_tail(&ep->entry, &rx_progressed_ep_list); efa_rdm_pke_handle_rx_error(pkt_entry, prov_errno); break; default: @@ -384,8 +382,6 @@ void efa_rdm_cq_poll_ibv_cq(ssize_t cqe_to_process, struct efa_ibv_cq *ibv_cq) break; case IBV_WC_RECV: efa_av = ep->base_ep.av; - if (!dlist_find_first_match(&rx_progressed_ep_list, &efa_rdm_cq_match_ep, ep)) - dlist_insert_tail(&ep->entry, &rx_progressed_ep_list); pkt_entry->addr = efa_av_reverse_lookup_rdm(efa_av, ibv_wc_read_slid(ibv_cq->ibv_cq_ex), ibv_wc_read_src_qp(ibv_cq->ibv_cq_ex), pkt_entry); @@ -405,8 +401,6 @@ void efa_rdm_cq_poll_ibv_cq(ssize_t cqe_to_process, struct efa_ibv_cq *ibv_cq) efa_rdm_pke_handle_rma_completion(pkt_entry); break; case IBV_WC_RECV_RDMA_WITH_IMM: - if (!dlist_find_first_match(&rx_progressed_ep_list, &efa_rdm_cq_match_ep, ep)) - dlist_insert_tail(&ep->entry, &rx_progressed_ep_list); efa_rdm_cq_proc_ibv_recv_rdma_with_imm_completion( ibv_cq->ibv_cq_ex, FI_REMOTE_CQ_DATA | FI_RMA | FI_REMOTE_WRITE, @@ -418,6 +412,8 @@ void efa_rdm_cq_poll_ibv_cq(ssize_t cqe_to_process, struct efa_ibv_cq *ibv_cq) assert(0 && "Unhandled cq type"); } + if (ep->efa_rx_pkts_to_post > 0 && !dlist_find_first_match(&rx_progressed_ep_list, &efa_rdm_cq_match_ep, ep)) + dlist_insert_tail(&ep->entry, &rx_progressed_ep_list); i++; if (i == cqe_to_process) { break;