[PATCH net-next v2 0/7] net: ethernet: ti: am65-cpsw: add AF_XDP zero copy support

Roger Quadros posted 7 patches 1 month, 1 week ago
drivers/net/ethernet/ti/Makefile         |   2 +-
drivers/net/ethernet/ti/am65-cpsw-nuss.c | 583 ++++++++++++++++++++++++++-----
drivers/net/ethernet/ti/am65-cpsw-nuss.h |  37 +-
drivers/net/ethernet/ti/am65-cpsw-xdp.c  | 155 ++++++++
4 files changed, 692 insertions(+), 85 deletions(-)
[PATCH net-next v2 0/7] net: ethernet: ti: am65-cpsw: add AF_XDP zero copy support
Posted by Roger Quadros 1 month, 1 week ago
This series adds AF_XDP zero coppy support to am65-cpsw driver.

Tests were performed on AM62x-sk with xdpsock application [1].

A clear improvement is seen in 64 byte packets on Transmit (txonly)
and receive (rxdrop).
1500 byte test seems to be limited by line rate (1G link) so no
improvement seen there in packet rate. A test on higher speed link
(or PHY-less setup) might be worthwile.

There is some issue during l2fwd with 64 byte packets and benchmark
results show 0. This issue needs to be debugged further.
A 512 byte l2fwd test result has been added to compare instead.

AF_XDP performance using 64 byte packets in Kpps.
Benchmark:	XDP-SKB		XDP-Native	XDP-Native(ZeroCopy)
rxdrop		322		491		845
txonly		390		394		723
l2fwd 		205		257		0

AF_XDP performance using 512 byte packets in Kpps.
l2fwd		140		167		231

AF_XDP performance using 1500 byte packets in Kpps.
Benchmark:	XDP-SKB		XDP-Native	XDP-Native(ZeroCopy)
rxdrop		82		82		82
txonly		82		82		82
l2fwd 		82		82		82

[1]: https://github.com/xdp-project/bpf-examples/tree/master/AF_XDP-example

Signed-off-by: Roger Quadros <rogerq@kernel.org>
---
Changes in v2:
- Prevent crash on systems with 1 of 2 ports disabled in device tree. check
  for valid ndev before registering/unregistering XDP RXQ.
  Reported-by: Meghana Malladi <m-malladi@ti.com>
- Retain page pool on XDP program exchangae so we don't have to re-alloacate
  memory.
- Fix clearing of irq_disabled flag in am65_cpsw_nuss_rx_poll().
- Link to v1: https://lore.kernel.org/r/20250520-am65-cpsw-xdp-zc-v1-0-45558024f566@kernel.org

---
Roger Quadros (7):
      net: ethernet: ti: am65-cpsw: fix BPF Program change on multi-port CPSW
      net: ethernet: ti: am65-cpsw: Retain page_pool on XDP program exchange
      net: ethernet: ti: am65-cpsw: add XSK pool helpers
      net: ethernet: ti: am65-cpsw: Add AF_XDP zero copy for RX
      net: ethernet: ti: am65-cpsw: Add AF_XDP zero copy for TX
      net: ethernet: ti: am65-cpsw: enable zero copy in XDP features
      net: ethernet: ti: am65-cpsw: Fix clearing of irq_disabled flag in rx_poll

 drivers/net/ethernet/ti/Makefile         |   2 +-
 drivers/net/ethernet/ti/am65-cpsw-nuss.c | 583 ++++++++++++++++++++++++++-----
 drivers/net/ethernet/ti/am65-cpsw-nuss.h |  37 +-
 drivers/net/ethernet/ti/am65-cpsw-xdp.c  | 155 ++++++++
 4 files changed, 692 insertions(+), 85 deletions(-)
---
base-commit: a0c3aefb08cd81864b17c23c25b388dba90b9dad
change-id: 20250225-am65-cpsw-xdp-zc-2af9e4be1356

Best regards,
-- 
Roger Quadros <rogerq@kernel.org>
Re: [EXTERNAL] [PATCH net-next v2 0/7] net: ethernet: ti: am65-cpsw: add AF_XDP zero copy support
Posted by Meghana Malladi 1 month ago
Hi Roger,

