Files
erofs-linux/net/core/netmem_priv.h
T
Byungchul Park 54cf41c969 Revert "mm: introduce a new page type for page pool in page type"
This reverts commit db359fccf2 ("mm: introduce a new page type for page
pool in page type") and a part of 735a309b4b ("net: add net_iov_init()
and use it to initialize ->page_type").

Netpp page_type'ed pages might be used in mapping so as to use @_mapcount.
However, since @page_type and @_mapcount are union'ed in struct page,
these two can't be used at the same time.  Revert the commit introducing
page_type for Netpp for now.

The patch will be retried once @page_type and @_mapcount get allowed to be
used at the same time.

The revert also includes removal of @page_type initialization part
introduced by commit 735a309b4b ("net: add net_iov_init() and use it
to initialize ->page_type"), which will be restored on the retry.

Link: https://lore.kernel.org/[email protected]
Fixes: db359fccf2 ("mm: introduce a new page type for page pool in page type")
Signed-off-by: Byungchul Park <[email protected]>
Reported-by: Dragos Tatulea <[email protected]>
Closes: https://lore.kernel.org/all/[email protected]
Acked-by: Jakub Kicinski <[email protected]>
Acked-by: David Hildenbrand (Arm) <[email protected]>
Acked-by: Harry Yoo (Oracle) <[email protected]>
Reviewed-by: Lorenzo Stoakes <[email protected]>
Cc: Alexei Starovoitov <[email protected]>
Cc: Baolin Wang <[email protected]>
Cc: Brendan Jackman <[email protected]>
Cc: David S. Miller <[email protected]>
Cc: Eric Dumazet <[email protected]>
Cc: Ilias Apalodimas <[email protected]>
Cc: Jesper Dangaard Brouer <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: John Fastabend <[email protected]>
Cc: Leon Romanovsky <[email protected]>
Cc: Liam R. Howlett <[email protected]>
Cc: Mark Bloch <[email protected]>
Cc: Matthew Wilcox (Oracle) <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Mike Rapoport <[email protected]>
Cc: Paolo Abeni <[email protected]>
Cc: Pavel Begunkov <[email protected]>
Cc: Saeed Mahameed <[email protected]>
Cc: Simon Horman <[email protected]>
Cc: Stanislav Fomichev <[email protected]>
Cc: Suren Baghdasaryan <[email protected]>
Cc: Tariq Toukan <[email protected]>
Cc: Toke Hoiland-Jorgensen <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Cc: Zi Yan <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
2026-05-21 19:06:13 -07:00

63 lines
1.4 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __NETMEM_PRIV_H
#define __NETMEM_PRIV_H
static inline unsigned long netmem_get_pp_magic(netmem_ref netmem)
{
return netmem_to_nmdesc(netmem)->pp_magic & ~PP_DMA_INDEX_MASK;
}
static inline void netmem_or_pp_magic(netmem_ref netmem, unsigned long pp_magic)
{
netmem_to_nmdesc(netmem)->pp_magic |= pp_magic;
}
static inline void netmem_clear_pp_magic(netmem_ref netmem)
{
WARN_ON_ONCE(netmem_to_nmdesc(netmem)->pp_magic & PP_DMA_INDEX_MASK);
netmem_to_nmdesc(netmem)->pp_magic = 0;
}
static inline bool netmem_is_pp(netmem_ref netmem)
{
return (netmem_get_pp_magic(netmem) & PP_MAGIC_MASK) == PP_SIGNATURE;
}
static inline void netmem_set_pp(netmem_ref netmem, struct page_pool *pool)
{
netmem_to_nmdesc(netmem)->pp = pool;
}
static inline void netmem_set_dma_addr(netmem_ref netmem,
unsigned long dma_addr)
{
netmem_to_nmdesc(netmem)->dma_addr = dma_addr;
}
static inline unsigned long netmem_get_dma_index(netmem_ref netmem)
{
unsigned long magic;
if (WARN_ON_ONCE(netmem_is_net_iov(netmem)))
return 0;
magic = netmem_to_nmdesc(netmem)->pp_magic;
return (magic & PP_DMA_INDEX_MASK) >> PP_DMA_INDEX_SHIFT;
}
static inline void netmem_set_dma_index(netmem_ref netmem,
unsigned long id)
{
unsigned long magic;
if (WARN_ON_ONCE(netmem_is_net_iov(netmem)))
return;
magic = netmem_get_pp_magic(netmem) | (id << PP_DMA_INDEX_SHIFT);
netmem_to_nmdesc(netmem)->pp_magic = magic;
}
#endif