DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] ethdev: fix DMA zone reserve not honoring size
@ 2019-03-31 16:25 Pavan Nikhilesh Bhagavatula
  2019-03-31 16:25 ` Pavan Nikhilesh Bhagavatula
  2019-04-01  7:30 ` Andrew Rybchenko
  0 siblings, 2 replies; 22+ messages in thread
From: Pavan Nikhilesh Bhagavatula @ 2019-03-31 16:25 UTC (permalink / raw)
  To: Jerin Jacob Kollanukkaran, thomas, ferruh.yigit, arybchenko, stephen
  Cc: dev, Pavan Nikhilesh Bhagavatula, stable

From: Pavan Nikhilesh <pbhagavatula@marvell.com>

The `rte_eth_dma_zone_reserve()` is generally used to create HW rings.
In some scenarios when a driver needs to reconfigure the ring size
since the named memzone already exists it returns the previous memzone
without checking if a different sized ring is requested.

Introduce a check to see if the ring size requested is different from the
previously created memzone length.

Fixes: 719dbebceb81 ("xen: allow determining DOM0 at runtime")
Cc: stable@dpdk.org

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 lib/librte_ethdev/rte_ethdev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 12b66b68c..4ae12e43b 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -3604,9 +3604,12 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev *dev, const char *ring_name,
 	}
 
 	mz = rte_memzone_lookup(z_name);
-	if (mz)
+	if (mz && (mz->len == size))
 		return mz;
 
+	if (mz)
+		rte_memzone_free(mz);
+
 	return rte_memzone_reserve_aligned(z_name, size, socket_id,
 			RTE_MEMZONE_IOVA_CONTIG, align);
 }
-- 
2.21.0

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2019-04-05  8:03 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-31 16:25 [dpdk-dev] [PATCH] ethdev: fix DMA zone reserve not honoring size Pavan Nikhilesh Bhagavatula
2019-03-31 16:25 ` Pavan Nikhilesh Bhagavatula
2019-04-01  7:30 ` Andrew Rybchenko
2019-04-01  7:30   ` Andrew Rybchenko
2019-04-01  9:28   ` Burakov, Anatoly
2019-04-01  9:28     ` Burakov, Anatoly
2019-04-01  9:40     ` Burakov, Anatoly
2019-04-01  9:40       ` Burakov, Anatoly
2019-04-01 12:12       ` [dpdk-dev] [EXT] " Pavan Nikhilesh Bhagavatula
2019-04-01 12:12         ` Pavan Nikhilesh Bhagavatula
2019-04-02  0:47   ` Jerin Jacob Kollanukkaran
2019-04-02  0:47     ` Jerin Jacob Kollanukkaran
2019-04-02  7:36     ` Andrew Rybchenko
2019-04-02  7:36       ` Andrew Rybchenko
2019-04-02  8:25       ` Jerin Jacob Kollanukkaran
2019-04-02  8:25         ` Jerin Jacob Kollanukkaran
2019-04-02  8:44         ` Andrew Rybchenko
2019-04-02  8:44           ` Andrew Rybchenko
2019-04-04 22:23           ` Thomas Monjalon
2019-04-04 22:23             ` Thomas Monjalon
2019-04-05  8:03             ` Andrew Rybchenko
2019-04-05  8:03               ` Andrew Rybchenko

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).