[net-next,2/3,v2] net: page_pool: add helper function for retrieving dma direction

Message ID 1561785805-21647-3-git-send-email-ilias.apalodimas@linaro.org
State New
Headers show
  • net: netsec: Add XDP Support
Related show

Commit Message

Ilias Apalodimas June 29, 2019, 5:23 a.m.
Since the dma direction is stored in page pool params, offer an API
helper for driver that choose not to keep track of it locally

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>

 include/net/page_pool.h | 9 +++++++++
 1 file changed, 9 insertions(+)



diff --git a/include/net/page_pool.h b/include/net/page_pool.h
index f07c518ef8a5..ee9c871d2043 100644
--- a/include/net/page_pool.h
+++ b/include/net/page_pool.h
@@ -112,6 +112,15 @@  static inline struct page *page_pool_dev_alloc_pages(struct page_pool *pool)
 	return page_pool_alloc_pages(pool, gfp);
+/* get the stored dma direction. A driver might decide to treat this locally and
+ * avoid the extra cache line from page_pool to determine the direction
+ */
+inline enum dma_data_direction page_pool_get_dma_dir(struct page_pool *pool)
+	return pool->p.dma_dir;
 struct page_pool *page_pool_create(const struct page_pool_params *params);
 void __page_pool_free(struct page_pool *pool);