[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <89d7ce83-cc1d-4791-87b5-6f7af29a031d@huawei.com>
Date: Wed, 16 Oct 2024 17:20:51 +0800
From: Yunsheng Lin <linyunsheng@...wei.com>
To: Praveen Kaligineedi <pkaligineedi@...gle.com>, <netdev@...r.kernel.org>
CC: <davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
<pabeni@...hat.com>, <willemb@...gle.com>, <jeroendb@...gle.com>,
<shailend@...gle.com>, <hramamurthy@...gle.com>, <ziweixiao@...gle.com>,
<shannon.nelson@....com>, <jacob.e.keller@...el.com>
Subject: Re: [PATCH net-next v3 2/3] gve: adopt page pool for DQ RDA mode
On 2024/10/15 4:21, Praveen Kaligineedi wrote:
...
> +void gve_free_to_page_pool(struct gve_rx_ring *rx,
> + struct gve_rx_buf_state_dqo *buf_state,
> + bool allow_direct)
> +{
> + struct page *page = buf_state->page_info.page;
> +
> + if (!page)
> + return;
> +
> + page_pool_put_page(page->pp, page, buf_state->page_info.buf_size,
> + allow_direct);
page_pool_put_full_page() might be a better option here for now when
page_pool is created with PP_FLAG_DMA_SYNC_DEV flag and frag API like
page_pool_alloc() is used in gve_alloc_from_page_pool(), as explained
in below:
https://lore.kernel.org/netdev/20241014143542.000028dc@gmail.com/T/#mdaba23284a37affc2c46ef846674ae6aa49f8f04
> + buf_state->page_info.page = NULL;
> +}
> +
> +static int gve_alloc_from_page_pool(struct gve_rx_ring *rx,
> + struct gve_rx_buf_state_dqo *buf_state)
> +{
> + struct gve_priv *priv = rx->gve;
> + struct page *page;
> +
> + buf_state->page_info.buf_size = priv->data_buffer_size_dqo;
> + page = page_pool_alloc(rx->dqo.page_pool,
> + &buf_state->page_info.page_offset,
> + &buf_state->page_info.buf_size, GFP_ATOMIC);
> +
> + if (!page)
> + return -ENOMEM;
> +
> + buf_state->page_info.page = page;
> + buf_state->page_info.page_address = page_address(page);
> + buf_state->addr = page_pool_get_dma_addr(page);
> +
> + return 0;
> +}
> +
> +struct page_pool *gve_rx_create_page_pool(struct gve_priv *priv,
> + struct gve_rx_ring *rx)
> +{
> + u32 ntfy_id = gve_rx_idx_to_ntfy(priv, rx->q_num);
> + struct page_pool_params pp = {
> + .flags = PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV,
> + .order = 0,
> + .pool_size = GVE_PAGE_POOL_SIZE_MULTIPLIER * priv->rx_desc_cnt,
> + .dev = &priv->pdev->dev,
> + .netdev = priv->dev,
> + .napi = &priv->ntfy_blocks[ntfy_id].napi,
> + .max_len = PAGE_SIZE,
> + .dma_dir = DMA_FROM_DEVICE,
> + };
> +
> + return page_pool_create(&pp);
> +}
> +
Powered by blists - more mailing lists