diff mbox series

[v3,bpf-next,2/5] bpf: sync bpf.h to tools and update bpf_helpers.h

Message ID 20190301203847.4181108-1-brakmo@fb.com
State Accepted
Delegated to: BPF Maintainers
Headers show
Series [v3,bpf-next,1/5] bpf: add bpf helper bpf_skb_ecn_set_ce | expand

Commit Message

Lawrence Brakmo March 1, 2019, 8:38 p.m. UTC
This patch syncs the uapi bpf.h to tools/ and also updates
bpf_herlpers.h in tools/

Signed-off-by: Lawrence Brakmo <brakmo@fb.com>
---
 tools/include/uapi/linux/bpf.h            | 10 +++++++++-
 tools/testing/selftests/bpf/bpf_helpers.h |  2 ++
 2 files changed, 11 insertions(+), 1 deletion(-)

Comments

Song Liu March 2, 2019, 12:26 a.m. UTC | #1
On Fri, Mar 1, 2019 at 12:39 PM brakmo <brakmo@fb.com> wrote:
>
> This patch syncs the uapi bpf.h to tools/ and also updates
> bpf_herlpers.h in tools/
>
> Signed-off-by: Lawrence Brakmo <brakmo@fb.com>

Acked-by: Song Liu <songliubraving@fb.com>

> ---
>  tools/include/uapi/linux/bpf.h            | 10 +++++++++-
>  tools/testing/selftests/bpf/bpf_helpers.h |  2 ++
>  2 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
> index 2e308e90ffea..3c38ac9a92a7 100644
> --- a/tools/include/uapi/linux/bpf.h
> +++ b/tools/include/uapi/linux/bpf.h
> @@ -2359,6 +2359,13 @@ union bpf_attr {
>   *     Return
>   *             A **struct bpf_tcp_sock** pointer on success, or NULL in
>   *             case of failure.
> + *
> + * int bpf_skb_ecn_set_ce(struct sk_buf *skb)
> + *     Description
> + *             Sets ECN of IP header to ce (congestion encountered) if
> + *             current value is ect (ECN capable). Works with IPv6 and IPv4.
> + *     Return
> + *             1 if set, 0 if not set.
>   */
>  #define __BPF_FUNC_MAPPER(FN)          \
>         FN(unspec),                     \
> @@ -2457,7 +2464,8 @@ union bpf_attr {
>         FN(spin_lock),                  \
>         FN(spin_unlock),                \
>         FN(sk_fullsock),                \
> -       FN(tcp_sock),
> +       FN(tcp_sock),                   \
> +       FN(skb_ecn_set_ce),
>
>  /* integer value in 'imm' field of BPF_CALL instruction selects which helper
>   * function eBPF program intends to call
> diff --git a/tools/testing/selftests/bpf/bpf_helpers.h b/tools/testing/selftests/bpf/bpf_helpers.h
> index d9999f1ed1d2..332cbf8c7abc 100644
> --- a/tools/testing/selftests/bpf/bpf_helpers.h
> +++ b/tools/testing/selftests/bpf/bpf_helpers.h
> @@ -180,6 +180,8 @@ static struct bpf_sock *(*bpf_sk_fullsock)(struct bpf_sock *sk) =
>         (void *) BPF_FUNC_sk_fullsock;
>  static struct bpf_tcp_sock *(*bpf_tcp_sock)(struct bpf_sock *sk) =
>         (void *) BPF_FUNC_tcp_sock;
> +static int (*bpf_skb_ecn_set_ce)(void *ctx) =
> +       (void *) BPF_FUNC_skb_ecn_set_ce;
>
>  /* llvm builtin functions that eBPF C program may use to
>   * emit BPF_LD_ABS and BPF_LD_IND instructions
> --
> 2.17.1
>
diff mbox series

Patch

diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index 2e308e90ffea..3c38ac9a92a7 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -2359,6 +2359,13 @@  union bpf_attr {
  *	Return
  *		A **struct bpf_tcp_sock** pointer on success, or NULL in
  *		case of failure.
+ *
+ * int bpf_skb_ecn_set_ce(struct sk_buf *skb)
+ *     Description
+ *             Sets ECN of IP header to ce (congestion encountered) if
+ *             current value is ect (ECN capable). Works with IPv6 and IPv4.
+ *     Return
+ *             1 if set, 0 if not set.
  */
 #define __BPF_FUNC_MAPPER(FN)		\
 	FN(unspec),			\
@@ -2457,7 +2464,8 @@  union bpf_attr {
 	FN(spin_lock),			\
 	FN(spin_unlock),		\
 	FN(sk_fullsock),		\
-	FN(tcp_sock),
+	FN(tcp_sock),			\
+	FN(skb_ecn_set_ce),
 
 /* integer value in 'imm' field of BPF_CALL instruction selects which helper
  * function eBPF program intends to call
diff --git a/tools/testing/selftests/bpf/bpf_helpers.h b/tools/testing/selftests/bpf/bpf_helpers.h
index d9999f1ed1d2..332cbf8c7abc 100644
--- a/tools/testing/selftests/bpf/bpf_helpers.h
+++ b/tools/testing/selftests/bpf/bpf_helpers.h
@@ -180,6 +180,8 @@  static struct bpf_sock *(*bpf_sk_fullsock)(struct bpf_sock *sk) =
 	(void *) BPF_FUNC_sk_fullsock;
 static struct bpf_tcp_sock *(*bpf_tcp_sock)(struct bpf_sock *sk) =
 	(void *) BPF_FUNC_tcp_sock;
+static int (*bpf_skb_ecn_set_ce)(void *ctx) =
+	(void *) BPF_FUNC_skb_ecn_set_ce;
 
 /* llvm builtin functions that eBPF C program may use to
  * emit BPF_LD_ABS and BPF_LD_IND instructions