aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Kicinski <jakub.kicinski@netronome.com>2017-11-20 18:21:53 -0500
committerDaniel Borkmann <daniel@iogearbox.net>2017-11-20 18:37:35 -0500
commit1f6f4cb7ba219b00a3fa9afe8049fa16444d8b52 (patch)
tree72cb4ecf1587efe24184c61c215e1ad4fd86adb6
parent649f11dcd19a5f0d00fdbc760fbdccdd98e56a43 (diff)
bpf: offload: rename the ifindex field
bpf_target_prog seems long and clunky, rename it to prog_ifindex. We don't want to call this field just ifindex, because maps may need a similar field in the future and bpf_attr members for programs and maps are unnamed. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com> Acked-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
-rw-r--r--include/uapi/linux/bpf.h2
-rw-r--r--kernel/bpf/offload.c2
-rw-r--r--kernel/bpf/syscall.c4
-rw-r--r--tools/include/uapi/linux/bpf.h2
4 files changed, 5 insertions, 5 deletions
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index e880ae6434ee..3f626df42516 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -262,7 +262,7 @@ union bpf_attr {
262 __u32 kern_version; /* checked when prog_type=kprobe */ 262 __u32 kern_version; /* checked when prog_type=kprobe */
263 __u32 prog_flags; 263 __u32 prog_flags;
264 char prog_name[BPF_OBJ_NAME_LEN]; 264 char prog_name[BPF_OBJ_NAME_LEN];
265 __u32 prog_target_ifindex; /* ifindex of netdev to prep for */ 265 __u32 prog_ifindex; /* ifindex of netdev to prep for */
266 }; 266 };
267 267
268 struct { /* anonymous struct used by BPF_OBJ_* commands */ 268 struct { /* anonymous struct used by BPF_OBJ_* commands */
diff --git a/kernel/bpf/offload.c b/kernel/bpf/offload.c
index ac187f9ee182..a778e5df7e26 100644
--- a/kernel/bpf/offload.c
+++ b/kernel/bpf/offload.c
@@ -29,7 +29,7 @@ int bpf_prog_offload_init(struct bpf_prog *prog, union bpf_attr *attr)
29 init_waitqueue_head(&offload->verifier_done); 29 init_waitqueue_head(&offload->verifier_done);
30 30
31 rtnl_lock(); 31 rtnl_lock();
32 offload->netdev = __dev_get_by_index(net, attr->prog_target_ifindex); 32 offload->netdev = __dev_get_by_index(net, attr->prog_ifindex);
33 if (!offload->netdev) { 33 if (!offload->netdev) {
34 rtnl_unlock(); 34 rtnl_unlock();
35 kfree(offload); 35 kfree(offload);
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 09badc37e864..8e9d065bb7cd 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -1118,7 +1118,7 @@ struct bpf_prog *bpf_prog_get_type_dev(u32 ufd, enum bpf_prog_type type,
1118EXPORT_SYMBOL_GPL(bpf_prog_get_type_dev); 1118EXPORT_SYMBOL_GPL(bpf_prog_get_type_dev);
1119 1119
1120/* last field in 'union bpf_attr' used by this command */ 1120/* last field in 'union bpf_attr' used by this command */
1121#define BPF_PROG_LOAD_LAST_FIELD prog_target_ifindex 1121#define BPF_PROG_LOAD_LAST_FIELD prog_ifindex
1122 1122
1123static int bpf_prog_load(union bpf_attr *attr) 1123static int bpf_prog_load(union bpf_attr *attr)
1124{ 1124{
@@ -1181,7 +1181,7 @@ static int bpf_prog_load(union bpf_attr *attr)
1181 atomic_set(&prog->aux->refcnt, 1); 1181 atomic_set(&prog->aux->refcnt, 1);
1182 prog->gpl_compatible = is_gpl ? 1 : 0; 1182 prog->gpl_compatible = is_gpl ? 1 : 0;
1183 1183
1184 if (attr->prog_target_ifindex) { 1184 if (attr->prog_ifindex) {
1185 err = bpf_prog_offload_init(prog, attr); 1185 err = bpf_prog_offload_init(prog, attr);
1186 if (err) 1186 if (err)
1187 goto free_prog; 1187 goto free_prog;
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index e880ae6434ee..3f626df42516 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -262,7 +262,7 @@ union bpf_attr {
262 __u32 kern_version; /* checked when prog_type=kprobe */ 262 __u32 kern_version; /* checked when prog_type=kprobe */
263 __u32 prog_flags; 263 __u32 prog_flags;
264 char prog_name[BPF_OBJ_NAME_LEN]; 264 char prog_name[BPF_OBJ_NAME_LEN];
265 __u32 prog_target_ifindex; /* ifindex of netdev to prep for */ 265 __u32 prog_ifindex; /* ifindex of netdev to prep for */
266 }; 266 };
267 267
268 struct { /* anonymous struct used by BPF_OBJ_* commands */ 268 struct { /* anonymous struct used by BPF_OBJ_* commands */