From patchwork Thu Jun 10 10:49:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Devesh Sharma X-Patchwork-Id: 12312645 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, 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 4107EC47094 for ; Thu, 10 Jun 2021 10:50:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1D977613CB for ; Thu, 10 Jun 2021 10:50:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229941AbhFJKw1 (ORCPT ); Thu, 10 Jun 2021 06:52:27 -0400 Received: from mail-pj1-f50.google.com ([209.85.216.50]:35362 "EHLO mail-pj1-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230001AbhFJKwX (ORCPT ); Thu, 10 Jun 2021 06:52:23 -0400 Received: by mail-pj1-f50.google.com with SMTP id fy24-20020a17090b0218b029016c5a59021fso3527362pjb.0 for ; Thu, 10 Jun 2021 03:50:27 -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=lMQ8sv4TL1wbz/E6lqgzXkL11ehoYXE1UPkQt9tdE/Y=; b=DyTruwq5ECr62xvmYCOJZuPQKUvATuVQfPDxPpzugu5An/3297S5xX8fATXwNNPhVg yeuW3DaoOrvsZ6d1ElWfGyXdhOvgw+e97cYecOv86F0OkZG/AZt5OfXU6gHpsR7wpio0 XxDEfCBVihOfynANTq34CFPrB7hMVff3b794M= 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=lMQ8sv4TL1wbz/E6lqgzXkL11ehoYXE1UPkQt9tdE/Y=; b=Np67DiZcNMlJwqUDNqc1AnmWmNPIb85RDbQdz5tg7geqQma7SZhnQkNLPeAnTx3hsH hmgyvjxNuUomZpL7m7PmekQjGCT9gyhfwac4esXsNX7E/AE7/vQbtZcCf9DlW1AKnw9K JvpMAu4ZYPLF/mhB0yOzp1kDv6WoSPScmo2/8r7PBaB7e0FoXYVdCdJcrrVpUcPJp8Sp 4PEmNqpD9N+i8Z8BeNBeWTW8oGWTYat/r5Z2JSw04mHqDbpsbBONVkTkvgMHV7HSOU4J FiIILRgIYfs1wBOgLkOMb4L3+bJUbMDfCNGYCqR6KBZ3sz58NdDLOEvHGGTtouH7MmP5 Crmg== X-Gm-Message-State: AOAM530dVC53ZiTklZfdle2H7HPzA/gxe2/WH9awlKwSPDhyXVHsZiSI kLx3QYmfLJEOXd4815db9LIIbtsu9f1QhQHS6pJ+QqUNVFyjbOsZ4Z8pX0SW6RFMo5+3f1iqVYs pNSKYd99y25lAeJjMTSKGz2utOV1Rv49oAO55k7Xgo6XzAa+2AB1jGICcRYvkIxDXoqy6eQhj3N VR6oyNjA== X-Google-Smtp-Source: ABdhPJywxHuD6cDKJgAYahFKVcISHdX6CgPF2qMb+ufyJ7laWpBg8osqTWBogPMwMl1oO3LvhP0YSQ== X-Received: by 2002:a17:90b:318:: with SMTP id ay24mr2631663pjb.150.1623322167145; Thu, 10 Jun 2021 03:49:27 -0700 (PDT) Received: from dev01.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r6sm7362564pjm.12.2021.06.10.03.49.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Jun 2021 03:49:26 -0700 (PDT) From: Devesh Sharma To: linux-rdma@vger.kernel.org Cc: Devesh Sharma Subject: [PATCH V4 rdma-core 2/5] bnxt_re/lib: Read wqe mode from the driver Date: Thu, 10 Jun 2021 16:19:07 +0530 Message-Id: <20210610104910.1147756-3-devesh.sharma@broadcom.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210610104910.1147756-1-devesh.sharma@broadcom.com> References: <20210610104910.1147756-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 */