From nobody Wed Sep 13 22:17:16 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RmFDr4vfKz4t1j1; Wed, 13 Sep 2023 22:17:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RmFDr3shPz4JMD; Wed, 13 Sep 2023 22:17:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694643436; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gabicTM7rp29s1TfEvLep7ErbzTlkSW/afFKmbLomMw=; b=cHuBbQk648NeT2ZjWfGLmzinv6dfAbz1/ElvIAE1AH2iM64jnUJHFa8587FqGyq0egtNKy XmxOoSKJfpg8LiJj9iucp1yqYPE7sclfLtIYXZT8CxZ5rOABNdCmZQVBc/PwcB/c8suPbM 7mzZjsQ+bJd3fLNvNJb7EJTh8bJHU3oqbqoYFQETPOuaRq0oYoBnXLK6BFhs/dYUt3fNeU Y6I7Rx6ScJUHVO+PYysj5Bw1JvUmHyesmr9vtdHikSGsE6i7U2Baf7n+ROsGNadRjVrVwA brZ18SGRLgTX9jESqdsNYqDf/Ndwg15Es4rr3O2kZhwXclrgXGS7dsTLIn532Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694643436; a=rsa-sha256; cv=none; b=wLoUmYcZsac3J6ys9AhtPT4RsEYYK4Y29lqshbjpFUq/oThIsYBUAmcjrSs72TPwHBsYXq 7L7XTA95u3rhdd1AHLIIxBGS1tJRTCa9xpJQ6rZ6hYzay76LIJEysUYVCvE/4vERq1wtY6 L2IySxYglHVqx1AwUqztPB7NcwyrBMhADafkgY9IDnj2U24cVS1Zxr5koaHYf+FijRnulw hwgRzA6kKwTV7sJfniwt8iHlEXXvnXG5HAzK1ZuQ/SF/ID0KAoFzXTxqCZOQ3hzc0AXWex olEZZVUipGyotQlslmxK5R43PoIXcu48QaSobdE1KmUHUtsxWgYZFUM/WfNfPg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694643436; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gabicTM7rp29s1TfEvLep7ErbzTlkSW/afFKmbLomMw=; b=Oy/PbvSlwAG/p4UmHqViHwih6r8JgjsHEY6cFXu7AgoJAjqvoWsQgt7WU4cgo041H6H+me eb5GaY41aUttQwT/7yTojtaYXM+NdLnKoyvwXmX3/yOBpSNQBbcdhav5/0j875VaocCIWp x/XXEJ/gQbllodj/O7GCgole4OdpQSmE8qQBfKmLPShve291VIUPhjvnBQ5zCpxK+ChRPG aysxotd8j8GnAXOlYaLNelpW090S0iCAwcISt9/rU+JfOoym6LM3bccIPe+4KWYrLZDca2 8a0hr1vdWvA0AaHKvCfpX2icCdUBFbvtOuYOla60TjBeDRYSN2JO/KA6kqI3/Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RmFDr2fzszWxw; Wed, 13 Sep 2023 22:17:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 38DMHGIu012496; Wed, 13 Sep 2023 22:17:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38DMHG1I012493; Wed, 13 Sep 2023 22:17:16 GMT (envelope-from git) Date: Wed, 13 Sep 2023 22:17:16 GMT Message-Id: <202309132217.38DMHG1I012493@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Eric Joyner Subject: git: ffafa6a4d157 - main - irdma(4): remove artificial completion generator List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ffafa6a4d157e49e6b12567958c4ab0c9151c080 Auto-Submitted: auto-generated The branch main has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=ffafa6a4d157e49e6b12567958c4ab0c9151c080 commit ffafa6a4d157e49e6b12567958c4ab0c9151c080 Author: Bartosz Sobczak AuthorDate: 2023-09-12 21:35:06 +0000 Commit: Eric Joyner CommitDate: 2023-09-13 22:16:21 +0000 irdma(4): remove artificial completion generator Removing artificial completion generator as there had been no indication of the code being required for E810 cards. Further more it was found that the code may have unpleasant side effects on user experience when using ucmatose tool. Signed-off-by: Bartosz Sobczak Signed-off-by: Eric Joyner Reviewed by: erj@ MFC after: 1 day Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D41593 --- contrib/ofed/libirdma/irdma_umain.h | 8 -- contrib/ofed/libirdma/irdma_uverbs.c | 161 +---------------------------------- 2 files changed, 1 insertion(+), 168 deletions(-) diff --git a/contrib/ofed/libirdma/irdma_umain.h b/contrib/ofed/libirdma/irdma_umain.h index c67c5d7076f9..7ff850c46b72 100644 --- a/contrib/ofed/libirdma/irdma_umain.h +++ b/contrib/ofed/libirdma/irdma_umain.h @@ -109,11 +109,6 @@ struct verbs_cq { }; }; -struct irdma_cmpl_gen { - LIST_ENTRY(irdma_cmpl_gen) list; - struct irdma_cq_poll_info cpi; -}; - struct irdma_ucq { struct verbs_cq verbs_cq; struct verbs_mr vmr; @@ -130,7 +125,6 @@ struct irdma_ucq { struct list_head resize_list; /* for extended CQ completion fields */ struct irdma_cq_poll_info cur_cqe; - struct list_head_cmpl cmpl_generated; }; struct irdma_uqp { @@ -150,7 +144,6 @@ struct irdma_uqp { struct irdma_qp_uk qp; enum ibv_qp_type qp_type; struct irdma_sge *recv_sges; - pthread_t flush_thread; }; /* irdma_uverbs.c */ @@ -207,5 +200,4 @@ void irdma_async_event(struct ibv_context *context, void irdma_set_hw_attrs(struct irdma_hw_attrs *attrs); void *irdma_mmap(int fd, off_t offset); void irdma_munmap(void *map); -void *irdma_flush_thread(void *arg); #endif /* IRDMA_UMAIN_H */ diff --git a/contrib/ofed/libirdma/irdma_uverbs.c b/contrib/ofed/libirdma/irdma_uverbs.c index c59d409e72cd..bc6bec34e6cd 100644 --- a/contrib/ofed/libirdma/irdma_uverbs.c +++ b/contrib/ofed/libirdma/irdma_uverbs.c @@ -459,7 +459,6 @@ ucreate_cq(struct ibv_context *context, info.cq_size = get_cq_size(attr_ex->cqe, hw_rev, cqe_64byte_ena); iwucq->comp_vector = attr_ex->comp_vector; LIST_INIT(&iwucq->resize_list); - LIST_INIT(&iwucq->cmpl_generated); total_size = get_cq_total_bytes(info.cq_size, cqe_64byte_ena); cq_pages = total_size >> IRDMA_HW_PAGE_SHIFT; @@ -615,142 +614,6 @@ irdma_process_resize_list(struct irdma_ucq *iwucq, return cq_cnt; } -static void -irdma_remove_cmpls_list(struct irdma_ucq *iwucq) -{ - struct irdma_cmpl_gen *cmpl_node, *next; - - LIST_FOREACH_SAFE(cmpl_node, &iwucq->cmpl_generated, list, next) { - LIST_REMOVE(cmpl_node, list); - free(cmpl_node); - } -} - -static int -irdma_generated_cmpls(struct irdma_ucq *iwucq, struct irdma_cq_poll_info *cq_poll_info) -{ - struct irdma_cmpl_gen *cmpl; - - if (!iwucq || LIST_EMPTY(&iwucq->cmpl_generated)) - return ENOENT; - cmpl = LIST_FIRST(&iwucq->cmpl_generated); - LIST_REMOVE(cmpl, list); - memcpy(cq_poll_info, &cmpl->cpi, sizeof(*cq_poll_info)); - - free(cmpl); - - return 0; -} - -/** - * irdma_set_cpi_common_values - fill in values for polling info struct - * @cpi: resulting structure of cq_poll_info type - * @qp: QPair - * @qp_num: id of the QP - */ -static void -irdma_set_cpi_common_values(struct irdma_cq_poll_info *cpi, - struct irdma_qp_uk *qp, __u32 qp_num) -{ - cpi->comp_status = IRDMA_COMPL_STATUS_FLUSHED; - cpi->error = 1; - cpi->major_err = IRDMA_FLUSH_MAJOR_ERR; - cpi->minor_err = FLUSH_GENERAL_ERR; - cpi->qp_handle = (irdma_qp_handle) (uintptr_t)qp; - cpi->qp_id = qp_num; -} - -static bool -irdma_cq_empty(struct irdma_ucq *iwucq) -{ - struct irdma_cq_uk *ukcq; - __u64 qword3; - __le64 *cqe; - __u8 polarity; - - ukcq = &iwucq->cq; - cqe = IRDMA_GET_CURRENT_CQ_ELEM(ukcq); - get_64bit_val(cqe, 24, &qword3); - polarity = (__u8) FIELD_GET(IRDMA_CQ_VALID, qword3); - - return polarity != ukcq->polarity; -} - -/** - * irdma_generate_flush_completions - generate completion from WRs - * @iwuqp: pointer to QP - */ -static void -irdma_generate_flush_completions(struct irdma_uqp *iwuqp) -{ - struct irdma_qp_uk *qp = &iwuqp->qp; - struct irdma_ring *sq_ring = &qp->sq_ring; - struct irdma_ring *rq_ring = &qp->rq_ring; - struct irdma_cmpl_gen *cmpl; - __le64 *sw_wqe; - __u64 wqe_qword; - __u32 wqe_idx; - - if (pthread_spin_lock(&iwuqp->send_cq->lock)) - return; - if (irdma_cq_empty(iwuqp->send_cq)) { - while (IRDMA_RING_MORE_WORK(*sq_ring)) { - cmpl = malloc(sizeof(*cmpl)); - if (!cmpl) { - pthread_spin_unlock(&iwuqp->send_cq->lock); - return; - } - - wqe_idx = sq_ring->tail; - irdma_set_cpi_common_values(&cmpl->cpi, qp, qp->qp_id); - cmpl->cpi.wr_id = qp->sq_wrtrk_array[wqe_idx].wrid; - sw_wqe = qp->sq_base[wqe_idx].elem; - get_64bit_val(sw_wqe, 24, &wqe_qword); - cmpl->cpi.op_type = (__u8) FIELD_GET(IRDMAQPSQ_OPCODE, wqe_qword); - /* remove the SQ WR by moving SQ tail */ - IRDMA_RING_SET_TAIL(*sq_ring, sq_ring->tail + qp->sq_wrtrk_array[sq_ring->tail].quanta); - LIST_INSERT_HEAD(&iwuqp->send_cq->cmpl_generated, cmpl, list); - } - } - pthread_spin_unlock(&iwuqp->send_cq->lock); - if (pthread_spin_lock(&iwuqp->recv_cq->lock)) - return; - if (irdma_cq_empty(iwuqp->recv_cq)) { - while (IRDMA_RING_MORE_WORK(*rq_ring)) { - cmpl = malloc(sizeof(*cmpl)); - if (!cmpl) { - pthread_spin_unlock(&iwuqp->recv_cq->lock); - return; - } - - wqe_idx = rq_ring->tail; - irdma_set_cpi_common_values(&cmpl->cpi, qp, qp->qp_id); - cmpl->cpi.wr_id = qp->rq_wrid_array[wqe_idx]; - cmpl->cpi.op_type = IRDMA_OP_TYPE_REC; - /* remove the RQ WR by moving RQ tail */ - IRDMA_RING_SET_TAIL(*rq_ring, rq_ring->tail + 1); - LIST_INSERT_HEAD(&iwuqp->recv_cq->cmpl_generated, cmpl, list); - } - } - pthread_spin_unlock(&iwuqp->recv_cq->lock); -} - -void * -irdma_flush_thread(void *arg) -{ - __u8 i = 5; - struct irdma_uqp *iwuqp = arg; - - while (--i) { - if (pthread_spin_lock(&iwuqp->lock)) - break; - irdma_generate_flush_completions(arg); - pthread_spin_unlock(&iwuqp->lock); - sleep(1); - } - pthread_exit(NULL); -} - /** * irdma_udestroy_cq - destroys cq * @cq: ptr to cq to be destroyed @@ -771,8 +634,6 @@ irdma_udestroy_cq(struct ibv_cq *cq) if (ret) goto err; - if (!LIST_EMPTY(&iwucq->cmpl_generated)) - irdma_remove_cmpls_list(iwucq); irdma_process_resize_list(iwucq, NULL); ret = ibv_cmd_destroy_cq(cq); if (ret) @@ -1016,15 +877,6 @@ __irdma_upoll_cq(struct irdma_ucq *iwucq, int num_entries, while (npolled < num_entries) { ret = irdma_poll_one(&iwucq->cq, cur_cqe, entry ? entry + npolled : NULL); - if (ret == ENOENT) { - ret = irdma_generated_cmpls(iwucq, cur_cqe); - if (!ret) { - if (entry) - irdma_process_cqe(entry + npolled, cur_cqe); - else - irdma_process_cqe_ext(cur_cqe); - } - } if (!ret) { ++npolled; cq_new_cqe = true; @@ -1710,14 +1562,7 @@ irdma_umodify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr, int attr_mask) return ret; } else { - int ret; - - ret = ibv_cmd_modify_qp(qp, attr, attr_mask, &cmd, sizeof(cmd)); - if (ret) - return ret; - if (attr_mask & IBV_QP_STATE && attr->qp_state == IBV_QPS_ERR) - pthread_create(&iwuqp->flush_thread, NULL, irdma_flush_thread, iwuqp); - return 0; + return ibv_cmd_modify_qp(qp, attr, attr_mask, &cmd, sizeof(cmd)); } } @@ -1770,10 +1615,6 @@ irdma_udestroy_qp(struct ibv_qp *qp) int ret; iwuqp = container_of(qp, struct irdma_uqp, ibv_qp); - if (iwuqp->flush_thread) { - pthread_cancel(iwuqp->flush_thread); - pthread_join(iwuqp->flush_thread, NULL); - } ret = pthread_spin_destroy(&iwuqp->lock); if (ret) goto err;