From patchwork Sat Feb 18 15:43:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Devesh Sharma X-Patchwork-Id: 9581133 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 04491604A4 for ; Sat, 18 Feb 2017 15:44:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E82CB28728 for ; Sat, 18 Feb 2017 15:44:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DB94928731; Sat, 18 Feb 2017 15:44:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7027F2871E for ; Sat, 18 Feb 2017 15:44:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753408AbdBRPok (ORCPT ); Sat, 18 Feb 2017 10:44:40 -0500 Received: from mail-wm0-f52.google.com ([74.125.82.52]:33667 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752971AbdBRPok (ORCPT ); Sat, 18 Feb 2017 10:44:40 -0500 Received: by mail-wm0-f52.google.com with SMTP id t18so14733403wmt.0 for ; Sat, 18 Feb 2017 07:44:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=Nx3uKXpn+FIVx+S6m+IQZeNpqKMUCVJ1RqSJrpkPRrY=; b=hoUJ/EEV9rzX3KRh/GFZQ+msEvg8TzGZDvxLj0uEmNHvrJswtvXSnBsF25aRKzM7b9 9taNOSrPkJ1J+zC9lBpDZY7c6cPqmyQYxYJ/0t0C/Uwi8mAjtyouj2a4PZgzETtT0CPR mHkKBVwdpOOgNw+ajKqtFq0EzA5vBJZ5PQsbw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=Nx3uKXpn+FIVx+S6m+IQZeNpqKMUCVJ1RqSJrpkPRrY=; b=GfOX0B37b7lO1z+m/blJQrZ1u/Dpns0VhlUne6pHpptzzW63s1lglRkmbfBaR39tT0 jNsRE6zyulRwbn1vKkAfHJEZ5dOouC2c8lAU90aQIwnX73khyIGPdZpHHxLJMrYMb6Bm YweJj5JzHezYqeVaVmaK5v6IBw5r9I7XAxFeCEGDELIrZqT9+xd59aC3qWRjnlpZX8XP PkvnFmB6h+Tk+BnDE311Zn4wXcbvIOQ3cCG43rD/yX2ZRTwe3QeQrDmab9YNdEUsTP6x +0VvbU1SWaC5XuK4UoF5P4q42W6BSKZ+Ib8Bt57PdcIGSk/+uqxOgmKURQMKwggl5DpR LbzQ== X-Gm-Message-State: AMke39mLsKWhiDkrdT42gxXUejyc+NYeD3P3cY5VQAptoGIeJThkv430v1MRUHAnIMgsH3oK X-Received: by 10.28.182.70 with SMTP id g67mr9757686wmf.131.1487432678099; Sat, 18 Feb 2017 07:44:38 -0800 (PST) Received: from neo00-el73.iig.avagotech.net ([192.19.239.250]) by smtp.gmail.com with ESMTPSA id l67sm6076098wmf.1.2017.02.18.07.44.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Feb 2017 07:44:37 -0800 (PST) From: Devesh Sharma To: linux-rdma@vger.kernel.org Subject: [rdma-core v2 7/9] libbnxt_re: Enable polling for UD completions Date: Sat, 18 Feb 2017 10:43:56 -0500 Message-Id: <1487432638-19607-8-git-send-email-devesh.sharma@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487432638-19607-1-git-send-email-devesh.sharma@broadcom.com> References: <1487432638-19607-1-git-send-email-devesh.sharma@broadcom.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds support to allow polling of send and recv completions for a UD qp. Signed-off-by: Sriharsha Basavapatna Signed-off-by: Somnath Kotur Signed-off-by: Selvin Xavier Signed-off-by: Devesh Sharma --- providers/bnxt_re/bnxt_re-abi.h | 6 ++++++ providers/bnxt_re/verbs.c | 43 +++++++++++++++++++++++++++-------------- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/providers/bnxt_re/bnxt_re-abi.h b/providers/bnxt_re/bnxt_re-abi.h index 3082d76..581e1b7 100644 --- a/providers/bnxt_re/bnxt_re-abi.h +++ b/providers/bnxt_re/bnxt_re-abi.h @@ -174,6 +174,12 @@ enum bnxt_re_ud_flags_mask { BNXT_RE_UD_FLAGS_ROCE_IPV6 = 0x03 }; +enum bnxt_re_ud_cqe_mask { + BNXT_RE_UD_CQE_MAC_MASK = 0xFFFFFFFFFFFFULL, + BNXT_RE_UD_CQE_SRCQPLO_MASK = 0xFFFF, + BNXT_RE_UD_CQE_SRCQPLO_SHIFT = 0x30 +}; + enum bnxt_re_shpg_offt { BNXT_RE_SHPG_BEG_RESV_OFFT = 0x00, BNXT_RE_SHPG_AVID_OFFT = 0x10, diff --git a/providers/bnxt_re/verbs.c b/providers/bnxt_re/verbs.c index 19c30a0..36a1a6e 100644 --- a/providers/bnxt_re/verbs.c +++ b/providers/bnxt_re/verbs.c @@ -336,10 +336,8 @@ static uint8_t bnxt_re_poll_scqe(struct bnxt_re_qp *qp, struct ibv_wc *ibvwc, return pcqe; } -static int bnxt_re_poll_err_rcqe(struct bnxt_re_qp *qp, - struct ibv_wc *ibvwc, - struct bnxt_re_bcqe *hdr, - struct bnxt_re_rc_cqe *rcqe) +static int bnxt_re_poll_err_rcqe(struct bnxt_re_qp *qp, struct ibv_wc *ibvwc, + struct bnxt_re_bcqe *hdr, void *cqe) { struct bnxt_re_queue *rq = qp->rqq; struct bnxt_re_wrid *rwrid; @@ -364,6 +362,10 @@ static int bnxt_re_poll_err_rcqe(struct bnxt_re_qp *qp, ibvwc->qp_num = qp->qpid; ibvwc->opcode = IBV_WC_RECV; ibvwc->byte_len = 0; + ibvwc->wc_flags = 0; + if (qp->qptyp == IBV_QPT_UD) + ibvwc->src_qp = 0; + bnxt_re_incr_head(qp->rqq); if (qp->qpst != IBV_QPS_ERR) qp->qpst = IBV_QPS_ERR; @@ -375,16 +377,32 @@ static int bnxt_re_poll_err_rcqe(struct bnxt_re_qp *qp, return 1; } +static void bnxt_re_fill_ud_cqe(struct ibv_wc *ibvwc, + struct bnxt_re_bcqe *hdr, void *cqe) +{ + struct bnxt_re_ud_cqe *ucqe = cqe; + uint32_t qpid; + + qpid = ((hdr->qphi_rwrid >> BNXT_RE_BCQE_SRCQP_SHIFT) & + BNXT_RE_BCQE_SRCQP_SHIFT) << 0x10; /* higher 8 bits of 24 */ + qpid |= (ucqe->qplo_mac >> BNXT_RE_UD_CQE_SRCQPLO_SHIFT) & + BNXT_RE_UD_CQE_SRCQPLO_MASK; /*lower 16 of 24 */ + ibvwc->src_qp = qpid; + ibvwc->wc_flags |= IBV_WC_GRH; + /*IB-stack ABI in user do not ask for MAC to be reported. */ +} + static void bnxt_re_poll_success_rcqe(struct bnxt_re_qp *qp, struct ibv_wc *ibvwc, - struct bnxt_re_bcqe *hdr, - struct bnxt_re_rc_cqe *rcqe) + struct bnxt_re_bcqe *hdr, void *cqe) { struct bnxt_re_queue *rq = qp->rqq; struct bnxt_re_wrid *rwrid; + struct bnxt_re_rc_cqe *rcqe; uint32_t head = rq->head; uint8_t flags, is_imm, is_rdma; + rcqe = cqe; rwrid = &qp->rwrid[head]; ibvwc->status = IBV_WC_SUCCESS; @@ -407,6 +425,9 @@ static void bnxt_re_poll_success_rcqe(struct bnxt_re_qp *qp, ibvwc->opcode = IBV_WC_RECV_RDMA_WITH_IMM; } + if (qp->qptyp == IBV_QPT_UD) + bnxt_re_fill_ud_cqe(ibvwc, hdr, cqe); + bnxt_re_incr_head(rq); } @@ -414,19 +435,17 @@ static uint8_t bnxt_re_poll_rcqe(struct bnxt_re_qp *qp, struct ibv_wc *ibvwc, void *cqe, int *cnt) { struct bnxt_re_bcqe *hdr; - struct bnxt_re_rc_cqe *rcqe; uint8_t status, pcqe = false; - rcqe = cqe; hdr = cqe + sizeof(struct bnxt_re_rc_cqe); status = (hdr->flg_st_typ_ph >> BNXT_RE_BCQE_STATUS_SHIFT) & BNXT_RE_BCQE_STATUS_MASK; *cnt = 1; if (status == BNXT_RE_RSP_ST_OK) - bnxt_re_poll_success_rcqe(qp, ibvwc, hdr, rcqe); + bnxt_re_poll_success_rcqe(qp, ibvwc, hdr, cqe); else - *cnt = bnxt_re_poll_err_rcqe(qp, ibvwc, hdr, rcqe); + *cnt = bnxt_re_poll_err_rcqe(qp, ibvwc, hdr, cqe); return pcqe; } @@ -484,9 +503,6 @@ static int bnxt_re_poll_one(struct bnxt_re_cq *cq, int nwc, struct ibv_wc *wc) qp = (struct bnxt_re_qp *)scqe->qp_handle; if (!qp) break; /*stale cqe. should be rung.*/ - if (qp->qptyp == IBV_QPT_UD) - goto bail; /* TODO: Add UD poll */ - pcqe = bnxt_re_poll_scqe(qp, wc, cqe, &cnt); break; case BNXT_RE_WC_TYPE_RECV_RC: @@ -500,7 +516,6 @@ static int bnxt_re_poll_one(struct bnxt_re_cq *cq, int nwc, struct ibv_wc *wc) goto bail; /*TODO: Add SRQ poll */ pcqe = bnxt_re_poll_rcqe(qp, wc, cqe, &cnt); - /* TODO: Process UD rcqe */ break; case BNXT_RE_WC_TYPE_RECV_RAW: break;