Lines Matching refs:rulei

71 	struct mlxsw_sp_acl_rule_info *rulei;  member
318 struct mlxsw_sp_acl_rule_info *rulei; in mlxsw_sp_acl_rulei_create() local
321 rulei = kzalloc(sizeof(*rulei), GFP_KERNEL); in mlxsw_sp_acl_rulei_create()
322 if (!rulei) in mlxsw_sp_acl_rulei_create()
326 rulei->act_block = afa_block; in mlxsw_sp_acl_rulei_create()
327 return rulei; in mlxsw_sp_acl_rulei_create()
330 rulei->act_block = mlxsw_afa_block_create(acl->mlxsw_sp->afa); in mlxsw_sp_acl_rulei_create()
331 if (IS_ERR(rulei->act_block)) { in mlxsw_sp_acl_rulei_create()
332 err = PTR_ERR(rulei->act_block); in mlxsw_sp_acl_rulei_create()
335 rulei->action_created = 1; in mlxsw_sp_acl_rulei_create()
336 return rulei; in mlxsw_sp_acl_rulei_create()
339 kfree(rulei); in mlxsw_sp_acl_rulei_create()
344 struct mlxsw_sp_acl_rule_info *rulei) in mlxsw_sp_acl_rulei_destroy() argument
346 if (rulei->action_created) in mlxsw_sp_acl_rulei_destroy()
347 mlxsw_afa_block_destroy(rulei->act_block); in mlxsw_sp_acl_rulei_destroy()
348 if (rulei->src_port_range_reg_valid) in mlxsw_sp_acl_rulei_destroy()
350 rulei->src_port_range_reg_index); in mlxsw_sp_acl_rulei_destroy()
351 if (rulei->dst_port_range_reg_valid) in mlxsw_sp_acl_rulei_destroy()
353 rulei->dst_port_range_reg_index); in mlxsw_sp_acl_rulei_destroy()
354 kfree(rulei); in mlxsw_sp_acl_rulei_destroy()
357 int mlxsw_sp_acl_rulei_commit(struct mlxsw_sp_acl_rule_info *rulei) in mlxsw_sp_acl_rulei_commit() argument
359 return mlxsw_afa_block_commit(rulei->act_block); in mlxsw_sp_acl_rulei_commit()
362 void mlxsw_sp_acl_rulei_priority(struct mlxsw_sp_acl_rule_info *rulei, in mlxsw_sp_acl_rulei_priority() argument
365 rulei->priority = priority; in mlxsw_sp_acl_rulei_priority()
368 void mlxsw_sp_acl_rulei_keymask_u32(struct mlxsw_sp_acl_rule_info *rulei, in mlxsw_sp_acl_rulei_keymask_u32() argument
372 mlxsw_afk_values_add_u32(&rulei->values, element, in mlxsw_sp_acl_rulei_keymask_u32()
376 void mlxsw_sp_acl_rulei_keymask_buf(struct mlxsw_sp_acl_rule_info *rulei, in mlxsw_sp_acl_rulei_keymask_buf() argument
381 mlxsw_afk_values_add_buf(&rulei->values, element, in mlxsw_sp_acl_rulei_keymask_buf()
385 int mlxsw_sp_acl_rulei_act_continue(struct mlxsw_sp_acl_rule_info *rulei) in mlxsw_sp_acl_rulei_act_continue() argument
387 return mlxsw_afa_block_continue(rulei->act_block); in mlxsw_sp_acl_rulei_act_continue()
390 int mlxsw_sp_acl_rulei_act_jump(struct mlxsw_sp_acl_rule_info *rulei, in mlxsw_sp_acl_rulei_act_jump() argument
393 return mlxsw_afa_block_jump(rulei->act_block, group_id); in mlxsw_sp_acl_rulei_act_jump()
396 int mlxsw_sp_acl_rulei_act_terminate(struct mlxsw_sp_acl_rule_info *rulei) in mlxsw_sp_acl_rulei_act_terminate() argument
398 return mlxsw_afa_block_terminate(rulei->act_block); in mlxsw_sp_acl_rulei_act_terminate()
401 int mlxsw_sp_acl_rulei_act_drop(struct mlxsw_sp_acl_rule_info *rulei, in mlxsw_sp_acl_rulei_act_drop() argument
406 return mlxsw_afa_block_append_drop(rulei->act_block, ingress, in mlxsw_sp_acl_rulei_act_drop()
410 int mlxsw_sp_acl_rulei_act_trap(struct mlxsw_sp_acl_rule_info *rulei) in mlxsw_sp_acl_rulei_act_trap() argument
412 return mlxsw_afa_block_append_trap(rulei->act_block, in mlxsw_sp_acl_rulei_act_trap()
417 struct mlxsw_sp_acl_rule_info *rulei, in mlxsw_sp_acl_rulei_act_fwd() argument
444 return mlxsw_afa_block_append_fwd(rulei->act_block, in mlxsw_sp_acl_rulei_act_fwd()
449 struct mlxsw_sp_acl_rule_info *rulei, in mlxsw_sp_acl_rulei_act_mirror() argument
465 return mlxsw_afa_block_append_mirror(rulei->act_block, in mlxsw_sp_acl_rulei_act_mirror()
473 struct mlxsw_sp_acl_rule_info *rulei, in mlxsw_sp_acl_rulei_act_vlan() argument
494 return mlxsw_afa_block_append_vlan_modify(rulei->act_block, in mlxsw_sp_acl_rulei_act_vlan()
505 struct mlxsw_sp_acl_rule_info *rulei, in mlxsw_sp_acl_rulei_act_priority() argument
517 return mlxsw_afa_block_append_qos_switch_prio(rulei->act_block, prio, in mlxsw_sp_acl_rulei_act_priority()
585 struct mlxsw_sp_acl_rule_info *rulei, in mlxsw_sp_acl_rulei_act_mangle_field() argument
591 return mlxsw_afa_block_append_qos_dsfield(rulei->act_block, in mlxsw_sp_acl_rulei_act_mangle_field()
594 return mlxsw_afa_block_append_qos_dscp(rulei->act_block, in mlxsw_sp_acl_rulei_act_mangle_field()
597 return mlxsw_afa_block_append_qos_ecn(rulei->act_block, in mlxsw_sp_acl_rulei_act_mangle_field()
605 struct mlxsw_sp_acl_rule_info *rulei, in mlxsw_sp1_acl_rulei_act_mangle_field() argument
611 err = mlxsw_sp_acl_rulei_act_mangle_field(mlxsw_sp, rulei, mact, val, extack); in mlxsw_sp1_acl_rulei_act_mangle_field()
620 mlxsw_sp2_acl_rulei_act_mangle_field_ip_odd(struct mlxsw_sp_acl_rule_info *rulei, in mlxsw_sp2_acl_rulei_act_mangle_field_ip_odd() argument
624 if (!rulei->ipv6_valid) { in mlxsw_sp2_acl_rulei_act_mangle_field_ip_odd()
625 rulei->ipv6.prev_val = val; in mlxsw_sp2_acl_rulei_act_mangle_field_ip_odd()
626 rulei->ipv6_valid = true; in mlxsw_sp2_acl_rulei_act_mangle_field_ip_odd()
627 rulei->ipv6.prev_field = field; in mlxsw_sp2_acl_rulei_act_mangle_field_ip_odd()
636 struct mlxsw_sp_acl_rule_info *rulei, in mlxsw_sp2_acl_rulei_act_mangle_field() argument
642 err = mlxsw_sp_acl_rulei_act_mangle_field(mlxsw_sp, rulei, mact, val, extack); in mlxsw_sp2_acl_rulei_act_mangle_field()
648 return mlxsw_afa_block_append_l4port(rulei->act_block, false, val, extack); in mlxsw_sp2_acl_rulei_act_mangle_field()
650 return mlxsw_afa_block_append_l4port(rulei->act_block, true, val, extack); in mlxsw_sp2_acl_rulei_act_mangle_field()
653 return mlxsw_afa_block_append_ip(rulei->act_block, false, in mlxsw_sp2_acl_rulei_act_mangle_field()
656 return mlxsw_afa_block_append_ip(rulei->act_block, true, in mlxsw_sp2_acl_rulei_act_mangle_field()
663 return mlxsw_sp2_acl_rulei_act_mangle_field_ip_odd(rulei, in mlxsw_sp2_acl_rulei_act_mangle_field()
667 if (rulei->ipv6_valid && in mlxsw_sp2_acl_rulei_act_mangle_field()
668 rulei->ipv6.prev_field == MLXSW_SP_ACL_MANGLE_FIELD_IP6_SIP_1) { in mlxsw_sp2_acl_rulei_act_mangle_field()
669 rulei->ipv6_valid = false; in mlxsw_sp2_acl_rulei_act_mangle_field()
670 return mlxsw_afa_block_append_ip(rulei->act_block, in mlxsw_sp2_acl_rulei_act_mangle_field()
672 rulei->ipv6.prev_val, in mlxsw_sp2_acl_rulei_act_mangle_field()
677 if (rulei->ipv6_valid && in mlxsw_sp2_acl_rulei_act_mangle_field()
678 rulei->ipv6.prev_field == MLXSW_SP_ACL_MANGLE_FIELD_IP6_SIP_3) { in mlxsw_sp2_acl_rulei_act_mangle_field()
679 rulei->ipv6_valid = false; in mlxsw_sp2_acl_rulei_act_mangle_field()
680 return mlxsw_afa_block_append_ip(rulei->act_block, in mlxsw_sp2_acl_rulei_act_mangle_field()
682 rulei->ipv6.prev_val, in mlxsw_sp2_acl_rulei_act_mangle_field()
687 if (rulei->ipv6_valid && in mlxsw_sp2_acl_rulei_act_mangle_field()
688 rulei->ipv6.prev_field == MLXSW_SP_ACL_MANGLE_FIELD_IP6_DIP_1) { in mlxsw_sp2_acl_rulei_act_mangle_field()
689 rulei->ipv6_valid = false; in mlxsw_sp2_acl_rulei_act_mangle_field()
690 return mlxsw_afa_block_append_ip(rulei->act_block, in mlxsw_sp2_acl_rulei_act_mangle_field()
692 rulei->ipv6.prev_val, in mlxsw_sp2_acl_rulei_act_mangle_field()
697 if (rulei->ipv6_valid && in mlxsw_sp2_acl_rulei_act_mangle_field()
698 rulei->ipv6.prev_field == MLXSW_SP_ACL_MANGLE_FIELD_IP6_DIP_3) { in mlxsw_sp2_acl_rulei_act_mangle_field()
699 rulei->ipv6_valid = false; in mlxsw_sp2_acl_rulei_act_mangle_field()
700 return mlxsw_afa_block_append_ip(rulei->act_block, in mlxsw_sp2_acl_rulei_act_mangle_field()
702 rulei->ipv6.prev_val, in mlxsw_sp2_acl_rulei_act_mangle_field()
715 struct mlxsw_sp_acl_rule_info *rulei, in mlxsw_sp_acl_rulei_act_mangle() argument
731 rulei, mact, in mlxsw_sp_acl_rulei_act_mangle()
741 struct mlxsw_sp_acl_rule_info *rulei, in mlxsw_sp_acl_rulei_act_police() argument
747 err = mlxsw_afa_block_append_police(rulei->act_block, index, in mlxsw_sp_acl_rulei_act_police()
749 &rulei->policer_index, extack); in mlxsw_sp_acl_rulei_act_police()
753 rulei->policer_index_valid = true; in mlxsw_sp_acl_rulei_act_police()
759 struct mlxsw_sp_acl_rule_info *rulei, in mlxsw_sp_acl_rulei_act_count() argument
764 err = mlxsw_afa_block_append_counter(rulei->act_block, in mlxsw_sp_acl_rulei_act_count()
765 &rulei->counter_index, extack); in mlxsw_sp_acl_rulei_act_count()
768 rulei->counter_valid = true; in mlxsw_sp_acl_rulei_act_count()
773 struct mlxsw_sp_acl_rule_info *rulei, in mlxsw_sp_acl_rulei_act_fid_set() argument
776 return mlxsw_afa_block_append_fid_set(rulei->act_block, fid, extack); in mlxsw_sp_acl_rulei_act_fid_set()
780 struct mlxsw_sp_acl_rule_info *rulei, in mlxsw_sp_acl_rulei_act_ignore() argument
783 return mlxsw_afa_block_append_ignore(rulei->act_block, in mlxsw_sp_acl_rulei_act_ignore()
789 struct mlxsw_sp_acl_rule_info *rulei, in mlxsw_sp_acl_rulei_act_sample() argument
806 return mlxsw_afa_block_append_sampler(rulei->act_block, in mlxsw_sp_acl_rulei_act_sample()
834 rule->rulei = mlxsw_sp_acl_rulei_create(mlxsw_sp->acl, afa_block); in mlxsw_sp_acl_rule_create()
835 if (IS_ERR(rule->rulei)) { in mlxsw_sp_acl_rule_create()
836 err = PTR_ERR(rule->rulei); in mlxsw_sp_acl_rule_create()
854 mlxsw_sp_acl_rulei_destroy(mlxsw_sp, rule->rulei); in mlxsw_sp_acl_rule_destroy()
867 err = ops->rule_add(mlxsw_sp, ruleset->priv, rule->priv, rule->rulei); in mlxsw_sp_acl_rule_add()
891 block->ingress_blocker_rule_count += rule->rulei->ingress_bind_blocker; in mlxsw_sp_acl_rule_add()
892 block->egress_blocker_rule_count += rule->rulei->egress_bind_blocker; in mlxsw_sp_acl_rule_add()
910 block->egress_blocker_rule_count -= rule->rulei->egress_bind_blocker; in mlxsw_sp_acl_rule_del()
911 block->ingress_blocker_rule_count -= rule->rulei->ingress_bind_blocker; in mlxsw_sp_acl_rule_del()
930 struct mlxsw_sp_acl_rule_info *rulei; in mlxsw_sp_acl_rule_action_replace() local
932 rulei = mlxsw_sp_acl_rule_rulei(rule); in mlxsw_sp_acl_rule_action_replace()
933 rulei->act_block = afa_block; in mlxsw_sp_acl_rule_action_replace()
935 return ops->rule_action_replace(mlxsw_sp, rule->priv, rule->rulei); in mlxsw_sp_acl_rule_action_replace()
950 return rule->rulei; in mlxsw_sp_acl_rule_rulei()
1018 struct mlxsw_sp_acl_rule_info *rulei; in mlxsw_sp_acl_rule_get_stats() local
1024 rulei = mlxsw_sp_acl_rule_rulei(rule); in mlxsw_sp_acl_rule_get_stats()
1025 if (rulei->counter_valid) { in mlxsw_sp_acl_rule_get_stats()
1026 err = mlxsw_sp_flow_counter_get(mlxsw_sp, rulei->counter_index, in mlxsw_sp_acl_rule_get_stats()
1033 if (rulei->policer_index_valid) { in mlxsw_sp_acl_rule_get_stats()
1035 rulei->policer_index, in mlxsw_sp_acl_rule_get_stats()