Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Jul 2026 00:10:41 +0000
From:      Bjoern A. Zeeb <bz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: b37a29f84940 - stable/15 - LinuxKPI: skbuff: add initial page pool support
Message-ID:  <6a66a201.25fa4.368a53fa@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/15 has been updated by bz:

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

commit b37a29f849402f417f2144c886ce523d78f76ab7
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2026-07-17 11:02:45 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-07-26 16:48:29 +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
    
    (cherry picked from commit e4795d3dbee71c463429e2901dad111fbc2d08fc)
---
 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++;
 		}
 	}


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a66a201.25fa4.368a53fa>