[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190923100031.GB11084@ulmo>
Date: Mon, 23 Sep 2019 12:00:31 +0200
From: Thierry Reding <thierry.reding@...il.com>
To: "David S . Miller" <davem@...emloft.net>
Cc: Giuseppe Cavallaro <peppe.cavallaro@...com>,
Alexandre Torgue <alexandre.torgue@...com>,
Jose Abreu <joabreu@...opsys.com>,
Florian Fainelli <f.fainelli@...il.com>,
Jakub Kicinski <jakub.kicinski@...ronome.com>,
Jon Hunter <jonathanh@...dia.com>,
Bitan Biswas <bbiswas@...dia.com>, netdev@...r.kernel.org,
linux-tegra@...r.kernel.org
Subject: Re: [PATCH net-next] net: stmmac: Fix page pool size
On Mon, Sep 23, 2019 at 11:59:15AM +0200, Thierry Reding wrote:
> From: Thierry Reding <treding@...dia.com>
>
> The size of individual pages in the page pool in given by an order. The
> order is the binary logarithm of the number of pages that make up one of
> the pages in the pool. However, the driver currently passes the number
> of pages rather than the order, so it ends up wasting quite a bit of
> memory.
>
> Fix this by taking the binary logarithm and passing that in the order
> field.
>
> Fixes: 2af6106ae949 ("net: stmmac: Introducing support for Page Pool")
> Signed-off-by: Thierry Reding <treding@...dia.com>
> ---
> drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
I fumbled the git format-patch incantation. This should've been marked
v2.
Thierry
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index ecd461207dbc..f8c90dba6db8 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -1550,13 +1550,15 @@ static int alloc_dma_rx_desc_resources(struct stmmac_priv *priv)
> for (queue = 0; queue < rx_count; queue++) {
> struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
> struct page_pool_params pp_params = { 0 };
> + unsigned int num_pages;
>
> rx_q->queue_index = queue;
> rx_q->priv_data = priv;
>
> pp_params.flags = PP_FLAG_DMA_MAP;
> pp_params.pool_size = DMA_RX_SIZE;
> - pp_params.order = DIV_ROUND_UP(priv->dma_buf_sz, PAGE_SIZE);
> + num_pages = DIV_ROUND_UP(priv->dma_buf_sz, PAGE_SIZE);
> + pp_params.order = ilog2(num_pages);
> pp_params.nid = dev_to_node(priv->device);
> pp_params.dev = priv->device;
> pp_params.dma_dir = DMA_FROM_DEVICE;
> --
> 2.23.0
>
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists