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

multicast.h (27348B)


      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_MULTICAST_H__
     11 #define __BCM_MULTICAST_H__
     12 
     13 #include <bcm/types.h>
     14 #include <shared/multicast.h>
     15 
     16 #define BCM_MULTICAST_INVALID   0          
     17 
     18 /* Mulicast flags. */
     19 #define BCM_MULTICAST_WITH_ID               0x00000001 
     20 #define BCM_MULTICAST_TYPE_L2               0x00010000 
     21 #define BCM_MULTICAST_TYPE_L3               0x00020000 
     22 #define BCM_MULTICAST_TYPE_VPLS             0x00040000 
     23 #define BCM_MULTICAST_TYPE_SUBPORT          0x00080000 
     24 #define BCM_MULTICAST_TYPE_MIM              0x00100000 
     25 #define BCM_MULTICAST_TYPE_WLAN             0x00200000 
     26 #define BCM_MULTICAST_TYPE_VLAN             0x00400000 
     27 #define BCM_MULTICAST_TYPE_TRILL            0x00800000 
     28 #define BCM_MULTICAST_TYPE_NIV              0x01000000 
     29 #define BCM_MULTICAST_TYPE_EGRESS_OBJECT    0x02000000 
     30 #define BCM_MULTICAST_TYPE_L2GRE            0x04000000 
     31 #define BCM_MULTICAST_TYPE_VXLAN            0x08000000 
     32 #define BCM_MULTICAST_TYPE_EXTENDER         0x10000000 
     33 #define BCM_MULTICAST_TYPE_MAC              0x20000000 
     34 #define BCM_MULTICAST_TYPE_PORTS_GROUP      0x40000000 
     35 #define BCM_MULTICAST_TYPE_FLOW             0x80000000 
     36 #define BCM_MULTICAST_TYPE_MASK             0xffff0000 
     37 #define BCM_MULTICAST_DISABLE_SRC_KNOCKOUT  0x00000002 
     38 #define BCM_MULTICAST_INGRESS_GROUP         0x00000004 
     39 #define BCM_MULTICAST_EGRESS_GROUP          0x00000008 
     40 #define BCM_MULTICAST_INGRESS_MMC_BUFFERS   0x00000010 
     41 #define BCM_MULTICAST_EGRESS_TDM_GROUP      0x00000020 
     42 
     43 /* Multicast Type (for bcm_multicast_type). */
     44 typedef enum bcm_multicast_type_e {
     45     bcmMulticastTypeL2 = 1,             /* Multicast type L2 */
     46     bcmMulticastTypeL3 = 2,             /* Multicast type L3 */
     47     bcmMulticastTypeVpls = 3,           /* Multicast type VPLS */
     48     bcmMulticastTypeSubPort = 4,        /* Multicast type Sub Port */
     49     bcmMulticastTypeMim = 5,            /* Multicast type MIM */
     50     bcmMulticastTypeWlan = 6,           /* Multicast type Wlan */
     51     bcmMulticastTypeVlan = 7,           /* Multicast type Vlan */
     52     bcmMulticastTypeTrill = 8,          /* Multicast type TRILL */
     53     bcmMulticastTypeNiv = 9,            /* Multicast type NIV */
     54     bcmMulticastTypeEgressObject = 10,  /* Multicast type Egress Object */
     55     bcmMulticastTypeL2Gre = 11,         /* Multicast type L2 GRE */
     56     bcmMulticastTypeVxlan = 12,         /* Multicast type Vxlan */
     57     bcmMulticastTypePortsGroup = 13,    /* Multicast type Ports Group */
     58     bcmMulticastTypeExtender = 14,      /* Multicast type Extender */
     59     bcmMulticastTypeMac = 15,           /* Multicast type MAC */
     60     bcmMulticastTypeFlow = 16,          /* Multicast type Flow */
     61     bcmMulticastTypeCount = 17          /* Multicast type Count */
     62 } bcm_multicast_type_t;
     63 
     64 #define BCM_MULTICASTTYPE_STRINGS \
     65 { \
     66     "L2", \
     67     "L3", \
     68     "Vpls", \
     69     "SubPort", \
     70     "Mim", \
     71     "Wlan", \
     72     "Vlan", \
     73     "Trill", \
     74     "Niv", \
     75     "EgressObject", \
     76     "L2Gre", \
     77     "Vxlan", \
     78     "PortsGroup", \
     79     "Extender", \
     80     "Mac", \
     81     "Flow", \
     82     "Count"  \
     83 }
     84 
     85 #define BCM_MULTICAST_IS_SET(group)  _SHR_MULTICAST_IS_SET(group) 
     86 
     87 #define BCM_MULTICAST_IS_L2(group)      _SHR_MULTICAST_IS_L2(group) 
     88 #define BCM_MULTICAST_IS_L3(group)      _SHR_MULTICAST_IS_L3(group) 
     89 #define BCM_MULTICAST_IS_VPLS(group)    _SHR_MULTICAST_IS_VPLS(group) 
     90 #define BCM_MULTICAST_IS_SUBPORT(group)  _SHR_MULTICAST_IS_SUBPORT(group) 
     91 #define BCM_MULTICAST_IS_MIM(group)     _SHR_MULTICAST_IS_MIM(group) 
     92 #define BCM_MULTICAST_IS_WLAN(group)    _SHR_MULTICAST_IS_WLAN(group) 
     93 #define BCM_MULTICAST_IS_VLAN(group)    _SHR_MULTICAST_IS_VLAN(group) 
     94 #define BCM_MULTICAST_IS_TRILL(group)   _SHR_MULTICAST_IS_TRILL(group) 
     95 #define BCM_MULTICAST_IS_NIV(group)     _SHR_MULTICAST_IS_NIV(group) 
     96 #define BCM_MULTICAST_IS_EGRESS_OBJECT(group)  _SHR_MULTICAST_IS_EGRESS_OBJECT(group) 
     97 #define BCM_MULTICAST_IS_L2GRE(group)   _SHR_MULTICAST_IS_L2GRE(group) 
     98 #define BCM_MULTICAST_IS_VXLAN(group)   _SHR_MULTICAST_IS_VXLAN(group) 
     99 #define BCM_MULTICAST_IS_FLOW(group)    _SHR_MULTICAST_IS_FLOW(group) 
    100 #define BCM_MULTICAST_IS_PORTS_GROUP(group)  _SHR_MULTICAST_IS_PORTS_GROUP(group) 
    101 #define BCM_MULTICAST_IS_EXTENDER(group)  _SHR_MULTICAST_IS_EXTENDER(group) 
    102 
    103 #define BCM_MULTICAST_L2_SET(group, mc_index)  _SHR_MULTICAST_L2_SET(group, mc_index) 
    104 #define BCM_MULTICAST_L3_SET(group, mc_index)  _SHR_MULTICAST_L3_SET(group, mc_index) 
    105 #define BCM_MULTICAST_VPLS_SET(group, mc_index)  _SHR_MULTICAST_VPLS_SET(group, mc_index) 
    106 #define BCM_MULTICAST_SUBPORT_SET(group, mc_index)  _SHR_MULTICAST_SUBPORT_SET(group, mc_index) 
    107 #define BCM_MULTICAST_MIM_SET(group, mc_index)  _SHR_MULTICAST_MIM_SET(group, mc_index) 
    108 #define BCM_MULTICAST_WLAN_SET(group, mc_index)  _SHR_MULTICAST_WLAN_SET(group, mc_index) 
    109 #define BCM_MULTICAST_VLAN_SET(group, mc_index)  _SHR_MULTICAST_VLAN_SET(group, mc_index) 
    110 #define BCM_MULTICAST_TRILL_SET(group, mc_index)  _SHR_MULTICAST_TRILL_SET(group, mc_index) 
    111 #define BCM_MULTICAST_NIV_SET(group, mc_index)  _SHR_MULTICAST_NIV_SET(group, mc_index) 
    112 #define BCM_MULTICAST_EGRESS_OBJECT_SET(group, mc_index)  _SHR_MULTICAST_EGRESS_OBJECT_SET(group, mc_index) 
    113 #define BCM_MULTICAST_L2GRE_SET(group, mc_index)  _SHR_MULTICAST_L2GRE_SET(group, mc_index) 
    114 #define BCM_MULTICAST_VXLAN_SET(group, mc_index)  _SHR_MULTICAST_VXLAN_SET(group, mc_index) 
    115 #define BCM_MULTICAST_FLOW_SET(group, mc_index)  _SHR_MULTICAST_FLOW_SET(group, mc_index) 
    116 #define BCM_MULTICAST_PORTS_GROUP_SET(group, mc_index)  _SHR_MULTICAST_PORTS_GROUP_SET(group, mc_index) 
    117 #define BCM_MULTICAST_EXTENDER_SET(group, mc_index)  _SHR_MULTICAST_EXTENDER_SET(group, mc_index) 
    118 
    119 #define BCM_MULTICAST_L2_GET(group)     _SHR_MULTICAST_L2_GET(group) 
    120 #define BCM_MULTICAST_L3_GET(group)     _SHR_MULTICAST_L3_GET(group) 
    121 #define BCM_MULTICAST_VPLS_GET(group)   _SHR_MULTICAST_VPLS_GET(group) 
    122 #define BCM_MULTICAST_SUBPORT_GET(group)  _SHR_MULTICAST_SUBPORT_GET(group) 
    123 #define BCM_MULTICAST_MIM_GET(group)    _SHR_MULTICAST_MIM_GET(group) 
    124 #define BCM_MULTICAST_WLAN_GET(group)   _SHR_MULTICAST_WLAN_GET(group) 
    125 #define BCM_MULTICAST_VLAN_GET(group)   _SHR_MULTICAST_VLAN_GET(group) 
    126 #define BCM_MULTICAST_TRILL_GET(group)  _SHR_MULTICAST_TRILL_GET(group) 
    127 #define BCM_MULTICAST_NIV_GET(group)    _SHR_MULTICAST_NIV_GET(group) 
    128 #define BCM_MULTICAST_EGRESS_OBJECT_GET(group)  _SHR_MULTICAST_EGRESS_OBJECT_GET(group) 
    129 #define BCM_MULTICAST_L2GRE_GET(group)  _SHR_MULTICAST_L2GRE_GET(group) 
    130 #define BCM_MULTICAST_VXLAN_GET(group)  _SHR_MULTICAST_VXLAN_GET(group) 
    131 #define BCM_MULTICAST_FLOW_GET(group)   _SHR_MULTICAST_FLOW_GET(group) 
    132 #define BCM_MULTICAST_PORTS_GROUP_GET(group)  _SHR_MULTICAST_PORTS_GROUP_GET(group) 
    133 #define BCM_MULTICAST_EXTENDER_GET(group)  _SHR_MULTICAST_EXTENDER_GET(group) 
    134 
    135 #define BCM_MULTICAST_L2(mc_index)  _SHR_MULTICAST_L2(mc_index) 
    136 #define BCM_MULTICAST_L3(mc_index)  _SHR_MULTICAST_L3(mc_index) 
    137 #define BCM_MULTICAST_VPLS(mc_index)  _SHR_MULTICAST_VPLS(mc_index) 
    138 #define BCM_MULTICAST_SUBPORT(mc_index)  _SHR_MULTICAST_SUBPORT(mc_index) 
    139 #define BCM_MULTICAST_MIM(mc_index)  _SHR_MULTICAST_MIM(mc_index) 
    140 #define BCM_MULTICAST_WLAN(mc_index)  _SHR_MULTICAST_WLAN(mc_index) 
    141 #define BCM_MULTICAST_VLAN(mc_index)  _SHR_MULTICAST_VLAN(mc_index) 
    142 #define BCM_MULTICAST_TRILL(mc_index)  _SHR_MULTICAST_TRILL(mc_index) 
    143 #define BCM_MULTICAST_NIV(mc_index)  _SHR_MULTICAST_NIV(mc_index) 
    144 #define BCM_MULTICAST_EGRESS_OBJECT(mc_index)  _SHR_MULTICAST_EGRESS_OBJECT(mc_index) 
    145 #define BCM_MULTICAST_L2GRE(mc_index)  _SHR_MULTICAST_L2GRE(mc_index) 
    146 #define BCM_MULTICAST_VXLAN(mc_index)  _SHR_MULTICAST_VXLAN(mc_index) 
    147 #define BCM_MULTICAST_FLOW(mc_index)  _SHR_MULTICAST_FLOW(mc_index) 
    148 #define BCM_MULTICAST_PORTS_GROUP(mc_index)  _SHR_MULTICAST_PORTS_GROUP(mc_index) 
    149 #define BCM_MULTICAST_EXTENDER(mc_index)  _SHR_MULTICAST_EXTENDER(mc_index) 
    150 
    151 #define BCM_MULTICAST_TYPE(group)  _SHR_MULTICAST_TYPE(group) 
    152 
    153 #ifndef BCM_HIDE_DISPATCHABLE
    154 
    155 /* Initialize the multicast module. */
    156 extern int bcm_multicast_init(
    157     int unit);
    158 
    159 /* Shut down (uninitialize) the multicast module. */
    160 extern int bcm_multicast_detach(
    161     int unit);
    162 
    163 /* Create a multicast group for packet replication. */
    164 extern int bcm_multicast_create(
    165     int unit, 
    166     uint32 flags, 
    167     bcm_multicast_t *group);
    168 
    169 /* Destroy a multicast group. */
    170 extern int bcm_multicast_destroy(
    171     int unit, 
    172     bcm_multicast_t group);
    173 
    174 /* bcm_multicast_group_destroy */
    175 extern int bcm_multicast_group_destroy(
    176     int unit, 
    177     uint32 flags, 
    178     bcm_multicast_t group);
    179 
    180 extern int bcm_multicast_fabric_distribution_set(
    181     int unit, 
    182     bcm_multicast_t group, 
    183     bcm_fabric_distribution_t ds_id);
    184 
    185 /* Get the Fabric Distribution ID for a Multicast group ID. */
    186 extern int bcm_multicast_fabric_distribution_get(
    187     int unit, 
    188     bcm_multicast_t group, 
    189     bcm_fabric_distribution_t *ds_id);
    190 
    191 /* Get the multicast encapsulation ID for L3 replication. */
    192 extern int bcm_multicast_l3_encap_get(
    193     int unit, 
    194     bcm_multicast_t group, 
    195     bcm_gport_t port, 
    196     bcm_if_t intf, 
    197     bcm_if_t *encap_id);
    198 
    199 /* Get the multicast encapsulation ID for L2 replication. */
    200 extern int bcm_multicast_l2_encap_get(
    201     int unit, 
    202     bcm_multicast_t group, 
    203     bcm_gport_t port, 
    204     bcm_vlan_t vlan, 
    205     bcm_if_t *encap_id);
    206 
    207 /* Get the multicast encapsulation ID. */
    208 extern int bcm_multicast_vpls_encap_get(
    209     int unit, 
    210     bcm_multicast_t group, 
    211     bcm_gport_t port, 
    212     bcm_gport_t mpls_port_id, 
    213     bcm_if_t *encap_id);
    214 
    215 /* Get the multicast encapsulation ID for TRILL replication. */
    216 extern int bcm_multicast_trill_encap_get(
    217     int unit, 
    218     bcm_multicast_t group, 
    219     bcm_gport_t port, 
    220     bcm_if_t intf, 
    221     bcm_if_t *encap_id);
    222 
    223 /* Get the multicast encapsulation ID for SUBPORT replication. */
    224 extern int bcm_multicast_subport_encap_get(
    225     int unit, 
    226     bcm_multicast_t group, 
    227     bcm_gport_t port, 
    228     bcm_gport_t subport, 
    229     bcm_if_t *encap_id);
    230 
    231 /* Get the multicast encapsulation ID for MAC-in-MAC replication. */
    232 extern int bcm_multicast_mim_encap_get(
    233     int unit, 
    234     bcm_multicast_t group, 
    235     bcm_gport_t port, 
    236     bcm_gport_t mim_port_id, 
    237     bcm_if_t *encap_id);
    238 
    239 /* Get the multicast encapsulation ID for WLAN replication. */
    240 extern int bcm_multicast_wlan_encap_get(
    241     int unit, 
    242     bcm_multicast_t group, 
    243     bcm_gport_t port, 
    244     bcm_gport_t wlan_port_id, 
    245     bcm_if_t *encap_id);
    246 
    247 /* 
    248  * Get the multicast encapsulation ID for layer 2 logical port
    249  * replication.
    250  */
    251 extern int bcm_multicast_vlan_encap_get(
    252     int unit, 
    253     bcm_multicast_t group, 
    254     bcm_gport_t port, 
    255     bcm_gport_t vlan_port_id, 
    256     bcm_if_t *encap_id);
    257 
    258 /* Get the multicast encapsulation ID for NIV replication. */
    259 extern int bcm_multicast_niv_encap_get(
    260     int unit, 
    261     bcm_multicast_t group, 
    262     bcm_gport_t port, 
    263     bcm_gport_t niv_port_id, 
    264     bcm_if_t *encap_id);
    265 
    266 /* Get the multicast encapsulation ID for egress_object type replication. */
    267 extern int bcm_multicast_egress_object_encap_get(
    268     int unit, 
    269     bcm_multicast_t group, 
    270     bcm_if_t intf, 
    271     bcm_if_t *encap_id);
    272 
    273 /* Get the multicast encapsulation ID for L2GRE replication. */
    274 extern int bcm_multicast_l2gre_encap_get(
    275     int unit, 
    276     bcm_multicast_t group, 
    277     bcm_gport_t port, 
    278     bcm_gport_t l2gre_port_id, 
    279     bcm_if_t *encap_id);
    280 
    281 /* Get the multicast encapsulation ID for VXLAN replication. */
    282 extern int bcm_multicast_vxlan_encap_get(
    283     int unit, 
    284     bcm_multicast_t group, 
    285     bcm_gport_t port, 
    286     bcm_gport_t vxlan_port_id, 
    287     bcm_if_t *encap_id);
    288 
    289 /* Get the multicast encapsulation ID for Port Extension replication. */
    290 extern int bcm_multicast_extender_encap_get(
    291     int unit, 
    292     bcm_multicast_t group, 
    293     bcm_gport_t port, 
    294     bcm_gport_t extender_port_id, 
    295     bcm_if_t *encap_id);
    296 
    297 /* bcm_multicast_mac_encap_get */
    298 extern int bcm_multicast_mac_encap_get(
    299     int unit, 
    300     bcm_multicast_t group, 
    301     bcm_gport_t port, 
    302     bcm_gport_t mac_port_id, 
    303     bcm_if_t *encap_id);
    304 
    305 /* 
    306  * Add an encapsulated interface to a multicast group's replication list
    307  * on a
    308  * specific port.
    309  */
    310 extern int bcm_multicast_egress_add(
    311     int unit, 
    312     bcm_multicast_t group, 
    313     bcm_gport_t port, 
    314     bcm_if_t encap_id);
    315 
    316 /* 
    317  * Add an encapsulated interface to a multicast group's replication list
    318  * on a
    319  * specific port.
    320  */
    321 extern int bcm_multicast_egress_subscriber_add(
    322     int unit, 
    323     bcm_multicast_t group, 
    324     bcm_gport_t port, 
    325     bcm_if_t encap_id, 
    326     bcm_gport_t subscriber_queue);
    327 
    328 /* Delete a port from a multicast group's replication list. */
    329 extern int bcm_multicast_egress_delete(
    330     int unit, 
    331     bcm_multicast_t group, 
    332     bcm_gport_t port, 
    333     bcm_if_t encap_id);
    334 
    335 /* Delete a port from a multicast group's replication list. */
    336 extern int bcm_multicast_egress_subscriber_delete(
    337     int unit, 
    338     bcm_multicast_t group, 
    339     bcm_gport_t port, 
    340     bcm_if_t encap_id, 
    341     bcm_gport_t subscriber_queue);
    342 
    343 /* Delete all replications for the specified multicast index. */
    344 extern int bcm_multicast_egress_delete_all(
    345     int unit, 
    346     bcm_multicast_t group);
    347 
    348 /* 
    349  * Assign a set of encapsulated interfaces on specific ports as a
    350  * multicast
    351  * group's replication list.
    352  */
    353 extern int bcm_multicast_egress_set(
    354     int unit, 
    355     bcm_multicast_t group, 
    356     int port_count, 
    357     bcm_gport_t *port_array, 
    358     bcm_if_t *encap_id_array);
    359 
    360 /* 
    361  * Assign a set of encapsulated interfaces on specific ports as a
    362  * multicast
    363  * group's replication list.
    364  */
    365 extern int bcm_multicast_egress_subscriber_set(
    366     int unit, 
    367     bcm_multicast_t group, 
    368     int port_count, 
    369     bcm_gport_t *port_array, 
    370     bcm_if_t *encap_id_array, 
    371     bcm_gport_t *subscriber_queue_array);
    372 
    373 /* 
    374  * Get the set of encapsulated interfaces on specific ports which
    375  * comprises
    376  * a multicast group's replication list.
    377  */
    378 extern int bcm_multicast_egress_get(
    379     int unit, 
    380     bcm_multicast_t group, 
    381     int port_max, 
    382     bcm_gport_t *port_array, 
    383     bcm_if_t *encap_id_array, 
    384     int *port_count);
    385 
    386 /* 
    387  * Get the set of encapsulated interfaces on specific ports which
    388  * comprises
    389  * a multicast group's replication list.
    390  */
    391 extern int bcm_multicast_egress_subscriber_get(
    392     int unit, 
    393     bcm_multicast_t group, 
    394     int port_max, 
    395     bcm_gport_t *port_array, 
    396     bcm_if_t *encap_id_array, 
    397     bcm_gport_t *subscriber_queue_array, 
    398     int *port_count);
    399 
    400 /* 
    401  * Assign a replication queue offset profile index to multicast group's
    402  * subscriber queue replication list.
    403  */
    404 extern int bcm_multicast_egress_subscriber_qos_map_set(
    405     int unit, 
    406     bcm_multicast_t group, 
    407     bcm_gport_t port, 
    408     bcm_gport_t subscriber_queue, 
    409     int qos_map_id);
    410 
    411 /* 
    412  * Get the replication queue offset profile index associated to multicast
    413  * group's
    414  * subscriber queue replication list.
    415  */
    416 extern int bcm_multicast_egress_subscriber_qos_map_get(
    417     int unit, 
    418     bcm_multicast_t group, 
    419     bcm_gport_t port, 
    420     bcm_gport_t subscriber_queue, 
    421     int *qos_map_id);
    422 
    423 /* Add a port to a Ingress Multicast group's replication list. */
    424 extern int bcm_multicast_ingress_add(
    425     int unit, 
    426     bcm_multicast_t group, 
    427     bcm_gport_t port, 
    428     bcm_if_t encap_id);
    429 
    430 /* Delete a port from Ingress Multicast group's replication list. */
    431 extern int bcm_multicast_ingress_delete(
    432     int unit, 
    433     bcm_multicast_t group, 
    434     bcm_gport_t port, 
    435     bcm_if_t encap_id);
    436 
    437 /* bcm_multicast_egress_delete_all */
    438 extern int bcm_multicast_ingress_delete_all(
    439     int unit, 
    440     bcm_multicast_t group);
    441 
    442 /* Add a set of ports to a Ingress multicast group's replication list. */
    443 extern int bcm_multicast_ingress_set(
    444     int unit, 
    445     bcm_multicast_t group, 
    446     int port_count, 
    447     bcm_gport_t *port_array, 
    448     bcm_if_t *encap_id_array);
    449 
    450 /* bcm_multicast_ingress_get */
    451 extern int bcm_multicast_ingress_get(
    452     int unit, 
    453     bcm_multicast_t group, 
    454     int port_max, 
    455     bcm_gport_t *port_array, 
    456     bcm_if_t *encap_id_array, 
    457     int *port_count);
    458 
    459 /* 
    460  * Assign a set of VLANs as the selected port's replication list for the
    461  * chosen
    462  * multicast group.
    463  */
    464 extern int bcm_multicast_repl_set(
    465     int unit, 
    466     int mc_index, 
    467     bcm_port_t port, 
    468     bcm_vlan_vector_t vlan_vec);
    469 
    470 /* 
    471  * Return set of VLANs selected for port's replication list for multicast
    472  * group.
    473  */
    474 extern int bcm_multicast_repl_get(
    475     int unit, 
    476     int index, 
    477     bcm_port_t port, 
    478     bcm_vlan_vector_t vlan_vec);
    479 
    480 /* Retrieve the flags associated with a multicast group. */
    481 extern int bcm_multicast_group_get(
    482     int unit, 
    483     bcm_multicast_t group, 
    484     uint32 *flags);
    485 
    486 /* Request if the given multicast group is available on the device. */
    487 extern int bcm_multicast_group_is_free(
    488     int unit, 
    489     bcm_multicast_t group);
    490 
    491 /* 
    492  * Retrieve the minimum and maximum unallocated multicast groups for a
    493  * given multicast type.
    494  */
    495 extern int bcm_multicast_group_free_range_get(
    496     int unit, 
    497     uint32 type_flag, 
    498     bcm_multicast_t *group_min, 
    499     bcm_multicast_t *group_max);
    500 
    501 #endif /* BCM_HIDE_DISPATCHABLE */
    502 
    503 /* Callback function for bcm_multicast_group_traverse. */
    504 typedef int (*bcm_multicast_group_traverse_cb_t)(
    505     int unit, 
    506     bcm_multicast_t group, 
    507     uint32 flags, 
    508     void *user_data);
    509 
    510 #ifndef BCM_HIDE_DISPATCHABLE
    511 
    512 /* 
    513  * Iterate over the defined multicast groups of the type specified in
    514  * 'flags'.  If all types are desired, use MULTICAST_TYPE_MASK.
    515  */
    516 extern int bcm_multicast_group_traverse(
    517     int unit, 
    518     bcm_multicast_group_traverse_cb_t trav_fn, 
    519     uint32 flags, 
    520     void *user_data);
    521 
    522 #endif /* BCM_HIDE_DISPATCHABLE */
    523 
    524 /* Multicast group controls. */
    525 typedef enum bcm_multicast_control_e {
    526     bcmMulticastControlMtu = 0,     /* Maximum transmission unit. */
    527     bcmMulticastVpTrunkResolve = 1, /* Enable virtual port trunk group
    528                                        resolution. */
    529     bcmMulticastRemapGroup = 2,     /* Remap multicast groups. */
    530     bcmMulticastControlCount = 3    /* Must be last */
    531 } bcm_multicast_control_t;
    532 
    533 #ifndef BCM_HIDE_DISPATCHABLE
    534 
    535 /* Set/get miscellaneous per multicast group controls. */
    536 extern int bcm_multicast_control_set(
    537     int unit, 
    538     bcm_multicast_t group, 
    539     bcm_multicast_control_t type, 
    540     int arg);
    541 
    542 /* Set/get miscellaneous per multicast group controls. */
    543 extern int bcm_multicast_control_get(
    544     int unit, 
    545     bcm_multicast_t group, 
    546     bcm_multicast_control_t type, 
    547     int *arg);
    548 
    549 #endif /* BCM_HIDE_DISPATCHABLE */
    550 
    551 /* describes a multicast replication */
    552 typedef struct bcm_multicast_replication_s {
    553     uint32 flags;       /* information on the replication */
    554     bcm_gport_t port;   /* destination */
    555     bcm_if_t encap1;    /* first encapsulation. */
    556     bcm_if_t encap2;    /* second encapsulation. */
    557 } bcm_multicast_replication_t;
    558 
    559 #define BCM_MUTICAST_REPLICATION_ENCAP2_VALID 1          /* determines if encap2
    560                                                           is used . */
    561 #define BCM_MUTICAST_REPLICATION_ENCAP1_L3_INTF 2          /* when encap2 is used,
    562                                                           determines if encap1
    563                                                           is a routing interface
    564                                                           or not. */
    565 
    566 #ifndef BCM_HIDE_DISPATCHABLE
    567 
    568 /* Set or Get all the replicataions of a multicast group. */
    569 extern int bcm_multicast_get(
    570     int unit, 
    571     bcm_multicast_t group, 
    572     uint32 flags, 
    573     int replication_max, 
    574     bcm_multicast_replication_t *out_rep_array, 
    575     int *rep_count);
    576 
    577 /* Set or Get all the replicataions of a multicast group. */
    578 extern int bcm_multicast_set(
    579     int unit, 
    580     bcm_multicast_t group, 
    581     uint32 flags, 
    582     int nof_replications, 
    583     bcm_multicast_replication_t *rep_array);
    584 
    585 /* Delete or add replications of a multicast group. */
    586 extern int bcm_multicast_delete(
    587     int unit, 
    588     bcm_multicast_t group, 
    589     uint32 flags, 
    590     int nof_replications, 
    591     bcm_multicast_replication_t *rep_array);
    592 
    593 /* Delete or add replications of a multicast group. */
    594 extern int bcm_multicast_add(
    595     int unit, 
    596     bcm_multicast_t group, 
    597     uint32 flags, 
    598     int nof_replications, 
    599     bcm_multicast_replication_t *rep_array);
    600 
    601 #endif /* BCM_HIDE_DISPATCHABLE */
    602 
    603 /* Init the multicast_replication_t structure. */
    604 extern void bcm_multicast_replication_t_init(
    605     bcm_multicast_replication_t *replication_structure);
    606 
    607 /* 
    608  * Can be use for  setting flags parameter  to 
    609  * (bcm_multicast_get,bcm_multicast_set,bcm_multicast_add,bcm_multicast_delete)
    610  */
    611 #define BCM_MULTICAST_INGRESS   0x00000001 
    612 
    613 /* L3 Multiple multicast group related flags. */
    614 #define BCM_MULTICAST_MULTI_WITH_ID     (1 << 0)   /* Create multiple multicast
    615                                                       groups with id. */
    616 #define BCM_MULTICAST_MULTI_TYPE_L3     (1 << 1)   /* Create multiple group of
    617                                                       L3 type. */
    618 #define BCM_MULTICAST_MULTI_TYPE_VPLS   (1 << 2)   /* Create multiple group of
    619                                                       VPLS type. */
    620 
    621 /* Information to create multiple multicast groups. */
    622 typedef struct bcm_multicast_multi_info_s {
    623     uint32 flags;           /* See BCM_MULTICAST_MULTI_XXX flag definitions. */
    624     int number_of_elements; /* number of multicast groups to allocate. */
    625 } bcm_multicast_multi_info_t;
    626 
    627 /* Initialize bcm_multicast_multi_info_t structure. */
    628 extern void bcm_multicast_multi_info_t_init(
    629     bcm_multicast_multi_info_t *mc_multi_info);
    630 
    631 #ifndef BCM_HIDE_DISPATCHABLE
    632 
    633 /* Alloc/Create multiple multicast groups. */
    634 extern int bcm_multicast_multi_alloc(
    635     int unit, 
    636     bcm_multicast_multi_info_t mc_multi_info, 
    637     bcm_multicast_t *base_mc_group);
    638 
    639 /* Deallocates/frees multiple multicast groups. */
    640 extern int bcm_multicast_multi_free(
    641     int unit, 
    642     bcm_multicast_t base_mc_group);
    643 
    644 #endif /* BCM_HIDE_DISPATCHABLE */
    645 
    646 #define BCM_MULTICAST_REMOVE_ALL    0x00000040 
    647 
    648 #define BCM_MULTICAST_BIER_64_GROUP     0x00000080 
    649 #define BCM_MULTICAST_BIER_128_GROUP    0x00000100 
    650 #define BCM_MULTICAST_BIER_256_GROUP    0x00000200 
    651 
    652 #define BCM_MULICAST_STAT_EXTERNAL  0x00000001 /* Used to indicate of updating
    653                                                   multicast external statistics
    654                                                   parameters. */
    655 
    656 /* Multicast statistics control types. */
    657 typedef enum bcm_multicast_stat_control_type_e {
    658     bcmMulticastStatControlCountAllCopiesAsOne = 0 
    659 } bcm_multicast_stat_control_type_t;
    660 
    661 #ifndef BCM_HIDE_DISPATCHABLE
    662 
    663 /* Multicast statistics control set API. */
    664 extern int bcm_multicast_stat_control_set(
    665     int unit, 
    666     bcm_core_t core_id, 
    667     uint32 flags, 
    668     int command_id, 
    669     bcm_multicast_stat_control_type_t type, 
    670     int arg);
    671 
    672 /* Multicast statistics control get API. */
    673 extern int bcm_multicast_stat_control_get(
    674     int unit, 
    675     bcm_core_t core_id, 
    676     uint32 flags, 
    677     int command_id, 
    678     bcm_multicast_stat_control_type_t type, 
    679     int *arg);
    680 
    681 #endif /* BCM_HIDE_DISPATCHABLE */
    682 
    683 /* Multicast Encap extension flags */
    684 #define BCM_MULTICAST_ENCAP_EXTENSION_REPLACE 0x00000001 /* Replace an existing
    685                                                           entry in encapsulation
    686                                                           extension table */
    687 #define BCM_MULTICAST_ENCAP_EXTENSION_WITH_ID 0x00000002 /* Indicate creation with
    688                                                           a given ID. */
    689 
    690 #ifndef BCM_HIDE_DISPATCHABLE
    691 
    692 /* Allows the MC replication to use more than a single encapsulation. */
    693 extern int bcm_multicast_encap_extension_create(
    694     int unit, 
    695     uint32 flags, 
    696     bcm_if_t *multicast_replication_index, 
    697     int encap_extension_count, 
    698     bcm_if_t *encap_extension_array);
    699 
    700 /* 
    701  * Return the encapsulation IDs that are placed in the encapsulation
    702  * extension table under the encap_id entry.
    703  */
    704 extern int bcm_multicast_encap_extension_get(
    705     int unit, 
    706     uint32 flags, 
    707     bcm_if_t multicast_replication_index, 
    708     int encap_max, 
    709     bcm_if_t *encap_extension_array, 
    710     int *encap_extension_count);
    711 
    712 /* Delete an entry from the encapsulation table. */
    713 extern int bcm_multicast_encap_extension_destroy(
    714     int unit, 
    715     uint32 flags, 
    716     bcm_if_t multicast_replication_index);
    717 
    718 /* Delete all the members from the encapsulation extension table. */
    719 extern int bcm_multicast_encap_extension_delete_all(
    720     int unit);
    721 
    722 #endif /* BCM_HIDE_DISPATCHABLE */
    723 
    724 /* Callback function for bcm_multicast_encap_extension_traverse. */
    725 typedef int (*bcm_multicast_encap_extension_traverse_cb)(
    726     int unit, 
    727     bcm_if_t multicast_replication_index, 
    728     uint32 flags, 
    729     void *user_data);
    730 
    731 #ifndef BCM_HIDE_DISPATCHABLE
    732 
    733 /* Traverse over all the entries in the encapsulation extension table */
    734 extern int bcm_multicast_encap_extension_traverse(
    735     int unit, 
    736     bcm_multicast_encap_extension_traverse_cb trav_fn, 
    737     void *user_data);
    738 
    739 #endif /* BCM_HIDE_DISPATCHABLE */
    740 
    741 /* Multicast Encapsulation type. */
    742 typedef enum bcm_multicast_encap_type_e {
    743     bcmMulticastEncapTypeInvalid = 0,   /* Invalid type. */
    744     bcmMulticastEncapTypeL3 = 1,        /* Multicast Encapsulation type for
    745                                            non-tunnel L3 service. */
    746     bcmMulticastEncapTypeL3Tunnel = 2,  /* Multicast Encapsulation type for L3
    747                                            tunnel. */
    748     bcmMulticastEncapTypeL2Tunnel = 3,  /* Multicast Encapsulation type for L2
    749                                            tunnel such as VXLAN and VPLS. */
    750     bcmMulticastEncapTypeL2TunnelAccess = 4, /* Multicast Encapsulation type for the
    751                                            access on L2 tunnel. */
    752     bcmMulticastEncapTypeCount = 5      /* Multicast type Count */
    753 } bcm_multicast_encap_type_t;
    754 
    755 /* Describes multicast encapsulation info. */
    756 typedef struct bcm_multicast_encap_s {
    757     bcm_multicast_encap_type_t encap_type; /* Multicast Encapsulation type. */
    758     bcm_if_t ul_egress_if;              /* Underlay egress object ID. It is
    759                                            valid for L3Tunnel/L2Tunnel encap
    760                                            type. */
    761     bcm_if_t l3_intf;                   /* Overlay L3 interface ID for
    762                                            L3Tunnel/L2Tunnel encap type or L3
    763                                            interface ID for L3 encap type. */
    764     bcm_gport_t port_id;                /* Gport ID for L2Tunnel encap type. */
    765 } bcm_multicast_encap_t;
    766 
    767 /* Initialize bcm_multicast_encap_t structure. */
    768 extern void bcm_multicast_encap_t_init(
    769     bcm_multicast_encap_t *mc_encap);
    770 
    771 #ifndef BCM_HIDE_DISPATCHABLE
    772 
    773 /* 
    774  * Create a multicast encapsualtion id based on multicast encapsulation
    775  * info.
    776  */
    777 extern int bcm_multicast_encap_create(
    778     int unit, 
    779     bcm_multicast_encap_t *mc_encap, 
    780     bcm_if_t *encap_id);
    781 
    782 /* Destroy a multicast encapsulation ID. */
    783 extern int bcm_multicast_encap_destroy(
    784     int unit, 
    785     bcm_if_t encap_id);
    786 
    787 /* Get the multicast encapsulation info from the given encap_id. */
    788 extern int bcm_multicast_encap_get(
    789     int unit, 
    790     bcm_if_t encap_id, 
    791     bcm_multicast_encap_t *mc_encap);
    792 
    793 #endif /* BCM_HIDE_DISPATCHABLE */
    794 
    795 #endif /* __BCM_MULTICAST_H__ */