The branch main has been updated by bz:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=e4795d3dbee71c463429e2901dad111fbc2d08fc

commit e4795d3dbee71c463429e2901dad111fbc2d08fc
Author:     Bjoern A. Zeeb <[email protected]>
AuthorDate: 2026-07-17 11:02:45 +0000
Commit:     Bjoern A. Zeeb <[email protected]>
CommitDate: 2026-07-17 15:48:54 +0000

    LinuxKPI: skbuff: add initial page pool support
    
    Add an internal flag which is set by skb_mark_for_recycle() and upon
    "skb_free" then selects whether the skb is freed or returned to the
    page pool.
    There will likely be more details to figure out once the LinuxKPI page
    work is done and we support more of the page pool than the bare minimum.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
---
 sys/compat/linuxkpi/common/include/linux/skbuff.h | 5 +++--
 sys/compat/linuxkpi/common/src/linux_skbuff.c     | 9 ++++++++-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/skbuff.h 
b/sys/compat/linuxkpi/common/include/linux/skbuff.h
index 9434655fc9f4..77ef47064fa5 100644
--- a/sys/compat/linuxkpi/common/include/linux/skbuff.h
+++ b/sys/compat/linuxkpi/common/include/linux/skbuff.h
@@ -182,6 +182,7 @@ struct sk_buff {
        uint16_t                qmap;           /* queue mapping */
        uint16_t                _flags;         /* Internal flags. */
 #define        _SKB_FLAGS_SKBEXTFRAG   0x0001
+#define        _SKB_PP_RECYCLE         0x0010
        uint16_t                l3hdroff;       /* network header offset from 
*head */
        uint16_t                l4hdroff;       /* transport header offset from 
*head */
        uint16_t                mac_header;     /* offset of mac_header */
@@ -263,6 +264,7 @@ static inline void
 dev_kfree_skb(struct sk_buff *skb)
 {
        SKB_TRACE(skb);
+       SKB_IMPROVE("Need to be able to deal with page_pool");
        kfree_skb(skb);
 }
 
@@ -1166,8 +1168,7 @@ static inline void
 skb_mark_for_recycle(struct sk_buff *skb)
 {
        SKB_TRACE(skb);
-       /* page_pool */
-       SKB_TODO();
+       skb->_flags |= _SKB_PP_RECYCLE;
 }
 
 static inline int
diff --git a/sys/compat/linuxkpi/common/src/linux_skbuff.c 
b/sys/compat/linuxkpi/common/src/linux_skbuff.c
index d57c277c3267..6908101f25af 100644
--- a/sys/compat/linuxkpi/common/src/linux_skbuff.c
+++ b/sys/compat/linuxkpi/common/src/linux_skbuff.c
@@ -55,6 +55,8 @@
 #include <linux/log2.h>
 #endif
 
+#include <net/page_pool/helpers.h>
+
 SYSCTL_DECL(_compat_linuxkpi);
 SYSCTL_NODE(_compat_linuxkpi, OID_AUTO, skb, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
     "LinuxKPI skbuff");
@@ -349,7 +351,12 @@ linuxkpi_kfree_skb(struct sk_buff *skb)
                        shinfo->frags[fragno].size = 0;
                        shinfo->frags[fragno].offset = 0;
                        shinfo->frags[fragno].page = NULL;
-                       __free_page(p);
+#ifdef PAGE_IS_LKPI_PAGE
+                       if ((skb->_flags & _SKB_PP_RECYCLE) != 0)
+                               page_pool_put_full_page(p->pp, p, false);
+                       else
+#endif
+                               __free_page(p);
                        count++;
                }
        }

Reply via email to