Skip to content

Commit f382a24

Browse files
Awik84kuba-moo
authored andcommitted
net/mlx5e: TC, Reject forwarding from internal port to internal port
Reject TC rules that forward from internal port to internal port as it is not supported. This include rules that are explicitly have internal port as the filter device as well as rules that apply on tunnel interfaces as the route device for the tunnel interface can be an internal port. Fixes: 27484f7 ("net/mlx5e: Offload tc rules that redirect to ovs internal port") Signed-off-by: Ariel Levkovich <lariel@nvidia.com> Reviewed-by: Maor Dickman <maord@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com> Link: https://lore.kernel.org/r/20221026135153.154807-9-saeed@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent bacd22d commit f382a24

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

  • drivers/net/ethernet/mellanox/mlx5/core

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4066,6 +4066,7 @@ parse_tc_fdb_actions(struct mlx5e_priv *priv,
40664066
struct mlx5e_tc_flow_parse_attr *parse_attr;
40674067
struct mlx5_flow_attr *attr = flow->attr;
40684068
struct mlx5_esw_flow_attr *esw_attr;
4069+
struct net_device *filter_dev;
40694070
int err;
40704071

40714072
err = flow_action_supported(flow_action, extack);
@@ -4074,6 +4075,7 @@ parse_tc_fdb_actions(struct mlx5e_priv *priv,
40744075

40754076
esw_attr = attr->esw_attr;
40764077
parse_attr = attr->parse_attr;
4078+
filter_dev = parse_attr->filter_dev;
40774079
parse_state = &parse_attr->parse_state;
40784080
mlx5e_tc_act_init_parse_state(parse_state, flow, flow_action, extack);
40794081
parse_state->ct_priv = get_ct_priv(priv);
@@ -4083,13 +4085,21 @@ parse_tc_fdb_actions(struct mlx5e_priv *priv,
40834085
return err;
40844086

40854087
/* Forward to/from internal port can only have 1 dest */
4086-
if ((netif_is_ovs_master(parse_attr->filter_dev) || esw_attr->dest_int_port) &&
4088+
if ((netif_is_ovs_master(filter_dev) || esw_attr->dest_int_port) &&
40874089
esw_attr->out_count > 1) {
40884090
NL_SET_ERR_MSG_MOD(extack,
40894091
"Rules with internal port can have only one destination");
40904092
return -EOPNOTSUPP;
40914093
}
40924094

4095+
/* Forward from tunnel/internal port to internal port is not supported */
4096+
if ((mlx5e_get_tc_tun(filter_dev) || netif_is_ovs_master(filter_dev)) &&
4097+
esw_attr->dest_int_port) {
4098+
NL_SET_ERR_MSG_MOD(extack,
4099+
"Forwarding from tunnel/internal port to internal port is not supported");
4100+
return -EOPNOTSUPP;
4101+
}
4102+
40934103
err = actions_prepare_mod_hdr_actions(priv, flow, attr, extack);
40944104
if (err)
40954105
return err;

0 commit comments

Comments
 (0)