Re: [PATCH iproute2 net-next] bpf: Add support for IFLA_XDP_PROG_ID

2017-06-27 Thread Stephen Hemminger
On Wed, 21 Jun 2017 14:29:42 -0700
Martin KaFai Lau  wrote:

> This patch adds support to the newly added IFLA_XDP_PROG_ID.
> 
> ./ip link show dev eth0
> 3: eth0:  mtu 1500 xdpgeneric/id:2 qdisc 
> [...]
> 
> Signed-off-by: Martin KaFai Lau 

Applied to net-next


Re: [PATCH iproute2 net-next] bpf: Add support for IFLA_XDP_PROG_ID

2017-06-21 Thread Daniel Borkmann

On 06/21/2017 11:29 PM, Martin KaFai Lau wrote:

This patch adds support to the newly added IFLA_XDP_PROG_ID.

./ip link show dev eth0
3: eth0:  mtu 1500 xdpgeneric/id:2 qdisc [...]

Signed-off-by: Martin KaFai Lau 


Acked-by: Daniel Borkmann 


[PATCH iproute2 net-next] bpf: Add support for IFLA_XDP_PROG_ID

2017-06-21 Thread Martin KaFai Lau
This patch adds support to the newly added IFLA_XDP_PROG_ID.

./ip link show dev eth0
3: eth0:  mtu 1500 xdpgeneric/id:2 qdisc [...]

Signed-off-by: Martin KaFai Lau 
---
 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