diff mbox series

[RFC,7/8] net: hns3: temp hack for hns3 to use dmabuf memory provider

Message ID 20231113130041.58124-8-linyunsheng@huawei.com (mailing list archive)
State RFC
Delegated to: Netdev Maintainers
Headers show
Series A possible proposal for intergating dmabuf to page pool | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang fail Errors and warnings before: 1194 this patch: 19
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn fail Errors and warnings before: 1161 this patch: 1163
netdev/checkpatch warning WARNING: Missing commit description - Add an appropriate one
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Yunsheng Lin Nov. 13, 2023, 1 p.m. UTC
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
---
 drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index 06117502001f..43454aa6a279 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -3371,6 +3371,8 @@  static int hns3_alloc_buffer(struct hns3_enet_ring *ring,
 	struct page *p;
 
 	if (ring->page_pool) {
+		struct page_pool_iov *ppiov;
+
 		p = page_pool_dev_alloc_frag(ring->page_pool,
 					     &cb->page_offset,
 					     hns3_buf_size(ring));
@@ -3378,7 +3380,8 @@  static int hns3_alloc_buffer(struct hns3_enet_ring *ring,
 			return -ENOMEM;
 
 		cb->priv = p;
-		cb->buf = page_address(p);
+		ppiov = cb->priv;
+		cb->buf = page_address(ppiov->page);
 		cb->dma = page_pool_get_dma_addr(p);
 		cb->type = DESC_TYPE_PP_FRAG;
 		cb->reuse_flag = 0;
@@ -4940,7 +4943,7 @@  static void hns3_put_ring_config(struct hns3_nic_priv *priv)
 static void hns3_alloc_page_pool(struct hns3_enet_ring *ring)
 {
 	struct page_pool_params pp_params = {
-		.flags = PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV,
+		.flags = 0,//PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV,
 		.order = hns3_page_order(ring),
 		.pool_size = ring->desc_num * hns3_buf_size(ring) /
 				(PAGE_SIZE << hns3_page_order(ring)),
@@ -4949,6 +4952,8 @@  static void hns3_alloc_page_pool(struct hns3_enet_ring *ring)
 		.dma_dir = DMA_FROM_DEVICE,
 		.offset = 0,
 		.max_len = PAGE_SIZE << hns3_page_order(ring),
+		.memory_provider = PP_MP_DMABUF_DEVMEM,
+		.mp_priv = &dmabuf_devmem_ops,
 	};
 
 	ring->page_pool = page_pool_create(&pp_params);