Commit a20ff8eb authored by Ido Schimmel's avatar Ido Schimmel Committed by David S. Miller

mlxsw: spectrum_acl: Pass C-TCAM region and entry to insert function

When A-TCAM will be used together with C-TCAM, the C-TCAM code will need
to call into the eRP core in order to get an eRP for an inserted entry.

The eRP core takes an A-TCAM region as one of its arguments, so pass the
C-TCAM region to the insertion function which will later allow us to
derive the A-TCAM region, given it contains the C-TCAM one.
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6d240650
...@@ -69,11 +69,12 @@ mlxsw_sp_acl_ctcam_region_move(struct mlxsw_sp *mlxsw_sp, ...@@ -69,11 +69,12 @@ mlxsw_sp_acl_ctcam_region_move(struct mlxsw_sp *mlxsw_sp,
static int static int
mlxsw_sp_acl_ctcam_region_entry_insert(struct mlxsw_sp *mlxsw_sp, mlxsw_sp_acl_ctcam_region_entry_insert(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_acl_tcam_region *region, struct mlxsw_sp_acl_ctcam_region *cregion,
unsigned int offset, struct mlxsw_sp_acl_ctcam_entry *centry,
struct mlxsw_sp_acl_rule_info *rulei, struct mlxsw_sp_acl_rule_info *rulei,
bool fillup_priority) bool fillup_priority)
{ {
struct mlxsw_sp_acl_tcam_region *region = cregion->region;
struct mlxsw_afk *afk = mlxsw_sp_acl_afk(mlxsw_sp->acl); struct mlxsw_afk *afk = mlxsw_sp_acl_afk(mlxsw_sp->acl);
char ptce2_pl[MLXSW_REG_PTCE2_LEN]; char ptce2_pl[MLXSW_REG_PTCE2_LEN];
unsigned int blocks_count; unsigned int blocks_count;
...@@ -89,7 +90,8 @@ mlxsw_sp_acl_ctcam_region_entry_insert(struct mlxsw_sp *mlxsw_sp, ...@@ -89,7 +90,8 @@ mlxsw_sp_acl_ctcam_region_entry_insert(struct mlxsw_sp *mlxsw_sp,
return err; return err;
mlxsw_reg_ptce2_pack(ptce2_pl, true, MLXSW_REG_PTCE2_OP_WRITE_WRITE, mlxsw_reg_ptce2_pack(ptce2_pl, true, MLXSW_REG_PTCE2_OP_WRITE_WRITE,
region->tcam_region_info, offset, priority); region->tcam_region_info,
centry->parman_item.index, priority);
key = mlxsw_reg_ptce2_flex_key_blocks_data(ptce2_pl); key = mlxsw_reg_ptce2_flex_key_blocks_data(ptce2_pl);
mask = mlxsw_reg_ptce2_mask_data(ptce2_pl); mask = mlxsw_reg_ptce2_mask_data(ptce2_pl);
blocks_count = mlxsw_afk_key_info_blocks_count_get(region->key_info); blocks_count = mlxsw_afk_key_info_blocks_count_get(region->key_info);
...@@ -105,13 +107,14 @@ mlxsw_sp_acl_ctcam_region_entry_insert(struct mlxsw_sp *mlxsw_sp, ...@@ -105,13 +107,14 @@ mlxsw_sp_acl_ctcam_region_entry_insert(struct mlxsw_sp *mlxsw_sp,
static void static void
mlxsw_sp_acl_ctcam_region_entry_remove(struct mlxsw_sp *mlxsw_sp, mlxsw_sp_acl_ctcam_region_entry_remove(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_acl_tcam_region *region, struct mlxsw_sp_acl_ctcam_region *cregion,
unsigned int offset) struct mlxsw_sp_acl_ctcam_entry *centry)
{ {
char ptce2_pl[MLXSW_REG_PTCE2_LEN]; char ptce2_pl[MLXSW_REG_PTCE2_LEN];
mlxsw_reg_ptce2_pack(ptce2_pl, false, MLXSW_REG_PTCE2_OP_WRITE_WRITE, mlxsw_reg_ptce2_pack(ptce2_pl, false, MLXSW_REG_PTCE2_OP_WRITE_WRITE,
region->tcam_region_info, offset, 0); cregion->region->tcam_region_info,
centry->parman_item.index, 0);
mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ptce2), ptce2_pl); mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(ptce2), ptce2_pl);
} }
...@@ -193,8 +196,7 @@ int mlxsw_sp_acl_ctcam_entry_add(struct mlxsw_sp *mlxsw_sp, ...@@ -193,8 +196,7 @@ int mlxsw_sp_acl_ctcam_entry_add(struct mlxsw_sp *mlxsw_sp,
if (err) if (err)
return err; return err;
err = mlxsw_sp_acl_ctcam_region_entry_insert(mlxsw_sp, cregion->region, err = mlxsw_sp_acl_ctcam_region_entry_insert(mlxsw_sp, cregion, centry,
centry->parman_item.index,
rulei, fillup_priority); rulei, fillup_priority);
if (err) if (err)
goto err_rule_insert; goto err_rule_insert;
...@@ -211,8 +213,7 @@ void mlxsw_sp_acl_ctcam_entry_del(struct mlxsw_sp *mlxsw_sp, ...@@ -211,8 +213,7 @@ void mlxsw_sp_acl_ctcam_entry_del(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_acl_ctcam_chunk *cchunk, struct mlxsw_sp_acl_ctcam_chunk *cchunk,
struct mlxsw_sp_acl_ctcam_entry *centry) struct mlxsw_sp_acl_ctcam_entry *centry)
{ {
mlxsw_sp_acl_ctcam_region_entry_remove(mlxsw_sp, cregion->region, mlxsw_sp_acl_ctcam_region_entry_remove(mlxsw_sp, cregion, centry);
centry->parman_item.index);
parman_item_remove(cregion->parman, &cchunk->parman_prio, parman_item_remove(cregion->parman, &cchunk->parman_prio,
&centry->parman_item); &centry->parman_item);
} }
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