> -----Original Message-----
> From: Michael Kelley <[email protected]>
> Sent: Sunday, June 16, 2024 12:04 AM
> To: Haiyang Zhang <[email protected]>; [email protected];
> [email protected]
> Cc: Dexuan Cui <[email protected]>; [email protected]; KY
> Srinivasan <[email protected]>; Paul Rosswurm <[email protected]>;
> [email protected]; vkuznets <[email protected]>; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; Long Li <[email protected]>;
> [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]
> Subject: RE: [PATCH v2, net-next] net: mana: Add support for page sizes
> other than 4KB on ARM64
 
> > diff --git a/drivers/net/ethernet/microsoft/mana/gdma_main.c
> > b/drivers/net/ethernet/microsoft/mana/gdma_main.c
> > index 1332db9a08eb..aa215e2e9606 100644
> > --- a/drivers/net/ethernet/microsoft/mana/gdma_main.c
> > +++ b/drivers/net/ethernet/microsoft/mana/gdma_main.c
> > @@ -182,7 +182,7 @@ int mana_gd_alloc_memory(struct gdma_context *gc,
> unsigned int length,
> >     dma_addr_t dma_handle;
> >     void *buf;
> >
> > -   if (length < PAGE_SIZE || !is_power_of_2(length))
> > +   if (length < MANA_MIN_QSIZE || !is_power_of_2(length))
> >             return -EINVAL;
> 
> Since mana_gd_alloc_memory() is a somewhat generic function that wraps
> dma_alloc_coherent(), checking the length against MANA_MIN_QSIZE is
> unexpected.  In looking at the call graph, I see that
> mana_gd_alloc_memory()
> is used in creating queues, but all the callers already ensure that the
> minimum
> size requirement is met.  For robustness, having a check here seems OK,
> but
> I would have expected checking against MANA_PAGE_SIZE, since that's the
> DMA-related concept.
 
I will update this and the other checking in mana_gd_create_dma_region()
to MANA_PAGE_SIZE.

Thanks,
- Haiyang

Reply via email to