[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALHRZuqdEg11kvpbEkX1G-i1OkBX=tSf1eeQmBBQCeBs3mSEqQ@mail.gmail.com>
Date: Mon, 1 Feb 2021 18:11:19 +0530
From: sundeep subbaraya <sundeep.lkml@...il.com>
To: Kevin Hao <haokexin@...il.com>
Cc: "David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
Sunil Goutham <sgoutham@...vell.com>,
Geetha sowjanya <gakula@...vell.com>,
Subbaraya Sundeep <sbhatta@...vell.com>,
hariprasad <hkelam@...vell.com>
Subject: Re: [PATCH net-next v2 3/4] net: octeontx2: Use napi_alloc_frag_align()
to avoid the memory waste
Tested-by: Subbaraya Sundeep <sbhatta@...vell.com>
Thanks,
Sundeep
On Sun, Jan 31, 2021 at 1:49 PM Kevin Hao <haokexin@...il.com> wrote:
>
> The napi_alloc_frag_align() will guarantee that a correctly align
> buffer address is returned. So use this function to simplify the buffer
> alloc and avoid the unnecessary memory waste.
>
> Signed-off-by: Kevin Hao <haokexin@...il.com>
> ---
> v2: No change.
>
> drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
> index 5ddedc3b754d..cbd68fa9f1d6 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
> @@ -488,11 +488,10 @@ dma_addr_t __otx2_alloc_rbuf(struct otx2_nic *pfvf, struct otx2_pool *pool)
> dma_addr_t iova;
> u8 *buf;
>
> - buf = napi_alloc_frag(pool->rbsize + OTX2_ALIGN);
> + buf = napi_alloc_frag_align(pool->rbsize, OTX2_ALIGN);
> if (unlikely(!buf))
> return -ENOMEM;
>
> - buf = PTR_ALIGN(buf, OTX2_ALIGN);
> iova = dma_map_single_attrs(pfvf->dev, buf, pool->rbsize,
> DMA_FROM_DEVICE, DMA_ATTR_SKIP_CPU_SYNC);
> if (unlikely(dma_mapping_error(pfvf->dev, iova))) {
> --
> 2.29.2
>
Powered by blists - more mailing lists