Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1574303 > unrolled thread

[PATCH net-next v1 4/7] tools: Sync {,tools/}include/uapi/linux/bpf.h

Started byMickaël Salaün <mic@digikod.net>
First post2017-02-06 00:20 +0100
Last post2017-02-06 21:00 +0100
Articles 2 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH net-next v1 4/7] tools: Sync {,tools/}include/uapi/linux/bpf.h Mickaël Salaün <mic@digikod.net> - 2017-02-06 00:20 +0100
    Re: [PATCH net-next v1 4/7] tools: Sync  {,tools/}include/uapi/linux/bpf.h Mickaël Salaün <mic@digikod.net> - 2017-02-06 21:00 +0100

#1574303 — [PATCH net-next v1 4/7] tools: Sync {,tools/}include/uapi/linux/bpf.h

FromMickaël Salaün <mic@digikod.net>
Date2017-02-06 00:20 +0100
Subject[PATCH net-next v1 4/7] tools: Sync {,tools/}include/uapi/linux/bpf.h
Message-ID<t7Ega-5mH-17@gated-at.bofh.it>
The tools version of this header is out of date; update it to the latest
version from kernel header.

Signed-off-by: Mickaël Salaün <mic@digikod.net>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: David S. Miller <davem@davemloft.net>
---
 tools/include/uapi/linux/bpf.h | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index 0eb0e87dbe9f..e07fd5a324e6 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -63,6 +63,12 @@ struct bpf_insn {
 	__s32	imm;		/* signed immediate constant */
 };
 
