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

mlxsw: spectrum_acl: Add region association callback

In Spectrum-2, ACL regions that use 8 or 12 key blocks require several
consecutive hardware regions.

In order to allow defragmentation, the device stores a mapping from a
logical region ID to an hardware region ID, which is similar to the page
table that is used to translate virtual addresses to physical addresses.

Add the region association callback to the region create sequence and
implement it as a NOP in Spectrum which does not require it.
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7a921a1e
...@@ -624,6 +624,8 @@ struct mlxsw_sp_acl_tcam_ops { ...@@ -624,6 +624,8 @@ struct mlxsw_sp_acl_tcam_ops {
int (*region_init)(struct mlxsw_sp *mlxsw_sp, void *region_priv, int (*region_init)(struct mlxsw_sp *mlxsw_sp, void *region_priv,
struct mlxsw_sp_acl_tcam_region *region); struct mlxsw_sp_acl_tcam_region *region);
void (*region_fini)(struct mlxsw_sp *mlxsw_sp, void *region_priv); void (*region_fini)(struct mlxsw_sp *mlxsw_sp, void *region_priv);
int (*region_associate)(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_acl_tcam_region *region);
size_t chunk_priv_size; size_t chunk_priv_size;
void (*chunk_init)(void *region_priv, void *chunk_priv, void (*chunk_init)(void *region_priv, void *chunk_priv,
unsigned int priority); unsigned int priority);
......
...@@ -151,6 +151,13 @@ mlxsw_sp1_acl_tcam_region_fini(struct mlxsw_sp *mlxsw_sp, void *region_priv) ...@@ -151,6 +151,13 @@ mlxsw_sp1_acl_tcam_region_fini(struct mlxsw_sp *mlxsw_sp, void *region_priv)
mlxsw_sp_acl_ctcam_region_fini(&region->cregion); mlxsw_sp_acl_ctcam_region_fini(&region->cregion);
} }
static int
mlxsw_sp1_acl_tcam_region_associate(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_acl_tcam_region *region)
{
return 0;
}
static void mlxsw_sp1_acl_tcam_chunk_init(void *region_priv, void *chunk_priv, static void mlxsw_sp1_acl_tcam_chunk_init(void *region_priv, void *chunk_priv,
unsigned int priority) unsigned int priority)
{ {
...@@ -235,6 +242,7 @@ const struct mlxsw_sp_acl_tcam_ops mlxsw_sp1_acl_tcam_ops = { ...@@ -235,6 +242,7 @@ const struct mlxsw_sp_acl_tcam_ops mlxsw_sp1_acl_tcam_ops = {
.region_priv_size = sizeof(struct mlxsw_sp1_acl_tcam_region), .region_priv_size = sizeof(struct mlxsw_sp1_acl_tcam_region),
.region_init = mlxsw_sp1_acl_tcam_region_init, .region_init = mlxsw_sp1_acl_tcam_region_init,
.region_fini = mlxsw_sp1_acl_tcam_region_fini, .region_fini = mlxsw_sp1_acl_tcam_region_fini,
.region_associate = mlxsw_sp1_acl_tcam_region_associate,
.chunk_priv_size = sizeof(struct mlxsw_sp1_acl_tcam_chunk), .chunk_priv_size = sizeof(struct mlxsw_sp1_acl_tcam_chunk),
.chunk_init = mlxsw_sp1_acl_tcam_chunk_init, .chunk_init = mlxsw_sp1_acl_tcam_chunk_init,
.chunk_fini = mlxsw_sp1_acl_tcam_chunk_fini, .chunk_fini = mlxsw_sp1_acl_tcam_chunk_fini,
......
...@@ -547,6 +547,10 @@ mlxsw_sp_acl_tcam_region_create(struct mlxsw_sp *mlxsw_sp, ...@@ -547,6 +547,10 @@ mlxsw_sp_acl_tcam_region_create(struct mlxsw_sp *mlxsw_sp,
if (err) if (err)
goto err_region_id_get; goto err_region_id_get;
err = ops->region_associate(mlxsw_sp, region);
if (err)
goto err_tcam_region_associate;
region->key_type = ops->key_type; region->key_type = ops->key_type;
err = mlxsw_sp_acl_tcam_region_alloc(mlxsw_sp, region); err = mlxsw_sp_acl_tcam_region_alloc(mlxsw_sp, region);
if (err) if (err)
...@@ -567,6 +571,7 @@ mlxsw_sp_acl_tcam_region_create(struct mlxsw_sp *mlxsw_sp, ...@@ -567,6 +571,7 @@ mlxsw_sp_acl_tcam_region_create(struct mlxsw_sp *mlxsw_sp,
err_tcam_region_enable: err_tcam_region_enable:
mlxsw_sp_acl_tcam_region_free(mlxsw_sp, region); mlxsw_sp_acl_tcam_region_free(mlxsw_sp, region);
err_tcam_region_alloc: err_tcam_region_alloc:
err_tcam_region_associate:
mlxsw_sp_acl_tcam_region_id_put(tcam, region->id); mlxsw_sp_acl_tcam_region_id_put(tcam, region->id);
err_region_id_get: err_region_id_get:
mlxsw_afk_key_info_put(region->key_info); mlxsw_afk_key_info_put(region->key_info);
......
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