X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_mbuf%2Frte_mbuf.h;h=e39ad28da853544fbf9d8d19cb86473c2d9cc94e;hb=d6b324c00fc933f757e68c54c0e50c92826d83f0;hp=c1f6bc4ffd0c2df6c50e5b9804632f3dd7621453;hpb=ac78cb27a80852f337c92f5373ca778e67a85c40;p=dpdk.git diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index c1f6bc4ffd..e39ad28da8 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -854,6 +854,38 @@ struct rte_mbuf { static inline uint16_t rte_pktmbuf_priv_size(struct rte_mempool *mp); +/** + * Return the DMA address of the beginning of the mbuf data + * + * @param mb + * The pointer to the mbuf. + * @return + * The physical address of the beginning of the mbuf data + */ +static inline phys_addr_t +rte_mbuf_data_dma_addr(const struct rte_mbuf *mb) +{ + return mb->buf_physaddr + mb->data_off; +} + +/** + * Return the default DMA address of the beginning of the mbuf data + * + * This function is used by drivers in their receive function, as it + * returns the location where data should be written by the NIC, taking + * the default headroom in account. + * + * @param mb + * The pointer to the mbuf. + * @return + * The physical address of the beginning of the mbuf data + */ +static inline phys_addr_t +rte_mbuf_data_dma_addr_default(const struct rte_mbuf *mb) +{ + return mb->buf_physaddr + RTE_PKTMBUF_HEADROOM; +} + /** * Return the mbuf owning the data buffer address of an indirect mbuf. *