+/* Key of an a BPF_MAP_TYPE_LPM_TRIE entry */
+struct bpf_lpm_trie_key {
+	__u32	prefixlen;	/* up to 32 for AF_INET, 128 for AF_INET6 */
+	__u8	data[0];	/* Arbitrary size */
+};
+
 /* BPF syscall commands, see bpf(2) man-page for details. */
 enum bpf_cmd {
 	BPF_MAP_CREATE,
@@ -89,6 +95,7 @@ enum bpf_map_type {
 	BPF_MAP_TYPE_CGROUP_ARRAY,
 	BPF_MAP_TYPE_LRU_HASH,
 	BPF_MAP_TYPE_LRU_PERCPU_HASH,
+	BPF_MAP_TYPE_LPM_TRIE,
 };
 
 enum bpf_prog_type {
@@ -430,6 +437,18 @@ union bpf_attr {
  *     @xdp_md: pointer to xdp_md
  *     @delta: An positive/negative integer to be added to xdp_md.data
  *     Return: 0 on success or negative on error
+ *
+ * int bpf_probe_read_str(void *dst, int size, const void *unsafe_ptr)
+ *     Copy a NUL terminated string from unsafe address. In case the string
+ *     length is smaller than size, the target is not padded with further NUL
+ *     bytes. In case the string length is larger than size, just count-1
+ *     bytes are copied and the last byte is set to NUL.
+ *     @dst: destination address
+ *     @size: maximum number of bytes to copy, including the trailing NUL
+ *     @unsafe_ptr: unsafe address
+ *     Return:
+ *       > 0 length of the string including the trailing NUL on success
+ *       < 0 error
  */
 #define __BPF_FUNC_MAPPER(FN)		\
 	FN(unspec),			\
@@ -476,7 +495,8 @@ union bpf_attr {
 	FN(set_hash_invalid),		\
 	FN(get_numa_node_id),		\
 	FN(skb_change_head),		\
-	FN(xdp_adjust_head),
+	FN(xdp_adjust_head),		\
+	FN(probe_read_str),
 
 /* integer value in 'imm' field of BPF_CALL instruction selects which helper
  * function eBPF program intends to call
@@ -502,6 +522,7 @@ enum bpf_func_id {
 /* BPF_FUNC_l4_csum_replace flags. */
 #define BPF_F_PSEUDO_HDR		(1ULL << 4)
 #define BPF_F_MARK_MANGLED_0		(1ULL << 5)
+#define BPF_F_MARK_ENFORCE		(1ULL << 6)
 
 /* BPF_FUNC_clone_redirect and BPF_FUNC_redirect flags. */
 #define BPF_F_INGRESS			(1ULL << 0)
-- 
2.11.0

[toc] | [next] | [standalone]


#1575098 — Re: [PATCH net-next v1 4/7] tools: Sync {,tools/}include/uapi/linux/bpf.h

FromMickaël Salaün <mic@digikod.net>
Date2017-02-06 21:00 +0100
SubjectRe: [PATCH net-next v1 4/7] tools: Sync {,tools/}include/uapi/linux/bpf.h
Message-ID<t7XCa-W4-1@gated-at.bofh.it>
In reply to#1574303

[Multipart message — attachments visible in raw view] — view raw

This patch only make sense in net-next, however.

On 06/02/2017 00:14, Mickaël Salaün wrote:
> The tools version of this header is out of date; update it to the latest
> version from kernel header.
> 
> Signed-off-by: Mickaël Salaün <mic@digikod.net>
> Cc: Alexei Starovoitov <ast@fb.com>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: David S. Miller <davem@davemloft.net>
> ---
>  tools/include/uapi/linux/bpf.h | 23 ++++++++++++++++++++++-
>  1 file changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
> index 0eb0e87dbe9f..e07fd5a324e6 100644
> --- a/tools/include/uapi/linux/bpf.h
> +++ b/tools/include/uapi/linux/bpf.h
> @@ -63,6 +63,12 @@ struct bpf_insn {
>  	__s32	imm;		/* signed immediate constant */
>  };
>  
> +/* Key of an a BPF_MAP_TYPE_LPM_TRIE entry */
> +struct bpf_lpm_trie_key {
> +	__u32	prefixlen;	/* up to 32 for AF_INET, 128 for AF_INET6 */
> +	__u8	data[0];	/* Arbitrary size */
> +};
> +
>  /* BPF syscall commands, see bpf(2) man-page for details. */
>  enum bpf_cmd {
>  	BPF_MAP_CREATE,
> @@ -89,6 +95,7 @@ enum bpf_map_type {
>  	BPF_MAP_TYPE_CGROUP_ARRAY,
>  	BPF_MAP_TYPE_LRU_HASH,
>  	BPF_MAP_TYPE_LRU_PERCPU_HASH,
> +	BPF_MAP_TYPE_LPM_TRIE,
>  };
>  
>  enum bpf_prog_type {
> @@ -430,6 +437,18 @@ union bpf_attr {
>   *     @xdp_md: pointer to xdp_md
>   *     @delta: An positive/negative integer to be added to xdp_md.data
>   *     Return: 0 on success or negative on error
> + *
> + * int bpf_probe_read_str(void *dst, int size, const void *unsafe_ptr)
> + *     Copy a NUL terminated string from unsafe address. In case the string
> + *     length is smaller than size, the target is not padded with further NUL
> + *     bytes. In case the string length is larger than size, just count-1
> + *     bytes are copied and the last byte is set to NUL.
> + *     @dst: destination address
> + *     @size: maximum number of bytes to copy, including the trailing NUL
> + *     @unsafe_ptr: unsafe address
> + *     Return:
> + *       > 0 length of the string including the trailing NUL on success
> + *       < 0 error
>   */
>  #define __BPF_FUNC_MAPPER(FN)		\
>  	FN(unspec),			\
> @@ -476,7 +495,8 @@ union bpf_attr {
>  	FN(set_hash_invalid),		\
>  	FN(get_numa_node_id),		\
>  	FN(skb_change_head),		\
> -	FN(xdp_adjust_head),
> +	FN(xdp_adjust_head),		\
> +	FN(probe_read_str),
>  
>  /* integer value in 'imm' field of BPF_CALL instruction selects which helper
>   * function eBPF program intends to call
> @@ -502,6 +522,7 @@ enum bpf_func_id {
>  /* BPF_FUNC_l4_csum_replace flags. */
>  #define BPF_F_PSEUDO_HDR		(1ULL << 4)
>  #define BPF_F_MARK_MANGLED_0		(1ULL << 5)
> +#define BPF_F_MARK_ENFORCE		(1ULL << 6)
>  
>  /* BPF_FUNC_clone_redirect and BPF_FUNC_redirect flags. */
>  #define BPF_F_INGRESS			(1ULL << 0)
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web