public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] xsk: remove doubled defines
@ 2026-03-10 13:43 Maciej Fijalkowski
  2026-03-10 21:34 ` Stanislav Fomichev
  0 siblings, 1 reply; 4+ messages in thread
From: Maciej Fijalkowski @ 2026-03-10 13:43 UTC (permalink / raw)
  To: netdev
  Cc: bpf, magnus.karlsson, stfomichev, kuba, pabeni, horms,
	Maciej Fijalkowski

Seems we have been carrying around doubled defines for unaligned mode
logic. Remove one of them.

Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
---
 include/net/xsk_buff_pool.h | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/include/net/xsk_buff_pool.h b/include/net/xsk_buff_pool.h
index 0b1abdb99c9e..ccb3b350001f 100644
--- a/include/net/xsk_buff_pool.h
+++ b/include/net/xsk_buff_pool.h
@@ -174,13 +174,6 @@ static inline void xp_dma_sync_for_device(struct xsk_buff_pool *pool,
 	dma_sync_single_for_device(pool->dev, dma, size, DMA_BIDIRECTIONAL);
 }
 
-/* Masks for xdp_umem_page flags.
- * The low 12-bits of the addr will be 0 since this is the page address, so we
- * can use them for flags.
- */
-#define XSK_NEXT_PG_CONTIG_SHIFT 0
-#define XSK_NEXT_PG_CONTIG_MASK BIT_ULL(XSK_NEXT_PG_CONTIG_SHIFT)
-
 static inline bool xp_desc_crosses_non_contig_pg(struct xsk_buff_pool *pool,
 						 u64 addr, u32 len)
 {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] xsk: remove doubled defines
  2026-03-10 13:43 [PATCH net-next] xsk: remove doubled defines Maciej Fijalkowski
@ 2026-03-10 21:34 ` Stanislav Fomichev
  2026-03-12 12:39   ` Paolo Abeni
  0 siblings, 1 reply; 4+ messages in thread
From: Stanislav Fomichev @ 2026-03-10 21:34 UTC (permalink / raw)
  To: Maciej Fijalkowski; +Cc: netdev, bpf, magnus.karlsson, kuba, pabeni, horms

On 03/10, Maciej Fijalkowski wrote:
> Seems we have been carrying around doubled defines for unaligned mode
> logic. Remove one of them.
> 
> Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> ---
>  include/net/xsk_buff_pool.h | 7 -------
>  1 file changed, 7 deletions(-)
> 
> diff --git a/include/net/xsk_buff_pool.h b/include/net/xsk_buff_pool.h
> index 0b1abdb99c9e..ccb3b350001f 100644
> --- a/include/net/xsk_buff_pool.h
> +++ b/include/net/xsk_buff_pool.h
> @@ -174,13 +174,6 @@ static inline void xp_dma_sync_for_device(struct xsk_buff_pool *pool,
>  	dma_sync_single_for_device(pool->dev, dma, size, DMA_BIDIRECTIONAL);
>  }
>  
> -/* Masks for xdp_umem_page flags.
> - * The low 12-bits of the addr will be 0 since this is the page address, so we
> - * can use them for flags.
> - */
> -#define XSK_NEXT_PG_CONTIG_SHIFT 0
> -#define XSK_NEXT_PG_CONTIG_MASK BIT_ULL(XSK_NEXT_PG_CONTIG_SHIFT)
> -
>  static inline bool xp_desc_crosses_non_contig_pg(struct xsk_buff_pool *pool,
>  						 u64 addr, u32 len)
>  {
> -- 
> 2.43.0
> 

All consumers seem to be in net/xdp/xsk_buff_pool.c, so why not remove
the defines from xsk.h instead?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] xsk: remove doubled defines
  2026-03-10 21:34 ` Stanislav Fomichev
@ 2026-03-12 12:39   ` Paolo Abeni
  2026-03-13  9:30     ` Maciej Fijalkowski
  0 siblings, 1 reply; 4+ messages in thread
From: Paolo Abeni @ 2026-03-12 12:39 UTC (permalink / raw)
  To: Stanislav Fomichev, Maciej Fijalkowski
  Cc: netdev, bpf, magnus.karlsson, kuba, horms

