hercules.h (14062B)
1 /* 2 * 3 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 4 * 5 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 6 * 7 * File: hercules.h 8 * Purpose: Function declarations for Hercules bcm functions 9 */ 10 11 #ifndef _BCM_INT_HERCULES_H_ 12 #define _BCM_INT_HERCULES_H_ 13 14 #include <bcm_int/esw/mbcm.h> 15 16 /**************************************************************** 17 * 18 * Hercules functions 19 */ 20 21 extern int bcm_hercules_l2_init(int unit); 22 extern int bcm_hercules_l2_term(int unit); 23 extern int bcm_hercules_l2_addr_get(int unit, bcm_mac_t mac_addr, 24 bcm_vlan_t vid, bcm_l2_addr_t *l2addr); 25 extern int bcm_hercules_l2_addr_add(int unit, bcm_l2_addr_t *l2addr); 26 extern int bcm_hercules_l2_addr_delete(int, bcm_mac_t, bcm_vlan_t); 27 extern int bcm_hercules_l2_addr_delete_by_mac(int, bcm_mac_t, uint32); 28 extern int bcm_hercules_l2_addr_delete_by_mac_port(int, bcm_mac_t, 29 bcm_module_t, bcm_port_t, 30 uint32); 31 extern int bcm_hercules_l2_conflict_get(int, bcm_l2_addr_t*, bcm_l2_addr_t*, 32 int, int*); 33 34 extern int bcm_hercules_vlan_init(int, bcm_vlan_data_t *); 35 extern int bcm_hercules_vlan_reload(int, vbmp_t *, int *); 36 extern int bcm_hercules_vlan_create(int, bcm_vlan_t); 37 extern int bcm_hercules_vlan_destroy(int, bcm_vlan_t); 38 extern int bcm_hercules_vlan_destroy_all(int); 39 extern int bcm_hercules_vlan_port_add(int, bcm_vlan_t, bcm_pbmp_t, 40 bcm_pbmp_t, bcm_pbmp_t); 41 extern int bcm_hercules_vlan_port_remove(int, bcm_vlan_t, bcm_pbmp_t, 42 bcm_pbmp_t, bcm_pbmp_t); 43 extern int bcm_hercules_vlan_port_get(int, bcm_vlan_t, bcm_pbmp_t *, 44 bcm_pbmp_t *, bcm_pbmp_t *); 45 extern int bcm_hercules_vlan_list(int, bcm_vlan_data_t **, int *); 46 extern int bcm_hercules_vlan_stg_get(int, bcm_vlan_t, int *); 47 extern int bcm_hercules_vlan_stg_set(int, bcm_vlan_t, int); 48 49 extern int bcm_hercules_port_cfg_init(int, bcm_port_t, bcm_vlan_data_t *); 50 extern int bcm_hercules_port_cfg_get(int, bcm_port_t, bcm_port_cfg_t *); 51 extern int bcm_hercules_port_cfg_set(int, bcm_port_t, bcm_port_cfg_t *); 52 53 extern int bcm_hercules_trunk_modify(int, bcm_trunk_t, 54 bcm_trunk_info_t *, int, bcm_trunk_member_t *, 55 trunk_private_t *, int, bcm_trunk_member_t *); 56 extern int bcm_hercules_trunk_get(int, bcm_trunk_t, 57 bcm_trunk_info_t *, int, bcm_trunk_member_t *, 58 int *, trunk_private_t *); 59 extern int bcm_hercules_trunk_destroy(int, bcm_trunk_t, trunk_private_t *); 60 extern int bcm_hercules_trunk_mcast_join(int, bcm_trunk_t, 61 bcm_vlan_t, bcm_mac_t, 62 trunk_private_t *); 63 64 extern int bcm_hercules_stg_stp_init(int, bcm_stg_t); 65 extern int bcm_hercules_stg_stp_get(int, bcm_stg_t, bcm_port_t, int *); 66 extern int bcm_hercules_stg_stp_set(int, bcm_stg_t, bcm_port_t, int); 67 68 extern int bcm_hercules_cosq_init(int unit); 69 extern int bcm_hercules_cosq_detach(int unit, int software_state_only); 70 extern int bcm_hercules_cosq_config_set(int unit, int numq); 71 extern int bcm_hercules_cosq_config_get(int unit, int *numq); 72 extern int bcm_hercules_cosq_mapping_set(int unit, 73 bcm_port_t port, 74 bcm_cos_t priority, 75 bcm_cos_queue_t cosq); 76 extern int bcm_hercules_cosq_mapping_get(int unit, 77 bcm_port_t port, 78 bcm_cos_t priority, 79 bcm_cos_queue_t *cosq); 80 extern int bcm_hercules_cosq_port_sched_set(int unit, bcm_pbmp_t, int mode, 81 const int weights[], int delay); 82 extern int bcm_hercules_cosq_port_sched_get(int unit, bcm_pbmp_t, int *mode, 83 int weights[], int *delay); 84 extern int bcm_hercules_cosq_sched_weight_max_get(int unit, int mode, 85 int *weight_max); 86 extern int bcm_hercules_cosq_port_bandwidth_set(int unit, bcm_port_t port, 87 bcm_cos_queue_t cosq, 88 uint32 kbits_sec_min, 89 uint32 kbits_sec_max, 90 uint32 kbits_sec_burst, 91 uint32 flags); 92 extern int bcm_hercules_cosq_port_bandwidth_get(int unit, bcm_port_t port, 93 bcm_cos_queue_t cosq, 94 uint32 *kbits_sec_min, 95 uint32 *kbits_sec_max, 96 uint32 *kbits_sec_burst, 97 uint32 *flags); 98 extern int bcm_hercules_cosq_discard_set(int unit, uint32 flags); 99 extern int bcm_hercules_cosq_discard_get(int unit, uint32 *flags); 100 extern int bcm_hercules_cosq_discard_port_set(int unit, bcm_port_t port, 101 bcm_cos_queue_t cosq, 102 uint32 color, 103 int drop_start, 104 int drop_slope, 105 int average_time); 106 extern int bcm_hercules_cosq_discard_port_get(int unit, bcm_port_t port, 107 bcm_cos_queue_t cosq, 108 uint32 color, 109 int *drop_start, 110 int *drop_slope, 111 int *average_time); 112 #ifdef BCM_WARM_BOOT_SUPPORT 113 extern int bcm_hercules_cosq_sync(int unit); 114 #endif /* BCM_WARM_BOOT_SUPPORT */ 115 #ifndef BCM_SW_STATE_DUMP_DISABLE 116 extern void bcm_hercules_cosq_sw_dump(int unit); 117 #endif /* BCM_SW_STATE_DUMP_DISABLE */ 118 119 extern int bcm_hercules_mcast_addr_add(int, bcm_mcast_addr_t *); 120 extern int bcm_hercules_mcast_addr_remove(int, bcm_mac_t, bcm_vlan_t); 121 extern int bcm_hercules_mcast_port_get(int, bcm_mac_t, bcm_vlan_t, 122 bcm_mcast_addr_t *); 123 extern int bcm_hercules_mcast_init(int); 124 extern int _bcm_hercules_mcast_detach(int); 125 extern int bcm_hercules_mcast_addr_init(bcm_mcast_addr_t *, bcm_mac_t, 126 bcm_vlan_t); 127 extern int bcm_hercules_mcast_addr_add_w_l2mcindex(int, bcm_mcast_addr_t *); 128 extern int bcm_hercules_mcast_addr_remove_w_l2mcindex(int, 129 bcm_mcast_addr_t *); 130 extern int bcm_hercules_mcast_port_add(int, bcm_mcast_addr_t *); 131 extern int bcm_hercules_mcast_port_remove(int, bcm_mcast_addr_t *); 132 133 extern int bcm_hercules_meter_init(int unit); 134 extern int bcm_hercules_meter_create(int unit, int port, int *mid); 135 extern int bcm_hercules_meter_delete(int unit, int port, int mid); 136 extern int bcm_hercules_meter_delete_all(int unit); 137 extern int bcm_hercules_meter_get(int unit, int port, int mid, 138 uint32 *kbits_sec, uint32 *kbits_burst); 139 extern int bcm_hercules_meter_set(int unit, int port, int mid, 140 uint32 kbits_sec, uint32 kbits_burst); 141 extern int bcm_hercules_ffppacketcounter_set(int unit, int port, int mid, 142 uint64 val); 143 extern int bcm_hercules_ffppacketcounter_get(int unit, int port, int mid, 144 uint64 *val); 145 extern int bcm_hercules_ffpcounter_init(int unit); 146 extern int bcm_hercules_ffpcounter_create(int unit, int port, 147 int *ffpcounterid); 148 extern int bcm_hercules_ffpcounter_delete(int unit, int port, 149 int ffpcounterid); 150 extern int bcm_hercules_ffpcounter_delete_all(int unit); 151 extern int bcm_hercules_ffpcounter_set(int unit, int port, int ffpcounterid, 152 uint64 val); 153 extern int bcm_hercules_ffpcounter_get(int unit, int port, int ffpcounterid, 154 uint64 *val); 155 extern int bcm_hercules_port_rate_egress_set(int unit, int port, 156 uint32 kbits_sec, 157 uint32 kbits_burst, uint32 mode); 158 extern int bcm_hercules_port_rate_egress_get(int unit, int port, 159 uint32 *kbits_sec, 160 uint32 *kbits_burst, uint32 *mode); 161 162 #ifdef INCLUDE_L3 163 extern int bcm_hercules_l3_tables_init(int); 164 extern int bcm_hercules_l3_tables_cleanup(int); 165 extern int bcm_hercules_l3_enable(int, int); 166 extern int bcm_hercules_l3_intf_get(int, _bcm_l3_intf_cfg_t *); 167 extern int bcm_hercules_l3_intf_get_by_vid(int, _bcm_l3_intf_cfg_t *); 168 extern int bcm_hercules_l3_intf_create(int, _bcm_l3_intf_cfg_t *); 169 extern int bcm_hercules_l3_intf_id_create(int, _bcm_l3_intf_cfg_t *); 170 extern int bcm_hercules_l3_intf_lookup(int, _bcm_l3_intf_cfg_t *); 171 extern int bcm_hercules_l3_intf_del(int, _bcm_l3_intf_cfg_t *); 172 extern int bcm_hercules_l3_intf_del_all(int); 173 extern int bcm_hercules_l3_tables_entries(int); 174 175 extern int bcm_hercules_l3_get(int, _bcm_l3_cfg_t *); 176 extern int bcm_hercules_l3_add(int, _bcm_l3_cfg_t *); 177 extern int bcm_hercules_l3_del(int, _bcm_l3_cfg_t *); 178 extern int bcm_hercules_l3_del_prefix(int, _bcm_l3_cfg_t *); 179 extern int bcm_hercules_l3_del_intf(int, _bcm_l3_cfg_t *, int); 180 extern int bcm_hercules_l3_del_all(int); 181 extern int bcm_hercules_l3_replace(int, _bcm_l3_cfg_t *); 182 extern int bcm_hercules_l3_age(int unit, uint32 flags, bcm_l3_host_traverse_cb 183 age_out, void *); 184 extern int bcm_hercules_l3_traverse(int unit, uint32 flags, 185 uint32 start, uint32 end, 186 bcm_l3_host_traverse_cb cb, 187 void *user_data); 188 189 extern int bcm_hercules_l3_ip6_get(int, _bcm_l3_cfg_t *); 190 extern int bcm_hercules_l3_ip6_add(int, _bcm_l3_cfg_t *); 191 extern int bcm_hercules_l3_ip6_del(int, _bcm_l3_cfg_t *); 192 extern int bcm_hercules_l3_ip6_del_prefix(int, _bcm_l3_cfg_t *); 193 extern int bcm_hercules_l3_ip6_replace(int, _bcm_l3_cfg_t *); 194 extern int bcm_hercules_l3_ip6_traverse(int unit, uint32 flags, 195 uint32 start, uint32 end, 196 bcm_l3_host_traverse_cb cb, 197 void *user_data); 198 199 extern int bcm_hercules_defip_cfg_get(int, _bcm_defip_cfg_t *); 200 extern int bcm_hercules_defip_ecmp_get_all(int, _bcm_defip_cfg_t *, 201 bcm_l3_route_t *, int, int *); 202 extern int bcm_hercules_defip_add(int, _bcm_defip_cfg_t *); 203 extern int bcm_hercules_defip_del(int, _bcm_defip_cfg_t *); 204 extern int bcm_hercules_defip_del_intf(int, _bcm_defip_cfg_t *, int); 205 extern int bcm_hercules_defip_del_all(int); 206 extern int bcm_hercules_defip_age(int unit, bcm_l3_route_traverse_cb age_out, 207 void *); 208 extern int bcm_hercules_defip_traverse(int unit, uint32 start, uint32 end, 209 bcm_l3_route_traverse_cb trav_fn, void *user_data); 210 211 extern int bcm_hercules_ip6_defip_cfg_get(int, _bcm_defip_cfg_t *); 212 extern int bcm_hercules_ip6_defip_ecmp_get_all(int, _bcm_defip_cfg_t *, 213 bcm_l3_route_t *, int, int *); 214 extern int bcm_hercules_ip6_defip_add(int, _bcm_defip_cfg_t *); 215 extern int bcm_hercules_ip6_defip_del(int, _bcm_defip_cfg_t *); 216 extern int bcm_hercules_ip6_defip_traverse(int unit, uint32 start, uint32 end, 217 bcm_l3_route_traverse_cb trav_fn, void *user_data); 218 219 extern int bcm_hercules_l3_conflict_get(int unit, bcm_l3_key_t *ipkey, 220 bcm_l3_key_t *cf_array, 221 int cf_max, int *cf_count); 222 extern int bcm_hercules_l3_info(int unit, bcm_l3_info_t *l3_info); 223 224 extern int bcm_hercules_ipmc_init(int unit); 225 extern int bcm_hercules_ipmc_detach(int unit); 226 extern int bcm_hercules_ipmc_get(int unit, int index, bcm_ipmc_addr_t *ipmc); 227 extern int bcm_hercules_ipmc_lookup(int unit, int *index, bcm_ipmc_addr_t *ipmc); 228 extern int bcm_hercules_ipmc_add(int unit, bcm_ipmc_addr_t *ipmc); 229 extern int bcm_hercules_ipmc_put(int unit, int index, bcm_ipmc_addr_t *ipmc); 230 extern int bcm_hercules_ipmc_delete(int unit, bcm_ipmc_addr_t *ipmc); 231 extern int bcm_hercules_ipmc_delete_all(int unit); 232 extern int bcm_hercules_ipmc_age(int unit, uint32 flags, bcm_ipmc_traverse_cb age_out, 233 void *user_data); 234 extern int bcm_hercules_ipmc_traverse(int unit, uint32 flags, bcm_ipmc_traverse_cb cb, 235 void *user_data); 236 extern int bcm_hercules_ipmc_enable(int unit, int enable); 237 extern int bcm_hercules_ipmc_src_port_check(int unit, int enable); 238 extern int bcm_hercules_ipmc_src_ip_search(int unit, int enable); 239 extern int bcm_hercules_ipmc_egress_port_set(int unit, bcm_port_t port, 240 const bcm_mac_t mac, int untag, 241 bcm_vlan_t vid, int ttl_threshold); 242 extern int bcm_hercules_ipmc_egress_port_get(int unit, bcm_port_t port, 243 sal_mac_addr_t mac, int *untag, 244 bcm_vlan_t *vid, 245 int *ttl_threshold); 246 extern int bcm_hercules_ipmc_repl_init(int unit); 247 extern int bcm_hercules_ipmc_repl_detach(int unit); 248 extern int bcm_hercules_ipmc_repl_get(int unit, int index, bcm_port_t port, 249 bcm_vlan_vector_t vlan_vec); 250 extern int bcm_hercules_ipmc_repl_add(int unit, int index, bcm_port_t port, 251 bcm_vlan_t vlan); 252 extern int bcm_hercules_ipmc_repl_delete(int unit, int index, bcm_port_t port, 253 bcm_vlan_t vlan); 254 extern int bcm_hercules_ipmc_repl_delete_all(int unit, int index, 255 bcm_port_t port); 256 extern int bcm_hercules_ipmc_egress_intf_add(int unit, int index, bcm_port_t port, 257 bcm_l3_intf_t *l3_intf); 258 extern int bcm_hercules_ipmc_egress_intf_delete(int unit, int index, bcm_port_t port, 259 bcm_l3_intf_t *l3_intf); 260 extern int bcm_hercules_lpm_defip_sw_tbl_empty(int unit, int *count); 261 extern int bcm_hercules_lpm_defip_hw_tbl_empty(int unit, int *count); 262 extern int bcm_hercules_lpm_check_table(int unit); 263 extern int bcm_hercules_lpm_delete(int unit, _bcm_defip_cfg_t *lpm_cfg); 264 extern int bcm_hercules_lpm_insert(int unit, _bcm_defip_cfg_t *lpm_cfg); 265 extern int bcm_hercules_lpm_lookup(int unit, ip_addr_t iproute, 266 _bcm_defip_cfg_t* lpm_cfg); 267 #endif /* INCLUDE_L3 */ 268 269 extern int bcm_hercules_switch_control_port_get(int unit, bcm_port_t port, 270 bcm_switch_control_t type, 271 int *arg); 272 extern int bcm_hercules_switch_control_port_set(int unit, bcm_port_t port, 273 bcm_switch_control_t type, int arg); 274 275 #endif /* !_BCM_INT_HERCULES_H_ */