trill.h (15452B)
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 */ 9 10 #ifndef __BCM_TRILL_H__ 11 #define __BCM_TRILL_H__ 12 13 #if defined(INCLUDE_L3) 14 15 #include <bcm/types.h> 16 #include <bcm/multicast.h> 17 #include <bcm/l3.h> 18 19 #if defined(INCLUDE_L3) 20 /* BCM_TRILL_* flags. */ 21 #define BCM_TRILL_PORT_WITH_ID (1 << 0) /* create trill port with 22 specified ID */ 23 #define BCM_TRILL_PORT_DROP (1 << 1) /* Drop matching packets */ 24 #define BCM_TRILL_PORT_COPYTOCPU (1 << 2) /* Copy matching packets 25 to CPU */ 26 #define BCM_TRILL_PORT_NETWORK (1 << 3) /* Network facing 27 interface */ 28 #define BCM_TRILL_PORT_UNICAST BCM_TRILL_PORT_NETWORK /* Create Unicast Rbridge */ 29 #define BCM_TRILL_PORT_COUNTED (1 << 4) /* Maintain packet/byte 30 counts */ 31 #define BCM_TRILL_PORT_REPLACE (1 << 5) /* Replace existing entry */ 32 #define BCM_TRILL_PORT_MULTICAST (1 << 6) /* Create Root RBridge */ 33 #define BCM_TRILL_PORT_LOCAL (1 << 7) /* Create Local RBridge */ 34 #define BCM_TRILL_MULTICAST_ACCESS_TO_NETWORK (1 << 8) /* Multicast from Access 35 to Network */ 36 #define BCM_TRILL_MULTICAST_ESADI (1 << 9) /* Use ESADI bit as a 37 part of the MC key */ 38 #define BCM_TRILL_MULTICAST_STATIC (1 << 10) /* Trill multicast 39 entries are marked as 40 static, not aged out */ 41 #define BCM_TRILL_PORT_VIRTUAL (1 << 11) /* Virtual/pseudo 42 nicknames for trill 43 multi homing support */ 44 #define BCM_TRILL_PORT_TUNNEL (1 << 12) /* Create unicast Rbridge 45 without transit 46 functionality */ 47 #define BCM_TRILL_PORT_INGRESS (1 << 13) /* Create Ingress Rbridge */ 48 #define BCM_TRILL_PORT_EGRESS (1 << 14) /* Create Egress Rbridge */ 49 #define BCM_TRILL_MULTICAST_TRANSPARENT_SERVICE (1 << 15) /* Trill multicast 50 transparent service */ 51 #define BCM_TRILL_PORT_TERM_ETHERNET (1 << 16) /* Terminate Ethernet 52 header after 53 terminated Trill */ 54 #define BCM_TRILL_PORT_INGRESS_WIDE (1 << 17) /* Create Trill port Wide 55 mode */ 56 #define BCM_TRILL_MULTICAST_REPLACE_DYNAMIC (1 << 18) /* Replace an existing L2 57 entry with TRILL 58 entry, when table is 59 full */ 60 #endif 61 62 #if defined(INCLUDE_L3) 63 /* Trill VPN Flags. */ 64 #define BCM_BCM_TRILL_VPN 0x00000001 /* TRILL Fine Grained VPN */ 65 #define BCM_BCM_TRILL_VPN_WITH_ID 0x00000002 /* Create VPN with 66 specified ID */ 67 #define BCM_BCM_TRILL_VPN_REPLACE 0x00000004 /* Replace attributes of 68 an existing VPN */ 69 #define BCM_BCM_TRILL_VPN_ACCESS 0x00000008 /* For mapping vpn -> 70 high+low vid */ 71 #define BCM_BCM_TRILL_VPN_NETWORK 0x00000010 /* For mapping high+low 72 vid -> vpn */ 73 #define BCM_BCM_TRILL_VPN_INVALID 0x00000020 /* Invalid TRILL VPN */ 74 #define BCM_TRILL_VPN_TRANSPARENT_SERVICE 0x00000040 /* Create VPN with 75 transparent service */ 76 #endif 77 78 #if defined(INCLUDE_L3) 79 /* Trill VPN structure. */ 80 typedef struct bcm_trill_vpn_config_s { 81 uint32 flags; /* Configuration flags */ 82 bcm_vpn_t vpn; /* VPN ID. */ 83 bcm_vlan_t high_vid; /* Outer vlan */ 84 bcm_vlan_t low_vid; /* Inner vlan */ 85 bcm_multicast_t broadcast_group; /* Broadcast group */ 86 bcm_multicast_t unknown_unicast_group; /* Unknown unicast group */ 87 bcm_multicast_t unknown_multicast_group; /* Unknown multicast group */ 88 } bcm_trill_vpn_config_t; 89 #endif 90 91 #if defined(INCLUDE_L3) 92 /* TRILL port type. */ 93 typedef struct bcm_trill_port_s { 94 bcm_gport_t trill_port_id; /* GPORT identifier. */ 95 uint32 flags; /* BCM_TRILL_PORT_xxx. */ 96 int if_class; /* Interface class ID. */ 97 bcm_gport_t port; /* Match port and/or egress port. */ 98 bcm_if_t egress_if; /* TRILL egress object. */ 99 bcm_trill_name_t name; /* Destination RBridge Nickname. */ 100 int mtu; /* TRILL port MTU. */ 101 int hopcount; /* Unicast Hopcount for TRILL. */ 102 int multicast_hopcount; /* Multicast Hopcount for TRILL. */ 103 bcm_if_t encap_id; /* Encap Identifier. */ 104 bcm_trill_name_t virtual_name; /* Virtual RBridge Nickname */ 105 bcm_switch_network_group_t network_group_id; /* Split Horizon network group 106 identifier. */ 107 int inlif_counting_profile; /* In LIF counting profile */ 108 int outlif_counting_profile; /* Out LIF counting profile */ 109 } bcm_trill_port_t; 110 #endif 111 112 #if defined(INCLUDE_L3) 113 /* Initialize the TRILL port structure. */ 114 extern void bcm_trill_port_t_init( 115 bcm_trill_port_t *trill_port); 116 #endif 117 118 /* Initialize the TRILL VPN config structure. */ 119 extern void bcm_trill_vpn_config_t_init( 120 bcm_trill_vpn_config_t *trill_vpn_config); 121 122 #ifndef BCM_HIDE_DISPATCHABLE 123 124 #if defined(INCLUDE_L3) 125 /* Initialize the BCM TRILL subsystem. */ 126 extern int bcm_trill_init( 127 int unit); 128 #endif 129 130 #if defined(INCLUDE_L3) 131 /* Detach the BCM TRILL subsystem. */ 132 extern int bcm_trill_cleanup( 133 int unit); 134 #endif 135 136 #if defined(INCLUDE_L3) 137 /* bcm_trill_port_add adds a TRILL port to TRILL network. */ 138 extern int bcm_trill_port_add( 139 int unit, 140 bcm_trill_port_t *trill_port); 141 #endif 142 143 #if defined(INCLUDE_L3) 144 /* bcm_trill_port_delete deletes a TRILL port from TRILL network. */ 145 extern int bcm_trill_port_delete( 146 int unit, 147 bcm_gport_t trill_port_id); 148 #endif 149 150 #if defined(INCLUDE_L3) 151 /* bcm_trill_port_delete deletes a TRILL port from TRILL network. */ 152 extern int bcm_trill_port_delete_all( 153 int unit); 154 #endif 155 156 #if defined(INCLUDE_L3) 157 /* Get TRILL port information. */ 158 extern int bcm_trill_port_get( 159 int unit, 160 bcm_trill_port_t *trill_port); 161 #endif 162 163 #if defined(INCLUDE_L3) 164 /* Get all TRILL port information. */ 165 extern int bcm_trill_port_get_all( 166 int unit, 167 int port_max, 168 bcm_trill_port_t *port_array, 169 int *port_count); 170 #endif 171 172 #endif /* BCM_HIDE_DISPATCHABLE */ 173 174 #if defined(INCLUDE_L3) 175 /* RBridge TRILL port. */ 176 typedef struct bcm_trill_rbridge_s { 177 uint32 flags; /* BCM_TRILL_RBRIDGE_xxx. */ 178 bcm_trill_name_t name; /* RBridge Nickname. */ 179 bcm_if_t egress_if; /* TRILL egress object. */ 180 int mtu; /* TRILL port MTU. */ 181 int hopcount; /* Hopcount for TRILL. */ 182 } bcm_trill_rbridge_t; 183 #endif 184 185 #ifndef BCM_HIDE_DISPATCHABLE 186 187 #if defined(INCLUDE_L3) 188 /* bcm_trill_rbridge_entry_add Add TRILL Rbridge entry. */ 189 extern int bcm_trill_rbridge_entry_add( 190 int unit, 191 bcm_trill_rbridge_t *trill_entry); 192 #endif 193 194 #if defined(INCLUDE_L3) 195 /* bcm_trill_rbridge_entry_delete Add TRILL Rbridge entry. */ 196 extern int bcm_trill_rbridge_entry_delete( 197 int unit, 198 bcm_trill_rbridge_t *trill_entry); 199 #endif 200 201 #if defined(INCLUDE_L3) 202 /* bcm_trill_rbridge_entry_get Add TRILL Rbridge entry. */ 203 extern int bcm_trill_rbridge_entry_get( 204 int unit, 205 bcm_trill_rbridge_t *trill_entry); 206 #endif 207 208 #endif /* BCM_HIDE_DISPATCHABLE */ 209 210 #if defined(INCLUDE_L3) 211 /* TRILL Multicast Entry. */ 212 typedef struct bcm_trill_multicast_entry_s { 213 uint32 flags; /* BCM_TRILL_MULTICAST_xxx. */ 214 bcm_trill_name_t root_name; /* Trill Root Rbridge. */ 215 bcm_vlan_t c_vlan; /* Customer Vlan */ 216 bcm_mac_t c_dmac; /* Customer Destination MAC Address. */ 217 bcm_multicast_t group; /* TRILL Multicast Group */ 218 bcm_if_t encap_intf; /* RPF interface for Multipath. */ 219 bcm_vlan_t c_vlan_inner; /* low-vlan, when using fine-grained trill, and 220 customer Ethernet header is double-tagged */ 221 } bcm_trill_multicast_entry_t; 222 #endif 223 224 #if defined(INCLUDE_L3) 225 /* Initialize the TRILL multicast entry structure. */ 226 extern void bcm_trill_multicast_entry_t_init( 227 bcm_trill_multicast_entry_t *trill_multicast_entry); 228 #endif 229 230 #ifndef BCM_HIDE_DISPATCHABLE 231 232 #if defined(INCLUDE_L3) 233 /* Add TRILL Multicast entry */ 234 extern int bcm_trill_multicast_entry_add( 235 int unit, 236 bcm_trill_multicast_entry_t *trill_mc_entry); 237 #endif 238 239 #if defined(INCLUDE_L3) 240 /* Delete TRILL Multicast entry */ 241 extern int bcm_trill_multicast_entry_delete( 242 int unit, 243 bcm_trill_multicast_entry_t *trill_mc_entry); 244 #endif 245 246 #if defined(INCLUDE_L3) 247 /* Get TRILL Multicast entry */ 248 extern int bcm_trill_multicast_entry_get( 249 int unit, 250 bcm_trill_multicast_entry_t *trill_mc_entry); 251 #endif 252 253 #endif /* BCM_HIDE_DISPATCHABLE */ 254 255 /* TRILL multicast traverse function prototype. */ 256 #if defined(INCLUDE_L3) 257 typedef int (*bcm_trill_multicast_entry_traverse_cb)( 258 int unit, 259 bcm_trill_multicast_entry_t *trill_mc_entry, 260 void *user_data); 261 #endif 262 263 #ifndef BCM_HIDE_DISPATCHABLE 264 265 #if defined(INCLUDE_L3) 266 /* 267 * Traverse all valid TRILL Multicast entry and call supplied callback 268 * routine. 269 */ 270 extern int bcm_trill_multicast_entry_traverse( 271 int unit, 272 bcm_trill_multicast_entry_traverse_cb cb, 273 void *user_data); 274 #endif 275 276 #if defined(INCLUDE_L3) 277 /* Delete TRILL Multicast entry */ 278 extern int bcm_trill_multicast_delete_all( 279 int unit, 280 bcm_trill_name_t root_name); 281 #endif 282 283 #if defined(INCLUDE_L3) 284 /* Add Multicast RPF entry */ 285 extern int bcm_trill_multicast_source_add( 286 int unit, 287 bcm_trill_name_t root_name, 288 bcm_trill_name_t source_rbridge_name, 289 bcm_gport_t port, 290 bcm_if_t encap_intf); 291 #endif 292 293 #if defined(INCLUDE_L3) 294 /* Delete Multicast RPF entry */ 295 extern int bcm_trill_multicast_source_delete( 296 int unit, 297 bcm_trill_name_t root_name, 298 bcm_trill_name_t source_rbridge_name, 299 bcm_gport_t port, 300 bcm_if_t encap_intf); 301 #endif 302 303 #if defined(INCLUDE_L3) 304 /* Get Multicast RPF entry */ 305 extern int bcm_trill_multicast_source_get( 306 int unit, 307 bcm_trill_name_t root_name, 308 bcm_trill_name_t source_rbridge_name, 309 bcm_gport_t *port); 310 #endif 311 312 #endif /* BCM_HIDE_DISPATCHABLE */ 313 314 /* TRILL multicast RPF traverse function prototype. */ 315 #if defined(INCLUDE_L3) 316 typedef int (*bcm_trill_multicast_source_traverse_cb)( 317 int unit, 318 bcm_trill_name_t root_name, 319 bcm_trill_name_t source_rbridge_name, 320 bcm_gport_t port, 321 void *user_data); 322 #endif 323 324 #ifndef BCM_HIDE_DISPATCHABLE 325 326 #if defined(INCLUDE_L3) 327 /* 328 * Traverse all valid TRILL Multicast RPF entries and call supplied 329 * callback routine. 330 */ 331 extern int bcm_trill_multicast_source_traverse( 332 int unit, 333 bcm_trill_multicast_source_traverse_cb cb, 334 void *user_data); 335 #endif 336 337 #endif /* BCM_HIDE_DISPATCHABLE */ 338 339 #if defined(INCLUDE_L3) 340 /* TRILL multicast adjacency entry. */ 341 typedef struct bcm_trill_multicast_adjacency_s { 342 bcm_gport_t port; /* Match Trill network port. */ 343 uint32 flags; /* BCM_TRILL_MULTICAST_ADJACENCY_xxx. */ 344 bcm_if_t encap_intf; /* Neighbor interface. */ 345 } bcm_trill_multicast_adjacency_t; 346 #endif 347 348 #ifndef BCM_HIDE_DISPATCHABLE 349 350 #if defined(INCLUDE_L3) 351 /* Add Multicast adjacency entry */ 352 extern int bcm_trill_multicast_adjacency_add( 353 int unit, 354 bcm_trill_multicast_adjacency_t *trill_multicast_adjacency); 355 #endif 356 357 #if defined(INCLUDE_L3) 358 /* Delete Multicast adjacency entry */ 359 extern int bcm_trill_multicast_adjacency_delete( 360 int unit, 361 bcm_trill_multicast_adjacency_t *trill_multicast_adjacency); 362 #endif 363 364 #if defined(INCLUDE_L3) 365 /* Delete all Multicast adjacency entry */ 366 extern int bcm_trill_multicast_adjacency_delete_all( 367 int unit); 368 #endif 369 370 #endif /* BCM_HIDE_DISPATCHABLE */ 371 372 /* Trill multicast adjacency callback function prototype. */ 373 #if defined(INCLUDE_L3) 374 typedef int (*bcm_trill_multicast_adjacency_traverse_cb)( 375 int unit, 376 bcm_trill_multicast_adjacency_t *info, 377 void *user_data); 378 #endif 379 380 #ifndef BCM_HIDE_DISPATCHABLE 381 382 #if defined(INCLUDE_L3) 383 /* 384 * Traverse all valid TRILL Multicast adjacency entries and call supplied 385 * callback routine. 386 */ 387 extern int bcm_trill_multicast_adjacency_traverse( 388 int unit, 389 bcm_trill_multicast_adjacency_traverse_cb cb, 390 void *user_data); 391 #endif 392 393 #endif /* BCM_HIDE_DISPATCHABLE */ 394 395 #if defined(INCLUDE_L3) 396 /* TRILL statistics counters. */ 397 typedef enum bcm_trill_stat_e { 398 bcmTrillInPkts = 0, 399 bcmTrillOutPkts = 1, 400 bcmTrillErrorPkts = 2, 401 bcmTrillNameMissPkts = 3, 402 bcmTrillRpfFailPkts = 4, 403 bcmTrillTtlFailPkts = 5 404 } bcm_trill_stat_t; 405 #endif 406 407 #ifndef BCM_HIDE_DISPATCHABLE 408 409 #if defined(INCLUDE_L3) 410 /* Get TRILL Stats. */ 411 extern int bcm_trill_stat_get( 412 int unit, 413 bcm_port_t port, 414 bcm_trill_stat_t stat, 415 uint64 *val); 416 #endif 417 418 #if defined(INCLUDE_L3) 419 /* Get TRILL Stats. */ 420 extern int bcm_trill_stat_get32( 421 int unit, 422 bcm_port_t port, 423 bcm_trill_stat_t stat, 424 uint32 *val); 425 #endif 426 427 #if defined(INCLUDE_L3) 428 /* Clear TRILL Stats. */ 429 extern int bcm_trill_stat_clear( 430 int unit, 431 bcm_port_t port, 432 bcm_trill_stat_t stat); 433 #endif 434 435 #if defined(INCLUDE_L3) 436 /* Create a TRILL VPN. */ 437 extern int bcm_trill_vpn_create( 438 int unit, 439 bcm_trill_vpn_config_t *info); 440 #endif 441 442 #if defined(INCLUDE_L3) 443 /* Destroy a TRILL VPN. */ 444 extern int bcm_trill_vpn_destroy( 445 int unit, 446 bcm_vpn_t vpn); 447 #endif 448 449 #if defined(INCLUDE_L3) 450 /* Destroy a TRILL VPN. */ 451 extern int bcm_trill_vpn_destroy_all( 452 int unit); 453 #endif 454 455 #if defined(INCLUDE_L3) 456 /* Get a TRILL VPN. */ 457 extern int bcm_trill_vpn_get( 458 int unit, 459 bcm_vpn_t vpn, 460 bcm_trill_vpn_config_t *info); 461 #endif 462 463 #endif /* BCM_HIDE_DISPATCHABLE */ 464 465 /* Trill VPN callback function prototype. */ 466 #if defined(INCLUDE_L3) 467 typedef int (*bcm_trill_vpn_traverse_cb)( 468 int unit, 469 bcm_trill_vpn_config_t *info, 470 void *user_data); 471 #endif 472 473 #ifndef BCM_HIDE_DISPATCHABLE 474 475 #if defined(INCLUDE_L3) 476 /* bcm_trill_vpn_traverse */ 477 extern int bcm_trill_vpn_traverse( 478 int unit, 479 bcm_trill_vpn_traverse_cb cb, 480 void *user_data); 481 #endif 482 483 #endif /* defined(INCLUDE_L3) */ 484 485 #endif /* BCM_HIDE_DISPATCHABLE */ 486 487 #endif /* __BCM_TRILL_H__ */