ipmc.h (17472B)
1 /* 2 * 3 * 4 * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file. 5 * 6 * Copyright 2007-2020 Broadcom Inc. All rights reserved. 7 * 8 * DO NOT EDIT THIS FILE! 9 * This file is auto-generated. 10 * Edits to this file will be lost when it is regenerated. 11 */ 12 13 #ifndef __BCM_IPMC_H__ 14 #define __BCM_IPMC_H__ 15 16 #if defined(INCLUDE_L3) 17 18 #include <bcm/types.h> 19 #include <bcm/l3.h> 20 21 /* IPMC address type. */ 22 typedef struct bcm_ipmc_addr_s { 23 bcm_ip_t s_ip_addr; /* IPv4 Source address. */ 24 bcm_ip_t mc_ip_addr; /* IPv4 Destination address. */ 25 bcm_ip6_t s_ip6_addr; /* IPv6 Source address. */ 26 bcm_ip6_t mc_ip6_addr; /* IPv6 Destination address. */ 27 bcm_vlan_t vid; /* VLAN identifier. */ 28 bcm_vrf_t vrf; /* Virtual Router Instance. */ 29 bcm_cos_t cos; /* COS based on dst IP multicast addr. */ 30 int ts; /* Source port or TGID bit. */ 31 int port_tgid; /* Source port or TGID. */ 32 int v; /* Valid bit. */ 33 int mod_id; /* Module ID. */ 34 bcm_multicast_t group; /* Use this index to program IPMC table 35 for XGS chips based on flags value */ 36 uint32 flags; /* See BCM_IPMC_XXX flag definitions. */ 37 int lookup_class; /* Classification lookup class ID. */ 38 bcm_fabric_distribution_t distribution_class; /* Fabric Distribution Class. */ 39 bcm_if_t l3a_intf; /* L3 interface associated with route. */ 40 int rp_id; /* Rendezvous point ID. */ 41 bcm_ip_t s_ip_mask; /* IPv4 Source subnet mask. */ 42 bcm_if_t ing_intf; /* L3 interface associated with this 43 Entry */ 44 bcm_ip_t mc_ip_mask; /* IPv4 Destination subnet mask. */ 45 bcm_ip6_t mc_ip6_mask; /* IPv6 Destination subnet mask. */ 46 bcm_multicast_t group_l2; /* Use this index to program IPMC table 47 for l2 recipients if TTL/RPF check 48 fails. */ 49 uint32 stat_id; /* Object statistics ID. */ 50 int stat_pp_profile; /* Statistics profile. */ 51 bcm_ip6_t s_ip6_mask; /* IPv6 Source subnet mask. */ 52 int priority; /* Entry priority. */ 53 uint32 flow_handle; /* FLOW handle for flex entries. */ 54 uint32 flow_option_handle; /* FLOW option handle for flex entries. */ 55 bcm_flow_logical_field_t logical_fields[BCM_FLOW_MAX_NOF_LOGICAL_FIELDS]; /* logical fields array for flex 56 entries. */ 57 uint32 num_logical_fields; /* number of logical fields. */ 58 } bcm_ipmc_addr_t; 59 60 /* IPMC address flags. */ 61 #define BCM_IPMC_KEEP_ENTRY 0x00000001 /* Internal use. */ 62 #define BCM_IPMC_HIT 0x00000002 /* On get, indicates if 63 L3 hit is on for 64 entry. */ 65 #define BCM_IPMC_SOURCE_PORT_NOCHECK 0x80000000 /* Do not source port 66 check this entry (XGS 67 only). */ 68 #define BCM_IPMC_DISABLED 0x00000008 /* Add entry in disabled 69 state. */ 70 #define BCM_IPMC_REPLACE 0x00000010 /* Replace an existing 71 entry. */ 72 #define BCM_IPMC_IP6 0x00000020 /* IPv6 support. */ 73 #define BCM_IPMC_HIT_CLEAR 0x00000040 /* Clear hit bit. */ 74 #define BCM_IPMC_SETPRI 0x00000080 /* Pick up new priority 75 (XGS3 only). */ 76 #define BCM_IPMC_PROXY_IP6 0x00000100 /* IPv6 Proxy MC egress 77 ports on XGS2. */ 78 #define BCM_IPMC_ADD_DISABLED BCM_IPMC_DISABLED 79 #define BCM_IPMC_USE_FABRIC_DISTRIBUTION 0x00000400 /* Use specified fabric 80 distribution class. */ 81 #define BCM_IPMC_COPYTOCPU 0x00000800 /* When set, Copy the 82 packet to CPU. */ 83 #define BCM_IPMC_POST_LOOKUP_RPF_CHECK 0x00001000 /* When set, perform RPF 84 check. */ 85 #define BCM_IPMC_RPF_FAIL_DROP 0x00002000 /* Drop packet on RPF 86 failure. */ 87 #define BCM_IPMC_RPF_FAIL_TOCPU 0x00004000 /* Copy packets to CPU on 88 RPF failure. */ 89 #define BCM_IPMC_L2 0x00008000 /* XGS: Define IPMC L2 90 domain lookup 91 (VLAN/VFI) in L3 IPMC 92 table. DNX: Add a 93 bridged MC entry */ 94 #define BCM_IPMC_RAW_ENTRY 0x00010000 /* Insert raw data 95 payload */ 96 #define BCM_IPMC_DECAP_ROE_HEADER 0x00020000 /* Indicates the 97 decapsulation of 98 ROE/ROE Custom Header. */ 99 #define BCM_IPMC_TCAM 0x00040000 /* Indicates MC TCAM 100 entry. */ 101 #define BCM_IPMC_RP_ID_EXPECTED_INTF_RESOLVE 0x00080000 /* Indicates 102 configuration 103 resolution between 104 rendezvous point ID 105 (l3a_rp) and L3 106 interface 107 (l3a_expected_intf) is 108 not successful during 109 route 110 get/find/traverse 111 API's. bcm_l3_route_t 112 has l3a_rp and 113 l3a_expected_intf 114 members set without 115 BCM_IPMC_POST_LOOKUP_RPF_CHECK 116 in l3a_ipmc_flags. End 117 user application 118 should resolve based 119 on application 120 configuration. Flag is 121 set as a result of 122 route get, find and 123 traverse operations 124 and is not applicable 125 for any other 126 operations. */ 127 128 /* Invalid value for rendezvous point ID parameter. */ 129 #define BCM_IPMC_RP_ID_INVALID -1 /* Invalid rendezvous point ID */ 130 131 /* IPMC counters structure. */ 132 typedef struct bcm_ipmc_counters_s { 133 uint64 rmca; /* Received L2 multicast frame. */ 134 uint64 tmca; /* Transmit L2 multicast packet counter. */ 135 uint64 imbp; /* Number of IPMC packets bridged. */ 136 uint64 imrp; /* Number of IPMC packets routed. */ 137 uint64 rimdr; /* Number of IPMC dropped in ingress. */ 138 uint64 timdr; /* Number of IPMC dropped in egress. */ 139 } bcm_ipmc_counters_t; 140 141 /* bcm_ipmc_traverse_cb */ 142 typedef int (*bcm_ipmc_traverse_cb)( 143 int unit, 144 bcm_ipmc_addr_t *info, 145 void *user_data); 146 147 #ifndef BCM_HIDE_DISPATCHABLE 148 149 /* Initialize the BCM IPMC subsystem. */ 150 extern int bcm_ipmc_init( 151 int unit); 152 153 /* Detach the BCM IPMC subsystem. */ 154 extern int bcm_ipmc_detach( 155 int unit); 156 157 /* Enable/disable IPMC support. */ 158 extern int bcm_ipmc_enable( 159 int unit, 160 int enable); 161 162 #endif /* BCM_HIDE_DISPATCHABLE */ 163 164 /* Initialize a bcm_ipmc_addr_t/bcmx_ipmc_addr_t. */ 165 extern void bcm_ipmc_addr_t_init( 166 bcm_ipmc_addr_t *data); 167 168 #ifndef BCM_HIDE_DISPATCHABLE 169 170 /* Add new IPMC group. */ 171 extern int bcm_ipmc_add( 172 int unit, 173 bcm_ipmc_addr_t *data); 174 175 /* Find info of an IPMC group. */ 176 extern int bcm_ipmc_find( 177 int unit, 178 bcm_ipmc_addr_t *data); 179 180 /* Remove IPMC group. */ 181 extern int bcm_ipmc_remove( 182 int unit, 183 bcm_ipmc_addr_t *data); 184 185 /* Remove all IPMC groups. */ 186 extern int bcm_ipmc_remove_all( 187 int unit); 188 189 /* Reinitialize/clear the egress IP multicast configuration. */ 190 extern int bcm_ipmc_egress_port_init( 191 int unit); 192 193 /* Configure the IP Multicast egress properties. */ 194 extern int bcm_ipmc_egress_port_set( 195 int unit, 196 bcm_port_t port, 197 const bcm_mac_t mac, 198 int untag, 199 bcm_vlan_t vid, 200 int ttl_threshold); 201 202 /* Get the egress IP multicast configuration properties. */ 203 extern int bcm_ipmc_egress_port_get( 204 int unit, 205 bcm_port_t port, 206 bcm_mac_t mac, 207 int *untag, 208 bcm_vlan_t *vid, 209 int *ttl_threshold); 210 211 /* Get the combined IP multicast statistics. */ 212 extern int bcm_ipmc_counters_get( 213 int unit, 214 bcm_port_t port, 215 bcm_ipmc_counters_t *counters); 216 217 /* 218 * Provides maximum IPMC index that this fabric can handle 219 * (BCM5670/BCM5675). 220 */ 221 extern int bcm_ipmc_bitmap_max_get( 222 int unit, 223 int *max_index); 224 225 /* Set the IPMC forwarding port bitmap (BCM5670/BCM5675). */ 226 extern int bcm_ipmc_bitmap_set( 227 int unit, 228 int ipmc_idx, 229 bcm_port_t port, 230 bcm_pbmp_t pbmp); 231 232 /* Get the IPMC forwarding port bitmap (BCM5670/BCM5675). */ 233 extern int bcm_ipmc_bitmap_get( 234 int unit, 235 int ipmc_idx, 236 bcm_port_t port, 237 bcm_pbmp_t *pbmp); 238 239 /* Remove IPMC forwarding port bitmap (BCM5670/BCM5675). */ 240 extern int bcm_ipmc_bitmap_del( 241 int unit, 242 int ipmc_idx, 243 bcm_port_t port, 244 bcm_pbmp_t pbmp); 245 246 #endif /* BCM_HIDE_DISPATCHABLE */ 247 248 /* Initialize an IPMC counters structure (XGS3). */ 249 extern void bcm_ipmc_counters_t_init( 250 bcm_ipmc_counters_t *ipmc_counter); 251 252 #ifndef BCM_HIDE_DISPATCHABLE 253 254 /* Age unused ipmc table entries. */ 255 extern int bcm_ipmc_age( 256 int unit, 257 uint32 flags, 258 bcm_ipmc_traverse_cb age_cb, 259 void *user_data); 260 261 /* 262 * Traverse through the ipmc table and run callback at each valid ipmc 263 * entry. 264 */ 265 extern int bcm_ipmc_traverse( 266 int unit, 267 uint32 flags, 268 bcm_ipmc_traverse_cb cb, 269 void *user_data); 270 271 #endif /* BCM_HIDE_DISPATCHABLE */ 272 273 /* Rendezvous point flags. */ 274 #define BCM_IPMC_RP_WITH_ID 0x00000001 /* Rendezvous point ID is provided. */ 275 276 #ifndef BCM_HIDE_DISPATCHABLE 277 278 /* Create a rendezvous point */ 279 extern int bcm_ipmc_rp_create( 280 int unit, 281 uint32 flags, 282 int *rp_id); 283 284 /* Destroy a rendezvous point */ 285 extern int bcm_ipmc_rp_destroy( 286 int unit, 287 int rp_id); 288 289 /* Set active ingress L3 interfaces for a rendezvous point */ 290 extern int bcm_ipmc_rp_set( 291 int unit, 292 int rp_id, 293 int intf_count, 294 bcm_if_t *intf_array); 295 296 /* Get active ingress L3 interfaces for a rendezvous point */ 297 extern int bcm_ipmc_rp_get( 298 int unit, 299 int rp_id, 300 int intf_max, 301 bcm_if_t *intf_array, 302 int *intf_count); 303 304 /* Add an active ingress L3 interface for a rendezvous point */ 305 extern int bcm_ipmc_rp_add( 306 int unit, 307 int rp_id, 308 bcm_if_t intf_id); 309 310 /* Delete an active ingress L3 interface for a rendezvous point */ 311 extern int bcm_ipmc_rp_delete( 312 int unit, 313 int rp_id, 314 bcm_if_t intf_id); 315 316 /* Delete all active ingress L3 interfaces for a rendezvous point */ 317 extern int bcm_ipmc_rp_delete_all( 318 int unit, 319 int rp_id); 320 321 #endif /* BCM_HIDE_DISPATCHABLE */ 322 323 /* IPMC address range info. */ 324 typedef struct bcm_ipmc_range_s { 325 uint32 flags; /* BCM_IPMC_RANGE_xxx flags. */ 326 int priority; /* Priority. */ 327 bcm_ip_t mc_ip_addr; /* IPv4 group address. */ 328 bcm_ip_t mc_ip_addr_mask; /* IPv4 group address mask. */ 329 bcm_ip6_t mc_ip6_addr; /* IPv6 group address. */ 330 bcm_ip6_t mc_ip6_addr_mask; /* IPv6 group address mask. */ 331 bcm_vrf_t vrf; /* Virtual router instance. */ 332 bcm_vrf_t vrf_mask; /* Virtual router instance mask. */ 333 int rp_id; /* Rendezvous Point ID */ 334 } bcm_ipmc_range_t; 335 336 /* Flags for bcm_ipmc_range APIs. */ 337 #define BCM_IPMC_RANGE_WITH_ID (1 << 0) /* Use the specified range ID. */ 338 #define BCM_IPMC_RANGE_REPLACE (1 << 1) /* Replace an existing range. */ 339 #define BCM_IPMC_RANGE_IP6 (1 << 2) /* IPv6 group address range is 340 valid. */ 341 #define BCM_IPMC_RANGE_PIM_BIDIR (1 << 3) /* Packets matching this range 342 are subject to PIM-BIDIR 343 processing. */ 344 345 /* Encap Id used to add or delete a trunk member */ 346 #define BCM_ENCAP_TRUNK_MEMBER 0xfffffffe /* Encap Identifier */ 347 348 /* Initialize bcm_ipmc_range_t structure. */ 349 extern void bcm_ipmc_range_t_init( 350 bcm_ipmc_range_t *range); 351 352 #ifndef BCM_HIDE_DISPATCHABLE 353 354 /* Add an IPMC group address range. */ 355 extern int bcm_ipmc_range_add( 356 int unit, 357 int *range_id, 358 bcm_ipmc_range_t *range); 359 360 /* Delete an IPMC group address range. */ 361 extern int bcm_ipmc_range_delete( 362 int unit, 363 int range_id); 364 365 /* Clear all IPMC group address ranges. */ 366 extern int bcm_ipmc_range_delete_all( 367 int unit); 368 369 /* Get IPMC group address range info. */ 370 extern int bcm_ipmc_range_get( 371 int unit, 372 int range_id, 373 bcm_ipmc_range_t *range); 374 375 /* Get max number of IPMC group address ranges supported. */ 376 extern int bcm_ipmc_range_size_get( 377 int unit, 378 int *size); 379 380 #endif /* BCM_HIDE_DISPATCHABLE */ 381 382 /* Ipmc statistics maintained per IPMC group. */ 383 typedef enum bcm_ipmc_stat_e { 384 bcmIpmcInPackets = 0, /* Packets that ingress on the IPMC group. */ 385 bcmIpmcInBytes = 1 /* Bytes that ingress on the IPMC group. */ 386 } bcm_ipmc_stat_t; 387 388 #ifndef BCM_HIDE_DISPATCHABLE 389 390 /* Attach counters entries to the given IPMC group. */ 391 extern int bcm_ipmc_stat_attach( 392 int unit, 393 bcm_ipmc_addr_t *info, 394 uint32 stat_counter_id); 395 396 /* Detach counters entries to the given IPMC group. */ 397 extern int bcm_ipmc_stat_detach( 398 int unit, 399 bcm_ipmc_addr_t *info); 400 401 /* Get the specified counter statistic for an IPMC group. */ 402 extern int bcm_ipmc_stat_counter_get( 403 int unit, 404 bcm_ipmc_addr_t *info, 405 bcm_ipmc_stat_t stat, 406 uint32 num_entries, 407 uint32 *counter_indexes, 408 bcm_stat_value_t *counter_values); 409 410 /* Get the specified counter statistic for an IPMC group. */ 411 extern int bcm_ipmc_stat_counter_sync_get( 412 int unit, 413 bcm_ipmc_addr_t *info, 414 bcm_ipmc_stat_t stat, 415 uint32 num_entries, 416 uint32 *counter_indexes, 417 bcm_stat_value_t *counter_values); 418 419 /* Set the specified counter statistic for an IPMC group. */ 420 extern int bcm_ipmc_stat_counter_set( 421 int unit, 422 bcm_ipmc_addr_t *info, 423 bcm_ipmc_stat_t stat, 424 uint32 num_entries, 425 uint32 *counter_indexes, 426 bcm_stat_value_t *counter_values); 427 428 /* Get 64-bit counter value for multiple IPMC group statistic types. */ 429 extern int bcm_ipmc_stat_multi_get( 430 int unit, 431 bcm_ipmc_addr_t *info, 432 int nstat, 433 bcm_ipmc_stat_t *stat_arr, 434 uint64 *value_arr); 435 436 /* 437 * Get lower 32-bit counter value for multiple IPMC group statistic 438 * types. 439 */ 440 extern int bcm_ipmc_stat_multi_get32( 441 int unit, 442 bcm_ipmc_addr_t *info, 443 int nstat, 444 bcm_ipmc_stat_t *stat_arr, 445 uint32 *value_arr); 446 447 /* Set 64-bit counter value for multiple IPMC group statistic types. */ 448 extern int bcm_ipmc_stat_multi_set( 449 int unit, 450 bcm_ipmc_addr_t *info, 451 int nstat, 452 bcm_ipmc_stat_t *stat_arr, 453 uint64 *value_arr); 454 455 /* 456 * Set lower 32-bit counter value for multiple IPMC group statistic 457 * types. 458 */ 459 extern int bcm_ipmc_stat_multi_set32( 460 int unit, 461 bcm_ipmc_addr_t *info, 462 int nstat, 463 bcm_ipmc_stat_t *stat_arr, 464 uint32 *value_arr); 465 466 /* Provide stat counter ids associated with given IPMC group. */ 467 extern int bcm_ipmc_stat_id_get( 468 int unit, 469 bcm_ipmc_addr_t *info, 470 bcm_ipmc_stat_t stat, 471 uint32 *stat_counter_id); 472 473 #endif /* defined(INCLUDE_L3) */ 474 475 #endif /* BCM_HIDE_DISPATCHABLE */ 476 477 #endif /* __BCM_IPMC_H__ */