net: fec: add XDP_TX feature support
Subsystems (4)
Wei Fang
maintainerPATCH v4 1/1 net: fec: add XDP_TX feature support
The XDP_TX feature is not supported before, and all the frames which are deemed to do XDP_TX action actually do the XDP_DROP action. So this patch adds the XDP_TX support to FEC driver.
I tested the performance of XDP_TX feature in XDP_DRV and XDP_SKB modes on i.MX8MM-EVK and i.MX8MP-EVK platforms respectively, and the test steps and results are as follows.
Step 1: Board A connects to the FEC port of the DUT and runs the pktgen_sample03_burst_single_flow.sh script to generate and send burst traffic to DUT. Note that the length of packet was set to 64 bytes and the procotol of packet was UDP in my test scenario.
Step 2: The DUT runs the xdp2 program to transmit received UDP packets back out on the same port where they were received.
root@imx8mmevk:~# ./xdp2 eth0 proto 17: 150326 pkt/s proto 17: 141920 pkt/s proto 17: 147338 pkt/s proto 17: 140783 pkt/s proto 17: 150400 pkt/s proto 17: 134651 pkt/s proto 17: 134676 pkt/s proto 17: 134959 pkt/s proto 17: 148152 pkt/s proto 17: 149885 pkt/s
root@imx8mmevk:~# ./xdp2 -S eth0 proto 17: 131094 pkt/s proto 17: 134691 pkt/s proto 17: 138930 pkt/s proto 17: 129347 pkt/s proto 17: 133050 pkt/s proto 17: 132932 pkt/s proto 17: 136628 pkt/s proto 17: 132964 pkt/s proto 17: 131265 pkt/s proto 17: 135794 pkt/s
root@imx8mpevk:~# ./xdp2 eth0 proto 17: 135817 pkt/s proto 17: 142776 pkt/s proto 17: 142237 pkt/s proto 17: 135673 pkt/s proto 17: 139508 pkt/s proto 17: 147340 pkt/s proto 17: 133329 pkt/s proto 17: 141171 pkt/s proto 17: 146917 pkt/s proto 17: 135488 pkt/s
root@imx8mpevk:~# ./xdp2 -S eth0 proto 17: 133150 pkt/s proto 17: 133127 pkt/s proto 17: 133538 pkt/s proto 17: 133094 pkt/s proto 17: 133690 pkt/s proto 17: 133199 pkt/s proto 17: 133905 pkt/s proto 17: 132908 pkt/s proto 17: 133292 pkt/s proto 17: 133511 pkt/s
---
V2 changes:
According to Jakub's comments, the V2 patch adds two changes.
1. Call txq_trans_cond_update() in fec_enet_xdp_tx_xmit() to avoid tx timeout as XDP shares the queues with kernel stack.
2. Tx processing shouldn't call any XDP (or page pool) APIs if the "budget" is 0.
V3 changes:
1. Remove the second change in V2, because this change has been separated into another patch and it has been submmitted to the upstream [1].
[1] https://lore.kernel.org/r/[email protected]
V4 changes:
1. Based on Jakub's comments, add trace_xdp_exception() for the error path of XDP_TX.
--- drivers/net/ethernet/freescale/fec.h | 1 + drivers/net/ethernet/freescale/fec_main.c | 82 ++++++++++++++++++----- 2 files changed, 67 insertions(+), 16 deletions(-)
drivers/net/ethernet/freescale/fec.h +1 -0
@@ -547,6 +547,7 @@ enum {enum fec_txbuf_type {FEC_TXBUF_T_SKB ,FEC_TXBUF_T_XDP_NDO , +FEC_TXBUF_T_XDP_TX , };struct fec_tx_buffer {
drivers/net/ethernet/freescale/fec_main.c +66 -16
149 lines not on this page · raw message
Signature · 1 line
2.25.1
Jakub Kicinski
maintainerQuoted 7 lines · On Wed, 2 Aug 2023 10:48:57 +0800 Wei Fang wrote:
The
XDP_TXfeature is not supported before, and all the frames which are deemed to doXDP_TXaction actually do theXDP_DROPaction. So this patch adds theXDP_TXsupport to FEC driver.I tested the performance of
XDP_TXfeature inXDP_DRVandXDP_SKBmodes on i.MX8MM-EVK and i.MX8MP-EVK platforms respectively, and the test steps and results are as follows.
There were changes requested on v3, so marking it as
pw-bot: changes-requested