vlan.h (99168B)
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_VLAN_H__ 14 #define __BCM_VLAN_H__ 15 16 #include <bcm/types.h> 17 #include <bcm/multicast.h> 18 #include <bcm/policer.h> 19 #include <bcm/qos.h> 20 #include <bcm/port.h> 21 22 #define BCM_VLAN_VID_DISABLE BCM_VLAN_INVALID 23 24 /* Initialize a VLAN data information structure. */ 25 typedef struct bcm_vlan_data_s { 26 bcm_vlan_t vlan_tag; 27 bcm_pbmp_t port_bitmap; 28 bcm_pbmp_t ut_port_bitmap; 29 } bcm_vlan_data_t; 30 31 /* Backward compatibility: Do not use. */ 32 typedef bcm_vlan_data_t vlan_data_t; 33 34 #ifndef BCM_HIDE_DISPATCHABLE 35 36 /* Initialize the VLAN module. */ 37 extern int bcm_vlan_init( 38 int unit); 39 40 /* Allocate and configure a VLAN on the BCM device. */ 41 extern int bcm_vlan_create( 42 int unit, 43 bcm_vlan_t vid); 44 45 /* Deallocate VLAN from the BCM device. */ 46 extern int bcm_vlan_destroy( 47 int unit, 48 bcm_vlan_t vid); 49 50 /* Destroy all VLANs except the default VLAN. */ 51 extern int bcm_vlan_destroy_all( 52 int unit); 53 54 /* Add ports to the specified vlan. */ 55 extern int bcm_vlan_port_add( 56 int unit, 57 bcm_vlan_t vid, 58 bcm_pbmp_t pbmp, 59 bcm_pbmp_t ubmp); 60 61 /* Remove ports from a specified vlan. */ 62 extern int bcm_vlan_port_remove( 63 int unit, 64 bcm_vlan_t vid, 65 bcm_pbmp_t pbmp); 66 67 /* Retrieves a list of the member ports of an existing VLAN. */ 68 extern int bcm_vlan_port_get( 69 int unit, 70 bcm_vlan_t vid, 71 bcm_pbmp_t *pbmp, 72 bcm_pbmp_t *ubmp); 73 74 #endif /* BCM_HIDE_DISPATCHABLE */ 75 76 /* Flags for bcm_vlan_gport_add. */ 77 #define BCM_VLAN_GPORT_ADD_UNTAGGED 0x00000001 78 #define BCM_VLAN_GPORT_ADD_INGRESS_ONLY 0x00000002 79 #define BCM_VLAN_GPORT_ADD_EGRESS_ONLY 0x00000004 80 #define BCM_VLAN_GPORT_ADD_MEMBER_REPLACE 0x00000008 81 #define BCM_VLAN_GPORT_ADD_STP_DISABLE 0x00000000 82 #define BCM_VLAN_GPORT_ADD_STP_BLOCK 0x00000010 83 #define BCM_VLAN_GPORT_ADD_STP_LEARN 0x00000020 84 #define BCM_VLAN_GPORT_ADD_STP_FORWARD 0x00000030 85 #define BCM_VLAN_GPORT_ADD_STP_MASK 0x00000030 86 #define BCM_VLAN_GPORT_ADD_VP_VLAN_MEMBERSHIP 0x00000080 87 #define BCM_VLAN_GPORT_ADD_UNKNOWN_UCAST_DO_NOT_ADD 0x00000100 88 #define BCM_VLAN_GPORT_ADD_UNKNOWN_MCAST_DO_NOT_ADD 0x00000200 89 #define BCM_VLAN_GPORT_ADD_BCAST_DO_NOT_ADD 0x00000400 90 #define BCM_VLAN_GPORT_ADD_TAG_DO_NOT_UPDATE 0x00000800 91 #define BCM_VLAN_GPORT_ADD_MEMBER_DO_NOT_UPDATE 0x00001000 92 #define BCM_VLAN_GPORT_ADD_SERVICE 0x00002000 93 #define BCM_VLAN_GPORT_ADD_EGRESS_STP_DISABLE BCM_VLAN_GPORT_ADD_STP_DISABLE 94 #define BCM_VLAN_GPORT_ADD_EGRESS_STP_BLOCK 0x00010000 95 #define BCM_VLAN_GPORT_ADD_EGRESS_STP_LEARN 0x00020000 96 #define BCM_VLAN_GPORT_ADD_EGRESS_STP_FORWARD 0x00030000 97 #define BCM_VLAN_GPORT_ADD_EGRESS_STP_MASK 0x00030000 98 #define BCM_VLAN_GPORT_ADD_EGRESS_L3_ONLY 0x00040000 99 #define BCM_VLAN_GPORT_ADD_STAT_INGRESS_ENABLE 0x00080000 100 #define BCM_VLAN_GPORT_ADD_STAT_EGRESS_ENABLE 0x00100000 101 102 /* Obselete flags for bcm_vlan_gport_add. */ 103 #define BCM_VLAN_PORT_UNTAGGED BCM_VLAN_GPORT_ADD_UNTAGGED 104 #define BCM_VLAN_PORT_INGRESS_ONLY BCM_VLAN_GPORT_ADD_INGRESS_ONLY 105 #define BCM_VLAN_PORT_EGRESS_ONLY BCM_VLAN_GPORT_ADD_EGRESS_ONLY 106 #define BCM_VLAN_PORT_MEMBER_REPLACE BCM_VLAN_GPORT_ADD_MEMBER_REPLACE 107 #define BCM_VLAN_PORT_STP_DISABLE BCM_VLAN_GPORT_ADD_STP_DISABLE 108 #define BCM_VLAN_PORT_STP_BLOCK BCM_VLAN_GPORT_ADD_STP_BLOCK 109 #define BCM_VLAN_PORT_STP_LEARN BCM_VLAN_GPORT_ADD_STP_LEARN 110 #define BCM_VLAN_PORT_STP_FORWARD BCM_VLAN_GPORT_ADD_STP_FORWARD 111 #define BCM_VLAN_PORT_STP_MASK BCM_VLAN_GPORT_ADD_STP_MASK 112 #define BCM_VLAN_PORT_VP_VLAN_MEMBERSHIP BCM_VLAN_GPORT_ADD_VP_VLAN_MEMBERSHIP 113 #define BCM_VLAN_PORT_UNKNOWN_UCAST_DO_NOT_ADD BCM_VLAN_GPORT_ADD_UNKNOWN_UCAST_DO_NOT_ADD 114 #define BCM_VLAN_PORT_UNKNOWN_MCAST_DO_NOT_ADD BCM_VLAN_GPORT_ADD_UNKNOWN_MCAST_DO_NOT_ADD 115 #define BCM_VLAN_PORT_BCAST_DO_NOT_ADD BCM_VLAN_GPORT_ADD_BCAST_DO_NOT_ADD 116 117 /* Flags for bcm_vlan_gport_extended_delete. */ 118 #define BCM_VLAN_GPORT_UNKNOWN_UCAST_DO_NOT_UPDATE BCM_VLAN_GPORT_ADD_UNKNOWN_UCAST_DO_NOT_ADD 119 #define BCM_VLAN_GPORT_UNKNOWN_MCAST_DO_NOT_UPDATE BCM_VLAN_GPORT_ADD_UNKNOWN_MCAST_DO_NOT_ADD 120 #define BCM_VLAN_GPORT_BCAST_DO_NOT_UPDATE BCM_VLAN_GPORT_ADD_BCAST_DO_NOT_ADD 121 122 #ifndef BCM_HIDE_DISPATCHABLE 123 124 /* Add a Gport to the specified vlan. */ 125 extern int bcm_vlan_gport_add( 126 int unit, 127 bcm_vlan_t vlan, 128 bcm_gport_t port, 129 int flags); 130 131 /* Remove a Gport from the specified vlan. */ 132 extern int bcm_vlan_gport_delete( 133 int unit, 134 bcm_vlan_t vlan, 135 bcm_gport_t port); 136 137 /* Remove a Gport from the specified vlan with flags. */ 138 extern int bcm_vlan_gport_extended_delete( 139 int unit, 140 bcm_vlan_t vlan, 141 bcm_gport_t port, 142 int flags); 143 144 /* Remove all ports from the specified vlan. */ 145 extern int bcm_vlan_gport_delete_all( 146 int unit, 147 bcm_vlan_t vlan); 148 149 /* Get a Gport from the specified vlan. */ 150 extern int bcm_vlan_gport_get( 151 int unit, 152 bcm_vlan_t vlan, 153 bcm_gport_t port, 154 int *flags); 155 156 /* Get all Gports from the specified vlan. */ 157 extern int bcm_vlan_gport_get_all( 158 int unit, 159 bcm_vlan_t vlan, 160 int array_max, 161 bcm_gport_t *gport_array, 162 int *flags_array, 163 int *array_size); 164 165 /* 166 * Returns an array of defined VLANs and their port bitmaps. If by pbmp, 167 * only VLANs which contain at least one of the specified ports are 168 * listed. 169 */ 170 extern int bcm_vlan_list( 171 int unit, 172 bcm_vlan_data_t **listp, 173 int *countp); 174 175 /* 176 * Returns an array of defined VLANs and their port bitmaps. If by pbmp, 177 * only VLANs which contain at least one of the specified ports are 178 * listed. 179 */ 180 extern int bcm_vlan_list_by_pbmp( 181 int unit, 182 bcm_pbmp_t ports, 183 bcm_vlan_data_t **listp, 184 int *countp); 185 186 /* Destroy a list returned by bcm_vlan_list. */ 187 extern int bcm_vlan_list_destroy( 188 int unit, 189 bcm_vlan_data_t *list, 190 int count); 191 192 /* Get the default VLAN ID. */ 193 extern int bcm_vlan_default_get( 194 int unit, 195 bcm_vlan_t *vid_ptr); 196 197 /* Set the default VLAN ID. */ 198 extern int bcm_vlan_default_set( 199 int unit, 200 bcm_vlan_t vid); 201 202 /* Retrieve the VTABLE STG for the specified vlan. */ 203 extern int bcm_vlan_stg_get( 204 int unit, 205 bcm_vlan_t vid, 206 bcm_stg_t *stg_ptr); 207 208 /* Update the VTABLE STG for the specified vlan. */ 209 extern int bcm_vlan_stg_set( 210 int unit, 211 bcm_vlan_t vid, 212 bcm_stg_t stg); 213 214 /* 215 * Set/get the spanning tree state for a port in the whole spanning tree 216 * group that contains the specified VLAN. 217 */ 218 extern int bcm_vlan_stp_get( 219 int unit, 220 bcm_vlan_t vid, 221 bcm_port_t port, 222 int *stp_state); 223 224 /* 225 * Set/get the spanning tree state for a port in the whole spanning tree 226 * group that contains the specified VLAN. 227 */ 228 extern int bcm_vlan_stp_set( 229 int unit, 230 bcm_vlan_t vid, 231 bcm_port_t port, 232 int stp_state); 233 234 /* Set spanning tree state for a port over a vlan vector. */ 235 extern int bcm_vlan_vector_stp_set( 236 int unit, 237 bcm_vlan_vector_t vlan_vector, 238 bcm_port_t port, 239 int stp_state); 240 241 #endif /* BCM_HIDE_DISPATCHABLE */ 242 243 /* Initialize a VLAN tag action set structure. */ 244 extern void bcm_vlan_action_set_t_init( 245 bcm_vlan_action_set_t *action); 246 247 #ifndef BCM_HIDE_DISPATCHABLE 248 249 /* Get or set the port's default VLAN tag actions. */ 250 extern int bcm_vlan_port_default_action_get( 251 int unit, 252 bcm_port_t port, 253 bcm_vlan_action_set_t *action); 254 255 /* Get or set the port's default VLAN tag actions. */ 256 extern int bcm_vlan_port_default_action_set( 257 int unit, 258 bcm_port_t port, 259 bcm_vlan_action_set_t *action); 260 261 /* Delete the port's default VLAN tag action. */ 262 extern int bcm_vlan_port_default_action_delete( 263 int unit, 264 bcm_port_t port); 265 266 /* Get or set the egress default VLAN tag actions. */ 267 extern int bcm_vlan_port_egress_default_action_get( 268 int unit, 269 bcm_port_t port, 270 bcm_vlan_action_set_t *action); 271 272 /* Get or set the egress default VLAN tag actions. */ 273 extern int bcm_vlan_port_egress_default_action_set( 274 int unit, 275 bcm_port_t port, 276 bcm_vlan_action_set_t *action); 277 278 /* Deletes the egress default VLAN tag actions. */ 279 extern int bcm_vlan_port_egress_default_action_delete( 280 int unit, 281 bcm_port_t port); 282 283 /* 284 * Add protocol based VLAN with specified action. If the entry already 285 * exists, update the action. 286 */ 287 extern int bcm_vlan_port_protocol_action_add( 288 int unit, 289 bcm_port_t port, 290 bcm_port_frametype_t frame, 291 bcm_port_ethertype_t ether, 292 bcm_vlan_action_set_t *action); 293 294 /* Get protocol based VLAN action. */ 295 extern int bcm_vlan_port_protocol_action_get( 296 int unit, 297 bcm_port_t port, 298 bcm_port_frametype_t frame, 299 bcm_port_ethertype_t ether, 300 bcm_vlan_action_set_t *action); 301 302 /* Delete protocol based VLAN action. */ 303 extern int bcm_vlan_port_protocol_action_delete( 304 int unit, 305 bcm_port_t port, 306 bcm_port_frametype_t frame, 307 bcm_port_ethertype_t ether); 308 309 /* Delete all protocol based VLAN actions. */ 310 extern int bcm_vlan_port_protocol_action_delete_all( 311 int unit, 312 bcm_port_t port); 313 314 #endif /* BCM_HIDE_DISPATCHABLE */ 315 316 /* vlan_port_protocol_action_traverse_cb */ 317 typedef int (*bcm_vlan_port_protocol_action_traverse_cb)( 318 int unit, 319 bcm_port_t port, 320 bcm_port_frametype_t frame, 321 bcm_port_ethertype_t ether, 322 bcm_vlan_action_set_t *action, 323 void *user_data); 324 325 #ifndef BCM_HIDE_DISPATCHABLE 326 327 /* 328 * Traverse over vlan ip actions, which are used for VLAN 329 * tag/s assignment to untagged packets. 330 */ 331 extern int bcm_vlan_port_protocol_action_traverse( 332 int unit, 333 bcm_vlan_port_protocol_action_traverse_cb cb, 334 void *user_data); 335 336 /* 337 * Add an association from MAC address to VLAN, used for VLAN tag 338 * assignment to untagged packets. 339 */ 340 extern int bcm_vlan_mac_add( 341 int unit, 342 bcm_mac_t mac, 343 bcm_vlan_t vid, 344 int prio); 345 346 /* Remove an association from MAC address to VLAN. */ 347 extern int bcm_vlan_mac_delete( 348 int unit, 349 bcm_mac_t mac); 350 351 /* Remove all associations from MAC addresses to VLAN. */ 352 extern int bcm_vlan_mac_delete_all( 353 int unit); 354 355 #endif /* BCM_HIDE_DISPATCHABLE */ 356 357 /* vlan_mac_action_traverse_cb */ 358 typedef int (*bcm_vlan_mac_action_traverse_cb)( 359 int unit, 360 bcm_mac_t mac, 361 bcm_vlan_action_set_t *action, 362 void *user_data); 363 364 #ifndef BCM_HIDE_DISPATCHABLE 365 366 /* 367 * Traverse over vlan mac actions, which are used for VLAN 368 * tag/s assignment to untagged packets. 369 */ 370 extern int bcm_vlan_mac_action_traverse( 371 int unit, 372 bcm_vlan_mac_action_traverse_cb cb, 373 void *user_data); 374 375 /* 376 * Add an association from MAC address to VLAN actions, which are 377 * used for VLAN tag/s assignment to untagged packets. 378 */ 379 extern int bcm_vlan_mac_action_add( 380 int unit, 381 bcm_mac_t mac, 382 bcm_vlan_action_set_t *action); 383 384 /* 385 * Retrive an association from MAC address to VLAN actions, which 386 * are used for VLAN tag assignment to untagged packets. 387 */ 388 extern int bcm_vlan_mac_action_get( 389 int unit, 390 bcm_mac_t mac, 391 bcm_vlan_action_set_t *action); 392 393 /* 394 * Remove an association from MAC address to VLAN actions, which 395 * are used for VLAN tag assignment to untagged packets. 396 */ 397 extern int bcm_vlan_mac_action_delete( 398 int unit, 399 bcm_mac_t mac); 400 401 /* 402 * Remove all MAC addresses to VLAN actions associations. 403 * Mac to VLAN actions are used for VLAN tag assignment 404 * to untagged packets. 405 */ 406 extern int bcm_vlan_mac_action_delete_all( 407 int unit); 408 409 #endif /* BCM_HIDE_DISPATCHABLE */ 410 411 /* 412 * VLAN translation selection 413 * 414 * For chips supporting VLAN translation on a HiGig port, use the 415 * following to construct a value to pass to 416 * bcm_vlan_translate_add/delete routines as "port." 417 */ 418 #define BCM_VLAN_TRANSLATE_PORTMOD_MOD_SHIFT 16 419 #define BCM_VLAN_TRANSLATE_PORTMOD_PORT_MASK \ 420 ((1 << BCM_VLAN_TRANSLATE_PORTMOD_MOD_SHIFT) - 1) 421 #define BCM_VLAN_TRANSLATE_PORTMOD(port, mod_id) \ 422 ((port) | (((mod_id) + 1) << BCM_VLAN_TRANSLATE_PORTMOD_MOD_SHIFT)) 423 424 #ifndef BCM_HIDE_DISPATCHABLE 425 426 /* Add an entry to the VLAN Translation table. */ 427 extern int bcm_vlan_translate_add( 428 int unit, 429 int port, 430 bcm_vlan_t old_vid, 431 bcm_vlan_t new_vid, 432 int prio); 433 434 /* Add an entry to the VLAN Translation table. */ 435 extern int bcm_vlan_translate_get( 436 int unit, 437 int port, 438 bcm_vlan_t old_vid, 439 bcm_vlan_t *new_vid, 440 int *prio); 441 442 /* Delete an entry or entries from the VLAN Translation table. */ 443 extern int bcm_vlan_translate_delete( 444 int unit, 445 int port, 446 bcm_vlan_t old_vid); 447 448 /* Remove all entries from the VLAN Translation table. */ 449 extern int bcm_vlan_translate_delete_all( 450 int unit); 451 452 #endif /* BCM_HIDE_DISPATCHABLE */ 453 454 /* Key types for vlan translation lookup. */ 455 typedef enum bcm_vlan_translate_key_e { 456 bcmVlanTranslateKeyInvalid = 0, /* Invalid Key Type. */ 457 bcmVlanTranslateKeyDouble = 1, /* Use O-VID[11:0] and I-VID[11:0]. */ 458 bcmVlanTranslateKeyOuter = 2, /* Use O-VID[11:0] */ 459 bcmVlanTranslateKeyInner = 3, /* Use I-VID[11:0] */ 460 bcmVlanTranslateKeyOuterTag = 4, /* Use O-TAG[15:0] */ 461 bcmVlanTranslateKeyInnerTag = 5, /* Use I-TAG[15:0] */ 462 bcmVlanTranslateKeyOuterPri = 6, /* Use (VLAN-PRI, VLAN-CFI => 463 O-TAG[15:12]) */ 464 bcmVlanTranslateKeyPortDouble = 7, /* Use Port, O-VID[11:0] and 465 I-VID[11:0]. */ 466 bcmVlanTranslateKeyPortOuter = 8, /* Use Port, O-VID[11:0] */ 467 bcmVlanTranslateKeyPortInner = 9, /* Use Port, I-VID[11:0] */ 468 bcmVlanTranslateKeyPortOuterTag = 10, /* Use Port, O-TAG[15:0] */ 469 bcmVlanTranslateKeyPortInnerTag = 11, /* Use Port, I-TAG[15:0] */ 470 bcmVlanTranslateKeyPortOuterPri = 12, /* Use Port, (VLAN-PRI, VLAN-CFI => 471 O-TAG[15:12]) */ 472 bcmVlanTranslateKeyDoubleVsan = 13, /* Use I-VID[11:0], O-VID[11:0] and 473 VSAN-ID[11:0] */ 474 bcmVlanTranslateKeyInnerVsan = 14, /* Use I-VID[11:0] and VSAN-ID[11:0] */ 475 bcmVlanTranslateKeyOuterVsan = 15, /* Use O-VID[11:0] and VSAN-ID[11:0] */ 476 bcmVlanTranslateKeyPortPonTunnel = 16, /* Use Port, LLVID[11:0] */ 477 bcmVlanTranslateKeyPortPonTunnelOuter = 17, /* Use Port, LLVID[11:0] and 478 O-VID[11:0] */ 479 bcmVlanTranslateKeyPortPonTunnelInner = 18, /* Use Port LLVID[11:0] and I-VID[11:0] */ 480 bcmVlanTranslateKeyCapwapPayloadDouble = 19, /* Use O-VID[11:0] and I-VID[11:0] in 481 CAPWAP wireless payload */ 482 bcmVlanTranslateKeyCapwapPayloadOuter = 20, /* Use O-VID[11:0] in CAPWAP wireless 483 payload */ 484 bcmVlanTranslateKeyCapwapPayloadInner = 21, /* Use I-VID[11:0] in CAPWAP wireless 485 payload */ 486 bcmVlanTranslateKeyCapwapPayloadOuterTag = 22, /* Use O-TAG[15:0] in CAPWAP wireless 487 payload */ 488 bcmVlanTranslateKeyCapwapPayloadInnerTag = 23, /* Use I-TAG[15:0] in CAPWAP wireless 489 payload */ 490 bcmVlanTranslateKeyPortCapwapPayloadDouble = 24, /* Use port, O-VID[11:0] and I-VID[11:0] 491 in CAPWAP wireless payload */ 492 bcmVlanTranslateKeyPortCapwapPayloadOuter = 25, /* Use Port, O-VID[11:0] in CAPWAP 493 wireless payload */ 494 bcmVlanTranslateKeyPortCapwapPayloadInner = 26, /* Use Port, I-VID[11:0] in CAPWAP 495 wireless payload */ 496 bcmVlanTranslateKeyPortCapwapPayloadOuterTag = 27, /* Use Port, O-TAG[15:0] in CAPWAP 497 wireless payload */ 498 bcmVlanTranslateKeyPortCapwapPayloadInnerTag = 28, /* Use Port, I-TAG[15:0] in CAPWAP 499 wireless payload */ 500 bcmVlanTranslateKeyPortGroupDouble = 29, /* Use Port-Group, O-VID[11:0] and 501 I-VID[11:0] */ 502 bcmVlanTranslateKeyPortGroupOuter = 30, /* Use Port-Group, O-VID[11:0] */ 503 bcmVlanTranslateKeyPortGroupInner = 31, /* Use Port-Group, I-VID[11:0] */ 504 bcmVlanTranslateKeyPortGroupOuterTag = 32, /* Use Port-Group, O-TAG[15:0] */ 505 bcmVlanTranslateKeyPortGroupInnerTag = 33, /* Use Port-Group, I-TAG[15:0] */ 506 bcmVlanTranslateKeyPortGroupOuterPri = 34, /* Use Port-Group, (VLAN-PRI, VLAN-CFI 507 => O-TAG[15:12]) */ 508 bcmVlanTranslateKeyVxlanVnid = 35, /* Use VNID[23:0] in VXLAN header */ 509 bcmVlanTranslateKeyPortVxlanVnid = 36, /* Use Port and VNID[23:0] in VXLAN 510 header */ 511 bcmVlanTranslateKeyMacPort = 37, /* Use Mac Address[47:0] and Port */ 512 bcmVlanTranslateKeyMacVirtualPort = 38, /* Use Mac Address[47:0] + Port */ 513 bcmVlanTranslateKeyMacPortGroup = 39 /* Use Mac Address[47:0] and 514 Port-Group[11:0] */ 515 } bcm_vlan_translate_key_t; 516 517 #ifndef BCM_HIDE_DISPATCHABLE 518 519 /* Add an entry to the VLAN Translation table and assign VLAN actions. */ 520 extern int bcm_vlan_translate_action_add( 521 int unit, 522 bcm_gport_t port, 523 bcm_vlan_translate_key_t key_type, 524 bcm_vlan_t outer_vlan, 525 bcm_vlan_t inner_vlan, 526 bcm_vlan_action_set_t *action); 527 528 /* Add an entry to the VLAN Translation table and assign VLAN actions. */ 529 extern int bcm_vlan_translate_action_create( 530 int unit, 531 bcm_gport_t port, 532 bcm_vlan_translate_key_t key_type, 533 bcm_vlan_t outer_vlan, 534 bcm_vlan_t inner_vlan, 535 bcm_vlan_action_set_t *action); 536 537 /* Get an entry to the VLAN Translation table and assign VLAN actions. */ 538 extern int bcm_vlan_translate_action_get( 539 int unit, 540 bcm_gport_t port, 541 bcm_vlan_translate_key_t key_type, 542 bcm_vlan_t outer_vlan, 543 bcm_vlan_t inner_vlan, 544 bcm_vlan_action_set_t *action); 545 546 /* Delete an entry from the VLAN Translation table. */ 547 extern int bcm_vlan_translate_action_delete( 548 int unit, 549 bcm_gport_t port, 550 bcm_vlan_translate_key_t key_type, 551 bcm_vlan_t outer_vlan, 552 bcm_vlan_t inner_vlan); 553 554 /* Add an entry to the egress VLAN Translation table. */ 555 extern int bcm_vlan_translate_egress_add( 556 int unit, 557 int port, 558 bcm_vlan_t old_vid, 559 bcm_vlan_t new_vid, 560 int prio); 561 562 /* Get an entry to the egress VLAN Translation table. */ 563 extern int bcm_vlan_translate_egress_get( 564 int unit, 565 int port, 566 bcm_vlan_t old_vid, 567 bcm_vlan_t *new_vid, 568 int *prio); 569 570 /* Remove an entry or entries from the VLAN egress Translation table. */ 571 extern int bcm_vlan_translate_egress_delete( 572 int unit, 573 int port, 574 bcm_vlan_t old_vid); 575 576 /* Remove all entries from the egress VLAN Translation table. */ 577 extern int bcm_vlan_translate_egress_delete_all( 578 int unit); 579 580 /* 581 * Add an entry to the egress VLAN Translation table and assign VLAN 582 * actions. 583 */ 584 extern int bcm_vlan_translate_egress_action_add( 585 int unit, 586 int port_class, 587 bcm_vlan_t outer_vlan, 588 bcm_vlan_t inner_vlan, 589 bcm_vlan_action_set_t *action); 590 591 /* 592 * Get an entry to the egress VLAN Translation table and assign VLAN 593 * actions. 594 */ 595 extern int bcm_vlan_translate_egress_action_get( 596 int unit, 597 int port_class, 598 bcm_vlan_t outer_vlan, 599 bcm_vlan_t inner_vlan, 600 bcm_vlan_action_set_t *action); 601 602 /* Delete an entry from the egress VLAN Translation table. */ 603 extern int bcm_vlan_translate_egress_action_delete( 604 int unit, 605 int port_class, 606 bcm_vlan_t outer_vlan, 607 bcm_vlan_t inner_vlan); 608 609 /* 610 * Add an entry based on gport and VLANs to the egress VLAN Translation 611 * table and assign VLAN actions. 612 */ 613 extern int bcm_vlan_translate_egress_gport_action_add( 614 int unit, 615 bcm_gport_t port, 616 bcm_vlan_t outer_vlan, 617 bcm_vlan_t inner_vlan, 618 bcm_vlan_action_set_t *action); 619 620 /* 621 * Get VLAN actions for an entry based on gport and VLANS in the egress 622 * VLAN Translation table. 623 */ 624 extern int bcm_vlan_translate_egress_gport_action_get( 625 int unit, 626 bcm_gport_t port, 627 bcm_vlan_t outer_vlan, 628 bcm_vlan_t inner_vlan, 629 bcm_vlan_action_set_t *action); 630 631 /* 632 * Delete an entry based on gport and VLANs from the egress VLAN 633 * Translation table. 634 */ 635 extern int bcm_vlan_translate_egress_gport_action_delete( 636 int unit, 637 bcm_gport_t port, 638 bcm_vlan_t outer_vlan, 639 bcm_vlan_t inner_vlan); 640 641 /* Add an entry to the VLAN Translation table for double-tagging. */ 642 extern int bcm_vlan_dtag_add( 643 int unit, 644 int port, 645 bcm_vlan_t old_vid, 646 bcm_vlan_t new_vid, 647 int prio); 648 649 /* Get an entry to the VLAN Translation table for double-tagging. */ 650 extern int bcm_vlan_dtag_get( 651 int unit, 652 int port, 653 bcm_vlan_t old_vid, 654 bcm_vlan_t *new_vid, 655 int *prio); 656 657 /* Remove an entry from the VLAN Translation table for double-tagging. */ 658 extern int bcm_vlan_dtag_delete( 659 int unit, 660 int port, 661 bcm_vlan_t old_vid); 662 663 /* Remove all entries from the VLAN Translation table for double-tagging. */ 664 extern int bcm_vlan_dtag_delete_all( 665 int unit); 666 667 /* Add a VLAN range to the VLAN Translation table. */ 668 extern int bcm_vlan_translate_range_add( 669 int unit, 670 int port, 671 bcm_vlan_t old_vid_low, 672 bcm_vlan_t old_vid_high, 673 bcm_vlan_t new_vid, 674 int int_prio); 675 676 /* Get a VLAN range to the VLAN Translation table. */ 677 extern int bcm_vlan_translate_range_get( 678 int unit, 679 int port, 680 bcm_vlan_t old_vid_low, 681 bcm_vlan_t old_vid_high, 682 bcm_vlan_t *new_vid, 683 int *int_prio); 684 685 /* Delete a VLAN range from the VLAN Translation table. */ 686 extern int bcm_vlan_translate_range_delete( 687 int unit, 688 int port, 689 bcm_vlan_t old_vid_low, 690 bcm_vlan_t old_vid_high); 691 692 /* Remove all VLAN ranges from the VLAN Translation table. */ 693 extern int bcm_vlan_translate_range_delete_all( 694 int unit); 695 696 /* Add VLAN range to the VLAN Translation table for double-tagging. */ 697 extern int bcm_vlan_dtag_range_add( 698 int unit, 699 int port, 700 bcm_vlan_t old_vid_low, 701 bcm_vlan_t old_vid_high, 702 bcm_vlan_t new_vid, 703 int int_prio); 704 705 /* Get VLAN range to the VLAN Translation table for double-tagging. */ 706 extern int bcm_vlan_dtag_range_get( 707 int unit, 708 int port, 709 bcm_vlan_t old_vid_low, 710 bcm_vlan_t old_vid_high, 711 bcm_vlan_t *new_vid, 712 int *prio); 713 714 /* 715 * Remove a VLAN range from the VLAN Translation table for 716 * double-tagging. 717 */ 718 extern int bcm_vlan_dtag_range_delete( 719 int unit, 720 int port, 721 bcm_vlan_t old_vid_low, 722 bcm_vlan_t old_vid_high); 723 724 /* 725 * Remove all VLAN ranges from the VLAN Translation table for 726 * double-tagging. 727 */ 728 extern int bcm_vlan_dtag_range_delete_all( 729 int unit); 730 731 /* bcm_vlan_translate_action_range_add */ 732 extern int bcm_vlan_translate_action_range_add( 733 int unit, 734 bcm_gport_t port, 735 bcm_vlan_t outer_vlan_low, 736 bcm_vlan_t outer_vlan_high, 737 bcm_vlan_t inner_vlan_low, 738 bcm_vlan_t inner_vlan_high, 739 bcm_vlan_action_set_t *action); 740 741 /* bcm_vlan_translate_action_range_get */ 742 extern int bcm_vlan_translate_action_range_get( 743 int unit, 744 bcm_gport_t port, 745 bcm_vlan_t outer_vlan_low, 746 bcm_vlan_t outer_vlan_high, 747 bcm_vlan_t inner_vlan_low, 748 bcm_vlan_t inner_vlan_high, 749 bcm_vlan_action_set_t *action); 750 751 /* bcm_vlan_translate_action_range_delete */ 752 extern int bcm_vlan_translate_action_range_delete( 753 int unit, 754 bcm_gport_t port, 755 bcm_vlan_t outer_vlan_low, 756 bcm_vlan_t outer_vlan_high, 757 bcm_vlan_t inner_vlan_low, 758 bcm_vlan_t inner_vlan_high); 759 760 /* bcm_vlan_translate_action_range_delete_all */ 761 extern int bcm_vlan_translate_action_range_delete_all( 762 int unit); 763 764 #endif /* BCM_HIDE_DISPATCHABLE */ 765 766 /* vlan_translate_egress_action_traverse_cb */ 767 typedef int (*bcm_vlan_translate_egress_action_traverse_cb)( 768 int unit, 769 int port_class, 770 bcm_vlan_t outer_vlan, 771 bcm_vlan_t inner_vlan, 772 bcm_vlan_action_set_t *action, 773 void *user_data); 774 775 #ifndef BCM_HIDE_DISPATCHABLE 776 777 /* Traverse vlan translate egress table */ 778 extern int bcm_vlan_translate_egress_action_traverse( 779 int unit, 780 bcm_vlan_translate_egress_action_traverse_cb cb, 781 void *user_data); 782 783 #endif /* BCM_HIDE_DISPATCHABLE */ 784 785 /* vlan_translate_action_traverse_cb */ 786 typedef int (*bcm_vlan_translate_action_traverse_cb)( 787 int unit, 788 bcm_gport_t port, 789 bcm_vlan_translate_key_t key_type, 790 bcm_vlan_t outer_vlan, 791 bcm_vlan_t inner_vlan, 792 bcm_vlan_action_set_t *action, 793 void *user_data); 794 795 #ifndef BCM_HIDE_DISPATCHABLE 796 797 /* Traverse vlan translate table */ 798 extern int bcm_vlan_translate_action_traverse( 799 int unit, 800 bcm_vlan_translate_action_traverse_cb cb, 801 void *user_data); 802 803 #endif /* BCM_HIDE_DISPATCHABLE */ 804 805 /* vlan_translate_traverse_cb */ 806 typedef int (*bcm_vlan_translate_traverse_cb)( 807 int unit, 808 bcm_gport_t port, 809 bcm_vlan_t old_vlan, 810 bcm_vlan_t new_vlan, 811 int prio, 812 void *user_data); 813 814 #ifndef BCM_HIDE_DISPATCHABLE 815 816 /* Traverse vlan translate table */ 817 extern int bcm_vlan_translate_traverse( 818 int unit, 819 bcm_vlan_translate_traverse_cb cb, 820 void *user_data); 821 822 #endif /* BCM_HIDE_DISPATCHABLE */ 823 824 /* vlan_translate_egress_traverse_cb */ 825 typedef int (*bcm_vlan_translate_egress_traverse_cb)( 826 int unit, 827 bcm_gport_t port, 828 bcm_vlan_t old_vlan, 829 bcm_vlan_t new_vlan, 830 int prio, 831 void *user_data); 832 833 #ifndef BCM_HIDE_DISPATCHABLE 834 835 /* Traverse vlan egress translate table */ 836 extern int bcm_vlan_translate_egress_traverse( 837 int unit, 838 bcm_vlan_translate_egress_traverse_cb cb, 839 void *user_data); 840 841 #endif /* BCM_HIDE_DISPATCHABLE */ 842 843 /* vlan_dtag_traverse_cb */ 844 typedef int (*bcm_vlan_dtag_traverse_cb)( 845 int unit, 846 bcm_gport_t port, 847 bcm_vlan_t old_vlan, 848 bcm_vlan_t new_vlan, 849 int prio, 850 void *user_data); 851 852 #ifndef BCM_HIDE_DISPATCHABLE 853 854 /* Traverse vlan translate table */ 855 extern int bcm_vlan_dtag_traverse( 856 int unit, 857 bcm_vlan_dtag_traverse_cb cb, 858 void *user_data); 859 860 #endif /* BCM_HIDE_DISPATCHABLE */ 861 862 /* vlan_translate_action_range_traverse_cb */ 863 typedef int (*bcm_vlan_translate_action_range_traverse_cb)( 864 int unit, 865 bcm_gport_t port, 866 bcm_vlan_t outer_vlan_low, 867 bcm_vlan_t outer_vlan_high, 868 bcm_vlan_t inner_vlan_low, 869 bcm_vlan_t inner_vlan_high, 870 bcm_vlan_action_set_t *action, 871 void *user_data); 872 873 #ifndef BCM_HIDE_DISPATCHABLE 874 875 /* Traverse vlan translate range table */ 876 extern int bcm_vlan_translate_action_range_traverse( 877 int unit, 878 bcm_vlan_translate_action_range_traverse_cb cb, 879 void *user_data); 880 881 #endif /* BCM_HIDE_DISPATCHABLE */ 882 883 /* bcm_vlan_translate_range_traverse_cb */ 884 typedef int (*bcm_vlan_translate_range_traverse_cb)( 885 int unit, 886 bcm_gport_t port, 887 bcm_vlan_t old_vlan_low, 888 bcm_vlan_t old_vlan_high, 889 bcm_vlan_t new_vlan, 890 int prio, 891 void *user_data); 892 893 #ifndef BCM_HIDE_DISPATCHABLE 894 895 /* Traverse vlan translate range table */ 896 extern int bcm_vlan_translate_range_traverse( 897 int unit, 898 bcm_vlan_translate_range_traverse_cb cb, 899 void *user_data); 900 901 #endif /* BCM_HIDE_DISPATCHABLE */ 902 903 /* bcm_vlan_dtag_range_traverse_cb */ 904 typedef int (*bcm_vlan_dtag_range_traverse_cb)( 905 int unit, 906 bcm_gport_t port, 907 bcm_vlan_t old_vlan_low, 908 bcm_vlan_t old_vlan_high, 909 bcm_vlan_t new_vlan, 910 int prio, 911 void *user_data); 912 913 #ifndef BCM_HIDE_DISPATCHABLE 914 915 /* Traverse vlan translate range table */ 916 extern int bcm_vlan_dtag_range_traverse( 917 int unit, 918 bcm_vlan_dtag_range_traverse_cb cb, 919 void *user_data); 920 921 /* Create a VLAN translation ID instance */ 922 extern int bcm_vlan_translate_action_id_create( 923 int unit, 924 uint32 flags, 925 int *action_id); 926 927 /* Destroy a VLAN translation ID instance */ 928 extern int bcm_vlan_translate_action_id_destroy( 929 int unit, 930 uint32 flags, 931 int action_id); 932 933 /* Destroy all VLAN translation ID instances */ 934 extern int bcm_vlan_translate_action_id_destroy_all( 935 int unit, 936 uint32 flags); 937 938 /* Set a VLAN translation ID instance with tag actions */ 939 extern int bcm_vlan_translate_action_id_set( 940 int unit, 941 uint32 flags, 942 int action_id, 943 bcm_vlan_action_set_t *action); 944 945 /* Get tag actions from a VLAN translation ID instance */ 946 extern int bcm_vlan_translate_action_id_get( 947 int unit, 948 uint32 flags, 949 int action_id, 950 bcm_vlan_action_set_t *action); 951 952 #endif /* BCM_HIDE_DISPATCHABLE */ 953 954 /* bcm_vlan_translate_action_class_s */ 955 typedef struct bcm_vlan_translate_action_class_s { 956 uint32 flags; /* BCM_VLAN_ACTION_SET_XXX */ 957 uint32 vlan_edit_class_id; /* VLAN edit class ID. See 958 bcm_vlan_port_translation_set */ 959 bcm_port_tag_format_class_t tag_format_class_id; /* VLAN-tag format ID */ 960 int vlan_translation_action_id; /* Action ID */ 961 } bcm_vlan_translate_action_class_t; 962 963 /* Initialize the VLAN translate action class structure */ 964 extern void bcm_vlan_translate_action_class_t_init( 965 bcm_vlan_translate_action_class_t *action_class); 966 967 #ifndef BCM_HIDE_DISPATCHABLE 968 969 /* 970 * Set an action ID for a specified combination of packet format ID and 971 * VLAN edit profile 972 */ 973 extern int bcm_vlan_translate_action_class_set( 974 int unit, 975 bcm_vlan_translate_action_class_t *action_class); 976 977 /* 978 * Get the action ID that is configured for a specified combination of 979 * packet format ID and VLAN edit profile 980 */ 981 extern int bcm_vlan_translate_action_class_get( 982 int unit, 983 bcm_vlan_translate_action_class_t *action_class); 984 985 #endif /* BCM_HIDE_DISPATCHABLE */ 986 987 /* Flags for the unified IPv4/IPv6 bcm_vlan_ip_t type. */ 988 #define BCM_VLAN_SUBNET_IP6 (1 << 14) 989 990 /* Unified IPv4/IPv6 type. */ 991 typedef struct bcm_vlan_ip_s { 992 uint32 flags; 993 bcm_ip_t ip4; 994 bcm_ip_t mask; 995 bcm_ip6_t ip6; 996 int prefix; 997 bcm_vlan_t vid; 998 int prio; 999 } bcm_vlan_ip_t; 1000 1001 /* Initialize the bcm_vlan_ip_t structure. */ 1002 extern void bcm_vlan_ip_t_init( 1003 bcm_vlan_ip_t *vlan_ip); 1004 1005 #ifndef BCM_HIDE_DISPATCHABLE 1006 1007 /* 1008 * Add an association from IP subnet to VLAN to use for assigning a VLAN 1009 * tag to untagged packets. 1010 */ 1011 extern int bcm_vlan_ip_add( 1012 int unit, 1013 bcm_vlan_ip_t *vlan_ip); 1014 1015 /* Remove an association from IP subnet to VLAN. */ 1016 extern int bcm_vlan_ip_delete( 1017 int unit, 1018 bcm_vlan_ip_t *vlan_ip); 1019 1020 /* Remove all associations from IP subnet to VLAN. */ 1021 extern int bcm_vlan_ip_delete_all( 1022 int unit); 1023 1024 /* 1025 * Add an association from IP subnet to VLAN actions to use for assigning 1026 * VLAN tag actions to untagged packets. 1027 */ 1028 extern int bcm_vlan_ip_action_add( 1029 int unit, 1030 bcm_vlan_ip_t *vlan_ip, 1031 bcm_vlan_action_set_t *action); 1032 1033 /* 1034 * Get an association from IP subnet to VLAN actions to use for assigning 1035 * VLAN tag actions to untagged packets. 1036 */ 1037 extern int bcm_vlan_ip_action_get( 1038 int unit, 1039 bcm_vlan_ip_t *vlan_ip, 1040 bcm_vlan_action_set_t *action); 1041 1042 /* 1043 * Delete an association from IP subnet to VLAN actions to use for 1044 * assigning VLAN tag actions to untagged packets. 1045 */ 1046 extern int bcm_vlan_ip_action_delete( 1047 int unit, 1048 bcm_vlan_ip_t *vlan_ip); 1049 1050 /* 1051 * Delete all associations from IP subnet to VLAN actions to use for 1052 * assigning VLAN tag actions to untagged packets. 1053 */ 1054 extern int bcm_vlan_ip_action_delete_all( 1055 int unit); 1056 1057 #endif /* BCM_HIDE_DISPATCHABLE */ 1058 1059 /* vlan_ip_action_traverse_cb */ 1060 typedef int (*bcm_vlan_ip_action_traverse_cb)( 1061 int unit, 1062 bcm_vlan_ip_t *vlan_ip, 1063 bcm_vlan_action_set_t *action, 1064 void *user_data); 1065 1066 #ifndef BCM_HIDE_DISPATCHABLE 1067 1068 /* 1069 * Traverse over vlan ip actions, which are used for VLAN 1070 * tag/s assignment to untagged packets. 1071 */ 1072 extern int bcm_vlan_ip_action_traverse( 1073 int unit, 1074 bcm_vlan_ip_action_traverse_cb cb, 1075 void *user_data); 1076 1077 #endif /* BCM_HIDE_DISPATCHABLE */ 1078 1079 /* bcm_vlan_control_t */ 1080 typedef enum bcm_vlan_control_e { 1081 bcmVlanDropUnknown = 0, /* Drop unknown/FFF VLAN pkts or send to 1082 CPU. */ 1083 bcmVlanPreferIP4 = 1, /* Prefer IP Subnet VLAN selection. */ 1084 bcmVlanPreferMAC = 2, /* Prefer MAC VLAN selection. */ 1085 bcmVlanShared = 3, /* Shared vs. Independent VLAN Learning. */ 1086 bcmVlanSharedID = 4, /* Shared Learning VLAN ID. */ 1087 bcmVlanTranslate = 5, /* Chip is in VLAN translate mode. */ 1088 bcmVlanPreferEgressTranslate = 7, /* Do egress translation even if ingress 1089 FP changes the outer/inner VLAN 1090 tag(s). */ 1091 bcmVlanIndependentStp = 9, /* Directly set port,vlan stp state, 1092 igoring STG in bcm_vlan_stp_set(). */ 1093 bcmVlanMemberMismatchLearn = 20, /* Packets' incoming port is not the 1094 member of the VLAN are learned when 1095 set to 1. */ 1096 bcmVlanMemberMismatchToCpu = 21 /* Packets' incoming port is not the 1097 member of the VLAN are sent to CPU 1098 when set to 1. */ 1099 } bcm_vlan_control_t; 1100 1101 #ifndef BCM_HIDE_DISPATCHABLE 1102 1103 /* Set/get miscellaneous VLAN-specific chip options. */ 1104 extern int bcm_vlan_control_get( 1105 int unit, 1106 bcm_vlan_control_t type, 1107 int *arg); 1108 1109 /* Set/get miscellaneous VLAN-specific chip options. */ 1110 extern int bcm_vlan_control_set( 1111 int unit, 1112 bcm_vlan_control_t type, 1113 int arg); 1114 1115 #endif /* BCM_HIDE_DISPATCHABLE */ 1116 1117 /* Key types for egress vlan translation lookup. */ 1118 typedef enum bcm_vlan_translate_egress_key_e { 1119 bcmVlanTranslateEgressKeyInvalid = 0, /* Invalid Key Type. */ 1120 bcmVlanTranslateEgressKeyVpn = 1, /* Use VPN ID. */ 1121 bcmVlanTranslateEgressKeyVpnGport = 2, /* Use VPN ID and GPORT. */ 1122 bcmVlanTranslateEgressKeyVpnGportGroup = 3, /* Use VPN ID and GPORT group. */ 1123 bcmVlanTranslateEgressKeyVlanPort = 4, /* Use VLAN and PORT. */ 1124 bcmVlanTranslateEgressKeyPortGroupDouble = 5, /* Use port-group ID, OVID, IVID. */ 1125 bcmVlanTranslateEgressKeyPortDouble = 6, /* Use port, OVID, IVID. */ 1126 bcmVlanTranslateEgressKeyCount = 7 /* Egress VLAN translation key count. 1127 Always the last. */ 1128 } bcm_vlan_translate_egress_key_t; 1129 1130 /* bcm_vlan_control_port_t */ 1131 typedef enum bcm_vlan_control_port_e { 1132 bcmVlanPortPreferIP4 = 0, 1133 bcmVlanPortPreferMAC = 1, 1134 bcmVlanTranslateIngressEnable = 2, 1135 bcmVlanTranslateIngressHitDrop = 3, 1136 bcmVlanTranslateIngressMissDrop = 4, 1137 bcmVlanTranslateEgressEnable = 5, 1138 bcmVlanTranslateEgressMissDrop = 6, 1139 bcmVlanTranslateEgressMissUntaggedDrop = 7, 1140 bcmVlanLookupMACEnable = 8, 1141 bcmVlanLookupIPEnable = 9, 1142 bcmVlanPortUseInnerPri = 10, 1143 bcmVlanPortUseOuterPri = 11, 1144 bcmVlanPortVerifyOuterTpid = 12, 1145 bcmVlanPortOuterTpidSelect = 13, 1146 bcmVlanPortTranslateKeyFirst = 14, 1147 bcmVlanPortTranslateKeySecond = 15, 1148 bcmVlanTranslateEgressMissUntag = 16, 1149 bcmVlanPortIgnorePktTag = 17, 1150 bcmVlanPortUntaggedDrop = 18, 1151 bcmVlanPortPriTaggedDrop = 19, 1152 bcmVlanPortDoubleLookupEnable = 20, 1153 bcmVlanPortLookupTunnelEnable = 21, 1154 bcmVlanPortIgnoreInnerPktTag = 22, 1155 bcmVlanPortJoinAllVlan = 23, 1156 bcmVlanPortOamUseXlatedInnerVlan = 24, 1157 bcmVlanPortTranslateEgressKey = 25, 1158 bcmVlanPortTranslateEgressKeyFirst = 26, 1159 bcmVlanPortTranslateEgressKeySecond = 27 1160 } bcm_vlan_control_port_t; 1161 1162 /* Selectors for bcmVlanPortOuterTpidSelect */ 1163 #define BCM_PORT_OUTER_TPID 0 /* Use egress port TPID as outer 1164 TPID. */ 1165 #define BCM_VLAN_OUTER_TPID 1 /* Use VLAN TPID as outer TPID. */ 1166 1167 #ifndef BCM_HIDE_DISPATCHABLE 1168 1169 /* Set/get miscellaneous port-specific VLAN options. */ 1170 extern int bcm_vlan_control_port_get( 1171 int unit, 1172 int port, 1173 bcm_vlan_control_port_t type, 1174 int *arg); 1175 1176 /* Set/get miscellaneous port-specific VLAN options. */ 1177 extern int bcm_vlan_control_port_set( 1178 int unit, 1179 int port, 1180 bcm_vlan_control_port_t type, 1181 int arg); 1182 1183 #endif /* BCM_HIDE_DISPATCHABLE */ 1184 1185 /* VLAN multicast flood modes. */ 1186 typedef enum bcm_vlan_mcast_flood_e { 1187 BCM_VLAN_MCAST_FLOOD_ALL = _SHR_PORT_MCAST_FLOOD_ALL, 1188 BCM_VLAN_MCAST_FLOOD_UNKNOWN = _SHR_PORT_MCAST_FLOOD_UNKNOWN, 1189 BCM_VLAN_MCAST_FLOOD_NONE = _SHR_PORT_MCAST_FLOOD_NONE, 1190 BCM_VLAN_MCAST_FLOOD_COUNT = _SHR_PORT_MCAST_FLOOD_COUNT 1191 } bcm_vlan_mcast_flood_t; 1192 1193 #define BCM_VLAN_MCAST_FLOOD_STR \ 1194 { \ 1195 "MCAST_FLOOD_ALL", \ 1196 "MCAST_FLOOD_UNKNOWN", \ 1197 "MCAST_FLOOD_NONE", \ 1198 "" \ 1199 } 1200 1201 #ifndef BCM_HIDE_DISPATCHABLE 1202 1203 /* Set or retrieve the current vlan multicast flood behavior. */ 1204 extern int bcm_vlan_mcast_flood_get( 1205 int unit, 1206 bcm_vlan_t vlan, 1207 bcm_vlan_mcast_flood_t *mode); 1208 1209 /* Set or retrieve the current vlan multicast flood behavior. */ 1210 extern int bcm_vlan_mcast_flood_set( 1211 int unit, 1212 bcm_vlan_t vlan, 1213 bcm_vlan_mcast_flood_t mode); 1214 1215 #endif /* BCM_HIDE_DISPATCHABLE */ 1216 1217 /* Per VLAN forwarding behavior. */ 1218 typedef enum bcm_vlan_forward_e { 1219 bcmVlanForwardBridging = 0, /* Switching based on MAC and VLAN. */ 1220 bcmVlanForwardSingleCrossConnect = 1, /* Switching based on outer VLAN. */ 1221 bcmVlanForwardDoubleCrossConnect = 2 /* Switching based on outer+inner VLAN. */ 1222 } bcm_vlan_forward_t; 1223 1224 /* Per VLAN URPF Mode setting. */ 1225 typedef enum bcm_vlan_urpf_mode_e { 1226 bcmVlanUrpfDisable = 0, /* Disable unicast RPF. */ 1227 bcmVlanUrpfLoose = 1, /* Loose mode Unicast RPF. */ 1228 bcmVlanUrpfStrict = 2 /* Strict mode Unicast RPF. */ 1229 } bcm_vlan_urpf_mode_t; 1230 1231 /* Per VLAN VP Mode control. */ 1232 typedef enum bcm_vlan_vp_mc_ctrl_e { 1233 bcmVlanVPMcControlAuto = 0, /* VP Multicast replication auto control */ 1234 bcmVlanVPMcControlEnable = 1, /* Enable VP Multicast replication */ 1235 bcmVlanVPMcControlDisable = 2 /* Disable VP Multicast replication */ 1236 } bcm_vlan_vp_mc_ctrl_t; 1237 1238 #define BCM_VLAN_PROTO_PKT_TOCPU_ENABLE 0x00000001 1239 #define BCM_VLAN_PROTO_PKT_FORWARD_ENABLE 0x00000002 1240 #define BCM_VLAN_PROTO_PKT_DROP_ENABLE 0x00000004 1241 #define BCM_VLAN_PROTO_PKT_FLOOD_ENABLE 0x00000008 1242 1243 /* 1244 * Per VLAN Protocol Packet control. A protocol packet type is copied to 1245 * CPU if the packet control value is set to VLAN_PROTO_PKT_TOCPU_ENABLE. 1246 * Additionally the control can be set to one of 1247 * VLAN_PROTO_PKT_FORWARD_ENABLE, VLAN_PROTO_PKT_DROP_ENABLE, or 1248 * VLAN_PROTO_PKT_FLOOD_ENABLE to forward, drop or flood in VLAN 1249 * respectively. 1250 */ 1251 typedef struct bcm_vlan_protocol_packet_ctrl_s { 1252 int mmrp_action; /* MMRP packet action */ 1253 int srp_action; /* SRP packet action */ 1254 int arp_reply_action; /* ARP reply packet action */ 1255 int arp_request_action; /* ARP request packet action */ 1256 int nd_action; /* ND packet action */ 1257 int dhcp_action; /* DHCP packet action */ 1258 int igmp_report_leave_action; /* IGMP Report(v1,v2,v3)/Leave(v2) 1259 packet action */ 1260 int igmp_query_action; /* IGMP Query packet action */ 1261 int igmp_unknown_msg_action; /* Unknown IGMP message packet action */ 1262 int mld_report_done_action; /* MLD Report(v1,v2)/Done(v1) packet 1263 action */ 1264 int mld_query_action; /* MLD Query packet action */ 1265 int ip4_rsvd_mc_action; /* IPv4 reserved multicast packet 1266 (DIP=224.0.0.X) action */ 1267 int ip6_rsvd_mc_action; /* IPv6 reserved multicast packet 1268 (DIP=ff0X:0:0:0:0:0:0:0) action */ 1269 int ip4_mc_router_adv_action; /* IPv4 multicast router 1270 advertisement/solicitation/termination 1271 (ICMP types 151,152,153) packet 1272 action */ 1273 int ip6_mc_router_adv_action; /* IPv6 multicast router 1274 advertisement/solicitation/termination 1275 (ICMP types 151,152,153) packet 1276 action */ 1277 int flood_action_according_to_pfm; /* Use PFM rules for flooding 1278 IGMP/MLD/IPv4,IPv6 Reserved Multicast */ 1279 } bcm_vlan_protocol_packet_ctrl_t; 1280 1281 #define BCM_VLAN_LEARN_DISABLE 0x00000001 1282 #define BCM_VLAN_UNKNOWN_IP6_MCAST_TOCPU 0x00000002 1283 #define BCM_VLAN_UNKNOWN_IP4_MCAST_TOCPU 0x00000004 1284 #define BCM_VLAN_IP4_DISABLE 0x00000008 1285 #define BCM_VLAN_IP6_DISABLE 0x00000010 1286 #define BCM_VLAN_IP4_MCAST_DISABLE 0x00000020 1287 #define BCM_VLAN_IP6_MCAST_DISABLE 0x00000040 1288 #define BCM_VLAN_IP4_MCAST_L2_DISABLE 0x00000080 1289 #define BCM_VLAN_IP6_MCAST_L2_DISABLE 0x00000100 1290 #define BCM_VLAN_MPLS_DISABLE 0x00000200 1291 #define BCM_VLAN_COSQ_ENABLE 0x00000400 1292 #define BCM_VLAN_IGMP_SNOOP_DISABLE 0x00000800 1293 #define BCM_VLAN_PIM_SNOOP_DISABLE 0x00001000 1294 #define BCM_VLAN_USE_FABRIC_DISTRIBUTION 0x00002000 1295 #define BCM_VLAN_ICMP_REDIRECT_TOCPU 0x00004000 1296 #define BCM_VLAN_UNKNOWN_UCAST_TOCPU 0x00008000 1297 #define BCM_VLAN_UNKNOWN_UCAST_DROP 0x00010000 1298 #define BCM_VLAN_NON_UCAST_TOCPU 0x00020000 1299 #define BCM_VLAN_NON_UCAST_DROP 0x00040000 1300 #define BCM_VLAN_L2_LOOKUP_DISABLE 0x00080000 1301 #define BCM_VLAN_L3_VRF_GLOBAL_DISABLE 0x00100000 1302 #define BCM_VLAN_MIM_TERM_DISABLE 0x00200000 1303 #define BCM_VLAN_L2_CLASS_ID_ONLY 0x00400000 1304 #define BCM_VLAN_L3_URPF_DEFAULT_ROUTE_CHECK_DISABLE 0x00800000 1305 #define BCM_VLAN_TRILL_IGMP_SNOOP_DISABLE 0x01000000 1306 #define BCM_VLAN_POLICER_DISABLE 0x02000000 1307 #define BCM_VLAN_UNKNOWN_SMAC_DROP 0x04000000 1308 #define BCM_VLAN_IPMC_DO_VLAN_DISABLE 0x08000000 1309 #define BCM_VLAN_L3_CLASS_ID 0x10000000 1310 #define BCM_VLAN_IPMC4_UCAST_ENABLE 0x20000000 1311 #define BCM_VLAN_IPMC6_UCAST_ENABLE 0x40000000 1312 #define BCM_VLAN_SRC_DST_NAT_REALM_ID 0x80000000 1313 1314 #define BCM_VLAN_FLAGS2_MEMBER_INGRESS_DISABLE 0x00000001 /* Disable ingress 1315 membership check for 1316 this VPN */ 1317 #define BCM_VLAN_FLAGS2_MEMBER_EGRESS_DISABLE 0x00000002 /* Disable egress 1318 membership check for 1319 this VPN */ 1320 #define BCM_VLAN_FLAGS2_IVL 0x00000004 /* Configure VSI to use 1321 IVL key format 1322 (vid,vsi,mac) */ 1323 #define BCM_VLAN_FLAGS2_WIRED_COS_MAP_SELECT 0x00000008 /* Select the wired cos 1324 map */ 1325 #define BCM_VLAN_FLAGS2_WIRELESS_COS_MAP_SELECT 0x00000010 /* Select the wireless 1326 cos map */ 1327 1328 /* Valid fields bitmask for vlan control structure. */ 1329 #define BCM_VLAN_CONTROL_VLAN_VRF_MASK 0x00000001 1330 #define BCM_VLAN_CONTROL_VLAN_FORWARDING_VLAN_MASK 0x00000002 1331 #define BCM_VLAN_CONTROL_VLAN_INGRESS_IF_MASK 0x00000004 1332 #define BCM_VLAN_CONTROL_VLAN_OUTER_TPID_MASK 0x00000008 1333 #define BCM_VLAN_CONTROL_VLAN_IP6_MCAST_FLOOD_MODE_MASK 0x00000010 1334 #define BCM_VLAN_CONTROL_VLAN_IP4_MCAST_FLOOD_MODE_MASK 0x00000020 1335 #define BCM_VLAN_CONTROL_VLAN_L2_MCAST_FLOOD_MODE_MASK 0x00000040 1336 #define BCM_VLAN_CONTROL_VLAN_IF_CLASS_MASK 0x00000080 1337 #define BCM_VLAN_CONTROL_VLAN_FORWARDING_MODE_MASK 0x00000100 1338 #define BCM_VLAN_CONTROL_VLAN_URPF_MODE_MASK 0x00000200 1339 #define BCM_VLAN_CONTROL_VLAN_COSQ_MASK 0x00000400 1340 #define BCM_VLAN_CONTROL_VLAN_QOS_MAP_ID_MASK 0x00000800 1341 #define BCM_VLAN_CONTROL_VLAN_DISTRIBUTION_CLASS_MASK 0x00001000 1342 #define BCM_VLAN_CONTROL_VLAN_BROADCAST_GROUP_MASK 0x00002000 1343 #define BCM_VLAN_CONTROL_VLAN_UNKNOWN_MULTICAST_GROUP_MASK 0x00004000 1344 #define BCM_VLAN_CONTROL_VLAN_UNKNOWN_UNICAST_GROUP_MASK 0x00008000 1345 #define BCM_VLAN_CONTROL_VLAN_TRILL_NONUNICAST_GROUP_MASK 0x00010000 1346 #define BCM_VLAN_CONTROL_VLAN_SOURCE_TRILL_NAME_MASK 0x00020000 1347 #define BCM_VLAN_CONTROL_VLAN_TRUNK_INDEX_MASK 0x00040000 1348 #define BCM_VLAN_CONTROL_VLAN_PROTOCOL_PKT_MASK 0x00080000 1349 #define BCM_VLAN_CONTROL_VLAN_NAT_REALM_ID_MASK 0x00100000 1350 #define BCM_VLAN_CONTROL_VLAN_L3_IF_CLASS_MASK 0x00200000 1351 #define BCM_VLAN_CONTROL_VLAN_VP_MCAST_MASK 0x00400000 1352 #define BCM_VLAN_CONTROL_VLAN_SR_FLAGS_MASK 0x00800000 1353 1354 /* Enable all fields in vlan control structure. */ 1355 #define BCM_VLAN_CONTROL_VLAN_ALL_MASK 0xffffffff 1356 1357 /* 1358 * Flags for Vlan-based learn mode 1359 * 1360 * This call takes flags to turn on and off mutually-independent actions 1361 * that should be taken when a packet is received with an unknown source 1362 * address, or source lookup failure (SLF) on a per-VLAN basis. 1363 * 1364 * BCM_VLAN_LEARN_CONTROL_ENABLE: Enable the VLAN-based Learn will 1365 * override per-port learning (The default behavior when it is set: "Do 1366 * not hardware learning", "Do not copy to cpu", "Drop packet" and "No 1367 * pending learn"). 1368 */ 1369 #define BCM_VLAN_LEARN_CONTROL_ENABLE 0x80000000 1370 #define BCM_VLAN_LEARN_CONTROL_ARL 0x01 1371 #define BCM_VLAN_LEARN_CONTROL_CPU 0x02 1372 #define BCM_VLAN_LEARN_CONTROL_FWD 0x04 1373 #define BCM_VLAN_LEARN_CONTROL_PENDING 0x08 1374 1375 /* This structure contains the configuration of a VLAN. */ 1376 typedef struct bcm_vlan_control_vlan_s { 1377 bcm_vrf_t vrf; 1378 bcm_vlan_t forwarding_vlan; /* Shared VLAN ID. */ 1379 bcm_if_t ingress_if; /* Mapped Ingress interface. */ 1380 uint16 outer_tpid; 1381 uint32 flags; 1382 bcm_vlan_mcast_flood_t ip6_mcast_flood_mode; 1383 bcm_vlan_mcast_flood_t ip4_mcast_flood_mode; 1384 bcm_vlan_mcast_flood_t l2_mcast_flood_mode; 1385 int if_class; 1386 bcm_vlan_forward_t forwarding_mode; 1387 bcm_vlan_urpf_mode_t urpf_mode; 1388 bcm_cos_queue_t cosq; 1389 int qos_map_id; /* index to int_pri->queue offset 1390 mapping profile */ 1391 bcm_fabric_distribution_t distribution_class; /* Fabric Distribution Class. */ 1392 bcm_multicast_t broadcast_group; /* Group to handle broadcast frames */ 1393 bcm_multicast_t unknown_multicast_group; /* Group to handle unknown multicast 1394 frames */ 1395 bcm_multicast_t unknown_unicast_group; /* Group to handle unknown unicast 1396 frames */ 1397 bcm_multicast_t trill_nonunicast_group; /* Group to handle trill-domain 1398 nonunicast frames */ 1399 bcm_trill_name_t source_trill_name; /* Source RBridge nickname per VLAN */ 1400 int trunk_index; /* Trunk index for static PSC */ 1401 bcm_vlan_protocol_packet_ctrl_t protocol_pkt; /* Protocol packet control per VLAN */ 1402 int nat_realm_id; /* Realm id of interface that this vlan 1403 maps to */ 1404 int l3_if_class; /* L3IIF class id. */ 1405 bcm_vlan_vp_mc_ctrl_t vp_mc_ctrl; /* VP replication control, Auto, Enable, 1406 Disable */ 1407 int aging_cycles; /* number of aging meta-cycles */ 1408 int entropy_id; /* aging profile ID */ 1409 bcm_vpn_t vpn; /* vpn */ 1410 bcm_vlan_t egress_vlan; /* egress outer vlan */ 1411 uint32 learn_flags; /* Learn control flags for VLAN-based 1412 (BCM_VLAN_LEARN_CONTROL_XXX) */ 1413 uint32 sr_flags; /* Flags for Seamless Redundancy: 1414 BCM_VLAN_CONTROL_SR_FLAG_xxx */ 1415 uint32 flags2; /* BCM_VLAN_FLAGS2_XXX */ 1416 uint32 ingress_stat_id; /* Object statistics id ingress. */ 1417 int ingress_stat_pp_profile; /* Statistic profile ingress. */ 1418 uint32 egress_stat_id; /* Object statistics id egress. */ 1419 int egress_stat_pp_profile; /* Statistic profile egress. */ 1420 } bcm_vlan_control_vlan_t; 1421 1422 /* Initialize the bcm_vlan_control_vlan_t structure. */ 1423 extern void bcm_vlan_control_vlan_t_init( 1424 bcm_vlan_control_vlan_t *data); 1425 1426 #ifndef BCM_HIDE_DISPATCHABLE 1427 1428 /* Set or retrieve current vlan properties selectively. */ 1429 extern int bcm_vlan_control_vlan_selective_get( 1430 int unit, 1431 bcm_vlan_t vlan, 1432 uint32 valid_fields, 1433 bcm_vlan_control_vlan_t *control); 1434 1435 /* Set or retrieve current vlan properties selectively. */ 1436 extern int bcm_vlan_control_vlan_selective_set( 1437 int unit, 1438 bcm_vlan_t vlan, 1439 uint32 valid_fields, 1440 bcm_vlan_control_vlan_t *control); 1441 1442 /* Set or retrieve current vlan properties. */ 1443 extern int bcm_vlan_control_vlan_get( 1444 int unit, 1445 bcm_vlan_t vlan, 1446 bcm_vlan_control_vlan_t *control); 1447 1448 /* Set or retrieve current vlan properties. */ 1449 extern int bcm_vlan_control_vlan_set( 1450 int unit, 1451 bcm_vlan_t vlan, 1452 bcm_vlan_control_vlan_t control); 1453 1454 /* Set vlan_control_vlan flags over a vlan vector. */ 1455 extern int bcm_vlan_vector_flags_set( 1456 int unit, 1457 bcm_vlan_vector_t vlan_vector, 1458 uint32 flags_mask, 1459 uint32 flags_value); 1460 1461 #endif /* BCM_HIDE_DISPATCHABLE */ 1462 1463 /* This structure contains the configuration of a VLAN. */ 1464 typedef struct bcm_vlan_block_s { 1465 bcm_pbmp_t known_multicast; 1466 bcm_pbmp_t unknown_multicast; 1467 bcm_pbmp_t unknown_unicast; 1468 bcm_pbmp_t broadcast; 1469 } bcm_vlan_block_t; 1470 1471 /* Initialize the bcm_vlan_block_t structure. */ 1472 extern void bcm_vlan_block_t_init( 1473 bcm_vlan_block_t *data); 1474 1475 #ifndef BCM_HIDE_DISPATCHABLE 1476 1477 /* Retrieve vlan block properties. */ 1478 extern int bcm_vlan_block_get( 1479 int unit, 1480 bcm_vlan_t vlan, 1481 bcm_vlan_block_t *vlan_block); 1482 1483 /* Set vlan block properties. */ 1484 extern int bcm_vlan_block_set( 1485 int unit, 1486 bcm_vlan_t vlan, 1487 bcm_vlan_block_t *vlan_block); 1488 1489 #endif /* BCM_HIDE_DISPATCHABLE */ 1490 1491 /* Initialize a VLAN data information structure. */ 1492 extern void bcm_vlan_data_t_init( 1493 bcm_vlan_data_t *vlan_data); 1494 1495 #ifndef BCM_HIDE_DISPATCHABLE 1496 1497 /* bcm_vlan_cross_connect_add */ 1498 extern int bcm_vlan_cross_connect_add( 1499 int unit, 1500 bcm_vlan_t outer_vlan, 1501 bcm_vlan_t inner_vlan, 1502 bcm_gport_t port_1, 1503 bcm_gport_t port_2); 1504 1505 /* bcm_vlan_cross_connect_delete */ 1506 extern int bcm_vlan_cross_connect_delete( 1507 int unit, 1508 bcm_vlan_t outer_vlan, 1509 bcm_vlan_t inner_vlan); 1510 1511 /* bcm_vlan_cross_connect_delete_all */ 1512 extern int bcm_vlan_cross_connect_delete_all( 1513 int unit); 1514 1515 #endif /* BCM_HIDE_DISPATCHABLE */ 1516 1517 /* bcm_vlan_cross_connect_traverse_cb */ 1518 typedef int (*bcm_vlan_cross_connect_traverse_cb)( 1519 int unit, 1520 bcm_vlan_t outer_vlan, 1521 bcm_vlan_t inner_vlan, 1522 bcm_gport_t port_1, 1523 bcm_gport_t port_2, 1524 void *user_data); 1525 1526 #ifndef BCM_HIDE_DISPATCHABLE 1527 1528 /* bcm_vlan_cross_connect_traverse */ 1529 extern int bcm_vlan_cross_connect_traverse( 1530 int unit, 1531 bcm_vlan_cross_connect_traverse_cb cb, 1532 void *user_data); 1533 1534 #endif /* BCM_HIDE_DISPATCHABLE */ 1535 1536 /* Types of statistics that are maintained per VLAN. */ 1537 typedef enum bcm_vlan_stat_e { 1538 bcmVlanStatPackets = 0, /* Packets that have hit the VLAN 1539 (forward/drop, L2/L3, 1540 unicast/multicast/broadcast/flood) */ 1541 bcmVlanStatIngressPackets = bcmVlanStatPackets, /* Packets that ingress on the VLAN */ 1542 bcmVlanStatBytes = 1, /* Bytes that have hit the VLAN 1543 (forward/drop, L2/L3, 1544 unicast/multicast/broadcast/flood) */ 1545 bcmVlanStatIngressBytes = bcmVlanStatBytes, /* Bytes that ingress on the VLAN */ 1546 bcmVlanStatEgressPackets = 2, /* Packets that egress on the VLAN */ 1547 bcmVlanStatEgressBytes = 3, /* Bytes that egress on the VLAN */ 1548 bcmVlanStatForwardedPackets = 4, /* Packets forwarded on the VLAN (L2/L3, 1549 unicast/multicast/broadcast/flood) */ 1550 bcmVlanStatForwardedBytes = 5, /* Bytes forwarded on the VLAN (L2/L3, 1551 unicast/multicast/broadcast/flood) */ 1552 bcmVlanStatDropPackets = 6, /* Packets dropped on the VLAN (L2/L3, 1553 unicast/multicast/broadcast/flood) */ 1554 bcmVlanStatDropBytes = 7, /* Bytes dropped on the VLAN (L2/L3, 1555 unicast/multicast/broadcast/flood) */ 1556 bcmVlanStatUnicastPackets = 8, /* L2 unicast packets forwarded on the 1557 VLAN */ 1558 bcmVlanStatUnicastBytes = 9, /* L2 unicast bytes forwarded on the 1559 VLAN */ 1560 bcmVlanStatUnicastDropPackets = 10, /* L2 unicast packets dropped on the 1561 VLAN */ 1562 bcmVlanStatUnicastDropBytes = 11, /* L2 unicast bytes dropped on the VLAN */ 1563 bcmVlanStatNonUnicastPackets = 12, /* L2 multicast packets forwarded on the 1564 VLAN */ 1565 bcmVlanStatNonUnicastBytes = 13, /* L2 multicast bytes forwarded on the 1566 VLAN */ 1567 bcmVlanStatNonUnicastDropPackets = 14, /* L2 non-unicast packets dropped on the 1568 VLAN */ 1569 bcmVlanStatNonUnicastDropBytes = 15, /* L2 non-unicast bytes dropped on the 1570 VLAN */ 1571 bcmVlanStatL3Packets = 16, /* Packets delivered to L3 for 1572 forwarding on the VLAN */ 1573 bcmVlanStatL3Bytes = 17, /* Bytes delivered to L3 for forwarding 1574 on the VLAN */ 1575 bcmVlanStatL3DropPackets = 18, /* Packets delivered to L3 for dropping 1576 on the VLAN */ 1577 bcmVlanStatL3DropBytes = 19, /* Bytes delivered to L3 for dropping on 1578 the VLAN */ 1579 bcmVlanStatFloodPackets = 20, /* L2 flood packets forwarded on the 1580 VLAN */ 1581 bcmVlanStatFloodBytes = 21, /* L2 flood bytes forwarded on the VLAN */ 1582 bcmVlanStatFloodDropPackets = 22, /* L2 flood packets dropped on the VLAN */ 1583 bcmVlanStatFloodDropBytes = 23, /* L2 flood bytes dropped on the VLAN */ 1584 bcmVlanStatGreenPackets = 24, /* Green packets forwarded on the VLAN */ 1585 bcmVlanStatGreenBytes = 25, /* Green bytes forwarded on the VLAN */ 1586 bcmVlanStatYellowPackets = 26, /* Yellow packets forwarded on the VLAN */ 1587 bcmVlanStatYellowBytes = 27, /* Yellow bytes forwared on the VLAN */ 1588 bcmVlanStatRedPackets = 28, /* Red packets forwarded on the VLAN */ 1589 bcmVlanStatRedBytes = 29, /* Red bytes forwarded on the VLAN */ 1590 bcmVlanStatCount = 30 /* Always last. Not a usable value. */ 1591 } bcm_vlan_stat_t; 1592 1593 #ifndef BCM_HIDE_DISPATCHABLE 1594 1595 /* Extract per-VLAN statistics from the chip. */ 1596 extern int bcm_vlan_stat_get( 1597 int unit, 1598 bcm_vlan_t vlan, 1599 bcm_cos_t cos, 1600 bcm_vlan_stat_t stat, 1601 uint64 *val); 1602 1603 /* Extract per-VLAN statistics from the chip. */ 1604 extern int bcm_vlan_stat_sync_get( 1605 int unit, 1606 bcm_vlan_t vlan, 1607 bcm_cos_t cos, 1608 bcm_vlan_stat_t stat, 1609 uint64 *val); 1610 1611 /* Extract per-VLAN statistics from the chip. */ 1612 extern int bcm_vlan_stat_get32( 1613 int unit, 1614 bcm_vlan_t vlan, 1615 bcm_cos_t cos, 1616 bcm_vlan_stat_t stat, 1617 uint32 *val); 1618 1619 /* Extract per-VLAN statistics from the chip. */ 1620 extern int bcm_vlan_stat_sync_get32( 1621 int unit, 1622 bcm_vlan_t vlan, 1623 bcm_cos_t cos, 1624 bcm_vlan_stat_t stat, 1625 uint32 *val); 1626 1627 /* 1628 * Set the specified statistic to the indicated value for the specified 1629 * VLAN. 1630 */ 1631 extern int bcm_vlan_stat_set( 1632 int unit, 1633 bcm_vlan_t vlan, 1634 bcm_cos_t cos, 1635 bcm_vlan_stat_t stat, 1636 uint64 val); 1637 1638 /* 1639 * Set the specified statistic to the indicated value for the specified 1640 * VLAN. 1641 */ 1642 extern int bcm_vlan_stat_set32( 1643 int unit, 1644 bcm_vlan_t vlan, 1645 bcm_cos_t cos, 1646 bcm_vlan_stat_t stat, 1647 uint32 val); 1648 1649 /* Provide stat counter ids associated with given vlan */ 1650 extern int bcm_vlan_stat_id_get( 1651 int unit, 1652 bcm_vlan_t vlan, 1653 bcm_vlan_stat_t stat, 1654 uint32 *stat_counter_id); 1655 1656 /* Enable/disable collection of statistics on the indicated VLAN. */ 1657 extern int bcm_vlan_stat_enable_set( 1658 int unit, 1659 bcm_vlan_t vlan, 1660 int enable); 1661 1662 /* Get 64-bit counter value for multiple VLAN statistic types. */ 1663 extern int bcm_vlan_stat_multi_get( 1664 int unit, 1665 bcm_vlan_t vlan, 1666 bcm_cos_t cos, 1667 int nstat, 1668 bcm_vlan_stat_t *stat_arr, 1669 uint64 *value_arr); 1670 1671 /* Get lower 32-bit counter value for multiple VLAN statistic types. */ 1672 extern int bcm_vlan_stat_multi_get32( 1673 int unit, 1674 bcm_vlan_t vlan, 1675 bcm_cos_t cos, 1676 int nstat, 1677 bcm_vlan_stat_t *stat_arr, 1678 uint32 *value_arr); 1679 1680 /* Set 64-bit counter value for multiple VLAN statistic types. */ 1681 extern int bcm_vlan_stat_multi_set( 1682 int unit, 1683 bcm_vlan_t vlan, 1684 bcm_cos_t cos, 1685 int nstat, 1686 bcm_vlan_stat_t *stat_arr, 1687 uint64 *value_arr); 1688 1689 /* Set lower 32-bit counter value for multiple VLAN statistic types. */ 1690 extern int bcm_vlan_stat_multi_set32( 1691 int unit, 1692 bcm_vlan_t vlan, 1693 bcm_cos_t cos, 1694 int nstat, 1695 bcm_vlan_stat_t *stat_arr, 1696 uint32 *value_arr); 1697 1698 /* Extract ingress VLAN translation statistics from the chip. */ 1699 extern int bcm_vlan_translate_stat_get( 1700 int unit, 1701 bcm_gport_t port, 1702 bcm_vlan_translate_key_t key_type, 1703 bcm_vlan_t outer_vlan, 1704 bcm_vlan_t inner_vlan, 1705 bcm_vlan_stat_t stat, 1706 uint64 *val); 1707 1708 /* Extract ingress VLAN translation statistics from the chip. */ 1709 extern int bcm_vlan_translate_stat_sync_get( 1710 int unit, 1711 bcm_gport_t port, 1712 bcm_vlan_translate_key_t key_type, 1713 bcm_vlan_t outer_vlan, 1714 bcm_vlan_t inner_vlan, 1715 bcm_vlan_stat_t stat, 1716 uint64 *val); 1717 1718 /* Extract ingress VLAN translation statistics from the chip. */ 1719 extern int bcm_vlan_translate_stat_get32( 1720 int unit, 1721 bcm_gport_t port, 1722 bcm_vlan_translate_key_t key_type, 1723 bcm_vlan_t outer_vlan, 1724 bcm_vlan_t inner_vlan, 1725 bcm_vlan_stat_t stat, 1726 uint32 *val); 1727 1728 /* Extract ingress VLAN translation statistics from the chip. */ 1729 extern int bcm_vlan_translate_stat_sync_get32( 1730 int unit, 1731 bcm_gport_t port, 1732 bcm_vlan_translate_key_t key_type, 1733 bcm_vlan_t outer_vlan, 1734 bcm_vlan_t inner_vlan, 1735 bcm_vlan_stat_t stat, 1736 uint32 *val); 1737 1738 /* 1739 * Provide stat counter ids associated with given ingress vlan translate 1740 * table 1741 */ 1742 extern int bcm_vlan_translate_stat_id_get( 1743 int unit, 1744 bcm_gport_t port, 1745 bcm_vlan_translate_key_t key_type, 1746 bcm_vlan_t outer_vlan, 1747 bcm_vlan_t inner_vlan, 1748 bcm_vlan_stat_t stat, 1749 uint32 *stat_counter_id); 1750 1751 /* 1752 * Set the specified statistic to the indicated value for the specified 1753 * ingress VLAN translation. 1754 */ 1755 extern int bcm_vlan_translate_stat_set( 1756 int unit, 1757 bcm_gport_t port, 1758 bcm_vlan_translate_key_t key_type, 1759 bcm_vlan_t outer_vlan, 1760 bcm_vlan_t inner_vlan, 1761 bcm_vlan_stat_t stat, 1762 uint64 val); 1763 1764 /* 1765 * Set the specified statistic to the indicated value for the specified 1766 * ingress VLAN translation. 1767 */ 1768 extern int bcm_vlan_translate_stat_set32( 1769 int unit, 1770 bcm_gport_t port, 1771 bcm_vlan_translate_key_t key_type, 1772 bcm_vlan_t outer_vlan, 1773 bcm_vlan_t inner_vlan, 1774 bcm_vlan_stat_t stat, 1775 uint32 val); 1776 1777 /* 1778 * Enable/disable collection of statistics on the indicated ingress VLAN 1779 * translation. 1780 */ 1781 extern int bcm_vlan_translate_stat_enable_set( 1782 int unit, 1783 bcm_gport_t port, 1784 bcm_vlan_translate_key_t key_type, 1785 bcm_vlan_t outer_vlan, 1786 bcm_vlan_t inner_vlan, 1787 int enable); 1788 1789 /* 1790 * Get 64-bit counter value for multiple ingress VLAN translation 1791 * statistic types. 1792 */ 1793 extern int bcm_vlan_translate_stat_multi_get( 1794 int unit, 1795 bcm_gport_t port, 1796 bcm_vlan_translate_key_t key_type, 1797 bcm_vlan_t outer_vlan, 1798 bcm_vlan_t inner_vlan, 1799 int nstat, 1800 bcm_vlan_stat_t *stat_arr, 1801 uint64 *value_arr); 1802 1803 /* 1804 * Get lower 32-bit counter value for multiple ingress VLAN translation 1805 * statistic types. 1806 */ 1807 extern int bcm_vlan_translate_stat_multi_get32( 1808 int unit, 1809 bcm_gport_t port, 1810 bcm_vlan_translate_key_t key_type, 1811 bcm_vlan_t outer_vlan, 1812 bcm_vlan_t inner_vlan, 1813 int nstat, 1814 bcm_vlan_stat_t *stat_arr, 1815 uint32 *value_arr); 1816 1817 /* 1818 * Set 64-bit counter value for multiple ingress VLAN translation 1819 * statistic types. 1820 */ 1821 extern int bcm_vlan_translate_stat_multi_set( 1822 int unit, 1823 bcm_gport_t port, 1824 bcm_vlan_translate_key_t key_type, 1825 bcm_vlan_t outer_vlan, 1826 bcm_vlan_t inner_vlan, 1827 int nstat, 1828 bcm_vlan_stat_t *stat_arr, 1829 uint64 *value_arr); 1830 1831 /* 1832 * Set lower 32-bit counter value for multiple ingress VLAN translation 1833 * statistic types. 1834 */ 1835 extern int bcm_vlan_translate_stat_multi_set32( 1836 int unit, 1837 bcm_gport_t port, 1838 bcm_vlan_translate_key_t key_type, 1839 bcm_vlan_t outer_vlan, 1840 bcm_vlan_t inner_vlan, 1841 int nstat, 1842 bcm_vlan_stat_t *stat_arr, 1843 uint32 *value_arr); 1844 1845 /* Extract egress VLAN translation statistics from the chip. */ 1846 extern int bcm_vlan_translate_egress_stat_get( 1847 int unit, 1848 int port_class, 1849 bcm_vlan_t outer_vlan, 1850 bcm_vlan_t inner_vlan, 1851 bcm_vlan_stat_t stat, 1852 uint64 *val); 1853 1854 /* Extract egress VLAN translation statistics from the chip. */ 1855 extern int bcm_vlan_translate_egress_stat_sync_get( 1856 int unit, 1857 int port_class, 1858 bcm_vlan_t outer_vlan, 1859 bcm_vlan_t inner_vlan, 1860 bcm_vlan_stat_t stat, 1861 uint64 *val); 1862 1863 /* Extract egress VLAN translation statistics from the chip. */ 1864 extern int bcm_vlan_translate_egress_stat_get32( 1865 int unit, 1866 int port_class, 1867 bcm_vlan_t outer_vlan, 1868 bcm_vlan_t inner_vlan, 1869 bcm_vlan_stat_t stat, 1870 uint32 *val); 1871 1872 /* Extract egress VLAN translation statistics from the chip. */ 1873 extern int bcm_vlan_translate_egress_stat_sync_get32( 1874 int unit, 1875 int port_class, 1876 bcm_vlan_t outer_vlan, 1877 bcm_vlan_t inner_vlan, 1878 bcm_vlan_stat_t stat, 1879 uint32 *val); 1880 1881 /* 1882 * Provide stat counter ids associated with given egress vlan translate 1883 * table 1884 */ 1885 extern int bcm_vlan_translate_egress_stat_id_get( 1886 int unit, 1887 int port_class, 1888 bcm_vlan_t outer_vlan, 1889 bcm_vlan_t inner_vlan, 1890 bcm_vlan_stat_t stat, 1891 uint32 *stat_counter_id); 1892 1893 /* 1894 * Set the specified statistic to the indicated value for the specified 1895 * egress VLAN translation. 1896 */ 1897 extern int bcm_vlan_translate_egress_stat_set( 1898 int unit, 1899 int port_class, 1900 bcm_vlan_t outer_vlan, 1901 bcm_vlan_t inner_vlan, 1902 bcm_vlan_stat_t stat, 1903 uint64 val); 1904 1905 /* 1906 * Set the specified statistic to the indicated value for the specified 1907 * egress VLAN translation. 1908 */ 1909 extern int bcm_vlan_translate_egress_stat_set32( 1910 int unit, 1911 int port_class, 1912 bcm_vlan_t outer_vlan, 1913 bcm_vlan_t inner_vlan, 1914 bcm_vlan_stat_t stat, 1915 uint32 val); 1916 1917 /* 1918 * Enable/disable collection of statistics on the indicated egress VLAN 1919 * translation. 1920 */ 1921 extern int bcm_vlan_translate_egress_stat_enable_set( 1922 int unit, 1923 int port_class, 1924 bcm_vlan_t outer_vlan, 1925 bcm_vlan_t inner_vlan, 1926 int enable); 1927 1928 /* 1929 * Get 64-bit counter value for multiple egress VLAN translation 1930 * statistic types. 1931 */ 1932 extern int bcm_vlan_translate_egress_stat_multi_get( 1933 int unit, 1934 int port_class, 1935 bcm_vlan_t outer_vlan, 1936 bcm_vlan_t inner_vlan, 1937 int nstat, 1938 bcm_vlan_stat_t *stat_arr, 1939 uint64 *value_arr); 1940 1941 /* 1942 * Get lower 32-bit counter value for multiple egress VLAN translation 1943 * statistic types. 1944 */ 1945 extern int bcm_vlan_translate_egress_stat_multi_get32( 1946 int unit, 1947 int port_class, 1948 bcm_vlan_t outer_vlan, 1949 bcm_vlan_t inner_vlan, 1950 int nstat, 1951 bcm_vlan_stat_t *stat_arr, 1952 uint32 *value_arr); 1953 1954 /* 1955 * Set 64-bit counter value for multiple egress VLAN translation 1956 * statistic types. 1957 */ 1958 extern int bcm_vlan_translate_egress_stat_multi_set( 1959 int unit, 1960 int port_class, 1961 bcm_vlan_t outer_vlan, 1962 bcm_vlan_t inner_vlan, 1963 int nstat, 1964 bcm_vlan_stat_t *stat_arr, 1965 uint64 *value_arr); 1966 1967 /* 1968 * Set lower 32-bit counter value for multiple egress VLAN translation 1969 * statistic types. 1970 */ 1971 extern int bcm_vlan_translate_egress_stat_multi_set32( 1972 int unit, 1973 int port_class, 1974 bcm_vlan_t outer_vlan, 1975 bcm_vlan_t inner_vlan, 1976 int nstat, 1977 bcm_vlan_stat_t *stat_arr, 1978 uint32 *value_arr); 1979 1980 /* 1981 * Get 64-bit counter value for multiple GPORT or VLAN/port statistic 1982 * types. 1983 */ 1984 extern int bcm_vlan_port_stat_multi_get( 1985 int unit, 1986 bcm_vlan_t vlan, 1987 bcm_port_t port, 1988 bcm_cos_t cos, 1989 int nstat, 1990 bcm_vlan_stat_t *stat_arr, 1991 uint64 *value_arr); 1992 1993 /* 1994 * Get 32-bit counter value for multiple GPORT or VLAN/port statistic 1995 * types. 1996 */ 1997 extern int bcm_vlan_port_stat_multi_get32( 1998 int unit, 1999 bcm_vlan_t vlan, 2000 bcm_port_t port, 2001 bcm_cos_t cos, 2002 int nstat, 2003 bcm_vlan_stat_t *stat_arr, 2004 uint32 *value_arr); 2005 2006 /* Retrieve the Policer ID accociated with the specified VLAN. */ 2007 extern int bcm_vlan_policer_get( 2008 int unit, 2009 bcm_vlan_t vlan, 2010 bcm_policer_t *policer_id); 2011 2012 /* Set the Policer ID accociated with the specified VLAN. */ 2013 extern int bcm_vlan_policer_set( 2014 int unit, 2015 bcm_vlan_t vlan, 2016 bcm_policer_t policer_id); 2017 2018 /* 2019 * set 64-bit counter value for multiple GPORT or VLAN/port statistic 2020 * types. 2021 */ 2022 extern int bcm_vlan_port_stat_multi_set( 2023 int unit, 2024 bcm_vlan_t vlan, 2025 bcm_port_t port, 2026 bcm_cos_t cos, 2027 int nstat, 2028 bcm_vlan_stat_t *stat_arr, 2029 uint64 *value_arr); 2030 2031 /* 2032 * set 32-bit counter value for multiple GPORT or VLAN/port statistic 2033 * types. 2034 */ 2035 extern int bcm_vlan_port_stat_multi_set32( 2036 int unit, 2037 bcm_vlan_t vlan, 2038 bcm_port_t port, 2039 bcm_cos_t cos, 2040 int nstat, 2041 bcm_vlan_stat_t *stat_arr, 2042 uint32 *value_arr); 2043 2044 #endif /* BCM_HIDE_DISPATCHABLE */ 2045 2046 /* Flags for logical layer 2 port. */ 2047 #define BCM_VLAN_PORT_REPLACE 0x00000001 /* Replace existing 2048 entry. */ 2049 #define BCM_VLAN_PORT_WITH_ID 0x00000002 /* Add using the 2050 specified ID. */ 2051 #define BCM_VLAN_PORT_INNER_VLAN_PRESERVE 0x00000004 /* Preserve the inner 2052 VLAN tag (by default 2053 it is stripped). */ 2054 #define BCM_VLAN_PORT_INNER_VLAN_ADD 0x00000008 /* Add the port vid to 2055 untagged and 2056 pri-tagged packets. */ 2057 #define BCM_VLAN_PORT_EGRESS_UNTAGGED 0x00000010 /* Indicates tag is 2058 stripped on logical 2059 port egress */ 2060 #define BCM_VLAN_PORT_EGRESS_VLAN16 0x00000020 /* Indicates a 16-bit 2061 VLAN tag (not the 2062 default 3-bit 2063 priority, 1-bit CFI, 2064 and 12-bit VLAN tag) 2065 is added on logical 2066 port egress */ 2067 #define BCM_VLAN_PORT_ENCAP_WITH_ID 0x00000040 /* Use the specified 2068 encap id to allocate 2069 and setup 2070 encapsulation. */ 2071 #define BCM_VLAN_PORT_NETWORK 0x00000080 /* Core facing vlan port. 2072 This is used for 2073 split-horizon checks. 2074 Packets forwarded from 2075 core-facing port to 2076 another core-facing 2077 port is discarded. */ 2078 #define BCM_VLAN_PORT_OUTER_VLAN_PRESERVE 0x00000100 /* Preserve the outer 2079 VLAN tag (by default 2080 it is stripped). */ 2081 #define BCM_VLAN_PORT_EXTENDED 0x00000200 /* Use the extended P2P 2082 service. */ 2083 #define BCM_VLAN_PORT_TRANSPARENT 0x00000400 /* Use the transparent 2084 mode to pass through 2085 traffic from PON port 2086 to NNI port. */ 2087 #define BCM_VLAN_PORT_CREATE_INGRESS_ONLY 0x00000800 /* Indicates Ingress 2088 settings */ 2089 #define BCM_VLAN_PORT_CREATE_EGRESS_ONLY 0x00001000 /* Indicates Egress 2090 settings */ 2091 #define BCM_VLAN_PORT_LOCAL_PROTECTION 0x00002000 /* Local protection 2092 according to link 2093 status */ 2094 #define BCM_VLAN_PORT_FORWARD_GROUP 0x00004000 /* Use forwarding group */ 2095 #define BCM_VLAN_PORT_EGRESS_PROTECTION 0x00008000 /* Egress Protection 2096 object */ 2097 #define BCM_VLAN_PORT_VSI_BASE_VID 0x00010000 /* VSI assignment 2098 mode.VSI equal to VSI 2099 in LIF table + VID */ 2100 #define BCM_VLAN_PORT_CASCADED 0x00020000 /* Creates a VLAN port 2101 object of type FEC 2102 that is pointed by 2103 another VLAN port 2104 object */ 2105 #define BCM_VLAN_PORT_INGRESS_WIDE 0x00040000 /* Creates a wide ingress 2106 lif that can hold 2107 user's data. */ 2108 #define BCM_VLAN_PORT_VLAN_TRANSLATION 0x00080000 /* Creates a vlan 2109 translation only 2110 egress lif. */ 2111 #define BCM_VLAN_PORT_EGRESS_PON_TUNNEL_NONE 0x00100000 /* This flag indicates 2112 that LLTAG is not 2113 added when a packet 2114 egress out from this 2115 VLAN port. */ 2116 #define BCM_VLAN_PORT_NATIVE 0x00200000 /* Creates a native vlan 2117 port. */ 2118 #define BCM_VLAN_PORT_DEFAULT 0x00400000 /* Creates default vlan 2119 editing object. */ 2120 #define BCM_VLAN_PORT_CROSS_CONNECT 0x00800000 /* Creates a P2P vlan 2121 port. */ 2122 #define BCM_VLAN_PORT_USE_SGLP_TPID 0x01000000 /* Use TPID based on 2123 Source global logical 2124 port (SGLP) for 2125 parsing the packet. */ 2126 #define BCM_VLAN_PORT_EGRESS_ARP_POINTED 0x02000000 /* Create an ARP pointed 2127 vlan port. */ 2128 #define BCM_VLAN_PORT_STAT_INGRESS_ENABLE 0x04000000 /* Enable statistics on 2129 ingress side. */ 2130 #define BCM_VLAN_PORT_STAT_EGRESS_ENABLE 0x08000000 /* Enable statistics on 2131 egress side. */ 2132 #define BCM_VLAN_PORT_ALLOC_SYMMETRIC 0x10000000 /* Indicate that VLAN 2133 Port ID allocation 2134 (ingress or egress) 2135 will return a GPORT 2136 which is free in both 2137 ingress and egress. */ 2138 2139 /* Logical layer 2 port match criteria */ 2140 typedef enum bcm_vlan_port_match_e { 2141 BCM_VLAN_PORT_MATCH_INVALID = 0, /* Illegal. */ 2142 BCM_VLAN_PORT_MATCH_NONE = 1, /* No source match criteria. */ 2143 BCM_VLAN_PORT_MATCH_PORT = 2, /* {Module, Port} or Trunk. */ 2144 BCM_VLAN_PORT_MATCH_PORT_VLAN = 3, /* Mod/port/trunk + outer VLAN or SVLAN. */ 2145 BCM_VLAN_PORT_MATCH_PORT_VLAN_STACKED = 4, /* Mod/port/trunk + outer/inner VLAN. */ 2146 BCM_VLAN_PORT_MATCH_PORT_VLAN16 = 5, /* Mod/port/trunk + 16-bit outer VLAN 2147 tag. */ 2148 BCM_VLAN_PORT_MATCH_PORT_PCP_VLAN = 6, /* Mod/port/trunk + outer VLAN + outer 2149 PCP. */ 2150 BCM_VLAN_PORT_MATCH_PORT_PCP_VLAN_STACKED = 7, /* Mod/port/trunk + outer/inner VLAN + 2151 outer/inner PCP. */ 2152 BCM_VLAN_PORT_MATCH_PORT_INITIAL_VLAN = 8, /* Mod/port/trunk + Initial-VID */ 2153 BCM_VLAN_PORT_MATCH_PORT_TUNNEL = 9, /* Mod/port/trunk + Tunnel Value. */ 2154 BCM_VLAN_PORT_MATCH_PORT_TUNNEL_VLAN = 10, /* Mod/port/trunk + Tunnel Value + outer 2155 VLAN. */ 2156 BCM_VLAN_PORT_MATCH_PORT_TUNNEL_VLAN_STACKED = 11, /* Mod/port/trunk + Tunnel Value + outer 2157 VLAN + inner VLAN. */ 2158 BCM_VLAN_PORT_MATCH_PORT_TUNNEL_PCP_VLAN = 12, /* Mod/port/trunk + Tunnel Value + outer 2159 PCP + outer VLAN. */ 2160 BCM_VLAN_PORT_MATCH_PORT_TUNNEL_PCP_VLAN_STACKED = 13, /* Mod/port/trunk + Tunnel Value + outer 2161 PCP + outer VLAN + inner VLAN. */ 2162 BCM_VLAN_PORT_MATCH_PORT_TUNNEL_PCP_VLAN_ETHERTYPE = 14, /* Mod/port/trunk + Tunnel Value + Outer 2163 PCP + outer VLAN + Ethertype. */ 2164 BCM_VLAN_PORT_MATCH_PORT_TUNNEL_PCP_VLAN_VLAN_ETHERTYPE = 15, /* Mod/port/trunk + Tunnel Value + Outer 2165 PCP + outer VLAN + Inner VLAN + 2166 Ethertype. */ 2167 BCM_VLAN_PORT_MATCH_PORT_TUNNEL_ETHERTYPE = 16, /* Mod/port/trunk + Tunnel Value + 2168 Ethertype. */ 2169 BCM_VLAN_PORT_MATCH_PORT_TUNNEL_VLAN_ETHERTYPE = 17, /* Mod/port/trunk + Tunnel Value + outer 2170 VLAN + Ethertype. */ 2171 BCM_VLAN_PORT_MATCH_PORT_TUNNEL_VLAN_STACKED_ETHERTYPE = 18, /* Mod/port/trunk + Tunnel Value + outer 2172 VLAN + inner VLAN + Ethertype. */ 2173 BCM_VLAN_PORT_MATCH_PORT_TUNNEL_PCP = 19, /* Mod/port/trunk + Tunnel Value + outer 2174 PCP. */ 2175 BCM_VLAN_PORT_MATCH_PORT_UNTAGGED = 20, /* Mod/port/trunk for untagged packets. */ 2176 BCM_VLAN_PORT_MATCH_PORT_PON_TUNNEL = 21, /* Mod/port/trunk + LLTAG VLAN ID[11:0]. */ 2177 BCM_VLAN_PORT_MATCH_PORT_PON_TUNNEL_VLAN = 22, /* Mod/port/trunk + LLTAG VLAN ID[11:0] 2178 + Outer VLAN. */ 2179 BCM_VLAN_PORT_MATCH_PORT_PON_TUNNEL_INNER_VLAN = 23, /* Mod/port/trunk + LLTAG VLAN ID[11:0] 2180 + Inner VLAN. */ 2181 BCM_VLAN_PORT_MATCH_PORT_INNER_VLAN = 24, /* Mod/port/trunk + Inner VLAN. */ 2182 BCM_VLAN_PORT_MATCH_PORT_INNER_VLAN16 = 25, /* Mod/port/trunk + 16-bit Inner VLAN 2183 tag. */ 2184 BCM_VLAN_PORT_MATCH_PORT_CVLAN = 26, /* Mod/port/trunk + CVLAN. */ 2185 BCM_VLAN_PORT_MATCH_NAMESPACE_VSI = 27, /* Namespace + VSI. */ 2186 BCM_VLAN_PORT_MATCH_NAMESPACE_PORT = 28, /* Namespace + port. */ 2187 BCM_VLAN_PORT_MATCH_PORT_SVLAN_STACKED = 29, /* Mod/port/trunk + outer/inner both 2188 SVLAN. */ 2189 BCM_VLAN_PORT_MATCH_PORT_CVLAN_STACKED = 30, /* Mod/port/trunk + outer/inner both 2190 CVLAN. */ 2191 BCM_VLAN_PORT_MATCH_COUNT = 31 /* Must be last. */ 2192 } bcm_vlan_port_match_t; 2193 2194 /* Layer 2 Logical port type */ 2195 typedef struct bcm_vlan_port_s { 2196 bcm_vlan_port_match_t criteria; /* Match criteria. */ 2197 uint32 flags; /* BCM_VLAN_PORT_xxx. */ 2198 bcm_vlan_t vsi; /* Populated for bcm_vlan_port_find only */ 2199 bcm_vlan_t match_vlan; /* Outer VLAN ID to match. */ 2200 bcm_vlan_t match_inner_vlan; /* Inner VLAN ID to match. */ 2201 int match_pcp; /* Outer PCP ID to match. */ 2202 bcm_tunnel_id_t match_tunnel_value; /* Tunnel value to match. */ 2203 bcm_port_ethertype_t match_ethertype; /* Ethernet type value to match. */ 2204 bcm_gport_t port; /* Gport: local or remote Physical or 2205 logical gport. */ 2206 uint8 pkt_pri; /* Service tag priority. */ 2207 uint8 pkt_cfi; /* Service tag cfi. */ 2208 uint16 egress_service_tpid; /* Service VLAN TPID value. */ 2209 bcm_vlan_t egress_vlan; /* Egress Outer VLAN or SD-TAG VLAN ID. */ 2210 bcm_vlan_t egress_inner_vlan; /* Egress Inner VLAN. */ 2211 bcm_tunnel_id_t egress_tunnel_value; /* Egress Tunnel value. */ 2212 bcm_if_t encap_id; /* Encapsulation Index. */ 2213 int qos_map_id; /* QoS Map Index. */ 2214 bcm_policer_t policer_id; /* Policer ID */ 2215 bcm_policer_t egress_policer_id; /* Egress Policer ID */ 2216 bcm_failover_t failover_id; /* Failover Object Index. */ 2217 bcm_gport_t failover_port_id; /* Failover VLAN Port Identifier. */ 2218 bcm_gport_t vlan_port_id; /* GPORT identifier */ 2219 bcm_multicast_t failover_mc_group; /* MC group used for bi-cast. */ 2220 bcm_failover_t ingress_failover_id; /* 1+1 protection. */ 2221 bcm_failover_t egress_failover_id; /* Failover object index for Egress 2222 Protection */ 2223 bcm_gport_t egress_failover_port_id; /* Failover VLAN Port Identifier for 2224 Egress Protection */ 2225 bcm_switch_network_group_t ingress_network_group_id; /* Split Horizon ingress network group 2226 identifier */ 2227 bcm_switch_network_group_t egress_network_group_id; /* Split Horizon egress network group 2228 identifier */ 2229 int inlif_counting_profile; /* In LIF counting profile */ 2230 int outlif_counting_profile; /* Out LIF counting profile */ 2231 uint32 if_class; /* Egress Interface class ID */ 2232 bcm_gport_t tunnel_id; /* Pointer from Native AC to next entry 2233 in EEDB list. */ 2234 uint32 group; /* flush group id to be used by l2 flush 2235 mechanism */ 2236 bcm_gport_t ingress_failover_port_id; /* Failover VLAN Port Identifier for 2237 ingress Protection. */ 2238 uint32 match_class_id; /* Match Namespace. */ 2239 bcm_qos_ingress_model_t ingress_qos_model; /* ingress qos and ttl model */ 2240 bcm_qos_egress_model_t egress_qos_model; /* egress qos and ttl model */ 2241 } bcm_vlan_port_t; 2242 2243 /* Initialize the VLAN port structure. */ 2244 extern void bcm_vlan_port_t_init( 2245 bcm_vlan_port_t *vlan_port); 2246 2247 #ifndef BCM_HIDE_DISPATCHABLE 2248 2249 /* 2250 * Create a layer 2 logical port. Places the ID in the logical port 2251 * descriptor if WITH_ID flag is not provided, uses the ID in the logical 2252 * port descriptor if WITH_ID flag specified. 2253 */ 2254 extern int bcm_vlan_port_create( 2255 int unit, 2256 bcm_vlan_port_t *vlan_port); 2257 2258 /* Destroy a layer 2 logical port. */ 2259 extern int bcm_vlan_port_destroy( 2260 int unit, 2261 bcm_gport_t gport); 2262 2263 /* Get/find a layer 2 logical port given the GPORT id or match criteria. */ 2264 extern int bcm_vlan_port_find( 2265 int unit, 2266 bcm_vlan_port_t *vlan_port); 2267 2268 #endif /* BCM_HIDE_DISPATCHABLE */ 2269 2270 /* bcm_vlan_port_translation_s */ 2271 typedef struct bcm_vlan_port_translation_s { 2272 uint32 flags; /* BCM_VLAN_ACTION_SET_XXX */ 2273 bcm_gport_t gport; /* gport ID */ 2274 uint32 new_outer_vlan; /* New outer VLAN ID to use in vlan translation */ 2275 uint32 new_inner_vlan; /* New inner VLAN ID to use in vlan translation */ 2276 uint32 vlan_edit_class_id; /* VLAN editing profile */ 2277 } bcm_vlan_port_translation_t; 2278 2279 /* Initialize the VLAN port translation structure */ 2280 extern void bcm_vlan_port_translation_t_init( 2281 bcm_vlan_port_translation_t *vlan_port_translation); 2282 2283 #ifndef BCM_HIDE_DISPATCHABLE 2284 2285 /* Set translation information for a vlan port */ 2286 extern int bcm_vlan_port_translation_set( 2287 int unit, 2288 bcm_vlan_port_translation_t *vlan_port_translation); 2289 2290 /* Get translation information from a vlan port */ 2291 extern int bcm_vlan_port_translation_get( 2292 int unit, 2293 bcm_vlan_port_translation_t *vlan_port_translation); 2294 2295 #endif /* BCM_HIDE_DISPATCHABLE */ 2296 2297 /* Flags for bcm_vlan_queue_map_create(). */ 2298 #define BCM_VLAN_QUEUE_MAP_WITH_ID 0x0001 2299 #define BCM_VLAN_QUEUE_MAP_REPLACE 0x0002 2300 #define BCM_VLAN_QUEUE_MAP_INNER_PKT_PRI 0x0004 2301 #define BCM_VLAN_QUEUE_MAP_OUTER_PKT_PRI 0x0008 2302 2303 #ifndef BCM_HIDE_DISPATCHABLE 2304 2305 /* Create a VLAN queue map entry. */ 2306 extern int bcm_vlan_queue_map_create( 2307 int unit, 2308 uint32 flags, 2309 int *qmid); 2310 2311 /* Delete a VLAN queue map entry. */ 2312 extern int bcm_vlan_queue_map_destroy( 2313 int unit, 2314 int qmid); 2315 2316 /* Delete all VLAN queue map entries. */ 2317 extern int bcm_vlan_queue_map_destroy_all( 2318 int unit); 2319 2320 /* Set a VLAN queue map entry. */ 2321 extern int bcm_vlan_queue_map_set( 2322 int unit, 2323 int qmid, 2324 int pkt_pri, 2325 int cfi, 2326 int queue, 2327 int color); 2328 2329 /* Get a VLAN queue map entry. */ 2330 extern int bcm_vlan_queue_map_get( 2331 int unit, 2332 int qmid, 2333 int pkt_pri, 2334 int cfi, 2335 int *queue, 2336 int *color); 2337 2338 /* Attach a queue map object to a VLAN or VFI. */ 2339 extern int bcm_vlan_queue_map_attach( 2340 int unit, 2341 bcm_vlan_t vlan, 2342 int qmid); 2343 2344 /* Get the queue map object which is attached to a VLAN or VFI. */ 2345 extern int bcm_vlan_queue_map_attach_get( 2346 int unit, 2347 bcm_vlan_t vlan, 2348 int *qmid); 2349 2350 /* Detach a queue map object from a VLAN or VFI. */ 2351 extern int bcm_vlan_queue_map_detach( 2352 int unit, 2353 bcm_vlan_t vlan); 2354 2355 /* Detach queue map objects from all VLAN or VFI. */ 2356 extern int bcm_vlan_queue_map_detach_all( 2357 int unit); 2358 2359 /* Attach counter entries to the given vlan */ 2360 extern int bcm_vlan_stat_attach( 2361 int unit, 2362 bcm_vlan_t vlan, 2363 uint32 stat_counter_id); 2364 2365 /* Detach counter entries to the given vlan */ 2366 extern int bcm_vlan_stat_detach( 2367 int unit, 2368 bcm_vlan_t vlan); 2369 2370 /* Detach counter entries to the given vlan with a given stat counter id */ 2371 extern int bcm_vlan_stat_detach_with_id( 2372 int unit, 2373 bcm_vlan_t vlan, 2374 uint32 stat_counter_id); 2375 2376 /* 2377 * Get the specified statistic to the indicated value for the specified 2378 * VLAN 2379 */ 2380 extern int bcm_vlan_stat_counter_get( 2381 int unit, 2382 bcm_vlan_t vlan, 2383 bcm_vlan_stat_t stat, 2384 uint32 num_entries, 2385 uint32 *counter_indexes, 2386 bcm_stat_value_t *counter_values); 2387 2388 /* 2389 * Get the specified statistic to the indicated value for the specified 2390 * VLAN 2391 */ 2392 extern int bcm_vlan_stat_counter_sync_get( 2393 int unit, 2394 bcm_vlan_t vlan, 2395 bcm_vlan_stat_t stat, 2396 uint32 num_entries, 2397 uint32 *counter_indexes, 2398 bcm_stat_value_t *counter_values); 2399 2400 /* 2401 * Set the specified statistic to the indicated value for the specified 2402 * VLAN 2403 */ 2404 extern int bcm_vlan_stat_counter_set( 2405 int unit, 2406 bcm_vlan_t vlan, 2407 bcm_vlan_stat_t stat, 2408 uint32 num_entries, 2409 uint32 *counter_indexes, 2410 bcm_stat_value_t *counter_values); 2411 2412 /* Attach counters entries for the given ingress vlan translation table */ 2413 extern int bcm_vlan_translate_stat_attach( 2414 int unit, 2415 bcm_gport_t port, 2416 bcm_vlan_translate_key_t key_type, 2417 bcm_vlan_t outer_vlan, 2418 bcm_vlan_t inner_vlan, 2419 uint32 stat_counter_id); 2420 2421 /* Detach counters entries for the given ingress vlan translation table */ 2422 extern int bcm_vlan_translate_stat_detach( 2423 int unit, 2424 bcm_gport_t port, 2425 bcm_vlan_translate_key_t key_type, 2426 bcm_vlan_t outer_vlan, 2427 bcm_vlan_t inner_vlan); 2428 2429 /* Get counter values from ingress vlan translation table */ 2430 extern int bcm_vlan_translate_stat_counter_get( 2431 int unit, 2432 bcm_gport_t port, 2433 bcm_vlan_translate_key_t key_type, 2434 bcm_vlan_t outer_vlan, 2435 bcm_vlan_t inner_vlan, 2436 bcm_vlan_stat_t stat, 2437 uint32 num_entries, 2438 uint32 *counter_indexes, 2439 bcm_stat_value_t *counter_values); 2440 2441 /* Get counter values from ingress vlan translation table */ 2442 extern int bcm_vlan_translate_stat_counter_sync_get( 2443 int unit, 2444 bcm_gport_t port, 2445 bcm_vlan_translate_key_t key_type, 2446 bcm_vlan_t outer_vlan, 2447 bcm_vlan_t inner_vlan, 2448 bcm_vlan_stat_t stat, 2449 uint32 num_entries, 2450 uint32 *counter_indexes, 2451 bcm_stat_value_t *counter_values); 2452 2453 /* Set counter values into a ingress vlan translation table */ 2454 extern int bcm_vlan_translate_stat_counter_set( 2455 int unit, 2456 bcm_gport_t port, 2457 bcm_vlan_translate_key_t key_type, 2458 bcm_vlan_t outer_vlan, 2459 bcm_vlan_t inner_vlan, 2460 bcm_vlan_stat_t stat, 2461 uint32 num_entries, 2462 uint32 *counter_indexes, 2463 bcm_stat_value_t *counter_values); 2464 2465 /* Attach counters for the given egress vlan translation table. */ 2466 extern int bcm_vlan_translate_egress_stat_attach( 2467 int unit, 2468 int port_class, 2469 bcm_vlan_t outer_vlan, 2470 bcm_vlan_t inner_vlan, 2471 uint32 stat_counter_id); 2472 2473 /* Detach counters for the given egress vlan translation table. */ 2474 extern int bcm_vlan_translate_egress_stat_detach( 2475 int unit, 2476 int port_class, 2477 bcm_vlan_t outer_vlan, 2478 bcm_vlan_t inner_vlan); 2479 2480 /* Get counter values from egress vlan translation table. */ 2481 extern int bcm_vlan_translate_egress_stat_counter_get( 2482 int unit, 2483 int port_class, 2484 bcm_vlan_t outer_vlan, 2485 bcm_vlan_t inner_vlan, 2486 bcm_vlan_stat_t stat, 2487 uint32 num_entries, 2488 uint32 *counter_indexes, 2489 bcm_stat_value_t *counter_values); 2490 2491 /* Get counter values from egress vlan translation table. */ 2492 extern int bcm_vlan_translate_egress_stat_counter_sync_get( 2493 int unit, 2494 int port_class, 2495 bcm_vlan_t outer_vlan, 2496 bcm_vlan_t inner_vlan, 2497 bcm_vlan_stat_t stat, 2498 uint32 num_entries, 2499 uint32 *counter_indexes, 2500 bcm_stat_value_t *counter_values); 2501 2502 /* Set counter values from egress vlan translation table . */ 2503 extern int bcm_vlan_translate_egress_stat_counter_set( 2504 int unit, 2505 int port_class, 2506 bcm_vlan_t outer_vlan, 2507 bcm_vlan_t inner_vlan, 2508 bcm_vlan_stat_t stat, 2509 uint32 num_entries, 2510 uint32 *counter_indexes, 2511 bcm_stat_value_t *counter_values); 2512 2513 #endif /* BCM_HIDE_DISPATCHABLE */ 2514 2515 /* Seamless Redundancy flags for this VLAN */ 2516 #define BCM_VLAN_CONTROL_SR_FLAG_ENABLE 0x80000000 /* SR enabled on this 2517 VLAN */ 2518 #define BCM_VLAN_CONTROL_SR_FLAG_LAN_ID 0x00000001 /* Set if LAN B. 2519 Otherwise LAN A. */ 2520 #define BCM_VLAN_CONTROL_SR_FLAG_ENABLE_WITH_LAN_ID_A (BCM_VLAN_CONTROL_SR_FLAG_ENABLE) 2521 #define BCM_VLAN_CONTROL_SR_FLAG_ENABLE_WITH_LAN_ID_B (BCM_VLAN_CONTROL_SR_FLAG_ENABLE |\ 2522 BCM_VLAN_CONTROL_SR_FLAG_LAN_ID) 2523 2524 /* VLAN action flags */ 2525 #define BCM_VLAN_ACTION_SET_WITH_ID 0x0001 /* Add VLAN action 2526 instance using a 2527 specific ID */ 2528 #define BCM_VLAN_ACTION_SET_REPLACE 0x0002 /* Replace data in an 2529 existing VLAN action 2530 instance */ 2531 #define BCM_VLAN_ACTION_SET_INGRESS 0x0004 /* Add VLAN action 2532 instance only on the 2533 ingress side */ 2534 #define BCM_VLAN_ACTION_SET_EGRESS 0x0008 /* Add VLAN action 2535 instance only on the 2536 egress side */ 2537 #define BCM_VLAN_ACTION_SET_TPID_ALLOW_CREATE 0x0010 /* Create a TPID profile 2538 if TPIDs can't match 2539 an existing one. */ 2540 #define BCM_VLAN_ACTION_SET_TPID_ALLOW_DESTROY 0x0020 /* Destroy a TPID profile 2541 using specifi TPIDs */ 2542 #define BCM_VLAN_ACTION_SET_OUTER_VID_UNTAGGED 0x0040 /* Set the packet format 2543 after EVE to untagged */ 2544 #define BCM_VLAN_ACTION_SET_VLAN_CHECKS_DISABLE 0x0080 /* Disable spanning tree 2545 and ingress port VLAN 2546 membership checks */ 2547 #define BCM_VLAN_ACTION_SET_SR_ENABLE 0x00000100 /* Enable Seamless 2548 Redundancy(SR) */ 2549 #define BCM_VLAN_ACTION_SET_SR_LAN_ID 0x00000200 /* SR LAN ID. Set if LAN 2550 B. Otherwise LAN A */ 2551 #define BCM_VLAN_ACTION_SET_SR_ENABLE_WITH_LAN_ID_A (BCM_VLAN_ACTION_SET_SR_ENABLE) 2552 #define BCM_VLAN_ACTION_SET_SR_ENABLE_WITH_LAN_ID_B (BCM_VLAN_ACTION_SET_SR_ENABLE |\ 2553 BCM_VLAN_ACTION_SET_SR_LAN_ID) 2554 #define BCM_VLAN_ACTION_SET_DUMMY_VP 0x00000400 /* Configure VLAN 2555 Translation entry with 2556 dummy VP */ 2557 #define BCM_VLAN_ACTION_SET_EGRESS_DISABLE_MEMBERSHIP 0x00000800 /* Post EVE disable VLAN 2558 membership. */ 2559 #define BCM_VLAN_ACTION_SET_EGRESS_ENABLE_INNER_MEMBERSHIP 0x00001000 /* Post EVE enable VLAN 2560 membership use Inner 2561 VLAN */ 2562 #define BCM_VLAN_ACTION_SET_EGRESS_DISABLE_OUTER_TAG_REMOVAL 0x00002000 /* Post EVE disable 2563 removal of Outer VLAN 2564 tag */ 2565 #define BCM_VLAN_ACTION_SET_EGRESS_DISABLE_MIRRORING 0x00004000 /* Post EVE disable 2566 mirroring. */ 2567 #define BCM_VLAN_ACTION_SET_EGRESS_ENABLE_INNER_MIRRORING 0x00008000 /* Post EVE enable 2568 mirroring use Inner 2569 VLAN */ 2570 2571 /* Gport info struct */ 2572 typedef struct bcm_vlan_gport_info_s { 2573 uint32 flags; /* BCM_VLAN_PORT_GPORT_XXX */ 2574 bcm_vlan_t vlan; 2575 bcm_vlan_t vsi; 2576 bcm_gport_t gport; 2577 } bcm_vlan_gport_info_t; 2578 2579 /* Init structure bcm_vlan_gport_info_t */ 2580 extern void bcm_vlan_gport_info_t_init( 2581 bcm_vlan_gport_info_t *info); 2582 2583 #ifndef BCM_HIDE_DISPATCHABLE 2584 2585 /* Get a Gport from the specified vlan. */ 2586 extern int bcm_vlan_gport_info_get( 2587 int unit, 2588 bcm_vlan_gport_info_t *vlan_gport_info); 2589 2590 #endif /* BCM_HIDE_DISPATCHABLE */ 2591 2592 #if defined(INCLUDE_L3) 2593 /* BCM_VLAN_VPN_* flags for VPN Create. */ 2594 #define BCM_VLAN_VPN_ELINE 0x00000001 2595 #define BCM_VLAN_VPN_ELAN 0x00000002 2596 #define BCM_VLAN_VPN_WITH_ID 0x00000004 2597 #endif 2598 2599 #if defined(INCLUDE_L3) 2600 /* VPN Config Structure. */ 2601 typedef struct bcm_vlan_vpn_config_s { 2602 uint32 flags; /* BCM_VXLAN_VPN_xxx. */ 2603 bcm_vpn_t vpn; 2604 bcm_multicast_t broadcast_group; 2605 bcm_multicast_t unknown_unicast_group; 2606 bcm_multicast_t unknown_multicast_group; 2607 } bcm_vlan_vpn_config_t; 2608 #endif 2609 2610 #if defined(INCLUDE_L3) 2611 /* Initialize structure bcm_vlan_vpn_config_t. */ 2612 extern void bcm_vlan_vpn_config_t_init( 2613 bcm_vlan_vpn_config_t *info); 2614 #endif 2615 2616 #ifndef BCM_HIDE_DISPATCHABLE 2617 2618 #if defined(INCLUDE_L3) 2619 /* Create VPN instance */ 2620 extern int bcm_vlan_vpn_create( 2621 int unit, 2622 bcm_vlan_vpn_config_t *info); 2623 #endif 2624 2625 #if defined(INCLUDE_L3) 2626 /* Delete VPN Instance */ 2627 extern int bcm_vlan_vpn_destroy( 2628 int unit, 2629 bcm_vpn_t vpn); 2630 #endif 2631 2632 #if defined(INCLUDE_L3) 2633 /* Delete all VPN instances */ 2634 extern int bcm_vlan_vpn_destroy_all( 2635 int unit); 2636 #endif 2637 2638 #if defined(INCLUDE_L3) 2639 /* Get VPN instance by ID */ 2640 extern int bcm_vlan_vpn_get( 2641 int unit, 2642 bcm_vpn_t vpn, 2643 bcm_vlan_vpn_config_t *info); 2644 #endif 2645 2646 #endif /* BCM_HIDE_DISPATCHABLE */ 2647 2648 /* Vpn callback function prototype */ 2649 #if defined(INCLUDE_L3) 2650 typedef int(*bcm_vlan_vpn_traverse_cb)( 2651 int unit, 2652 bcm_vlan_vpn_config_t *info, 2653 void *user_data); 2654 #endif 2655 2656 #ifndef BCM_HIDE_DISPATCHABLE 2657 2658 #if defined(INCLUDE_L3) 2659 /* Traverse VPN */ 2660 extern int bcm_vlan_vpn_traverse( 2661 int unit, 2662 bcm_vlan_vpn_traverse_cb cb, 2663 void *user_data); 2664 #endif 2665 2666 #endif /* BCM_HIDE_DISPATCHABLE */ 2667 2668 #if defined(INCLUDE_L3) 2669 /* BCM_VLAN_PORT_SERVICE_* flags. */ 2670 #define BCM_VLAN_PORT_SERVICE_TAGGED 0x00200000 /* Service tag mode */ 2671 #define BCM_VLAN_PORT_SERVICE_VLAN_ADD 0x00400000 /* Add SD-tag */ 2672 #define BCM_VLAN_PORT_SERVICE_VLAN_REPLACE 0x00800000 /* Replace VLAN not TPID */ 2673 #define BCM_VLAN_PORT_SERVICE_VLAN_DELETE 0x01000000 /* Delete VLAN Tag */ 2674 #define BCM_VLAN_PORT_SERVICE_VLAN_TPID_REPLACE 0x02000000 /* Replace VLAN and TPID */ 2675 #define BCM_VLAN_PORT_SERVICE_VLAN_PRI_TPID_REPLACE 0x04000000 /* Replace VLAN, VLAN-PRI 2676 and TPID */ 2677 #define BCM_VLAN_PORT_SERVICE_VLAN_PRI_REPLACE 0x08000000 /* Replace VLAN and 2678 VLAN-PRI */ 2679 #define BCM_VLAN_PORT_SERVICE_PRI_REPLACE 0x10000000 /* Replace VLAN-PRI only */ 2680 #define BCM_VLAN_PORT_SERVICE_TPID_REPLACE 0x20000000 /* Replace TPID only */ 2681 #endif 2682 2683 /* Structure of VLAN port traverse object. */ 2684 typedef struct bcm_vlan_port_traverse_info_s { 2685 uint32 flags; /* BCM_VLAN_PORT_xxx. */ 2686 } bcm_vlan_port_traverse_info_t; 2687 2688 /* VLAN port traverse callback function prototype. */ 2689 typedef int (*bcm_vlan_port_traverse_cb)( 2690 int unit, 2691 bcm_vlan_port_t *vlan_port, 2692 void *user_data); 2693 2694 #ifndef BCM_HIDE_DISPATCHABLE 2695 2696 /* Traverse routine for VLAN port. */ 2697 extern int bcm_vlan_port_traverse( 2698 int unit, 2699 bcm_vlan_port_traverse_info_t *additional_info, 2700 bcm_vlan_port_traverse_cb trav_fn, 2701 void *user_data); 2702 2703 #endif /* BCM_HIDE_DISPATCHABLE */ 2704 2705 /* Generic match criteria to assign Vlan. */ 2706 typedef enum bcm_vlan_match_e { 2707 BCM_VLAN_MATCH_INVALID = 0, /* Invalid */ 2708 BCM_VLAN_MATCH_MAC_PORT = 1, /* Match on mac address and module/port 2709 or trunk or virtual port */ 2710 BCM_VLAN_MATCH_MAC_PORT_CLASS = 2, /* Match on Mac Address and Port-Group */ 2711 BCM_VALN_MATCH_COUNT = 3 /* Must be Last */ 2712 } bcm_vlan_match_t; 2713 2714 /* Generic vlan match attribute structure */ 2715 typedef struct bcm_vlan_match_info_s { 2716 bcm_vlan_match_t match; /* Match criteria */ 2717 bcm_gport_t port; /* Match port */ 2718 bcm_mac_t src_mac; /* Match source mac address */ 2719 uint32 port_class; /* Match port class */ 2720 } bcm_vlan_match_info_t; 2721 2722 /* Initialize the vlan match info structure. */ 2723 extern void bcm_vlan_match_info_t_init( 2724 bcm_vlan_match_info_t *vlan_match_info); 2725 2726 #define BCM_VLAN_MATCH_ACTION_REPLACE (1 << 0) /* Option to replace action 2727 for match criteria */ 2728 2729 #ifndef BCM_HIDE_DISPATCHABLE 2730 2731 /* Add action for match criteria for Vlan assignment. */ 2732 extern int bcm_vlan_match_action_add( 2733 int unit, 2734 uint32 options, 2735 bcm_vlan_match_info_t *match_info, 2736 bcm_vlan_action_set_t *action_set); 2737 2738 /* Get action for given match criteria. */ 2739 extern int bcm_vlan_match_action_get( 2740 int unit, 2741 bcm_vlan_match_info_t *match_info, 2742 bcm_vlan_action_set_t *action_set); 2743 2744 /* Get all actions and match criteria for given vlan match. */ 2745 extern int bcm_vlan_match_action_multi_get( 2746 int unit, 2747 bcm_vlan_match_t match, 2748 int size, 2749 bcm_vlan_match_info_t *match_info_array, 2750 bcm_vlan_action_set_t *action_set_array, 2751 int *count); 2752 2753 /* Remove action for a match criteria */ 2754 extern int bcm_vlan_match_action_delete( 2755 int unit, 2756 bcm_vlan_match_info_t *match_info); 2757 2758 /* Remove all actions for vlan match */ 2759 extern int bcm_vlan_match_action_delete_all( 2760 int unit, 2761 bcm_vlan_match_t match); 2762 2763 #endif /* BCM_HIDE_DISPATCHABLE */ 2764 2765 #endif /* __BCM_VLAN_H__ */