* [PATCH net-next] tsnep: Add helper for RX XDP_RING_NEED_WAKEUP flag
@ 2024-01-31 20:54 Gerhard Engleder
2024-02-02 16:53 ` Simon Horman
2024-02-05 11:20 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Gerhard Engleder @ 2024-01-31 20:54 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, edumazet, pabeni, Gerhard Engleder
Similar chunk of code is used in tsnep_rx_poll_zc() and
tsnep_rx_reopen_xsk() to maintain the RX XDP_RING_NEED_WAKEUP flag.
Consolidate the code to common helper function.
Suggested-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Gerhard Engleder <gerhard@engleder-embedded.com>
---
drivers/net/ethernet/engleder/tsnep_main.c | 23 +++++++++++-----------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ethernet/engleder/tsnep_main.c b/drivers/net/ethernet/engleder/tsnep_main.c
index 11d49d08d017..332d561cb8a4 100644
--- a/drivers/net/ethernet/engleder/tsnep_main.c
+++ b/drivers/net/ethernet/engleder/tsnep_main.c
@@ -1275,6 +1275,14 @@ static int tsnep_rx_refill_zc(struct tsnep_rx *rx, int count, bool reuse)
return desc_refilled;
}
+static void tsnep_xsk_rx_need_wakeup(struct tsnep_rx *rx, int desc_available)
+{
+ if (desc_available)
+ xsk_set_rx_need_wakeup(rx->xsk_pool);
+ else
+ xsk_clear_rx_need_wakeup(rx->xsk_pool);
+}
+
static bool tsnep_xdp_run_prog(struct tsnep_rx *rx, struct bpf_prog *prog,
struct xdp_buff *xdp, int *status,
struct netdev_queue *tx_nq, struct tsnep_tx *tx)
@@ -1636,10 +1644,7 @@ static int tsnep_rx_poll_zc(struct tsnep_rx *rx, struct napi_struct *napi,
desc_available -= tsnep_rx_refill_zc(rx, desc_available, false);
if (xsk_uses_need_wakeup(rx->xsk_pool)) {
- if (desc_available)
- xsk_set_rx_need_wakeup(rx->xsk_pool);
- else
- xsk_clear_rx_need_wakeup(rx->xsk_pool);
+ tsnep_xsk_rx_need_wakeup(rx, desc_available);
return done;
}
@@ -1784,14 +1789,8 @@ static void tsnep_rx_reopen_xsk(struct tsnep_rx *rx)
* first polling would be too late as need wakeup signalisation would
* be delayed for an indefinite time
*/
- if (xsk_uses_need_wakeup(rx->xsk_pool)) {
- int desc_available = tsnep_rx_desc_available(rx);
-
- if (desc_available)
- xsk_set_rx_need_wakeup(rx->xsk_pool);
- else
- xsk_clear_rx_need_wakeup(rx->xsk_pool);
- }
+ if (xsk_uses_need_wakeup(rx->xsk_pool))
+ tsnep_xsk_rx_need_wakeup(rx, tsnep_rx_desc_available(rx));
}
static bool tsnep_pending(struct tsnep_queue *queue)
--
2.39.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] tsnep: Add helper for RX XDP_RING_NEED_WAKEUP flag
2024-01-31 20:54 [PATCH net-next] tsnep: Add helper for RX XDP_RING_NEED_WAKEUP flag Gerhard Engleder
@ 2024-02-02 16:53 ` Simon Horman
2024-02-05 11:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2024-02-02 16:53 UTC (permalink / raw)
To: Gerhard Engleder; +Cc: netdev, davem, kuba, edumazet, pabeni
On Wed, Jan 31, 2024 at 09:54:34PM +0100, Gerhard Engleder wrote:
> Similar chunk of code is used in tsnep_rx_poll_zc() and
> tsnep_rx_reopen_xsk() to maintain the RX XDP_RING_NEED_WAKEUP flag.
> Consolidate the code to common helper function.
>
> Suggested-by: Paolo Abeni <pabeni@redhat.com>
> Signed-off-by: Gerhard Engleder <gerhard@engleder-embedded.com>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] tsnep: Add helper for RX XDP_RING_NEED_WAKEUP flag
2024-01-31 20:54 [PATCH net-next] tsnep: Add helper for RX XDP_RING_NEED_WAKEUP flag Gerhard Engleder
2024-02-02 16:53 ` Simon Horman
@ 2024-02-05 11:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-02-05 11:20 UTC (permalink / raw)
To: Gerhard Engleder; +Cc: netdev, davem, kuba, edumazet, pabeni
Hello:
This patch was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:
On Wed, 31 Jan 2024 21:54:34 +0100 you wrote:
> Similar chunk of code is used in tsnep_rx_poll_zc() and
> tsnep_rx_reopen_xsk() to maintain the RX XDP_RING_NEED_WAKEUP flag.
> Consolidate the code to common helper function.
>
> Suggested-by: Paolo Abeni <pabeni@redhat.com>
> Signed-off-by: Gerhard Engleder <gerhard@engleder-embedded.com>
>
> [...]
Here is the summary with links:
- [net-next] tsnep: Add helper for RX XDP_RING_NEED_WAKEUP flag
https://git.kernel.org/netdev/net-next/c/1e08223272c7
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-05 11:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-31 20:54 [PATCH net-next] tsnep: Add helper for RX XDP_RING_NEED_WAKEUP flag Gerhard Engleder
2024-02-02 16:53 ` Simon Horman
2024-02-05 11:20 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).