[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+f9V1MZWkWmVHruHgJC1hqepi-CTLDvGjtkd3CGaCiUR-kF5Q@mail.gmail.com>
Date: Wed, 16 Oct 2024 12:43:27 -0700
From: Praveen Kaligineedi <pkaligineedi@...gle.com>
To: Yunsheng Lin <linyunsheng@...wei.com>
Cc: netdev@...r.kernel.org, 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
Thanks Yunsheng. One thing that's not clear to me - the GVE driver
does not call page_pool_put_page with dma_sync_size of 0 anywhere. Is
this still an issue in that case?
Thanks,
Praveen
On Wed, Oct 16, 2024 at 2:21 AM Yunsheng Lin <linyunsheng@...wei.com> wrote:
>
> 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