netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] xdp: document xdp_do_flush() before napi_complete_done()
@ 2023-01-17  9:43 Magnus Karlsson
  2023-01-17 10:33 ` Toke Høiland-Jørgensen
  2023-01-18 14:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Magnus Karlsson @ 2023-01-17  9:43 UTC (permalink / raw)
  To: magnus.karlsson, bjorn, ast, daniel, netdev, jonathan.lemon,
	maciej.fijalkowski, kuba, toke, pabeni, davem, brouer
  Cc: bpf

From: Magnus Karlsson <magnus.karlsson@intel.com>

Document in the XDP_REDIRECT manual section that drivers must call
xdp_do_flush() before napi_complete_done(). The two reasons behind
this can be found following the links below.

Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Link: https://lore.kernel.org/r/20221220185903.1105011-1-sbohrer@cloudflare.com
Link: https://lore.kernel.org/all/20210624160609.292325-1-toke@redhat.com/
---
 net/core/filter.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/net/core/filter.c b/net/core/filter.c
index ab811293ae5d..7a2b67893afd 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -4128,9 +4128,13 @@ static const struct bpf_func_proto bpf_xdp_adjust_meta_proto = {
  *    bpf_redirect_info to actually enqueue the frame into a map type-specific
  *    bulk queue structure.
  *
- * 3. Before exiting its NAPI poll loop, the driver will call xdp_do_flush(),
- *    which will flush all the different bulk queues, thus completing the
- *    redirect.
+ * 3. Before exiting its NAPI poll loop, the driver will call
+ *    xdp_do_flush(), which will flush all the different bulk queues,
+ *    thus completing the redirect. Note that xdp_do_flush() must be
+ *    called before napi_complete_done() in the driver, as the
+ *    XDP_REDIRECT logic relies on being inside a single NAPI instance
+ *    through to the xdp_do_flush() call for RCU protection of all
+ *    in-kernel data structures.
  */
 /*
  * Pointers to the map entries will be kept around for this whole sequence of

base-commit: 501543b4fff0ff70bde28a829eb8835081ccef2f
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] xdp: document xdp_do_flush() before napi_complete_done()
  2023-01-17  9:43 [PATCH net-next] xdp: document xdp_do_flush() before napi_complete_done() Magnus Karlsson
@ 2023-01-17 10:33 ` Toke Høiland-Jørgensen
  2023-01-18 14:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Toke Høiland-Jørgensen @ 2023-01-17 10:33 UTC (permalink / raw)
  To: Magnus Karlsson, magnus.karlsson, bjorn, ast, daniel, netdev,
	jonathan.lemon, maciej.fijalkowski, kuba, pabeni, davem, brouer
  Cc: bpf

Magnus Karlsson <magnus.karlsson@gmail.com> writes:

> From: Magnus Karlsson <magnus.karlsson@intel.com>
>
> Document in the XDP_REDIRECT manual section that drivers must call
> xdp_do_flush() before napi_complete_done(). The two reasons behind
> this can be found following the links below.
>
> Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
> Link: https://lore.kernel.org/r/20221220185903.1105011-1-sbohrer@cloudflare.com
> Link: https://lore.kernel.org/all/20210624160609.292325-1-toke@redhat.com/

Thanks for fixing this!

Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] xdp: document xdp_do_flush() before napi_complete_done()
  2023-01-17  9:43 [PATCH net-next] xdp: document xdp_do_flush() before napi_complete_done() Magnus Karlsson
  2023-01-17 10:33 ` Toke Høiland-Jørgensen
@ 2023-01-18 14:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-01-18 14:40 UTC (permalink / raw)
  To: Magnus Karlsson
  Cc: magnus.karlsson, bjorn, ast, daniel, netdev, jonathan.lemon,
	maciej.fijalkowski, kuba, toke, pabeni, davem, brouer, bpf

Hello:

This patch was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Tue, 17 Jan 2023 10:43:05 +0100 you wrote:
> From: Magnus Karlsson <magnus.karlsson@intel.com>
> 
> Document in the XDP_REDIRECT manual section that drivers must call
> xdp_do_flush() before napi_complete_done(). The two reasons behind
> this can be found following the links below.
> 
> Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
> Link: https://lore.kernel.org/r/20221220185903.1105011-1-sbohrer@cloudflare.com
> Link: https://lore.kernel.org/all/20210624160609.292325-1-toke@redhat.com/
> 
> [...]

Here is the summary with links:
  - [net-next] xdp: document xdp_do_flush() before napi_complete_done()
    https://git.kernel.org/netdev/net-next/c/68e5b6aa2795

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:[~2023-01-18 14:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-17  9:43 [PATCH net-next] xdp: document xdp_do_flush() before napi_complete_done() Magnus Karlsson
2023-01-17 10:33 ` Toke Høiland-Jørgensen
2023-01-18 14:40 ` 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).