On Wed, Jul 10, 2024 at 9:49 AM Jakub Kicinski kuba@kernel.org wrote:
On Wed, 10 Jul 2024 00:17:38 +0000 Mina Almasry wrote:
+static inline struct net_iov *__netmem_clear_lsb(netmem_ref netmem) +{
return (struct net_iov *)((__force unsigned long)netmem & ~NET_IOV);
+}
+static inline unsigned long netmem_get_pp_magic(netmem_ref netmem) +{
return __netmem_clear_lsb(netmem)->pp_magic;
+}
+static inline void netmem_or_pp_magic(netmem_ref netmem, unsigned long pp_magic) +{
__netmem_clear_lsb(netmem)->pp_magic |= pp_magic;
+}
+static inline void netmem_clear_pp_magic(netmem_ref netmem) +{
__netmem_clear_lsb(netmem)->pp_magic = 0;
+}
+static inline struct page_pool *netmem_get_pp(netmem_ref netmem) +{
return __netmem_clear_lsb(netmem)->pp;
+}
+static inline void netmem_set_pp(netmem_ref netmem, struct page_pool *pool) +{
__netmem_clear_lsb(netmem)->pp = pool;
+}
Why is all this stuff in the main header? It's really low level. Please put helpers which are only used by the core in a header under net/core/, like net/core/dev.h
Sorry none of those are only used by net/core/*. Pretty much all of these are used by include/net/page_pool/helpers.h, and some have callers in net/core/devmem.c or net/core/skbuff.c
Would you like me to move these pp specific looking ones to include/net/page_pool/netmem.h or something similar?