> -----Original Message-----
> From: Michael Kelley <mhkli...@outlook.com>
> Sent: Sunday, June 16, 2024 12:04 AM
> To: Haiyang Zhang <haiya...@microsoft.com>; linux-hyperv@vger.kernel.org;
> net...@vger.kernel.org
> Cc: Dexuan Cui <de...@microsoft.com>; step...@networkplumber.org; KY
> Srinivasan <k...@microsoft.com>; Paul Rosswurm <paul...@microsoft.com>;
> o...@aepfle.de; vkuznets <vkuzn...@redhat.com>; da...@davemloft.net;
> wei....@kernel.org; eduma...@google.com; k...@kernel.org;
> pab...@redhat.com; l...@kernel.org; Long Li <lon...@microsoft.com>;
> ssen...@linux.microsoft.com; linux-r...@vger.kernel.org;
> dan...@iogearbox.net; john.fastab...@gmail.com; b...@vger.kernel.org;
> a...@kernel.org; h...@kernel.org; t...@linutronix.de;
> shradhagu...@linux.microsoft.com; linux-ker...@vger.kernel.org
> 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