Re: [PATCH bpf-next v5 2/4] xsk: Support UMEM chunk_size > PAGE_SIZE
From: Magnus Karlsson
Date: Wed Apr 12 2023 - 11:02:30 EST
On Wed, 12 Apr 2023 at 16:30, Kal Cutter Conley <kal.conley@xxxxxxxxxxx> wrote:
>
> > > - pool->unaligned = unaligned;
> > > pool->frame_len = umem->chunk_size - umem->headroom -
> > > XDP_PACKET_HEADROOM;
> > > + pool->unaligned = unaligned;
> >
> > nit: This change is not necessary.
>
> Do you mind if we keep it? It makes the assignments better match the
> order in the struct declaration.
Do not mind.
> > > -static void xp_check_dma_contiguity(struct xsk_dma_map *dma_map)
> > > +static void xp_check_dma_contiguity(struct xsk_dma_map *dma_map, u32 page_size)
> > > {
> > > u32 i;
> > >
> > > - for (i = 0; i < dma_map->dma_pages_cnt - 1; i++) {
> > > - if (dma_map->dma_pages[i] + PAGE_SIZE == dma_map->dma_pages[i + 1])
> > > + for (i = 0; i + 1 < dma_map->dma_pages_cnt; i++) {
> >
> > I think the previous version is clearer than this new one.
>
> I like using `i + 1` since it matches the subscript usage. I'm used to
> writing it like this for SIMD code where subtraction may wrap if the
> length is unsigned, that doesn't matter in this case though. I can
> restore the old way if you want.
Please restore it in that case. I am not used to SIMD code :-).