DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ouyang Changchun <changchun.ouyang@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 1/3] mbuf: Use EXTERNAL_MBUF to indicate external buffer
Date: Fri, 24 Oct 2014 16:10:07 +0800	[thread overview]
Message-ID: <1414138209-24431-2-git-send-email-changchun.ouyang@intel.com> (raw)
In-Reply-To: <1414138209-24431-1-git-send-email-changchun.ouyang@intel.com>

mbuf uses EXTERNAL_MBUF in ol_flags to indicate it is an
external buffer, when freeing such kind of mbuf, just need put mbuf itself
back into mempool, doesn't free the attached external buffer, user/caller
need take care of detaching and freeing the external buffer.

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
---
 lib/librte_mbuf/rte_mbuf.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index ddadc21..8cee8fa 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -114,6 +114,9 @@ extern "C" {
 /* Bit 51 - IEEE1588*/
 #define PKT_TX_IEEE1588_TMST (1ULL << 51) /**< TX IEEE1588 packet to timestamp. */
 
+/* Bit 62 - Indicate it is external buffer */
+#define EXTERNAL_MBUF        (1ULL << 62) /**< External buffer. */
+
 /* Use final bit of flags to indicate a control mbuf */
 #define CTRL_MBUF_FLAG       (1ULL << 63) /**< Mbuf contains control data */
 
@@ -670,7 +673,7 @@ __rte_pktmbuf_prefree_seg(struct rte_mbuf *m)
 		 *  - detach mbuf
 		 *  - free attached mbuf segment
 		 */
-		if (unlikely (md != m)) {
+		if (unlikely((md != m) && !(m->ol_flags & EXTERNAL_MBUF))) {
 			rte_pktmbuf_detach(m);
 			if (rte_mbuf_refcnt_update(md, -1) == 0)
 				__rte_mbuf_raw_free(md);
-- 
1.8.4.2

  reply	other threads:[~2014-10-24  8:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-24  8:10 [dpdk-dev] [PATCH 0/3] Vhost app removes dependency of REFCNT Ouyang Changchun
2014-10-24  8:10 ` Ouyang Changchun [this message]
2014-10-24  8:10 ` [dpdk-dev] [PATCH 2/3] pmd: RX function need keep EXTERNAL_MBUF flag Ouyang Changchun
2014-10-24 10:46   ` Ananyev, Konstantin
2014-10-24 12:34     ` Bruce Richardson
2014-10-24 15:43       ` Bruce Richardson
2014-10-24 15:58         ` Ananyev, Konstantin
2014-10-25  2:08           ` Ouyang, Changchun
2014-10-24  8:10 ` [dpdk-dev] [PATCH 3/3] vhost: Removes dependency on REFCNT for zero copy Ouyang Changchun
2014-10-24  9:47 ` [dpdk-dev] [PATCH 0/3] Vhost app removes dependency of REFCNT Thomas Monjalon
2014-10-24 10:47   ` Bruce Richardson
2014-10-25  1:01   ` Ouyang, Changchun

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=1414138209-24431-2-git-send-email-changchun.ouyang@intel.com \
    --to=changchun.ouyang@intel.com \
    --cc=dev@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).