From: Daniel Borkmann <daniel@iogearbox•net>
To: Sergei Shtylyov <sergei.shtylyov@cogentembedded•com>,
stephen@networkplumber•org
Cc: alexei.starovoitov@gmail•com, netdev@vger•kernel.org
Subject: Re: [PATCH iproute2 -master 1/2] bpf: update printing of generic xdp mode
Date: Sat, 13 May 2017 11:19:10 +0200 [thread overview]
Message-ID: <5916CF8E.4000602@iogearbox.net> (raw)
In-Reply-To: <d012ef18-8689-81ef-8f56-ef2b9c673b44@cogentembedded.com>
On 05/13/2017 11:01 AM, Sergei Shtylyov wrote:
> On 5/13/2017 3:32 AM, Daniel Borkmann wrote:
>
>> 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>
>> ---
>> ip/iplink_xdp.c | 19 +++++++++++--------
>> 1 file changed, 11 insertions(+), 8 deletions(-)
>>
>> diff --git a/ip/iplink_xdp.c b/ip/iplink_xdp.c
>> index a1380ee..98503fa 100644
>> --- a/ip/iplink_xdp.c
>> +++ b/ip/iplink_xdp.c
>> @@ -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)
>> {
>> struct rtattr *tb[IFLA_XDP_MAX + 1];
>> - __u32 flags = 0;
>> + __u8 mode;
>>
>> parse_rtattr_nested(tb, IFLA_XDP_MAX, xdp);
>>
>> - if (!tb[IFLA_XDP_ATTACHED] ||
>> - !rta_getattr_u8(tb[IFLA_XDP_ATTACHED]))
>> + if (!tb[IFLA_XDP_ATTACHED])
>> return;
>>
>> - if (tb[IFLA_XDP_FLAGS])
>> - flags = rta_getattr_u32(tb[IFLA_XDP_FLAGS]);
>> -
>> - fprintf(fp, "xdp%s ",
>> - flags & XDP_FLAGS_SKB_MODE ? "generic" : "");
>> + mode = rta_getattr_u8(tb[IFLA_XDP_ATTACHED]);
>> + if (mode == XDP_ATTACHED_NONE)
>> + return;
>> + else if (mode == XDP_ATTACHED_DRV)
>> + fprintf(fp, "xdp ");
>> + else if (mode == XDP_ATTACHED_SKB)
>> + fprintf(fp, "xdpgeneric ");
>> + else
>> + fprintf(fp, "xdp[%u] ", mode);
>
> This is asking to be a *switch* statement.
The code is fine as-is, thank you !
next prev parent reply other threads:[~2017-05-13 9:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-13 0:32 [PATCH iproute2 -master 0/2] Two misc BPF updates Daniel Borkmann
2017-05-13 0:32 ` [PATCH iproute2 -master 1/2] bpf: update printing of generic xdp mode Daniel Borkmann
2017-05-13 9:01 ` Sergei Shtylyov
2017-05-13 9:19 ` Daniel Borkmann [this message]
2017-05-13 0:32 ` [PATCH iproute2 -master 2/2] bpf: dump error to the user when retrieving pinned prog fails Daniel Borkmann
2017-05-15 22:07 ` [PATCH iproute2 -master 0/2] Two misc BPF updates Stephen Hemminger
2017-05-31 0:49 ` Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5916CF8E.4000602@iogearbox.net \
--to=daniel@iogearbox$(echo .)net \
--cc=alexei.starovoitov@gmail$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=sergei.shtylyov@cogentembedded$(echo .)com \
--cc=stephen@networkplumber$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox