From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2C151A00BE; Wed, 6 May 2020 08:11:29 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D13A41D6E4; Wed, 6 May 2020 08:11:14 +0200 (CEST) Received: from relay.smtp.broadcom.com (relay.smtp.broadcom.com [192.19.232.149]) by dpdk.org (Postfix) with ESMTP id 0791E1D6A8 for ; Wed, 6 May 2020 08:11:12 +0200 (CEST) Received: from dhcp-10-123-153-22.dhcp.broadcom.net (bgccx-dev-host-lnx2.bec.broadcom.net [10.123.153.22]) by relay.smtp.broadcom.com (Postfix) with ESMTP id 180E71BEFAF; Tue, 5 May 2020 23:11:10 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 relay.smtp.broadcom.com 180E71BEFAF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1588745472; bh=pDRUITbe9qQq22mpzVgtjxV9Q1AG6ErlkXfMWXXQhyA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=slgwWe7SgJxk06JgZaRnV17d/kff4wjIQX4Iz67V6pkhQWStwLvU48usSgHJvDmIr dtXIQ6/2Gk6C6Y7mSYT5Ml5cBGc1U4+0cxCOgyJWXS35kcFXXhsaN6m6yCqPcOBUSu xmo0qXumyHbPHuk0VxALS4Z5s1L5JQvrPW03DrE8= From: Kalesh A P To: dev@dpdk.org Cc: ferruh.yigit@intel.com, ajit.khaparde@broadcom.com Date: Wed, 6 May 2020 11:57:10 +0530 Message-Id: <20200506062710.22093-3-kalesh-anakkur.purayil@broadcom.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20200506062710.22093-1-kalesh-anakkur.purayil@broadcom.com> References: <20200506062710.22093-1-kalesh-anakkur.purayil@broadcom.com> Subject: [dpdk-dev] [PATCH 2/2] net/bnxt: fix TQM ring context memory sizing formulas X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Kalesh AP The current formulas to calculate the TQM slow path and fast path ring context memory sizes are not quite correct. TQM slow path entry is array index 0 of ctx->tqm_mem[]. The other array entries are for fast path. Fix these sizes according to firmware spec. for 57500 and newer chips. Fixes: cc5e26b8ef98 ("net/bnxt: increase TQM entry allocation") Cc: stable@dpdk.org Signed-off-by: Kalesh AP Reviewed-by: Somnath Kotur Reviewed-by: Ajit Kumar Khaparde --- drivers/net/bnxt/bnxt_ethdev.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index d877ff6..dab291c 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -4672,6 +4672,7 @@ int bnxt_alloc_ctx_mem(struct bnxt *bp) struct bnxt_ctx_pg_info *ctx_pg; struct bnxt_ctx_mem_info *ctx; uint32_t mem_size, ena, entries; + uint32_t entries_sp, min; int i, rc; rc = bnxt_hwrm_func_backing_store_qcaps(bp); @@ -4719,15 +4720,20 @@ int bnxt_alloc_ctx_mem(struct bnxt *bp) if (rc) return rc; - entries = ctx->qp_max_l2_entries + - ctx->vnic_max_vnic_entries + - ctx->tqm_min_entries_per_ring; + min = ctx->tqm_min_entries_per_ring; + + entries_sp = ctx->qp_max_l2_entries + + ctx->vnic_max_vnic_entries + + 2 * ctx->qp_min_qp1_entries + min; + entries_sp = bnxt_roundup(entries_sp, ctx->tqm_entries_multiple); + + entries = ctx->qp_max_l2_entries + ctx->qp_min_qp1_entries; entries = bnxt_roundup(entries, ctx->tqm_entries_multiple); - entries = clamp_t(uint32_t, entries, ctx->tqm_min_entries_per_ring, + entries = clamp_t(uint32_t, entries, min, ctx->tqm_max_entries_per_ring); for (i = 0, ena = 0; i < ctx->tqm_fp_rings_count + 1; i++) { ctx_pg = ctx->tqm_mem[i]; - ctx_pg->entries = entries; + ctx_pg->entries = i ? entries : entries_sp; mem_size = ctx->tqm_entry_size * ctx_pg->entries; rc = bnxt_alloc_ctx_mem_blk(bp, ctx_pg, mem_size, "tqm_mem", i); if (rc) -- 2.10.1