From: Ouyang Changchun <changchun.ouyang@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 2/3] [PMD] [VHOST] Support zero copy RX/TX in user space vhost
Date: Mon, 19 May 2014 19:15:40 +0800 [thread overview]
Message-ID: <1400498141-16360-3-git-send-email-changchun.ouyang@intel.com> (raw)
In-Reply-To: <1400498141-16360-1-git-send-email-changchun.ouyang@intel.com>
Implement mbuf metadata macros to facilitate refering to space in mbuf headroom;
Signed-off-by: Ouyang Changchun <changchun.ouyang@intel.com>
---
lib/librte_mbuf/rte_mbuf.h | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index edffc2c..baf3ca4 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -201,8 +201,25 @@ struct rte_mbuf {
struct rte_ctrlmbuf ctrl;
struct rte_pktmbuf pkt;
};
+
+ union {
+ uint8_t metadata[0];
+ uint16_t metadata16[0];
+ uint32_t metadata32[0];
+ uint64_t metadata64[0];
+ };
} __rte_cache_aligned;
+#define RTE_MBUF_METADATA_UINT8(mbuf, offset) (mbuf->metadata[offset])
+#define RTE_MBUF_METADATA_UINT16(mbuf, offset) (mbuf->metadata16[offset/sizeof(uint16_t)])
+#define RTE_MBUF_METADATA_UINT32(mbuf, offset) (mbuf->metadata32[offset/sizeof(uint32_t)])
+#define RTE_MBUF_METADATA_UINT64(mbuf, offset) (mbuf->metadata64[offset/sizeof(uint64_t)])
+
+#define RTE_MBUF_METADATA_UINT8_PTR(mbuf, offset) (&mbuf->metadata[offset])
+#define RTE_MBUF_METADATA_UINT16_PTR(mbuf, offset) (&mbuf->metadata16[offset/sizeof(uint16_t)])
+#define RTE_MBUF_METADATA_UINT32_PTR(mbuf, offset) (&mbuf->metadata32[offset/sizeof(uint32_t)])
+#define RTE_MBUF_METADATA_UINT64_PTR(mbuf, offset) (&mbuf->metadata64[offset/sizeof(uint64_t)])
+
/**
* Given the buf_addr returns the pointer to corresponding mbuf.
*/
--
1.9.0
next prev parent reply other threads:[~2014-05-19 11:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-19 11:15 [dpdk-dev] [PATCH 0/3] [PMD] [VHOST] *** Support zero copy RX/TX in user space vhost *** Ouyang Changchun
2014-05-19 11:15 ` [dpdk-dev] [PATCH 1/3] [PMD] [VHOST] Support zero copy RX/TX in user space vhost Ouyang Changchun
2014-05-19 11:15 ` Ouyang Changchun [this message]
2014-05-19 11:15 ` [dpdk-dev] [PATCH 3/3] " 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=1400498141-16360-3-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).