From: Stephen Hemminger <stephen@networkplumber.org>
To: Vedang Patel <vedang.patel@intel.com>
Cc: netdev@vger.kernel.org, jhs@mojatatu.com,
xiyou.wangcong@gmail.com, jiri@resnulli.us,
vinicius.gomes@intel.com, leandro.maciel.dorileo@intel.com,
jakub.kicinski@netronome.com, m-karicheri2@ti.com,
dsahern@gmail.com
Subject: Re: [PATCH iproute2 net-next v3 2/5] taprio: Add support for setting flags
Date: Mon, 15 Jul 2019 16:37:43 -0700 [thread overview]
Message-ID: <20190715163743.2c6cec2b@hermes.lan> (raw)
In-Reply-To: <1563231104-19912-2-git-send-email-vedang.patel@intel.com>
On Mon, 15 Jul 2019 15:51:41 -0700
Vedang Patel <vedang.patel@intel.com> wrote:
> @@ -405,6 +420,7 @@ static int taprio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
> struct rtattr *tb[TCA_TAPRIO_ATTR_MAX + 1];
> struct tc_mqprio_qopt *qopt = 0;
> __s32 clockid = CLOCKID_INVALID;
> + __u32 taprio_flags = 0;
> int i;
>
> if (opt == NULL)
> @@ -442,6 +458,11 @@ static int taprio_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
>
> print_string(PRINT_ANY, "clockid", "clockid %s", get_clock_name(clockid));
>
> + if (tb[TCA_TAPRIO_ATTR_FLAGS]) {
> + taprio_flags = rta_getattr_u32(tb[TCA_TAPRIO_ATTR_FLAGS]);
> + print_uint(PRINT_ANY, "flags", " flags %x", taprio_flags);
> + }
> +
Overall this looks fine, but three small comments:
1. It is better not to do unnecessary variable initialization
2. It is better to move variables into the basic block where they are used.
3. Use the print_0xhex() instead of print_uint() for hex values. The difference
is that in the JSON output, print_uint would be decimal but the print_0xhex
is always hex. And use "flags %#x" so that it is clear you are printing flags in hex.
next prev parent reply other threads:[~2019-07-15 23:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-15 22:51 [PATCH iproute2 net-next v3 1/5] etf: Add skip_sock_check Vedang Patel
2019-07-15 22:51 ` [PATCH iproute2 net-next v3 2/5] taprio: Add support for setting flags Vedang Patel
2019-07-15 23:37 ` Stephen Hemminger [this message]
2019-07-16 0:15 ` Jakub Kicinski
2019-07-16 0:24 ` Stephen Hemminger
2019-07-16 0:34 ` Jakub Kicinski
2019-07-16 1:15 ` Patel, Vedang
2019-07-15 22:51 ` [PATCH iproute2 net-next v3 3/5] taprio: add support for setting txtime_delay Vedang Patel
2019-07-15 23:38 ` Stephen Hemminger
2019-07-16 1:17 ` Patel, Vedang
2019-07-15 22:51 ` [PATCH iproute2 net-next v3 4/5] tc: etf: Add documentation for skip-skb-check Vedang Patel
2019-07-15 22:51 ` [PATCH iproute2 net-next v3 5/5] tc: taprio: Update documentation Vedang Patel
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=20190715163743.2c6cec2b@hermes.lan \
--to=stephen@networkplumber.org \
--cc=dsahern@gmail.com \
--cc=jakub.kicinski@netronome.com \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=leandro.maciel.dorileo@intel.com \
--cc=m-karicheri2@ti.com \
--cc=netdev@vger.kernel.org \
--cc=vedang.patel@intel.com \
--cc=vinicius.gomes@intel.com \
--cc=xiyou.wangcong@gmail.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.