mlxsw: spectrum_acl: Set A-TCAM rules in Bloom filter
authorNir Dotan <nird@mellanox.com>
Sun, 16 Dec 2018 08:49:30 +0000 (08:49 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 16 Dec 2018 23:20:34 +0000 (15:20 -0800)
Add calls to eRP module for updating Bloom filter when a rule is
added or removed from the A-TCAM. eRP module will update the Bloom
filter only for cases in which the region has an active eRP table.

Signed-off-by: Nir Dotan <nird@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_acl_atcam.c

index 75f11c2d7b97d42882f9ff1732613a96a93998b9..aedfece86121917558c98f5e8afb3a6b910af068 100644 (file)
@@ -508,6 +508,13 @@ __mlxsw_sp_acl_atcam_entry_add(struct mlxsw_sp *mlxsw_sp,
        if (err)
                goto err_rhashtable_insert;
 
+       /* Bloom filter must be updated here, before inserting the rule into
+        * the A-TCAM.
+        */
+       err = mlxsw_sp_acl_erp_bf_insert(mlxsw_sp, aregion, erp_mask, aentry);
+       if (err)
+               goto err_bf_insert;
+
        err = mlxsw_sp_acl_atcam_region_entry_insert(mlxsw_sp, aregion, aentry,
                                                     rulei);
        if (err)
@@ -516,6 +523,8 @@ __mlxsw_sp_acl_atcam_entry_add(struct mlxsw_sp *mlxsw_sp,
        return 0;
 
 err_rule_insert:
+       mlxsw_sp_acl_erp_bf_remove(mlxsw_sp, aregion, erp_mask, aentry);
+err_bf_insert:
        rhashtable_remove_fast(&aregion->entries_ht, &aentry->ht_node,
                               mlxsw_sp_acl_atcam_entries_ht_params);
 err_rhashtable_insert:
@@ -529,6 +538,7 @@ __mlxsw_sp_acl_atcam_entry_del(struct mlxsw_sp *mlxsw_sp,
                               struct mlxsw_sp_acl_atcam_entry *aentry)
 {
        mlxsw_sp_acl_atcam_region_entry_remove(mlxsw_sp, aregion, aentry);
+       mlxsw_sp_acl_erp_bf_remove(mlxsw_sp, aregion, aentry->erp_mask, aentry);
        rhashtable_remove_fast(&aregion->entries_ht, &aentry->ht_node,
                               mlxsw_sp_acl_atcam_entries_ht_params);
        mlxsw_sp_acl_erp_mask_put(aregion, aentry->erp_mask);