2023-08-08 16:30:28

by 黄杰

[permalink] [raw]
Subject: [RFC v3 Optimizing veth xsk performance 9/9] veth: add support for AF_XDP tx need_wakup feature

this patch only support for tx need_wakup feature.

Signed-off-by: Albert Huang <[email protected]>
---
drivers/net/veth.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 70489d017b51..7c60c64ef10b 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -1447,9 +1447,9 @@ static int veth_xsk_tx_xmit(struct veth_sq *sq, struct xsk_buff_pool *xsk_pool,

memset(&tuple, 0, sizeof(tuple));

- /* set xsk wake up flag, to do: where to disable */
+ /* clear xsk wake up flag */
if (xsk_uses_need_wakeup(xsk_pool))
- xsk_set_tx_need_wakeup(xsk_pool);
+ xsk_clear_tx_need_wakeup(xsk_pool);

while (budget-- > 0) {
unsigned int truesize = 0;
@@ -1539,12 +1539,15 @@ static int veth_poll_tx(struct napi_struct *napi, int budget)
if (pool)
done = veth_xsk_tx_xmit(sq, pool, budget);

- rcu_read_unlock();
-
if (done < budget) {
+ /* set xsk wake up flag */
+ if (xsk_uses_need_wakeup(pool))
+ xsk_set_tx_need_wakeup(pool);
+
/* if done < budget, the tx ring is no buffer */
napi_complete_done(napi, done);
}
+ rcu_read_unlock();

return done;
}
--
2.20.1