All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mbuf: decrease refcnt when detaching
@ 2016-05-15 15:50 Hiroyuki Mikita
  2016-05-16  0:05 ` Ananyev, Konstantin
                   ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: Hiroyuki Mikita @ 2016-05-15 15:50 UTC (permalink / raw)
  To: olivier.matz; +Cc: dev

The rte_pktmbuf_detach() function should decrease refcnt on a direct
buffer.

Signed-off-by: Hiroyuki Mikita <h.mikita89@gmail.com>
---
 lib/librte_mbuf/rte_mbuf.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 529debb..3b117ca 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -1468,9 +1468,11 @@ static inline void rte_pktmbuf_attach(struct rte_mbuf *mi, struct rte_mbuf *m)
  */
 static inline void rte_pktmbuf_detach(struct rte_mbuf *m)
 {
+	struct rte_mbuf *md = rte_mbuf_from_indirect(m);
 	struct rte_mempool *mp = m->pool;
 	uint32_t mbuf_size, buf_len, priv_size;
 
+	rte_mbuf_refcnt_update(md, -1);
 	priv_size = rte_pktmbuf_priv_size(mp);
 	mbuf_size = sizeof(struct rte_mbuf) + priv_size;
 	buf_len = rte_pktmbuf_data_room_size(mp);
@@ -1498,7 +1500,7 @@ __rte_pktmbuf_prefree_seg(struct rte_mbuf *m)
 		if (RTE_MBUF_INDIRECT(m)) {
 			struct rte_mbuf *md = rte_mbuf_from_indirect(m);
 			rte_pktmbuf_detach(m);
-			if (rte_mbuf_refcnt_update(md, -1) == 0)
+			if (rte_mbuf_refcnt_read(md) == 0)
 				__rte_mbuf_raw_free(md);
 		}
 		return m;
-- 
1.9.1

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

end of thread, other threads:[~2016-05-19 12:38 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-15 15:50 [PATCH] mbuf: decrease refcnt when detaching Hiroyuki Mikita
2016-05-16  0:05 ` Ananyev, Konstantin
2016-05-16  2:46   ` Hiroyuki MIKITA
2016-05-16  8:49     ` Ananyev, Konstantin
2016-05-16  9:13     ` Thomas Monjalon
2016-05-16 16:24       ` Hiroyuki MIKITA
2016-05-16  8:52 ` Olivier Matz
2016-05-16 16:53 ` [PATCH v2] " Hiroyuki Mikita
2016-05-17 10:58   ` Bruce Richardson
2016-05-17 11:06   ` Ananyev, Konstantin
2016-05-17 12:43   ` Thomas Monjalon
2016-05-17 12:59     ` Ananyev, Konstantin
2016-05-17 13:39       ` Thomas Monjalon
2016-05-17 13:44         ` Ananyev, Konstantin
2016-05-17 14:19           ` Thomas Monjalon
2016-05-17 15:45             ` Ananyev, Konstantin
2016-05-17 16:12               ` Hiroyuki MIKITA
2016-05-17 16:35   ` [PATCH v3] " Hiroyuki Mikita
2016-05-18 11:58     ` Olivier Matz
2016-05-18 14:29       ` Hiroyuki Mikita
2016-05-18 14:41     ` [PATCH v4] " Hiroyuki Mikita
2016-05-18 15:51       ` Olivier Matz
2016-05-19 12:38         ` Thomas Monjalon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.