Skip to content

Commit bbc84a8

Browse files
rleonBrian Maly
authored andcommitted
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: 6721239 ("net/mlx5e: Skip IPsec encryption for TX path without matching policy") Signed-off-by: Leon Romanovsky <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]> Orabug: 35383105 (cherry picked from commit e239e31) cherry-pick-repo=kernel/git/torvalds/linux.git unmodified-from-upstream: e239e31 Signed-off-by: Mikhael Goikhman <[email protected]> Signed-off-by: Qing Huang <[email protected]> Reviewed-by: Devesh Sharma <[email protected]> Signed-off-by: Brian Maly <[email protected]>
1 parent 21fa419 commit bbc84a8

File tree

1 file changed

+8
-8
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core/en_accel

1 file changed

+8
-8
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,16 +1252,16 @@ static int tx_add_policy(struct mlx5e_ipsec_pol_entry *pol_entry)
12521252
setup_fte_no_frags(spec);
12531253
setup_fte_upper_proto_match(spec, &attrs->upspec);
12541254

1255-
if (attrs->reqid) {
1255+
switch (attrs->action) {
1256+
case XFRM_POLICY_ALLOW:
1257+
flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
1258+
if (!attrs->reqid)
1259+
break;
1260+
12561261
err = setup_modify_header(mdev, attrs->reqid,
12571262
XFRM_DEV_OFFLOAD_OUT, &flow_act);
12581263
if (err)
12591264
goto err_mod_header;
1260-
}
1261-
1262-
switch (attrs->action) {
1263-
case XFRM_POLICY_ALLOW:
1264-
flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
12651265
break;
12661266
case XFRM_POLICY_BLOCK:
12671267
flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_DROP |
@@ -1273,7 +1273,7 @@ static int tx_add_policy(struct mlx5e_ipsec_pol_entry *pol_entry)
12731273
default:
12741274
WARN_ON(true);
12751275
err = -EINVAL;
1276-
goto err_action;
1276+
goto err_mod_header;
12771277
}
12781278

12791279
flow_act.flags |= FLOW_ACT_NO_APPEND;
@@ -1293,7 +1293,7 @@ static int tx_add_policy(struct mlx5e_ipsec_pol_entry *pol_entry)
12931293
return 0;
12941294

12951295
err_action:
1296-
if (attrs->reqid)
1296+
if (flow_act.modify_hdr)
12971297
mlx5_modify_header_dealloc(mdev, flow_act.modify_hdr);
12981298
err_mod_header:
12991299
kvfree(spec);

0 commit comments

Comments
 (0)