aboutsummaryrefslogtreecommitdiffstats
path: root/tools/include/uapi/linux
diff options
context:
space:
mode:
authorDaniel Borkmann <daniel@iogearbox.net>2018-05-03 19:08:24 -0400
committerAlexei Starovoitov <ast@kernel.org>2018-05-03 19:49:20 -0400
commit32b3652c307ef62f624182fac1fd6328ccc8fcbe (patch)
tree92221b6309ccd5c231dde62a2a7ca1d21cbca9fe /tools/include/uapi/linux
parent24dea04767e6e5175f4750770281b0c17ac6a2fb (diff)
bpf: sync tools bpf.h uapi header
Only sync the header from include/uapi/linux/bpf.h. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/include/uapi/linux')
-rw-r--r--tools/include/uapi/linux/bpf.h33
1 files changed, 32 insertions, 1 deletions
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index 8daef7326bb7..83a95ae388dd 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -1801,6 +1801,30 @@ union bpf_attr {
1801 * Return 1801 * Return
1802 * a non-negative value equal to or less than size on success, or 1802 * a non-negative value equal to or less than size on success, or
1803 * a negative error in case of failure. 1803 * a negative error in case of failure.
1804 *
1805 * int skb_load_bytes_relative(const struct sk_buff *skb, u32 offset, void *to, u32 len, u32 start_header)
1806 * Description
1807 * This helper is similar to **bpf_skb_load_bytes**\ () in that
1808 * it provides an easy way to load *len* bytes from *offset*
1809 * from the packet associated to *skb*, into the buffer pointed
1810 * by *to*. The difference to **bpf_skb_load_bytes**\ () is that
1811 * a fifth argument *start_header* exists in order to select a
1812 * base offset to start from. *start_header* can be one of:
1813 *
1814 * **BPF_HDR_START_MAC**
1815 * Base offset to load data from is *skb*'s mac header.
1816 * **BPF_HDR_START_NET**
1817 * Base offset to load data from is *skb*'s network header.
1818 *
1819 * In general, "direct packet access" is the preferred method to
1820 * access packet data, however, this helper is in particular useful
1821 * in socket filters where *skb*\ **->data** does not always point
1822 * to the start of the mac header and where "direct packet access"
1823 * is not available.
1824 *
1825 * Return
1826 * 0 on success, or a negative error in case of failure.
1827 *
1804 */ 1828 */
1805#define __BPF_FUNC_MAPPER(FN) \ 1829#define __BPF_FUNC_MAPPER(FN) \
1806 FN(unspec), \ 1830 FN(unspec), \
@@ -1870,7 +1894,8 @@ union bpf_attr {
1870 FN(bind), \ 1894 FN(bind), \
1871 FN(xdp_adjust_tail), \ 1895 FN(xdp_adjust_tail), \
1872 FN(skb_get_xfrm_state), \ 1896 FN(skb_get_xfrm_state), \
1873 FN(get_stack), 1897 FN(get_stack), \
1898 FN(skb_load_bytes_relative),
1874 1899
1875/* integer value in 'imm' field of BPF_CALL instruction selects which helper 1900/* integer value in 'imm' field of BPF_CALL instruction selects which helper
1876 * function eBPF program intends to call 1901 * function eBPF program intends to call
@@ -1931,6 +1956,12 @@ enum bpf_adj_room_mode {
1931 BPF_ADJ_ROOM_NET, 1956 BPF_ADJ_ROOM_NET,
1932}; 1957};
1933 1958
1959/* Mode for BPF_FUNC_skb_load_bytes_relative helper. */
1960enum bpf_hdr_start_off {
1961 BPF_HDR_START_MAC,
1962 BPF_HDR_START_NET,
1963};
1964
1934/* user accessible mirror of in-kernel sk_buff. 1965/* user accessible mirror of in-kernel sk_buff.
1935 * new fields can only be added to the end of this structure 1966 * new fields can only be added to the end of this structure
1936 */ 1967 */