From: Stephen Hemminger <stephen@networkplumber.org>
To: Jakub Kicinski <jakub.kicinski@netronome.com>
Cc: alexei.starovoitov@gmail.com, daniel@iogearbox.net,
dsahern@gmail.com, netdev@vger.kernel.org,
oss-drivers@netronome.com
Subject: Re: [PATCH iproute2-next] iplink: add support for reporting multiple XDP programs
Date: Fri, 13 Jul 2018 13:59:41 -0700 [thread overview]
Message-ID: <20180713135941.3791c3ff@xeon-e3> (raw)
In-Reply-To: <20180713204359.1161-1-jakub.kicinski@netronome.com>
On Fri, 13 Jul 2018 13:43:59 -0700
Jakub Kicinski <jakub.kicinski@netronome.com> wrote:
>
> +static void xdp_dump_prog_one(FILE *fp, struct rtattr *tb[IFLA_XDP_MAX + 1],
> + __u32 attr, bool link, bool details, char *pfx)
> +{
> + __u32 prog_id;
> +
> + if (!tb[attr])
> + return;
> +
> + prog_id = rta_getattr_u32(tb[attr]);
> + if (!details) {
> + if (prog_id && !link && attr == IFLA_XDP_PROG_ID)
> + fprintf(fp, "/id:%u", prog_id);
> + return;
> + }
> +
> + if (prog_id) {
> + fprintf(fp, "%s prog/xdp%s ", _SL_, pfx);
> + bpf_dump_prog_info(fp, prog_id);
> + }
Maybe const char *pfx.
I prefer to not use "printf(fp," and use print_string(PRINT_FP, NULL, "%s", ...)
because otherwise you end up mixing strings and json format output in the
same result.
You should be able to do
tc -j ...
and always get valid JSON output.
One quick way to test json validation is to pipe it into python:
tc -j ... | python -mjson.tool
next prev parent reply other threads:[~2018-07-13 21:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-13 20:43 [PATCH iproute2-next] iplink: add support for reporting multiple XDP programs Jakub Kicinski
2018-07-13 20:59 ` Stephen Hemminger [this message]
2018-07-13 21:20 ` Jakub Kicinski
2018-07-13 22:23 ` Stephen Hemminger
2018-07-13 22:59 ` Jakub Kicinski
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=20180713135941.3791c3ff@xeon-e3 \
--to=stephen@networkplumber.org \
--cc=alexei.starovoitov@gmail.com \
--cc=daniel@iogearbox.net \
--cc=dsahern@gmail.com \
--cc=jakub.kicinski@netronome.com \
--cc=netdev@vger.kernel.org \
--cc=oss-drivers@netronome.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.