[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <505ce6cb-be99-3972-a882-4baeeeece216@gmail.com>
Date: Sun, 29 Nov 2020 14:22:59 -0700
From: David Ahern <dsahern@...il.com>
To: Moshe Shemesh <moshe@...lanox.com>,
Stephen Hemminger <stephen@...workplumber.org>,
Jakub Kicinski <kuba@...nel.org>, Jiri Pirko <jiri@...dia.com>,
netdev@...r.kernel.org
Subject: Re: [PATCH iproute2-net 3/3] devlink: Add reload stats to dev show
On 11/26/20 4:14 AM, Moshe Shemesh wrote:
> @@ -2975,17 +2996,93 @@ static int cmd_dev_param(struct dl *dl)
> return -ENOENT;
> }
>
> -static void pr_out_dev(struct dl *dl, struct nlattr **tb)
> +static void pr_out_action_stats(struct dl *dl, struct nlattr *action_stats)
> +{
> + struct nlattr *tb_stats_entry[DEVLINK_ATTR_MAX + 1] = {};
> + struct nlattr *reload_stats_entry;
> + enum devlink_reload_limit limit;
> + uint32_t value;
> + int err;
> +
> + mnl_attr_for_each_nested(reload_stats_entry, action_stats) {
> + err = mnl_attr_parse_nested(reload_stats_entry, attr_cb, tb_stats_entry);
wrap lines at 80 columns unless it is a print statement.
> + if (err != MNL_CB_OK)
> + return;
> + if (!tb_stats_entry[DEVLINK_ATTR_RELOAD_STATS_LIMIT] ||
> + !tb_stats_entry[DEVLINK_ATTR_RELOAD_STATS_VALUE])
> + return;
> +
> + check_indent_newline(dl);
> + limit = mnl_attr_get_u8(tb_stats_entry[DEVLINK_ATTR_RELOAD_STATS_LIMIT]);
> + value = mnl_attr_get_u32(tb_stats_entry[DEVLINK_ATTR_RELOAD_STATS_VALUE]);
Use temp variables for the attributes to make the code readable.
> + print_uint_name_value(reload_limit_name(limit), value);
> + }
> +}
> +
that applies to all of the patches.
Powered by blists - more mailing lists