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;
- }
linaro-mm-sig@lists.linaro.org