]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
mlxsw: spectrum_acl: Add A-TCAM initialization
authorIdo Schimmel <idosch@mellanox.com>
Wed, 25 Jul 2018 06:24:00 +0000 (09:24 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 25 Jul 2018 23:46:01 +0000 (16:46 -0700)
Initialize the A-TCAM as part of the driver's initialization routine.

Specifically, initialize the eRP tables so that A-TCAM regions will be
able to perform allocations of eRP tables upon rule insertion in
subsequent patches.

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/spectrum2_acl_tcam.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_atcam.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_acl_tcam.h

index 33787b154e7463f756f688aa4ec92ff475897d5d..2442decd065231b0c4aa79b225a1491b620a7195 100644 (file)
@@ -39,6 +39,7 @@
 #include "core_acl_flex_actions.h"
 
 struct mlxsw_sp2_acl_tcam {
+       struct mlxsw_sp_acl_atcam atcam;
        u32 kvdl_index;
        unsigned int kvdl_count;
 };
@@ -100,9 +101,14 @@ static int mlxsw_sp2_acl_tcam_init(struct mlxsw_sp *mlxsw_sp, void *priv,
        if (err)
                goto err_pgcr_write;
 
+       err = mlxsw_sp_acl_atcam_init(mlxsw_sp, &tcam->atcam);
+       if (err)
+               goto err_atcam_init;
+
        mlxsw_afa_block_destroy(afa_block);
        return 0;
 
+err_atcam_init:
 err_pgcr_write:
 err_pefa_write:
 err_afa_block_continue:
@@ -117,6 +123,7 @@ static void mlxsw_sp2_acl_tcam_fini(struct mlxsw_sp *mlxsw_sp, void *priv)
 {
        struct mlxsw_sp2_acl_tcam *tcam = priv;
 
+       mlxsw_sp_acl_atcam_fini(mlxsw_sp, &tcam->atcam);
        mlxsw_sp_kvdl_free(mlxsw_sp, MLXSW_SP_KVDL_ENTRY_TYPE_ACTSET,
                           tcam->kvdl_count, tcam->kvdl_index);
 }
index a27d3b0f9fcb41fc3d4e2469bf9be178bb488b59..89c78c62e7e50551a63490a9b3e7cfd56212257c 100644 (file)
@@ -93,3 +93,15 @@ int mlxsw_sp_acl_atcam_region_init(struct mlxsw_sp *mlxsw_sp,
 
        return 0;
 }
+
+int mlxsw_sp_acl_atcam_init(struct mlxsw_sp *mlxsw_sp,
+                           struct mlxsw_sp_acl_atcam *atcam)
+{
+       return mlxsw_sp_acl_erps_init(mlxsw_sp, atcam);
+}
+
+void mlxsw_sp_acl_atcam_fini(struct mlxsw_sp *mlxsw_sp,
+                            struct mlxsw_sp_acl_atcam *atcam)
+{
+       mlxsw_sp_acl_erps_fini(mlxsw_sp, atcam);
+}
index 70094936ca4388dd7db698680b7dc76ea9e9840b..ac6bdffd99a731744a58e26cb7ca96139fe87fdd 100644 (file)
@@ -173,6 +173,10 @@ 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_tcam_region *region);
+int mlxsw_sp_acl_atcam_init(struct mlxsw_sp *mlxsw_sp,
+                           struct mlxsw_sp_acl_atcam *atcam);
+void mlxsw_sp_acl_atcam_fini(struct mlxsw_sp *mlxsw_sp,
+                            struct mlxsw_sp_acl_atcam *atcam);
 
 struct mlxsw_sp_acl_erp;