bpf: update printing of generic xdp mode
Follow-up to d67b9cd28c1d ("xdp: refine xdp api with regards to
generic xdp") in order to update the XDP dumping part.
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
This commit is contained in:
parent
759fa6086e
commit
077bb1803c
|
|
@ -79,17 +79,20 @@ int xdp_parse(int *argc, char ***argv, struct iplink_req *req, bool generic)
|
||||||
void xdp_dump(FILE *fp, struct rtattr *xdp)
|
void xdp_dump(FILE *fp, struct rtattr *xdp)
|
||||||
{
|
{
|
||||||
struct rtattr *tb[IFLA_XDP_MAX + 1];
|
struct rtattr *tb[IFLA_XDP_MAX + 1];
|
||||||
__u32 flags = 0;
|
__u8 mode;
|
||||||
|
|
||||||
parse_rtattr_nested(tb, IFLA_XDP_MAX, xdp);
|
parse_rtattr_nested(tb, IFLA_XDP_MAX, xdp);
|
||||||
|
|
||||||
if (!tb[IFLA_XDP_ATTACHED] ||
|
if (!tb[IFLA_XDP_ATTACHED])
|
||||||
!rta_getattr_u8(tb[IFLA_XDP_ATTACHED]))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (tb[IFLA_XDP_FLAGS])
|
mode = rta_getattr_u8(tb[IFLA_XDP_ATTACHED]);
|
||||||
flags = rta_getattr_u32(tb[IFLA_XDP_FLAGS]);
|
if (mode == XDP_ATTACHED_NONE)
|
||||||
|
return;
|
||||||
fprintf(fp, "xdp%s ",
|
else if (mode == XDP_ATTACHED_DRV)
|
||||||
flags & XDP_FLAGS_SKB_MODE ? "generic" : "");
|
fprintf(fp, "xdp ");
|
||||||
|
else if (mode == XDP_ATTACHED_SKB)
|
||||||
|
fprintf(fp, "xdpgeneric ");
|
||||||
|
else
|
||||||
|
fprintf(fp, "xdp[%u] ", mode);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue