From: Jakub Kicinski <kuba@kernel.org>
To: dsahern@gmail.com
Cc: netdev@vger.kernel.org, stephen@networkplumber.org,
jiri@resnulli.us, Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH iproute2-next] tc: m_action: rename hw stats type uAPI
Date: Fri, 20 Mar 2020 13:21:45 -0700 [thread overview]
Message-ID: <20200320202145.149844-1-kuba@kernel.org> (raw)
In-Reply-To: <4e960372-2a5e-5a38-b2ae-843957f0cd67@gmail.com>
Follow the kernel rename to shorten the identifiers.
Rename hw_stats_type to hw_stats.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
tc/m_action.c | 39 +++++++++++++++++++--------------------
1 file changed, 19 insertions(+), 20 deletions(-)
diff --git a/tc/m_action.c b/tc/m_action.c
index 58ae1846033b..2c4b5df6e05c 100644
--- a/tc/m_action.c
+++ b/tc/m_action.c
@@ -150,31 +150,30 @@ new_cmd(char **argv)
(matches(*argv, "add") == 0);
}
-static const struct hw_stats_type_item {
+static const struct hw_stats_item {
const char *str;
__u8 type;
-} hw_stats_type_items[] = {
- { "immediate", TCA_ACT_HW_STATS_TYPE_IMMEDIATE },
- { "delayed", TCA_ACT_HW_STATS_TYPE_DELAYED },
+} hw_stats_items[] = {
+ { "immediate", TCA_ACT_HW_STATS_IMMEDIATE },
+ { "delayed", TCA_ACT_HW_STATS_DELAYED },
{ "disabled", 0 }, /* no bit set */
};
static void print_hw_stats(const struct rtattr *arg)
{
- struct nla_bitfield32 *hw_stats_type_bf = RTA_DATA(arg);
- __u8 hw_stats_type;
+ struct nla_bitfield32 *hw_stats_bf = RTA_DATA(arg);
+ __u8 hw_stats;
int i;
- hw_stats_type = hw_stats_type_bf->value & hw_stats_type_bf->selector;
+ hw_stats = hw_stats_bf->value & hw_stats_bf->selector;
print_string(PRINT_FP, NULL, "\t", NULL);
open_json_array(PRINT_ANY, "hw_stats");
- for (i = 0; i < ARRAY_SIZE(hw_stats_type_items); i++) {
- const struct hw_stats_type_item *item;
+ for (i = 0; i < ARRAY_SIZE(hw_stats_items); i++) {
+ const struct hw_stats_item *item;
- item = &hw_stats_type_items[i];
- if ((!hw_stats_type && !item->type) ||
- hw_stats_type & item->type)
+ item = &hw_stats_items[i];
+ if ((!hw_stats && !item->type) || hw_stats & item->type)
print_string(PRINT_ANY, NULL, " %s", item->str);
}
close_json_array(PRINT_JSON, NULL);
@@ -184,18 +183,18 @@ static int parse_hw_stats(const char *str, struct nlmsghdr *n)
{
int i;
- for (i = 0; i < ARRAY_SIZE(hw_stats_type_items); i++) {
- const struct hw_stats_type_item *item;
+ for (i = 0; i < ARRAY_SIZE(hw_stats_items); i++) {
+ const struct hw_stats_item *item;
- item = &hw_stats_type_items[i];
+ item = &hw_stats_items[i];
if (matches(str, item->str) == 0) {
- struct nla_bitfield32 hw_stats_type_bf = {
+ struct nla_bitfield32 hw_stats_bf = {
.value = item->type,
.selector = item->type
};
- addattr_l(n, MAX_MSG, TCA_ACT_HW_STATS_TYPE,
- &hw_stats_type_bf, sizeof(hw_stats_type_bf));
+ addattr_l(n, MAX_MSG, TCA_ACT_HW_STATS,
+ &hw_stats_bf, sizeof(hw_stats_bf));
return 0;
}
@@ -399,8 +398,8 @@ static int tc_print_one_action(FILE *f, struct rtattr *arg)
TCA_ACT_FLAGS_NO_PERCPU_STATS);
print_string(PRINT_FP, NULL, "%s", _SL_);
}
- if (tb[TCA_ACT_HW_STATS_TYPE])
- print_hw_stats(tb[TCA_ACT_HW_STATS_TYPE]);
+ if (tb[TCA_ACT_HW_STATS])
+ print_hw_stats(tb[TCA_ACT_HW_STATS]);
return 0;
}
--
2.25.1
next prev parent reply other threads:[~2020-03-20 20:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-14 9:25 [patch iproute2/net-next v5] tc: m_action: introduce support for hw stats type Jiri Pirko
2020-03-19 23:56 ` David Ahern
2020-03-20 9:59 ` Jiri Pirko
2020-03-20 16:34 ` David Ahern
2020-03-20 20:08 ` Jakub Kicinski
2020-03-20 20:12 ` David Ahern
2020-03-20 20:21 ` Jakub Kicinski [this message]
2020-03-25 16:43 ` [PATCH iproute2-next] tc: m_action: rename hw stats type uAPI David Ahern
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=20200320202145.149844-1-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=dsahern@gmail.com \
--cc=jiri@resnulli.us \
--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).