openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

vlan.h (110819B)


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