[PATCH RESEND net-next mlxsw 12/18] mlxsw: spectrum_acl: Encapsulate C-TCAM region in A-TCAM region
Ido Schimmel
idosch at mellanox.com
Wed Jul 18 01:36:51 AEST 2018
In Spectrum-2 the C-TCAM is only used for rules that can't fit in the
A-TCAM due to a limited number of masks per A-TCAM region.
In addition, rules inserted into the C-TCAM may affect rules residing in
the A-TCAM, by clearing their C-TCAM prune bit.
The two regions are thus closely related and can be thought of as if the
C-TCAM region is encapsulated in the A-TCAM one.
Change the data structures to reflect that before introducing A-TCAM
support.
Signed-off-by: Ido Schimmel <idosch at mellanox.com>
---
drivers/net/ethernet/mellanox/mlxsw/spectrum2_acl_tcam.c | 13 +++++++------
drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.h | 1 +
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum2_acl_tcam.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum2_acl_tcam.c
index 2442decd0652..0f21d7ed5881 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum2_acl_tcam.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum2_acl_tcam.c
@@ -45,7 +45,7 @@ struct mlxsw_sp2_acl_tcam {
};
struct mlxsw_sp2_acl_tcam_region {
- struct mlxsw_sp_acl_ctcam_region cregion;
+ struct mlxsw_sp_acl_atcam_region aregion;
struct mlxsw_sp_acl_tcam_region *region;
};
@@ -140,7 +140,8 @@ mlxsw_sp2_acl_tcam_region_init(struct mlxsw_sp *mlxsw_sp, void *region_priv,
err = mlxsw_sp_acl_atcam_region_init(mlxsw_sp, _region);
if (err)
return err;
- return mlxsw_sp_acl_ctcam_region_init(mlxsw_sp, ®ion->cregion,
+ return mlxsw_sp_acl_ctcam_region_init(mlxsw_sp,
+ ®ion->aregion.cregion,
_region);
}
@@ -149,7 +150,7 @@ mlxsw_sp2_acl_tcam_region_fini(struct mlxsw_sp *mlxsw_sp, void *region_priv)
{
struct mlxsw_sp2_acl_tcam_region *region = region_priv;
- mlxsw_sp_acl_ctcam_region_fini(®ion->cregion);
+ mlxsw_sp_acl_ctcam_region_fini(®ion->aregion.cregion);
}
static int
@@ -165,7 +166,7 @@ static void mlxsw_sp2_acl_tcam_chunk_init(void *region_priv, void *chunk_priv,
struct mlxsw_sp2_acl_tcam_region *region = region_priv;
struct mlxsw_sp2_acl_tcam_chunk *chunk = chunk_priv;
- mlxsw_sp_acl_ctcam_chunk_init(®ion->cregion, &chunk->cchunk,
+ mlxsw_sp_acl_ctcam_chunk_init(®ion->aregion.cregion, &chunk->cchunk,
priority);
}
@@ -186,7 +187,7 @@ static int mlxsw_sp2_acl_tcam_entry_add(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp2_acl_tcam_entry *entry = entry_priv;
entry->act_block = rulei->act_block;
- return mlxsw_sp_acl_ctcam_entry_add(mlxsw_sp, ®ion->cregion,
+ return mlxsw_sp_acl_ctcam_entry_add(mlxsw_sp, ®ion->aregion.cregion,
&chunk->cchunk, &entry->centry,
rulei, true);
}
@@ -199,7 +200,7 @@ static void mlxsw_sp2_acl_tcam_entry_del(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp2_acl_tcam_chunk *chunk = chunk_priv;
struct mlxsw_sp2_acl_tcam_entry *entry = entry_priv;
- mlxsw_sp_acl_ctcam_entry_del(mlxsw_sp, ®ion->cregion,
+ mlxsw_sp_acl_ctcam_entry_del(mlxsw_sp, ®ion->aregion.cregion,
&chunk->cchunk, &entry->centry);
}
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.h
index 0f242afdf5fe..fa0ecc226bec 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.h
@@ -162,6 +162,7 @@ struct mlxsw_sp_acl_atcam {
};
struct mlxsw_sp_acl_atcam_region {
+ struct mlxsw_sp_acl_ctcam_region cregion;
struct mlxsw_sp_acl_tcam_region *region;
struct mlxsw_sp_acl_atcam *atcam;
enum mlxsw_sp_acl_atcam_region_type type;
--
2.14.4
More information about the Linux-mlxsw
mailing list