aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Kicinski <jakub.kicinski@netronome.com>2017-11-20 18:21:59 -0500
committerDaniel Borkmann <daniel@iogearbox.net>2017-11-20 18:37:35 -0500
commit1ee640095f049e7ac4ec36b985abada497b98cc2 (patch)
tree8cc464b6d7f56efb6a355caba80631ebca2c078a
parent51aa423959b0ab62169c98b90566a0628ba096b8 (diff)
bpf: revert report offload info to user space
This reverts commit bd601b6ada11 ("bpf: report offload info to user space"). The ifindex by itself is not sufficient, we should provide information on which network namespace this ifindex belongs to. After considering some options we concluded that it's best to just remove this API for now, and rework it in -next. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
-rw-r--r--include/linux/bpf.h1
-rw-r--r--include/uapi/linux/bpf.h6
-rw-r--r--kernel/bpf/offload.c12
-rw-r--r--kernel/bpf/syscall.c5
4 files changed, 0 insertions, 24 deletions
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 37bbab8c0f56..76c577281d78 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -515,7 +515,6 @@ static inline struct bpf_prog *bpf_prog_get_type(u32 ufd,
515 515
516int bpf_prog_offload_compile(struct bpf_prog *prog); 516int bpf_prog_offload_compile(struct bpf_prog *prog);
517void bpf_prog_offload_destroy(struct bpf_prog *prog); 517void bpf_prog_offload_destroy(struct bpf_prog *prog);
518u32 bpf_prog_offload_ifindex(struct bpf_prog *prog);
519 518
520#if defined(CONFIG_NET) && defined(CONFIG_BPF_SYSCALL) 519#if defined(CONFIG_NET) && defined(CONFIG_BPF_SYSCALL)
521int bpf_prog_offload_init(struct bpf_prog *prog, union bpf_attr *attr); 520int bpf_prog_offload_init(struct bpf_prog *prog, union bpf_attr *attr);
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index 3f626df42516..4c223ab30293 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -897,10 +897,6 @@ enum sk_action {
897 897
898#define BPF_TAG_SIZE 8 898#define BPF_TAG_SIZE 8
899 899
900enum bpf_prog_status {
901 BPF_PROG_STATUS_DEV_BOUND = (1 << 0),
902};
903
904struct bpf_prog_info { 900struct bpf_prog_info {
905 __u32 type; 901 __u32 type;
906 __u32 id; 902 __u32 id;
@@ -914,8 +910,6 @@ struct bpf_prog_info {
914 __u32 nr_map_ids; 910 __u32 nr_map_ids;
915 __aligned_u64 map_ids; 911 __aligned_u64 map_ids;
916 char name[BPF_OBJ_NAME_LEN]; 912 char name[BPF_OBJ_NAME_LEN];
917 __u32 ifindex;
918 __u32 status;
919} __attribute__((aligned(8))); 913} __attribute__((aligned(8)));
920 914
921struct bpf_map_info { 915struct bpf_map_info {
diff --git a/kernel/bpf/offload.c b/kernel/bpf/offload.c
index d4267c674fec..68ec884440b7 100644
--- a/kernel/bpf/offload.c
+++ b/kernel/bpf/offload.c
@@ -149,18 +149,6 @@ int bpf_prog_offload_compile(struct bpf_prog *prog)
149 return bpf_prog_offload_translate(prog); 149 return bpf_prog_offload_translate(prog);
150} 150}
151 151
152u32 bpf_prog_offload_ifindex(struct bpf_prog *prog)
153{
154 struct bpf_dev_offload *offload = prog->aux->offload;
155 u32 ifindex;
156
157 rtnl_lock();
158 ifindex = offload->netdev ? offload->netdev->ifindex : 0;
159 rtnl_unlock();
160
161 return ifindex;
162}
163
164const struct bpf_prog_ops bpf_offload_prog_ops = { 152const struct bpf_prog_ops bpf_offload_prog_ops = {
165}; 153};
166 154
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 41509cf825d8..2c4cfeaa8d5e 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -1616,11 +1616,6 @@ static int bpf_prog_get_info_by_fd(struct bpf_prog *prog,
1616 return -EFAULT; 1616 return -EFAULT;
1617 } 1617 }
1618 1618
1619 if (bpf_prog_is_dev_bound(prog->aux)) {
1620 info.status |= BPF_PROG_STATUS_DEV_BOUND;
1621 info.ifindex = bpf_prog_offload_ifindex(prog);
1622 }
1623
1624done: 1619done:
1625 if (copy_to_user(uinfo, &info, info_len) || 1620 if (copy_to_user(uinfo, &info, info_len) ||
1626 put_user(info_len, &uattr->info.info_len)) 1621 put_user(info_len, &uattr->info.info_len))