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

l2gre.h (14657B)


      1 /*
      2  * 
      3  * 
      4  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      5  * 
      6  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
      7  * 
      8  * DO NOT EDIT THIS FILE!
      9  * This file is auto-generated.
     10  * Edits to this file will be lost when it is regenerated.
     11  */
     12 
     13 #ifndef __BCM_L2GRE_H__
     14 #define __BCM_L2GRE_H__
     15 
     16 #if defined(INCLUDE_L3)
     17 
     18 #include <bcm/types.h>
     19 #include <bcm/l3.h>
     20 #include <bcm/tunnel.h>
     21 
     22 #if defined(INCLUDE_L3)
     23 /* BCM_L2GRE_VPN_* flags for L2GRE VPN Create. */
     24 #define BCM_L2GRE_VPN_ELINE                 0x00000001 
     25 #define BCM_L2GRE_VPN_ELAN                  0x00000002 
     26 #define BCM_L2GRE_VPN_WITH_ID               0x00000004 
     27 #define BCM_L2GRE_VPN_WITH_VPNID            0x00000008 
     28 #define BCM_L2GRE_VPN_SERVICE_TAGGED        0x00000010 
     29 #define BCM_L2GRE_VPN_SERVICE_VLAN_ADD      0x00000020 
     30 #define BCM_L2GRE_VPN_SERVICE_VLAN_REPLACE  0x00000040 
     31 #define BCM_L2GRE_VPN_SERVICE_VLAN_DELETE   0x00000080 
     32 #define BCM_L2GRE_VPN_SERVICE_VLAN_TPID_REPLACE 0x00000100 
     33 #define BCM_L2GRE_VPN_SERVICE_VLAN_PRI_TPID_REPLACE 0x00000200 
     34 #define BCM_L2GRE_VPN_SERVICE_VLAN_PRI_REPLACE 0x00000400 
     35 #define BCM_L2GRE_VPN_SERVICE_PRI_REPLACE   0x00000800 
     36 #define BCM_L2GRE_VPN_SERVICE_TPID_REPLACE  0x00001000 
     37 #define BCM_L2GRE_VPN_REPLACE               0x00002000 
     38 #define BCM_L2GRE_VPN_UNKNOWN_UCAST_REPLACE 0x00004000 
     39 #define BCM_L2GRE_VPN_UNKNOWN_MCAST_REPLACE 0x00008000 
     40 #define BCM_L2GRE_VPN_BCAST_REPLACE         0x00010000 
     41 #endif
     42 
     43 #if defined(INCLUDE_L3)
     44 /* BCM_L2GRE_MULTICAST_TUNNEL_STATE_BUD_* flags. */
     45 #define BCM_L2GRE_MULTICAST_TUNNEL_STATE_BUD_ENABLE 0x00000001 
     46 #define BCM_L2GRE_MULTICAST_TUNNEL_STATE_BUD_DISABLE 0x00000002 
     47 #endif
     48 
     49 #if defined(INCLUDE_L3)
     50 /* L2GRE VPN Definitions. */
     51 #define BCM_L2GRE_VPN_INVALID   0xFFFF     /* Invalid L2GRE VPN */
     52 #endif
     53 
     54 #if defined(INCLUDE_L3)
     55 /* L2GRE-VPN Config Structure. */
     56 typedef struct bcm_l2gre_vpn_config_s {
     57     uint32 flags;                       /* BCM_L2GRE_VPN_xxx. */
     58     bcm_vpn_t vpn;                      /* L2GRE VPN */
     59     uint32 vpnid;                       /* VPNID */
     60     uint8 pkt_pri;                      /* Packet Priority */
     61     uint8 pkt_cfi;                      /* Packet CFI */
     62     uint16 egress_service_tpid;         /* Service TPID */
     63     bcm_vlan_t egress_service_vlan;     /* Service VLAN */
     64     bcm_multicast_t broadcast_group; 
     65     bcm_multicast_t unknown_unicast_group; 
     66     bcm_multicast_t unknown_multicast_group; 
     67     bcm_gport_t match_port_class;       /* local port vlan domain */
     68 } bcm_l2gre_vpn_config_t;
     69 #endif
     70 
     71 #if defined(INCLUDE_L3)
     72 /* Initialize L2GRE-VPN config structure. */
     73 extern void bcm_l2gre_vpn_config_t_init(
     74     bcm_l2gre_vpn_config_t *info);
     75 #endif
     76 
     77 #ifndef BCM_HIDE_DISPATCHABLE
     78 
     79 #if defined(INCLUDE_L3)
     80 /* Create L2GRE-VPN instance */
     81 extern int bcm_l2gre_vpn_create(
     82     int unit, 
     83     bcm_l2gre_vpn_config_t *info);
     84 #endif
     85 
     86 #if defined(INCLUDE_L3)
     87 /* Delete L2GRE_VPN Instance */
     88 extern int bcm_l2gre_vpn_destroy(
     89     int unit, 
     90     bcm_vpn_t l2vpn);
     91 #endif
     92 
     93 #if defined(INCLUDE_L3)
     94 /* Delete all L2GRE-VPN instances */
     95 extern int bcm_l2gre_vpn_destroy_all(
     96     int unit);
     97 #endif
     98 
     99 #if defined(INCLUDE_L3)
    100 /* Get L2GRE-VPN instance by ID */
    101 extern int bcm_l2gre_vpn_get(
    102     int unit, 
    103     bcm_vpn_t l2vpn, 
    104     bcm_l2gre_vpn_config_t *info);
    105 #endif
    106 
    107 #endif /* BCM_HIDE_DISPATCHABLE */
    108 
    109 /* L2GRE vpn callback function prototype */
    110 #if defined(INCLUDE_L3)
    111 typedef int(*bcm_l2gre_vpn_traverse_cb)(
    112     int unit, 
    113     bcm_l2gre_vpn_config_t *info, 
    114     void *user_data);
    115 #endif
    116 
    117 #ifndef BCM_HIDE_DISPATCHABLE
    118 
    119 #if defined(INCLUDE_L3)
    120 /* Traverse L2GRE-VPN */
    121 extern int bcm_l2gre_vpn_traverse(
    122     int unit, 
    123     bcm_l2gre_vpn_traverse_cb cb, 
    124     void *user_data);
    125 #endif
    126 
    127 #endif /* BCM_HIDE_DISPATCHABLE */
    128 
    129 #if defined(INCLUDE_L3)
    130 /* L2GRE port match criteria. */
    131 typedef enum bcm_l2gre_port_match_e {
    132     BCM_L2GRE_PORT_MATCH_INVALID = 0,   /* Illegal. */
    133     BCM_L2GRE_PORT_MATCH_NONE = 1,      /* No source match criteria. */
    134     BCM_L2GRE_PORT_MATCH_PORT = 2,      /* {Module, Port} or Trunk. */
    135     BCM_L2GRE_PORT_MATCH_PORT_VLAN = 3, /* Mod/port/trunk + outer VLAN. */
    136     BCM_L2GRE_PORT_MATCH_PORT_INNER_VLAN = 4, /* Mod/port/trunk + inner VLAN. */
    137     BCM_L2GRE_PORT_MATCH_PORT_VLAN_STACKED = 5, /* Mod/port/trunk + outer/inner VLAN. */
    138     BCM_L2GRE_PORT_MATCH_VLAN_PRI = 6,  /* Mod/port/trunk + VLAN-PRI + VLAN-CFI. */
    139     BCM_L2GRE_PORT_MATCH_VPNID = 7,     /* Match L2GRE VPNID */
    140     BCM_L2GRE_PORT_MATCH_SHARE = 8,     /* Shared logical port */
    141     BCM_L2GRE_PORT_MATCH_PORT_ITAG = 9, /* Mod/port/trunk + inner TAG. */
    142     BCM_L2GRE_PORT_MATCH_COUNT = 10     /* Must be last. */
    143 } bcm_l2gre_port_match_t;
    144 #endif
    145 
    146 #if defined(INCLUDE_L3)
    147 /* BCM_L2GRE_* flags. */
    148 #define BCM_L2GRE_PORT_WITH_ID              (1 << 0)   /* create L2GRE port with
    149                                                           specified ID */
    150 #define BCM_L2GRE_PORT_DROP                 (1 << 1)   /* Drop matching packets */
    151 #define BCM_L2GRE_PORT_NETWORK              (1 << 2)   /* Network facing
    152                                                           interface */
    153 #define BCM_L2GRE_PORT_COUNTED              (1 << 3)   /* Maintain packet/byte
    154                                                           counts */
    155 #define BCM_L2GRE_PORT_REPLACE              (1 << 4)   /* Replace existing entry */
    156 #define BCM_L2GRE_PORT_INT_PRI_SET          (1 << 5)   /* Use Specified pri for
    157                                                           internal priority */
    158 #define BCM_L2GRE_PORT_INT_PRI_MAP          (1 << 6)   /* Use specified exp_map
    159                                                           for internal priority */
    160 #define BCM_L2GRE_PORT_EGRESS_TUNNEL        (1 << 7)   /* Specified Egress
    161                                                           tunnel is valid */
    162 #define BCM_L2GRE_PORT_SERVICE_TAGGED       (1 << 8)   /* Service tag mode */
    163 #define BCM_L2GRE_PORT_SERVICE_VLAN_ADD     (1 << 9)   /* Add SD-tag */
    164 #define BCM_L2GRE_PORT_SERVICE_VLAN_REPLACE (1 << 10)  /* Replace VLAN not TPID */
    165 #define BCM_L2GRE_PORT_SERVICE_VLAN_DELETE  (1 << 11)  /* Delete VLAN Tag */
    166 #define BCM_L2GRE_PORT_SERVICE_VLAN_TPID_REPLACE (1 << 12)  /* Replace VLAN and TPID */
    167 #define BCM_L2GRE_PORT_SERVICE_VLAN_PRI_TPID_REPLACE (1 << 13)  /* Replace VLAN, VLAN-PRI
    168                                                           and TPID */
    169 #define BCM_L2GRE_PORT_SERVICE_VLAN_PRI_REPLACE (1 << 14)  /* Replace VLAN and
    170                                                           VLAN-PRI */
    171 #define BCM_L2GRE_PORT_SERVICE_PRI_REPLACE  (1 << 15)  /* Replace VLAN-PRI only */
    172 #define BCM_L2GRE_PORT_SERVICE_TPID_REPLACE (1 << 16)  /* Replace TPID only */
    173 #define BCM_L2GRE_PORT_MULTICAST            (1 << 19)  /* Create Multicast-only
    174                                                           L2GRE Tunnel */
    175 #define BCM_L2GRE_PORT_DEFAULT              (1 << 20)  /* Create L2GRE Default
    176                                                           Network Port */
    177 #define BCM_L2GRE_PORT_ENABLE_VLAN_CHECKS   (1 << 21)  /* Enable vlan check,
    178                                                           only for access VP
    179                                                           derived from
    180                                                           VLAN_XLATE */
    181 #endif
    182 
    183 #if defined(INCLUDE_L3)
    184 /* L2GRE Gport */
    185 typedef struct bcm_l2gre_port_s {
    186     bcm_gport_t l2gre_port_id;          /* GPORT identifier. */
    187     uint32 flags;                       /* BCM_L2GRE_PORT_xxx. */
    188     uint32 if_class;                    /* Interface class ID. */
    189     uint16 int_pri;                     /* Internal Priority */
    190     uint8 pkt_pri;                      /* Packet Priority */
    191     uint8 pkt_cfi;                      /* Packet CFI */
    192     uint16 egress_service_tpid;         /* Service Vlan TPID Value */
    193     bcm_vlan_t egress_service_vlan;     /* SD-TAG Vlan ID. */
    194     uint16 mtu;                         /* MTU */
    195     bcm_gport_t match_port;             /* Match port / trunk */
    196     bcm_l2gre_port_match_t criteria;    /* Match criteria */
    197     bcm_vlan_t match_vlan;              /* Outer VLAN ID to match. */
    198     bcm_vlan_t match_inner_vlan;        /* Inner VLAN ID to match. */
    199     bcm_gport_t egress_tunnel_id;       /* Tunnel Initiator ID */
    200     bcm_gport_t match_tunnel_id;        /* Tunnel Terminator ID */
    201     bcm_if_t egress_if;                 /* L2GRE egress object. */
    202     bcm_switch_network_group_t network_group_id; /* Split Horizon network group
    203                                            identifier. */
    204 } bcm_l2gre_port_t;
    205 #endif
    206 
    207 #if defined(INCLUDE_L3)
    208 /* Initialize the L2GRE port structure. */
    209 extern void bcm_l2gre_port_t_init(
    210     bcm_l2gre_port_t *l2gre_port);
    211 #endif
    212 
    213 #ifndef BCM_HIDE_DISPATCHABLE
    214 
    215 #if defined(INCLUDE_L3)
    216 /* Initialize l2gre module. */
    217 extern int bcm_l2gre_init(
    218     int unit);
    219 #endif
    220 
    221 #if defined(INCLUDE_L3)
    222 /* Detach l2gre module. */
    223 extern int bcm_l2gre_cleanup(
    224     int unit);
    225 #endif
    226 
    227 #if defined(INCLUDE_L3)
    228 /* Add Access/Network L2GRE port */
    229 extern int bcm_l2gre_port_add(
    230     int unit, 
    231     bcm_vpn_t l2vpn, 
    232     bcm_l2gre_port_t *l2gre_port);
    233 #endif
    234 
    235 #if defined(INCLUDE_L3)
    236 /* Delete Access/Network L2GRE port */
    237 extern int bcm_l2gre_port_delete(
    238     int unit, 
    239     bcm_vpn_t l2vpn, 
    240     bcm_gport_t l2gre_port_id);
    241 #endif
    242 
    243 #if defined(INCLUDE_L3)
    244 /* bcm_l2gre_port_delete_all */
    245 extern int bcm_l2gre_port_delete_all(
    246     int unit, 
    247     bcm_vpn_t l2vpn);
    248 #endif
    249 
    250 #if defined(INCLUDE_L3)
    251 /* Get Access/Network L2GRE port */
    252 extern int bcm_l2gre_port_get(
    253     int unit, 
    254     bcm_vpn_t l2vpn, 
    255     bcm_l2gre_port_t *l2gre_port);
    256 #endif
    257 
    258 #if defined(INCLUDE_L3)
    259 /* Get all Access/Network L2GRE port */
    260 extern int bcm_l2gre_port_get_all(
    261     int unit, 
    262     bcm_vpn_t l2vpn, 
    263     int port_max, 
    264     bcm_l2gre_port_t *port_array, 
    265     int *port_count);
    266 #endif
    267 
    268 #if defined(INCLUDE_L3)
    269 /* Create L2GRE Tunnel Initiator */
    270 extern int bcm_l2gre_tunnel_initiator_create(
    271     int unit, 
    272     bcm_tunnel_initiator_t *info);
    273 #endif
    274 
    275 #if defined(INCLUDE_L3)
    276 /* Destroy L2GRE Tunnel Initiator */
    277 extern int bcm_l2gre_tunnel_initiator_destroy(
    278     int unit, 
    279     bcm_gport_t l2gre_tunnel_id);
    280 #endif
    281 
    282 #if defined(INCLUDE_L3)
    283 /* Destroy all L2GRE Tunnel Initiators */
    284 extern int bcm_l2gre_tunnel_initiator_destroy_all(
    285     int unit);
    286 #endif
    287 
    288 #if defined(INCLUDE_L3)
    289 /* Get L2GRE Tunnel Initiator Info */
    290 extern int bcm_l2gre_tunnel_initiator_get(
    291     int unit, 
    292     bcm_tunnel_initiator_t *info);
    293 #endif
    294 
    295 #if defined(INCLUDE_L3)
    296 /* Traverse L2GRE Tunnel Initiator Info */
    297 extern int bcm_l2gre_tunnel_initiator_traverse(
    298     int unit, 
    299     bcm_tunnel_initiator_traverse_cb cb, 
    300     void *user_data);
    301 #endif
    302 
    303 #if defined(INCLUDE_L3)
    304 /* Create L2GRE Tunnel Terminator */
    305 extern int bcm_l2gre_tunnel_terminator_create(
    306     int unit, 
    307     bcm_tunnel_terminator_t *info);
    308 #endif
    309 
    310 #if defined(INCLUDE_L3)
    311 /* Update L2GRE Tunnel Terminator */
    312 extern int bcm_l2gre_tunnel_terminator_update(
    313     int unit, 
    314     bcm_tunnel_terminator_t *info);
    315 #endif
    316 
    317 #if defined(INCLUDE_L3)
    318 /* Destroy L2GRE Tunnel terminator */
    319 extern int bcm_l2gre_tunnel_terminator_destroy(
    320     int unit, 
    321     bcm_gport_t l2gre_tunnel_id);
    322 #endif
    323 
    324 #if defined(INCLUDE_L3)
    325 /* Destroy all L2GRE Tunnel terminators */
    326 extern int bcm_l2gre_tunnel_terminator_destroy_all(
    327     int unit);
    328 #endif
    329 
    330 #if defined(INCLUDE_L3)
    331 /* Get L2GRE Tunnel terminator Info */
    332 extern int bcm_l2gre_tunnel_terminator_get(
    333     int unit, 
    334     bcm_tunnel_terminator_t *info);
    335 #endif
    336 
    337 #if defined(INCLUDE_L3)
    338 /* Traverse L2GRE Tunnel Terminator Info */
    339 extern int bcm_l2gre_tunnel_terminator_traverse(
    340     int unit, 
    341     bcm_tunnel_terminator_traverse_cb cb, 
    342     void *user_data);
    343 #endif
    344 
    345 #endif /* BCM_HIDE_DISPATCHABLE */
    346 
    347 /* Ingress and Egress statistics maintained per L2gre. */
    348 typedef enum bcm_l2gre_stat_e {
    349     bcmL2greInPackets = 0,  /* Packets that ingress on the L2gre */
    350     bcmL2greOutPackets = 1, /* Packets that egress on the L2gre */
    351     bcmL2greInBytes = 2,    /* Bytes that ingress on the L2gre */
    352     bcmL2greOutBytes = 3    /* Bytes that egress on the L2gre */
    353 } bcm_l2gre_stat_t;
    354 
    355 #ifndef BCM_HIDE_DISPATCHABLE
    356 
    357 /* Attach counter entries to the given L2gre gport and vpn. */
    358 extern int bcm_l2gre_stat_attach(
    359     int unit, 
    360     bcm_gport_t port, 
    361     bcm_vpn_t vpn, 
    362     uint32 stat_counter_id);
    363 
    364 /* Detach counter entries to the given L2gre gport and vpn. */
    365 extern int bcm_l2gre_stat_detach(
    366     int unit, 
    367     bcm_gport_t port, 
    368     bcm_vpn_t vpn);
    369 
    370 /* Get L2gre counter value for specified L2gre gport and vpn */
    371 extern int bcm_l2gre_stat_counter_get(
    372     int unit, 
    373     bcm_gport_t port, 
    374     bcm_vpn_t vpn, 
    375     bcm_l2gre_stat_t stat, 
    376     uint32 num_entries, 
    377     uint32 *counter_indexes, 
    378     bcm_stat_value_t *counter_values);
    379 
    380 /* Get L2gre counter value for specified L2gre gport and vpn */
    381 extern int bcm_l2gre_stat_counter_sync_get(
    382     int unit, 
    383     bcm_gport_t port, 
    384     bcm_vpn_t vpn, 
    385     bcm_l2gre_stat_t stat, 
    386     uint32 num_entries, 
    387     uint32 *counter_indexes, 
    388     bcm_stat_value_t *counter_values);
    389 
    390 /* Set L2gre counter value for specified L2gre gport and vpn */
    391 extern int bcm_l2gre_stat_counter_set(
    392     int unit, 
    393     bcm_gport_t port, 
    394     bcm_vpn_t vpn, 
    395     bcm_l2gre_stat_t stat, 
    396     uint32 num_entries, 
    397     uint32 *counter_indexes, 
    398     bcm_stat_value_t *counter_values);
    399 
    400 /* Get 64-bit counter value for multiple L2gre statistic types. */
    401 extern int bcm_l2gre_stat_multi_get(
    402     int unit, 
    403     bcm_gport_t port, 
    404     bcm_vpn_t vpn, 
    405     int nstat, 
    406     bcm_l2gre_stat_t *stat_arr, 
    407     uint64 *value_arr);
    408 
    409 /* Get lower 32-bit counter value for multiple L2gre statistic types. */
    410 extern int bcm_l2gre_stat_multi_get32(
    411     int unit, 
    412     bcm_gport_t port, 
    413     bcm_vpn_t vpn, 
    414     int nstat, 
    415     bcm_l2gre_stat_t *stat_arr, 
    416     uint32 *value_arr);
    417 
    418 /* Set 64-bit counter value for multiple L2gre statistic types. */
    419 extern int bcm_l2gre_stat_multi_set(
    420     int unit, 
    421     bcm_gport_t port, 
    422     bcm_vpn_t vpn, 
    423     int nstat, 
    424     bcm_l2gre_stat_t *stat_arr, 
    425     uint64 *value_arr);
    426 
    427 /* Set lower 32-bit counter value for multiple L2gre statistic types. */
    428 extern int bcm_l2gre_stat_multi_set32(
    429     int unit, 
    430     bcm_gport_t port, 
    431     bcm_vpn_t vpn, 
    432     int nstat, 
    433     bcm_l2gre_stat_t *stat_arr, 
    434     uint32 *value_arr);
    435 
    436 /* Provide stat counter ids associated with given L2gre gport and vpn */
    437 extern int bcm_l2gre_stat_id_get(
    438     int unit, 
    439     bcm_gport_t port, 
    440     bcm_vpn_t vpn, 
    441     bcm_l2gre_stat_t stat, 
    442     uint32 *stat_counter_id);
    443 
    444 #endif /* defined(INCLUDE_L3) */
    445 
    446 #endif /* BCM_HIDE_DISPATCHABLE */
    447 
    448 #endif /* __BCM_L2GRE_H__ */