mlxsw: spectrum_acl: Make global TCAM resources available to regions
authorIdo Schimmel <idosch@mellanox.com>
Wed, 25 Jul 2018 06:24:02 +0000 (09:24 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 25 Jul 2018 23:46:01 +0000 (16:46 -0700)
Each TCAM region currently uses its own resources and there is no
sharing between the different regions.

This is going to change with A-TCAM as each region will need to allocate
an eRP table from the global eRP tables array.

Make the global TCAM resources available to each region by passing the
TCAM private data to the region initialization routine.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum.h
drivers/net/ethernet/mellanox/mlxsw/spectrum1_acl_tcam.c
drivers/net/ethernet/mellanox/mlxsw/spectrum2_acl_tcam.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_atcam.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.h

index 589c63daf0855b44acb3a712684ccbce6009eabf..bc2704193666614fc2935694d215416974929364 100644 (file)
@@ -628,6 +628,7 @@ struct mlxsw_sp_acl_tcam_ops {
        void (*fini)(struct mlxsw_sp *mlxsw_sp, void *priv);
        size_t region_priv_size;
        int (*region_init)(struct mlxsw_sp *mlxsw_sp, void *region_priv,
+                          void *tcam_priv,
                           struct mlxsw_sp_acl_tcam_region *region);
        void (*region_fini)(struct mlxsw_sp *mlxsw_sp, void *region_priv);
        int (*region_associate)(struct mlxsw_sp *mlxsw_sp,
index d339ec43d79cbdd2561eb81aaaf03aaa204288f7..926483434e99449af68b45f4af0420e7afe12834 100644 (file)
@@ -122,6 +122,7 @@ mlxsw_sp1_acl_ctcam_region_catchall_del(struct mlxsw_sp *mlxsw_sp,
 
 static int
 mlxsw_sp1_acl_tcam_region_init(struct mlxsw_sp *mlxsw_sp, void *region_priv,
+                              void *tcam_priv,
                               struct mlxsw_sp_acl_tcam_region *_region)
 {
        struct mlxsw_sp1_acl_tcam_region *region = region_priv;
index 7e392529a89619d7b4583c0a9de945c4ed9aee4c..bef2329bb233627b5c2f6e15d84860956b81d6eb 100644 (file)
@@ -130,14 +130,16 @@ static void mlxsw_sp2_acl_tcam_fini(struct mlxsw_sp *mlxsw_sp, void *priv)
 
 static int
 mlxsw_sp2_acl_tcam_region_init(struct mlxsw_sp *mlxsw_sp, void *region_priv,
+                              void *tcam_priv,
                               struct mlxsw_sp_acl_tcam_region *_region)
 {
        struct mlxsw_sp2_acl_tcam_region *region = region_priv;
+       struct mlxsw_sp2_acl_tcam *tcam = tcam_priv;
 
        region->region = _region;
 
-       return mlxsw_sp_acl_atcam_region_init(mlxsw_sp, &region->aregion,
-                                             _region);
+       return mlxsw_sp_acl_atcam_region_init(mlxsw_sp, &tcam->atcam,
+                                             &region->aregion, _region);
 }
 
 static void
index e45172850ed350df938d0163490c4038eff26916..abe8194d50f18a9989c36a7e047bc235fdb601db 100644 (file)
@@ -77,6 +77,7 @@ mlxsw_sp_acl_atcam_region_erp_init(struct mlxsw_sp *mlxsw_sp,
 }
 
 int mlxsw_sp_acl_atcam_region_init(struct mlxsw_sp *mlxsw_sp,
+                                  struct mlxsw_sp_acl_atcam *atcam,
                                   struct mlxsw_sp_acl_atcam_region *aregion,
                                   struct mlxsw_sp_acl_tcam_region *region)
 {
index 310fd87895b8e5faaa85bab3dfffd98f1f1d03d8..245e2f473c6f512ba48bc69678394624e8ac25e1 100644 (file)
@@ -577,7 +577,7 @@ mlxsw_sp_acl_tcam_region_create(struct mlxsw_sp *mlxsw_sp,
        if (err)
                goto err_tcam_region_enable;
 
-       err = ops->region_init(mlxsw_sp, region->priv, region);
+       err = ops->region_init(mlxsw_sp, region->priv, tcam->priv, region);
        if (err)
                goto err_tcam_region_init;
 
index 17187e5fc3f20a4e0bd06112dabaf4f2cda490f1..718e96de28609fd71387c64af53ec4305a293b72 100644 (file)
@@ -173,6 +173,7 @@ struct mlxsw_sp_acl_atcam_region {
 int mlxsw_sp_acl_atcam_region_associate(struct mlxsw_sp *mlxsw_sp,
                                        u16 region_id);
 int mlxsw_sp_acl_atcam_region_init(struct mlxsw_sp *mlxsw_sp,
+                                  struct mlxsw_sp_acl_atcam *atcam,
                                   struct mlxsw_sp_acl_atcam_region *aregion,
                                   struct mlxsw_sp_acl_tcam_region *region);
 void mlxsw_sp_acl_atcam_region_fini(struct mlxsw_sp_acl_atcam_region *aregion);