diff options
author | Magnus Karlsson <magnus.karlsson@intel.com> | 2023-01-17 10:43:05 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-01-18 14:33:34 +0000 |
commit | 68e5b6aa2795fd05c6ff58616cb16f2f216e4123 (patch) | |
tree | e9da14bb8e0a1be9848be5c91bc063ce2fb16a76 | |
parent | bed91ac0810634e0ae58e575d8a1fb7893b4ac72 (diff) | |
download | lwn-68e5b6aa2795fd05c6ff58616cb16f2f216e4123.tar.gz lwn-68e5b6aa2795fd05c6ff58616cb16f2f216e4123.zip |
xdp: document xdp_do_flush() before napi_complete_done()
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/
Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/core/filter.c | 10 |
1 files 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 |