[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-mm
Subject: [PATCH 23/24] net: Add support for netmem in skb_frag
From: "Matthew Wilcox (Oracle)" <willy () infradead ! org>
Date: 2022-11-30 22:08:02
Message-ID: 20221130220803.3657490-24-willy () infradead ! org
[Download RAW message or body]
Allow drivers to add netmem to skbs & retrieve them again. If the
VM_BUG_ON triggers, we can add a call to compound_head() either in
this function or in page_netmem().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
include/linux/skbuff.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 4e464a27adaf..dabfb392ca01 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -3345,6 +3345,12 @@ static inline struct page *skb_frag_page(const skb_frag_t *frag)
return frag->bv_page;
}
+static inline struct netmem *skb_frag_netmem(const skb_frag_t *frag)
+{
+ VM_BUG_ON_PAGE(PageTail(frag->bv_page), frag->bv_page);
+ return page_netmem(frag->bv_page);
+}
+
/**
* __skb_frag_ref - take an addition reference on a paged fragment.
* @frag: the paged fragment
@@ -3453,6 +3459,11 @@ static inline void __skb_frag_set_page(skb_frag_t *frag, struct page *page)
frag->bv_page = page;
}
+static inline void __skb_frag_set_netmem(skb_frag_t *frag, struct netmem *nmem)
+{
+ __skb_frag_set_page(frag, netmem_page(nmem));
+}
+
/**
* skb_frag_set_page - sets the page contained in a paged fragment of an skb
* @skb: the buffer
--
2.35.1
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic