aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDaniel Borkmann <daniel@iogearbox.net>2017-11-20 18:37:36 -0500
committerDaniel Borkmann <daniel@iogearbox.net>2017-11-20 18:37:36 -0500
commit6547f424be5d9d75c78c146ed6e9f71be1c43981 (patch)
treeecaa7c403a5953e4f31dcc9270b5a93ac6269835 /tools
parent32a72bbd5da2411eab591bf9bc2e39349106193a (diff)
parent1438019479349d262b76f8767ace3273d11b6dcb (diff)
Merge branch 'bpf-offload-fixes'
Jakub Kicinski says: ==================== This series addresses some late comments and moves checking if program has been loaded for the correct device to the drivers. There are also some problems with net namespaces which I didn't take into consideration. On the kernel side we will now simply ignore namespace moves. Since the user space API is not reporting any namespace identification we have to remove the ifindex until a correct way of reporting is agreed upon. v2: - fix ext ack reporting for XDP (David A); - add Jiri's Ack. ==================== Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools')
-rw-r--r--tools/bpf/bpftool/prog.c31
-rw-r--r--tools/include/uapi/linux/bpf.h8
2 files changed, 1 insertions, 38 deletions
diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
index f45c44ef9bec..ad619b96c276 100644
--- a/tools/bpf/bpftool/prog.c
+++ b/tools/bpf/bpftool/prog.c
@@ -41,7 +41,6 @@
41#include <string.h> 41#include <string.h>
42#include <time.h> 42#include <time.h>
43#include <unistd.h> 43#include <unistd.h>
44#include <net/if.h>
45#include <sys/types.h> 44#include <sys/types.h>
46#include <sys/stat.h> 45#include <sys/stat.h>
47 46
@@ -230,21 +229,6 @@ static void print_prog_json(struct bpf_prog_info *info, int fd)
230 info->tag[0], info->tag[1], info->tag[2], info->tag[3], 229 info->tag[0], info->tag[1], info->tag[2], info->tag[3],
231 info->tag[4], info->tag[5], info->tag[6], info->tag[7]); 230 info->tag[4], info->tag[5], info->tag[6], info->tag[7]);
232 231
233 if (info->status & BPF_PROG_STATUS_DEV_BOUND) {
234 jsonw_name(json_wtr, "dev");
235 if (info->ifindex) {
236 char name[IF_NAMESIZE];
237
238 if (!if_indextoname(info->ifindex, name))
239 jsonw_printf(json_wtr, "\"ifindex:%d\"",
240 info->ifindex);
241 else
242 jsonw_printf(json_wtr, "\"%s\"", name);
243 } else {
244 jsonw_printf(json_wtr, "\"unknown\"");
245 }
246 }
247
248 if (info->load_time) { 232 if (info->load_time) {
249 char buf[32]; 233 char buf[32];
250 234
@@ -302,21 +286,6 @@ static void print_prog_plain(struct bpf_prog_info *info, int fd)
302 286
303 printf("tag "); 287 printf("tag ");
304 fprint_hex(stdout, info->tag, BPF_TAG_SIZE, ""); 288 fprint_hex(stdout, info->tag, BPF_TAG_SIZE, "");
305 printf(" ");
306
307 if (info->status & BPF_PROG_STATUS_DEV_BOUND) {
308 printf("dev ");
309 if (info->ifindex) {
310 char name[IF_NAMESIZE];
311
312 if (!if_indextoname(info->ifindex, name))
313 printf("ifindex:%d ", info->ifindex);
314 else
315 printf("%s ", name);
316 } else {
317 printf("unknown ");
318 }
319 }
320 printf("\n"); 289 printf("\n");
321 290
322 if (info->load_time) { 291 if (info->load_time) {
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index e880ae6434ee..4c223ab30293 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 */
@@ -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 {