From patchwork Wed Nov 25 13:25:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Doherty, Declan" X-Patchwork-Id: 9100 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id AED738E9F; Wed, 25 Nov 2015 14:26:54 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 1F0728D96 for ; Wed, 25 Nov 2015 14:26:47 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP; 25 Nov 2015 05:26:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,342,1444719600"; d="scan'208";a="859494073" Received: from dwdohert-dpdk.ir.intel.com ([163.33.213.167]) by fmsmga002.fm.intel.com with ESMTP; 25 Nov 2015 05:26:37 -0800 From: Declan Doherty To: dev@dpdk.org Date: Wed, 25 Nov 2015 13:25:11 +0000 Message-Id: <1448457917-27695-5-git-send-email-declan.doherty@intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1448457917-27695-1-git-send-email-declan.doherty@intel.com> References: <1447441090-8129-1-git-send-email-declan.doherty@intel.com> <1448457917-27695-1-git-send-email-declan.doherty@intel.com> Subject: [dpdk-dev] [PATCH v8 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Signed-off-by: Declan Doherty Acked-by: Sergio Gonzalez Monroy --- lib/librte_mbuf/rte_mbuf.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 4a93189..6a1c133 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -1622,6 +1622,27 @@ 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. + */ +#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.