On 11/10/25 03:07, Roger Quadros wrote:
> This series adds AF_XDP zero coppy support to am65-cpsw driver. Tests 
> were performed on AM62x-sk with xdpsock application [1]. A clear 
> improvement is seen in 64 byte packets on Transmit (txonly) and receive 
> (rxdrop). 1500 byte test seems to
> ZjQcmQRYFpfptBannerStart
> This message was sent from outside of Texas Instruments.
> Do not click links or open attachments unless you recognize the source 
> of this email and know the content is safe.
> Report Suspicious
> <https://us-phishalarm-ewt.proofpoint.com/EWT/v1/G3vK! 
> u7dqXRfP1k07KyXOF3NDf8vo0my_AFaH4vPAPLVnKCsqFWj_bXKNsRmhTJBE82Rrr_w736hROV-tgpjEGb6O7cQAClKjG9x9il73ZT70$>
> ZjQcmQRYFpfptBannerEnd
> 
> This series adds AF_XDP zero coppy support to am65-cpsw driver.
> 
> Tests were performed on AM62x-sk with xdpsock application [1].
> 
> A clear improvement is seen in 64 byte packets on Transmit (txonly)
> and receive (rxdrop).
> 1500 byte test seems to be limited by line rate (1G link) so no
> improvement seen there in packet rate. A test on higher speed link
> (or PHY-less setup) might be worthwile.
> 
> There is some issue during l2fwd with 64 byte packets and benchmark
> results show 0. This issue needs to be debugged further.
> A 512 byte l2fwd test result has been added to compare instead.
> 
> AF_XDP performance using 64 byte packets in Kpps.
> Benchmark:	XDP-SKB		XDP-Native	XDP-Native(ZeroCopy)
> rxdrop		322		491		845
> txonly		390		394		723
> l2fwd 		205		257		0
> 
> AF_XDP performance using 512 byte packets in Kpps.
> l2fwd		140		167		231
> 
> AF_XDP performance using 1500 byte packets in Kpps.
> Benchmark:	XDP-SKB		XDP-Native	XDP-Native(ZeroCopy)
> rxdrop		82		82		82
> txonly		82		82		82
> l2fwd 		82		82		82
> 
> [1]:https://urldefense.com/v3/__https://github.com/xdp-project/bpf-examples/ 
> tree/master/AF_XDP-example__;!!G3vK! 
> SX4J82NfOn_sfwizSTYO-8W3GRuffFIHyCngO1J2CT4Alea18pIGiBI4l5XKFKVUbxESDgb4GkCb$ <https://urldefense.com/v3/__https://github.com/xdp-project/bpf-examples/tree/master/AF_XDP-example__;!!G3vK!SX4J82NfOn_sfwizSTYO-8W3GRuffFIHyCngO1J2CT4Alea18pIGiBI4l5XKFKVUbxESDgb4GkCb$>
> 
> Signed-off-by: Roger Quadros <rogerq@kernel.org>

After applying this series patches, I tried booting am64xx-hsevm in 
prueth dual-emac mode by applying k3-am642-evm-icssg1-dualemac.dtbo 
overlay, and I am getting the following kernel crash: 
https://gist.github.com/MeghanaMalladiTI/784fd2262d95b19fe9573c553c4a6a24

Can you please take a look at this.

> ---
> Changes in v2:
> - Prevent crash on systems with 1 of 2 ports disabled in device tree. check
>    for valid ndev before registering/unregistering XDP RXQ.
>    Reported-by: Meghana Malladi <m-malladi@ti.com>
> - Retain page pool on XDP program exchangae so we don't have to re-alloacate
>    memory.
> - Fix clearing of irq_disabled flag in am65_cpsw_nuss_rx_poll().
> - Link to v1:https://urldefense.com/v3/__https://lore.kernel.org/r/20250520-am65- 
> cpsw-xdp-zc-v1-0-45558024f566@kernel.org__;!!G3vK! 
> SX4J82NfOn_sfwizSTYO-8W3GRuffFIHyCngO1J2CT4Alea18pIGiBI4l5XKFKVUbxESDgAECR9g$ <https://urldefense.com/v3/__https://lore.kernel.org/r/20250520-am65-cpsw-xdp-zc-v1-0-45558024f566@kernel.org__;!!G3vK!SX4J82NfOn_sfwizSTYO-8W3GRuffFIHyCngO1J2CT4Alea18pIGiBI4l5XKFKVUbxESDgAECR9g$>
> 
> ---
> Roger Quadros (7):
>        net: ethernet: ti: am65-cpsw: fix BPF Program change on multi-port CPSW
>        net: ethernet: ti: am65-cpsw: Retain page_pool on XDP program exchange
>        net: ethernet: ti: am65-cpsw: add XSK pool helpers
>        net: ethernet: ti: am65-cpsw: Add AF_XDP zero copy for RX
>        net: ethernet: ti: am65-cpsw: Add AF_XDP zero copy for TX
>        net: ethernet: ti: am65-cpsw: enable zero copy in XDP features
>        net: ethernet: ti: am65-cpsw: Fix clearing of irq_disabled flag in rx_poll
> 
>   drivers/net/ethernet/ti/Makefile         |   2 +-
>   drivers/net/ethernet/ti/am65-cpsw-nuss.c | 583 ++++++++++++++++++++++++++-----
>   drivers/net/ethernet/ti/am65-cpsw-nuss.h |  37 +-
>   drivers/net/ethernet/ti/am65-cpsw-xdp.c  | 155 ++++++++
>   4 files changed, 692 insertions(+), 85 deletions(-)
> ---
> base-commit: a0c3aefb08cd81864b17c23c25b388dba90b9dad
> change-id: 20250225-am65-cpsw-xdp-zc-2af9e4be1356
> 
> Best regards,
> -- 
> Roger Quadros <rogerq@kernel.org>
> 