On 3/10/26 10:34 PM, Stanislav Fomichev wrote:
> On 03/10, Maciej Fijalkowski wrote:
>> Seems we have been carrying around doubled defines for unaligned mode
>> logic. Remove one of them.
>>
>> Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
>> ---
>>  include/net/xsk_buff_pool.h | 7 -------
>>  1 file changed, 7 deletions(-)
>>
>> diff --git a/include/net/xsk_buff_pool.h b/include/net/xsk_buff_pool.h
>> index 0b1abdb99c9e..ccb3b350001f 100644
>> --- a/include/net/xsk_buff_pool.h
>> +++ b/include/net/xsk_buff_pool.h
>> @@ -174,13 +174,6 @@ static inline void xp_dma_sync_for_device(struct xsk_buff_pool *pool,
>>  	dma_sync_single_for_device(pool->dev, dma, size, DMA_BIDIRECTIONAL);
>>  }
>>  
>> -/* Masks for xdp_umem_page flags.
>> - * The low 12-bits of the addr will be 0 since this is the page address, so we
>> - * can use them for flags.
>> - */
>> -#define XSK_NEXT_PG_CONTIG_SHIFT 0
>> -#define XSK_NEXT_PG_CONTIG_MASK BIT_ULL(XSK_NEXT_PG_CONTIG_SHIFT)
>> -
>>  static inline bool xp_desc_crosses_non_contig_pg(struct xsk_buff_pool *pool,
>>  						 u64 addr, u32 len)
>>  {
>> -- 
>> 2.43.0
>>
> 
> All consumers seem to be in net/xdp/xsk_buff_pool.c, 

AFAICS there are users in xsk_buff_pool.h, too:

$ git grep XSK_NEXT_PG_CONTIG_MASK include/
include/net/xsk_buff_pool.h:#define XSK_NEXT_PG_CONTIG_MASK
BIT_ULL(XSK_NEXT_PG_CONTIG_SHIFT)
include/net/xsk_buff_pool.h:    xskb->frame_dma = (dma_pages[addr >>
PAGE_SHIFT] & ~XSK_NEXT_PG_CONTIG_MASK) +
include/net/xsk_buff_pool.h:#define XSK_NEXT_PG_CONTIG_MASK
BIT_ULL(XSK_NEXT_PG_CONTIG_SHIFT)
include/net/xsk_buff_pool.h:           !(pool->dma_pages[addr >>
PAGE_SHIFT] & XSK_NEXT_PG_CONTIG_MASK);

> so why not remove the defines from xsk.h instead?

Indeed it looks like the macro definition is duplicated multiple times.
@Maciej: could you please drop all the unneeded dups?

Thanks,

Paolo


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] xsk: remove doubled defines
  2026-03-12 12:39   ` Paolo Abeni
@ 2026-03-13  9:30     ` Maciej Fijalkowski
  0 siblings, 0 replies; 4+ messages in thread
From: Maciej Fijalkowski @ 2026-03-13  9:30 UTC (permalink / raw)
  To: Paolo Abeni; +Cc: Stanislav Fomichev, netdev, bpf, magnus.karlsson, kuba, horms

On Thu, Mar 12, 2026 at 01:39:47PM +0100, Paolo Abeni wrote:
> On 3/10/26 10:34 PM, Stanislav Fomichev wrote:
> > On 03/10, Maciej Fijalkowski wrote:
> >> Seems we have been carrying around doubled defines for unaligned mode
> >> logic. Remove one of them.
> >>
> >> Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> >> ---
> >>  include/net/xsk_buff_pool.h | 7 -------
> >>  1 file changed, 7 deletions(-)
> >>
> >> diff --git a/include/net/xsk_buff_pool.h b/include/net/xsk_buff_pool.h
> >> index 0b1abdb99c9e..ccb3b350001f 100644
> >> --- a/include/net/xsk_buff_pool.h
> >> +++ b/include/net/xsk_buff_pool.h
> >> @@ -174,13 +174,6 @@ static inline void xp_dma_sync_for_device(struct xsk_buff_pool *pool,
> >>  	dma_sync_single_for_device(pool->dev, dma, size, DMA_BIDIRECTIONAL);
> >>  }
> >>  
> >> -/* Masks for xdp_umem_page flags.
> >> - * The low 12-bits of the addr will be 0 since this is the page address, so we
> >> - * can use them for flags.
> >> - */
> >> -#define XSK_NEXT_PG_CONTIG_SHIFT 0
> >> -#define XSK_NEXT_PG_CONTIG_MASK BIT_ULL(XSK_NEXT_PG_CONTIG_SHIFT)
> >> -
> >>  static inline bool xp_desc_crosses_non_contig_pg(struct xsk_buff_pool *pool,
> >>  						 u64 addr, u32 len)
> >>  {
> >> -- 
> >> 2.43.0
> >>
> > 
> > All consumers seem to be in net/xdp/xsk_buff_pool.c, 
> 
> AFAICS there are users in xsk_buff_pool.h, too:
> 
> $ git grep XSK_NEXT_PG_CONTIG_MASK include/
> include/net/xsk_buff_pool.h:#define XSK_NEXT_PG_CONTIG_MASK
> BIT_ULL(XSK_NEXT_PG_CONTIG_SHIFT)
> include/net/xsk_buff_pool.h:    xskb->frame_dma = (dma_pages[addr >>
> PAGE_SHIFT] & ~XSK_NEXT_PG_CONTIG_MASK) +
> include/net/xsk_buff_pool.h:#define XSK_NEXT_PG_CONTIG_MASK
> BIT_ULL(XSK_NEXT_PG_CONTIG_SHIFT)
> include/net/xsk_buff_pool.h:           !(pool->dma_pages[addr >>
> PAGE_SHIFT] & XSK_NEXT_PG_CONTIG_MASK);
> 
> > so why not remove the defines from xsk.h instead?
> 
> Indeed it looks like the macro definition is duplicated multiple times.
> @Maciej: could you please drop all the unneeded dups?

Thanks, let me send a v2 with a better cleanup:)

> 
> Thanks,
> 
> Paolo
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-03-13  9:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-10 13:43 [PATCH net-next] xsk: remove doubled defines Maciej Fijalkowski
2026-03-10 21:34 ` Stanislav Fomichev
2026-03-12 12:39   ` Paolo Abeni
2026-03-13  9:30     ` Maciej Fijalkowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox