Lines Matching refs:mlxsw_sp
24 struct mlxsw_sp *mlxsw_sp; member
88 struct mlxsw_sp_fid *mlxsw_sp_acl_dummy_fid(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_acl_dummy_fid() argument
90 return mlxsw_sp->acl->dummy_fid; in mlxsw_sp_acl_dummy_fid()
100 int mlxsw_sp_acl_ruleset_bind(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_acl_ruleset_bind() argument
107 return ops->ruleset_bind(mlxsw_sp, ruleset->priv, in mlxsw_sp_acl_ruleset_bind()
111 void mlxsw_sp_acl_ruleset_unbind(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_acl_ruleset_unbind() argument
118 ops->ruleset_unbind(mlxsw_sp, ruleset->priv, in mlxsw_sp_acl_ruleset_unbind()
123 mlxsw_sp_acl_ruleset_block_bind(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_acl_ruleset_block_bind() argument
132 err = mlxsw_sp_acl_ruleset_bind(mlxsw_sp, block, binding); in mlxsw_sp_acl_ruleset_block_bind()
141 mlxsw_sp_acl_ruleset_unbind(mlxsw_sp, block, binding); in mlxsw_sp_acl_ruleset_block_bind()
148 mlxsw_sp_acl_ruleset_block_unbind(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_acl_ruleset_block_unbind() argument
155 mlxsw_sp_acl_ruleset_unbind(mlxsw_sp, block, binding); in mlxsw_sp_acl_ruleset_block_unbind()
160 mlxsw_sp_acl_ruleset_create(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_acl_ruleset_create() argument
165 struct mlxsw_sp_acl *acl = mlxsw_sp->acl; in mlxsw_sp_acl_ruleset_create()
183 err = ops->ruleset_add(mlxsw_sp, &acl->tcam, ruleset->priv, in mlxsw_sp_acl_ruleset_create()
197 ops->ruleset_del(mlxsw_sp, ruleset->priv); in mlxsw_sp_acl_ruleset_create()
205 static void mlxsw_sp_acl_ruleset_destroy(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_acl_ruleset_destroy() argument
209 struct mlxsw_sp_acl *acl = mlxsw_sp->acl; in mlxsw_sp_acl_ruleset_destroy()
213 ops->ruleset_del(mlxsw_sp, ruleset->priv); in mlxsw_sp_acl_ruleset_destroy()
223 static void mlxsw_sp_acl_ruleset_ref_dec(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_acl_ruleset_ref_dec() argument
228 mlxsw_sp_acl_ruleset_destroy(mlxsw_sp, ruleset); in mlxsw_sp_acl_ruleset_ref_dec()
247 mlxsw_sp_acl_ruleset_lookup(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_acl_ruleset_lookup() argument
252 struct mlxsw_sp_acl *acl = mlxsw_sp->acl; in mlxsw_sp_acl_ruleset_lookup()
255 ops = mlxsw_sp_acl_tcam_profile_ops(mlxsw_sp, profile); in mlxsw_sp_acl_ruleset_lookup()
265 mlxsw_sp_acl_ruleset_get(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_acl_ruleset_get() argument
271 struct mlxsw_sp_acl *acl = mlxsw_sp->acl; in mlxsw_sp_acl_ruleset_get()
274 ops = mlxsw_sp_acl_tcam_profile_ops(mlxsw_sp, profile); in mlxsw_sp_acl_ruleset_get()
283 return mlxsw_sp_acl_ruleset_create(mlxsw_sp, block, chain_index, ops, in mlxsw_sp_acl_ruleset_get()
287 void mlxsw_sp_acl_ruleset_put(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_acl_ruleset_put() argument
290 mlxsw_sp_acl_ruleset_ref_dec(mlxsw_sp, ruleset); in mlxsw_sp_acl_ruleset_put()
324 rulei->act_block = mlxsw_afa_block_create(acl->mlxsw_sp->afa); in mlxsw_sp_acl_rulei_create()
403 int mlxsw_sp_acl_rulei_act_fwd(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_acl_rulei_act_fwd() argument
418 if (mlxsw_sp_port->mlxsw_sp != mlxsw_sp) { in mlxsw_sp_acl_rulei_act_fwd()
435 int mlxsw_sp_acl_rulei_act_mirror(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_acl_rulei_act_mirror() argument
459 int mlxsw_sp_acl_rulei_act_vlan(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_acl_rulei_act_vlan() argument
476 dev_err(mlxsw_sp->bus_info->dev, "Unsupported VLAN protocol %#04x\n", in mlxsw_sp_acl_rulei_act_vlan()
486 dev_err(mlxsw_sp->bus_info->dev, "Unsupported VLAN action\n"); in mlxsw_sp_acl_rulei_act_vlan()
491 int mlxsw_sp_acl_rulei_act_priority(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_acl_rulei_act_priority() argument
567 mlxsw_sp_acl_rulei_act_mangle_field(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_acl_rulei_act_mangle_field() argument
587 static int mlxsw_sp1_acl_rulei_act_mangle_field(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp1_acl_rulei_act_mangle_field() argument
594 err = mlxsw_sp_acl_rulei_act_mangle_field(mlxsw_sp, rulei, mact, val, extack); in mlxsw_sp1_acl_rulei_act_mangle_field()
602 static int mlxsw_sp2_acl_rulei_act_mangle_field(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp2_acl_rulei_act_mangle_field() argument
609 err = mlxsw_sp_acl_rulei_act_mangle_field(mlxsw_sp, rulei, mact, val, extack); in mlxsw_sp2_acl_rulei_act_mangle_field()
626 int mlxsw_sp_acl_rulei_act_mangle(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_acl_rulei_act_mangle() argument
632 const struct mlxsw_sp_acl_rulei_ops *acl_rulei_ops = mlxsw_sp->acl_rulei_ops; in mlxsw_sp_acl_rulei_act_mangle()
642 return acl_rulei_ops->act_mangle_field(mlxsw_sp, in mlxsw_sp_acl_rulei_act_mangle()
652 int mlxsw_sp_acl_rulei_act_police(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_acl_rulei_act_police() argument
670 int mlxsw_sp_acl_rulei_act_count(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_acl_rulei_act_count() argument
684 int mlxsw_sp_acl_rulei_act_fid_set(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_acl_rulei_act_fid_set() argument
692 mlxsw_sp_acl_rule_create(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_acl_rule_create() argument
712 rule->rulei = mlxsw_sp_acl_rulei_create(mlxsw_sp->acl, afa_block); in mlxsw_sp_acl_rule_create()
723 mlxsw_sp_acl_ruleset_ref_dec(mlxsw_sp, ruleset); in mlxsw_sp_acl_rule_create()
727 void mlxsw_sp_acl_rule_destroy(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_acl_rule_destroy() argument
734 mlxsw_sp_acl_ruleset_ref_dec(mlxsw_sp, ruleset); in mlxsw_sp_acl_rule_destroy()
737 int mlxsw_sp_acl_rule_add(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_acl_rule_add() argument
745 err = ops->rule_add(mlxsw_sp, ruleset->priv, rule->priv, rule->rulei); in mlxsw_sp_acl_rule_add()
760 err = mlxsw_sp_acl_ruleset_block_bind(mlxsw_sp, ruleset, block); in mlxsw_sp_acl_rule_add()
765 mutex_lock(&mlxsw_sp->acl->rules_lock); in mlxsw_sp_acl_rule_add()
766 list_add_tail(&rule->list, &mlxsw_sp->acl->rules); in mlxsw_sp_acl_rule_add()
767 mutex_unlock(&mlxsw_sp->acl->rules_lock); in mlxsw_sp_acl_rule_add()
777 ops->rule_del(mlxsw_sp, rule->priv); in mlxsw_sp_acl_rule_add()
781 void mlxsw_sp_acl_rule_del(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_acl_rule_del() argument
791 mutex_lock(&mlxsw_sp->acl->rules_lock); in mlxsw_sp_acl_rule_del()
793 mutex_unlock(&mlxsw_sp->acl->rules_lock); in mlxsw_sp_acl_rule_del()
796 mlxsw_sp_acl_ruleset_block_unbind(mlxsw_sp, ruleset, block); in mlxsw_sp_acl_rule_del()
799 ops->rule_del(mlxsw_sp, rule->priv); in mlxsw_sp_acl_rule_del()
802 int mlxsw_sp_acl_rule_action_replace(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_acl_rule_action_replace() argument
813 return ops->rule_action_replace(mlxsw_sp, rule->priv, rule->rulei); in mlxsw_sp_acl_rule_action_replace()
817 mlxsw_sp_acl_rule_lookup(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_acl_rule_lookup() argument
831 static int mlxsw_sp_acl_rule_activity_update(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_acl_rule_activity_update() argument
839 err = ops->rule_activity_get(mlxsw_sp, rule->priv, &active); in mlxsw_sp_acl_rule_activity_update()
854 err = mlxsw_sp_acl_rule_activity_update(acl->mlxsw_sp, in mlxsw_sp_acl_rules_activity_update()
883 dev_err(acl->mlxsw_sp->bus_info->dev, "Could not update acl activity"); in mlxsw_sp_acl_rule_activity_update_work()
888 int mlxsw_sp_acl_rule_get_stats(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_acl_rule_get_stats() argument
904 err = mlxsw_sp_flow_counter_get(mlxsw_sp, rulei->counter_index, in mlxsw_sp_acl_rule_get_stats()
912 err = mlxsw_sp_policer_drops_counter_get(mlxsw_sp, type, in mlxsw_sp_acl_rule_get_stats()
930 int mlxsw_sp_acl_init(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_acl_init() argument
937 alloc_size = sizeof(*acl) + mlxsw_sp_acl_tcam_priv_size(mlxsw_sp); in mlxsw_sp_acl_init()
941 mlxsw_sp->acl = acl; in mlxsw_sp_acl_init()
942 acl->mlxsw_sp = mlxsw_sp; in mlxsw_sp_acl_init()
943 acl->afk = mlxsw_afk_create(MLXSW_CORE_RES_GET(mlxsw_sp->core, in mlxsw_sp_acl_init()
945 mlxsw_sp->afk_ops); in mlxsw_sp_acl_init()
956 fid = mlxsw_sp_fid_dummy_get(mlxsw_sp); in mlxsw_sp_acl_init()
965 err = mlxsw_sp_acl_tcam_init(mlxsw_sp, &acl->tcam); in mlxsw_sp_acl_init()
988 void mlxsw_sp_acl_fini(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_acl_fini() argument
990 struct mlxsw_sp_acl *acl = mlxsw_sp->acl; in mlxsw_sp_acl_fini()
992 cancel_delayed_work_sync(&mlxsw_sp->acl->rule_activity_update.dw); in mlxsw_sp_acl_fini()
993 mlxsw_sp_acl_tcam_fini(mlxsw_sp, &acl->tcam); in mlxsw_sp_acl_fini()
1002 u32 mlxsw_sp_acl_region_rehash_intrvl_get(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_acl_region_rehash_intrvl_get() argument
1004 struct mlxsw_sp_acl *acl = mlxsw_sp->acl; in mlxsw_sp_acl_region_rehash_intrvl_get()
1006 return mlxsw_sp_acl_tcam_vregion_rehash_intrvl_get(mlxsw_sp, in mlxsw_sp_acl_region_rehash_intrvl_get()
1010 int mlxsw_sp_acl_region_rehash_intrvl_set(struct mlxsw_sp *mlxsw_sp, u32 val) in mlxsw_sp_acl_region_rehash_intrvl_set() argument
1012 struct mlxsw_sp_acl *acl = mlxsw_sp->acl; in mlxsw_sp_acl_region_rehash_intrvl_set()
1014 return mlxsw_sp_acl_tcam_vregion_rehash_intrvl_set(mlxsw_sp, in mlxsw_sp_acl_region_rehash_intrvl_set()