netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Moshe Shemesh <moshe@mellanox.com>,
	Stephen Hemminger <stephen@networkplumber.org>,
	Jakub Kicinski <kuba@kernel.org>, Jiri Pirko <jiri@nvidia.com>,
	netdev@vger.kernel.org
Subject: Re: [PATCH iproute2-net 3/3] devlink: Add reload stats to dev show
Date: Sun, 29 Nov 2020 14:22:59 -0700	[thread overview]
Message-ID: <505ce6cb-be99-3972-a882-4baeeeece216@gmail.com> (raw)
In-Reply-To: <1606389296-3906-4-git-send-email-moshe@mellanox.com>

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.


  reply	other threads:[~2020-11-29 21:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-26 11:14 [PATCH iproute2-net 0/3] devlink: Add devlink reload action limit and stats Moshe Shemesh
2020-11-26 11:14 ` [PATCH iproute2-net 1/3] devlink: Add devlink reload action and limit options Moshe Shemesh
2020-11-29 21:12   ` David Ahern
2020-12-02  6:57     ` Moshe Shemesh
2020-11-26 11:14 ` [PATCH iproute2-net 2/3] devlink: Add pr_out_dev() helper function Moshe Shemesh
2020-11-29 21:15   ` David Ahern
2020-12-02  7:00     ` Moshe Shemesh
2020-11-26 11:14 ` [PATCH iproute2-net 3/3] devlink: Add reload stats to dev show Moshe Shemesh
2020-11-29 21:22   ` David Ahern [this message]
2020-12-02  7:01     ` Moshe Shemesh
2020-12-01 11:25 ` [PATCH iproute2-net 0/3] devlink: Add devlink reload action limit and stats Vasundhara Volam
2020-12-02  8:44   ` Moshe Shemesh

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=505ce6cb-be99-3972-a882-4baeeeece216@gmail.com \
    --to=dsahern@gmail.com \
    --cc=jiri@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=moshe@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).