net/mlx5: DR, Use attributes struct for FW flow table creation
Instead of using multiple variables use a simple struct. The number of passed argument was too high after adding the encap decap support bits arguments used for multiple destination reformat. Signed-off-by: Alex Vesker <valex@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
This commit is contained in:
parent
3ed879965c
commit
cc78dbd768
|
@ -320,12 +320,7 @@ int mlx5dr_cmd_destroy_flow_group(struct mlx5_core_dev *mdev,
|
|||
}
|
||||
|
||||
int mlx5dr_cmd_create_flow_table(struct mlx5_core_dev *mdev,
|
||||
u32 table_type,
|
||||
u64 icm_addr_rx,
|
||||
u64 icm_addr_tx,
|
||||
u8 level,
|
||||
bool sw_owner,
|
||||
bool term_tbl,
|
||||
struct mlx5dr_cmd_create_flow_table_attr *attr,
|
||||
u64 *fdb_rx_icm_addr,
|
||||
u32 *table_id)
|
||||
{
|
||||
|
@ -335,37 +330,43 @@ int mlx5dr_cmd_create_flow_table(struct mlx5_core_dev *mdev,
|
|||
int err;
|
||||
|
||||
MLX5_SET(create_flow_table_in, in, opcode, MLX5_CMD_OP_CREATE_FLOW_TABLE);
|
||||
MLX5_SET(create_flow_table_in, in, table_type, table_type);
|
||||
MLX5_SET(create_flow_table_in, in, table_type, attr->table_type);
|
||||
|
||||
ft_mdev = MLX5_ADDR_OF(create_flow_table_in, in, flow_table_context);
|
||||
MLX5_SET(flow_table_context, ft_mdev, termination_table, term_tbl);
|
||||
MLX5_SET(flow_table_context, ft_mdev, sw_owner, sw_owner);
|
||||
MLX5_SET(flow_table_context, ft_mdev, level, level);
|
||||
MLX5_SET(flow_table_context, ft_mdev, termination_table, attr->term_tbl);
|
||||
MLX5_SET(flow_table_context, ft_mdev, sw_owner, attr->sw_owner);
|
||||
MLX5_SET(flow_table_context, ft_mdev, level, attr->level);
|
||||
|
||||
if (sw_owner) {
|
||||
if (attr->sw_owner) {
|
||||
/* icm_addr_0 used for FDB RX / NIC TX / NIC_RX
|
||||
* icm_addr_1 used for FDB TX
|
||||
*/
|
||||
if (table_type == MLX5_FLOW_TABLE_TYPE_NIC_RX) {
|
||||
if (attr->table_type == MLX5_FLOW_TABLE_TYPE_NIC_RX) {
|
||||
MLX5_SET64(flow_table_context, ft_mdev,
|
||||
sw_owner_icm_root_0, icm_addr_rx);
|
||||
} else if (table_type == MLX5_FLOW_TABLE_TYPE_NIC_TX) {
|
||||
sw_owner_icm_root_0, attr->icm_addr_rx);
|
||||
} else if (attr->table_type == MLX5_FLOW_TABLE_TYPE_NIC_TX) {
|
||||
MLX5_SET64(flow_table_context, ft_mdev,
|
||||
sw_owner_icm_root_0, icm_addr_tx);
|
||||
} else if (table_type == MLX5_FLOW_TABLE_TYPE_FDB) {
|
||||
sw_owner_icm_root_0, attr->icm_addr_tx);
|
||||
} else if (attr->table_type == MLX5_FLOW_TABLE_TYPE_FDB) {
|
||||
MLX5_SET64(flow_table_context, ft_mdev,
|
||||
sw_owner_icm_root_0, icm_addr_rx);
|
||||
sw_owner_icm_root_0, attr->icm_addr_rx);
|
||||
MLX5_SET64(flow_table_context, ft_mdev,
|
||||
sw_owner_icm_root_1, icm_addr_tx);
|
||||
sw_owner_icm_root_1, attr->icm_addr_tx);
|
||||
}
|
||||
}
|
||||
|
||||
MLX5_SET(create_flow_table_in, in, flow_table_context.decap_en,
|
||||
attr->decap_en);
|
||||
MLX5_SET(create_flow_table_in, in, flow_table_context.reformat_en,
|
||||
attr->reformat_en);
|
||||
|
||||
err = mlx5_cmd_exec(mdev, in, sizeof(in), out, sizeof(out));
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
*table_id = MLX5_GET(create_flow_table_out, out, table_id);
|
||||
if (!sw_owner && table_type == MLX5_FLOW_TABLE_TYPE_FDB)
|
||||
if (!attr->sw_owner && attr->table_type == MLX5_FLOW_TABLE_TYPE_FDB &&
|
||||
fdb_rx_icm_addr)
|
||||
*fdb_rx_icm_addr =
|
||||
(u64)MLX5_GET(create_flow_table_out, out, icm_address_31_0) |
|
||||
(u64)MLX5_GET(create_flow_table_out, out, icm_address_39_32) << 32 |
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
struct mlx5dr_fw_recalc_cs_ft *
|
||||
mlx5dr_fw_create_recalc_cs_ft(struct mlx5dr_domain *dmn, u32 vport_num)
|
||||
{
|
||||
struct mlx5dr_cmd_create_flow_table_attr ft_attr = {};
|
||||
struct mlx5dr_fw_recalc_cs_ft *recalc_cs_ft;
|
||||
u32 table_id, group_id, modify_hdr_id;
|
||||
u64 rx_icm_addr, modify_ttl_action;
|
||||
|
@ -16,9 +17,14 @@ mlx5dr_fw_create_recalc_cs_ft(struct mlx5dr_domain *dmn, u32 vport_num)
|
|||
if (!recalc_cs_ft)
|
||||
return NULL;
|
||||
|
||||
ret = mlx5dr_cmd_create_flow_table(dmn->mdev, MLX5_FLOW_TABLE_TYPE_FDB,
|
||||
0, 0, dmn->info.caps.max_ft_level - 1,
|
||||
false, true, &rx_icm_addr, &table_id);
|
||||
ft_attr.table_type = MLX5_FLOW_TABLE_TYPE_FDB;
|
||||
ft_attr.level = dmn->info.caps.max_ft_level - 1;
|
||||
ft_attr.term_tbl = true;
|
||||
|
||||
ret = mlx5dr_cmd_create_flow_table(dmn->mdev,
|
||||
&ft_attr,
|
||||
&rx_icm_addr,
|
||||
&table_id);
|
||||
if (ret) {
|
||||
mlx5dr_err(dmn, "Failed creating TTL W/A FW flow table %d\n", ret);
|
||||
goto free_ttl_tbl;
|
||||
|
|
|
@ -211,6 +211,7 @@ static int dr_table_destroy_sw_owned_tbl(struct mlx5dr_table *tbl)
|
|||
|
||||
static int dr_table_create_sw_owned_tbl(struct mlx5dr_table *tbl)
|
||||
{
|
||||
struct mlx5dr_cmd_create_flow_table_attr ft_attr = {};
|
||||
u64 icm_addr_rx = 0;
|
||||
u64 icm_addr_tx = 0;
|
||||
int ret;
|
||||
|
@ -221,13 +222,14 @@ static int dr_table_create_sw_owned_tbl(struct mlx5dr_table *tbl)
|
|||
if (tbl->tx.s_anchor)
|
||||
icm_addr_tx = tbl->tx.s_anchor->chunk->icm_addr;
|
||||
|
||||
ret = mlx5dr_cmd_create_flow_table(tbl->dmn->mdev,
|
||||
tbl->table_type,
|
||||
icm_addr_rx,
|
||||
icm_addr_tx,
|
||||
tbl->dmn->info.caps.max_ft_level - 1,
|
||||
true, false, NULL,
|
||||
&tbl->table_id);
|
||||
ft_attr.table_type = tbl->table_type;
|
||||
ft_attr.icm_addr_rx = icm_addr_rx;
|
||||
ft_attr.icm_addr_tx = icm_addr_tx;
|
||||
ft_attr.level = tbl->dmn->info.caps.max_ft_level - 1;
|
||||
ft_attr.sw_owner = true;
|
||||
|
||||
ret = mlx5dr_cmd_create_flow_table(tbl->dmn->mdev, &ft_attr,
|
||||
NULL, &tbl->table_id);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -867,6 +867,17 @@ struct mlx5dr_cmd_query_flow_table_details {
|
|||
u64 sw_owner_icm_root_0;
|
||||
};
|
||||
|
||||
struct mlx5dr_cmd_create_flow_table_attr {
|
||||
u32 table_type;
|
||||
u64 icm_addr_rx;
|
||||
u64 icm_addr_tx;
|
||||
u8 level;
|
||||
bool sw_owner;
|
||||
bool term_tbl;
|
||||
bool decap_en;
|
||||
bool reformat_en;
|
||||
};
|
||||
|
||||
/* internal API functions */
|
||||
int mlx5dr_cmd_query_device(struct mlx5_core_dev *mdev,
|
||||
struct mlx5dr_cmd_caps *caps);
|
||||
|
@ -904,12 +915,7 @@ int mlx5dr_cmd_destroy_flow_group(struct mlx5_core_dev *mdev,
|
|||
u32 table_id,
|
||||
u32 group_id);
|
||||
int mlx5dr_cmd_create_flow_table(struct mlx5_core_dev *mdev,
|
||||
u32 table_type,
|
||||
u64 icm_addr_rx,
|
||||
u64 icm_addr_tx,
|
||||
u8 level,
|
||||
bool sw_owner,
|
||||
bool term_tbl,
|
||||
struct mlx5dr_cmd_create_flow_table_attr *attr,
|
||||
u64 *fdb_rx_icm_addr,
|
||||
u32 *table_id);
|
||||
int mlx5dr_cmd_destroy_flow_table(struct mlx5_core_dev *mdev,
|
||||
|
|
Loading…
Reference in New Issue