[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170621212942.2333878-1-kafai@fb.com>
Date: Wed, 21 Jun 2017 14:29:42 -0700
From: Martin KaFai Lau <kafai@...com>
To: <stephen@...workplumber.org>
CC: Daniel Borkmann <daniel@...earbox.net>,
Alexei Starovoitov <ast@...com>, <davem@...emloft.net>,
<netdev@...r.kernel.org>
Subject: [PATCH iproute2 net-next] bpf: Add support for IFLA_XDP_PROG_ID
This patch adds support to the newly added IFLA_XDP_PROG_ID.
./ip link show dev eth0
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 xdpgeneric/id:2 qdisc [...]
Signed-off-by: Martin KaFai Lau <kafai@...com>
---
include/linux/if_link.h | 1 +
ip/iplink_xdp.c | 12 +++++++++---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index a536a24b1c28..75e6824094e3 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -905,6 +905,7 @@ enum {
IFLA_XDP_FD,
IFLA_XDP_ATTACHED,
IFLA_XDP_FLAGS,
+ IFLA_XDP_PROG_ID,
__IFLA_XDP_MAX,
};
diff --git a/ip/iplink_xdp.c b/ip/iplink_xdp.c
index 98503fab7d3c..4857f50c80de 100644
--- a/ip/iplink_xdp.c
+++ b/ip/iplink_xdp.c
@@ -90,9 +90,15 @@ void xdp_dump(FILE *fp, struct rtattr *xdp)
if (mode == XDP_ATTACHED_NONE)
return;
else if (mode == XDP_ATTACHED_DRV)
- fprintf(fp, "xdp ");
+ fprintf(fp, "xdp");
else if (mode == XDP_ATTACHED_SKB)
- fprintf(fp, "xdpgeneric ");
+ fprintf(fp, "xdpgeneric");
else
- fprintf(fp, "xdp[%u] ", mode);
+ fprintf(fp, "xdp[%u]", mode);
+
+ if (tb[IFLA_XDP_PROG_ID])
+ fprintf(fp, "/id:%u",
+ rta_getattr_u32(tb[IFLA_XDP_PROG_ID]));
+
+ fprintf(fp, " ");
}
--
2.9.3
Powered by blists - more mailing lists