From patchwork Fri May 28 09:39:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Devesh Sharma X-Patchwork-Id: 12286557 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, 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 7E759C4708E for ; Fri, 28 May 2021 09:40:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6212461059 for ; Fri, 28 May 2021 09:40:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235437AbhE1Jlk (ORCPT ); Fri, 28 May 2021 05:41:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234497AbhE1Jlg (ORCPT ); Fri, 28 May 2021 05:41:36 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66597C061574 for ; Fri, 28 May 2021 02:40:02 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id z4so1357015plg.8 for ; Fri, 28 May 2021 02:40:02 -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=5AahqhNbCkh1whBZgLpBGKPjMIgbUf11ZZ3n1AruYtc=; b=SzKljFn0+1d/dtdL3LsGgHTqnfiPj2MJB1kxKRQzZjKa1zVp8A/tUsSlDjKgn2kYxD 4h4r+hPQvT4gARwdd7MIoQy5zlolhlWKCAmZlABllDw5Bf77h05pjye5lrXHtX0hddNr 2fvUa+V1IaSV2v2vmJiQqEiGb26yzsncM11+w= 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=5AahqhNbCkh1whBZgLpBGKPjMIgbUf11ZZ3n1AruYtc=; b=BkF9iA5I92bfzhEB4AyDjOz70991jw13Jn2LGI6zeo7Pypo0A9jfJHYbBkZuU86Bxy xX74LfdC6FZGdOYfzZlNKsWWvXMwhaGW9hgQzV9Qxi4WIG/dvVoJSaCz+ei9VkIvtnKv jkHh5/SoBKWrsWCVRi08hnSo6Mqg8ahMbZs+1lgjueEfZmZ0pm/aRNJ3VhvYfSkguXiV tReSi+YI0gtHOWFzD7XsryVT9uAvdV5ODSnZUyN1NdNFzWhbat4VDhn5YMr6CyJcyZUO RMkauDmutOXTAR732Pok4m0x3XZXWNiw631D1LZWDL4wIwP0QDhWEN0DDQn7RfWK/LyX 9D7w== X-Gm-Message-State: AOAM532E6ep4T4Fib+53WzZPld2vkeRjcezLld401UMsdJFYt9FHyn8U 8NhM3PCdNdmeRPWsH9kj25V4oJcga5rUkhRWcvpOAsT6fdLly5ELdsbrRAu7M/rQH9TpjcmN0l1 R7STxd+dgWE6wqvWSUhUtDaFEcI/Pmyu4zSA/vKGN0mOR5GUdHXkMe79xbAhQTRuT3Il1Q2/hqZ fdpolNDSjE X-Google-Smtp-Source: ABdhPJzJOcldh1Es7dk1P8AIWtWljRv/3O0v5C5EXcJlgZxWn2mwXGWwqRFFcPyVvq6xpaSJrnwSTA== X-Received: by 2002:a17:90a:448c:: with SMTP id t12mr3495273pjg.142.1622194801354; Fri, 28 May 2021 02:40:01 -0700 (PDT) Received: from dev01.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id s140sm3913216pfs.73.2021.05.28.02.40.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 May 2021 02:40:01 -0700 (PDT) From: Devesh Sharma To: linux-rdma@vger.kernel.org Cc: Devesh Sharma Subject: [PATCH V3 rdma-core 2/5] bnxt_re/lib: Read wqe mode from the driver Date: Fri, 28 May 2021 15:09:43 +0530 Message-Id: <20210528093946.900940-3-devesh.sharma@broadcom.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210528093946.900940-1-devesh.sharma@broadcom.com> References: <20210528093946.900940-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 */