Commit e239e31a authored by Leon Romanovsky's avatar Leon Romanovsky Committed by David S. Miller

net/mlx5e: Fix FW error while setting IPsec policy block action

When trying to set IPsec policy block action the following error is
generated:

 mlx5_cmd_out_err:803:(pid 3426): SET_FLOW_TABLE_ENTRY(0x936) op_mod(0x0) failed,
	status bad parameter(0x3), syndrome (0x8708c3), err(-22)

This error means that drop action is not allowed when modify action is
set, so update the code to skip modify header for XFRM_POLICY_BLOCK action.

Fixes: 67212396 ("net/mlx5e: Skip IPsec encryption for TX path without matching policy")
Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 35226750
...@@ -1252,16 +1252,16 @@ static int tx_add_policy(struct mlx5e_ipsec_pol_entry *pol_entry) ...@@ -1252,16 +1252,16 @@ static int tx_add_policy(struct mlx5e_ipsec_pol_entry *pol_entry)
setup_fte_no_frags(spec); setup_fte_no_frags(spec);
setup_fte_upper_proto_match(spec, &attrs->upspec); setup_fte_upper_proto_match(spec, &attrs->upspec);
if (attrs->reqid) { switch (attrs->action) {
case XFRM_POLICY_ALLOW:
flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
if (!attrs->reqid)
break;
err = setup_modify_header(mdev, attrs->reqid, err = setup_modify_header(mdev, attrs->reqid,
XFRM_DEV_OFFLOAD_OUT, &flow_act); XFRM_DEV_OFFLOAD_OUT, &flow_act);
if (err) if (err)
goto err_mod_header; goto err_mod_header;
}
switch (attrs->action) {
case XFRM_POLICY_ALLOW:
flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
break; break;
case XFRM_POLICY_BLOCK: case XFRM_POLICY_BLOCK:
flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_DROP | flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_DROP |
...@@ -1273,7 +1273,7 @@ static int tx_add_policy(struct mlx5e_ipsec_pol_entry *pol_entry) ...@@ -1273,7 +1273,7 @@ static int tx_add_policy(struct mlx5e_ipsec_pol_entry *pol_entry)
default: default:
WARN_ON(true); WARN_ON(true);
err = -EINVAL; err = -EINVAL;
goto err_action; goto err_mod_header;
} }
flow_act.flags |= FLOW_ACT_NO_APPEND; flow_act.flags |= FLOW_ACT_NO_APPEND;
...@@ -1293,7 +1293,7 @@ static int tx_add_policy(struct mlx5e_ipsec_pol_entry *pol_entry) ...@@ -1293,7 +1293,7 @@ static int tx_add_policy(struct mlx5e_ipsec_pol_entry *pol_entry)
return 0; return 0;
err_action: err_action:
if (attrs->reqid) if (flow_act.modify_hdr)
mlx5_modify_header_dealloc(mdev, flow_act.modify_hdr); mlx5_modify_header_dealloc(mdev, flow_act.modify_hdr);
err_mod_header: err_mod_header:
kvfree(spec); kvfree(spec);
......
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