]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
bpf, uapi: Remove text about bpf_redirect_map() giving higher performance
authorToke Høiland-Jørgensen <toke@redhat.com>
Tue, 18 Feb 2020 13:03:34 +0000 (14:03 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 18 Feb 2020 14:31:31 +0000 (15:31 +0100)
The performance of bpf_redirect() is now roughly the same as that of
bpf_redirect_map(). However, David Ahern pointed out that the header file
has not been updated to reflect this, and still says that a significant
performance increase is possible when using bpf_redirect_map(). Remove this
text from the bpf_redirect_map() description, and reword the description in
bpf_redirect() slightly. Also fix the 'Return' section of the
bpf_redirect_map() documentation.

Fixes: 1d233886dd90 ("xdp: Use bulking for non-map XDP_REDIRECT and consolidate code paths")
Reported-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Quentin Monnet <quentin@isovalent.com>
Link: https://lore.kernel.org/bpf/20200218130334.29889-1-toke@redhat.com
include/uapi/linux/bpf.h
tools/include/uapi/linux/bpf.h

index f1d74a2bd23493635afcbd6a7336c2fd2806f471..22f235260a3a352cf4223249fc1d26f2fce62f34 100644 (file)
@@ -1045,9 +1045,9 @@ union bpf_attr {
  *             supports redirection to the egress interface, and accepts no
  *             flag at all.
  *
- *             The same effect can be attained with the more generic
- *             **bpf_redirect_map**\ (), which requires specific maps to be
- *             used but offers better performance.
+ *             The same effect can also be attained with the more generic
+ *             **bpf_redirect_map**\ (), which uses a BPF map to store the
+ *             redirect target instead of providing it directly to the helper.
  *     Return
  *             For XDP, the helper returns **XDP_REDIRECT** on success or
  *             **XDP_ABORTED** on error. For other program types, the values
@@ -1611,13 +1611,11 @@ union bpf_attr {
  *             the caller. Any higher bits in the *flags* argument must be
  *             unset.
  *
- *             When used to redirect packets to net devices, this helper
- *             provides a high performance increase over **bpf_redirect**\ ().
- *             This is due to various implementation details of the underlying
- *             mechanisms, one of which is the fact that **bpf_redirect_map**\
- *             () tries to send packet as a "bulk" to the device.
+ *             See also bpf_redirect(), which only supports redirecting to an
+ *             ifindex, but doesn't require a map to do so.
  *     Return
- *             **XDP_REDIRECT** on success, or **XDP_ABORTED** on error.
+ *             **XDP_REDIRECT** on success, or the value of the two lower bits
+ *             of the **flags* argument on error.
  *
  * int bpf_sk_redirect_map(struct sk_buff *skb, struct bpf_map *map, u32 key, u64 flags)
  *     Description
index f1d74a2bd23493635afcbd6a7336c2fd2806f471..22f235260a3a352cf4223249fc1d26f2fce62f34 100644 (file)
@@ -1045,9 +1045,9 @@ union bpf_attr {
  *             supports redirection to the egress interface, and accepts no
  *             flag at all.
  *
- *             The same effect can be attained with the more generic
- *             **bpf_redirect_map**\ (), which requires specific maps to be
- *             used but offers better performance.
+ *             The same effect can also be attained with the more generic
+ *             **bpf_redirect_map**\ (), which uses a BPF map to store the
+ *             redirect target instead of providing it directly to the helper.
  *     Return
  *             For XDP, the helper returns **XDP_REDIRECT** on success or
  *             **XDP_ABORTED** on error. For other program types, the values
@@ -1611,13 +1611,11 @@ union bpf_attr {
  *             the caller. Any higher bits in the *flags* argument must be
  *             unset.
  *
- *             When used to redirect packets to net devices, this helper
- *             provides a high performance increase over **bpf_redirect**\ ().
- *             This is due to various implementation details of the underlying
- *             mechanisms, one of which is the fact that **bpf_redirect_map**\
- *             () tries to send packet as a "bulk" to the device.
+ *             See also bpf_redirect(), which only supports redirecting to an
+ *             ifindex, but doesn't require a map to do so.
  *     Return
- *             **XDP_REDIRECT** on success, or **XDP_ABORTED** on error.
+ *             **XDP_REDIRECT** on success, or the value of the two lower bits
+ *             of the **flags* argument on error.
  *
  * int bpf_sk_redirect_map(struct sk_buff *skb, struct bpf_map *map, u32 key, u64 flags)
  *     Description