Re: [PATCH net-next v2 0/7] net: ethernet: ti: am65-cpsw: add AF_XDP zero copy support
Posted by Jakub Kicinski 1 month, 1 week ago
On Sun, 09 Nov 2025 23:37:50 +0200 Roger Quadros wrote:
> This series adds AF_XDP zero coppy support to am65-cpsw driver.
> 
> Tests were performed on AM62x-sk with xdpsock application [1].
> 
> A clear improvement is seen in 64 byte packets on Transmit (txonly)
> and receive (rxdrop).
> 1500 byte test seems to be limited by line rate (1G link) so no
> improvement seen there in packet rate. A test on higher speed link
> (or PHY-less setup) might be worthwile.
> 
> There is some issue during l2fwd with 64 byte packets and benchmark
> results show 0. This issue needs to be debugged further.
> A 512 byte l2fwd test result has been added to compare instead.

It appears that the drivers/net/ethernet/ti/am65-* files do not fall
under any MAINTAINERS entry. Please add one or extend the existing CPSW
entry as the first patch of the series.
Re: [PATCH net-next v2 0/7] net: ethernet: ti: am65-cpsw: add AF_XDP zero copy support
Posted by Chintan Vankar 1 month ago
Hello Jakub,

On 12/11/25 06:48, Jakub Kicinski wrote:
> On Sun, 09 Nov 2025 23:37:50 +0200 Roger Quadros wrote:
>> This series adds AF_XDP zero coppy support to am65-cpsw driver.
>>
>> Tests were performed on AM62x-sk with xdpsock application [1].
>>
>> A clear improvement is seen in 64 byte packets on Transmit (txonly)
>> and receive (rxdrop).
>> 1500 byte test seems to be limited by line rate (1G link) so no
>> improvement seen there in packet rate. A test on higher speed link
>> (or PHY-less setup) might be worthwile.
>>
>> There is some issue during l2fwd with 64 byte packets and benchmark
>> results show 0. This issue needs to be debugged further.
>> A 512 byte l2fwd test result has been added to compare instead.
> 
> It appears that the drivers/net/ethernet/ti/am65-* files do not fall
> under any MAINTAINERS entry. Please add one or extend the existing CPSW
> entry as the first patch of the series.
> 

I am mainly working on am65-cpsw-nuss.c driver and volunteering myself
to be the MAINTAINER of am65-cpsw-nuss.c and other CPSW drivers.

Regards,
Chintan.
Re: [EXTERNAL] [PATCH net-next v2 0/7] net: ethernet: ti: am65-cpsw: add AF_XDP zero copy support
Posted by Meghana Malladi 4 weeks, 1 day ago
Hi Roger,

