Skip to content

Commit 0dfb2d8

Browse files
kuba-moodavem330
authored andcommitted
net: sched: rename more stats_types
Commit 53eca1f ("net: rename flow_action_hw_stats_types* -> flow_action_hw_stats*") renamed just the flow action types and helpers. For consistency rename variables, enums, struct members and UAPI too (note that this UAPI was not in any official release, yet). Signed-off-by: Jakub Kicinski <kuba@kernel.org> Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent c3c123d commit 0dfb2d8

7 files changed

Lines changed: 55 additions & 58 deletions

File tree

‎drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp,
3030
return -EOPNOTSUPP;
3131

3232
act = flow_action_first_entry_get(flow_action);
33-
if (act->hw_stats_type == FLOW_ACTION_HW_STATS_ANY ||
34-
act->hw_stats_type == FLOW_ACTION_HW_STATS_IMMEDIATE) {
33+
if (act->hw_stats == FLOW_ACTION_HW_STATS_ANY ||
34+
act->hw_stats == FLOW_ACTION_HW_STATS_IMMEDIATE) {
3535
/* Count action is inserted first */
3636
err = mlxsw_sp_acl_rulei_act_count(mlxsw_sp, rulei, extack);
3737
if (err)
3838
return err;
39-
} else if (act->hw_stats_type != FLOW_ACTION_HW_STATS_DISABLED) {
39+
} else if (act->hw_stats != FLOW_ACTION_HW_STATS_DISABLED) {
4040
NL_SET_ERR_MSG_MOD(extack, "Unsupported action HW stats type");
4141
return -EOPNOTSUPP;
4242
}

‎drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,7 +1387,7 @@ static int __stmmac_test_l3filt(struct stmmac_priv *priv, u32 dst, u32 src,
13871387
cls->rule = rule;
13881388

13891389
rule->action.entries[0].id = FLOW_ACTION_DROP;
1390-
rule->action.entries[0].hw_stats_type = FLOW_ACTION_HW_STATS_ANY;
1390+
rule->action.entries[0].hw_stats = FLOW_ACTION_HW_STATS_ANY;
13911391
rule->action.num_entries = 1;
13921392

13931393
attr.dst = priv->dev->dev_addr;
@@ -1516,7 +1516,7 @@ static int __stmmac_test_l4filt(struct stmmac_priv *priv, u32 dst, u32 src,
15161516
cls->rule = rule;
15171517

15181518
rule->action.entries[0].id = FLOW_ACTION_DROP;
1519-
rule->action.entries[0].hw_stats_type = FLOW_ACTION_HW_STATS_ANY;
1519+
rule->action.entries[0].hw_stats = FLOW_ACTION_HW_STATS_ANY;
15201520
rule->action.num_entries = 1;
15211521

15221522
attr.dst = priv->dev->dev_addr;

‎include/net/act_api.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ struct tc_action {
4141
struct tc_cookie __rcu *act_cookie;
4242
struct tcf_chain __rcu *goto_chain;
4343
u32 tcfa_flags;
44-
u8 hw_stats_type;
44+
u8 hw_stats;
4545
};
4646
#define tcf_index common.tcfa_index
4747
#define tcf_refcnt common.tcfa_refcnt
@@ -53,8 +53,8 @@ struct tc_action {
5353
#define tcf_rate_est common.tcfa_rate_est
5454
#define tcf_lock common.tcfa_lock
5555

56-
#define TCA_ACT_HW_STATS_TYPE_ANY (TCA_ACT_HW_STATS_TYPE_IMMEDIATE | \
57-
TCA_ACT_HW_STATS_TYPE_DELAYED)
56+
#define TCA_ACT_HW_STATS_ANY (TCA_ACT_HW_STATS_IMMEDIATE | \
57+
TCA_ACT_HW_STATS_DELAYED)
5858

5959
/* Update lastuse only if needed, to avoid dirtying a cache line.
6060
* We use a temp variable to avoid fetching jiffies twice.

‎include/net/flow_offload.h‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,12 @@ enum flow_action_mangle_base {
163163
FLOW_ACT_MANGLE_HDR_TYPE_UDP,
164164
};
165165

166-
enum flow_action_hw_stats_type_bit {
166+
enum flow_action_hw_stats_bit {
167167
FLOW_ACTION_HW_STATS_IMMEDIATE_BIT,
168168
FLOW_ACTION_HW_STATS_DELAYED_BIT,
169169
};
170170

171-
enum flow_action_hw_stats_type {
171+
enum flow_action_hw_stats {
172172
FLOW_ACTION_HW_STATS_DISABLED = 0,
173173
FLOW_ACTION_HW_STATS_IMMEDIATE =
174174
BIT(FLOW_ACTION_HW_STATS_IMMEDIATE_BIT),
@@ -191,7 +191,7 @@ void flow_action_cookie_destroy(struct flow_action_cookie *cookie);
191191

192192
struct flow_action_entry {
193193
enum flow_action_id id;
194-
enum flow_action_hw_stats_type hw_stats_type;
194+
enum flow_action_hw_stats hw_stats;
195195
action_destr destructor;
196196
void *destructor_priv;
197197
union {
@@ -289,18 +289,18 @@ flow_action_mixed_hw_stats_check(const struct flow_action *action,
289289
struct netlink_ext_ack *extack)
290290
{
291291
const struct flow_action_entry *action_entry;
292-
u8 uninitialized_var(last_hw_stats_type);
292+
u8 uninitialized_var(last_hw_stats);
293293
int i;
294294

295295
if (flow_offload_has_one_action(action))
296296
return true;
297297

298298
flow_action_for_each(i, action_entry, action) {
299-
if (i && action_entry->hw_stats_type != last_hw_stats_type) {
299+
if (i && action_entry->hw_stats != last_hw_stats) {
300300
NL_SET_ERR_MSG_MOD(extack, "Mixing HW stats types for actions is not supported");
301301
return false;
302302
}
303-
last_hw_stats_type = action_entry->hw_stats_type;
303+
last_hw_stats = action_entry->hw_stats;
304304
}
305305
return true;
306306
}
@@ -316,7 +316,7 @@ static inline bool
316316
__flow_action_hw_stats_check(const struct flow_action *action,
317317
struct netlink_ext_ack *extack,
318318
bool check_allow_bit,
319-
enum flow_action_hw_stats_type_bit allow_bit)
319+
enum flow_action_hw_stats_bit allow_bit)
320320
{
321321
const struct flow_action_entry *action_entry;
322322

@@ -326,11 +326,11 @@ __flow_action_hw_stats_check(const struct flow_action *action,
326326
return false;
327327
action_entry = flow_action_first_entry_get(action);
328328
if (!check_allow_bit &&
329-
action_entry->hw_stats_type != FLOW_ACTION_HW_STATS_ANY) {
329+
action_entry->hw_stats != FLOW_ACTION_HW_STATS_ANY) {
330330
NL_SET_ERR_MSG_MOD(extack, "Driver supports only default HW stats type \"any\"");
331331
return false;
332332
} else if (check_allow_bit &&
333-
!(action_entry->hw_stats_type & BIT(allow_bit))) {
333+
!(action_entry->hw_stats & BIT(allow_bit))) {
334334
NL_SET_ERR_MSG_MOD(extack, "Driver does not support selected HW stats type");
335335
return false;
336336
}
@@ -340,7 +340,7 @@ __flow_action_hw_stats_check(const struct flow_action *action,
340340
static inline bool
341341
flow_action_hw_stats_check(const struct flow_action *action,
342342
struct netlink_ext_ack *extack,
343-
enum flow_action_hw_stats_type_bit allow_bit)
343+
enum flow_action_hw_stats_bit allow_bit)
344344
{
345345
return __flow_action_hw_stats_check(action, extack, true, allow_bit);
346346
}

‎include/uapi/linux/pkt_cls.h‎

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ enum {
1717
TCA_ACT_PAD,
1818
TCA_ACT_COOKIE,
1919
TCA_ACT_FLAGS,
20-
TCA_ACT_HW_STATS_TYPE,
20+
TCA_ACT_HW_STATS,
2121
__TCA_ACT_MAX
2222
};
2323

@@ -31,20 +31,19 @@ enum {
3131
* all supported bits set.
3232
* In case no bits are set, user is not interested in getting any HW statistics.
3333
*/
34-
#define TCA_ACT_HW_STATS_TYPE_IMMEDIATE (1 << 0) /* Means that in dump, user
35-
* gets the current HW stats
36-
* state from the device
37-
* queried at the dump time.
38-
*/
39-
#define TCA_ACT_HW_STATS_TYPE_DELAYED (1 << 1) /* Means that in dump, user gets
40-
* HW stats that might be out
41-
* of date for some time, maybe
42-
* couple of seconds. This is
43-
* the case when driver polls
44-
* stats updates periodically
45-
* or when it gets async stats update
46-
* from the device.
47-
*/
34+
#define TCA_ACT_HW_STATS_IMMEDIATE (1 << 0) /* Means that in dump, user
35+
* gets the current HW stats
36+
* state from the device
37+
* queried at the dump time.
38+
*/
39+
#define TCA_ACT_HW_STATS_DELAYED (1 << 1) /* Means that in dump, user gets
40+
* HW stats that might be out of date
41+
* for some time, maybe couple of
42+
* seconds. This is the case when
43+
* driver polls stats updates
44+
* periodically or when it gets async
45+
* stats update from the device.
46+
*/
4847

4948
#define TCA_ACT_MAX __TCA_ACT_MAX
5049
#define TCA_OLD_COMPAT (TCA_ACT_MAX+1)

‎net/sched/act_api.c‎

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ static size_t tcf_action_shared_attrs_size(const struct tc_action *act)
185185
return nla_total_size(0) /* action number nested */
186186
+ nla_total_size(IFNAMSIZ) /* TCA_ACT_KIND */
187187
+ cookie_len /* TCA_ACT_COOKIE */
188-
+ nla_total_size(sizeof(struct nla_bitfield32)) /* TCA_ACT_HW_STATS_TYPE */
188+
+ nla_total_size(sizeof(struct nla_bitfield32)) /* TCA_ACT_HW_STATS */
189189
+ nla_total_size(0) /* TCA_ACT_STATS nested */
190190
+ nla_total_size(sizeof(struct nla_bitfield32)) /* TCA_ACT_FLAGS */
191191
/* TCA_STATS_BASIC */
@@ -789,14 +789,13 @@ tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
789789
}
790790
rcu_read_unlock();
791791

792-
if (a->hw_stats_type != TCA_ACT_HW_STATS_TYPE_ANY) {
793-
struct nla_bitfield32 hw_stats_type = {
794-
a->hw_stats_type,
795-
TCA_ACT_HW_STATS_TYPE_ANY,
792+
if (a->hw_stats != TCA_ACT_HW_STATS_ANY) {
793+
struct nla_bitfield32 hw_stats = {
794+
a->hw_stats,
795+
TCA_ACT_HW_STATS_ANY,
796796
};
797797

798-
if (nla_put(skb, TCA_ACT_HW_STATS_TYPE, sizeof(hw_stats_type),
799-
&hw_stats_type))
798+
if (nla_put(skb, TCA_ACT_HW_STATS, sizeof(hw_stats), &hw_stats))
800799
goto nla_put_failure;
801800
}
802801

@@ -866,22 +865,22 @@ static struct tc_cookie *nla_memdup_cookie(struct nlattr **tb)
866865
return c;
867866
}
868867

869-
static u8 tcf_action_hw_stats_type_get(struct nlattr *hw_stats_type_attr)
868+
static u8 tcf_action_hw_stats_get(struct nlattr *hw_stats_attr)
870869
{
871-
struct nla_bitfield32 hw_stats_type_bf;
870+
struct nla_bitfield32 hw_stats_bf;
872871

873872
/* If the user did not pass the attr, that means he does
874873
* not care about the type. Return "any" in that case
875874
* which is setting on all supported types.
876875
*/
877-
if (!hw_stats_type_attr)
878-
return TCA_ACT_HW_STATS_TYPE_ANY;
879-
hw_stats_type_bf = nla_get_bitfield32(hw_stats_type_attr);
880-
return hw_stats_type_bf.value;
876+
if (!hw_stats_attr)
877+
return TCA_ACT_HW_STATS_ANY;
878+
hw_stats_bf = nla_get_bitfield32(hw_stats_attr);
879+
return hw_stats_bf.value;
881880
}
882881

883882
static const u32 tca_act_flags_allowed = TCA_ACT_FLAGS_NO_PERCPU_STATS;
884-
static const u32 tca_act_hw_stats_type_allowed = TCA_ACT_HW_STATS_TYPE_ANY;
883+
static const u32 tca_act_hw_stats_allowed = TCA_ACT_HW_STATS_ANY;
885884

886885
static const struct nla_policy tcf_action_policy[TCA_ACT_MAX + 1] = {
887886
[TCA_ACT_KIND] = { .type = NLA_STRING },
@@ -891,8 +890,8 @@ static const struct nla_policy tcf_action_policy[TCA_ACT_MAX + 1] = {
891890
[TCA_ACT_OPTIONS] = { .type = NLA_NESTED },
892891
[TCA_ACT_FLAGS] = { .type = NLA_BITFIELD32,
893892
.validation_data = &tca_act_flags_allowed },
894-
[TCA_ACT_HW_STATS_TYPE] = { .type = NLA_BITFIELD32,
895-
.validation_data = &tca_act_hw_stats_type_allowed },
893+
[TCA_ACT_HW_STATS] = { .type = NLA_BITFIELD32,
894+
.validation_data = &tca_act_hw_stats_allowed },
896895
};
897896

898897
struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
@@ -901,8 +900,8 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
901900
bool rtnl_held,
902901
struct netlink_ext_ack *extack)
903902
{
904-
u8 hw_stats_type = TCA_ACT_HW_STATS_TYPE_ANY;
905903
struct nla_bitfield32 flags = { 0, 0 };
904+
u8 hw_stats = TCA_ACT_HW_STATS_ANY;
906905
struct tc_action *a;
907906
struct tc_action_ops *a_o;
908907
struct tc_cookie *cookie = NULL;
@@ -934,8 +933,7 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
934933
goto err_out;
935934
}
936935
}
937-
hw_stats_type =
938-
tcf_action_hw_stats_type_get(tb[TCA_ACT_HW_STATS_TYPE]);
936+
hw_stats = tcf_action_hw_stats_get(tb[TCA_ACT_HW_STATS]);
939937
if (tb[TCA_ACT_FLAGS])
940938
flags = nla_get_bitfield32(tb[TCA_ACT_FLAGS]);
941939
} else {
@@ -987,7 +985,7 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
987985
tcf_set_action_cookie(&a->act_cookie, cookie);
988986

989987
if (!name)
990-
a->hw_stats_type = hw_stats_type;
988+
a->hw_stats = hw_stats;
991989

992990
/* module count goes up only when brand new policy is created
993991
* if it exists and is only bound to in a_o->init() then

‎net/sched/cls_api.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3528,9 +3528,9 @@ int tc_setup_flow_action(struct flow_action *flow_action,
35283528
struct tc_action *act;
35293529
int i, j, k, err = 0;
35303530

3531-
BUILD_BUG_ON(TCA_ACT_HW_STATS_TYPE_ANY != FLOW_ACTION_HW_STATS_ANY);
3532-
BUILD_BUG_ON(TCA_ACT_HW_STATS_TYPE_IMMEDIATE != FLOW_ACTION_HW_STATS_IMMEDIATE);
3533-
BUILD_BUG_ON(TCA_ACT_HW_STATS_TYPE_DELAYED != FLOW_ACTION_HW_STATS_DELAYED);
3531+
BUILD_BUG_ON(TCA_ACT_HW_STATS_ANY != FLOW_ACTION_HW_STATS_ANY);
3532+
BUILD_BUG_ON(TCA_ACT_HW_STATS_IMMEDIATE != FLOW_ACTION_HW_STATS_IMMEDIATE);
3533+
BUILD_BUG_ON(TCA_ACT_HW_STATS_DELAYED != FLOW_ACTION_HW_STATS_DELAYED);
35343534

35353535
if (!exts)
35363536
return 0;
@@ -3545,7 +3545,7 @@ int tc_setup_flow_action(struct flow_action *flow_action,
35453545
if (err)
35463546
goto err_out_locked;
35473547

3548-
entry->hw_stats_type = act->hw_stats_type;
3548+
entry->hw_stats = act->hw_stats;
35493549

35503550
if (is_tcf_gact_ok(act)) {
35513551
entry->id = FLOW_ACTION_ACCEPT;
@@ -3613,7 +3613,7 @@ int tc_setup_flow_action(struct flow_action *flow_action,
36133613
entry->mangle.mask = tcf_pedit_mask(act, k);
36143614
entry->mangle.val = tcf_pedit_val(act, k);
36153615
entry->mangle.offset = tcf_pedit_offset(act, k);
3616-
entry->hw_stats_type = act->hw_stats_type;
3616+
entry->hw_stats = act->hw_stats;
36173617
entry = &flow_action->entries[++j];
36183618
}
36193619
} else if (is_tcf_csum(act)) {

0 commit comments

Comments
 (0)