patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Hernan Vargas <hernan.vargas@intel.com>
To: stable@dpdk.org, ktraynor@redhat.com
Cc: nicolas.chautru@intel.com,
	Hernan Vargas <hernan.vargas@intel.com>,
	Maxime Coquelin <maxime.coquelin@redhat.com>
Subject: [PATCH 21.11 6/7] baseband/acc100: fix ring/queue allocation
Date: Wed, 16 Nov 2022 20:46:51 -0800	[thread overview]
Message-ID: <20221117044652.163000-7-hernan.vargas@intel.com> (raw)
In-Reply-To: <20221117044652.163000-1-hernan.vargas@intel.com>

[ upstream commit e23491fc2e0028535891af85fcbfedc9b23b1149 ]

Allocate info ring, tail pointers and HARQ layout memory
for a device only if it hasn't already been allocated.

Fixes: 06531464151 ("baseband/acc100: support interrupt")

Signed-off-by: Hernan Vargas <hernan.vargas@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 drivers/baseband/acc100/rte_acc100_pmd.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c
index c90d7b8e1a..3030265c16 100644
--- a/drivers/baseband/acc100/rte_acc100_pmd.c
+++ b/drivers/baseband/acc100/rte_acc100_pmd.c
@@ -661,7 +661,8 @@ acc100_setup_queues(struct rte_bbdev *dev, uint16_t num_queues, int socket_id)
 	acc100_reg_write(d, reg_addr->ring_size, value);
 
 	/* Configure tail pointer for use when SDONE enabled */
-	d->tail_ptrs = rte_zmalloc_socket(
+	if (d->tail_ptrs == NULL)
+		d->tail_ptrs = rte_zmalloc_socket(
 			dev->device->driver->name,
 			ACC100_NUM_QGRPS * ACC100_NUM_AQS * sizeof(uint32_t),
 			RTE_CACHE_LINE_SIZE, socket_id);
@@ -669,8 +670,8 @@ acc100_setup_queues(struct rte_bbdev *dev, uint16_t num_queues, int socket_id)
 		rte_bbdev_log(ERR, "Failed to allocate tail ptr for %s:%u",
 				dev->device->driver->name,
 				dev->data->dev_id);
-		rte_free(d->sw_rings);
-		return -ENOMEM;
+		ret = -ENOMEM;
+		goto free_sw_rings;
 	}
 	d->tail_ptr_iova = rte_malloc_virt2iova(d->tail_ptrs);
 
@@ -693,15 +694,16 @@ acc100_setup_queues(struct rte_bbdev *dev, uint16_t num_queues, int socket_id)
 		/* Continue */
 	}
 
-	d->harq_layout = rte_zmalloc_socket("HARQ Layout",
+	if (d->harq_layout == NULL)
+		d->harq_layout = rte_zmalloc_socket("HARQ Layout",
 			ACC100_HARQ_LAYOUT * sizeof(*d->harq_layout),
 			RTE_CACHE_LINE_SIZE, dev->data->socket_id);
 	if (d->harq_layout == NULL) {
 		rte_bbdev_log(ERR, "Failed to allocate harq_layout for %s:%u",
 				dev->device->driver->name,
 				dev->data->dev_id);
-		rte_free(d->sw_rings);
-		return -ENOMEM;
+		ret = -ENOMEM;
+		goto free_tail_ptrs;
 	}
 
 	/* Mark as configured properly */
@@ -712,6 +714,15 @@ acc100_setup_queues(struct rte_bbdev *dev, uint16_t num_queues, int socket_id)
 			PRIx64, dev->data->name, d->sw_rings, d->sw_rings_iova);
 
 	return 0;
+
+free_tail_ptrs:
+	rte_free(d->tail_ptrs);
+	d->tail_ptrs = NULL;
+free_sw_rings:
+	rte_free(d->sw_rings_base);
+	d->sw_rings = NULL;
+
+	return ret;
 }
 
 static int
-- 
2.37.1


  parent reply	other threads:[~2022-11-16 20:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-17  4:46 [PATCH 21.11 0/7] baseband/acc100: backporting patches Hernan Vargas
2022-11-17  4:46 ` [PATCH 21.11 1/7] baseband/acc100: add LDPC encoder padding function Hernan Vargas
2022-11-17  4:46 ` [PATCH 21.11 2/7] baseband/acc100: check AQ availability Hernan Vargas
2022-11-17  4:46 ` [PATCH 21.11 3/7] baseband/acc100: fix ring availability calculation Hernan Vargas
2022-11-17  4:46 ` [PATCH 21.11 4/7] baseband/acc100: enforce additional check on FCW Hernan Vargas
2022-11-17  4:46 ` [PATCH 21.11 5/7] baseband/acc100: fix null HARQ input case Hernan Vargas
2022-11-17  4:46 ` Hernan Vargas [this message]
2022-11-17  4:46 ` [PATCH 21.11 7/7] baseband/acc100: fix double MSI intr in TB mode Hernan Vargas
2022-11-23 18:13 ` [PATCH 21.11 0/7] baseband/acc100: backporting patches Kevin Traynor

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=20221117044652.163000-7-hernan.vargas@intel.com \
    --to=hernan.vargas@intel.com \
    --cc=ktraynor@redhat.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=nicolas.chautru@intel.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).