mim.h (16412B)
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_MIM_H__ 14 #define __BCM_MIM_H__ 15 16 #if defined(INCLUDE_L3) 17 18 #include <bcm/types.h> 19 #include <bcm/multicast.h> 20 #include <bcm/l3.h> 21 #include <bcm/switch.h> 22 23 /* MAC-in-MAC VPN Flags. */ 24 #define BCM_MIM_VPN_MIM 0x00000001 /* ELAN VPN service */ 25 #define BCM_MIM_VPN_WITH_ID 0x00000002 26 #define BCM_MIM_VPN_REPLACE 0x00000004 27 #define BCM_MIM_VPN_MATCH_SERVICE_VLAN_TPID 0x00000008 28 #define BCM_MIM_VPN_PBB_TE 0x00000010 /* P2P service for 29 Provider Backbone 30 Transport */ 31 #define BCM_MIM_VPN_BVLAN 0x00000020 /* Creates Backbone VLAN */ 32 #define BCM_MIM_VPN_SERVICE_ENCAP_WITH_ID 0x00000040 /* Used when the 33 application provides 34 service_encap_id */ 35 #define BCM_MIM_VPN_QOS_SDTAG_NO_ACTION 0x00000080 /* SDTAG priority control 36 per VPN */ 37 #define BCM_MIM_VPN_QOS_SDTAG_FIX_PRIORITY 0x00000100 /* SDTAG priority control 38 per VPN, fixed 39 priority */ 40 #define BCM_MIM_VPN_QOS_SDTAG_MAP_INT_PRIORITY 0x00000200 /* SDTAG priority control 41 per VPN, map priority */ 42 #define BCM_MIM_VPN_QOS_ITAG_FIX_PRIORITY 0x00000400 /* ITAG priority control 43 per VPN, fixed 44 priority */ 45 #define BCM_MIM_VPN_QOS_ITAG_MAP_SDTAG_PRIORITY 0x00000800 /* ITAG priority control 46 per VPN, map priority */ 47 #define BCM_MIM_VPN_QOS_INGRESS_MAP_FIX_INT_PRIORITY 0x00001000 /* Fixed internal 48 priority based on VFI */ 49 #define BCM_MIM_VPN_QOS_INGRESS_MAP_INT_PRIORITY 0x00002000 /* Map internal priority 50 based on VFI */ 51 #define BCM_MIM_VPN_BVID_DROP_NOMATCH 0x00004000 /* Drop pkt if BVID check 52 fails */ 53 #define BCM_MIM_VPN_ELINE 0x00008000 /* Point-to-Point VPN 54 service */ 55 #define BCM_MIM_VPN_SERVICE_ENCAP_INGRESS_WIDE 0x00010000 /* create 56 service_encap_id wide 57 mode */ 58 #define BCM_MIM_VPN_EGRESS_SERVICE_TPID_REPLACE 0x00020000 /* Replace TPID in 59 SD-TAG on MIM egress */ 60 #define BCM_MIM_VPN_INGRESS_ONLY 0x00040000 /* Create the MiM VPN on 61 ingress pipe only 62 (InLIF, Spanning tree, 63 MC groups) */ 64 #define BCM_MIM_VPN_EGRESS_ONLY 0x00080000 /* Create the MiM VPN on 65 egress pipe only (VSI 66 to ISID table) */ 67 #define BCM_MIM_VPN_MATCH_SERVICE_SMAC 0x00100000 /* Match entry include 68 Source B-MAC address */ 69 70 /* MAC-in-MAC Port Flags. */ 71 #define BCM_MIM_PORT_WITH_ID 0x00000001 72 #define BCM_MIM_PORT_ENCAP_WITH_ID 0x00000002 73 #define BCM_MIM_PORT_REPLACE 0x00000004 74 #define BCM_MIM_PORT_DROP 0x00000008 75 #define BCM_MIM_PORT_TYPE_ACCESS 0x00000010 76 #define BCM_MIM_PORT_TYPE_BACKBONE 0x00000020 77 #define BCM_MIM_PORT_TYPE_PEER 0x00000040 78 #define BCM_MIM_PORT_MATCH_SERVICE_VLAN_TPID 0x00000080 79 #define BCM_MIM_PORT_EGRESS_TUNNEL_SERVICE_REPLACE 0x00000100 80 #define BCM_MIM_PORT_EGRESS_LABEL 0x00000200 81 #define BCM_MIM_PORT_EGRESS_SERVICE_VLAN_TAGGED 0x00000400 82 #define BCM_MIM_PORT_EGRESS_SERVICE_VLAN_ADD 0x00000800 83 #define BCM_MIM_PORT_EGRESS_SERVICE_VLAN_REPLACE 0x00001000 84 #define BCM_MIM_PORT_EGRESS_SERVICE_VLAN_DELETE 0x00002000 85 #define BCM_MIM_PORT_EGRESS_SERVICE_VLAN_TPID_REPLACE 0x00004000 86 #define BCM_MIM_PORT_EGRESS_SERVICE_VLAN_PRI_REPLACE 0x00008000 87 #define BCM_MIM_PORT_EGRESS_SERVICE_VLAN_PRI_TPID_REPLACE 0x00010000 88 #define BCM_MIM_PORT_EGRESS_TUNNEL_DEST_MAC_USE_SERVICE 0x00020000 89 #define BCM_MIM_PORT_EXTENDED 0x00040000 /* Use the extended P2P 90 service */ 91 #define BCM_MIM_PORT_LOCAL_PROTECTION 0x00080000 /* Local protection 92 according to link 93 status */ 94 #define BCM_MIM_PORT_SERVICE_ENCAP_WITH_ID 0x00100000 /* Used when the 95 application provides 96 service_encap_id */ 97 #define BCM_MIM_PORT_FIX_PRIORITY 0x00200000 /* Assign fixed priority */ 98 #define BCM_MIM_PORT_DEFAULT 0x00400000 /* MiM default SVP */ 99 #define BCM_MIM_PORT_SERVICE_ENCAP_INGERSS_WIDE 0x00800000 /* Used when the 100 application creates 101 service_encap_id wide 102 mode */ 103 #define BCM_MIM_PORT_FAILOVER_DROP 0x01000000 /* Be enabled to drop 104 data for 1+1 105 protection */ 106 #define BCM_MIM_PORT_CASCADED 0x02000000 /* Create hierarchical 107 FEC */ 108 #define BCM_MIM_PORT_ENCAP_OVERLAY 0x04000000 /* Create overlay link 109 layer */ 110 #define BCM_MIM_PORT_EGRESS_SERVICE_PRI_REPLACE 0x08000000 /* Replace priority in 111 SD-TAG on MIM egress */ 112 #define BCM_MIM_PORT_EGRESS_SERVICE_TPID_REPLACE 0x10000000 /* Replace TPID in SD-TAG 113 on MIM egress */ 114 #define BCM_MIM_PORT_SHARE 0x20000000 /* A flag only to be used 115 with 116 BCM_MIM_PORT_TYPE_PEER 117 flag for creating a 118 share peer port */ 119 #define BCM_MIM_PORT_PEER_NO_BTAG 0x40000000 /* Control whether add 120 B-TAG for peer port 121 traffic */ 122 #define BCM_MIM_PORT_NO_LEARN_ENTRY 0x80000000 123 124 /* MAC-in-MAC Port match criteria. */ 125 typedef enum bcm_mim_port_match_e { 126 BCM_MIM_PORT_MATCH_INVALID = 0, /* Illegal. */ 127 BCM_MIM_PORT_MATCH_PORT = 1, 128 BCM_MIM_PORT_MATCH_PORT_VLAN = 2, 129 BCM_MIM_PORT_MATCH_PORT_VLAN_STACKED = 3, 130 BCM_MIM_PORT_MATCH_TUNNEL_VLAN_SRCMAC = 4, 131 BCM_MIM_PORT_MATCH_LABEL = 5, 132 BCM_MIM_PORT_MATCH_SHARE = 6 133 } bcm_mim_port_match_t; 134 135 /* MAC-in-MAC VPN structure. */ 136 typedef struct bcm_mim_vpn_config_s { 137 uint32 flags; /* Configuration flags */ 138 bcm_mim_vpn_t vpn; /* VPN ID. */ 139 int lookup_id; /* The I-SID value */ 140 uint16 match_service_tpid; /* Incoming SD tag TPID */ 141 bcm_multicast_t broadcast_group; /* Broadcast group */ 142 bcm_multicast_t unknown_unicast_group; /* Unknown unicast group */ 143 bcm_multicast_t unknown_multicast_group; /* Unknown multicast group */ 144 bcm_policer_t policer_id; /* Policer ID to be used */ 145 bcm_if_t service_encap_id; /* Service encap Identifier */ 146 uint8 int_pri; /* Fixed internal priority */ 147 int qos_map_id; /* Mapped priority */ 148 bcm_vlan_t tunnel_vlan; /* B-domain VID */ 149 int inlif_counting_profile; /* In LIF counting profile */ 150 int outlif_counting_profile; /* Out LIF counting profile */ 151 bcm_vlan_protocol_packet_ctrl_t protocol_pkt; /* Protocol packet control */ 152 uint16 egress_service_tpid; /* egress SD tag TPID */ 153 bcm_mac_t match_service_smac; /* Source B-MAC address */ 154 } bcm_mim_vpn_config_t; 155 156 /* MAC-in-MAC Port structure. */ 157 typedef struct bcm_mim_port_s { 158 bcm_gport_t mim_port_id; /* Interface id (VP). */ 159 uint32 flags; /* Configuration flags */ 160 int if_class; /* Interface class ID. */ 161 bcm_gport_t port; /* Physical port / trunk. */ 162 bcm_mim_port_match_t criteria; /* Match criteria. */ 163 bcm_vlan_t match_vlan; /* S-Tag. */ 164 bcm_vlan_t match_inner_vlan; /* C-Tag. */ 165 bcm_mpls_label_t match_label; /* MPLS label. */ 166 bcm_vlan_t match_tunnel_vlan; /* B-domain VID. */ 167 bcm_mac_t match_tunnel_srcmac; /* Source MAC address. */ 168 uint16 match_service_tpid; /* Incoming SD tag TPID */ 169 bcm_vlan_t egress_tunnel_vlan; /* B-domain VID. */ 170 bcm_mac_t egress_tunnel_srcmac; /* Source MAC address. */ 171 bcm_mac_t egress_tunnel_dstmac; /* Dest MAC address. */ 172 uint32 egress_tunnel_service; /* Egress I-SID translation. */ 173 uint16 egress_service_tpid; /* SD tag. */ 174 bcm_vlan_t egress_service_vlan; /* SD tag. */ 175 uint8 egress_service_pri; /* SD tag pri. */ 176 uint8 egress_service_cfi; /* SD tag cfi. */ 177 bcm_if_t encap_id; /* Encap identifier. */ 178 bcm_failover_t failover_id; /* Failover Object identifier. */ 179 bcm_gport_t failover_gport_id; /* Failover MiM Port identifier. */ 180 bcm_policer_t policer_id; /* Policer ID to be associated with the 181 MiM gport */ 182 bcm_multicast_t failover_mc_group; /* MC group used for bi-cast. */ 183 bcm_failover_t ingress_failover_id; /* 1+1 protection. */ 184 bcm_if_t service_encap_id; /* Service encap Identifier */ 185 uint8 int_pri; /* Fixed priority */ 186 bcm_switch_network_group_t network_group_id; /* Split Horizon network group 187 identifier */ 188 int inlif_counting_profile; /* In LIF counting profile */ 189 int outlif_counting_profile; /* Out LIF counting profile */ 190 } bcm_mim_port_t; 191 192 /* Initialize the MIM VPN config structure. */ 193 extern void bcm_mim_vpn_config_t_init( 194 bcm_mim_vpn_config_t *mim_vpn_config); 195 196 /* Initialize the MIM port structure. */ 197 extern void bcm_mim_port_t_init( 198 bcm_mim_port_t *mim_port); 199 200 #ifndef BCM_HIDE_DISPATCHABLE 201 202 /* Initialize the BCM MIM subsystem. */ 203 extern int bcm_mim_init( 204 int unit); 205 206 /* Detach the MIM software module. */ 207 extern int bcm_mim_detach( 208 int unit); 209 210 /* Create a VPN instance. */ 211 extern int bcm_mim_vpn_create( 212 int unit, 213 bcm_mim_vpn_config_t *info); 214 215 /* Delete a VPN instance. */ 216 extern int bcm_mim_vpn_destroy( 217 int unit, 218 bcm_mim_vpn_t vpn); 219 220 /* Delete all VPN instances. */ 221 extern int bcm_mim_vpn_destroy_all( 222 int unit); 223 224 /* Get a VPN instance by ID. */ 225 extern int bcm_mim_vpn_get( 226 int unit, 227 bcm_mim_vpn_t vpn, 228 bcm_mim_vpn_config_t *info); 229 230 #endif /* BCM_HIDE_DISPATCHABLE */ 231 232 /* MIM VPN callback function prototype. */ 233 typedef int (*bcm_mim_vpn_traverse_cb)( 234 int unit, 235 bcm_mim_vpn_config_t *info, 236 void *user_data); 237 238 #ifndef BCM_HIDE_DISPATCHABLE 239 240 /* bcm_mim_vpn_traverse */ 241 extern int bcm_mim_vpn_traverse( 242 int unit, 243 bcm_mim_vpn_traverse_cb cb, 244 void *user_data); 245 246 /* bcm_mim_port_add */ 247 extern int bcm_mim_port_add( 248 int unit, 249 bcm_mim_vpn_t vpn, 250 bcm_mim_port_t *mim_port); 251 252 /* bcm_mim_port_delete */ 253 extern int bcm_mim_port_delete( 254 int unit, 255 bcm_mim_vpn_t vpn, 256 bcm_gport_t mim_port_id); 257 258 /* bcm_mim_port_delete_all */ 259 extern int bcm_mim_port_delete_all( 260 int unit, 261 bcm_mim_vpn_t vpn); 262 263 /* bcm_mim_port_get */ 264 extern int bcm_mim_port_get( 265 int unit, 266 bcm_mim_vpn_t vpn, 267 bcm_mim_port_t *mim_port); 268 269 /* bcm_mim_port_get_all */ 270 extern int bcm_mim_port_get_all( 271 int unit, 272 bcm_mim_vpn_t vpn, 273 int port_max, 274 bcm_mim_port_t *port_array, 275 int *port_count); 276 277 #endif /* BCM_HIDE_DISPATCHABLE */ 278 279 /* Types of statistics that are maintained per MIM interface. */ 280 typedef enum bcm_mim_stat_e { 281 bcmMimStatIngressPackets = 0, /* Packets that ingress on MIM interface */ 282 bcmMimStatIngressBytes = 1, /* Bytes that ingress on MIM interface */ 283 bcmMimStatEgressPackets = 2, /* Packets that egress on MIM interface */ 284 bcmMimStatEgressBytes = 3 /* Bytes that egress on MIM interface */ 285 } bcm_mim_stat_t; 286 287 #ifndef BCM_HIDE_DISPATCHABLE 288 289 /* attach counters entries to the given MiM I-SID entry */ 290 extern int bcm_mim_lookup_id_stat_attach( 291 int unit, 292 int lookup_id, 293 uint32 stat_counter_id); 294 295 /* detach counters entries to the given MiM I-SID entry */ 296 extern int bcm_mim_lookup_id_stat_detach( 297 int unit, 298 int lookup_id); 299 300 /* Get counter statistic values for specific MiM I-SID entry */ 301 extern int bcm_mim_lookup_id_stat_counter_get( 302 int unit, 303 int lookup_id, 304 bcm_mim_stat_t stat, 305 uint32 num_entries, 306 uint32 *counter_indexes, 307 bcm_stat_value_t *counter_values); 308 309 /* Get counter statistic values for specific MiM I-SID entry */ 310 extern int bcm_mim_lookup_id_stat_counter_sync_get( 311 int unit, 312 int lookup_id, 313 bcm_mim_stat_t stat, 314 uint32 num_entries, 315 uint32 *counter_indexes, 316 bcm_stat_value_t *counter_values); 317 318 /* Set counter statistic values for specific MiM I-SID entry */ 319 extern int bcm_mim_lookup_id_stat_counter_set( 320 int unit, 321 int lookup_id, 322 bcm_mim_stat_t stat, 323 uint32 num_entries, 324 uint32 *counter_indexes, 325 bcm_stat_value_t *counter_values); 326 327 /* Get stat counter id associated with given MiM I-SID entry */ 328 extern int bcm_mim_lookup_id_stat_id_get( 329 int unit, 330 int lookup_id, 331 bcm_mim_stat_t stat, 332 uint32 *stat_counter_id); 333 334 /* Attach counters entries to the given MiM VPN entry */ 335 extern int bcm_mim_vpn_stat_attach( 336 int unit, 337 bcm_mim_vpn_t vpn, 338 uint32 stat_counter_id); 339 340 /* Detach counters entries to the given MiM VPN entry */ 341 extern int bcm_mim_vpn_stat_detach( 342 int unit, 343 bcm_mim_vpn_t vpn); 344 345 /* Get counter statistic values for specific MiM VPN entry */ 346 extern int bcm_mim_vpn_stat_counter_get( 347 int unit, 348 bcm_mim_vpn_t vpn, 349 bcm_mim_stat_t stat, 350 uint32 num_entries, 351 uint32 *counter_indexes, 352 bcm_stat_value_t *counter_values); 353 354 /* Get counter statistic values for specific MiM VPN entry */ 355 extern int bcm_mim_vpn_stat_counter_sync_get( 356 int unit, 357 bcm_mim_vpn_t vpn, 358 bcm_mim_stat_t stat, 359 uint32 num_entries, 360 uint32 *counter_indexes, 361 bcm_stat_value_t *counter_values); 362 363 /* Set counter statistic values for specific MiM VPN entry */ 364 extern int bcm_mim_vpn_stat_counter_set( 365 int unit, 366 bcm_mim_vpn_t vpn, 367 bcm_mim_stat_t stat, 368 uint32 num_entries, 369 uint32 *counter_indexes, 370 bcm_stat_value_t *counter_values); 371 372 /* Get stat counter id associated with given MiM VPN entry */ 373 extern int bcm_mim_vpn_stat_id_get( 374 int unit, 375 bcm_mim_vpn_t vpn, 376 bcm_mim_stat_t stat, 377 uint32 *stat_counter_id); 378 379 #endif /* defined(INCLUDE_L3) */ 380 381 #endif /* BCM_HIDE_DISPATCHABLE */ 382 383 #endif /* __BCM_MIM_H__ */