mlxsw: spectrum_acl: Pass hints priv all the way to ERP code
authorJiri Pirko <jiri@mellanox.com>
Thu, 7 Feb 2019 11:22:52 +0000 (11:22 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 8 Feb 2019 23:02:50 +0000 (15:02 -0800)
The hints priv comes from ERP code and it is possible to obtain it from
TCAM code. Add arg to appropriate functions so the hints
priv could be passed back down to ERP code. Pass NULL now as the
follow-up patches would pass an actual hints priv pointer.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@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_erp.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.h

index 6432a1ce51f341be8ef03047b86affb03bc388cf..3d17b4a368f42aba3603a5ed450e404d989fc90d 100644 (file)
@@ -704,7 +704,8 @@ struct mlxsw_sp_acl_tcam_ops {
        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);
+                          struct mlxsw_sp_acl_tcam_region *region,
+                          void *hints_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);
index 6e444525713fb611b7a84061cc9315dc462a632b..3a636f753607b1c6dd3b9d3d7c2ed13af8f4e780 100644 (file)
@@ -112,7 +112,8 @@ 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_sp_acl_tcam_region *_region,
+                              void *hints_priv)
 {
        struct mlxsw_sp1_acl_tcam_region *region = region_priv;
        int err;
index 4808b29294d0b03ffd5fdc7dcab89c29d92457c4..6c66a0f1b79e38948af98b08bda300b55d5738e9 100644 (file)
@@ -139,7 +139,8 @@ 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_sp_acl_tcam_region *_region,
+                              void *hints_priv)
 {
        struct mlxsw_sp2_acl_tcam_region *region = region_priv;
        struct mlxsw_sp2_acl_tcam *tcam = tcam_priv;
@@ -147,7 +148,8 @@ mlxsw_sp2_acl_tcam_region_init(struct mlxsw_sp *mlxsw_sp, void *region_priv,
        region->region = _region;
 
        return mlxsw_sp_acl_atcam_region_init(mlxsw_sp, &tcam->atcam,
-                                             &region->aregion, _region,
+                                             &region->aregion,
+                                             _region, hints_priv,
                                              &mlxsw_sp2_acl_ctcam_region_ops);
 }
 
index e98037e4d03e00108fe178e12a3fe14ef5810672..ded4cf6586809b8055dc69c1740462062aaf49e0 100644 (file)
@@ -318,6 +318,7 @@ 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 *hints_priv,
                               const struct mlxsw_sp_acl_ctcam_region_ops *ops)
 {
        int err;
@@ -334,7 +335,7 @@ mlxsw_sp_acl_atcam_region_init(struct mlxsw_sp *mlxsw_sp,
        err = aregion->ops->init(aregion);
        if (err)
                goto err_ops_init;
-       err = mlxsw_sp_acl_erp_region_init(aregion);
+       err = mlxsw_sp_acl_erp_region_init(aregion, hints_priv);
        if (err)
                goto err_erp_region_init;
        err = mlxsw_sp_acl_ctcam_region_init(mlxsw_sp, &aregion->cregion,
index 013ab43a7727dd43573f80e0854fe67cd7ab28de..e935c36638d9f180ec2a6591bb014b0e8d2d0fe3 100644 (file)
@@ -1313,7 +1313,8 @@ static const struct objagg_ops mlxsw_sp_acl_erp_objagg_ops = {
 };
 
 static struct mlxsw_sp_acl_erp_table *
-mlxsw_sp_acl_erp_table_create(struct mlxsw_sp_acl_atcam_region *aregion)
+mlxsw_sp_acl_erp_table_create(struct mlxsw_sp_acl_atcam_region *aregion,
+                             struct objagg_hints *hints)
 {
        struct mlxsw_sp_acl_erp_table *erp_table;
        int err;
@@ -1323,7 +1324,7 @@ mlxsw_sp_acl_erp_table_create(struct mlxsw_sp_acl_atcam_region *aregion)
                return ERR_PTR(-ENOMEM);
 
        erp_table->objagg = objagg_create(&mlxsw_sp_acl_erp_objagg_ops,
-                                         NULL, aregion);
+                                         hints, aregion);
        if (IS_ERR(erp_table->objagg)) {
                err = PTR_ERR(erp_table->objagg);
                goto err_objagg_create;
@@ -1444,12 +1445,14 @@ void mlxsw_sp_acl_erp_rehash_hints_put(void *hints_priv)
        objagg_hints_put(hints);
 }
 
-int mlxsw_sp_acl_erp_region_init(struct mlxsw_sp_acl_atcam_region *aregion)
+int mlxsw_sp_acl_erp_region_init(struct mlxsw_sp_acl_atcam_region *aregion,
+                                void *hints_priv)
 {
        struct mlxsw_sp_acl_erp_table *erp_table;
+       struct objagg_hints *hints = hints_priv;
        int err;
 
-       erp_table = mlxsw_sp_acl_erp_table_create(aregion);
+       erp_table = mlxsw_sp_acl_erp_table_create(aregion, hints);
        if (IS_ERR(erp_table))
                return PTR_ERR(erp_table);
        aregion->erp_table = erp_table;
index 36921ed1d2d5feb439b4ce4b09894cf963959ee4..1077c893438b81444d9f19cd9465e3ce680902ac 100644 (file)
@@ -572,7 +572,8 @@ 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, tcam->priv, region);
+       err = ops->region_init(mlxsw_sp, region->priv, tcam->priv,
+                              region, NULL);
        if (err)
                goto err_tcam_region_init;
 
index a90942bc1fe9bcf4e8d6c71ee9995815c409615f..c2a340270982aa6be067737ce7cd49d5edbb8331 100644 (file)
@@ -206,6 +206,7 @@ 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 *hints_priv,
                               const struct mlxsw_sp_acl_ctcam_region_ops *ops);
 void mlxsw_sp_acl_atcam_region_fini(struct mlxsw_sp_acl_atcam_region *aregion);
 void mlxsw_sp_acl_atcam_chunk_init(struct mlxsw_sp_acl_atcam_region *aregion,
@@ -265,7 +266,8 @@ void mlxsw_sp_acl_erp_bf_remove(struct mlxsw_sp *mlxsw_sp,
 void *
 mlxsw_sp_acl_erp_rehash_hints_get(struct mlxsw_sp_acl_atcam_region *aregion);
 void mlxsw_sp_acl_erp_rehash_hints_put(void *hints_priv);
-int mlxsw_sp_acl_erp_region_init(struct mlxsw_sp_acl_atcam_region *aregion);
+int mlxsw_sp_acl_erp_region_init(struct mlxsw_sp_acl_atcam_region *aregion,
+                                void *hints_priv);
 void mlxsw_sp_acl_erp_region_fini(struct mlxsw_sp_acl_atcam_region *aregion);
 int mlxsw_sp_acl_erps_init(struct mlxsw_sp *mlxsw_sp,
                           struct mlxsw_sp_acl_atcam *atcam);