Commit 53eca1f3479f ("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).
Unified · Split
| @@ -30,13 +30,13 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp, · 29 unmodified lines | ||
| 30 | 30 | return -EOPNOTSUPP; |
| 31 | 31 | |
| 32 | 32 | 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) { | |
| 35 | 35 | /* Count action is inserted first */ |
| 36 | 36 | err = mlxsw_sp_acl_rulei_act_count(mlxsw_sp, rulei, extack); |
| 37 | 37 | if (err) |
| 38 | 38 | 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) { | |
| 40 | 40 | NL_SET_ERR_MSG_MOD(extack, "Unsupported action HW stats type"); |
| 41 | 41 | return -EOPNOTSUPP; |
| 42 | 42 | } |
| @@ -1387,7 +1387,7 @@ static int __stmmac_test_l3filt(struct stmmac_priv *priv, u32 dst, u32 src, · 1386 unmodified lines | ||
| 1387 | 1387 | cls->rule = rule; |
| 1388 | 1388 | |
| 1389 | 1389 | 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; | |
| 1391 | 1391 | rule->action.num_entries = 1; |
| 1392 | 1392 | |
| 1393 | 1393 | attr.dst = priv->dev->dev_addr; |
| @@ -1516,7 +1516,7 @@ static int __stmmac_test_l4filt(struct stmmac_priv *priv, u32 dst, u32 src, · 122 unmodified lines | ||
| 1516 | 1516 | cls->rule = rule; |
| 1517 | 1517 | |
| 1518 | 1518 | 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; | |
| 1520 | 1520 | rule->action.num_entries = 1; |
| 1521 | 1521 | |
| 1522 | 1522 | attr.dst = priv->dev->dev_addr; |
| @@ -41,7 +41,7 @@ struct tc_action { · 40 unmodified lines | ||
| 41 | 41 | struct tc_cookie __rcu *act_cookie; |
| 42 | 42 | struct tcf_chain __rcu *goto_chain; |
| 43 | 43 | u32 tcfa_flags; |
| 44 | − u8 hw_stats_type; | |
| 44 | + u8 hw_stats; | |
| 45 | 45 | }; |
| 46 | 46 | #define tcf_index common.tcfa_index |
| 47 | 47 | #define tcf_refcnt common.tcfa_refcnt |
| @@ -53,8 +53,8 @@ struct tc_action { · 5 unmodified lines | ||
| 53 | 53 | #define tcf_rate_est common.tcfa_rate_est |
| 54 | 54 | #define tcf_lock common.tcfa_lock |
| 55 | 55 | |
| 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) | |
| 58 | 58 | |
| 59 | 59 | /* Update lastuse only if needed, to avoid dirtying a cache line. |
| 60 | 60 | * We use a temp variable to avoid fetching jiffies twice. |
| @@ -163,12 +163,12 @@ enum flow_action_mangle_base { · 162 unmodified lines | ||
| 163 | 163 | FLOW_ACT_MANGLE_HDR_TYPE_UDP, |
| 164 | 164 | }; |
| 165 | 165 | |
| 166 | −enum flow_action_hw_stats_type_bit { | |
| 166 | +enum flow_action_hw_stats_bit { | |
| 167 | 167 | FLOW_ACTION_HW_STATS_IMMEDIATE_BIT, |
| 168 | 168 | FLOW_ACTION_HW_STATS_DELAYED_BIT, |
| 169 | 169 | }; |
| 170 | 170 | |
| 171 | −enum flow_action_hw_stats_type { | |
| 171 | +enum flow_action_hw_stats { | |
| 172 | 172 | FLOW_ACTION_HW_STATS_DISABLED = 0, |
| 173 | 173 | FLOW_ACTION_HW_STATS_IMMEDIATE = |
| 174 | 174 | BIT(FLOW_ACTION_HW_STATS_IMMEDIATE_BIT), |
| @@ -191,7 +191,7 @@ void flow_action_cookie_destroy(struct flow_action_cookie *cookie); · 16 unmodified lines | ||
| 191 | 191 | |
| 192 | 192 | struct flow_action_entry { |
| 193 | 193 | enum flow_action_id id; |
| 194 | − enum flow_action_hw_stats_type hw_stats_type; | |
| 194 | + enum flow_action_hw_stats hw_stats; | |
| 195 | 195 | action_destr destructor; |
| 196 | 196 | void *destructor_priv; |
| 197 | 197 | union { |
| @@ -289,18 +289,18 @@ flow_action_mixed_hw_stats_check(const struct flow_action *action, · 91 unmodified lines | ||
| 289 | 289 | struct netlink_ext_ack *extack) |
| 290 | 290 | { |
| 291 | 291 | const struct flow_action_entry *action_entry; |
| 292 | − u8 uninitialized_var(last_hw_stats_type); | |
| 292 | + u8 uninitialized_var(last_hw_stats); | |
| 293 | 293 | int i; |
| 294 | 294 | |
| 295 | 295 | if (flow_offload_has_one_action(action)) |
| 296 | 296 | return true; |
| 297 | 297 | |
| 298 | 298 | 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) { | |
| 300 | 300 | NL_SET_ERR_MSG_MOD(extack, "Mixing HW stats types for actions is not supported"); |
| 301 | 301 | return false; |
| 302 | 302 | } |
| 303 | − last_hw_stats_type = action_entry->hw_stats_type; | |
| 303 | + last_hw_stats = action_entry->hw_stats; | |
| 304 | 304 | } |
| 305 | 305 | return true; |
| 306 | 306 | } |
| @@ -316,7 +316,7 @@ static inline bool · 9 unmodified lines | ||
| 316 | 316 | __flow_action_hw_stats_check(const struct flow_action *action, |
| 317 | 317 | struct netlink_ext_ack *extack, |
| 318 | 318 | bool check_allow_bit, |
| 319 | − enum flow_action_hw_stats_type_bit allow_bit) | |
| 319 | + enum flow_action_hw_stats_bit allow_bit) | |
| 320 | 320 | { |
| 321 | 321 | const struct flow_action_entry *action_entry; |
| 322 | 322 | |
| @@ -326,11 +326,11 @@ __flow_action_hw_stats_check(const struct flow_action *action, · 3 unmodified lines | ||
| 326 | 326 | return false; |
| 327 | 327 | action_entry = flow_action_first_entry_get(action); |
| 328 | 328 | 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) { | |
| 330 | 330 | NL_SET_ERR_MSG_MOD(extack, "Driver supports only default HW stats type \"any\""); |
| 331 | 331 | return false; |
| 332 | 332 | } else if (check_allow_bit && |
| 333 | − !(action_entry->hw_stats_type & BIT(allow_bit))) { | |
| 333 | + !(action_entry->hw_stats & BIT(allow_bit))) { | |
| 334 | 334 | NL_SET_ERR_MSG_MOD(extack, "Driver does not support selected HW stats type"); |
| 335 | 335 | return false; |
| 336 | 336 | } |
| @@ -340,7 +340,7 @@ __flow_action_hw_stats_check(const struct flow_action *action, · 3 unmodified lines | ||
| 340 | 340 | static inline bool |
| 341 | 341 | flow_action_hw_stats_check(const struct flow_action *action, |
| 342 | 342 | struct netlink_ext_ack *extack, |
| 343 | − enum flow_action_hw_stats_type_bit allow_bit) | |
| 343 | + enum flow_action_hw_stats_bit allow_bit) | |
| 344 | 344 | { |
| 345 | 345 | return __flow_action_hw_stats_check(action, extack, true, allow_bit); |
| 346 | 346 | } |
| @@ -17,7 +17,7 @@ enum { · 16 unmodified lines | ||
| 17 | 17 | TCA_ACT_PAD, |
| 18 | 18 | TCA_ACT_COOKIE, |
| 19 | 19 | TCA_ACT_FLAGS, |
| 20 | − TCA_ACT_HW_STATS_TYPE, | |
| 20 | + TCA_ACT_HW_STATS, | |
| 21 | 21 | __TCA_ACT_MAX |
| 22 | 22 | }; |
| 23 | 23 | |
| @@ -31,20 +31,19 @@ enum { · 7 unmodified lines | ||
| 31 | 31 | * all supported bits set. |
| 32 | 32 | * In case no bits are set, user is not interested in getting any HW statistics. |
| 33 | 33 | */ |
| 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 | + */ | |
| 48 | 47 | |
| 49 | 48 | #define TCA_ACT_MAX __TCA_ACT_MAX |
| 50 | 49 | #define TCA_OLD_COMPAT (TCA_ACT_MAX+1) |
| @@ -185,7 +185,7 @@ static size_t tcf_action_shared_attrs_size(const struct tc_action *act) · 184 unmodified lines | ||
| 185 | 185 | return nla_total_size(0) /* action number nested */ |
| 186 | 186 | + nla_total_size(IFNAMSIZ) /* TCA_ACT_KIND */ |
| 187 | 187 | + 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 */ | |
| 189 | 189 | + nla_total_size(0) /* TCA_ACT_STATS nested */ |
| 190 | 190 | + nla_total_size(sizeof(struct nla_bitfield32)) /* TCA_ACT_FLAGS */ |
| 191 | 191 | /* TCA_STATS_BASIC */ |
| @@ -789,14 +789,13 @@ tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref) · 597 unmodified lines | ||
| 789 | 789 | } |
| 790 | 790 | rcu_read_unlock(); |
| 791 | 791 | |
| 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, | |
| 796 | 796 | }; |
| 797 | 797 | |
| 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)) | |
| 800 | 799 | goto nla_put_failure; |
| 801 | 800 | } |
| 802 | 801 | |
| @@ -866,22 +865,22 @@ static struct tc_cookie *nla_memdup_cookie(struct nlattr **tb) · 63 unmodified lines | ||
| 866 | 865 | return c; |
| 867 | 866 | } |
| 868 | 867 | |
| 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) | |
| 870 | 869 | { |
| 871 | − struct nla_bitfield32 hw_stats_type_bf; | |
| 870 | + struct nla_bitfield32 hw_stats_bf; | |
| 872 | 871 | |
| 873 | 872 | /* If the user did not pass the attr, that means he does |
| 874 | 873 | * not care about the type. Return "any" in that case |
| 875 | 874 | * which is setting on all supported types. |
| 876 | 875 | */ |
| 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; | |
| 881 | 880 | } |
| 882 | 881 | |
| 883 | 882 | 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; | |
| 885 | 884 | |
| 886 | 885 | static const struct nla_policy tcf_action_policy[TCA_ACT_MAX + 1] = { |
| 887 | 886 | [TCA_ACT_KIND] = { .type = NLA_STRING }, |
| @@ -891,8 +890,8 @@ static const struct nla_policy tcf_action_policy[TCA_ACT_MAX + 1] = { · 3 unmodified lines | ||
| 891 | 890 | [TCA_ACT_OPTIONS] = { .type = NLA_NESTED }, |
| 892 | 891 | [TCA_ACT_FLAGS] = { .type = NLA_BITFIELD32, |
| 893 | 892 | .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 }, | |
| 896 | 895 | }; |
| 897 | 896 | |
| 898 | 897 | 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, · 2 unmodified lines | ||
| 901 | 900 | bool rtnl_held, |
| 902 | 901 | struct netlink_ext_ack *extack) |
| 903 | 902 | { |
| 904 | − u8 hw_stats_type = TCA_ACT_HW_STATS_TYPE_ANY; | |
| 905 | 903 | struct nla_bitfield32 flags = { 0, 0 }; |
| 904 | + u8 hw_stats = TCA_ACT_HW_STATS_ANY; | |
| 906 | 905 | struct tc_action *a; |
| 907 | 906 | struct tc_action_ops *a_o; |
| 908 | 907 | struct tc_cookie *cookie = NULL; |
| @@ -934,8 +933,7 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, · 25 unmodified lines | ||
| 934 | 933 | goto err_out; |
| 935 | 934 | } |
| 936 | 935 | } |
| 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]); | |
| 939 | 937 | if (tb[TCA_ACT_FLAGS]) |
| 940 | 938 | flags = nla_get_bitfield32(tb[TCA_ACT_FLAGS]); |
| 941 | 939 | } else { |
| @@ -987,7 +985,7 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, · 45 unmodified lines | ||
| 987 | 985 | tcf_set_action_cookie(&a->act_cookie, cookie); |
| 988 | 986 | |
| 989 | 987 | if (!name) |
| 990 | − a->hw_stats_type = hw_stats_type; | |
| 988 | + a->hw_stats = hw_stats; | |
| 991 | 989 | |
| 992 | 990 | /* module count goes up only when brand new policy is created |
| 993 | 991 | * if it exists and is only bound to in a_o->init() then |
| @@ -3528,9 +3528,9 @@ int tc_setup_flow_action(struct flow_action *flow_action, · 3527 unmodified lines | ||
| 3528 | 3528 | struct tc_action *act; |
| 3529 | 3529 | int i, j, k, err = 0; |
| 3530 | 3530 | |
| 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); | |
| 3534 | 3534 | |
| 3535 | 3535 | if (!exts) |
| 3536 | 3536 | return 0; |
| @@ -3545,7 +3545,7 @@ int tc_setup_flow_action(struct flow_action *flow_action, · 8 unmodified lines | ||
| 3545 | 3545 | if (err) |
| 3546 | 3546 | goto err_out_locked; |
| 3547 | 3547 | |
| 3548 | − entry->hw_stats_type = act->hw_stats_type; | |
| 3548 | + entry->hw_stats = act->hw_stats; | |
| 3549 | 3549 | |
| 3550 | 3550 | if (is_tcf_gact_ok(act)) { |
| 3551 | 3551 | entry->id = FLOW_ACTION_ACCEPT; |
| @@ -3613,7 +3613,7 @@ int tc_setup_flow_action(struct flow_action *flow_action, · 61 unmodified lines | ||
| 3613 | 3613 | entry->mangle.mask = tcf_pedit_mask(act, k); |
| 3614 | 3614 | entry->mangle.val = tcf_pedit_val(act, k); |
| 3615 | 3615 | entry->mangle.offset = tcf_pedit_offset(act, k); |
| 3616 | − entry->hw_stats_type = act->hw_stats_type; | |
| 3616 | + entry->hw_stats = act->hw_stats; | |
| 3617 | 3617 | entry = &flow_action->entries[++j]; |
| 3618 | 3618 | } |
| 3619 | 3619 | } else if (is_tcf_csum(act)) { |