[net-next PATCH] net: comment fixes against BPF devmap helper calls

Subsystems: bpf [general] (safe dynamic programs and tools), the rest

STALE3362d

2 messages, 2 authors, 2017-08-04 · open the first message on its own page

[net-next PATCH] net: comment fixes against BPF devmap helper calls

From: John Fastabend <john.fastabend@gmail.com>
Date: 2017-08-04 04:58:37

Update BPF comments to accurately reflect XDP usage.

Fixes: 97f91a7cf04ff ("bpf: add bpf_redirect_map helper routine")
Reported-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
---
 include/uapi/linux/bpf.h |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index 1106a8c..1ae061e 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -345,14 +345,20 @@ enum bpf_attach_type {
  * int bpf_redirect(ifindex, flags)
  *     redirect to another netdev
  *     @ifindex: ifindex of the net device
- *     @flags: bit 0 - if set, redirect to ingress instead of egress
- *             other bits - reserved
- *     Return: TC_ACT_REDIRECT
- * int bpf_redirect_map(key, map, flags)
+ *     @flags:
+ *	  cls_bpf:
+ *          bit 0 - if set, redirect to ingress instead of egress
+ *          other bits - reserved
+ *	  xdp_bpf:
+ *	    all bits - reserved
+ *     Return: cls_bpf: TC_ACT_REDIRECT
+ *	       xdp_bfp: XDP_REDIRECT
+ * int bpf_redirect_map(map, key, flags)
  *     redirect to endpoint in map
+ *     @map: pointer to dev map
  *     @key: index in map to lookup
- *     @map: fd of map to do lookup in
  *     @flags: --
+ *     Return: XDP_REDIRECT on success or XDP_ABORT on error
  *
  * u32 bpf_get_route_realm(skb)
  *     retrieve a dst's tclassid

Re: [net-next PATCH] net: comment fixes against BPF devmap helper calls

From: Daniel Borkmann <daniel@iogearbox.net>
Date: 2017-08-04 13:21:37

On 08/04/2017 06:58 AM, John Fastabend wrote:
quoted hunk
Update BPF comments to accurately reflect XDP usage.

Fixes: 97f91a7cf04ff ("bpf: add bpf_redirect_map helper routine")
Reported-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
---
  include/uapi/linux/bpf.h |   16 +++++++++++-----
  1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index 1106a8c..1ae061e 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -345,14 +345,20 @@ enum bpf_attach_type {
   * int bpf_redirect(ifindex, flags)
   *     redirect to another netdev
   *     @ifindex: ifindex of the net device
- *     @flags: bit 0 - if set, redirect to ingress instead of egress
- *             other bits - reserved
- *     Return: TC_ACT_REDIRECT
- * int bpf_redirect_map(key, map, flags)
+ *     @flags:
+ *	  cls_bpf:
+ *          bit 0 - if set, redirect to ingress instead of egress
+ *          other bits - reserved
+ *	  xdp_bpf:
+ *	    all bits - reserved
+ *     Return: cls_bpf: TC_ACT_REDIRECT
+ *	       xdp_bfp: XDP_REDIRECT
We should probably also mention the XDP_ABORTED / TC_ACT_SHOT
on error(/misuse) similarly as below.
quoted hunk
+ * int bpf_redirect_map(map, key, flags)
   *     redirect to endpoint in map
+ *     @map: pointer to dev map
   *     @key: index in map to lookup
- *     @map: fd of map to do lookup in
   *     @flags: --
+ *     Return: XDP_REDIRECT on success or XDP_ABORT on error
   *
   * u32 bpf_get_route_realm(skb)
   *     retrieve a dst's tclassid
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help