Commit 7983a675 authored by Paul Blakey's avatar Paul Blakey Committed by Saeed Mahameed

net/mlx5: E-Switch, Enable chains only if regs loopback is enabled

Register c0 loopback is needed to fully support chains and prios.

Enable chains and prio only if loopback (of reg c1 which came together
with c0), is enabled. To be able to check that, move enabling of loopback
before eswitch chains init.
Signed-off-by: default avatarPaul Blakey <paulb@mellanox.com>
Reviewed-by: default avatarRoi Dayan <roid@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent 60acc105
...@@ -2351,14 +2351,15 @@ int esw_offloads_enable(struct mlx5_eswitch *esw) ...@@ -2351,14 +2351,15 @@ int esw_offloads_enable(struct mlx5_eswitch *esw)
mutex_init(&esw->offloads.termtbl_mutex); mutex_init(&esw->offloads.termtbl_mutex);
mlx5_rdma_enable_roce(esw->dev); mlx5_rdma_enable_roce(esw->dev);
err = esw_offloads_steering_init(esw);
if (err)
goto err_steering_init;
err = esw_set_passing_vport_metadata(esw, true); err = esw_set_passing_vport_metadata(esw, true);
if (err) if (err)
goto err_vport_metadata; goto err_vport_metadata;
err = esw_offloads_steering_init(esw);
if (err)
goto err_steering_init;
/* Representor will control the vport link state */ /* Representor will control the vport link state */
mlx5_esw_for_each_vf_vport(esw, i, vport, esw->esw_funcs.num_vfs) mlx5_esw_for_each_vf_vport(esw, i, vport, esw->esw_funcs.num_vfs)
vport->info.link_state = MLX5_VPORT_ADMIN_STATE_DOWN; vport->info.link_state = MLX5_VPORT_ADMIN_STATE_DOWN;
...@@ -2380,9 +2381,9 @@ int esw_offloads_enable(struct mlx5_eswitch *esw) ...@@ -2380,9 +2381,9 @@ int esw_offloads_enable(struct mlx5_eswitch *esw)
esw_offloads_unload_rep(esw, MLX5_VPORT_UPLINK); esw_offloads_unload_rep(esw, MLX5_VPORT_UPLINK);
err_uplink: err_uplink:
esw_set_passing_vport_metadata(esw, false); esw_set_passing_vport_metadata(esw, false);
err_vport_metadata:
esw_offloads_steering_cleanup(esw);
err_steering_init: err_steering_init:
esw_offloads_steering_cleanup(esw);
err_vport_metadata:
mlx5_rdma_disable_roce(esw->dev); mlx5_rdma_disable_roce(esw->dev);
mutex_destroy(&esw->offloads.termtbl_mutex); mutex_destroy(&esw->offloads.termtbl_mutex);
return err; return err;
......
...@@ -280,7 +280,8 @@ create_fdb_chain_restore(struct fdb_chain *fdb_chain) ...@@ -280,7 +280,8 @@ create_fdb_chain_restore(struct fdb_chain *fdb_chain)
u32 index; u32 index;
int err; int err;
if (fdb_chain->chain == mlx5_esw_chains_get_ft_chain(esw)) if (fdb_chain->chain == mlx5_esw_chains_get_ft_chain(esw) ||
!mlx5_esw_chains_prios_supported(esw))
return 0; return 0;
err = mapping_add(esw_chains_mapping(esw), &fdb_chain->chain, &index); err = mapping_add(esw_chains_mapping(esw), &fdb_chain->chain, &index);
...@@ -335,6 +336,18 @@ create_fdb_chain_restore(struct fdb_chain *fdb_chain) ...@@ -335,6 +336,18 @@ create_fdb_chain_restore(struct fdb_chain *fdb_chain)
return err; return err;
} }
static void destroy_fdb_chain_restore(struct fdb_chain *fdb_chain)
{
struct mlx5_eswitch *esw = fdb_chain->esw;
if (!fdb_chain->miss_modify_hdr)
return;
mlx5_del_flow_rules(fdb_chain->restore_rule);
mlx5_modify_header_dealloc(esw->dev, fdb_chain->miss_modify_hdr);
mapping_remove(esw_chains_mapping(esw), fdb_chain->id);
}
static struct fdb_chain * static struct fdb_chain *
mlx5_esw_chains_create_fdb_chain(struct mlx5_eswitch *esw, u32 chain) mlx5_esw_chains_create_fdb_chain(struct mlx5_eswitch *esw, u32 chain)
{ {
...@@ -361,11 +374,7 @@ mlx5_esw_chains_create_fdb_chain(struct mlx5_eswitch *esw, u32 chain) ...@@ -361,11 +374,7 @@ mlx5_esw_chains_create_fdb_chain(struct mlx5_eswitch *esw, u32 chain)
return fdb_chain; return fdb_chain;
err_insert: err_insert:
if (fdb_chain->chain != mlx5_esw_chains_get_ft_chain(esw)) { destroy_fdb_chain_restore(fdb_chain);
mlx5_del_flow_rules(fdb_chain->restore_rule);
mlx5_modify_header_dealloc(esw->dev,
fdb_chain->miss_modify_hdr);
}
err_restore: err_restore:
kvfree(fdb_chain); kvfree(fdb_chain);
return ERR_PTR(err); return ERR_PTR(err);
...@@ -379,14 +388,7 @@ mlx5_esw_chains_destroy_fdb_chain(struct fdb_chain *fdb_chain) ...@@ -379,14 +388,7 @@ mlx5_esw_chains_destroy_fdb_chain(struct fdb_chain *fdb_chain)
rhashtable_remove_fast(&esw_chains_ht(esw), &fdb_chain->node, rhashtable_remove_fast(&esw_chains_ht(esw), &fdb_chain->node,
chain_params); chain_params);
if (fdb_chain->chain != mlx5_esw_chains_get_ft_chain(esw)) { destroy_fdb_chain_restore(fdb_chain);
mlx5_del_flow_rules(fdb_chain->restore_rule);
mlx5_modify_header_dealloc(esw->dev,
fdb_chain->miss_modify_hdr);
mapping_remove(esw_chains_mapping(esw), fdb_chain->id);
}
kvfree(fdb_chain); kvfree(fdb_chain);
} }
...@@ -423,7 +425,7 @@ mlx5_esw_chains_add_miss_rule(struct fdb_chain *fdb_chain, ...@@ -423,7 +425,7 @@ mlx5_esw_chains_add_miss_rule(struct fdb_chain *fdb_chain,
dest.ft = next_fdb; dest.ft = next_fdb;
if (next_fdb == tc_end_fdb(esw) && if (next_fdb == tc_end_fdb(esw) &&
fdb_modify_header_fwd_to_table_supported(esw)) { mlx5_esw_chains_prios_supported(esw)) {
act.modify_hdr = fdb_chain->miss_modify_hdr; act.modify_hdr = fdb_chain->miss_modify_hdr;
act.action |= MLX5_FLOW_CONTEXT_ACTION_MOD_HDR; act.action |= MLX5_FLOW_CONTEXT_ACTION_MOD_HDR;
} }
...@@ -783,6 +785,9 @@ mlx5_esw_chains_init(struct mlx5_eswitch *esw) ...@@ -783,6 +785,9 @@ mlx5_esw_chains_init(struct mlx5_eswitch *esw)
esw->offloads.encap != DEVLINK_ESWITCH_ENCAP_MODE_NONE) { esw->offloads.encap != DEVLINK_ESWITCH_ENCAP_MODE_NONE) {
esw->fdb_table.flags &= ~ESW_FDB_CHAINS_AND_PRIOS_SUPPORTED; esw->fdb_table.flags &= ~ESW_FDB_CHAINS_AND_PRIOS_SUPPORTED;
esw_warn(dev, "Tc chains and priorities offload aren't supported, update firmware if needed\n"); esw_warn(dev, "Tc chains and priorities offload aren't supported, update firmware if needed\n");
} else if (!mlx5_eswitch_reg_c1_loopback_enabled(esw)) {
esw->fdb_table.flags &= ~ESW_FDB_CHAINS_AND_PRIOS_SUPPORTED;
esw_warn(dev, "Tc chains and priorities offload aren't supported\n");
} else if (!fdb_modify_header_fwd_to_table_supported(esw)) { } else if (!fdb_modify_header_fwd_to_table_supported(esw)) {
/* Disabled when ttl workaround is needed, e.g /* Disabled when ttl workaround is needed, e.g
* when ESWITCH_IPV4_TTL_MODIFY_ENABLE = true in mlxconfig * when ESWITCH_IPV4_TTL_MODIFY_ENABLE = true in mlxconfig
......
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