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 A920CA04FD; Tue, 14 Jan 2020 06:18:05 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CCAB41D156; Tue, 14 Jan 2020 06:16:50 +0100 (CET) Received: from rnd-relay.smtp.broadcom.com (rnd-relay.smtp.broadcom.com [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id 8870B1C2AD for ; Tue, 14 Jan 2020 06:16:34 +0100 (CET) Received: from mail-irv-17.broadcom.com (mail-irv-17.lvn.broadcom.net [10.75.242.48]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 3F4E830C56A; Mon, 13 Jan 2020 21:10:23 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 3F4E830C56A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1578978623; bh=1E2hbH33/DpZGP1H+/QJjVtqnKB1mddKlVb5mRhbKQk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T1jhe4e0gjJHkMJ367ApgkVUDHTSKgEj3FCrJrPHerlCSxIsc4IROVBwHy4BOiejS emBLmcr1VlD87evbw/WRnB0iZq6mIrzfKO3/ezFySWUEalQKEICl32Vu1XDFIdNilp r5wNTLO35LiL/Rg8657hRro6E6qJhOBszVtWvhtw= Received: from localhost.localdomain (unknown [10.230.30.124]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id 6290014008B; Mon, 13 Jan 2020 21:16:33 -0800 (PST) From: Ajit Khaparde To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Somnath Kotur , Kalesh Anakkur Purayil Date: Mon, 13 Jan 2020 21:14:35 -0800 Message-Id: <20200114051435.46093-11-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122.2) In-Reply-To: <20200114051435.46093-1-ajit.khaparde@broadcom.com> References: <20200113050118.28719-1-kalesh-anakkur.purayil@broadcom.com> <20200114051435.46093-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 10/10] net/bnxt: fix calculation of max rings 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: Somnath Kotur Max Tx rings count could be lesser than max Rx rings in some cases, so take this into account as well. Account for stat contexts available(one for each ring) along with no: of completion rings(one for each ring) to cap the max no: of Tx /Rx rings that can be possibly created. Fixes: f03e66cb ("net/bnxt: limit queue count for NS3/Stingray devices") Signed-off-by: Somnath Kotur Reviewed-by: Kalesh Anakkur Purayil Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/bnxt.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index 3487b917e..ddb26814c 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -622,12 +622,19 @@ struct bnxt { uint16_t max_tx_rings; uint16_t max_rx_rings; #define MAX_STINGRAY_RINGS 128U -#define BNXT_MAX_RINGS(bp) \ +/* For sake of symmetry, max Tx rings == max Rx rings, one stat ctx for each */ +#define BNXT_MAX_RX_RINGS(bp) \ (BNXT_STINGRAY(bp) ? RTE_MIN(RTE_MIN(bp->max_rx_rings, \ MAX_STINGRAY_RINGS), \ - bp->max_stat_ctx) : \ - RTE_MIN(bp->max_rx_rings, bp->max_stat_ctx)) + bp->max_stat_ctx / 2U) : \ + RTE_MIN(bp->max_rx_rings, \ + bp->max_stat_ctx / 2U)) +#define BNXT_MAX_TX_RINGS(bp) \ + (RTE_MIN((bp)->max_tx_rings, BNXT_MAX_RX_RINGS(bp))) +#define BNXT_MAX_RINGS(bp) \ + (RTE_MIN((((bp)->max_cp_rings - BNXT_NUM_ASYNC_CPR(bp)) / 2U), \ + BNXT_MAX_TX_RINGS(bp))) uint16_t max_nq_rings; uint16_t max_l2_ctx; uint16_t max_rx_em_flows; -- 2.21.0 (Apple Git-122.2)