Re: [PATCH net-next v5 3/3] net: ethernet: ti: am65-cpsw: Add minimal XDP support

From: Julien Panis
Date: Thu Mar 28 2024 - 08:34:36 EST


On 3/28/24 12:42, Ratheesh Kannoth wrote:
On 2024-03-28 at 14:56:42, Julien Panis (jpanis@xxxxxxxxxxxx) wrote:
This patch adds XDP (eXpress Data Path) support to TI AM65 CPSW
Ethernet driver. The following features are implemented:
- NETDEV_XDP_ACT_BASIC (XDP_PASS, XDP_TX, XDP_DROP, XDP_ABORTED)
- NETDEV_XDP_ACT_REDIRECT (XDP_REDIRECT)
- NETDEV_XDP_ACT_NDO_XMIT (ndo_xdp_xmit callback)

The page pool memory model is used to get better performance.
Below are benchmark results obtained for the receiver with iperf3 default
parameters:
- Without page pool: 495 Mbits/sec
- With page pool: 505 Mbits/sec (actually 510 Mbits/sec, with a 5 Mbits/sec
loss due to extra processing in the hot path to handle XDP).

Signed-off-by: Julien Panis <jpanis@xxxxxxxxxxxx>
---

[...]

+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)
+{
+ 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);
+ if (unlikely(!skb)) {
+ page_pool_put_full_page(rx_chn->page_pool, page, ndev);
Is it compiling ? third argument should be a bool.

Thank you for the time you spent on this patch.

Yes, it is compiling.
This was intentional but it may be unclear indeed.
I'll make the bool using more explicit in next version.