From mboxrd@z Thu Jan 1 00:00:00 1970 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=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 9496BC433DB for ; Mon, 1 Mar 2021 00:38:15 +0000 (UTC) Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by mail.kernel.org (Postfix) with ESMTP id 2CF8764D73 for ; Mon, 1 Mar 2021 00:38:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2CF8764D73 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 32E9B22A27F; Mon, 1 Mar 2021 01:38:10 +0100 (CET) Received: from mail-qv1-f49.google.com (mail-qv1-f49.google.com [209.85.219.49]) by mails.dpdk.org (Postfix) with ESMTP id 50AAA22A27F for ; Mon, 1 Mar 2021 01:38:09 +0100 (CET) Received: by mail-qv1-f49.google.com with SMTP id n4so5071759qvl.4 for ; Sun, 28 Feb 2021 16:38:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=pzBdy/iCjITcqL2TfkQ1t5tHO+TkiajnjhSXf9BAq38=; b=cufipDReNyu7EMoEnPL5LASc0slAOuu1wcTTtfOrX/0NuR9CmpMotFeYr7Wm7KLSRk vPRnBgLV4OelUm9cISBRaofhr34f0Z/FITP9yAPo0HeS5quqXgGv/pA0T07b4uJlPcjD 4KI8VZfsUn4RRToObTSzydvw6qWkd5g1i34RM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pzBdy/iCjITcqL2TfkQ1t5tHO+TkiajnjhSXf9BAq38=; b=ARv2TwyRyVifKSm6UwOYvKxF2NPXq5Yam2dp3ZKJ03PdifsblPjBOJtZg4IqMC/u9W KKOzqaD/InQLP+kYe90KqDpgF6acesTSji1h+Ot8SMlhM7Si5fnFsMYVy1mjNIp468WV 7LpStVbPbsJ1sLOgRHC5YTR9Vs8sKrOzwYg8IswhUh+lbh88a2873hoH8mtQMLJ0bCcg xifL6DzxfS6scKjcJtbKwVUoADquJJYGP6pYe7QtzE9C+IMUjMPo6jm/IH9GBKk9P43t FwUXlTiOedAUFYt6ugoN4HJLN+WYQhR73lsi6t/u9JREZmoYjgjPYw/JtHJhdQ5k5omW PgvQ== X-Gm-Message-State: AOAM532tMJT/RArDMnKYiO74X+0eN+Va3sMNKayLavb/K9V35xsZ9cQS 1jYD4ahDoNANY4UuBVN9IdQ2e/iFZuWZShNkpVevcA== X-Google-Smtp-Source: ABdhPJzULe+sl1ExlYSaKoJTl6MYtQ49R+oQ5FVobiPyd489VQz8um/jSD5LU4drwH4Q75zP5IHlmM9byD1yL19PegU= X-Received: by 2002:a0c:b9a6:: with SMTP id v38mr12016186qvf.35.1614559088665; Sun, 28 Feb 2021 16:38:08 -0800 (PST) MIME-Version: 1.0 References: <20210219092803.12756-1-somnath.kotur@broadcom.com> In-Reply-To: <20210219092803.12756-1-somnath.kotur@broadcom.com> From: Ajit Khaparde Date: Sun, 28 Feb 2021 16:37:52 -0800 Message-ID: To: Somnath Kotur Cc: dpdk-dev , Ferruh Yigit Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="000000000000f7c8cb05bc6ed40b" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [dpdk-dev] [PATCH] net/bnxt: refactor HWRM rings allocation routine X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" --000000000000f7c8cb05bc6ed40b Content-Type: text/plain; charset="UTF-8" On Fri, Feb 19, 2021 at 1:28 AM Somnath Kotur wrote: > > bnxt_alloc_hwrm_rings() was duplicating a snippet of code that was > already present in bnxt_alloc_hwrm_rx_ring() with just one line/function > invocation missing. Add that line and replace the snippet of code > with a call to bnxt_hwrm_alloc_rx_ring > > Signed-off-by: Somnath Kotur Patch applied to dpdk-next-net-brcm. > --- > drivers/net/bnxt/bnxt_ring.c | 59 ++++-------------------------------- > 1 file changed, 6 insertions(+), 53 deletions(-) > > diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c > index ba23c1fa03..997dcdc28b 100644 > --- a/drivers/net/bnxt/bnxt_ring.c > +++ b/drivers/net/bnxt/bnxt_ring.c > @@ -581,6 +581,7 @@ int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index) > struct bnxt_cp_ring_info *cpr = rxq->cp_ring; > struct bnxt_ring *cp_ring = cpr->cp_ring_struct; > struct bnxt_rx_ring_info *rxr = rxq->rx_ring; > + struct bnxt_coal coal; > int rc; > > /* > @@ -603,6 +604,9 @@ int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index) > bp->grp_info[queue_index].cp_fw_ring_id = cp_ring->fw_ring_id; > } > > + bnxt_init_dflt_coal(&coal); > + bnxt_hwrm_set_ring_coal(bp, &coal, cp_ring->fw_ring_id); > + > if (!BNXT_NUM_ASYNC_CPR(bp) && !queue_index) { > /* > * If a dedicated async event completion ring is not enabled, > @@ -699,60 +703,9 @@ int bnxt_alloc_hwrm_rings(struct bnxt *bp) > bnxt_init_all_rings(bp); > > for (i = 0; i < bp->rx_cp_nr_rings; i++) { > - struct bnxt_rx_queue *rxq = bp->rx_queues[i]; > - struct bnxt_cp_ring_info *cpr = rxq->cp_ring; > - struct bnxt_ring *cp_ring = cpr->cp_ring_struct; > - struct bnxt_rx_ring_info *rxr = rxq->rx_ring; > - > - /* > - * Storage for the cp ring is allocated based on worst-case > - * usage, the actual size to be used by hw is computed here. > - */ > - cp_ring->ring_size = rxr->rx_ring_struct->ring_size * 2; > - > - if (bp->eth_dev->data->scattered_rx) > - cp_ring->ring_size *= AGG_RING_SIZE_FACTOR; > - > - cp_ring->ring_mask = cp_ring->ring_size - 1; > - > - if (bnxt_alloc_cmpl_ring(bp, i, cpr)) > - goto err_out; > - > - if (BNXT_HAS_RING_GRPS(bp)) { > - bp->grp_info[i].fw_stats_ctx = cpr->hw_stats_ctx_id; > - bp->grp_info[i].cp_fw_ring_id = cp_ring->fw_ring_id; > - } > - > - bnxt_hwrm_set_ring_coal(bp, &coal, cp_ring->fw_ring_id); > - if (!BNXT_NUM_ASYNC_CPR(bp) && !i) { > - /* > - * If a dedicated async event completion ring is not > - * enabled, use the first completion ring as the default > - * completion ring for async event handling. > - */ > - bp->async_cp_ring = cpr; > - rc = bnxt_hwrm_set_async_event_cr(bp); > - if (rc) > - goto err_out; > - } > - > - if (bnxt_alloc_rx_ring(bp, i)) > - goto err_out; > - > - if (bnxt_alloc_rx_agg_ring(bp, i)) > + rc = bnxt_alloc_hwrm_rx_ring(bp, i); > + if (rc) > goto err_out; > - > - if (bnxt_init_one_rx_ring(rxq)) { > - PMD_DRV_LOG(ERR, "bnxt_init_one_rx_ring failed!\n"); > - bnxt_rx_queue_release_op(rxq); > - return -ENOMEM; > - } > - bnxt_db_write(&rxr->rx_db, rxr->rx_raw_prod); > - bnxt_db_write(&rxr->ag_db, rxr->ag_raw_prod); > - rxq->index = i; > -#if defined(RTE_ARCH_X86) || defined(RTE_ARCH_ARM64) > - bnxt_rxq_vec_setup(rxq); > -#endif > } > > for (i = 0; i < bp->tx_cp_nr_rings; i++) { > -- > 2.28.0.497.g54e85e7 > --000000000000f7c8cb05bc6ed40b--