Skip to content

Commit f028821

Browse files
Eli CohenSaeed Mahameed
authored andcommitted
net/mlx5e: Add support for tc trap
Support tc trap such that packets can explicitly be forwarded to slow path if they match a specific rule. In the example below, we want packets with src IP equals 7.7.7.8 to be forwarded to software, in which case it will get to the appropriate representor net device. $ tc filter add dev eth1 protocol ip prio 1 root flower skip_sw \ src_ip 7.7.7.8 action trap Signed-off-by: Eli Cohen <[email protected]> Reviewed-by: Roi Dayan <[email protected]> Reviewed-by: Ariel Levkovich <[email protected]> Reviewed-by: Maor Dickman <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent cd1ef96 commit f028821

File tree

1 file changed

+10
-0
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+10
-0
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_tc.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3943,6 +3943,16 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv,
39433943
action |= MLX5_FLOW_CONTEXT_ACTION_DROP |
39443944
MLX5_FLOW_CONTEXT_ACTION_COUNT;
39453945
break;
3946+
case FLOW_ACTION_TRAP:
3947+
if (!flow_offload_has_one_action(flow_action)) {
3948+
NL_SET_ERR_MSG_MOD(extack,
3949+
"action trap is supported as a sole action only");
3950+
return -EOPNOTSUPP;
3951+
}
3952+
action |= (MLX5_FLOW_CONTEXT_ACTION_FWD_DEST |
3953+
MLX5_FLOW_CONTEXT_ACTION_COUNT);
3954+
attr->flags |= MLX5_ESW_ATTR_FLAG_SLOW_PATH;
3955+
break;
39463956
case FLOW_ACTION_MPLS_PUSH:
39473957
if (!MLX5_CAP_ESW_FLOWTABLE_FDB(priv->mdev,
39483958
reformat_l2_to_l3_tunnel) ||

0 commit comments

Comments
 (0)