| From 5c520b031e6dae90c1c6ff28a7f2ad92fde44165 Mon Sep 17 00:00:00 2001 |
| From: Sasha Levin <sashal@kernel.org> |
| Date: Mon, 13 Jul 2020 14:09:04 +0300 |
| Subject: net/mlx5: DR, Change push vlan action sequence |
| |
| From: Alex Vesker <valex@mellanox.com> |
| |
| [ Upstream commit b206490940216542c68563699b279eed3c55107c ] |
| |
| The DR TX state machine supports the following order: |
| modify header, push vlan and encapsulation. |
| Instead fs_dr would pass: |
| push vlan, modify header and encapsulation. |
| |
| The above caused the rule creation to fail on invalid action |
| sequence provided error. |
| |
| Fixes: 6a48faeeca10 ("net/mlx5: Add direct rule fs_cmd implementation") |
| Signed-off-by: Alex Vesker <valex@mellanox.com> |
| Reviewed-by: Maor Gottlieb <maorg@mellanox.com> |
| Signed-off-by: Saeed Mahameed <saeedm@mellanox.com> |
| Signed-off-by: Sasha Levin <sashal@kernel.org> |
| --- |
| .../mellanox/mlx5/core/steering/fs_dr.c | 42 +++++++++---------- |
| 1 file changed, 21 insertions(+), 21 deletions(-) |
| |
| diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c |
| index 3b3f5b9d4f950..2f3ee8519b226 100644 |
| --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c |
| +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c |
| @@ -279,29 +279,9 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, |
| |
| /* The order of the actions are must to be keep, only the following |
| * order is supported by SW steering: |
| - * TX: push vlan -> modify header -> encap |
| + * TX: modify header -> push vlan -> encap |
| * RX: decap -> pop vlan -> modify header |
| */ |
| - if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH) { |
| - tmp_action = create_action_push_vlan(domain, &fte->action.vlan[0]); |
| - if (!tmp_action) { |
| - err = -ENOMEM; |
| - goto free_actions; |
| - } |
| - fs_dr_actions[fs_dr_num_actions++] = tmp_action; |
| - actions[num_actions++] = tmp_action; |
| - } |
| - |
| - if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH_2) { |
| - tmp_action = create_action_push_vlan(domain, &fte->action.vlan[1]); |
| - if (!tmp_action) { |
| - err = -ENOMEM; |
| - goto free_actions; |
| - } |
| - fs_dr_actions[fs_dr_num_actions++] = tmp_action; |
| - actions[num_actions++] = tmp_action; |
| - } |
| - |
| if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_DECAP) { |
| enum mlx5dr_action_reformat_type decap_type = |
| DR_ACTION_REFORMAT_TYP_TNL_L2_TO_L2; |
| @@ -354,6 +334,26 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, |
| actions[num_actions++] = |
| fte->action.modify_hdr->action.dr_action; |
| |
| + if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH) { |
| + tmp_action = create_action_push_vlan(domain, &fte->action.vlan[0]); |
| + if (!tmp_action) { |
| + err = -ENOMEM; |
| + goto free_actions; |
| + } |
| + fs_dr_actions[fs_dr_num_actions++] = tmp_action; |
| + actions[num_actions++] = tmp_action; |
| + } |
| + |
| + if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH_2) { |
| + tmp_action = create_action_push_vlan(domain, &fte->action.vlan[1]); |
| + if (!tmp_action) { |
| + err = -ENOMEM; |
| + goto free_actions; |
| + } |
| + fs_dr_actions[fs_dr_num_actions++] = tmp_action; |
| + actions[num_actions++] = tmp_action; |
| + } |
| + |
| if (delay_encap_set) |
| actions[num_actions++] = |
| fte->action.pkt_reformat->action.dr_action; |
| -- |
| 2.25.1 |
| |