Commit 1cab1cd7 authored by Or Gerlitz's avatar Or Gerlitz Committed by Saeed Mahameed

net/mlx5e: Use local actions var while processing offloaded TC flow actions

Use local actions variable while parsing the actions of offloaded TC flow.
Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: default avatarRoi Dayan <roid@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent 31c8eba5
...@@ -1917,6 +1917,7 @@ static int parse_tc_nic_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, ...@@ -1917,6 +1917,7 @@ static int parse_tc_nic_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
struct mlx5_nic_flow_attr *attr = flow->nic_attr; struct mlx5_nic_flow_attr *attr = flow->nic_attr;
const struct tc_action *a; const struct tc_action *a;
LIST_HEAD(actions); LIST_HEAD(actions);
u32 action = 0;
int err; int err;
if (!tcf_exts_has_actions(exts)) if (!tcf_exts_has_actions(exts))
...@@ -1927,10 +1928,10 @@ static int parse_tc_nic_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, ...@@ -1927,10 +1928,10 @@ static int parse_tc_nic_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
tcf_exts_to_list(exts, &actions); tcf_exts_to_list(exts, &actions);
list_for_each_entry(a, &actions, list) { list_for_each_entry(a, &actions, list) {
if (is_tcf_gact_shot(a)) { if (is_tcf_gact_shot(a)) {
attr->action |= MLX5_FLOW_CONTEXT_ACTION_DROP; action |= MLX5_FLOW_CONTEXT_ACTION_DROP;
if (MLX5_CAP_FLOWTABLE(priv->mdev, if (MLX5_CAP_FLOWTABLE(priv->mdev,
flow_table_properties_nic_receive.flow_counter)) flow_table_properties_nic_receive.flow_counter))
attr->action |= MLX5_FLOW_CONTEXT_ACTION_COUNT; action |= MLX5_FLOW_CONTEXT_ACTION_COUNT;
continue; continue;
} }
...@@ -1940,13 +1941,13 @@ static int parse_tc_nic_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, ...@@ -1940,13 +1941,13 @@ static int parse_tc_nic_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
if (err) if (err)
return err; return err;
attr->action |= MLX5_FLOW_CONTEXT_ACTION_MOD_HDR | action |= MLX5_FLOW_CONTEXT_ACTION_MOD_HDR |
MLX5_FLOW_CONTEXT_ACTION_FWD_DEST; MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
continue; continue;
} }
if (is_tcf_csum(a)) { if (is_tcf_csum(a)) {
if (csum_offload_supported(priv, attr->action, if (csum_offload_supported(priv, action,
tcf_csum_update_flags(a))) tcf_csum_update_flags(a)))
continue; continue;
...@@ -1960,7 +1961,7 @@ static int parse_tc_nic_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, ...@@ -1960,7 +1961,7 @@ static int parse_tc_nic_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
same_hw_devs(priv, netdev_priv(peer_dev))) { same_hw_devs(priv, netdev_priv(peer_dev))) {
parse_attr->mirred_ifindex = peer_dev->ifindex; parse_attr->mirred_ifindex = peer_dev->ifindex;
flow->flags |= MLX5E_TC_FLOW_HAIRPIN; flow->flags |= MLX5E_TC_FLOW_HAIRPIN;
attr->action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST | action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST |
MLX5_FLOW_CONTEXT_ACTION_COUNT; MLX5_FLOW_CONTEXT_ACTION_COUNT;
} else { } else {
netdev_warn(priv->netdev, "device %s not on same HW, can't offload\n", netdev_warn(priv->netdev, "device %s not on same HW, can't offload\n",
...@@ -1980,13 +1981,14 @@ static int parse_tc_nic_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, ...@@ -1980,13 +1981,14 @@ static int parse_tc_nic_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
} }
attr->flow_tag = mark; attr->flow_tag = mark;
attr->action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST; action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
continue; continue;
} }
return -EINVAL; return -EINVAL;
} }
attr->action = action;
if (!actions_match_supported(priv, exts, parse_attr, flow)) if (!actions_match_supported(priv, exts, parse_attr, flow))
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -2458,6 +2460,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, ...@@ -2458,6 +2460,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
const struct tc_action *a; const struct tc_action *a;
LIST_HEAD(actions); LIST_HEAD(actions);
bool encap = false; bool encap = false;
u32 action = 0;
if (!tcf_exts_has_actions(exts)) if (!tcf_exts_has_actions(exts))
return -EINVAL; return -EINVAL;
...@@ -2467,7 +2470,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, ...@@ -2467,7 +2470,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
tcf_exts_to_list(exts, &actions); tcf_exts_to_list(exts, &actions);
list_for_each_entry(a, &actions, list) { list_for_each_entry(a, &actions, list) {
if (is_tcf_gact_shot(a)) { if (is_tcf_gact_shot(a)) {
attr->action |= MLX5_FLOW_CONTEXT_ACTION_DROP | action |= MLX5_FLOW_CONTEXT_ACTION_DROP |
MLX5_FLOW_CONTEXT_ACTION_COUNT; MLX5_FLOW_CONTEXT_ACTION_COUNT;
continue; continue;
} }
...@@ -2480,12 +2483,12 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, ...@@ -2480,12 +2483,12 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
if (err) if (err)
return err; return err;
attr->action |= MLX5_FLOW_CONTEXT_ACTION_MOD_HDR; action |= MLX5_FLOW_CONTEXT_ACTION_MOD_HDR;
continue; continue;
} }
if (is_tcf_csum(a)) { if (is_tcf_csum(a)) {
if (csum_offload_supported(priv, attr->action, if (csum_offload_supported(priv, action,
tcf_csum_update_flags(a))) tcf_csum_update_flags(a)))
continue; continue;
...@@ -2500,7 +2503,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, ...@@ -2500,7 +2503,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
if (switchdev_port_same_parent_id(priv->netdev, if (switchdev_port_same_parent_id(priv->netdev,
out_dev)) { out_dev)) {
attr->action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST | action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST |
MLX5_FLOW_CONTEXT_ACTION_COUNT; MLX5_FLOW_CONTEXT_ACTION_COUNT;
out_priv = netdev_priv(out_dev); out_priv = netdev_priv(out_dev);
rpriv = out_priv->ppriv; rpriv = out_priv->ppriv;
...@@ -2509,7 +2512,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, ...@@ -2509,7 +2512,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
parse_attr->mirred_ifindex = out_dev->ifindex; parse_attr->mirred_ifindex = out_dev->ifindex;
parse_attr->tun_info = *info; parse_attr->tun_info = *info;
attr->parse_attr = parse_attr; attr->parse_attr = parse_attr;
attr->action |= MLX5_FLOW_CONTEXT_ACTION_ENCAP | action |= MLX5_FLOW_CONTEXT_ACTION_ENCAP |
MLX5_FLOW_CONTEXT_ACTION_FWD_DEST | MLX5_FLOW_CONTEXT_ACTION_FWD_DEST |
MLX5_FLOW_CONTEXT_ACTION_COUNT; MLX5_FLOW_CONTEXT_ACTION_COUNT;
/* attr->out_rep is resolved when we handle encap */ /* attr->out_rep is resolved when we handle encap */
...@@ -2532,9 +2535,9 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, ...@@ -2532,9 +2535,9 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
if (is_tcf_vlan(a)) { if (is_tcf_vlan(a)) {
if (tcf_vlan_action(a) == TCA_VLAN_ACT_POP) { if (tcf_vlan_action(a) == TCA_VLAN_ACT_POP) {
attr->action |= MLX5_FLOW_CONTEXT_ACTION_VLAN_POP; action |= MLX5_FLOW_CONTEXT_ACTION_VLAN_POP;
} else if (tcf_vlan_action(a) == TCA_VLAN_ACT_PUSH) { } else if (tcf_vlan_action(a) == TCA_VLAN_ACT_PUSH) {
attr->action |= MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH; action |= MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH;
attr->vlan_vid = tcf_vlan_push_vid(a); attr->vlan_vid = tcf_vlan_push_vid(a);
if (mlx5_eswitch_vlan_actions_supported(priv->mdev)) { if (mlx5_eswitch_vlan_actions_supported(priv->mdev)) {
attr->vlan_prio = tcf_vlan_push_prio(a); attr->vlan_prio = tcf_vlan_push_prio(a);
...@@ -2552,13 +2555,14 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts, ...@@ -2552,13 +2555,14 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
} }
if (is_tcf_tunnel_release(a)) { if (is_tcf_tunnel_release(a)) {
attr->action |= MLX5_FLOW_CONTEXT_ACTION_DECAP; action |= MLX5_FLOW_CONTEXT_ACTION_DECAP;
continue; continue;
} }
return -EINVAL; return -EINVAL;
} }
attr->action = action;
if (!actions_match_supported(priv, exts, parse_attr, flow)) if (!actions_match_supported(priv, exts, parse_attr, flow))
return -EOPNOTSUPP; return -EOPNOTSUPP;
......
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