On 11/10/25 03:07, Roger Quadros wrote:
> This series adds AF_XDP zero coppy support to am65-cpsw driver. Tests 
> were performed on AM62x-sk with xdpsock application [1]. A clear 
> improvement is seen in 64 byte packets on Transmit (txonly) and receive 
> (rxdrop). 1500 byte test seems to
> ZjQcmQRYFpfptBannerStart
> This message was sent from outside of Texas Instruments.
> Do not click links or open attachments unless you recognize the source 
> of this email and know the content is safe.
> Report Suspicious
> <https://us-phishalarm-ewt.proofpoint.com/EWT/v1/G3vK! 
> u7dqXRfP1k07KyXOF3NDf8vo0my_AFaH4vPAPLVnKCsqFWj_bXKNsRmhTJBE82Rrr_w736hROV-tgpjEGb6O7cQAClKjG9x9il73ZT70$>
> ZjQcmQRYFpfptBannerEnd
> 
> This series adds AF_XDP zero coppy support to am65-cpsw driver.
> 
> Tests were performed on AM62x-sk with xdpsock application [1].
> 
> A clear improvement is seen in 64 byte packets on Transmit (txonly)
> and receive (rxdrop).
> 1500 byte test seems to be limited by line rate (1G link) so no
> improvement seen there in packet rate. A test on higher speed link
> (or PHY-less setup) might be worthwile.
> 
> There is some issue during l2fwd with 64 byte packets and benchmark
> results show 0. This issue needs to be debugged further.
> A 512 byte l2fwd test result has been added to compare instead.
> 
> AF_XDP performance using 64 byte packets in Kpps.
> Benchmark:	XDP-SKB		XDP-Native	XDP-Native(ZeroCopy)
> rxdrop		322		491		845
> txonly		390		394		723
> l2fwd 		205		257		0
> 
> AF_XDP performance using 512 byte packets in Kpps.
> l2fwd		140		167		231
> 
> AF_XDP performance using 1500 byte packets in Kpps.
> Benchmark:	XDP-SKB		XDP-Native	XDP-Native(ZeroCopy)
> rxdrop		82		82		82
> txonly		82		82		82
> l2fwd 		82		82		82
> 
> [1]:https://urldefense.com/v3/__https://github.com/xdp-project/bpf-examples/ 
> tree/master/AF_XDP-example__;!!G3vK! 
> SX4J82NfOn_sfwizSTYO-8W3GRuffFIHyCngO1J2CT4Alea18pIGiBI4l5XKFKVUbxESDgb4GkCb$ <https://urldefense.com/v3/__https://github.com/xdp-project/bpf-examples/tree/master/AF_XDP-example__;!!G3vK!SX4J82NfOn_sfwizSTYO-8W3GRuffFIHyCngO1J2CT4Alea18pIGiBI4l5XKFKVUbxESDgb4GkCb$>
> 
> Signed-off-by: Roger Quadros <rogerq@kernel.org>
> ---

This series causes nfs boot failure for am62lxx-evm:
https://gist.github.com/MeghanaMalladiTI/dda232ebe6c24554e933085513ce8b33

Due to descriptor leakage during Rx teardown. I have faced similar 
problem in ICSSG and a fix similar to this is needed for CPSW as well. 
Please incorporate this fix as well in your v3: 
https://gist.github.com/MeghanaMalladiTI/c5467e2a5c9d4ebdc5e71e3720b6524d

> Changes in v2:
> - Prevent crash on systems with 1 of 2 ports disabled in device tree. check
>    for valid ndev before registering/unregistering XDP RXQ.
>    Reported-by: Meghana Malladi <m-malladi@ti.com>
> - Retain page pool on XDP program exchangae so we don't have to re-alloacate
>    memory.
> - Fix clearing of irq_disabled flag in am65_cpsw_nuss_rx_poll().
> - Link to v1:https://urldefense.com/v3/__https://lore.kernel.org/r/20250520-am65- 
> cpsw-xdp-zc-v1-0-45558024f566@kernel.org__;!!G3vK! 
> SX4J82NfOn_sfwizSTYO-8W3GRuffFIHyCngO1J2CT4Alea18pIGiBI4l5XKFKVUbxESDgAECR9g$ <https://urldefense.com/v3/__https://lore.kernel.org/r/20250520-am65-cpsw-xdp-zc-v1-0-45558024f566@kernel.org__;!!G3vK!SX4J82NfOn_sfwizSTYO-8W3GRuffFIHyCngO1J2CT4Alea18pIGiBI4l5XKFKVUbxESDgAECR9g$>
> 
> ---
> Roger Quadros (7):
>        net: ethernet: ti: am65-cpsw: fix BPF Program change on multi-port CPSW
>        net: ethernet: ti: am65-cpsw: Retain page_pool on XDP program exchange
>        net: ethernet: ti: am65-cpsw: add XSK pool helpers
>        net: ethernet: ti: am65-cpsw: Add AF_XDP zero copy for RX
>        net: ethernet: ti: am65-cpsw: Add AF_XDP zero copy for TX
>        net: ethernet: ti: am65-cpsw: enable zero copy in XDP features
>        net: ethernet: ti: am65-cpsw: Fix clearing of irq_disabled flag in rx_poll
> 
>   drivers/net/ethernet/ti/Makefile         |   2 +-
>   drivers/net/ethernet/ti/am65-cpsw-nuss.c | 583 ++++++++++++++++++++++++++-----
>   drivers/net/ethernet/ti/am65-cpsw-nuss.h |  37 +-
>   drivers/net/ethernet/ti/am65-cpsw-xdp.c  | 155 ++++++++
>   4 files changed, 692 insertions(+), 85 deletions(-)
> ---
> base-commit: a0c3aefb08cd81864b17c23c25b388dba90b9dad
> change-id: 20250225-am65-cpsw-xdp-zc-2af9e4be1356
> 
> Best regards,
> -- 
> Roger Quadros <rogerq@kernel.org>
>