lkml.org 
[lkml]   [2024]   [Apr]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH net-next v8 3/3] net: ethernet: ti: am65-cpsw: Add minimal XDP support
On Mon, 08 Apr 2024 11:38:04 +0200 Julien Panis wrote:
> +static struct sk_buff *am65_cpsw_alloc_skb(struct am65_cpsw_rx_chn *rx_chn,
> + struct net_device *ndev,
> + unsigned int len,
> + int desc_idx,
> + bool allow_direct)
> +{
> + struct sk_buff *skb;
> + struct page *page;
> +
> + page = page_pool_dev_alloc_pages(rx_chn->page_pool);
> + if (unlikely(!page))
> + return NULL;
> +
> + len += AM65_CPSW_HEADROOM;
> +
> + skb = build_skb(page_address(page), len);

You shouldn't build the skb upfront any more. Give the page to the HW,
once HW sends you a completion - build the skbs. If build fails
(allocation failure) just give the page back to HW. If it succeeds,
however, you'll get a skb which is far more likely to be cache hot.

> + if (unlikely(!skb)) {
> + page_pool_put_full_page(rx_chn->page_pool, page, allow_direct);
> + rx_chn->pages[desc_idx] = NULL;
> + return NULL;
> + }

\
 
 \ /
  Last update: 2024-05-27 16:32    [W:0.106 / U:1.860 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site