lkml.org 
[lkml]   [2023]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V3,net-next, 2/4] net: mana: Refactor RX buffer allocation code to prepare for various MTU
On Wed, Apr 12, 2023 at 02:16:01PM -0700, Haiyang Zhang wrote:
> Move out common buffer allocation code from mana_process_rx_cqe() and
> mana_alloc_rx_wqe() to helper functions.
> Refactor related variables so they can be changed in one place, and buffer
> sizes are in sync.
>
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
> ---
> V3:
> Refectored to multiple patches for readability. Suggested by Jacob Keller.
>
> V2:
> Refectored to multiple patches for readability. Suggested by Yunsheng Lin.
>
> ---
> drivers/net/ethernet/microsoft/mana/mana_en.c | 154 ++++++++++--------
> include/net/mana/mana.h | 6 +-
> 2 files changed, 91 insertions(+), 69 deletions(-)

<...>

> +static void *mana_get_rxfrag(struct mana_rxq *rxq, struct device *dev,
> + dma_addr_t *da, bool is_napi)
> +{
> + struct page *page;
> + void *va;
> +
> + /* Reuse XDP dropped page if available */
> + if (rxq->xdp_save_va) {
> + va = rxq->xdp_save_va;
> + rxq->xdp_save_va = NULL;
> + } else {
> + page = dev_alloc_page();

Documentation/networking/page_pool.rst
10 Basic use involves replacing alloc_pages() calls with the
11 page_pool_alloc_pages() call. Drivers should use page_pool_dev_alloc_pages()
12 replacing dev_alloc_pages().

General question, is this sentence applicable to all new code or only
for XDP related paths?

Thanks

\
 
 \ /
  Last update: 2023-04-13 19:06    [W:0.416 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site