History

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.

Jakub Kicinski committed 8 years ago

Commit 1f6f4cb1 parent 649f11d4 files · +5 −5Browse files

Unified · Split

4 files
  1. include/uapi/linux/bpf.h +1 −1
  2. kernel/bpf/offload.c +1 −1
  3. kernel/bpf/syscall.c +2 −2
  4. tools/include/uapi/linux/bpf.h +1 −1
include/uapi/linux/bpf.h+1−1
@@ -262,7 +262,7 @@ union bpf_attr { · 261 unmodified lines
262262 __u32 kern_version; /* checked when prog_type=kprobe */
263263 __u32 prog_flags;
264264 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 */
266266 };
267267
268268 struct { /* anonymous struct used by BPF_OBJ_* commands */
kernel/bpf/offload.c+1−1
@@ -29,7 +29,7 @@ int bpf_prog_offload_init(struct bpf_prog *prog, union bpf_attr *attr) · 28 unmodified lines
2929 init_waitqueue_head(&offload->verifier_done);
3030
3131 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);
3333 if (!offload->netdev) {
3434 rtnl_unlock();
3535 kfree(offload);
kernel/bpf/syscall.c+2−2
@@ -1118,7 +1118,7 @@ struct bpf_prog *bpf_prog_get_type_dev(u32 ufd, enum bpf_prog_type type, · 1117 unmodified lines
11181118 EXPORT_SYMBOL_GPL(bpf_prog_get_type_dev);
11191119
11201120 /* 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
11221122
11231123 static int bpf_prog_load(union bpf_attr *attr)
11241124 {
@@ -1181,7 +1181,7 @@ static int bpf_prog_load(union bpf_attr *attr) · 56 unmodified lines
11811181 atomic_set(&prog->aux->refcnt, 1);
11821182 prog->gpl_compatible = is_gpl ? 1 : 0;
11831183
1184− if (attr->prog_target_ifindex) {
1184+ if (attr->prog_ifindex) {
11851185 err = bpf_prog_offload_init(prog, attr);
11861186 if (err)
11871187 goto free_prog;
tools/include/uapi/linux/bpf.h+1−1
@@ -262,7 +262,7 @@ union bpf_attr { · 261 unmodified lines
262262 __u32 kern_version; /* checked when prog_type=kprobe */
263263 __u32 prog_flags;
264264 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 */
266266 };
267267
268268 struct { /* anonymous struct used by BPF_OBJ_* commands */