History

bpf: add documentation for eBPF helpers (65-66)

Add documentation for eBPF helper functions to bpf.h user header file. This documentation can be parsed with the Python script provided in another commit of the patch series, in order to provide a RST document that can later be converted into a man page. The objective is to make the documentation easily understandable and accessible to all eBPF developers, including beginners. This patch contains descriptions for the following helper functions: Helper from Nikita: - bpf_xdp_adjust_tail() Helper from Eyal: - bpf_skb_get_xfrm_state() v4: - New patch (helpers did not exist yet for previous versions).

Quentin Monnet committed 8 years ago

Commit 2d020dd1 parent ab127041 file · +30 −0Browse files

Showing the changes to include/uapi/linux (1 of 1 file). Show all

Unified · Split

include/uapi/linux/bpf.h+30−0
@@ -1737,6 +1737,36 @@ union bpf_attr { · 1736 unmodified lines
17371737 * must be set to zero.
17381738 * Return
17391739 * 0 on success, or a negative error in case of failure.
1740+ *
1741+ * int bpf_xdp_adjust_tail(struct xdp_buff *xdp_md, int delta)
1742+ * Description
1743+ * Adjust (move) *xdp_md*\ **->data_end** by *delta* bytes. It is
1744+ * only possible to shrink the packet as of this writing,
1745+ * therefore *delta* must be a negative integer.
1746+ *
1747+ * A call to this helper is susceptible to change the underlaying
1748+ * packet buffer. Therefore, at load time, all checks on pointers
1749+ * previously done by the verifier are invalidated and must be
1750+ * performed again, if the helper is used in combination with
1751+ * direct packet access.
1752+ * Return
1753+ * 0 on success, or a negative error in case of failure.
1754+ *
1755+ * int bpf_skb_get_xfrm_state(struct sk_buff *skb, u32 index, struct bpf_xfrm_state *xfrm_state, u32 size, u64 flags)
1756+ * Description
1757+ * Retrieve the XFRM state (IP transform framework, see also
1758+ * **ip-xfrm(8)**) at *index* in XFRM "security path" for *skb*.
1759+ *
1760+ * The retrieved value is stored in the **struct bpf_xfrm_state**
1761+ * pointed by *xfrm_state* and of length *size*.
1762+ *
1763+ * All values for *flags* are reserved for future usage, and must
1764+ * be left at zero.
1765+ *
1766+ * This helper is available only if the kernel was compiled with
1767+ * **CONFIG_XFRM** configuration option.
1768+ * Return
1769+ * 0 on success, or a negative error in case of failure.
17401770 */
17411771 #define __BPF_FUNC_MAPPER(FN) \
17421772 FN(unspec), \