net: fec: add XDP_TX feature support
Subsystems (4)
Wei Fang
maintainerPATCH 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 eth 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
--- drivers/net/ethernet/freescale/fec.h | 1 + drivers/net/ethernet/freescale/fec_main.c | 81 ++++++++++++++++++----- 2 files changed, 66 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 +65 -16
142 lines not on this page · raw message
Signature · 1 line
2.25.1
From: Wei Fang <[email protected]>
Date: Mon, 17 Jul 2023 18:37:09 +0800
Quoted 3 lines
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.
[...]
drivers/net/ethernet/freescale/fec_main.c static int fec_enet_txq_xmit_frame(struct fec_enet_private *fep, · line 3929
Quoted 8 lines
drivers/net/ethernet/freescale/fec_main.c +4
-0@@ -3897,6 +3923,29 @@ static int fec_enet_txq_xmit_frame(struct fec_enet_private *fep,return 0 ; } +static int fec_enet_xdp_tx_xmit (struct net_device *ndev, +struct xdp_buff *xdp) +{ +struct xdp_frame *xdpf =xdp_convert_buff_to_frame (xdp);
Have you tried avoid converting buff to frame in case of XDP_TX? It would save you a bunch of CPU cycles.
Quoted 23 lines
drivers/net/ethernet/freescale/fec_main.c +19
-0+struct fec_enet_private *fep =netdev_priv (ndev); +struct fec_enet_priv_tx_q *txq; +int cpu =smp_processor_id (); +struct netdev_queue *nq; +int queue, ret; + + queue =fec_enet_xdp_get_tx_queue (fep, cpu); + txq = fep->tx_queue[queue]; + nq =netdev_get_tx_queue (fep->netdev, queue); + +__netif_tx_lock (nq, cpu); + + ret =fec_enet_txq_xmit_frame (fep, txq, xdpf, false); + +__netif_tx_unlock (nq); + +return ret; +} + static int fec_enet_xdp_xmit(struct net_device *dev, int num_frames, struct xdp_frame **frames,
drivers/net/ethernet/freescale/fec_main.c static int fec_enet_xdp_xmit(struct net_device *dev, · line 3972
Quoted 8 lines
drivers/net/ethernet/freescale/fec_main.c +1
-1@@ -3917,7 +3966,7 @@ static int fec_enet_xdp_xmit(struct net_device *dev,__netif_tx_lock (nq, cpu);for (i =0 ; i < num_frames; i++) { -if (fec_enet_txq_xmit_frame (fep, txq, frames[i]) <0 ) +if (fec_enet_txq_xmit_frame (fep, txq, frames[i], true) <0 )break ; sent_frames++; }
Thanks,
Olek
Wei Fang
maintainerQuoted 26 lines
-----Original Message-----
From: Alexander Lobakin <[email protected]>
Sent: 2023年7月18日 23:15
To: Wei Fang <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Clark Wang <[email protected]>; Shenwei Wang <[email protected]>; [email protected]; dl-linux-imx <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH net-next] net: fec: addXDP_TXfeature supportFrom: Wei Fang <[email protected]>
Date: Mon, 17 Jul 2023 18:37:09 +0800Quoted 3 lines
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.[...]
Review static int fec_enet_txq_xmit_frame(struct
Quoted 1 line
(quoted diff) +0
-0@@ -3897,6 +3923,29 @@ static int fec_enet_txq_xmit_frame(struct
fec_enet_private*fep,Quoted 3 lines
drivers/net/ethernet/freescale/fec_main.c +0
-0return 0 ; }
Quoted 8 lines
drivers/net/ethernet/freescale/fec_main.c static int fec_enet_txq_xmit_frame(struct fec_enet_private *fep, · line 3929
Quoted 4 lines
drivers/net/ethernet/freescale/fec_main.c +4
-0+static int fec_enet_xdp_tx_xmit (struct net_device *ndev, +struct xdp_buff *xdp) +{ +struct xdp_frame *xdpf =xdp_convert_buff_to_frame (xdp);Have you tried avoid converting buff to frame in case of
XDP_TX? It would save you a bunch of CPU cycles.
Sorry, I haven't. I referred to several ethernet drivers about the implementation of XDP_TX. Most drivers adopt the method of converting xdp_buff to xdp_frame, and in this method, I can reuse the existing interface fec_enet_txq_xmit_frame() to transmit the frames and the implementation is relatively simple. Otherwise, there will be more changes and more effort is needed to implement this feature. Thanks!
Quoted 33 lines
drivers/net/ethernet/freescale/fec_main.c static int fec_enet_xdp_xmit(struct net_device
Quoted 23 lines
drivers/net/ethernet/freescale/fec_main.c +19
-0+struct fec_enet_private *fep =netdev_priv (ndev); +struct fec_enet_priv_tx_q *txq; +int cpu =smp_processor_id (); +struct netdev_queue *nq; +int queue, ret; + + queue =fec_enet_xdp_get_tx_queue (fep, cpu); + txq = fep->tx_queue[queue]; + nq =netdev_get_tx_queue (fep->netdev, queue); + +__netif_tx_lock (nq, cpu); + + ret =fec_enet_txq_xmit_frame (fep, txq, xdpf, false); + +__netif_tx_unlock (nq); + +return ret; +} + static int fec_enet_xdp_xmit(struct net_device *dev, int num_frames, struct xdp_frame **frames,@@ -3917,7 +3966,7 @@ static int fec_enet_xdp_xmit(struct net_device*dev,
Quoted 8 lines
drivers/net/ethernet/freescale/fec_main.c +1
-1__netif_tx_lock (nq, cpu);for (i =0 ; i < num_frames; i++) { -if (fec_enet_txq_xmit_frame (fep, txq, frames[i]) <0 ) +if (fec_enet_txq_xmit_frame (fep, txq, frames[i], true) <0 )break ; sent_frames++; }
From: Wei Fang <[email protected]>
Date: Wed, 19 Jul 2023 03:28:26 +0000
Quoted 34 lines
Quoted 26 lines
-----Original Message-----
From: Alexander Lobakin <[email protected]>
Sent: 2023年7月18日 23:15
To: Wei Fang <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Clark Wang <[email protected]>; Shenwei Wang <[email protected]>; [email protected]; dl-linux-imx <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH net-next] net: fec: addXDP_TXfeature supportFrom: Wei Fang <[email protected]>
Date: Mon, 17 Jul 2023 18:37:09 +0800Quoted 3 lines
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.[...]
Review static int fec_enet_txq_xmit_frame(struct
Quoted 1 line
(quoted diff) +0
-0@@ -3897,6 +3923,29 @@ static int fec_enet_txq_xmit_frame(struct
fec_enet_private*fep,Quoted 3 lines
drivers/net/ethernet/freescale/fec_main.c +0
-0return 0 ; }Quoted 8 lines
drivers/net/ethernet/freescale/fec_main.c static int fec_enet_txq_xmit_frame(struct fec_enet_private *fep, · line 3929
Quoted 4 lines
drivers/net/ethernet/freescale/fec_main.c +4
-0+static int fec_enet_xdp_tx_xmit (struct net_device *ndev, +struct xdp_buff *xdp) +{ +struct xdp_frame *xdpf =xdp_convert_buff_to_frame (xdp);Have you tried avoid converting buff to frame in case of
XDP_TX? It would save you a bunch of CPU cycles.
Quoted 6 lines
Sorry, I haven't. I referred to several ethernet drivers about the implementation of
XDP_TX. Most drivers adopt the method of convertingxdp_bufftoxdp_frame, and in this method, I can reuse the existing interfacefec_enet_txq_xmit_frame()to transmit the frames and the implementation is relatively simple. Otherwise, there will be more changes and more effort is needed to implement this feature. Thanks!
No problem, it is just FYI, as we observe worse performance when convert_buff_to_frame() is used for XDP_TX versus when you transmit the xdp_buff directly. The main reason is that converting to XDP frame touches ->data_hard_start cacheline (usually untouched), while xdp_buff is always on the stack and hot.
It is up to you what to pick for your driver obviously :)
Quoted 27 lines
Quoted 27 lines
drivers/net/ethernet/freescale/fec_main.c static int fec_enet_xdp_xmit(struct net_device
Quoted 24 lines
drivers/net/ethernet/freescale/fec_main.c +19
-0+struct fec_enet_private *fep =netdev_priv (ndev); +struct fec_enet_priv_tx_q *txq; +int cpu =smp_processor_id (); +struct netdev_queue *nq; +int queue, ret; + + queue =fec_enet_xdp_get_tx_queue (fep, cpu); + txq = fep->tx_queue[queue]; + nq =netdev_get_tx_queue (fep->netdev, queue); + +__netif_tx_lock (nq, cpu); + + ret =fec_enet_txq_xmit_frame (fep, txq, xdpf, false); + +__netif_tx_unlock (nq); + +return ret; +} + static int fec_enet_xdp_xmit(struct net_device *dev, int num_frames, struct xdp_frame **frames,@@ -3917,7 +3966,7 @@ static int fec_enet_xdp_xmit(struct net_device*dev,
Quoted 2 lines
drivers/net/ethernet/freescale/fec_main.c +0
-0__netif_tx_lock (nq, cpu);
Quoted 8 lines
Quoted 7 lines
drivers/net/ethernet/freescale/fec_main.c static int fec_enet_xdp_xmit(struct net_device *dev, · line 3972
Quoted 6 lines
drivers/net/ethernet/freescale/fec_main.c +1
-1for (i =0 ; i < num_frames; i++) { -if (fec_enet_txq_xmit_frame (fep, txq, frames[i]) <0 ) +if (fec_enet_txq_xmit_frame (fep, txq, frames[i], true) <0 )break ; sent_frames++; }
Thanks,
Olek
Wei Fang
maintainerQuoted 61 lines
-----Original Message-----
From: Alexander Lobakin <[email protected]>
Sent: 2023年7月20日 0:46
To: Wei Fang <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Clark Wang <[email protected]>; Shenwei Wang <[email protected]>; [email protected]; dl-linux-imx <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH net-next] net: fec: addXDP_TXfeature supportFrom: Wei Fang <[email protected]>
Date: Wed, 19 Jul 2023 03:28:26 +0000Quoted 26 lines
Quoted 26 lines
-----Original Message-----
From: Alexander Lobakin <[email protected]>
Sent: 2023年7月18日 23:15
To: Wei Fang <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Clark Wang <[email protected]>; Shenwei Wang <[email protected]>; [email protected]; dl-linux-imx <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH net-next] net: fec: addXDP_TXfeature supportFrom: Wei Fang <[email protected]>
Date: Mon, 17 Jul 2023 18:37:09 +0800Quoted 3 lines
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.[...]
Review static int fec_enet_txq_xmit_frame(struct
Quoted 1 line
(quoted diff) +0
-0@@ -3897,6 +3923,29 @@ static int fec_enet_txq_xmit_frame(struct
fec_enet_private*fep,Quoted 3 lines
drivers/net/ethernet/freescale/fec_main.c +0
-0return 0 ; }Quoted 6 lines
Quoted 6 lines
drivers/net/ethernet/freescale/fec_main.c static int fec_enet_txq_xmit_frame(struct fec_enet_private *fep, · line 3929
Quoted 4 lines
drivers/net/ethernet/freescale/fec_main.c +4
-0+static int fec_enet_xdp_tx_xmit (struct net_device *ndev, +struct xdp_buff *xdp) +{ +struct xdp_frame *xdpf =xdp_convert_buff_to_frame (xdp);Have you tried avoid converting buff to frame in case of
XDP_TX? It wouldsave
Quoted 3 lines
Quoted 2 lines
you a bunch of CPU cycles.
Sorry, I haven't. I referred to several ethernet drivers about the
implementation of
Quoted 1 line
XDP_TX. Most drivers adopt the method of convertingxdp_bufftoxdp_frame,and
Quoted 1 line
in this method, I can reuse the existing interface
fec_enet_txq_xmit_frame()to
Quoted 1 line
transmit the frames and the implementation is relatively simple. Otherwise,
there
Quoted 2 lines
will be more changes and more effort is needed to implement this feature. Thanks!
Quoted 7 lines
No problem, it is just FYI, as we observe worse performance when
convert_buff_to_frame()is used forXDP_TXversus when you transmit thexdp_buffdirectly. The main reason is that converting to XDP frame touches ->data_hard_start cacheline (usually untouched), whilexdp_buffis always on the stack and hot.
It is up to you what to pick for your driver obviously :)
Thanks for your information. For now, the current XDP_TX performance can meet our expectation. I'll keep your suggestion in mind and try your suggestion if we have higher performance requirement. :D
Quoted 38 lines
Quoted 27 lines
Quoted 27 lines
drivers/net/ethernet/freescale/fec_main.c static int fec_enet_xdp_xmit(struct net_device
Quoted 24 lines
drivers/net/ethernet/freescale/fec_main.c +19
-0+struct fec_enet_private *fep =netdev_priv (ndev); +struct fec_enet_priv_tx_q *txq; +int cpu =smp_processor_id (); +struct netdev_queue *nq; +int queue, ret; + + queue =fec_enet_xdp_get_tx_queue (fep, cpu); + txq = fep->tx_queue[queue]; + nq =netdev_get_tx_queue (fep->netdev, queue); + +__netif_tx_lock (nq, cpu); + + ret =fec_enet_txq_xmit_frame (fep, txq, xdpf, false); + +__netif_tx_unlock (nq); + +return ret; +} + static int fec_enet_xdp_xmit(struct net_device *dev, int num_frames, struct xdp_frame **frames,@@ -3917,7 +3966,7 @@ static int fec_enet_xdp_xmit(struct net_device*dev,
Quoted 2 lines
drivers/net/ethernet/freescale/fec_main.c +0
-0__netif_tx_lock (nq, cpu);Quoted 8 lines
Quoted 7 lines
drivers/net/ethernet/freescale/fec_main.c static int fec_enet_xdp_xmit(struct net_device *dev, · line 3972
Quoted 6 lines
drivers/net/ethernet/freescale/fec_main.c +1
-1for (i =0 ; i < num_frames; i++) { -if (fec_enet_txq_xmit_frame (fep, txq, frames[i]) <0 ) +if (fec_enet_txq_xmit_frame (fep, txq, frames[i], true) <0 )break ; sent_frames++; }Thanks,
Olek
Jakub Kicinski
maintainerdrivers/net/ethernet/freescale/fec_main.c fec_enet_tx_queue(struct net_device *ndev, u16 queue_id) · line 1486
Quoted 5 lines · On Mon, 17 Jul 2023 18:37:09 +0800 Wei Fang wrote:
drivers/net/ethernet/freescale/fec_main.c +4
-1-xdp_return_frame (xdpf); +if (txq->tx_buf[index].type ==FEC_TXBUF_T_XDP_NDO ) +xdp_return_frame (xdpf); +else +xdp_return_frame_rx_napi (xdpf);
Are you taking budget into account? When NAPI is called with budget of 0 we are *not* in napi / softirq context. You can't be processing any XDP tx under such conditions (it may be a netpoll call from IRQ context).
Quoted 9 lines
drivers/net/ethernet/freescale/fec_main.c +9
-0+static int fec_enet_xdp_tx_xmit (struct net_device *ndev, +struct xdp_buff *xdp) +{ +struct xdp_frame *xdpf =xdp_convert_buff_to_frame (xdp); +struct fec_enet_private *fep =netdev_priv (ndev); +struct fec_enet_priv_tx_q *txq; +int cpu =smp_processor_id (); +struct netdev_queue *nq; +int queue, ret;
drivers/net/ethernet/freescale/fec_main.c static int fec_enet_txq_xmit_frame(struct fec_enet_private *fep, · line 3944
Quoted 10 lines
drivers/net/ethernet/freescale/fec_main.c +10
-0+ + queue =fec_enet_xdp_get_tx_queue (fep, cpu); + txq = fep->tx_queue[queue]; + nq =netdev_get_tx_queue (fep->netdev, queue); + +__netif_tx_lock (nq, cpu); + + ret =fec_enet_txq_xmit_frame (fep, txq, xdpf, false); + +__netif_tx_unlock (nq);
If you're reusing the same queues as the stack you need to call txq_trans_cond_update() at some point, otherwise the stack may print a splat complaining the queue got stuck.
Signature · 1 line
pw-bot: cr
Wei Fang
maintainerQuoted 12 lines
-----Original Message-----
From: Jakub Kicinski <[email protected]>
Sent: 2023年7月20日 11:46
To: Wei Fang <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Clark Wang <[email protected]>; Shenwei Wang <[email protected]>; [email protected]; dl-linux-imx <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH net-next] net: fec: addXDP_TXfeature supportOn Mon, 17 Jul 2023 18:37:09 +0800 Wei Fang wrote:
Quoted 9 lines
drivers/net/ethernet/freescale/fec_main.c fec_enet_tx_queue(struct net_device *ndev, u16 queue_id) · line 1486
Quoted 5 lines
drivers/net/ethernet/freescale/fec_main.c +4
-1-xdp_return_frame (xdpf); +if (txq->tx_buf[index].type ==FEC_TXBUF_T_XDP_NDO ) +xdp_return_frame (xdpf); +else +xdp_return_frame_rx_napi (xdpf);Are you taking budget into account? When NAPI is called with budget of 0 we are *not* in napi / softirq context. You can't be processing any XDP tx under such conditions (it may be a netpoll call from IRQ context).
Actually, the fec driver never takes the budget into account for cleaning up tx BD ring. The budget is only valid for rx.
Quoted 16 lines
Quoted 16 lines
drivers/net/ethernet/freescale/fec_main.c +15
-0+static int fec_enet_xdp_tx_xmit (struct net_device *ndev, +struct xdp_buff *xdp) +{ +struct xdp_frame *xdpf =xdp_convert_buff_to_frame (xdp); +struct fec_enet_private *fep =netdev_priv (ndev); +struct fec_enet_priv_tx_q *txq; +int cpu =smp_processor_id (); +struct netdev_queue *nq; +int queue, ret; + + queue =fec_enet_xdp_get_tx_queue (fep, cpu); + txq = fep->tx_queue[queue]; + nq =netdev_get_tx_queue (fep->netdev, queue); + +__netif_tx_lock (nq, cpu);
Quoted 8 lines
drivers/net/ethernet/freescale/fec_main.c static int fec_enet_txq_xmit_frame(struct fec_enet_private *fep, · line 3944
Quoted 4 lines
drivers/net/ethernet/freescale/fec_main.c +4
-0+ + ret =fec_enet_txq_xmit_frame (fep, txq, xdpf, false); + +__netif_tx_unlock (nq);If you're reusing the same queues as the stack you need to call
txq_trans_cond_update()at some point, otherwise the stack may print a splat complaining the queue got stuck.
Yes, you are absolutely right. I'll add txq_trans_cond_update() in the next version. Thanks!
Jakub Kicinski
maintainerQuoted 6 lines · On Thu, 20 Jul 2023 07:06:05 +0000 Wei Fang wrote:
Quoted 3 lines
Are you taking budget into account? When NAPI is called with budget of 0 we are *not* in napi / softirq context. You can't be processing any XDP tx under such conditions (it may be a netpoll call from IRQ context).
Actually, the fec driver never takes the budget into account for cleaning up tx BD ring. The budget is only valid for rx.
I know, that's what I'm complaining about. XDP can only run in normal NAPI context, i.e. when NAPI is called with budget != 0. That works out without any changes on Rx, if budget is zero drivers already don't process Rx. But similar change must be done on Tx when adding XDP support. You can still process all normal skb packets on Tx when budget is 0 (in fact you should), but you _can't_ process any XDP Tx frame.
Wei Fang
maintainerQuoted 20 lines
-----Original Message-----
From: Jakub Kicinski <[email protected]>
Sent: 2023年7月20日 23:25
To: Wei Fang <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Clark Wang <[email protected]>; Shenwei Wang <[email protected]>; [email protected]; dl-linux-imx <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH net-next] net: fec: addXDP_TXfeature supportQuoted 3 lines · On Thu, 20 Jul 2023 07:06:05 +0000 Wei Fang wrote:
Quoted 3 lines
Are you taking budget into account? When NAPI is called with budget of 0 we are *not* in napi / softirq context. You can't be processing any XDP tx under such conditions (it may be a netpoll call from IRQ
context).
Quoted 3 lines
Actually, the fec driver never takes the budget into account for cleaning up tx BD ring. The budget is only valid for rx.
Quoted 6 lines
I know, that's what I'm complaining about. XDP can only run in normal NAPI context, i.e. when NAPI is called with budget != 0. That works out without any changes on Rx, if budget is zero drivers already don't process Rx. But similar change must be done on Tx when adding XDP support. You can still process all normal skb packets on Tx when budget is 0 (in fact you should), but you _can't_ process any XDP Tx frame.
Sorry, I did not realize that we can not process any tx XDP packet if the "budget" is 0. I noticed your latest clarification [1] in napi.rst, I believe it will help many people avoid this problem like me. Thank you very much.
[1]: https://lore.kernel.org/netdev/[email protected]/T/