From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by dpdk.org (Postfix) with ESMTP id 0B1ED1DB9 for ; Mon, 30 Apr 2018 16:54:24 +0200 (CEST) Received: by mail-wm0-f66.google.com with SMTP id a67so6076142wmf.3 for ; Mon, 30 Apr 2018 07:54:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xlGO4K6uANNBUPzs/dQ0fGMx/fLKLOmm9XFKZGmwtNc=; b=do/dNGD5LsnHYc7J1n5nWaouALH5VjVxHe+faZ8eNdzfLEf0S44KUj4k7OoJLSmaTL 5aMLwI/yLbJdRGWXs+11qdW+enyQ25yV83dfq8pN8Ev4TMbd0JTDWI4ZYOXFdRZKBYXd YYy2AOhST0vgrV1Bwh6DA9bPSZPeBJIUlhu5PAptbXzxIRG7LEa6OQIxGs8UJBVJh0eF ssFRClHq0hI/5mQQGPs1Ik2xI5uS1Ss1ApUAFbbRrucgoKMT43vOqajjjMYRyrJiayuP wvG2fYY96+nkugAPubT62+eYOb/9ha+p6AiYBZVFwzj+oebWhompVc2475oPbS1Zp1kN MntQ== 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; bh=xlGO4K6uANNBUPzs/dQ0fGMx/fLKLOmm9XFKZGmwtNc=; b=ovVBlDLWbQD7jQucbgn1JYSEUIfmVkvu+yIZSZXBocqbyt3mAe+GfwxbWmlpgTcY/q K50SDV17Pnh1Xo828TawD3t5HHeQ33JGkxwXFyBTJGFCc/GAR6mZqqY1k023eaoQLOxS ykXK7UlPiJ5uuR8FWGBtQ7h7uSR6/khK2vXiDAzBjGOEV6A0vCG2lojLQK3r+FDcwR+o Si/XAAISIEwzQPJCJl9/idd8uga9TZdaq7Ojn6L+icCsxp0kj1mm8tMc6e/1oIl9S29L sJZK+V1kfYZL8ZgaGHWa6IolPCCTmIeV20G8BuIryeG1cma6hfKJTO3ogrge1/xIVQmv oC5Q== X-Gm-Message-State: ALQs6tCjhRXzwGUh+6clKWMgz2xYZZOTSrvVf7JmD6LqquQj55W9b92z Uk83nLywwiIm6Icp7Bqost7BNzFTudU= X-Google-Smtp-Source: AB8JxZpyUIQTSwenjjenWEYrCLySIMM1U416qYDgLHhlx7ng0HjUrKybpRG84DEwA74p46+8ETfJ0Q== X-Received: by 10.28.3.85 with SMTP id 82mr3160916wmd.96.1525100063413; Mon, 30 Apr 2018 07:54:23 -0700 (PDT) Received: from localhost ([2a00:23c5:be9a:5200:ce4c:82c0:d567:ecbb]) by smtp.gmail.com with ESMTPSA id 140sm8150974wmi.9.2018.04.30.07.54.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Apr 2018 07:54:22 -0700 (PDT) From: luca.boccassi@gmail.com To: Ajit Khaparde Cc: dpdk stable Date: Mon, 30 Apr 2018 15:53:31 +0100 Message-Id: <20180430145402.23057-12-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180430145402.23057-1-luca.boccassi@gmail.com> References: <20180430144223.18657-85-luca.boccassi@gmail.com> <20180430145402.23057-1-luca.boccassi@gmail.com> Subject: [dpdk-stable] patch 'net/bnxt: avoid freeing memzone multiple times' has been queued to stable release 18.02.2 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Apr 2018 14:54:24 -0000 Hi, FYI, your patch has been queued to stable release 18.02.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/02/18. So please shout if anyone has objections. Thanks. Luca Boccassi --- >>From c3db11efce9ee68ff7c549ef3c249d44af337f67 Mon Sep 17 00:00:00 2001 From: Ajit Khaparde Date: Mon, 16 Apr 2018 18:11:25 -0700 Subject: [PATCH] net/bnxt: avoid freeing memzone multiple times [ upstream commit 23460b4c6a7ab68e2b6d217460684a554f7e78eb ] Since we are storing the mem_zone address for each ring created, we are freeing the same address multiple times. For example the memory zone created for Rx is being freed during Rx ring cleanup, AGG ring cleanup and CQ cleanup. Avoid this by storing the memory zone address in RXQ instead and free it as a part of queue_release dev_op. In the same way do the same for TX queues as well. Fixes: 51c87ebafc7d ("net/bnxt: add Tx queue create/destroy") Signed-off-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_ring.c | 10 +++++++--- drivers/net/bnxt/bnxt_ring.h | 4 ++-- drivers/net/bnxt/bnxt_rxq.c | 4 +++- drivers/net/bnxt/bnxt_rxq.h | 1 + drivers/net/bnxt/bnxt_txq.c | 4 +++- drivers/net/bnxt/bnxt_txq.h | 1 + 6 files changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c index 8fb897216..75c0830fe 100644 --- a/drivers/net/bnxt/bnxt_ring.c +++ b/drivers/net/bnxt/bnxt_ring.c @@ -56,7 +56,7 @@ void bnxt_free_ring(struct bnxt_ring *ring) memset((char *)*ring->vmem, 0, ring->vmem_size); *ring->vmem = NULL; } - rte_memzone_free((const struct rte_memzone *)ring->mem_zone); + ring->mem_zone = NULL; } /* @@ -89,12 +89,14 @@ int bnxt_init_ring_grps(struct bnxt *bp) * rx bd ring - Only non-zero length if rx_ring_info is not NULL */ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx, - struct bnxt_tx_ring_info *tx_ring_info, - struct bnxt_rx_ring_info *rx_ring_info, + struct bnxt_tx_queue *txq, + struct bnxt_rx_queue *rxq, struct bnxt_cp_ring_info *cp_ring_info, const char *suffix) { struct bnxt_ring *cp_ring = cp_ring_info->cp_ring_struct; + struct bnxt_rx_ring_info *rx_ring_info = rxq ? rxq->rx_ring : NULL; + struct bnxt_tx_ring_info *tx_ring_info = txq ? txq->tx_ring : NULL; struct bnxt_ring *tx_ring; struct bnxt_ring *rx_ring; struct rte_pci_device *pdev = bp->pdev; @@ -191,6 +193,7 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx, } if (tx_ring_info) { + txq->mz = mz; tx_ring = tx_ring_info->tx_ring_struct; tx_ring->bd = ((char *)mz->addr + tx_ring_start); @@ -210,6 +213,7 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx, } if (rx_ring_info) { + rxq->mz = mz; rx_ring = rx_ring_info->rx_ring_struct; rx_ring->bd = ((char *)mz->addr + rx_ring_start); diff --git a/drivers/net/bnxt/bnxt_ring.h b/drivers/net/bnxt/bnxt_ring.h index ebf7228e4..f4d9f095c 100644 --- a/drivers/net/bnxt/bnxt_ring.h +++ b/drivers/net/bnxt/bnxt_ring.h @@ -93,8 +93,8 @@ struct bnxt_cp_ring_info; void bnxt_free_ring(struct bnxt_ring *ring); int bnxt_init_ring_grps(struct bnxt *bp); int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx, - struct bnxt_tx_ring_info *tx_ring_info, - struct bnxt_rx_ring_info *rx_ring_info, + struct bnxt_tx_queue *txq, + struct bnxt_rx_queue *rxq, struct bnxt_cp_ring_info *cp_ring_info, const char *suffix); int bnxt_alloc_hwrm_rings(struct bnxt *bp); diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c index d49f35462..33cca9263 100644 --- a/drivers/net/bnxt/bnxt_rxq.c +++ b/drivers/net/bnxt/bnxt_rxq.c @@ -295,6 +295,8 @@ void bnxt_rx_queue_release_op(void *rx_queue) bnxt_free_ring(rxq->cp_ring->cp_ring_struct); bnxt_free_rxq_stats(rxq); + rte_memzone_free(rxq->mz); + rxq->mz = NULL; rte_free(rxq); } @@ -355,7 +357,7 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev, eth_dev->data->rx_queues[queue_idx] = rxq; /* Allocate RX ring hardware descriptors */ - if (bnxt_alloc_rings(bp, queue_idx, NULL, rxq->rx_ring, rxq->cp_ring, + if (bnxt_alloc_rings(bp, queue_idx, NULL, rxq, rxq->cp_ring, "rxr")) { PMD_DRV_LOG(ERR, "ring_dma_zone_reserve for rx_ring failed!\n"); diff --git a/drivers/net/bnxt/bnxt_rxq.h b/drivers/net/bnxt/bnxt_rxq.h index c7acaa755..514428128 100644 --- a/drivers/net/bnxt/bnxt_rxq.h +++ b/drivers/net/bnxt/bnxt_rxq.h @@ -60,6 +60,7 @@ struct bnxt_rx_queue { uint32_t rx_buf_use_size; /* useable size */ struct bnxt_rx_ring_info *rx_ring; struct bnxt_cp_ring_info *cp_ring; + const struct rte_memzone *mz; }; void bnxt_free_rxq_stats(struct bnxt_rx_queue *rxq); diff --git a/drivers/net/bnxt/bnxt_txq.c b/drivers/net/bnxt/bnxt_txq.c index 53524346d..ec4f5f6f5 100644 --- a/drivers/net/bnxt/bnxt_txq.c +++ b/drivers/net/bnxt/bnxt_txq.c @@ -93,6 +93,8 @@ void bnxt_tx_queue_release_op(void *tx_queue) bnxt_free_ring(txq->cp_ring->cp_ring_struct); bnxt_free_txq_stats(txq); + rte_memzone_free(txq->mz); + txq->mz = NULL; rte_free(txq); } @@ -147,7 +149,7 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev, txq->port_id = eth_dev->data->port_id; /* Allocate TX ring hardware descriptors */ - if (bnxt_alloc_rings(bp, queue_idx, txq->tx_ring, NULL, txq->cp_ring, + if (bnxt_alloc_rings(bp, queue_idx, txq, NULL, txq->cp_ring, "txr")) { PMD_DRV_LOG(ERR, "ring_dma_zone_reserve for tx_ring failed!"); bnxt_tx_queue_release_op(txq); diff --git a/drivers/net/bnxt/bnxt_txq.h b/drivers/net/bnxt/bnxt_txq.h index e27c34fa9..a013a84bd 100644 --- a/drivers/net/bnxt/bnxt_txq.h +++ b/drivers/net/bnxt/bnxt_txq.h @@ -61,6 +61,7 @@ struct bnxt_tx_queue { unsigned int cp_nr_rings; struct bnxt_cp_ring_info *cp_ring; + const struct rte_memzone *mz; }; void bnxt_free_txq_stats(struct bnxt_tx_queue *txq); -- 2.14.2