Commit c0e90fc2 authored by Yevgeny Kliteynik's avatar Yevgeny Kliteynik Committed by Saeed Mahameed

net/mlx5: DR, Support csum recalculation flow table on SFs

Implement csum recalculation flow tables in XAarray instead of a fixed
array, thus adding support for csum recalc table on any valid vport
number, which enables this support for SFs.
Signed-off-by: default avatarYevgeny Kliteynik <kliteyn@nvidia.com>
Reviewed-by: default avatarMuhammad Sammar <muhammads@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent ee1887fb
...@@ -513,7 +513,7 @@ static int dr_action_handle_cs_recalc(struct mlx5dr_domain *dmn, ...@@ -513,7 +513,7 @@ static int dr_action_handle_cs_recalc(struct mlx5dr_domain *dmn,
/* If destination is vport we will get the FW flow table /* If destination is vport we will get the FW flow table
* that recalculates the CS and forwards to the vport. * that recalculates the CS and forwards to the vport.
*/ */
ret = mlx5dr_domain_cache_get_recalc_cs_ft_addr(dest_action->vport->dmn, ret = mlx5dr_domain_get_recalc_cs_ft_addr(dest_action->vport->dmn,
dest_action->vport->caps->num, dest_action->vport->caps->num,
final_icm_addr); final_icm_addr);
if (ret) { if (ret) {
......
...@@ -9,48 +9,45 @@ ...@@ -9,48 +9,45 @@
((dmn)->info.caps.dmn_type##_sw_owner_v2 && \ ((dmn)->info.caps.dmn_type##_sw_owner_v2 && \
(dmn)->info.caps.sw_format_ver <= MLX5_STEERING_FORMAT_CONNECTX_6DX)) (dmn)->info.caps.sw_format_ver <= MLX5_STEERING_FORMAT_CONNECTX_6DX))
static int dr_domain_init_cache(struct mlx5dr_domain *dmn) static void dr_domain_init_csum_recalc_fts(struct mlx5dr_domain *dmn)
{ {
/* Per vport cached FW FT for checksum recalculation, this /* Per vport cached FW FT for checksum recalculation, this
* recalculation is needed due to a HW bug. * recalculation is needed due to a HW bug in STEv0.
*/ */
dmn->cache.recalc_cs_ft = kcalloc(dmn->info.caps.num_vports, xa_init(&dmn->csum_fts_xa);
sizeof(dmn->cache.recalc_cs_ft[0]),
GFP_KERNEL);
if (!dmn->cache.recalc_cs_ft)
return -ENOMEM;
return 0;
} }
static void dr_domain_uninit_cache(struct mlx5dr_domain *dmn) static void dr_domain_uninit_csum_recalc_fts(struct mlx5dr_domain *dmn)
{ {
int i; struct mlx5dr_fw_recalc_cs_ft *recalc_cs_ft;
unsigned long i;
for (i = 0; i < dmn->info.caps.num_vports; i++) {
if (!dmn->cache.recalc_cs_ft[i])
continue;
mlx5dr_fw_destroy_recalc_cs_ft(dmn, dmn->cache.recalc_cs_ft[i]); xa_for_each(&dmn->csum_fts_xa, i, recalc_cs_ft) {
if (recalc_cs_ft)
mlx5dr_fw_destroy_recalc_cs_ft(dmn, recalc_cs_ft);
} }
kfree(dmn->cache.recalc_cs_ft); xa_destroy(&dmn->csum_fts_xa);
} }
int mlx5dr_domain_cache_get_recalc_cs_ft_addr(struct mlx5dr_domain *dmn, int mlx5dr_domain_get_recalc_cs_ft_addr(struct mlx5dr_domain *dmn,
u16 vport_num, u16 vport_num,
u64 *rx_icm_addr) u64 *rx_icm_addr)
{ {
struct mlx5dr_fw_recalc_cs_ft *recalc_cs_ft; struct mlx5dr_fw_recalc_cs_ft *recalc_cs_ft;
int ret;
recalc_cs_ft = dmn->cache.recalc_cs_ft[vport_num]; recalc_cs_ft = xa_load(&dmn->csum_fts_xa, vport_num);
if (!recalc_cs_ft) { if (!recalc_cs_ft) {
/* Table not in cache, need to allocate a new one */ /* Table hasn't been created yet */
recalc_cs_ft = mlx5dr_fw_create_recalc_cs_ft(dmn, vport_num); recalc_cs_ft = mlx5dr_fw_create_recalc_cs_ft(dmn, vport_num);
if (!recalc_cs_ft) if (!recalc_cs_ft)
return -EINVAL; return -EINVAL;
dmn->cache.recalc_cs_ft[vport_num] = recalc_cs_ft; ret = xa_err(xa_store(&dmn->csum_fts_xa, vport_num,
recalc_cs_ft, GFP_KERNEL));
if (ret)
return ret;
} }
*rx_icm_addr = recalc_cs_ft->rx_icm_addr; *rx_icm_addr = recalc_cs_ft->rx_icm_addr;
...@@ -346,16 +343,10 @@ mlx5dr_domain_create(struct mlx5_core_dev *mdev, enum mlx5dr_domain_type type) ...@@ -346,16 +343,10 @@ mlx5dr_domain_create(struct mlx5_core_dev *mdev, enum mlx5dr_domain_type type)
goto uninit_caps; goto uninit_caps;
} }
ret = dr_domain_init_cache(dmn); dr_domain_init_csum_recalc_fts(dmn);
if (ret) {
mlx5dr_err(dmn, "Failed initialize domain cache\n");
goto uninit_resourses;
}
return dmn; return dmn;
uninit_resourses:
dr_domain_uninit_resources(dmn);
uninit_caps: uninit_caps:
dr_domain_caps_uninit(dmn); dr_domain_caps_uninit(dmn);
free_domain: free_domain:
...@@ -394,7 +385,7 @@ int mlx5dr_domain_destroy(struct mlx5dr_domain *dmn) ...@@ -394,7 +385,7 @@ int mlx5dr_domain_destroy(struct mlx5dr_domain *dmn)
/* make sure resources are not used by the hardware */ /* make sure resources are not used by the hardware */
mlx5dr_cmd_sync_steering(dmn->mdev); mlx5dr_cmd_sync_steering(dmn->mdev);
dr_domain_uninit_cache(dmn); dr_domain_uninit_csum_recalc_fts(dmn);
dr_domain_uninit_resources(dmn); dr_domain_uninit_resources(dmn);
dr_domain_caps_uninit(dmn); dr_domain_caps_uninit(dmn);
mutex_destroy(&dmn->info.tx.mutex); mutex_destroy(&dmn->info.tx.mutex);
......
...@@ -827,10 +827,6 @@ struct mlx5dr_domain_info { ...@@ -827,10 +827,6 @@ struct mlx5dr_domain_info {
struct mlx5dr_cmd_caps caps; struct mlx5dr_cmd_caps caps;
}; };
struct mlx5dr_domain_cache {
struct mlx5dr_fw_recalc_cs_ft **recalc_cs_ft;
};
struct mlx5dr_domain { struct mlx5dr_domain {
struct mlx5dr_domain *peer_dmn; struct mlx5dr_domain *peer_dmn;
struct mlx5_core_dev *mdev; struct mlx5_core_dev *mdev;
...@@ -842,7 +838,7 @@ struct mlx5dr_domain { ...@@ -842,7 +838,7 @@ struct mlx5dr_domain {
struct mlx5dr_icm_pool *action_icm_pool; struct mlx5dr_icm_pool *action_icm_pool;
struct mlx5dr_send_ring *send_ring; struct mlx5dr_send_ring *send_ring;
struct mlx5dr_domain_info info; struct mlx5dr_domain_info info;
struct mlx5dr_domain_cache cache; struct xarray csum_fts_xa;
struct mlx5dr_ste_ctx *ste_ctx; struct mlx5dr_ste_ctx *ste_ctx;
}; };
...@@ -1379,7 +1375,7 @@ struct mlx5dr_fw_recalc_cs_ft * ...@@ -1379,7 +1375,7 @@ struct mlx5dr_fw_recalc_cs_ft *
mlx5dr_fw_create_recalc_cs_ft(struct mlx5dr_domain *dmn, u16 vport_num); mlx5dr_fw_create_recalc_cs_ft(struct mlx5dr_domain *dmn, u16 vport_num);
void mlx5dr_fw_destroy_recalc_cs_ft(struct mlx5dr_domain *dmn, void mlx5dr_fw_destroy_recalc_cs_ft(struct mlx5dr_domain *dmn,
struct mlx5dr_fw_recalc_cs_ft *recalc_cs_ft); struct mlx5dr_fw_recalc_cs_ft *recalc_cs_ft);
int mlx5dr_domain_cache_get_recalc_cs_ft_addr(struct mlx5dr_domain *dmn, int mlx5dr_domain_get_recalc_cs_ft_addr(struct mlx5dr_domain *dmn,
u16 vport_num, u16 vport_num,
u64 *rx_icm_addr); u64 *rx_icm_addr);
int mlx5dr_fw_create_md_tbl(struct mlx5dr_domain *dmn, int mlx5dr_fw_create_md_tbl(struct mlx5dr_domain *dmn,
......
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