patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH 1/3] ring: fix dequeue parameter name
@ 2023-05-31  5:23 Wenbo Cao
  2023-05-31  5:23 ` [PATCH 2/3] pipeline: fix double free for table stats Wenbo Cao
  0 siblings, 1 reply; 2+ messages in thread
From: Wenbo Cao @ 2023-05-31  5:23 UTC (permalink / raw)
  To: caowenbo; +Cc: Feifei Wang, stable, Ruifeng Wang, Morten Brørup

From: Feifei Wang <feifei.wang2@arm.com>

Ring dequeue operation's parameters name should be 'cons_xx',
rather than 'prod_xxx'.

Fixes: 1fc73390bcf5 ("ring: refactor exported headers")
Cc: stable@dpdk.org

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
 lib/ring/rte_ring_elem_pvt.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/ring/rte_ring_elem_pvt.h b/lib/ring/rte_ring_elem_pvt.h
index e24e4492ff..4b80f58980 100644
--- a/lib/ring/rte_ring_elem_pvt.h
+++ b/lib/ring/rte_ring_elem_pvt.h
@@ -194,12 +194,12 @@ __rte_ring_dequeue_elems_32(struct rte_ring *r, const uint32_t size,
 }
 
 static __rte_always_inline void
-__rte_ring_dequeue_elems_64(struct rte_ring *r, uint32_t prod_head,
+__rte_ring_dequeue_elems_64(struct rte_ring *r, uint32_t cons_head,
 		void *obj_table, uint32_t n)
 {
 	unsigned int i;
 	const uint32_t size = r->size;
-	uint32_t idx = prod_head & r->mask;
+	uint32_t idx = cons_head & r->mask;
 	uint64_t *ring = (uint64_t *)&r[1];
 	unaligned_uint64_t *obj = (unaligned_uint64_t *)obj_table;
 	if (likely(idx + n <= size)) {
@@ -227,12 +227,12 @@ __rte_ring_dequeue_elems_64(struct rte_ring *r, uint32_t prod_head,
 }
 
 static __rte_always_inline void
-__rte_ring_dequeue_elems_128(struct rte_ring *r, uint32_t prod_head,
+__rte_ring_dequeue_elems_128(struct rte_ring *r, uint32_t cons_head,
 		void *obj_table, uint32_t n)
 {
 	unsigned int i;
 	const uint32_t size = r->size;
-	uint32_t idx = prod_head & r->mask;
+	uint32_t idx = cons_head & r->mask;
 	rte_int128_t *ring = (rte_int128_t *)&r[1];
 	rte_int128_t *obj = (rte_int128_t *)obj_table;
 	if (likely(idx + n <= size)) {
-- 
2.27.0


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

* [PATCH 2/3] pipeline: fix double free for table stats
  2023-05-31  5:23 [PATCH 1/3] ring: fix dequeue parameter name Wenbo Cao
@ 2023-05-31  5:23 ` Wenbo Cao
  0 siblings, 0 replies; 2+ messages in thread
From: Wenbo Cao @ 2023-05-31  5:23 UTC (permalink / raw)
  To: caowenbo; +Cc: Kamalakannan R, stable, Cristian Dumitrescu

From: Kamalakannan R <kamalakannan.r@intel.com>

The pointer to the table statistics data structure needs to be set
to NULL after free inside the table_build_free(), as this function is
called from multiple places, leading to double memory free error.

Similar fix for the learner_build_free() function.

Fixes: 742b0a57f50e ("pipeline: add table statistics to SWX")
Fixes: 4f59d3726147 ("pipeline: support learner tables")
Cc: stable@dpdk.org

Signed-off-by: Kamalakannan R <kamalakannan.r@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 lib/pipeline/rte_swx_pipeline.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/pipeline/rte_swx_pipeline.c b/lib/pipeline/rte_swx_pipeline.c
index dea1378095..da37eda231 100644
--- a/lib/pipeline/rte_swx_pipeline.c
+++ b/lib/pipeline/rte_swx_pipeline.c
@@ -8665,6 +8665,7 @@ table_build_free(struct rte_swx_pipeline *p)
 			free(p->table_stats[i].n_pkts_action);
 
 		free(p->table_stats);
+		p->table_stats = NULL;
 	}
 }
 
@@ -9579,6 +9580,7 @@ learner_build_free(struct rte_swx_pipeline *p)
 			free(p->learner_stats[i].n_pkts_action);
 
 		free(p->learner_stats);
+		p->learner_stats = NULL;
 	}
 }
 
-- 
2.27.0


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

end of thread, other threads:[~2023-05-31 10:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-31  5:23 [PATCH 1/3] ring: fix dequeue parameter name Wenbo Cao
2023-05-31  5:23 ` [PATCH 2/3] pipeline: fix double free for table stats Wenbo Cao

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