From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <declan.doherty@intel.com>
Received: from mga11.intel.com (mga11.intel.com [192.55.52.93])
 by dpdk.org (Postfix) with ESMTP id A886A8E7D
 for <dev@dpdk.org>; Tue, 10 Nov 2015 18:28:00 +0100 (CET)
Received: from orsmga002.jf.intel.com ([10.7.209.21])
 by fmsmga102.fm.intel.com with ESMTP; 10 Nov 2015 09:27:59 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.20,271,1444719600"; d="scan'208";a="847140676"
Received: from dwdohert-dpdk-fedora-20.ir.intel.com ([163.33.213.96])
 by orsmga002.jf.intel.com with ESMTP; 10 Nov 2015 09:27:57 -0800
From: Declan Doherty <declan.doherty@intel.com>
To: dev@dpdk.org
Date: Tue, 10 Nov 2015 17:32:37 +0000
Message-Id: <1447176763-19303-5-git-send-email-declan.doherty@intel.com>
X-Mailer: git-send-email 2.4.3
In-Reply-To: <1447176763-19303-1-git-send-email-declan.doherty@intel.com>
References: <1447101259-18972-1-git-send-email-declan.doherty@intel.com>
 <1447176763-19303-1-git-send-email-declan.doherty@intel.com>
Subject: [dpdk-dev] [PATCH v6 04/10] mbuf: add new marcos to get the
	physical address of data
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 10 Nov 2015 17:28:01 -0000

Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Signed-off-by: Declan Doherty <declan.doherty@intel.com>
---
 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..ef1ee26 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)((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