[RFC,8/8] net: temp hack for dmabuf page in __skb_datagram_iter()

Message ID 20231113130041.58124-9-linyunsheng@huawei.com
State New
Headers
Series A possible proposal for intergating dmabuf to page pool |

Commit Message

Yunsheng Lin Nov. 13, 2023, 1 p.m. UTC
  Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
---
 net/core/datagram.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
  

Patch

diff --git a/net/core/datagram.c b/net/core/datagram.c
index 103d46fa0eeb..5556782ac658 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -436,7 +436,15 @@  static int __skb_datagram_iter(const struct sk_buff *skb, int offset,
 		end = start + skb_frag_size(frag);
 		if ((copy = end - offset) > 0) {
 			struct page *page = skb_frag_page(frag);
-			u8 *vaddr = kmap(page);
+			u8 *vaddr;
+
+			if ((page->pp_magic & ~0x3UL) == PP_SIGNATURE) {
+				struct page_pool_iov *ppiov = (struct page_pool_iov *)page;
+
+				page = ppiov->page;
+			}
+
+			vaddr = kmap(page);
 
 			if (copy > len)
 				copy = len;