From: Alexei Starovoitov <ast@fb•com>
To: "David S . Miller" <davem@davemloft•net>
Cc: Daniel Borkmann <daniel@iogearbox•net>,
Wang Nan <wangnan0@huawei•com>, Martin KaFai Lau <kafai@fb•com>,
<netdev@vger•kernel.org>, <kernel-team@fb•com>
Subject: [PATCH v2 net-next 3/6] tools/lib/bpf: expose bpf_program__set_type()
Date: Thu, 30 Mar 2017 21:45:40 -0700 [thread overview]
Message-ID: <20170331044543.4075183-4-ast@fb.com> (raw)
In-Reply-To: <20170331044543.4075183-1-ast@fb.com>
expose bpf_program__set_type() to set program type
Signed-off-by: Alexei Starovoitov <ast@kernel•org>
Acked-by: Daniel Borkmann <daniel@iogearbox•net>
Acked-by: Martin KaFai Lau <kafai@fb•com>
---
tools/lib/bpf/libbpf.c | 3 +--
tools/lib/bpf/libbpf.h | 2 ++
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index ac6eb863b2a4..1a2c07eb7795 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -1618,8 +1618,7 @@ int bpf_program__nth_fd(struct bpf_program *prog, int n)
return fd;
}
-static void bpf_program__set_type(struct bpf_program *prog,
- enum bpf_prog_type type)
+void bpf_program__set_type(struct bpf_program *prog, enum bpf_prog_type type)
{
prog->type = type;
}
diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
index b30394f9947a..32c7252f734e 100644
--- a/tools/lib/bpf/libbpf.h
+++ b/tools/lib/bpf/libbpf.h
@@ -25,6 +25,7 @@
#include <stdint.h>
#include <stdbool.h>
#include <sys/types.h> // for size_t
+#include <linux/bpf.h>
enum libbpf_errno {
__LIBBPF_ERRNO__START = 4000,
@@ -185,6 +186,7 @@ int bpf_program__set_sched_cls(struct bpf_program *prog);
int bpf_program__set_sched_act(struct bpf_program *prog);
int bpf_program__set_xdp(struct bpf_program *prog);
int bpf_program__set_perf_event(struct bpf_program *prog);
+void bpf_program__set_type(struct bpf_program *prog, enum bpf_prog_type type);
bool bpf_program__is_socket_filter(struct bpf_program *prog);
bool bpf_program__is_tracepoint(struct bpf_program *prog);
--
2.9.3
next prev parent reply other threads:[~2017-03-31 4:45 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-31 4:45 [PATCH v2 net-next 0/6] bpf: program testing framework Alexei Starovoitov
2017-03-31 4:45 ` [PATCH v2 net-next 1/6] bpf: introduce BPF_PROG_TEST_RUN command Alexei Starovoitov
2017-04-01 7:14 ` Jesper Dangaard Brouer
2017-04-01 15:45 ` Alexei Starovoitov
2017-04-01 20:42 ` Jesper Dangaard Brouer
2017-03-31 4:45 ` [PATCH v2 net-next 2/6] tools/lib/bpf: add support for " Alexei Starovoitov
2017-03-31 6:36 ` Wangnan (F)
2017-03-31 4:45 ` Alexei Starovoitov [this message]
2017-03-31 7:49 ` [PATCH v2 net-next 3/6] tools/lib/bpf: expose bpf_program__set_type() Wangnan (F)
2017-03-31 23:28 ` Alexei Starovoitov
2017-04-01 2:29 ` Wangnan (F)
2017-04-01 3:18 ` Alexei Starovoitov
2017-04-01 5:32 ` Wangnan (F)
2017-04-01 5:46 ` Alexei Starovoitov
2017-03-31 4:45 ` [PATCH v2 net-next 4/6] selftests/bpf: add a test for overlapping packet range checks Alexei Starovoitov
2017-03-31 4:45 ` [PATCH v2 net-next 5/6] selftests/bpf: add a test for basic XDP functionality Alexei Starovoitov
2017-03-31 4:45 ` [PATCH v2 net-next 6/6] selftests/bpf: add l4 load balancer test based on sched_cls Alexei Starovoitov
2017-04-01 20:05 ` [PATCH v2 net-next 0/6] bpf: program testing framework David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170331044543.4075183-4-ast@fb.com \
--to=ast@fb$(echo .)com \
--cc=daniel@iogearbox$(echo .)net \
--cc=davem@davemloft$(echo .)net \
--cc=kafai@fb$(echo .)com \
--cc=kernel-team@fb$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=wangnan0@huawei$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox