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

mcast.h (4766B)


      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_MCAST_H__
     11 #define __BCM_MCAST_H__
     12 
     13 #include <bcm/types.h>
     14 
     15 /* BCM_MCAST_XXX Flags. */
     16 #define BCM_MCAST_USE_FABRIC_DISTRIBUTION   0x00000001 /* Use specified fabric
     17                                                           distribution class. */
     18 
     19 /* Device-independent L2 multicast address. */
     20 typedef struct bcm_mcast_addr_s {
     21     bcm_mac_t mac;                      /* 802.3 MAC address. */
     22     bcm_vlan_t vid;                     /* VLAN identifier. */
     23     bcm_cos_t cos_dst;                  /* COS based on destination address. */
     24     bcm_pbmp_t pbmp;                    /* Port bitmap. */
     25     bcm_pbmp_t ubmp;                    /* Untagged port bitmap. */
     26     uint32 l2mc_index;                  /* XGS: L2MC index. */
     27     uint32 flags;                       /* See BCM_MCAST_XXX flag definitions. */
     28     bcm_fabric_distribution_t distribution_class; /* Fabric Distribution Class. */
     29 } bcm_mcast_addr_t;
     30 
     31 /* Values returned by bcm_mcast_join and bcm_mcast_leave routines. */
     32 #define BCM_MCAST_JOIN_ADDED        1          
     33 #define BCM_MCAST_JOIN_UPDATED      2          
     34 #define BCM_MCAST_LEAVE_DELETED     3          
     35 #define BCM_MCAST_LEAVE_UPDATED     4          
     36 #define BCM_MCAST_LEAVE_NOTFOUND    5          
     37 
     38 /* Initialize a bcm_mcast_addr_t data type. */
     39 extern void bcm_mcast_addr_t_init(
     40     bcm_mcast_addr_t *mcaddr, 
     41     bcm_mac_t mac, 
     42     bcm_vlan_t vid);
     43 
     44 /* Backward compatibility. */
     45 #define bcm_mcast_addr_init     bcm_mcast_addr_t_init 
     46 
     47 #ifndef BCM_HIDE_DISPATCHABLE
     48 
     49 /* Initialize the L2 multicast module. */
     50 extern int bcm_mcast_init(
     51     int unit);
     52 
     53 /* Add/Remove an entry in the multicast table. */
     54 extern int bcm_mcast_addr_add(
     55     int unit, 
     56     bcm_mcast_addr_t *mcaddr);
     57 
     58 /* Add/Remove an entry in the multicast table. */
     59 extern int bcm_mcast_addr_remove(
     60     int unit, 
     61     bcm_mac_t mac, 
     62     bcm_vlan_t vid);
     63 
     64 /* 
     65  * Get untagged and tagged membership port bit maps for a Multicast
     66  * group.
     67  */
     68 extern int bcm_mcast_port_get(
     69     int unit, 
     70     bcm_mac_t mac, 
     71     bcm_vlan_t vid, 
     72     bcm_mcast_addr_t *mcaddr);
     73 
     74 /* Add a given port to the membership of a given multicast group. */
     75 extern int bcm_mcast_join(
     76     int unit, 
     77     bcm_mac_t mcMacAddr, 
     78     bcm_vlan_t vlanId, 
     79     int srcPort, 
     80     bcm_mcast_addr_t *mcaddr, 
     81     bcm_pbmp_t *allRouterBmp);
     82 
     83 /* Remove a given port from the membership of a given multicast group. */
     84 extern int bcm_mcast_leave(
     85     int unit, 
     86     bcm_mac_t mcMacAddr, 
     87     bcm_vlan_t vlanId, 
     88     int srcPort);
     89 
     90 /* 
     91  * Add/Update an entry in the multicast table with l2mc index provided.
     92  * Remove an entry in the multicast table, l2mc index not needed.
     93  */
     94 extern int bcm_mcast_addr_remove_w_l2mcindex(
     95     int unit, 
     96     bcm_mcast_addr_t *mcaddr);
     97 
     98 /* 
     99  * Add/Update an entry in the multicast table with l2mc index provided.
    100  * Remove an entry in the multicast table, l2mc index not needed.
    101  */
    102 extern int bcm_mcast_addr_add_w_l2mcindex(
    103     int unit, 
    104     bcm_mcast_addr_t *mcaddr);
    105 
    106 /* Add/Remove ports to/from an existing entry in the multicast table. */
    107 extern int bcm_mcast_port_remove(
    108     int unit, 
    109     bcm_mcast_addr_t *mcaddr);
    110 
    111 /* Add/Remove ports to/from an existing entry in the multicast table. */
    112 extern int bcm_mcast_port_add(
    113     int unit, 
    114     bcm_mcast_addr_t *mcaddr);
    115 
    116 /* Provides the maximum multicast index that this fabric can handle. */
    117 extern int bcm_mcast_bitmap_max_get(
    118     int unit, 
    119     int *max_index);
    120 
    121 /* Set/Get/Delete the L2 multicast forwarding port bitmap. */
    122 extern int bcm_mcast_bitmap_set(
    123     int unit, 
    124     int mc_idx, 
    125     bcm_port_t in_port, 
    126     bcm_pbmp_t pbmp);
    127 
    128 /* Set/Get/Delete the L2 multicast forwarding port bitmap. */
    129 extern int bcm_mcast_bitmap_get(
    130     int unit, 
    131     int mc_idx, 
    132     bcm_port_t in_port, 
    133     bcm_pbmp_t *pbmp);
    134 
    135 /* Set/Get/Delete the L2 multicast forwarding port bitmap. */
    136 extern int bcm_mcast_bitmap_del(
    137     int unit, 
    138     int mc_idx, 
    139     bcm_port_t in_port, 
    140     bcm_pbmp_t pbmp);
    141 
    142 #endif /* BCM_HIDE_DISPATCHABLE */
    143 
    144 #define BCM_MCAST_GPORT_IS_BITMAP_ID(gport)  _SHR_MCAST_GPORT_IS_BITMAP_ID(gport) 
    145 #define BCM_MCAST_GPORT_IS_GROUP_ID(gport)  _SHR_MCAST_GPORT_IS_GROUP_ID(gport) 
    146 #define BCM_MCAST_GPORT_GROUP_ID_SET(gport, mcast_id)  _SHR_MCAST_GPORT_GROUP_ID_SET(gport, mcast_id) 
    147 #define BCM_MCAST_GPORT_BITMAP_ID_SET(gport, bmp_id)  _SHR_MCAST_GPORT_BITMAP_ID_SET(gport, bmp_id) 
    148 #define BCM_MCAST_GPORT_GROUP_ID_GET(gport)  _SHR_MCAST_GPORT_GROUP_ID_GET(gport) 
    149 #define BCM_MCAST_GPORT_BITMAP_ID_GET(gport)  _SHR_MCAST_GPORT_BITMAP_ID_GET(gport) 
    150 
    151 #endif /* __BCM_MCAST_H__ */