From patchwork Tue Jun 15 18:31:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Devesh Sharma X-Patchwork-Id: 12322647 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14699C48BE5 for ; Tue, 15 Jun 2021 18:32:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EECDD61185 for ; Tue, 15 Jun 2021 18:32:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231451AbhFOSeL (ORCPT ); Tue, 15 Jun 2021 14:34:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231202AbhFOSeI (ORCPT ); Tue, 15 Jun 2021 14:34:08 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55D52C061574 for ; Tue, 15 Jun 2021 11:32:04 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id o88-20020a17090a0a61b029016eeb2adf66so2199125pjo.4 for ; Tue, 15 Jun 2021 11:32:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version; bh=NLmytu9MF2xJohkzCnT3Y8b1D4+3mYfVCoeVaAR9syk=; b=X7tm4hgh7nthM0c1of2ZJmEsXJZVzBeHRJWAlEdp+nO889da0lx9E2JOZOwGdPZAP6 zQZrOHBal6Bk7mNVMRchyp5OB/4uNtI3Cdev06E6B5QveVTHYX/rtcXalH2lB30F05z8 6GxNvycB8krlbsJft+O8JID7AQdTeU909kVEI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version; bh=NLmytu9MF2xJohkzCnT3Y8b1D4+3mYfVCoeVaAR9syk=; b=FSdhACafon9NJvC/g7Pg2Pw0II32wxvDct/puzUEFJUUQdp/AtueP+AFYMy1AwC8ch vp1RJnCItT+ZOmqOnfC+uvWaXz/qqePeq4NE2qgUYytWp6tx8vVfoZ870FhWD+b7QDTl pHm5O35Jf0jZOA3m1vNw3BuBTLsWFPsjKT8Cxc7Yaa4jh52kxO4BIIimoVM2pI4wd06W NzHpSxuFNV9DhE2knNGKaioBHG3C4Yp0TjdNh3OijZYO18dW+n2mYig6UdYIl7Erm+KY XRH1IHmH97eFo6zZOPjZ4EnyImoZfB1tgmxfwl0iz5plKuRRgvB6hh8IHqThl3bC+JmA bt8A== X-Gm-Message-State: AOAM533qoFM0UMK5c+guhnChPZVLW0U847mUJOS6UoN1lhXSVRqGWiYa DgX25/MG5BYzL9AyNbXMm5vcZOcnsBrTVVNnhzn4/8/e+TLYH4o9z6JEvhYFJAtLQ2ThHp/lxgU sY6obV8+YuqOXaCWcj6mrSNUcu9BvA3n0i7zmphesZs4TuTDQCALVe8kAbAIb88KOUpCyw4vPzs Zz9dxh1A== X-Google-Smtp-Source: ABdhPJwYYuIwJkriLT4Hj37iE8kKAOTk8vPufYPwbbdU64ti/7JVoAu4DEqEO3Dm9mDlDvd6hnFhBA== X-Received: by 2002:a17:902:ced1:b029:115:3e22:1eb4 with SMTP id d17-20020a170902ced1b02901153e221eb4mr5147934plg.19.1623781923108; Tue, 15 Jun 2021 11:32:03 -0700 (PDT) Received: from dev01.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id i125sm3803823pfc.7.2021.06.15.11.32.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 11:32:02 -0700 (PDT) From: Devesh Sharma To: linux-rdma@vger.kernel.org Cc: Devesh Sharma Subject: [PATCH V5 rdma-core 2/5] bnxt_re/lib: Read wqe mode from the driver Date: Wed, 16 Jun 2021 00:01:45 +0530 Message-Id: <20210615183148.1179042-3-devesh.sharma@broadcom.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210615183148.1179042-1-devesh.sharma@broadcom.com> References: <20210615183148.1179042-1-devesh.sharma@broadcom.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org During bnxt_re device context creation, read the wqe mode and store it in context structure and in the QP context structure. wqe mode would be required to change between fixed size wqe and non-fixed sized wqe modes of SQ/RQ in gen-p5 or newer devices. Signed-off-by: Devesh Sharma --- providers/bnxt_re/bnxt_re-abi.h | 5 +++++ providers/bnxt_re/main.c | 4 ++++ providers/bnxt_re/main.h | 2 ++ providers/bnxt_re/verbs.c | 1 + 4 files changed, 12 insertions(+) diff --git a/providers/bnxt_re/bnxt_re-abi.h b/providers/bnxt_re/bnxt_re-abi.h index c82019e8..d138cd9c 100644 --- a/providers/bnxt_re/bnxt_re-abi.h +++ b/providers/bnxt_re/bnxt_re-abi.h @@ -196,6 +196,11 @@ enum bnxt_re_ud_cqe_mask { BNXT_RE_UD_CQE_SRCQPLO_SHIFT = 0x30 }; +enum bnxt_re_modes { + BNXT_RE_WQE_MODE_STATIC = 0x00, + BNXT_RE_WQE_MODE_VARIABLE = 0x01 +}; + struct bnxt_re_db_hdr { __le32 indx; __le32 typ_qid; /* typ: 4, qid:20*/ diff --git a/providers/bnxt_re/main.c b/providers/bnxt_re/main.c index 1779e1ec..ee9edd7d 100644 --- a/providers/bnxt_re/main.c +++ b/providers/bnxt_re/main.c @@ -158,6 +158,10 @@ static struct verbs_context *bnxt_re_alloc_context(struct ibv_device *vdev, BNXT_RE_CHIP_ID0_CHIP_MET_SFT) & 0xFF; } + + if (resp.comp_mask & BNXT_RE_UCNTX_CMASK_HAVE_MODE) + cntx->wqe_mode = resp.mode; + pthread_spin_init(&cntx->fqlock, PTHREAD_PROCESS_PRIVATE); /* mmap shared page. */ cntx->shpg = mmap(NULL, rdev->pg_size, PROT_READ | PROT_WRITE, diff --git a/providers/bnxt_re/main.h b/providers/bnxt_re/main.h index a63719e8..dc8166f2 100644 --- a/providers/bnxt_re/main.h +++ b/providers/bnxt_re/main.h @@ -146,6 +146,7 @@ struct bnxt_re_qp { uint64_t wqe_cnt; uint16_t mtu; uint16_t qpst; + uint32_t qpmode; uint8_t qptyp; /* irdord? */ }; @@ -178,6 +179,7 @@ struct bnxt_re_context { uint32_t max_srq; struct bnxt_re_dpi udpi; void *shpg; + uint32_t wqe_mode; pthread_mutex_t shlock; pthread_spinlock_t fqlock; }; diff --git a/providers/bnxt_re/verbs.c b/providers/bnxt_re/verbs.c index fb2cf5ac..11c01574 100644 --- a/providers/bnxt_re/verbs.c +++ b/providers/bnxt_re/verbs.c @@ -952,6 +952,7 @@ struct ibv_qp *bnxt_re_create_qp(struct ibv_pd *ibvpd, goto fail; /* alloc queues */ qp->cctx = &cntx->cctx; + qp->qpmode = cntx->wqe_mode & BNXT_RE_WQE_MODE_VARIABLE; if (bnxt_re_alloc_queues(qp, attr, dev->pg_size)) goto failq; /* Fill ibv_cmd */