|
@@ -98,7 +98,6 @@ mlx5e_tc_add_nic_flow(struct mlx5e_priv *priv,
|
|
.action = attr->action,
|
|
.action = attr->action,
|
|
.flow_tag = attr->flow_tag,
|
|
.flow_tag = attr->flow_tag,
|
|
.encap_id = 0,
|
|
.encap_id = 0,
|
|
- .modify_id = attr->mod_hdr_id,
|
|
|
|
};
|
|
};
|
|
struct mlx5_fc *counter = NULL;
|
|
struct mlx5_fc *counter = NULL;
|
|
struct mlx5_flow_handle *rule;
|
|
struct mlx5_flow_handle *rule;
|
|
@@ -122,6 +121,7 @@ mlx5e_tc_add_nic_flow(struct mlx5e_priv *priv,
|
|
parse_attr->num_mod_hdr_actions,
|
|
parse_attr->num_mod_hdr_actions,
|
|
parse_attr->mod_hdr_actions,
|
|
parse_attr->mod_hdr_actions,
|
|
&attr->mod_hdr_id);
|
|
&attr->mod_hdr_id);
|
|
|
|
+ flow_act.modify_id = attr->mod_hdr_id;
|
|
kfree(parse_attr->mod_hdr_actions);
|
|
kfree(parse_attr->mod_hdr_actions);
|
|
if (err) {
|
|
if (err) {
|
|
rule = ERR_PTR(err);
|
|
rule = ERR_PTR(err);
|
|
@@ -208,6 +208,18 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,
|
|
goto err_add_vlan;
|
|
goto err_add_vlan;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) {
|
|
|
|
+ err = mlx5_modify_header_alloc(priv->mdev, MLX5_FLOW_NAMESPACE_FDB,
|
|
|
|
+ parse_attr->num_mod_hdr_actions,
|
|
|
|
+ parse_attr->mod_hdr_actions,
|
|
|
|
+ &attr->mod_hdr_id);
|
|
|
|
+ kfree(parse_attr->mod_hdr_actions);
|
|
|
|
+ if (err) {
|
|
|
|
+ rule = ERR_PTR(err);
|
|
|
|
+ goto err_mod_hdr;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
rule = mlx5_eswitch_add_offloaded_rule(esw, &parse_attr->spec, attr);
|
|
rule = mlx5_eswitch_add_offloaded_rule(esw, &parse_attr->spec, attr);
|
|
if (IS_ERR(rule))
|
|
if (IS_ERR(rule))
|
|
goto err_add_rule;
|
|
goto err_add_rule;
|
|
@@ -215,11 +227,14 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,
|
|
return rule;
|
|
return rule;
|
|
|
|
|
|
err_add_rule:
|
|
err_add_rule:
|
|
|
|
+ if (flow->esw_attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR)
|
|
|
|
+ mlx5_modify_header_dealloc(priv->mdev,
|
|
|
|
+ attr->mod_hdr_id);
|
|
|
|
+err_mod_hdr:
|
|
mlx5_eswitch_del_vlan_action(esw, attr);
|
|
mlx5_eswitch_del_vlan_action(esw, attr);
|
|
err_add_vlan:
|
|
err_add_vlan:
|
|
if (attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP)
|
|
if (attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP)
|
|
mlx5e_detach_encap(priv, flow);
|
|
mlx5e_detach_encap(priv, flow);
|
|
-
|
|
|
|
return rule;
|
|
return rule;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -227,6 +242,7 @@ static void mlx5e_tc_del_fdb_flow(struct mlx5e_priv *priv,
|
|
struct mlx5e_tc_flow *flow)
|
|
struct mlx5e_tc_flow *flow)
|
|
{
|
|
{
|
|
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
|
|
struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
|
|
|
|
+ struct mlx5_esw_flow_attr *attr = flow->esw_attr;
|
|
|
|
|
|
mlx5_eswitch_del_offloaded_rule(esw, flow->rule, flow->esw_attr);
|
|
mlx5_eswitch_del_offloaded_rule(esw, flow->rule, flow->esw_attr);
|
|
|
|
|
|
@@ -234,6 +250,10 @@ static void mlx5e_tc_del_fdb_flow(struct mlx5e_priv *priv,
|
|
|
|
|
|
if (flow->esw_attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP)
|
|
if (flow->esw_attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP)
|
|
mlx5e_detach_encap(priv, flow);
|
|
mlx5e_detach_encap(priv, flow);
|
|
|
|
+
|
|
|
|
+ if (flow->esw_attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR)
|
|
|
|
+ mlx5_modify_header_dealloc(priv->mdev,
|
|
|
|
+ attr->mod_hdr_id);
|
|
}
|
|
}
|
|
|
|
|
|
static void mlx5e_detach_encap(struct mlx5e_priv *priv,
|
|
static void mlx5e_detach_encap(struct mlx5e_priv *priv,
|
|
@@ -1406,6 +1426,7 @@ out_err:
|
|
}
|
|
}
|
|
|
|
|
|
static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
|
|
static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
|
|
|
|
+ struct mlx5e_tc_flow_parse_attr *parse_attr,
|
|
struct mlx5e_tc_flow *flow)
|
|
struct mlx5e_tc_flow *flow)
|
|
{
|
|
{
|
|
struct mlx5_esw_flow_attr *attr = flow->esw_attr;
|
|
struct mlx5_esw_flow_attr *attr = flow->esw_attr;
|
|
@@ -1429,6 +1450,16 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (is_tcf_pedit(a)) {
|
|
|
|
+ err = parse_tc_pedit_action(priv, a, MLX5_FLOW_NAMESPACE_FDB,
|
|
|
|
+ parse_attr);
|
|
|
|
+ if (err)
|
|
|
|
+ return err;
|
|
|
|
+
|
|
|
|
+ attr->action |= MLX5_FLOW_CONTEXT_ACTION_MOD_HDR;
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
if (is_tcf_mirred_egress_redirect(a)) {
|
|
if (is_tcf_mirred_egress_redirect(a)) {
|
|
int ifindex = tcf_mirred_ifindex(a);
|
|
int ifindex = tcf_mirred_ifindex(a);
|
|
struct net_device *out_dev;
|
|
struct net_device *out_dev;
|
|
@@ -1528,7 +1559,7 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv, __be16 protocol,
|
|
goto err_free;
|
|
goto err_free;
|
|
|
|
|
|
if (flow->flags & MLX5E_TC_FLOW_ESWITCH) {
|
|
if (flow->flags & MLX5E_TC_FLOW_ESWITCH) {
|
|
- err = parse_tc_fdb_actions(priv, f->exts, flow);
|
|
|
|
|
|
+ err = parse_tc_fdb_actions(priv, f->exts, parse_attr, flow);
|
|
if (err < 0)
|
|
if (err < 0)
|
|
goto err_free;
|
|
goto err_free;
|
|
flow->rule = mlx5e_tc_add_fdb_flow(priv, parse_attr, flow);
|
|
flow->rule = mlx5e_tc_add_fdb_flow(priv, parse_attr, flow);
|