From patchwork Mon May 17 13:35:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Devesh Sharma X-Patchwork-Id: 12261979 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=-19.1 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, URIBL_BLOCKED,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 C650AC43460 for ; Mon, 17 May 2021 13:35:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AB17361059 for ; Mon, 17 May 2021 13:35:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237375AbhEQNhC (ORCPT ); Mon, 17 May 2021 09:37:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229624AbhEQNhB (ORCPT ); Mon, 17 May 2021 09:37:01 -0400 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 646EEC061573 for ; Mon, 17 May 2021 06:35:45 -0700 (PDT) Received: by mail-pf1-x433.google.com with SMTP id q2so4926305pfh.13 for ; Mon, 17 May 2021 06:35:45 -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=yoEZnSL7onC6LOX2IBkeKuGuzdMQip9XAvavJHHOJnQ=; b=CMkiukyRJHIYC6lPn9EEiGkI/oreSi8Q5/RicXApx+5aiOhsanUY1E9hEoAbpTHihS CGzEaQP97qmq5+B2Us2vfNDBw0JJ0x1iv913NZvstTdX+8J/NqlRYWs3/TUGFsiti5AR JVUbTFbbExNqjdaias/G3xB8ufw/nrr2j86ik= 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=yoEZnSL7onC6LOX2IBkeKuGuzdMQip9XAvavJHHOJnQ=; b=o7R+CyyjbAUOPyt0V+z0zX3rOD6CJ71dwSOkszoe9eYFtKDxUkzDrKFfpx5GHHmucC 5ee4A/eUrI8IIuKIakjj7Nd18UeMrvi2WFqYksMMK7fUJvkteTwNwOWPdIm7+oCWAilL sZw3Ke4J1+Vki7fJ/mro2tWzJ6l6DmMH5nkRAzdy9Rn6giOWBGkjVfJRQ80nLJStwqq9 QhqvGEGy+IY9HyWgGfcLU63/+voy+d3J4jew1V/p8/C4MbCHm1gla4ICtN3PI1pcIta2 yrYJL7ninjtSUILpdx6gfwdPiJY2714E30DgiyJYprCa9s2C1IThrPW39qOGthlIr4/8 4yRg== X-Gm-Message-State: AOAM530DIsj8dUw79KunNITpPkJskULL9jw2GHPrHwYNhfTROSwvC+C0 ZNQGIQdLQmHUgs0FFjlvGTrHvFsdZSYZD6PG//aiv+4EvG5j0k9UifDvq9N/kX3aQkm41WCalPU GXEdHwBlHLpqCFw0Rr4HPBfYcLe/rVsvkWkMwDYojzNcxi8GCpPxbWbJkZXXLqOCXJgmTTZuZpE Y3Xm4Ne5ye X-Google-Smtp-Source: ABdhPJzKt4KVxajsTgJ46vdX9oqsuyJmsjyh9+coA5+VAo2ZN37ELv3Zu5FadslDq2wFEyC0LwRbcw== X-Received: by 2002:a05:6a00:2163:b029:216:deaa:e386 with SMTP id r3-20020a056a002163b0290216deaae386mr59981770pff.72.1621258544212; Mon, 17 May 2021 06:35:44 -0700 (PDT) Received: from dev01.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id b6sm10953618pjk.13.2021.05.17.06.35.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 May 2021 06:35:43 -0700 (PDT) From: Devesh Sharma To: linux-rdma@vger.kernel.org Cc: Devesh Sharma Subject: [PATCH V2 INTERNAL 1/4] bnxt_re/lib: Read wqe mode from the driver Date: Mon, 17 May 2021 19:05:29 +0530 Message-Id: <20210517133532.774998-2-devesh.sharma@broadcom.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210517133532.774998-1-devesh.sharma@broadcom.com> References: <20210517133532.774998-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 --- kernel-headers/rdma/bnxt_re-abi.h | 5 ++++- 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 + 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/kernel-headers/rdma/bnxt_re-abi.h b/kernel-headers/rdma/bnxt_re-abi.h index dc52e3cf..0234763e 100644 --- a/kernel-headers/rdma/bnxt_re-abi.h +++ b/kernel-headers/rdma/bnxt_re-abi.h @@ -49,7 +49,8 @@ #define BNXT_RE_CHIP_ID0_CHIP_MET_SFT 0x18 enum { - BNXT_RE_UCNTX_CMASK_HAVE_CCTX = 0x1ULL + BNXT_RE_UCNTX_CMASK_HAVE_CCTX = 0x1ULL, + BNXT_RE_UCNTX_CMASK_HAVE_MODE = 0x02ULL }; struct bnxt_re_uctx_resp { @@ -62,6 +63,8 @@ struct bnxt_re_uctx_resp { __aligned_u64 comp_mask; __u32 chip_id0; __u32 chip_id1; + __u32 wqe_mode; + __u32 rsvd1; }; /* 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..428affc7 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.wqe_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 */