From: Kevin Traynor <ktraynor@redhat.com>
To: Rasesh Mody <rasesh.mody@cavium.com>, dev@dpdk.org
Cc: ferruh.yigit@intel.com, Dept-EngDPDKDev@cavium.com, stable@dpdk.org
Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] net/qede: fix memory alloc for multiple port reconfig
Date: Fri, 8 Jun 2018 12:56:12 +0100 [thread overview]
Message-ID: <0c97c7b1-45d8-6eba-76f7-660c26fcbc7f@redhat.com> (raw)
In-Reply-To: <1528389020-4803-1-git-send-email-rasesh.mody@cavium.com>
On 06/07/2018 05:30 PM, Rasesh Mody wrote:
> Multiple port reconfigurations can lead to memory allocation failures
> due to hitting RTE memzone limit or no more room in config while
> reserving memzone.
>
> When freeing memzones, update the memzone mapping and the memzone count.
> Release Rx and Tx queue rings allocated during queue setup.
>
> Fixes: a39001d90dbd ("net/qede: fix DMA memory leak")
> Cc: stable@dpdk.org
>
> Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
Reviewed-by: Kevin Traynor <ktraynor@redhat.com>
> ---
> drivers/net/qede/base/bcm_osal.c | 5 +++++
> drivers/net/qede/qede_rxtx.c | 21 +++++++++++----------
> 2 files changed, 16 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/qede/base/bcm_osal.c b/drivers/net/qede/base/bcm_osal.c
> index ca1c2b1..72627df 100644
> --- a/drivers/net/qede/base/bcm_osal.c
> +++ b/drivers/net/qede/base/bcm_osal.c
> @@ -201,6 +201,11 @@ void osal_dma_free_mem(struct ecore_dev *p_dev, dma_addr_t phys)
> DP_VERBOSE(p_dev, ECORE_MSG_SP,
> "Free memzone %s\n", ecore_mz_mapping[j]->name);
> rte_memzone_free(ecore_mz_mapping[j]);
> + while (j < ecore_mz_count - 1) {
> + ecore_mz_mapping[j] = ecore_mz_mapping[j + 1];
> + j++;
> + }
> + ecore_mz_count--;
> return;
> }
> }
> diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c
> index bdb5d6f..4fa1c61 100644
> --- a/drivers/net/qede/qede_rxtx.c
> +++ b/drivers/net/qede/qede_rxtx.c
> @@ -192,9 +192,15 @@ static void qede_rx_queue_release_mbufs(struct qede_rx_queue *rxq)
> void qede_rx_queue_release(void *rx_queue)
> {
> struct qede_rx_queue *rxq = rx_queue;
> + struct qede_dev *qdev = rxq->qdev;
> + struct ecore_dev *edev = QEDE_INIT_EDEV(qdev);
> +
> + PMD_INIT_FUNC_TRACE(edev);
>
> if (rxq) {
> qede_rx_queue_release_mbufs(rxq);
> + qdev->ops->common->chain_free(edev, &rxq->rx_bd_ring);
> + qdev->ops->common->chain_free(edev, &rxq->rx_comp_ring);
> rte_free(rxq->sw_rx_ring);
> rte_free(rxq);
> }
> @@ -350,9 +356,14 @@ static void qede_tx_queue_release_mbufs(struct qede_tx_queue *txq)
> void qede_tx_queue_release(void *tx_queue)
> {
> struct qede_tx_queue *txq = tx_queue;
> + struct qede_dev *qdev = txq->qdev;
> + struct ecore_dev *edev = QEDE_INIT_EDEV(qdev);
> +
> + PMD_INIT_FUNC_TRACE(edev);
>
> if (txq) {
> qede_tx_queue_release_mbufs(txq);
> + qdev->ops->common->chain_free(edev, &txq->tx_pbl);
> rte_free(txq->sw_tx_ring);
> rte_free(txq);
> }
> @@ -441,8 +452,6 @@ void qede_dealloc_fp_resc(struct rte_eth_dev *eth_dev)
> struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev);
> struct ecore_dev *edev = QEDE_INIT_EDEV(qdev);
> struct qede_fastpath *fp;
> - struct qede_rx_queue *rxq;
> - struct qede_tx_queue *txq;
> uint16_t sb_idx;
> uint8_t i;
>
> @@ -467,21 +476,13 @@ void qede_dealloc_fp_resc(struct rte_eth_dev *eth_dev)
> for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
> if (eth_dev->data->rx_queues[i]) {
> qede_rx_queue_release(eth_dev->data->rx_queues[i]);
> - rxq = eth_dev->data->rx_queues[i];
> - qdev->ops->common->chain_free(edev,
> - &rxq->rx_bd_ring);
> - qdev->ops->common->chain_free(edev,
> - &rxq->rx_comp_ring);
> eth_dev->data->rx_queues[i] = NULL;
> }
> }
>
> for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
> if (eth_dev->data->tx_queues[i]) {
> - txq = eth_dev->data->tx_queues[i];
> qede_tx_queue_release(eth_dev->data->tx_queues[i]);
> - qdev->ops->common->chain_free(edev,
> - &txq->tx_pbl);
> eth_dev->data->tx_queues[i] = NULL;
> }
> }
>
next prev parent reply other threads:[~2018-06-08 11:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-07 16:30 [dpdk-stable] " Rasesh Mody
2018-06-08 11:56 ` Kevin Traynor [this message]
2018-06-08 18:05 ` [dpdk-stable] [dpdk-dev] " Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0c97c7b1-45d8-6eba-76f7-660c26fcbc7f@redhat.com \
--to=ktraynor@redhat.com \
--cc=Dept-EngDPDKDev@cavium.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=rasesh.mody@cavium.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).