Lines Matching refs:trap
30 struct devlink_trap trap; member
635 .trap = MLXSW_SP_TRAP_DROP(SMAC_MC, L2_DROPS),
641 .trap = MLXSW_SP_TRAP_DROP(VLAN_TAG_MISMATCH, L2_DROPS),
648 .trap = MLXSW_SP_TRAP_DROP(INGRESS_VLAN_FILTER, L2_DROPS),
654 .trap = MLXSW_SP_TRAP_DROP(INGRESS_STP_FILTER, L2_DROPS),
660 .trap = MLXSW_SP_TRAP_DROP(EMPTY_TX_LIST, L2_DROPS),
667 .trap = MLXSW_SP_TRAP_DROP(PORT_LOOPBACK_FILTER, L2_DROPS),
673 .trap = MLXSW_SP_TRAP_DROP(BLACKHOLE_ROUTE, L3_DROPS),
679 .trap = MLXSW_SP_TRAP_DROP(NON_IP_PACKET, L3_DROPS),
686 .trap = MLXSW_SP_TRAP_DROP(UC_DIP_MC_DMAC, L3_DROPS),
693 .trap = MLXSW_SP_TRAP_DROP(DIP_LB, L3_DROPS),
699 .trap = MLXSW_SP_TRAP_DROP(SIP_MC, L3_DROPS),
705 .trap = MLXSW_SP_TRAP_DROP(SIP_LB, L3_DROPS),
711 .trap = MLXSW_SP_TRAP_DROP(CORRUPTED_IP_HDR, L3_DROPS),
718 .trap = MLXSW_SP_TRAP_DROP(IPV4_SIP_BC, L3_DROPS),
725 .trap = MLXSW_SP_TRAP_DROP(IPV6_MC_DIP_RESERVED_SCOPE,
733 .trap = MLXSW_SP_TRAP_DROP(IPV6_MC_DIP_INTERFACE_LOCAL_SCOPE,
741 .trap = MLXSW_SP_TRAP_EXCEPTION(MTU_ERROR, L3_EXCEPTIONS),
748 .trap = MLXSW_SP_TRAP_EXCEPTION(TTL_ERROR, L3_EXCEPTIONS),
755 .trap = MLXSW_SP_TRAP_EXCEPTION(RPF, L3_EXCEPTIONS),
761 .trap = MLXSW_SP_TRAP_EXCEPTION(REJECT_ROUTE, L3_EXCEPTIONS),
768 .trap = MLXSW_SP_TRAP_EXCEPTION(UNRESOLVED_NEIGH,
780 .trap = MLXSW_SP_TRAP_EXCEPTION(IPV4_LPM_UNICAST_MISS,
789 .trap = MLXSW_SP_TRAP_EXCEPTION(IPV6_LPM_UNICAST_MISS,
798 .trap = MLXSW_SP_TRAP_DRIVER_DROP(IRIF_DISABLED, L3_DROPS),
804 .trap = MLXSW_SP_TRAP_DRIVER_DROP(ERIF_DISABLED, L3_DROPS),
810 .trap = MLXSW_SP_TRAP_DROP(NON_ROUTABLE, L3_DROPS),
816 .trap = MLXSW_SP_TRAP_EXCEPTION(DECAP_ERROR, TUNNEL_DROPS),
828 .trap = MLXSW_SP_TRAP_DROP(OVERLAY_SMAC_MC, TUNNEL_DROPS),
834 .trap = MLXSW_SP_TRAP_DROP_EXT(INGRESS_FLOW_ACTION_DROP,
843 .trap = MLXSW_SP_TRAP_DROP_EXT(EGRESS_FLOW_ACTION_DROP,
852 .trap = MLXSW_SP_TRAP_CONTROL(STP, STP, TRAP),
858 .trap = MLXSW_SP_TRAP_CONTROL(LACP, LACP, TRAP),
864 .trap = MLXSW_SP_TRAP_CONTROL(LLDP, LLDP, TRAP),
871 .trap = MLXSW_SP_TRAP_CONTROL(IGMP_QUERY, MC_SNOOPING, MIRROR),
878 .trap = MLXSW_SP_TRAP_CONTROL(IGMP_V1_REPORT, MC_SNOOPING,
886 .trap = MLXSW_SP_TRAP_CONTROL(IGMP_V2_REPORT, MC_SNOOPING,
894 .trap = MLXSW_SP_TRAP_CONTROL(IGMP_V3_REPORT, MC_SNOOPING,
902 .trap = MLXSW_SP_TRAP_CONTROL(IGMP_V2_LEAVE, MC_SNOOPING,
910 .trap = MLXSW_SP_TRAP_CONTROL(MLD_QUERY, MC_SNOOPING, MIRROR),
917 .trap = MLXSW_SP_TRAP_CONTROL(MLD_V1_REPORT, MC_SNOOPING,
925 .trap = MLXSW_SP_TRAP_CONTROL(MLD_V2_REPORT, MC_SNOOPING,
933 .trap = MLXSW_SP_TRAP_CONTROL(MLD_V1_DONE, MC_SNOOPING,
941 .trap = MLXSW_SP_TRAP_CONTROL(IPV4_DHCP, DHCP, TRAP),
947 .trap = MLXSW_SP_TRAP_CONTROL(IPV6_DHCP, DHCP, TRAP),
953 .trap = MLXSW_SP_TRAP_CONTROL(ARP_REQUEST, NEIGH_DISCOVERY,
961 .trap = MLXSW_SP_TRAP_CONTROL(ARP_RESPONSE, NEIGH_DISCOVERY,
969 .trap = MLXSW_SP_TRAP_CONTROL(ARP_OVERLAY, NEIGH_DISCOVERY,
977 .trap = MLXSW_SP_TRAP_CONTROL(IPV6_NEIGH_SOLICIT,
985 .trap = MLXSW_SP_TRAP_CONTROL(IPV6_NEIGH_ADVERT,
993 .trap = MLXSW_SP_TRAP_CONTROL(IPV4_BFD, BFD, TRAP),
999 .trap = MLXSW_SP_TRAP_CONTROL(IPV6_BFD, BFD, TRAP),
1005 .trap = MLXSW_SP_TRAP_CONTROL(IPV4_OSPF, OSPF, TRAP),
1011 .trap = MLXSW_SP_TRAP_CONTROL(IPV6_OSPF, OSPF, TRAP),
1017 .trap = MLXSW_SP_TRAP_CONTROL(IPV4_BGP, BGP, TRAP),
1023 .trap = MLXSW_SP_TRAP_CONTROL(IPV6_BGP, BGP, TRAP),
1029 .trap = MLXSW_SP_TRAP_CONTROL(IPV4_VRRP, VRRP, TRAP),
1035 .trap = MLXSW_SP_TRAP_CONTROL(IPV6_VRRP, VRRP, TRAP),
1041 .trap = MLXSW_SP_TRAP_CONTROL(IPV4_PIM, PIM, TRAP),
1047 .trap = MLXSW_SP_TRAP_CONTROL(IPV6_PIM, PIM, TRAP),
1053 .trap = MLXSW_SP_TRAP_CONTROL(UC_LB, UC_LB, MIRROR),
1060 .trap = MLXSW_SP_TRAP_CONTROL(LOCAL_ROUTE, LOCAL_DELIVERY,
1067 .trap = MLXSW_SP_TRAP_CONTROL(EXTERNAL_ROUTE, EXTERNAL_DELIVERY,
1075 .trap = MLXSW_SP_TRAP_CONTROL(IPV6_UC_DIP_LINK_LOCAL_SCOPE,
1083 .trap = MLXSW_SP_TRAP_CONTROL(IPV4_ROUTER_ALERT, LOCAL_DELIVERY,
1095 .trap = MLXSW_SP_TRAP_CONTROL(IPV6_ROUTER_ALERT, LOCAL_DELIVERY,
1103 .trap = MLXSW_SP_TRAP_CONTROL(IPV6_DIP_ALL_NODES, IPV6, TRAP),
1110 .trap = MLXSW_SP_TRAP_CONTROL(IPV6_DIP_ALL_ROUTERS, IPV6, TRAP),
1117 .trap = MLXSW_SP_TRAP_CONTROL(IPV6_ROUTER_SOLICIT, IPV6, TRAP),
1124 .trap = MLXSW_SP_TRAP_CONTROL(IPV6_ROUTER_ADVERT, IPV6, TRAP),
1131 .trap = MLXSW_SP_TRAP_CONTROL(IPV6_REDIRECT, IPV6, TRAP),
1138 .trap = MLXSW_SP_TRAP_CONTROL(PTP_EVENT, PTP_EVENT, TRAP),
1145 .trap = MLXSW_SP_TRAP_CONTROL(PTP_GENERAL, PTP_GENERAL, TRAP),
1151 .trap = MLXSW_SP_TRAP_CONTROL(FLOW_ACTION_TRAP, ACL_TRAP, TRAP),
1158 .trap = MLXSW_SP_TRAP_DROP(BLACKHOLE_NEXTHOP, L3_DROPS),
1168 struct mlxsw_sp_trap *trap = mlxsw_sp->trap; in mlxsw_sp_trap_policer_item_lookup() local
1171 for (i = 0; i < trap->policers_count; i++) { in mlxsw_sp_trap_policer_item_lookup()
1172 if (trap->policer_items_arr[i].policer.id == id) in mlxsw_sp_trap_policer_item_lookup()
1173 return &trap->policer_items_arr[i]; in mlxsw_sp_trap_policer_item_lookup()
1182 struct mlxsw_sp_trap *trap = mlxsw_sp->trap; in mlxsw_sp_trap_group_item_lookup() local
1185 for (i = 0; i < trap->groups_count; i++) { in mlxsw_sp_trap_group_item_lookup()
1186 if (trap->group_items_arr[i].group.id == id) in mlxsw_sp_trap_group_item_lookup()
1187 return &trap->group_items_arr[i]; in mlxsw_sp_trap_group_item_lookup()
1196 struct mlxsw_sp_trap *trap = mlxsw_sp->trap; in mlxsw_sp_trap_item_lookup() local
1199 for (i = 0; i < trap->traps_count; i++) { in mlxsw_sp_trap_item_lookup()
1200 if (trap->trap_items_arr[i].trap.id == id) in mlxsw_sp_trap_item_lookup()
1201 return &trap->trap_items_arr[i]; in mlxsw_sp_trap_item_lookup()
1209 struct mlxsw_sp_trap *trap = mlxsw_sp->trap; in mlxsw_sp_trap_cpu_policers_set() local
1216 hw_id = find_first_zero_bit(trap->policers_usage, trap->max_policers); in mlxsw_sp_trap_cpu_policers_set()
1217 if (WARN_ON(hw_id == trap->max_policers)) in mlxsw_sp_trap_cpu_policers_set()
1220 __set_bit(hw_id, trap->policers_usage); in mlxsw_sp_trap_cpu_policers_set()
1221 trap->thin_policer_hw_id = hw_id; in mlxsw_sp_trap_cpu_policers_set()
1232 mlxsw_sp->trap->thin_policer_hw_id, 0, 1); in mlxsw_sp_trap_dummy_group_init()
1240 struct mlxsw_sp_trap *trap = mlxsw_sp->trap; in mlxsw_sp_trap_policer_items_arr_init() local
1245 for_each_clear_bit(i, trap->policers_usage, trap->max_policers) in mlxsw_sp_trap_policer_items_arr_init()
1253 trap->policer_items_arr = kcalloc(free_policers, elem_size, GFP_KERNEL); in mlxsw_sp_trap_policer_items_arr_init()
1254 if (!trap->policer_items_arr) in mlxsw_sp_trap_policer_items_arr_init()
1257 trap->policers_count = free_policers; in mlxsw_sp_trap_policer_items_arr_init()
1260 memcpy(trap->policer_items_arr, mlxsw_sp_trap_policer_items_arr, in mlxsw_sp_trap_policer_items_arr_init()
1267 for (i = arr_size; i < trap->policers_count; i++) { in mlxsw_sp_trap_policer_items_arr_init()
1274 trap->policer_items_arr[i] = *policer_item; in mlxsw_sp_trap_policer_items_arr_init()
1275 trap->policer_items_arr[i].policer.id = ++last_id; in mlxsw_sp_trap_policer_items_arr_init()
1276 trap->policer_items_arr[i].policer.init_rate = 1; in mlxsw_sp_trap_policer_items_arr_init()
1277 trap->policer_items_arr[i].policer.init_burst = 16; in mlxsw_sp_trap_policer_items_arr_init()
1285 kfree(mlxsw_sp->trap->policer_items_arr); in mlxsw_sp_trap_policer_items_arr_fini()
1292 struct mlxsw_sp_trap *trap = mlxsw_sp->trap; in mlxsw_sp_trap_policers_init() local
1299 for (i = 0; i < trap->policers_count; i++) { in mlxsw_sp_trap_policers_init()
1300 policer_item = &trap->policer_items_arr[i]; in mlxsw_sp_trap_policers_init()
1311 policer_item = &trap->policer_items_arr[i]; in mlxsw_sp_trap_policers_init()
1323 struct mlxsw_sp_trap *trap = mlxsw_sp->trap; in mlxsw_sp_trap_policers_fini() local
1326 for (i = trap->policers_count - 1; i >= 0; i--) { in mlxsw_sp_trap_policers_fini()
1327 policer_item = &trap->policer_items_arr[i]; in mlxsw_sp_trap_policers_fini()
1339 struct mlxsw_sp_trap *trap = mlxsw_sp->trap; in mlxsw_sp_trap_group_items_arr_init() local
1352 trap->group_items_arr = kcalloc(groups_count, elem_size, GFP_KERNEL); in mlxsw_sp_trap_group_items_arr_init()
1353 if (!trap->group_items_arr) in mlxsw_sp_trap_group_items_arr_init()
1356 memcpy(trap->group_items_arr, mlxsw_sp_trap_group_items_arr, in mlxsw_sp_trap_group_items_arr_init()
1358 memcpy(trap->group_items_arr + common_groups_count, in mlxsw_sp_trap_group_items_arr_init()
1361 trap->groups_count = groups_count; in mlxsw_sp_trap_group_items_arr_init()
1368 kfree(mlxsw_sp->trap->group_items_arr); in mlxsw_sp_trap_group_items_arr_fini()
1375 struct mlxsw_sp_trap *trap = mlxsw_sp->trap; in mlxsw_sp_trap_groups_init() local
1382 for (i = 0; i < trap->groups_count; i++) { in mlxsw_sp_trap_groups_init()
1383 group_item = &trap->group_items_arr[i]; in mlxsw_sp_trap_groups_init()
1394 group_item = &trap->group_items_arr[i]; in mlxsw_sp_trap_groups_init()
1404 struct mlxsw_sp_trap *trap = mlxsw_sp->trap; in mlxsw_sp_trap_groups_fini() local
1407 for (i = trap->groups_count - 1; i >= 0; i--) { in mlxsw_sp_trap_groups_fini()
1410 group_item = &trap->group_items_arr[i]; in mlxsw_sp_trap_groups_fini()
1427 struct mlxsw_sp_trap *trap = mlxsw_sp->trap; in mlxsw_sp_trap_items_arr_init() local
1440 trap->trap_items_arr = kcalloc(traps_count, elem_size, GFP_KERNEL); in mlxsw_sp_trap_items_arr_init()
1441 if (!trap->trap_items_arr) in mlxsw_sp_trap_items_arr_init()
1444 memcpy(trap->trap_items_arr, mlxsw_sp_trap_items_arr, in mlxsw_sp_trap_items_arr_init()
1446 memcpy(trap->trap_items_arr + common_traps_count, in mlxsw_sp_trap_items_arr_init()
1449 trap->traps_count = traps_count; in mlxsw_sp_trap_items_arr_init()
1456 kfree(mlxsw_sp->trap->trap_items_arr); in mlxsw_sp_trap_items_arr_fini()
1462 struct mlxsw_sp_trap *trap = mlxsw_sp->trap; in mlxsw_sp_traps_init() local
1470 for (i = 0; i < trap->traps_count; i++) { in mlxsw_sp_traps_init()
1471 trap_item = &trap->trap_items_arr[i]; in mlxsw_sp_traps_init()
1472 err = devlink_traps_register(devlink, &trap_item->trap, 1, in mlxsw_sp_traps_init()
1482 trap_item = &trap->trap_items_arr[i]; in mlxsw_sp_traps_init()
1483 devlink_traps_unregister(devlink, &trap_item->trap, 1); in mlxsw_sp_traps_init()
1492 struct mlxsw_sp_trap *trap = mlxsw_sp->trap; in mlxsw_sp_traps_fini() local
1495 for (i = trap->traps_count - 1; i >= 0; i--) { in mlxsw_sp_traps_fini()
1498 trap_item = &trap->trap_items_arr[i]; in mlxsw_sp_traps_fini()
1499 devlink_traps_unregister(devlink, &trap_item->trap, 1); in mlxsw_sp_traps_fini()
1545 const struct devlink_trap *trap, void *trap_ctx) in mlxsw_sp_trap_init() argument
1551 trap_item = mlxsw_sp_trap_item_lookup(mlxsw_sp, trap->id); in mlxsw_sp_trap_init()
1571 const struct devlink_trap *trap, void *trap_ctx) in mlxsw_sp_trap_fini() argument
1577 trap_item = mlxsw_sp_trap_item_lookup(mlxsw_sp, trap->id); in mlxsw_sp_trap_fini()
1592 const struct devlink_trap *trap, in mlxsw_sp_trap_action_set() argument
1600 trap_item = mlxsw_sp_trap_item_lookup(mlxsw_sp, trap->id); in mlxsw_sp_trap_action_set()
1692 struct mlxsw_sp_trap *trap = mlxsw_sp->trap; in mlxsw_sp_trap_policer_item_init() local
1699 hw_id = find_first_zero_bit(trap->policers_usage, trap->max_policers); in mlxsw_sp_trap_policer_item_init()
1700 if (WARN_ON(hw_id == trap->max_policers)) in mlxsw_sp_trap_policer_item_init()
1703 __set_bit(hw_id, trap->policers_usage); in mlxsw_sp_trap_policer_item_init()
1713 __clear_bit(policer_item->hw_id, mlxsw_sp->trap->policers_usage); in mlxsw_sp_trap_policer_item_fini()
1869 .trap = MLXSW_SP_TRAP_CONTROL(FLOW_ACTION_SAMPLE, ACL_SAMPLE,
1923 .trap = MLXSW_SP_TRAP_BUFFER_DROP(EARLY_DROP),
1930 .trap = MLXSW_SP_TRAP_CONTROL(FLOW_ACTION_SAMPLE, ACL_SAMPLE,