Commit 24ee8651 authored by David S. Miller's avatar David S. Miller

Merge branch 'nfp-type'

Jakub Kicinski says:

====================
net: rename flow_action stats and set NFP type

Jiri, I hope this is okay with you, I just dropped the "type" from
the helper and value names, and now things should be able to fit
on a line, within 80 characters.

Second patch makes the NFP able to offload DELAYED stats, which
is the type it supports.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 362d3d88 36b4b92b
...@@ -300,7 +300,7 @@ static int bnxt_tc_parse_actions(struct bnxt *bp, ...@@ -300,7 +300,7 @@ static int bnxt_tc_parse_actions(struct bnxt *bp,
return -EINVAL; return -EINVAL;
} }
if (!flow_action_basic_hw_stats_types_check(flow_action, extack)) if (!flow_action_basic_hw_stats_check(flow_action, extack))
return -EOPNOTSUPP; return -EOPNOTSUPP;
flow_action_for_each(i, act, flow_action) { flow_action_for_each(i, act, flow_action) {
......
...@@ -553,7 +553,7 @@ int cxgb4_validate_flow_actions(struct net_device *dev, ...@@ -553,7 +553,7 @@ int cxgb4_validate_flow_actions(struct net_device *dev,
bool act_vlan = false; bool act_vlan = false;
int i; int i;
if (!flow_action_basic_hw_stats_types_check(actions, extack)) if (!flow_action_basic_hw_stats_check(actions, extack))
return -EOPNOTSUPP; return -EOPNOTSUPP;
flow_action_for_each(i, act, actions) { flow_action_for_each(i, act, actions) {
......
...@@ -1082,7 +1082,7 @@ static int mvpp2_port_c2_tcam_rule_add(struct mvpp2_port *port, ...@@ -1082,7 +1082,7 @@ static int mvpp2_port_c2_tcam_rule_add(struct mvpp2_port *port,
u8 qh, ql, pmap; u8 qh, ql, pmap;
int index, ctx; int index, ctx;
if (!flow_action_basic_hw_stats_types_check(&rule->flow->action, NULL)) if (!flow_action_basic_hw_stats_check(&rule->flow->action, NULL))
return -EOPNOTSUPP; return -EOPNOTSUPP;
memset(&c2, 0, sizeof(c2)); memset(&c2, 0, sizeof(c2));
...@@ -1308,7 +1308,7 @@ static int mvpp2_cls_rfs_parse_rule(struct mvpp2_rfs_rule *rule) ...@@ -1308,7 +1308,7 @@ static int mvpp2_cls_rfs_parse_rule(struct mvpp2_rfs_rule *rule)
struct flow_rule *flow = rule->flow; struct flow_rule *flow = rule->flow;
struct flow_action_entry *act; struct flow_action_entry *act;
if (!flow_action_basic_hw_stats_types_check(&rule->flow->action, NULL)) if (!flow_action_basic_hw_stats_check(&rule->flow->action, NULL))
return -EOPNOTSUPP; return -EOPNOTSUPP;
act = &flow->action.entries[0]; act = &flow->action.entries[0];
......
...@@ -3180,8 +3180,8 @@ static int parse_tc_nic_actions(struct mlx5e_priv *priv, ...@@ -3180,8 +3180,8 @@ static int parse_tc_nic_actions(struct mlx5e_priv *priv,
if (!flow_action_has_entries(flow_action)) if (!flow_action_has_entries(flow_action))
return -EINVAL; return -EINVAL;
if (!flow_action_hw_stats_types_check(flow_action, extack, if (!flow_action_hw_stats_check(flow_action, extack,
FLOW_ACTION_HW_STATS_TYPE_DELAYED_BIT)) FLOW_ACTION_HW_STATS_DELAYED_BIT))
return -EOPNOTSUPP; return -EOPNOTSUPP;
attr->flow_tag = MLX5_FS_DEFAULT_FLOW_TAG; attr->flow_tag = MLX5_FS_DEFAULT_FLOW_TAG;
...@@ -3675,8 +3675,8 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, ...@@ -3675,8 +3675,8 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv,
if (!flow_action_has_entries(flow_action)) if (!flow_action_has_entries(flow_action))
return -EINVAL; return -EINVAL;
if (!flow_action_hw_stats_types_check(flow_action, extack, if (!flow_action_hw_stats_check(flow_action, extack,
FLOW_ACTION_HW_STATS_TYPE_DELAYED_BIT)) FLOW_ACTION_HW_STATS_DELAYED_BIT))
return -EOPNOTSUPP; return -EOPNOTSUPP;
flow_action_for_each(i, act, flow_action) { flow_action_for_each(i, act, flow_action) {
...@@ -4510,7 +4510,7 @@ static int scan_tc_matchall_fdb_actions(struct mlx5e_priv *priv, ...@@ -4510,7 +4510,7 @@ static int scan_tc_matchall_fdb_actions(struct mlx5e_priv *priv,
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
if (!flow_action_basic_hw_stats_types_check(flow_action, extack)) if (!flow_action_basic_hw_stats_check(flow_action, extack))
return -EOPNOTSUPP; return -EOPNOTSUPP;
flow_action_for_each(i, act, flow_action) { flow_action_for_each(i, act, flow_action) {
......
...@@ -26,17 +26,17 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp, ...@@ -26,17 +26,17 @@ static int mlxsw_sp_flower_parse_actions(struct mlxsw_sp *mlxsw_sp,
if (!flow_action_has_entries(flow_action)) if (!flow_action_has_entries(flow_action))
return 0; return 0;
if (!flow_action_mixed_hw_stats_types_check(flow_action, extack)) if (!flow_action_mixed_hw_stats_check(flow_action, extack))
return -EOPNOTSUPP; return -EOPNOTSUPP;
act = flow_action_first_entry_get(flow_action); act = flow_action_first_entry_get(flow_action);
if (act->hw_stats_type == FLOW_ACTION_HW_STATS_TYPE_ANY || if (act->hw_stats_type == FLOW_ACTION_HW_STATS_ANY ||
act->hw_stats_type == FLOW_ACTION_HW_STATS_TYPE_IMMEDIATE) { act->hw_stats_type == FLOW_ACTION_HW_STATS_IMMEDIATE) {
/* Count action is inserted first */ /* Count action is inserted first */
err = mlxsw_sp_acl_rulei_act_count(mlxsw_sp, rulei, extack); err = mlxsw_sp_acl_rulei_act_count(mlxsw_sp, rulei, extack);
if (err) if (err)
return err; return err;
} else if (act->hw_stats_type != FLOW_ACTION_HW_STATS_TYPE_DISABLED) { } else if (act->hw_stats_type != FLOW_ACTION_HW_STATS_DISABLED) {
NL_SET_ERR_MSG_MOD(extack, "Unsupported action HW stats type"); NL_SET_ERR_MSG_MOD(extack, "Unsupported action HW stats type");
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
......
...@@ -17,7 +17,7 @@ static int ocelot_flower_parse_action(struct flow_cls_offload *f, ...@@ -17,7 +17,7 @@ static int ocelot_flower_parse_action(struct flow_cls_offload *f,
if (!flow_offload_has_one_action(&f->rule->action)) if (!flow_offload_has_one_action(&f->rule->action))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (!flow_action_basic_hw_stats_types_check(&f->rule->action, if (!flow_action_basic_hw_stats_check(&f->rule->action,
f->common.extack)) f->common.extack))
return -EOPNOTSUPP; return -EOPNOTSUPP;
......
...@@ -1207,8 +1207,8 @@ int nfp_flower_compile_action(struct nfp_app *app, ...@@ -1207,8 +1207,8 @@ int nfp_flower_compile_action(struct nfp_app *app,
bool pkt_host = false; bool pkt_host = false;
u32 csum_updated = 0; u32 csum_updated = 0;
if (!flow_action_basic_hw_stats_types_check(&flow->rule->action, if (!flow_action_hw_stats_check(&flow->rule->action, extack,
extack)) FLOW_ACTION_HW_STATS_DELAYED_BIT))
return -EOPNOTSUPP; return -EOPNOTSUPP;
memset(nfp_flow->action_data, 0, NFP_FL_MAX_A_SIZ); memset(nfp_flow->action_data, 0, NFP_FL_MAX_A_SIZ);
......
...@@ -1757,7 +1757,7 @@ static int qede_parse_actions(struct qede_dev *edev, ...@@ -1757,7 +1757,7 @@ static int qede_parse_actions(struct qede_dev *edev,
return -EINVAL; return -EINVAL;
} }
if (!flow_action_basic_hw_stats_types_check(flow_action, extack)) if (!flow_action_basic_hw_stats_check(flow_action, extack))
return -EOPNOTSUPP; return -EOPNOTSUPP;
flow_action_for_each(i, act, flow_action) { flow_action_for_each(i, act, flow_action) {
......
...@@ -1387,7 +1387,7 @@ static int __stmmac_test_l3filt(struct stmmac_priv *priv, u32 dst, u32 src, ...@@ -1387,7 +1387,7 @@ static int __stmmac_test_l3filt(struct stmmac_priv *priv, u32 dst, u32 src,
cls->rule = rule; cls->rule = rule;
rule->action.entries[0].id = FLOW_ACTION_DROP; rule->action.entries[0].id = FLOW_ACTION_DROP;
rule->action.entries[0].hw_stats_type = FLOW_ACTION_HW_STATS_TYPE_ANY; rule->action.entries[0].hw_stats_type = FLOW_ACTION_HW_STATS_ANY;
rule->action.num_entries = 1; rule->action.num_entries = 1;
attr.dst = priv->dev->dev_addr; attr.dst = priv->dev->dev_addr;
...@@ -1516,7 +1516,7 @@ static int __stmmac_test_l4filt(struct stmmac_priv *priv, u32 dst, u32 src, ...@@ -1516,7 +1516,7 @@ static int __stmmac_test_l4filt(struct stmmac_priv *priv, u32 dst, u32 src,
cls->rule = rule; cls->rule = rule;
rule->action.entries[0].id = FLOW_ACTION_DROP; rule->action.entries[0].id = FLOW_ACTION_DROP;
rule->action.entries[0].hw_stats_type = FLOW_ACTION_HW_STATS_TYPE_ANY; rule->action.entries[0].hw_stats_type = FLOW_ACTION_HW_STATS_ANY;
rule->action.num_entries = 1; rule->action.num_entries = 1;
attr.dst = priv->dev->dev_addr; attr.dst = priv->dev->dev_addr;
......
...@@ -376,7 +376,7 @@ static int tc_parse_flow_actions(struct stmmac_priv *priv, ...@@ -376,7 +376,7 @@ static int tc_parse_flow_actions(struct stmmac_priv *priv,
if (!flow_action_has_entries(action)) if (!flow_action_has_entries(action))
return -EINVAL; return -EINVAL;
if (!flow_action_basic_hw_stats_types_check(action, extack)) if (!flow_action_basic_hw_stats_check(action, extack))
return -EOPNOTSUPP; return -EOPNOTSUPP;
flow_action_for_each(i, act, action) { flow_action_for_each(i, act, action) {
......
...@@ -163,19 +163,17 @@ enum flow_action_mangle_base { ...@@ -163,19 +163,17 @@ enum flow_action_mangle_base {
}; };
enum flow_action_hw_stats_type_bit { enum flow_action_hw_stats_type_bit {
FLOW_ACTION_HW_STATS_TYPE_IMMEDIATE_BIT, FLOW_ACTION_HW_STATS_IMMEDIATE_BIT,
FLOW_ACTION_HW_STATS_TYPE_DELAYED_BIT, FLOW_ACTION_HW_STATS_DELAYED_BIT,
}; };
enum flow_action_hw_stats_type { enum flow_action_hw_stats_type {
FLOW_ACTION_HW_STATS_TYPE_DISABLED = 0, FLOW_ACTION_HW_STATS_DISABLED = 0,
FLOW_ACTION_HW_STATS_TYPE_IMMEDIATE = FLOW_ACTION_HW_STATS_IMMEDIATE =
BIT(FLOW_ACTION_HW_STATS_TYPE_IMMEDIATE_BIT), BIT(FLOW_ACTION_HW_STATS_IMMEDIATE_BIT),
FLOW_ACTION_HW_STATS_TYPE_DELAYED = FLOW_ACTION_HW_STATS_DELAYED = BIT(FLOW_ACTION_HW_STATS_DELAYED_BIT),
BIT(FLOW_ACTION_HW_STATS_TYPE_DELAYED_BIT), FLOW_ACTION_HW_STATS_ANY = FLOW_ACTION_HW_STATS_IMMEDIATE |
FLOW_ACTION_HW_STATS_TYPE_ANY = FLOW_ACTION_HW_STATS_DELAYED,
FLOW_ACTION_HW_STATS_TYPE_IMMEDIATE |
FLOW_ACTION_HW_STATS_TYPE_DELAYED,
}; };
typedef void (*action_destr)(void *priv); typedef void (*action_destr)(void *priv);
...@@ -285,7 +283,7 @@ static inline bool flow_offload_has_one_action(const struct flow_action *action) ...@@ -285,7 +283,7 @@ static inline bool flow_offload_has_one_action(const struct flow_action *action)
__act = &(__actions)->entries[++__i]) __act = &(__actions)->entries[++__i])
static inline bool static inline bool
flow_action_mixed_hw_stats_types_check(const struct flow_action *action, flow_action_mixed_hw_stats_check(const struct flow_action *action,
struct netlink_ext_ack *extack) struct netlink_ext_ack *extack)
{ {
const struct flow_action_entry *action_entry; const struct flow_action_entry *action_entry;
...@@ -313,7 +311,7 @@ flow_action_first_entry_get(const struct flow_action *action) ...@@ -313,7 +311,7 @@ flow_action_first_entry_get(const struct flow_action *action)
} }
static inline bool static inline bool
__flow_action_hw_stats_types_check(const struct flow_action *action, __flow_action_hw_stats_check(const struct flow_action *action,
struct netlink_ext_ack *extack, struct netlink_ext_ack *extack,
bool check_allow_bit, bool check_allow_bit,
enum flow_action_hw_stats_type_bit allow_bit) enum flow_action_hw_stats_type_bit allow_bit)
...@@ -322,11 +320,11 @@ __flow_action_hw_stats_types_check(const struct flow_action *action, ...@@ -322,11 +320,11 @@ __flow_action_hw_stats_types_check(const struct flow_action *action,
if (!flow_action_has_entries(action)) if (!flow_action_has_entries(action))
return true; return true;
if (!flow_action_mixed_hw_stats_types_check(action, extack)) if (!flow_action_mixed_hw_stats_check(action, extack))
return false; return false;
action_entry = flow_action_first_entry_get(action); action_entry = flow_action_first_entry_get(action);
if (!check_allow_bit && if (!check_allow_bit &&
action_entry->hw_stats_type != FLOW_ACTION_HW_STATS_TYPE_ANY) { action_entry->hw_stats_type != FLOW_ACTION_HW_STATS_ANY) {
NL_SET_ERR_MSG_MOD(extack, "Driver supports only default HW stats type \"any\""); NL_SET_ERR_MSG_MOD(extack, "Driver supports only default HW stats type \"any\"");
return false; return false;
} else if (check_allow_bit && } else if (check_allow_bit &&
...@@ -338,19 +336,18 @@ __flow_action_hw_stats_types_check(const struct flow_action *action, ...@@ -338,19 +336,18 @@ __flow_action_hw_stats_types_check(const struct flow_action *action,
} }
static inline bool static inline bool
flow_action_hw_stats_types_check(const struct flow_action *action, flow_action_hw_stats_check(const struct flow_action *action,
struct netlink_ext_ack *extack, struct netlink_ext_ack *extack,
enum flow_action_hw_stats_type_bit allow_bit) enum flow_action_hw_stats_type_bit allow_bit)
{ {
return __flow_action_hw_stats_types_check(action, extack, return __flow_action_hw_stats_check(action, extack, true, allow_bit);
true, allow_bit);
} }
static inline bool static inline bool
flow_action_basic_hw_stats_types_check(const struct flow_action *action, flow_action_basic_hw_stats_check(const struct flow_action *action,
struct netlink_ext_ack *extack) struct netlink_ext_ack *extack)
{ {
return __flow_action_hw_stats_types_check(action, extack, false, 0); return __flow_action_hw_stats_check(action, extack, false, 0);
} }
struct flow_rule { struct flow_rule {
......
...@@ -861,7 +861,7 @@ static int dsa_slave_add_cls_matchall(struct net_device *dev, ...@@ -861,7 +861,7 @@ static int dsa_slave_add_cls_matchall(struct net_device *dev,
if (!flow_offload_has_one_action(&cls->rule->action)) if (!flow_offload_has_one_action(&cls->rule->action))
return err; return err;
if (!flow_action_basic_hw_stats_types_check(&cls->rule->action, if (!flow_action_basic_hw_stats_check(&cls->rule->action,
cls->common.extack)) cls->common.extack))
return err; return err;
......
...@@ -3528,9 +3528,9 @@ int tc_setup_flow_action(struct flow_action *flow_action, ...@@ -3528,9 +3528,9 @@ int tc_setup_flow_action(struct flow_action *flow_action,
struct tc_action *act; struct tc_action *act;
int i, j, k, err = 0; int i, j, k, err = 0;
BUILD_BUG_ON(TCA_ACT_HW_STATS_TYPE_ANY != FLOW_ACTION_HW_STATS_TYPE_ANY); BUILD_BUG_ON(TCA_ACT_HW_STATS_TYPE_ANY != FLOW_ACTION_HW_STATS_ANY);
BUILD_BUG_ON(TCA_ACT_HW_STATS_TYPE_IMMEDIATE != FLOW_ACTION_HW_STATS_TYPE_IMMEDIATE); BUILD_BUG_ON(TCA_ACT_HW_STATS_TYPE_IMMEDIATE != FLOW_ACTION_HW_STATS_IMMEDIATE);
BUILD_BUG_ON(TCA_ACT_HW_STATS_TYPE_DELAYED != FLOW_ACTION_HW_STATS_TYPE_DELAYED); BUILD_BUG_ON(TCA_ACT_HW_STATS_TYPE_DELAYED != FLOW_ACTION_HW_STATS_DELAYED);
if (!exts) if (!exts)
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment