Skip to content

efa: Fix CQ poll after QP destroy #1616

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions providers/efa/verbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -769,9 +769,6 @@ static inline int efa_poll_sub_cqs(struct efa_cq *cq, struct ibv_wc *wc,
sub_cq = &cq->sub_cq_arr[cq->next_poll_idx++];
cq->next_poll_idx %= num_sub_cqs;

if (!sub_cq->ref_cnt)
continue;

err = efa_poll_sub_cq(cq, sub_cq, &qp, wc, extended);
if (err != ENOENT) {
cq->cc++;
Expand Down Expand Up @@ -896,7 +893,6 @@ static void efa_sub_cq_initialize(struct efa_sub_cq *sub_cq, uint8_t *buf,
sub_cq->buf = buf;
sub_cq->qmask = sub_cq_size - 1;
sub_cq->cqe_size = cqe_size;
sub_cq->ref_cnt = 0;
}

static struct ibv_cq_ex *create_cq(struct ibv_context *ibvctx,
Expand Down Expand Up @@ -1084,16 +1080,6 @@ int efa_destroy_cq(struct ibv_cq *ibvcq)
return 0;
}

static void efa_cq_inc_ref_cnt(struct efa_cq *cq, uint8_t sub_cq_idx)
{
cq->sub_cq_arr[sub_cq_idx].ref_cnt++;
}

static void efa_cq_dec_ref_cnt(struct efa_cq *cq, uint8_t sub_cq_idx)
{
cq->sub_cq_arr[sub_cq_idx].ref_cnt--;
}

static void efa_wq_terminate(struct efa_wq *wq, int pgsz)
{
void *db_aligned;
Expand Down Expand Up @@ -1476,8 +1462,6 @@ static struct ibv_qp *create_qp(struct ibv_context *ibvctx,
struct efa_dev *dev = to_efa_dev(ibvctx->device);
struct efa_create_qp_resp resp = {};
struct efa_create_qp req = {};
struct efa_cq *send_cq;
struct efa_cq *recv_cq;
struct ibv_qp *ibvqp;
struct efa_qp *qp;
int err;
Expand Down Expand Up @@ -1535,16 +1519,6 @@ static struct ibv_qp *create_qp(struct ibv_context *ibvctx,
ctx->qp_table[ibvqp->qp_num & ctx->qp_table_sz_m1] = qp;
pthread_spin_unlock(&ctx->qp_table_lock);

send_cq = to_efa_cq(attr->send_cq);
pthread_spin_lock(&send_cq->lock);
efa_cq_inc_ref_cnt(send_cq, resp.send_sub_cq_idx);
pthread_spin_unlock(&send_cq->lock);

recv_cq = to_efa_cq(attr->recv_cq);
pthread_spin_lock(&recv_cq->lock);
efa_cq_inc_ref_cnt(recv_cq, resp.recv_sub_cq_idx);
pthread_spin_unlock(&recv_cq->lock);

if (attr->comp_mask & IBV_QP_INIT_ATTR_SEND_OPS_FLAGS) {
efa_qp_fill_wr_pfns(&qp->verbs_qp.qp_ex, attr);
qp->verbs_qp.comp_mask |= VERBS_QP_EX;
Expand Down Expand Up @@ -1725,9 +1699,6 @@ int efa_destroy_qp(struct ibv_qp *ibvqp)
pthread_spin_lock(&ctx->qp_table_lock);
efa_lock_cqs(ibvqp);

efa_cq_dec_ref_cnt(to_efa_cq(ibvqp->send_cq), qp->sq.wq.sub_cq_idx);
efa_cq_dec_ref_cnt(to_efa_cq(ibvqp->recv_cq), qp->rq.wq.sub_cq_idx);

ctx->qp_table[ibvqp->qp_num & ctx->qp_table_sz_m1] = NULL;

efa_unlock_cqs(ibvqp);
Expand Down
Loading