Lines Matching refs:acl

39 struct mlxsw_afk *mlxsw_sp_acl_afk(struct mlxsw_sp_acl *acl)  in mlxsw_sp_acl_afk()  argument
41 return acl->afk; in mlxsw_sp_acl_afk()
44 struct mlxsw_sp_acl_tcam *mlxsw_sp_acl_to_tcam(struct mlxsw_sp_acl *acl) in mlxsw_sp_acl_to_tcam() argument
46 return &acl->tcam; in mlxsw_sp_acl_to_tcam()
96 return mlxsw_sp->acl->dummy_fid; in mlxsw_sp_acl_dummy_fid()
171 struct mlxsw_sp_acl *acl = mlxsw_sp->acl; in mlxsw_sp_acl_ruleset_create() local
189 err = ops->ruleset_add(mlxsw_sp, &acl->tcam, ruleset->priv, in mlxsw_sp_acl_ruleset_create()
195 err = rhashtable_insert_fast(&acl->ruleset_ht, &ruleset->ht_node, in mlxsw_sp_acl_ruleset_create()
215 struct mlxsw_sp_acl *acl = mlxsw_sp->acl; in mlxsw_sp_acl_ruleset_destroy() local
217 rhashtable_remove_fast(&acl->ruleset_ht, &ruleset->ht_node, in mlxsw_sp_acl_ruleset_destroy()
238 __mlxsw_sp_acl_ruleset_lookup(struct mlxsw_sp_acl *acl, in __mlxsw_sp_acl_ruleset_lookup() argument
248 return rhashtable_lookup_fast(&acl->ruleset_ht, &ht_key, in __mlxsw_sp_acl_ruleset_lookup()
258 struct mlxsw_sp_acl *acl = mlxsw_sp->acl; in mlxsw_sp_acl_ruleset_lookup() local
264 ruleset = __mlxsw_sp_acl_ruleset_lookup(acl, block, chain_index, ops); in mlxsw_sp_acl_ruleset_lookup()
277 struct mlxsw_sp_acl *acl = mlxsw_sp->acl; in mlxsw_sp_acl_ruleset_get() local
284 ruleset = __mlxsw_sp_acl_ruleset_lookup(acl, block, chain_index, ops); in mlxsw_sp_acl_ruleset_get()
315 mlxsw_sp_acl_rulei_create(struct mlxsw_sp_acl *acl, in mlxsw_sp_acl_rulei_create() argument
330 rulei->act_block = mlxsw_afa_block_create(acl->mlxsw_sp->afa); in mlxsw_sp_acl_rulei_create()
834 rule->rulei = mlxsw_sp_acl_rulei_create(mlxsw_sp->acl, afa_block); in mlxsw_sp_acl_rule_create()
887 mutex_lock(&mlxsw_sp->acl->rules_lock); in mlxsw_sp_acl_rule_add()
888 list_add_tail(&rule->list, &mlxsw_sp->acl->rules); in mlxsw_sp_acl_rule_add()
889 mutex_unlock(&mlxsw_sp->acl->rules_lock); in mlxsw_sp_acl_rule_add()
913 mutex_lock(&mlxsw_sp->acl->rules_lock); in mlxsw_sp_acl_rule_del()
915 mutex_unlock(&mlxsw_sp->acl->rules_lock); in mlxsw_sp_acl_rule_del()
969 static int mlxsw_sp_acl_rules_activity_update(struct mlxsw_sp_acl *acl) in mlxsw_sp_acl_rules_activity_update() argument
974 mutex_lock(&acl->rules_lock); in mlxsw_sp_acl_rules_activity_update()
975 list_for_each_entry(rule, &acl->rules, list) { in mlxsw_sp_acl_rules_activity_update()
976 err = mlxsw_sp_acl_rule_activity_update(acl->mlxsw_sp, in mlxsw_sp_acl_rules_activity_update()
981 mutex_unlock(&acl->rules_lock); in mlxsw_sp_acl_rules_activity_update()
985 mutex_unlock(&acl->rules_lock); in mlxsw_sp_acl_rules_activity_update()
989 static void mlxsw_sp_acl_rule_activity_work_schedule(struct mlxsw_sp_acl *acl) in mlxsw_sp_acl_rule_activity_work_schedule() argument
991 unsigned long interval = acl->rule_activity_update.interval; in mlxsw_sp_acl_rule_activity_work_schedule()
993 mlxsw_core_schedule_dw(&acl->rule_activity_update.dw, in mlxsw_sp_acl_rule_activity_work_schedule()
999 struct mlxsw_sp_acl *acl = container_of(work, struct mlxsw_sp_acl, in mlxsw_sp_acl_rule_activity_update_work() local
1003 err = mlxsw_sp_acl_rules_activity_update(acl); in mlxsw_sp_acl_rule_activity_update_work()
1005 dev_err(acl->mlxsw_sp->bus_info->dev, "Could not update acl activity"); in mlxsw_sp_acl_rule_activity_update_work()
1007 mlxsw_sp_acl_rule_activity_work_schedule(acl); in mlxsw_sp_acl_rule_activity_update_work()
1055 struct mlxsw_sp_acl *acl; in mlxsw_sp_acl_init() local
1059 alloc_size = sizeof(*acl) + mlxsw_sp_acl_tcam_priv_size(mlxsw_sp); in mlxsw_sp_acl_init()
1060 acl = kzalloc(alloc_size, GFP_KERNEL); in mlxsw_sp_acl_init()
1061 if (!acl) in mlxsw_sp_acl_init()
1063 mlxsw_sp->acl = acl; in mlxsw_sp_acl_init()
1064 acl->mlxsw_sp = mlxsw_sp; in mlxsw_sp_acl_init()
1065 acl->afk = mlxsw_afk_create(MLXSW_CORE_RES_GET(mlxsw_sp->core, in mlxsw_sp_acl_init()
1068 if (!acl->afk) { in mlxsw_sp_acl_init()
1073 err = rhashtable_init(&acl->ruleset_ht, in mlxsw_sp_acl_init()
1083 acl->dummy_fid = fid; in mlxsw_sp_acl_init()
1085 INIT_LIST_HEAD(&acl->rules); in mlxsw_sp_acl_init()
1086 mutex_init(&acl->rules_lock); in mlxsw_sp_acl_init()
1087 err = mlxsw_sp_acl_tcam_init(mlxsw_sp, &acl->tcam); in mlxsw_sp_acl_init()
1092 INIT_DELAYED_WORK(&acl->rule_activity_update.dw, in mlxsw_sp_acl_init()
1094 acl->rule_activity_update.interval = MLXSW_SP_ACL_RULE_ACTIVITY_UPDATE_PERIOD_MS; in mlxsw_sp_acl_init()
1095 mlxsw_core_schedule_dw(&acl->rule_activity_update.dw, 0); in mlxsw_sp_acl_init()
1099 mutex_destroy(&acl->rules_lock); in mlxsw_sp_acl_init()
1102 rhashtable_destroy(&acl->ruleset_ht); in mlxsw_sp_acl_init()
1104 mlxsw_afk_destroy(acl->afk); in mlxsw_sp_acl_init()
1106 kfree(acl); in mlxsw_sp_acl_init()
1112 struct mlxsw_sp_acl *acl = mlxsw_sp->acl; in mlxsw_sp_acl_fini() local
1114 cancel_delayed_work_sync(&mlxsw_sp->acl->rule_activity_update.dw); in mlxsw_sp_acl_fini()
1115 mlxsw_sp_acl_tcam_fini(mlxsw_sp, &acl->tcam); in mlxsw_sp_acl_fini()
1116 mutex_destroy(&acl->rules_lock); in mlxsw_sp_acl_fini()
1117 WARN_ON(!list_empty(&acl->rules)); in mlxsw_sp_acl_fini()
1118 mlxsw_sp_fid_put(acl->dummy_fid); in mlxsw_sp_acl_fini()
1119 rhashtable_destroy(&acl->ruleset_ht); in mlxsw_sp_acl_fini()
1120 mlxsw_afk_destroy(acl->afk); in mlxsw_sp_acl_fini()
1121 kfree(acl); in mlxsw_sp_acl_fini()