Re: [PATCH bpf-next] bpf: fix documentation for eBPF helpers

2018-12-03 Thread Daniel Borkmann
On 12/03/2018 01:13 PM, Quentin Monnet wrote:
> The missing indentation on the "Return" sections for bpf_map_pop_elem()
> and bpf_map_peek_elem() helpers break RST and man pages generation. This
> patch fixes them, and moves the description of those two helpers towards
> the end of the list (even though they are somehow related to the three
> first helpers for maps, the man page explicitly states that the helpers
> are sorted in chronological order).
> 
> While at it, bring other minor formatting edits for eBPF helpers
> documentation: mostly blank lines removal, RST formatting, or other
> small nits for consistency.
> 
> Signed-off-by: Quentin Monnet 
> Reviewed-by: Jakub Kicinski 

Applied to bpf-next, thanks!


[PATCH bpf-next] bpf: fix documentation for eBPF helpers

2018-12-03 Thread Quentin Monnet
The missing indentation on the "Return" sections for bpf_map_pop_elem()
and bpf_map_peek_elem() helpers break RST and man pages generation. This
patch fixes them, and moves the description of those two helpers towards
the end of the list (even though they are somehow related to the three
first helpers for maps, the man page explicitly states that the helpers
are sorted in chronological order).

While at it, bring other minor formatting edits for eBPF helpers
documentation: mostly blank lines removal, RST formatting, or other
small nits for consistency.

Signed-off-by: Quentin Monnet 
Reviewed-by: Jakub Kicinski 
---
 include/uapi/linux/bpf.h | 90 
 1 file changed, 45 insertions(+), 45 deletions(-)

diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index 597afdbc1ab9..41426e0efd5a 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -482,18 +482,6 @@ union bpf_attr {
  * Return
  * 0 on success, or a negative error in case of failure.
  *
- * int bpf_map_pop_elem(struct bpf_map *map, void *value)
- * Description
- * Pop an element from *map*.
- * Return
- * 0 on success, or a negative error in case of failure.
- *
- * int bpf_map_peek_elem(struct bpf_map *map, void *value)
- * Description
- * Get an element from *map* without removing it.
- * Return
- * 0 on success, or a negative error in case of failure.
- *
  * int bpf_probe_read(void *dst, u32 size, const void *src)
  * Description
  * For tracing programs, safely attempt to read *size* bytes from
@@ -1917,9 +1905,9 @@ union bpf_attr {
  * is set to metric from route (IPv4/IPv6 only), and ifindex
  * is set to the device index of the nexthop from the FIB lookup.
  *
- * *plen* argument is the size of the passed in struct.
- * *flags* argument can be a combination of one or more of the
- * following values:
+ * *plen* argument is the size of the passed in struct.
+ * *flags* argument can be a combination of one or more of the
+ * following values:
  *
  * **BPF_FIB_LOOKUP_DIRECT**
  * Do a direct table lookup vs full lookup using FIB
@@ -1928,9 +1916,9 @@ union bpf_attr {
  * Perform lookup from an egress perspective (default is
  * ingress).
  *
- * *ctx* is either **struct xdp_md** for XDP programs or
- * **struct sk_buff** tc cls_act programs.
- * Return
+ * *ctx* is either **struct xdp_md** for XDP programs or
+ * **struct sk_buff** tc cls_act programs.
+ * Return
  * * < 0 if any input argument is invalid
  * *   0 on success (packet is forwarded, nexthop neighbor exists)
  * * > 0 one of **BPF_FIB_LKUP_RET_** codes explaining why the
@@ -2075,8 +2063,8 @@ union bpf_attr {
  * translated to a keycode using the rc keymap, and reported as
  * an input key down event. After a period a key up event is
  * generated. This period can be extended by calling either
- * **bpf_rc_keydown** () again with the same values, or calling
- * **bpf_rc_repeat** ().
+ * **bpf_rc_keydown**\ () again with the same values, or calling
+ * **bpf_rc_repeat**\ ().
  *
  * Some protocols include a toggle bit, in case the button was
  * released and pressed again between consecutive scancodes.
@@ -2159,21 +2147,22 @@ union bpf_attr {
  * The *flags* meaning is specific for each map type,
  * and has to be 0 for cgroup local storage.
  *
- * Depending on the bpf program type, a local storage area
- * can be shared between multiple instances of the bpf program,
+ * Depending on the BPF program type, a local storage area
+ * can be shared between multiple instances of the BPF program,
  * running simultaneously.
  *
  * A user should care about the synchronization by himself.
- * For example, by using the BPF_STX_XADD instruction to alter
+ * For example, by using the **BPF_STX_XADD** instruction to alter
  * the shared data.
  * Return
- * Pointer to the local storage area.
+ * A pointer to the local storage area.
  *
  * int bpf_sk_select_reuseport(struct sk_reuseport_md *reuse, struct bpf_map 
*map, void *key, u64 flags)
  * Description
- * Select a SO_REUSEPORT sk from a BPF_MAP_TYPE_REUSEPORT_ARRAY map
- * It checks the selected sk is matching the incoming
- * request in the skb.
+ * Select a **SO_REUSEPORT** socket from a
+ * **BPF_MAP_TYPE_REUSEPORT_ARRAY** *map*.
+ * It checks the selected socket is matching the incoming