From mboxrd@z Thu Jan 1 00:00:00 1970 From: Declan Doherty Subject: [PATCH v5 04/10] mbuf: add new marcos to get the physical address of data Date: Mon, 9 Nov 2015 20:34:13 +0000 Message-ID: <1447101259-18972-5-git-send-email-declan.doherty@intel.com> References: <1446572746-26207-1-git-send-email-declan.doherty@intel.com> <1447101259-18972-1-git-send-email-declan.doherty@intel.com> To: dev@dpdk.org Return-path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 047835957 for ; Mon, 9 Nov 2015 21:29:38 +0100 (CET) In-Reply-To: <1447101259-18972-1-git-send-email-declan.doherty@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Acked-by: Sergio Gonzalez Monroy Signed-off-by: Declan Doherty --- lib/librte_mbuf/rte_mbuf.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 4a93189..e203c55 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -1622,6 +1622,29 @@ static inline struct rte_mbuf *rte_pktmbuf_lastseg(struct rte_mbuf *m) #define rte_pktmbuf_mtod(m, t) rte_pktmbuf_mtod_offset(m, t, 0) /** + * A macro that returns the physical address that points to an offset of the + * start of the data in the mbuf + * + * @param m + * The packet mbuf. + * @param o + * The offset into the data to calculate address from. + */ +#define rte_pktmbuf_mtophys_offset(m, o) \ + ((phys_addr_t)((char *)(m)->buf_physaddr + (m)->data_off) + (o)) + +/** + * A macro that returns the physical address that points to the start of the + * data in the mbuf + * + * @param m + * The packet mbuf. + * @param o + * The offset into the data to calculate address from. + */ +#define rte_pktmbuf_mtophys(m) rte_pktmbuf_mtophys_offset(m, 0) + +/** * A macro that returns the length of the packet. * * The value can be read or assigned. -- 2.4.3