Lines Matching refs:acl
38 struct mlxsw_afk *mlxsw_sp_acl_afk(struct mlxsw_sp_acl *acl) in mlxsw_sp_acl_afk() argument
40 return acl->afk; in mlxsw_sp_acl_afk()
43 struct mlxsw_sp_acl_tcam *mlxsw_sp_acl_to_tcam(struct mlxsw_sp_acl *acl) in mlxsw_sp_acl_to_tcam() argument
45 return &acl->tcam; in mlxsw_sp_acl_to_tcam()
95 return mlxsw_sp->acl->dummy_fid; in mlxsw_sp_acl_dummy_fid()
170 struct mlxsw_sp_acl *acl = mlxsw_sp->acl; in mlxsw_sp_acl_ruleset_create() local
188 err = ops->ruleset_add(mlxsw_sp, &acl->tcam, ruleset->priv, in mlxsw_sp_acl_ruleset_create()
194 err = rhashtable_insert_fast(&acl->ruleset_ht, &ruleset->ht_node, in mlxsw_sp_acl_ruleset_create()
214 struct mlxsw_sp_acl *acl = mlxsw_sp->acl; in mlxsw_sp_acl_ruleset_destroy() local
216 rhashtable_remove_fast(&acl->ruleset_ht, &ruleset->ht_node, in mlxsw_sp_acl_ruleset_destroy()
237 __mlxsw_sp_acl_ruleset_lookup(struct mlxsw_sp_acl *acl, in __mlxsw_sp_acl_ruleset_lookup() argument
247 return rhashtable_lookup_fast(&acl->ruleset_ht, &ht_key, in __mlxsw_sp_acl_ruleset_lookup()
257 struct mlxsw_sp_acl *acl = mlxsw_sp->acl; in mlxsw_sp_acl_ruleset_lookup() local
263 ruleset = __mlxsw_sp_acl_ruleset_lookup(acl, block, chain_index, ops); in mlxsw_sp_acl_ruleset_lookup()
276 struct mlxsw_sp_acl *acl = mlxsw_sp->acl; in mlxsw_sp_acl_ruleset_get() local
283 ruleset = __mlxsw_sp_acl_ruleset_lookup(acl, block, chain_index, ops); in mlxsw_sp_acl_ruleset_get()
314 mlxsw_sp_acl_rulei_create(struct mlxsw_sp_acl *acl, in mlxsw_sp_acl_rulei_create() argument
329 rulei->act_block = mlxsw_afa_block_create(acl->mlxsw_sp->afa); in mlxsw_sp_acl_rulei_create()
817 rule->rulei = mlxsw_sp_acl_rulei_create(mlxsw_sp->acl, afa_block); in mlxsw_sp_acl_rule_create()
870 mutex_lock(&mlxsw_sp->acl->rules_lock); in mlxsw_sp_acl_rule_add()
871 list_add_tail(&rule->list, &mlxsw_sp->acl->rules); in mlxsw_sp_acl_rule_add()
872 mutex_unlock(&mlxsw_sp->acl->rules_lock); in mlxsw_sp_acl_rule_add()
896 mutex_lock(&mlxsw_sp->acl->rules_lock); in mlxsw_sp_acl_rule_del()
898 mutex_unlock(&mlxsw_sp->acl->rules_lock); in mlxsw_sp_acl_rule_del()
952 static int mlxsw_sp_acl_rules_activity_update(struct mlxsw_sp_acl *acl) in mlxsw_sp_acl_rules_activity_update() argument
957 mutex_lock(&acl->rules_lock); in mlxsw_sp_acl_rules_activity_update()
958 list_for_each_entry(rule, &acl->rules, list) { in mlxsw_sp_acl_rules_activity_update()
959 err = mlxsw_sp_acl_rule_activity_update(acl->mlxsw_sp, in mlxsw_sp_acl_rules_activity_update()
964 mutex_unlock(&acl->rules_lock); in mlxsw_sp_acl_rules_activity_update()
968 mutex_unlock(&acl->rules_lock); in mlxsw_sp_acl_rules_activity_update()
972 static void mlxsw_sp_acl_rule_activity_work_schedule(struct mlxsw_sp_acl *acl) in mlxsw_sp_acl_rule_activity_work_schedule() argument
974 unsigned long interval = acl->rule_activity_update.interval; in mlxsw_sp_acl_rule_activity_work_schedule()
976 mlxsw_core_schedule_dw(&acl->rule_activity_update.dw, in mlxsw_sp_acl_rule_activity_work_schedule()
982 struct mlxsw_sp_acl *acl = container_of(work, struct mlxsw_sp_acl, in mlxsw_sp_acl_rule_activity_update_work() local
986 err = mlxsw_sp_acl_rules_activity_update(acl); in mlxsw_sp_acl_rule_activity_update_work()
988 dev_err(acl->mlxsw_sp->bus_info->dev, "Could not update acl activity"); in mlxsw_sp_acl_rule_activity_update_work()
990 mlxsw_sp_acl_rule_activity_work_schedule(acl); in mlxsw_sp_acl_rule_activity_update_work()
1038 struct mlxsw_sp_acl *acl; in mlxsw_sp_acl_init() local
1042 alloc_size = sizeof(*acl) + mlxsw_sp_acl_tcam_priv_size(mlxsw_sp); in mlxsw_sp_acl_init()
1043 acl = kzalloc(alloc_size, GFP_KERNEL); in mlxsw_sp_acl_init()
1044 if (!acl) in mlxsw_sp_acl_init()
1046 mlxsw_sp->acl = acl; in mlxsw_sp_acl_init()
1047 acl->mlxsw_sp = mlxsw_sp; in mlxsw_sp_acl_init()
1048 acl->afk = mlxsw_afk_create(MLXSW_CORE_RES_GET(mlxsw_sp->core, in mlxsw_sp_acl_init()
1051 if (!acl->afk) { in mlxsw_sp_acl_init()
1056 err = rhashtable_init(&acl->ruleset_ht, in mlxsw_sp_acl_init()
1066 acl->dummy_fid = fid; in mlxsw_sp_acl_init()
1068 INIT_LIST_HEAD(&acl->rules); in mlxsw_sp_acl_init()
1069 mutex_init(&acl->rules_lock); in mlxsw_sp_acl_init()
1070 err = mlxsw_sp_acl_tcam_init(mlxsw_sp, &acl->tcam); in mlxsw_sp_acl_init()
1075 INIT_DELAYED_WORK(&acl->rule_activity_update.dw, in mlxsw_sp_acl_init()
1077 acl->rule_activity_update.interval = MLXSW_SP_ACL_RULE_ACTIVITY_UPDATE_PERIOD_MS; in mlxsw_sp_acl_init()
1078 mlxsw_core_schedule_dw(&acl->rule_activity_update.dw, 0); in mlxsw_sp_acl_init()
1082 mutex_destroy(&acl->rules_lock); in mlxsw_sp_acl_init()
1085 rhashtable_destroy(&acl->ruleset_ht); in mlxsw_sp_acl_init()
1087 mlxsw_afk_destroy(acl->afk); in mlxsw_sp_acl_init()
1089 kfree(acl); in mlxsw_sp_acl_init()
1095 struct mlxsw_sp_acl *acl = mlxsw_sp->acl; in mlxsw_sp_acl_fini() local
1097 cancel_delayed_work_sync(&mlxsw_sp->acl->rule_activity_update.dw); in mlxsw_sp_acl_fini()
1098 mlxsw_sp_acl_tcam_fini(mlxsw_sp, &acl->tcam); in mlxsw_sp_acl_fini()
1099 mutex_destroy(&acl->rules_lock); in mlxsw_sp_acl_fini()
1100 WARN_ON(!list_empty(&acl->rules)); in mlxsw_sp_acl_fini()
1101 mlxsw_sp_fid_put(acl->dummy_fid); in mlxsw_sp_acl_fini()
1102 rhashtable_destroy(&acl->ruleset_ht); in mlxsw_sp_acl_fini()
1103 mlxsw_afk_destroy(acl->afk); in mlxsw_sp_acl_fini()
1104 kfree(acl); in mlxsw_sp_acl_fini()