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

vxlan.h (25177B)


      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_VXLAN_H__
     11 #define __BCM_VXLAN_H__
     12 
     13 #if defined(INCLUDE_L3)
     14 
     15 #include <bcm/types.h>
     16 #include <bcm/l3.h>
     17 #include <bcm/tunnel.h>
     18 #include <bcm/vlan.h>
     19 
     20 #if defined(INCLUDE_L3)
     21 /* BCM_VXLAN_VPN_* flags for VXLAN VPN Create. */
     22 #define BCM_VXLAN_VPN_ELINE                 0x00000001 
     23 #define BCM_VXLAN_VPN_ELAN                  0x00000002 
     24 #define BCM_VXLAN_VPN_WITH_ID               0x00000004 
     25 #define BCM_VXLAN_VPN_WITH_VPNID            0x00000008 
     26 #define BCM_VXLAN_VPN_SERVICE_TAGGED        0x00000010 
     27 #define BCM_VXLAN_VPN_SERVICE_VLAN_ADD      0x00000020 
     28 #define BCM_VXLAN_VPN_SERVICE_VLAN_REPLACE  0x00000040 
     29 #define BCM_VXLAN_VPN_SERVICE_VLAN_DELETE   0x00000080 
     30 #define BCM_VXLAN_VPN_SERVICE_VLAN_TPID_REPLACE 0x00000100 
     31 #define BCM_VXLAN_VPN_SERVICE_VLAN_PRI_TPID_REPLACE 0x00000200 
     32 #define BCM_VXLAN_VPN_SERVICE_VLAN_PRI_REPLACE 0x00000400 
     33 #define BCM_VXLAN_VPN_SERVICE_PRI_REPLACE   0x00000800 
     34 #define BCM_VXLAN_VPN_SERVICE_TPID_REPLACE  0x00001000 
     35 #define BCM_VXLAN_VPN_REPLACE               0x00002000 
     36 #define BCM_VXLAN_VPN_UNKNOWN_UCAST_REPLACE 0x00004000 
     37 #define BCM_VXLAN_VPN_UNKNOWN_MCAST_REPLACE 0x00008000 
     38 #define BCM_VXLAN_VPN_BCAST_REPLACE         0x00010000 
     39 #define BCM_VXLAN_VPN_TUNNEL_BASED_VNID     0x00020000 
     40 #endif
     41 
     42 #if defined(INCLUDE_L3)
     43 /* BCM_VXLAN_MULTICAST_TUNNEL_STATE_BUD_* flags. */
     44 #define BCM_VXLAN_MULTICAST_TUNNEL_STATE_BUD_ENABLE 0x00000001 
     45 #define BCM_VXLAN_MULTICAST_TUNNEL_STATE_BUD_DISABLE 0x00000002 
     46 #endif
     47 
     48 #if defined(INCLUDE_L3)
     49 /* VXLAN VPN Definitions. */
     50 #define BCM_VXLAN_VPN_INVALID   0xFFFF     /* Invalid VXLAN VPN */
     51 #endif
     52 
     53 #if defined(INCLUDE_L3)
     54 /* VXLAN VPN Config Structure. */
     55 typedef struct bcm_vxlan_vpn_config_s {
     56     uint32 flags;                       /* BCM_VXLAN_VPN_xxx. */
     57     bcm_vpn_t vpn;                      /* VXLAN VPN */
     58     uint32 vnid;                        /* VNID */
     59     uint8 pkt_pri;                      /* Packet Priority */
     60     uint8 pkt_cfi;                      /* Packet CFI */
     61     uint16 egress_service_tpid;         /* Service TPID */
     62     bcm_vlan_t egress_service_vlan;     /* Service VLAN */
     63     bcm_multicast_t broadcast_group; 
     64     bcm_multicast_t unknown_unicast_group; 
     65     bcm_multicast_t unknown_multicast_group; 
     66     bcm_vlan_protocol_packet_ctrl_t protocol_pkt; 
     67     bcm_vlan_t vlan;                    /* Outer VLAN */
     68     bcm_gport_t match_port_class;       /* local port vlan domain */
     69     bcm_vlan_t default_vlan;            /* default vlan for untag payload */
     70 } bcm_vxlan_vpn_config_t;
     71 #endif
     72 
     73 #if defined(INCLUDE_L3)
     74 /* Initialize VXLAN VPN config structure. */
     75 extern void bcm_vxlan_vpn_config_t_init(
     76     bcm_vxlan_vpn_config_t *info);
     77 #endif
     78 
     79 #ifndef BCM_HIDE_DISPATCHABLE
     80 
     81 #if defined(INCLUDE_L3)
     82 /* 
     83  * Create or update VXLAN VPN.
     84  *  When create a VXLAN VPN:
     85  * If use BCM_VXLAN_VPN_WITH_VPNID, both VFI and VNID will be created.
     86  * If not use flag BCM_VXLAN_VPN_WITH_VPNID, only VFI will be created.
     87  *  When update an exist VXLAN VPN(BCM_VXLAN_VPN_REPLACE should be used):
     88  * If use both BCM_VXLAN_VPN_REPLACE and BCM_VXLAN_VPN_WITH_VPNID, both
     89  * VFI and VNID will be created.
     90  * If only use BCM_VXLAN_VPN_REPLACE, the VNID will be removed.
     91  * If the flex counter is attached to the VPN, the previous flex counter
     92  * information can be kept.
     93  */
     94 extern int bcm_vxlan_vpn_create(
     95     int unit, 
     96     bcm_vxlan_vpn_config_t *info);
     97 #endif
     98 
     99 #if defined(INCLUDE_L3)
    100 /* Destroy VXLAN VPN. */
    101 extern int bcm_vxlan_vpn_destroy(
    102     int unit, 
    103     bcm_vpn_t l2vpn);
    104 #endif
    105 
    106 #if defined(INCLUDE_L3)
    107 /* Destroy VXLAN VPN. */
    108 extern int bcm_vxlan_vpn_destroy_all(
    109     int unit);
    110 #endif
    111 
    112 #if defined(INCLUDE_L3)
    113 /* Get VXLAN VPN. */
    114 extern int bcm_vxlan_vpn_get(
    115     int unit, 
    116     bcm_vpn_t l2vpn, 
    117     bcm_vxlan_vpn_config_t *info);
    118 #endif
    119 
    120 #endif /* BCM_HIDE_DISPATCHABLE */
    121 
    122 /* VXLAN vpn callback function prototype */
    123 #if defined(INCLUDE_L3)
    124 typedef int(*bcm_vxlan_vpn_traverse_cb)(
    125     int unit, 
    126     bcm_vxlan_vpn_config_t *info, 
    127     void *user_data);
    128 #endif
    129 
    130 #ifndef BCM_HIDE_DISPATCHABLE
    131 
    132 #if defined(INCLUDE_L3)
    133 /* 
    134  * Traverse all valid VXLAN VPN entries and call the supplied callback
    135  * routine.
    136  */
    137 extern int bcm_vxlan_vpn_traverse(
    138     int unit, 
    139     bcm_vxlan_vpn_traverse_cb cb, 
    140     void *user_data);
    141 #endif
    142 
    143 #endif /* BCM_HIDE_DISPATCHABLE */
    144 
    145 #if defined(INCLUDE_L3)
    146 /* VXLAN port match criteria. */
    147 typedef enum bcm_vxlan_port_match_e {
    148     BCM_VXLAN_PORT_MATCH_INVALID = 0,   /* Illegal. */
    149     BCM_VXLAN_PORT_MATCH_NONE = 1,      /* No source match criteria. */
    150     BCM_VXLAN_PORT_MATCH_PORT = 2,      /* {Module, Port} or Trunk. */
    151     BCM_VXLAN_PORT_MATCH_PORT_VLAN = 3, /* Mod/port/trunk + outer VLAN. */
    152     BCM_VXLAN_PORT_MATCH_PORT_INNER_VLAN = 4, /* Mod/port/trunk + inner VLAN. */
    153     BCM_VXLAN_PORT_MATCH_PORT_VLAN_STACKED = 5, /* Mod/port/trunk + outer/inner VLAN. */
    154     BCM_VXLAN_PORT_MATCH_VLAN_PRI = 6,  /* Mod/port/trunk + VLAN-PRI + VLAN-CFI. */
    155     BCM_VXLAN_PORT_MATCH_VN_ID = 7,     /* Match VXLAN VN_ID */
    156     BCM_VXLAN_PORT_MATCH_SHARE = 8,     /* Shared logical port */
    157     BCM_VXLAN_PORT_MATCH_PORT_ITAG = 9, /* Mod/port/trunk + inner vlan tag. */
    158     BCM_VXLAN_PORT_MATCH_COUNT = 10     /* Must be last. */
    159 } bcm_vxlan_port_match_t;
    160 #endif
    161 
    162 #if defined(INCLUDE_L3)
    163 /* BCM_VXLAN_* flags. */
    164 #define BCM_VXLAN_PORT_WITH_ID              (1U << 0)  /* create VXLAN port with
    165                                                           specified ID */
    166 #define BCM_VXLAN_PORT_DROP                 (1U << 1)  /* Drop matching packets */
    167 #define BCM_VXLAN_PORT_NETWORK              (1U << 2)  /* Network facing
    168                                                           interface */
    169 #define BCM_VXLAN_PORT_COUNTED              (1U << 3)  /* Maintain packet/byte
    170                                                           counts */
    171 #define BCM_VXLAN_PORT_REPLACE              (1U << 4)  /* Replace existing entry */
    172 #define BCM_VXLAN_PORT_INT_PRI_SET          (1U << 5)  /* Use Specified pri for
    173                                                           internal priority */
    174 #define BCM_VXLAN_PORT_INT_PRI_MAP          (1U << 6)  /* Use specified exp_map
    175                                                           for internal priority */
    176 #define BCM_VXLAN_PORT_EGRESS_TUNNEL        (1U << 7)  /* Specified Egress
    177                                                           tunnel is valid */
    178 #define BCM_VXLAN_PORT_SERVICE_TAGGED       (1U << 8)  /* Service tag mode */
    179 #define BCM_VXLAN_PORT_SERVICE_VLAN_ADD     (1U << 9)  /* Add SD-tag */
    180 #define BCM_VXLAN_PORT_SERVICE_VLAN_REPLACE (1U << 10) /* Replace VLAN not TPID */
    181 #define BCM_VXLAN_PORT_SERVICE_VLAN_DELETE  (1U << 11) /* Delete VLAN Tag */
    182 #define BCM_VXLAN_PORT_SERVICE_VLAN_TPID_REPLACE (1U << 12) /* Replace VLAN and TPID */
    183 #define BCM_VXLAN_PORT_SERVICE_VLAN_PRI_TPID_REPLACE (1U << 13) /* Replace VLAN, VLAN-PRI
    184                                                           and TPID */
    185 #define BCM_VXLAN_PORT_SERVICE_VLAN_PRI_REPLACE (1U << 14) /* Replace VLAN and
    186                                                           VLAN-PRI */
    187 #define BCM_VXLAN_PORT_SERVICE_PRI_REPLACE  (1U << 15) /* Replace VLAN-PRI only */
    188 #define BCM_VXLAN_PORT_SERVICE_TPID_REPLACE (1U << 16) /* Replace TPID only */
    189 #define BCM_VXLAN_PORT_EGRESS_OBJECT        (1U << 17) /* Specified Egress
    190                                                           interface is valid */
    191 #define BCM_VXLAN_PORT_MULTICAST            (1U << 19) /* Create Multicast-only
    192                                                           VXLAN Tunnel */
    193 #define BCM_VXLAN_PORT_DEFAULT              (1U << 20) /* Create VXLAN Default
    194                                                           Network Port */
    195 #define BCM_VXLAN_PORT_ENABLE_VLAN_CHECKS   (1U << 21) /* Enable stp check on
    196                                                           ingress physical port,
    197                                                           only for access VP
    198                                                           derived from
    199                                                           VLAN_XLATE */
    200 #define BCM_VXLAN_PORT_SHARE                (1U << 22) /* Create shared
    201                                                           multicast VXLAN
    202                                                           network port */
    203 #define BCM_VXLAN_PORT_ENCAP_LOCAL          (1U << 23) /* Encapsulate the VXLAN
    204                                                           tunnel on local device */
    205 #define BCM_VXLAN_PORT_TUNNEL_QOS_MAP       (1U << 24) /* Use QoS mapped
    206                                                           priority for egress
    207                                                           Tunnel packet priority
    208                                                           control */
    209 #define BCM_VXLAN_PORT_TUNNEL_OUTER_VLAN_DELETE (1U << 25) /* Delete Tunnel Outer
    210                                                           VLAN Tag */
    211 #define BCM_VXLAN_PORT_TUNNEL_INNER_VLAN_DELETE (1U << 26) /* Delete Tunnel Inner
    212                                                           VLAN Tag */
    213 #define BCM_VXLAN_PORT_UDP_SRC_PORT_RANGE_ENABLE (1U << 27) /* UDP source port range
    214                                                           checking for Entropy */
    215 #define BCM_VXLAN_PORT_VPN_BASED            (1U << 28) /* To specify the VP is
    216                                                           per VPN based */
    217 #define BCM_VXLAN_PORT_LOOPBACK             (1U << 29) /* Loopback facing
    218                                                           interface for 2-pass
    219                                                           RIOT */
    220 #define BCM_VXLAN_PORT_NO_SPLIT_HORIZON_EGRESS (1U << 30) /* Disable the egress
    221                                                           split horizon check on
    222                                                           the destination
    223                                                           network port. */
    224 #define BCM_VXLAN_PORT_NO_SPLIT_HORIZON_INGRESS (1U << 31) /* Disable the ingress
    225                                                           split horizon check on
    226                                                           the destination
    227                                                           network port when RIOT
    228                                                           is disabled. */
    229 #endif
    230 
    231 #if defined(INCLUDE_L3)
    232 /* BCM_VXLAN_PORT_FLAGS2* flags. */
    233 #define BCM_VXLAN_PORT_FLAGS2_UT_VLAN_ACTION_NO_CLEAR (1 << 0)   /* Do not clear untagged
    234                                                           VLAN actions. Used
    235                                                           only when
    236                                                           BCM_VXLAN_MATCH_PORT
    237                                                           is set. */
    238 #define BCM_VXLAN_PORT_FLAGS2_NO_SPLIT_HORIZON_SOURCE (1 << 1)   /* Disable the split
    239                                                           horizon check on the
    240                                                           source network port. */
    241 #endif
    242 
    243 #if defined(INCLUDE_L3)
    244 /* VXLAN Gport */
    245 typedef struct bcm_vxlan_port_s {
    246     bcm_gport_t vxlan_port_id;          /* GPORT identifier. */
    247     uint32 flags;                       /* BCM_VXLAN_PORT_xxx. */
    248     uint32 if_class;                    /* Interface class ID. */
    249     uint16 int_pri;                     /* Internal Priority */
    250     uint8 pkt_pri;                      /* Packet Priority */
    251     uint8 pkt_cfi;                      /* Packet CFI */
    252     uint16 egress_service_tpid;         /* Service Vlan TPID Value */
    253     bcm_vlan_t egress_service_vlan;     /* SD-TAG Vlan ID. */
    254     uint16 mtu;                         /* MTU */
    255     bcm_gport_t match_port;             /* Match port / trunk */
    256     bcm_vxlan_port_match_t criteria;    /* Match criteria */
    257     bcm_vlan_t match_vlan;              /* Outer VLAN ID to match. */
    258     bcm_vlan_t match_inner_vlan;        /* Inner VLAN ID to match. */
    259     bcm_gport_t egress_tunnel_id;       /* Tunnel Initiator ID */
    260     bcm_gport_t match_tunnel_id;        /* Tunnel Terminator ID */
    261     bcm_if_t egress_if;                 /* VXLAN egress object. */
    262     bcm_switch_network_group_t network_group_id; /* Split Horizon network group
    263                                            identifier. */
    264     uint32 vnid;                        /* VXLAN packet VNID. */
    265     int qos_map_id;                     /* QoS Mapped priority */
    266     uint8 tunnel_pkt_pri;               /* Tunnel Packet Priority */
    267     uint8 tunnel_pkt_cfi;               /* Tunnel Packet CFI */
    268     uint32 flags2;                      /* BCM_VXLAN_PORT_FLAGS2_xxx. */
    269     bcm_vpn_t default_vpn;              /* default vxlan vpn */
    270 } bcm_vxlan_port_t;
    271 #endif
    272 
    273 extern void bcm_vxlan_port_t_init(
    274     bcm_vxlan_port_t *vxlan_port);
    275 
    276 #ifndef BCM_HIDE_DISPATCHABLE
    277 
    278 #if defined(INCLUDE_L3)
    279 /* Initialize the BCM VXLAN subsystem. */
    280 extern int bcm_vxlan_init(
    281     int unit);
    282 #endif
    283 
    284 #if defined(INCLUDE_L3)
    285 /* Detach the BCM VXLAN subsystem. */
    286 extern int bcm_vxlan_cleanup(
    287     int unit);
    288 #endif
    289 
    290 #if defined(INCLUDE_L3)
    291 /* bcm_vxlan_port_add adds a Access or Network VXLAN port */
    292 extern int bcm_vxlan_port_add(
    293     int unit, 
    294     bcm_vpn_t l2vpn, 
    295     bcm_vxlan_port_t *vxlan_port);
    296 #endif
    297 
    298 #if defined(INCLUDE_L3)
    299 /* bcm_vxlan_port_delete VXLAN port from VXLAN network. */
    300 extern int bcm_vxlan_port_delete(
    301     int unit, 
    302     bcm_vpn_t l2vpn, 
    303     bcm_gport_t vxlan_port_id);
    304 #endif
    305 
    306 #if defined(INCLUDE_L3)
    307 /* bcm_vxlan_port_delete VXLAN port from VXLAN network. */
    308 extern int bcm_vxlan_port_delete_all(
    309     int unit, 
    310     bcm_vpn_t l2vpn);
    311 #endif
    312 
    313 #if defined(INCLUDE_L3)
    314 /* Get VXLAN port information. */
    315 extern int bcm_vxlan_port_get(
    316     int unit, 
    317     bcm_vpn_t l2vpn, 
    318     bcm_vxlan_port_t *vxlan_port);
    319 #endif
    320 
    321 #if defined(INCLUDE_L3)
    322 /* Get all VXLAN port information. */
    323 extern int bcm_vxlan_port_get_all(
    324     int unit, 
    325     bcm_vpn_t l2vpn, 
    326     int port_max, 
    327     bcm_vxlan_port_t *port_array, 
    328     int *port_count);
    329 #endif
    330 
    331 #if defined(INCLUDE_L3)
    332 /* Create VXLAN Tunnel Initiator. */
    333 extern int bcm_vxlan_tunnel_initiator_create(
    334     int unit, 
    335     bcm_tunnel_initiator_t *info);
    336 #endif
    337 
    338 #if defined(INCLUDE_L3)
    339 /* Delete VXLAN Tunnel Initiator. */
    340 extern int bcm_vxlan_tunnel_initiator_destroy(
    341     int unit, 
    342     bcm_gport_t vxlan_tunnel_id);
    343 #endif
    344 
    345 #if defined(INCLUDE_L3)
    346 /* Destroy all VXLAN Tunnel Initiators */
    347 extern int bcm_vxlan_tunnel_initiator_destroy_all(
    348     int unit);
    349 #endif
    350 
    351 #if defined(INCLUDE_L3)
    352 /* Get  VXLAN Tunnel Initiator. */
    353 extern int bcm_vxlan_tunnel_initiator_get(
    354     int unit, 
    355     bcm_tunnel_initiator_t *info);
    356 #endif
    357 
    358 #if defined(INCLUDE_L3)
    359 /* Traverse VXLAN Tunnel initiator. */
    360 extern int bcm_vxlan_tunnel_initiator_traverse(
    361     int unit, 
    362     bcm_tunnel_initiator_traverse_cb cb, 
    363     void *user_data);
    364 #endif
    365 
    366 #if defined(INCLUDE_L3)
    367 /* Create VXLAN Tunnel terminator. */
    368 extern int bcm_vxlan_tunnel_terminator_create(
    369     int unit, 
    370     bcm_tunnel_terminator_t *info);
    371 #endif
    372 
    373 #if defined(INCLUDE_L3)
    374 /* Update multicast/active state per VXLAN Tunnel terminator. */
    375 extern int bcm_vxlan_tunnel_terminator_update(
    376     int unit, 
    377     bcm_tunnel_terminator_t *info);
    378 #endif
    379 
    380 #if defined(INCLUDE_L3)
    381 /* Delete VXLAN Tunnel terminator. */
    382 extern int bcm_vxlan_tunnel_terminator_destroy(
    383     int unit, 
    384     bcm_gport_t vxlan_tunnel_id);
    385 #endif
    386 
    387 #if defined(INCLUDE_L3)
    388 /* Destroy all VXLAN Tunnel terminators */
    389 extern int bcm_vxlan_tunnel_terminator_destroy_all(
    390     int unit);
    391 #endif
    392 
    393 #if defined(INCLUDE_L3)
    394 /* Get VXLAN Tunnel terminator. */
    395 extern int bcm_vxlan_tunnel_terminator_get(
    396     int unit, 
    397     bcm_tunnel_terminator_t *info);
    398 #endif
    399 
    400 #if defined(INCLUDE_L3)
    401 /* Traverse VXLAN Tunnel terminator. */
    402 extern int bcm_vxlan_tunnel_terminator_traverse(
    403     int unit, 
    404     bcm_tunnel_terminator_traverse_cb cb, 
    405     void *user_data);
    406 #endif
    407 
    408 #endif /* BCM_HIDE_DISPATCHABLE */
    409 
    410 /* Ingress and Egress statistics maintained per Vxlan. */
    411 typedef enum bcm_vxlan_stat_e {
    412     bcmVxlanInPackets = 0,  /* Packets that ingress on the vxlan */
    413     bcmVxlanOutPackets = 1, /* Packets that egress on the vxlan */
    414     bcmVxlanInBytes = 2,    /* Bytes that ingress on the vxlan */
    415     bcmVxlanOutBytes = 3    /* Bytes that egress on the vxlan */
    416 } bcm_vxlan_stat_t;
    417 
    418 /* Ingress statistics maintained per Vxlan Dip. */
    419 typedef enum bcm_vxlan_dip_stat_e {
    420     bcmVxlanDipInPackets = 0,   /* Packets that ingress on the Vxlan Dip . */
    421     bcmVxlanDipInBytes = 1      /* Bytes that ingress on the Vxlan Dip . */
    422 } bcm_vxlan_dip_stat_t;
    423 
    424 #ifndef BCM_HIDE_DISPATCHABLE
    425 
    426 /* Attach counters entries to the given vxlan vp/vpn index */
    427 extern int bcm_vxlan_stat_attach(
    428     int unit, 
    429     bcm_gport_t port, 
    430     bcm_vpn_t vpn, 
    431     uint32 stat_counter_id);
    432 
    433 /* Detach  counters entries to the given vxlan vp/vpn index. */
    434 extern int bcm_vxlan_stat_detach(
    435     int unit, 
    436     bcm_gport_t port, 
    437     bcm_vpn_t vpn);
    438 
    439 /* Get counter statistic values for a vxlan vp/vpn index. */
    440 extern int bcm_vxlan_stat_counter_get(
    441     int unit, 
    442     bcm_gport_t port, 
    443     bcm_vpn_t vpn, 
    444     bcm_vxlan_stat_t stat, 
    445     uint32 num_entries, 
    446     uint32 *counter_indexes, 
    447     bcm_stat_value_t *counter_values);
    448 
    449 /* 
    450  * Force an immediate counter update and retrieve counter statistic
    451  * values for
    452  * a vxlan vp/vpn index.
    453  */
    454 extern int bcm_vxlan_stat_counter_sync_get(
    455     int unit, 
    456     bcm_gport_t port, 
    457     bcm_vpn_t vpn, 
    458     bcm_vxlan_stat_t stat, 
    459     uint32 num_entries, 
    460     uint32 *counter_indexes, 
    461     bcm_stat_value_t *counter_values);
    462 
    463 /* Set counter statistic values for a vxlan vp/vpn index */
    464 extern int bcm_vxlan_stat_counter_set(
    465     int unit, 
    466     bcm_gport_t port, 
    467     bcm_vpn_t vpn, 
    468     bcm_vxlan_stat_t stat, 
    469     uint32 num_entries, 
    470     uint32 *counter_indexes, 
    471     bcm_stat_value_t *counter_values);
    472 
    473 /* Get multiple counter statistic values for multiple vxlan vp/vpn index. */
    474 extern int bcm_vxlan_stat_multi_get(
    475     int unit, 
    476     bcm_gport_t port, 
    477     bcm_vpn_t vpn, 
    478     int nstat, 
    479     bcm_vxlan_stat_t *stat_arr, 
    480     uint64 *value_arr);
    481 
    482 /* 
    483  * Get 32bit multiple counter statistic values for multiple vxlan vp/vpn
    484  * index.
    485  */
    486 extern int bcm_vxlan_stat_multi_get32(
    487     int unit, 
    488     bcm_gport_t port, 
    489     bcm_vpn_t vpn, 
    490     int nstat, 
    491     bcm_vxlan_stat_t *stat_arr, 
    492     uint32 *value_arr);
    493 
    494 /* Set multiple counter statistic values for multiple vxlan vp/vpn index. */
    495 extern int bcm_vxlan_stat_multi_set(
    496     int unit, 
    497     bcm_gport_t port, 
    498     bcm_vpn_t vpn, 
    499     int nstat, 
    500     bcm_vxlan_stat_t *stat_arr, 
    501     uint64 *value_arr);
    502 
    503 /* 
    504  * Set 32bit multiple counter statistic values for multiple vxlan vp/vpn
    505  * index.
    506  */
    507 extern int bcm_vxlan_stat_multi_set32(
    508     int unit, 
    509     bcm_gport_t port, 
    510     bcm_vpn_t vpn, 
    511     int nstat, 
    512     bcm_vxlan_stat_t *stat_arr, 
    513     uint32 *value_arr);
    514 
    515 /* Get stat counter ID associated with given vxlan vp/vpn index. */
    516 extern int bcm_vxlan_stat_id_get(
    517     int unit, 
    518     bcm_gport_t port, 
    519     bcm_vpn_t vpn, 
    520     bcm_vxlan_stat_t stat, 
    521     uint32 *stat_counter_id);
    522 
    523 /* Enable/Disable collection of statistics on the indicated port or vpn */
    524 extern int bcm_vxlan_stat_enable_set(
    525     int unit, 
    526     bcm_gport_t port, 
    527     bcm_vpn_t vpn, 
    528     int enable);
    529 
    530 /* Attach counters entries to a given VXLAN DIP. */
    531 extern int bcm_vxlan_dip_stat_attach(
    532     int unit, 
    533     bcm_ip_t vxlan_dip, 
    534     uint32 stat_counter_id);
    535 
    536 /* Detach counters entries to a given VXLAN DIP. */
    537 extern int bcm_vxlan_dip_stat_detach(
    538     int unit, 
    539     bcm_ip_t vxlan_dip);
    540 
    541 /* Get the specified counter statistic for a given VXLAN DIP. */
    542 extern int bcm_vxlan_dip_stat_counter_get(
    543     int unit, 
    544     bcm_ip_t vxlan_dip, 
    545     bcm_vxlan_dip_stat_t stat, 
    546     uint32 num_entries, 
    547     uint32 *counter_indexes, 
    548     bcm_stat_value_t *counter_values);
    549 
    550 /* Set the specified counter statistic for a given VXLAN DIP. */
    551 extern int bcm_vxlan_dip_stat_counter_set(
    552     int unit, 
    553     bcm_ip_t vxlan_dip, 
    554     bcm_vxlan_dip_stat_t stat, 
    555     uint32 num_entries, 
    556     uint32 *counter_indexes, 
    557     bcm_stat_value_t *counter_values);
    558 
    559 /* Get 64-bit counter value for multiple VXLAN DIP statistic types. */
    560 extern int bcm_vxlan_dip_stat_multi_get(
    561     int unit, 
    562     bcm_ip_t vxlan_dip, 
    563     int nstat, 
    564     bcm_vxlan_dip_stat_t *stat_arr, 
    565     uint64 *value_arr);
    566 
    567 /* Get 32-bit counter value for multiple VXLAN DIP statistic types. */
    568 extern int bcm_vxlan_dip_stat_multi_get32(
    569     int unit, 
    570     bcm_ip_t vxlan_dip, 
    571     int nstat, 
    572     bcm_vxlan_dip_stat_t *stat_arr, 
    573     uint32 *value_arr);
    574 
    575 /* set 64-bit counter value for multiple VXLAN DIP statistic types. */
    576 extern int bcm_vxlan_dip_stat_multi_set(
    577     int unit, 
    578     bcm_ip_t vxlan_dip, 
    579     int nstat, 
    580     bcm_vxlan_dip_stat_t *stat_arr, 
    581     uint64 *value_arr);
    582 
    583 /* set 32-bit counter value for multiple VXLAN DIP statistic types. */
    584 extern int bcm_vxlan_dip_stat_multi_set32(
    585     int unit, 
    586     bcm_ip_t vxlan_dip, 
    587     int nstat, 
    588     bcm_vxlan_dip_stat_t *stat_arr, 
    589     uint32 *value_arr);
    590 
    591 /* Retrieve associated stat counter for a given VXLAN DIP. */
    592 extern int bcm_vxlan_dip_stat_id_get(
    593     int unit, 
    594     bcm_ip_t vxlan_dip, 
    595     bcm_vxlan_dip_stat_t stat, 
    596     uint32 *stat_counter_id);
    597 
    598 #endif /* BCM_HIDE_DISPATCHABLE */
    599 
    600 /* VXLAN port callback function prototype */
    601 #if defined(INCLUDE_L3)
    602 typedef int(*bcm_vxlan_port_traverse_cb)(
    603     int unit, 
    604     bcm_vxlan_port_t *info, 
    605     void *user_data);
    606 #endif
    607 
    608 #ifndef BCM_HIDE_DISPATCHABLE
    609 
    610 #if defined(INCLUDE_L3)
    611 /* Traverse all valid VXLAN port and call the supplied callback routine. */
    612 extern int bcm_vxlan_port_traverse(
    613     int unit, 
    614     bcm_vxlan_port_traverse_cb cb, 
    615     void *user_data);
    616 #endif
    617 
    618 #endif /* BCM_HIDE_DISPATCHABLE */
    619 
    620 #if defined(INCLUDE_L3)
    621 /* Invalid VXLAN VNI. */
    622 #define BCM_VXLAN_VNI_INVALID   -1         /* Invalid VXLAN VNI */
    623 #endif
    624 
    625 #if defined(INCLUDE_L3)
    626 /* VXLAN Network Domain Config Structure. */
    627 typedef struct bcm_vxlan_network_domain_config_s {
    628     uint32 flags;               /* BCM_VXLAN_NETWORK_DOMAIN_CONFIG_XXX. */
    629     uint32 vsi;                 /* Virtual switch instance. Populated for l2
    630                                    mapping only. */
    631     bcm_vrf_t vrf;              /* Virtual router instance. Populated for l3
    632                                    mapping only. */
    633     uint32 network_domain;      /* Network identifier. Used to distinct between
    634                                    multiple network. */
    635     uint32 vni;                 /* VXLAN packet VNID. */
    636     int qos_map_id;             /* QoS Mapped priority */
    637     bcm_gport_t vlan_port_id;   /* Vlan gport identifier */
    638 } bcm_vxlan_network_domain_config_t;
    639 #endif
    640 
    641 #if defined(INCLUDE_L3)
    642 /* Flags for bcm_vxlan_network_domain_config_t. */
    643 #define BCM_VXLAN_NETWORK_DOMAIN_CONFIG_INGRESS_ONLY 0x00000001 /* Add only ingress
    644                                                           mapping. */
    645 #define BCM_VXLAN_NETWORK_DOMAIN_CONFIG_EGRESS_ONLY 0x00000002 /* Add only egress
    646                                                           mapping. */
    647 #define BCM_VXLAN_NETWORK_DOMAIN_CONFIG_L2_MAPPING 0x00000004 /* Add L2 mapping. */
    648 #define BCM_VXLAN_NETWORK_DOMAIN_CONFIG_L3_MAPPING 0x00000008 /* Add L3 mapping. */
    649 #define BCM_VXLAN_NETWORK_DOMAIN_CONFIG_REPLACE 0x00000010 /* Replace the mapping. */
    650 #endif
    651 
    652 #if defined(INCLUDE_L3)
    653 /* VXLAN Network Domain Config Structure. */
    654 typedef struct bcm_vxlan_network_domain_config_additional_info_s {
    655     uint32 flags;   /* BCM_VXLAN_NETWORK_DOMAIN_CONFIG_XXX. */
    656 } bcm_vxlan_network_domain_config_additional_info_t;
    657 #endif
    658 
    659 #if defined(INCLUDE_L3)
    660 /* Initialize the VXLAN Network domain structure. */
    661 extern void bcm_vxlan_network_domain_config_t_init(
    662     bcm_vxlan_network_domain_config_t *config);
    663 #endif
    664 
    665 /* VXLAN port callback function prototype */
    666 #if defined(INCLUDE_L3)
    667 typedef int(*bcm_vxlan_network_domain_config_traverse_cb)(
    668     int unit, 
    669     bcm_vxlan_network_domain_config_t *info, 
    670     void *user_data);
    671 #endif
    672 
    673 #ifndef BCM_HIDE_DISPATCHABLE
    674 
    675 #if defined(INCLUDE_L3)
    676 /* Add a local identifier (vsi or vrf) with a VNI mapping. */
    677 extern int bcm_vxlan_network_domain_config_add(
    678     int unit, 
    679     bcm_vxlan_network_domain_config_t *config);
    680 #endif
    681 
    682 #if defined(INCLUDE_L3)
    683 /* Get local identifier (vsi or vrf) with VNI mapping. */
    684 extern int bcm_vxlan_network_domain_config_get(
    685     int unit, 
    686     bcm_vxlan_network_domain_config_t *config);
    687 #endif
    688 
    689 #if defined(INCLUDE_L3)
    690 /* Remove local identifier (vsi or vrf) with VNI mapping. */
    691 extern int bcm_vxlan_network_domain_config_remove(
    692     int unit, 
    693     bcm_vxlan_network_domain_config_t *config);
    694 #endif
    695 
    696 #if defined(INCLUDE_L3)
    697 /* Traverse local identifier (vsi or vrf) with VNI mapping. */
    698 extern int bcm_vxlan_network_domain_config_traverse(
    699     int unit, 
    700     bcm_vxlan_network_domain_config_additional_info_t *additional_info, 
    701     bcm_vxlan_network_domain_config_traverse_cb cb, 
    702     void *user_data);
    703 #endif
    704 
    705 #endif /* defined(INCLUDE_L3) */
    706 
    707 #endif /* BCM_HIDE_DISPATCHABLE */
    708 
    709 #endif /* __BCM_VXLAN_H__ */