From patchwork Tue Sep 22 07:06:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Somnath Kotur X-Patchwork-Id: 78233 X-Patchwork-Delegate: ajit.khaparde@broadcom.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1AEA6A04E1; Tue, 22 Sep 2020 09:13:41 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D198D1D6D4; Tue, 22 Sep 2020 09:13:26 +0200 (CEST) Received: from relay.smtp-ext.broadcom.com (unknown [192.19.221.30]) by dpdk.org (Postfix) with ESMTP id 7D23F1D60C for ; Tue, 22 Sep 2020 09:13:20 +0200 (CEST) Received: from dhcp-10-123-153-55.dhcp.broadcom.net (dhcp-10-123-153-55.dhcp.broadcom.net [10.123.153.55]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by relay.smtp-ext.broadcom.com (Postfix) with ESMTPS id 9CAC042A17; Tue, 22 Sep 2020 00:13:18 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com 9CAC042A17 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1600758798; bh=/bUc6vDKexQDfKTXEjAdYkTbIC0xvmKAuUR0TsjaNvk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QSlN/fLA3usehWmZluXgEnFu5ovDMPYfQ8O6GgOPf0IJi2H2WjiZuNL7qyVpoCMVD 26MfArDGtjQVP/u4u9ga421RVEcYSZioKu2g+6K5t1EqfFetvHYPgz99kiQWWqzqxR cUfqq/fPtOhnZO40dKPEp2L9fxXdH2bOO3FLUX3U= From: Somnath Kotur To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Somnath Kotur , Venkat Duvvuru Date: Tue, 22 Sep 2020 12:36:26 +0530 Message-Id: <20200922070632.17706-3-somnath.kotur@broadcom.com> X-Mailer: git-send-email 2.28.0.450.g3a238e5 In-Reply-To: <20200922070632.17706-1-somnath.kotur@broadcom.com> References: <20200922070632.17706-1-somnath.kotur@broadcom.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 2/8] net/bnxt: simplify representor Rx ring creation 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" rx_queue_setup_op for representor was using a common function to initialize the software data structures for the Rx ring. But that routine has code to init other rings not needed for representors like cp/agg ring etc. Define and invoke a new function to setup structures just for the representor Rx ring Signed-off-by: Somnath Kotur Reviewed-by: Venkat Duvvuru --- drivers/net/bnxt/bnxt_reps.c | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c index 17010f1..d4d0a9e 100644 --- a/drivers/net/bnxt/bnxt_reps.c +++ b/drivers/net/bnxt/bnxt_reps.c @@ -522,6 +522,31 @@ int bnxt_vf_rep_dev_configure_op(__rte_unused struct rte_eth_dev *eth_dev) return 0; } +static int bnxt_init_rep_rx_ring(struct bnxt_rx_queue *rxq, + unsigned int socket_id) +{ + struct bnxt_rx_ring_info *rxr; + struct bnxt_ring *ring; + + rxr = rte_zmalloc_socket("bnxt_rep_rx_ring", + sizeof(struct bnxt_rx_ring_info), + RTE_CACHE_LINE_SIZE, socket_id); + if (rxr == NULL) + return -ENOMEM; + rxq->rx_ring = rxr; + + ring = rte_zmalloc_socket("bnxt_rep_rx_ring_struct", + sizeof(struct bnxt_ring), + RTE_CACHE_LINE_SIZE, socket_id); + if (ring == NULL) + return -ENOMEM; + rxr->rx_ring_struct = ring; + ring->ring_size = rte_align32pow2(rxq->nb_rx_desc); + ring->ring_mask = ring->ring_size - 1; + + return 0; +} + int bnxt_vf_rep_rx_queue_setup_op(struct rte_eth_dev *eth_dev, uint16_t queue_idx, uint16_t nb_desc, @@ -580,7 +605,7 @@ int bnxt_vf_rep_rx_queue_setup_op(struct rte_eth_dev *eth_dev, rxq->nb_rx_desc = nb_desc; - rc = bnxt_init_rx_ring_struct(rxq, socket_id); + rc = bnxt_init_rep_rx_ring(rxq, socket_id); if (rc) goto out; @@ -603,7 +628,7 @@ int bnxt_vf_rep_rx_queue_setup_op(struct rte_eth_dev *eth_dev, out: if (rxq) - bnxt_rx_queue_release_op(rxq); + bnxt_vf_rep_rx_queue_release_op(rxq); return rc; } @@ -618,8 +643,8 @@ void bnxt_vf_rep_rx_queue_release_op(void *rx_queue) bnxt_rx_queue_release_mbufs(rxq); bnxt_free_ring(rxq->rx_ring->rx_ring_struct); - bnxt_free_ring(rxq->rx_ring->ag_ring_struct); - bnxt_free_ring(rxq->cp_ring->cp_ring_struct); + rte_free(rxq->rx_ring->rx_ring_struct); + rte_free(rxq->rx_ring); rte_free(rxq); }