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

flow.h (65464B)


      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_FLOW_H__
     11 #define __BCM_FLOW_H__
     12 
     13 #include <bcm/types.h>
     14 #include <bcm/l3.h>
     15 #include <bcm/tunnel.h>
     16 #include <bcm/vlan.h>
     17 #include <bcm/qos.h>
     18 #include <bcm/flexctr.h>
     19 
     20 /* flow handle */
     21 typedef uint32 bcm_flow_handle_t;
     22 
     23 /* flow option ID */
     24 typedef uint32 bcm_flow_option_id_t;
     25 
     26 /* flow field ID */
     27 typedef uint32 bcm_flow_field_id_t;
     28 
     29 #if defined(INCLUDE_L3)
     30 /* Initialize bcm_flow_logical_field_t structure. */
     31 extern void bcm_flow_logical_field_t_init(
     32     bcm_flow_logical_field_t *logical_field);
     33 #endif
     34 
     35 #if defined(INCLUDE_L3)
     36 /* Flow match options */
     37 #define BCM_FLOW_MATCH_OPTION_REPLACE   (1 << 1)   /* replace object attributes
     38                                                       for a match criteria. */
     39 #endif
     40 
     41 #if defined(INCLUDE_L3)
     42 /* Flow match flags for hardware control parameters */
     43 #define BCM_FLOW_MATCH_FLAG_DROP    (1 << 0)   /* drop packet. */
     44 #endif
     45 
     46 #if defined(INCLUDE_L3)
     47 /* Flow match valid elements. */
     48 #define BCM_FLOW_MATCH_VNID_VALID           (1 << 0)   /* VN_ID element is valid
     49                                                           for this match. */
     50 #define BCM_FLOW_MATCH_VLAN_VALID           (1 << 1)   /* vlan element valid. */
     51 #define BCM_FLOW_MATCH_INNER_VLAN_VALID     (1 << 2)   /* inner vlan element
     52                                                           valid. */
     53 #define BCM_FLOW_MATCH_PORT_VALID           (1 << 3)   /* port element valid. */
     54 #define BCM_FLOW_MATCH_SIP_VALID            (1 << 4)   /* source IPv4 address
     55                                                           element valid. */
     56 #define BCM_FLOW_MATCH_SIP_V6_VALID         (1 << 5)   /* source IPv6 address
     57                                                           element valid. */
     58 #define BCM_FLOW_MATCH_DIP_VALID            (1 << 6)   /* destination IPv4
     59                                                           address element valid. */
     60 #define BCM_FLOW_MATCH_DIP_V6_VALID         (1 << 7)   /* destination IPv6
     61                                                           address element valid. */
     62 #define BCM_FLOW_MATCH_VPN_VALID            (1 << 8)   /* VPN element valid. */
     63 #define BCM_FLOW_MATCH_FLOW_PORT_VALID      (1 << 9)   /* flow port element
     64                                                           valid. */
     65 #define BCM_FLOW_MATCH_IIF_VALID            (1 << 10)  /* iif element valid. */
     66 #define BCM_FLOW_MATCH_FLEX_KEY_VALID       (1 << 11)  /* logical field elements
     67                                                           for key valid. */
     68 #define BCM_FLOW_MATCH_FLEX_DATA_VALID      (1 << 12)  /* logical field elements
     69                                                           for data valid. */
     70 #define BCM_FLOW_MATCH_UDP_SRC_PORT_VALID   (1 << 13)  /* udp source port field
     71                                                           valid. */
     72 #define BCM_FLOW_MATCH_UDP_DST_PORT_VALID   (1 << 14)  /* udp destination port
     73                                                           field valid. */
     74 #define BCM_FLOW_MATCH_PROTOCOL_VALID       (1 << 15)  /* protocol field valid. */
     75 #define BCM_FLOW_MATCH_MPLS_LABEL_VALID     (1 << 16)  /*  mpls label field
     76                                                           valid. */
     77 #define BCM_FLOW_MATCH_FLAGS_VALID          (1 << 17)  /*  flags field valid. */
     78 #endif
     79 
     80 #if defined(INCLUDE_L3)
     81 /* flow match criteria. */
     82 typedef enum bcm_flow_match_criteria_e {
     83     BCM_FLOW_MATCH_CRITERIA_INVALID = 0, /* Illegal. */
     84     BCM_FLOW_MATCH_CRITERIA_PORT = 1,   /* {Module, Port} or Trunk. */
     85     BCM_FLOW_MATCH_CRITERIA_PORT_VLAN = 2, /* Mod/port/trunk + outer VLAN. */
     86     BCM_FLOW_MATCH_CRITERIA_PORT_INNER_VLAN = 3, /* Mod/port/trunk + inner VLAN. */
     87     BCM_FLOW_MATCH_CRITERIA_PORT_VLAN_STACKED = 4, /* Mod/port/trunk + outer/inner VLAN. */
     88     BCM_FLOW_MATCH_CRITERIA_VLAN_PRI = 5, /* Mod/port/trunk + VLAN-PRI + VLAN-CFI. */
     89     BCM_FLOW_MATCH_CRITERIA_VN_ID = 6,  /* Match VN_ID */
     90     BCM_FLOW_MATCH_CRITERIA_SIP = 7,    /* Match source IP address */
     91     BCM_FLOW_MATCH_CRITERIA_SIP_VNID = 8, /* Match source IP address and vn_id */
     92     BCM_FLOW_MATCH_CRITERIA_FLEX = 9,   /* Match key specified in logical fields */
     93     BCM_FLOW_MATCH_CRITERIA_MPLS_LABEL = 10, /* Match MPLS label */
     94     BCM_FLOW_MATCH_CRITERIA_PORT_GROUP_VLAN = 11, /* Match port group + outer VID */
     95     BCM_FLOW_MATCH_CRITERIA_PORT_GROUP_INNER_VLAN = 12, /* Match port group + inner VID */
     96     BCM_FLOW_MATCH_CRITERIA_PORT_GROUP_VLAN_STACKED = 13, /* Match port group + outer VID + inner
     97                                            VID */
     98     BCM_FLOW_MATCH_CRITERIA_SVP_VNID = 14, /* Match Source VP and VN_ID */
     99     BCM_FLOW_MATCH_CRITERIA_COUNT = 15  /* Must be last. */
    100 } bcm_flow_match_criteria_t;
    101 #endif
    102 
    103 #if defined(INCLUDE_L3)
    104 /* Flow match config structure */
    105 typedef struct bcm_flow_match_config_s {
    106     uint32 vnid;                        /* VN_ID. */
    107     bcm_vlan_t vlan;                    /* Outer VLAN ID to match. */
    108     bcm_vlan_t inner_vlan;              /* Inner VLAN ID to match. */
    109     bcm_gport_t port;                   /* Match port / trunk */
    110     bcm_ip_t sip;                       /* source IPv4 address */
    111     bcm_ip_t sip_mask;                  /* source IPv4 address mask */
    112     bcm_ip6_t sip6;                     /* source IPv6 address */
    113     bcm_ip6_t sip6_mask;                /* source IPv6 address mask */
    114     bcm_ip_t dip;                       /* destination IPv4 address */
    115     bcm_ip_t dip_mask;                  /* destination IPv4 address mask */
    116     bcm_ip6_t dip6;                     /* destination IPv6 address */
    117     bcm_ip6_t dip6_mask;                /* destination IPv6 address mask */
    118     uint16 udp_dst_port;                /* udp destination port. */
    119     uint16 udp_src_port;                /* udp source port. */
    120     uint16 protocol;                    /* IP protocol type. */
    121     bcm_mpls_label_t mpls_label;        /* MPLS label. */
    122     bcm_gport_t flow_port;              /* flow port id representing a SVP */
    123     bcm_vpn_t vpn;                      /* VPN representing a vfi or vrf */
    124     bcm_if_t intf_id;                   /* l3 interface id */
    125     uint32 options;                     /* BCM_FLOW_MATCH_OPTION_xxx. */
    126     bcm_flow_match_criteria_t criteria; /* flow match criteria. */
    127     uint32 valid_elements;              /* bitmap of valid fields for the match
    128                                            action */
    129     bcm_flow_handle_t flow_handle;      /* flow handle derived from flow name */
    130     uint32 flow_option;                 /* flow option derived from flow option
    131                                            name */
    132     uint32 flags;                       /* BCM_FLOW_MATCH_FLAG_xxx */
    133 } bcm_flow_match_config_t;
    134 #endif
    135 
    136 /* bcm_flow_match_traverse callback */
    137 #if defined(INCLUDE_L3)
    138 typedef int (*bcm_flow_match_traverse_cb)(
    139     int unit, 
    140     bcm_flow_match_config_t *info, 
    141     uint32 num_of_fields, 
    142     bcm_flow_logical_field_t *field, 
    143     void *user_data);
    144 #endif
    145 
    146 #if defined(INCLUDE_L3)
    147 /* initialize the bcm_flow_match_config_t structure. */
    148 extern void bcm_flow_match_config_t_init(
    149     bcm_flow_match_config_t *flow_match);
    150 #endif
    151 
    152 #ifndef BCM_HIDE_DISPATCHABLE
    153 
    154 #if defined(INCLUDE_L3)
    155 /* Add a match entry to assign switch objects for the matched packets */
    156 extern int bcm_flow_match_add(
    157     int unit, 
    158     bcm_flow_match_config_t *info, 
    159     uint32 num_of_fields, 
    160     bcm_flow_logical_field_t *field);
    161 #endif
    162 
    163 #if defined(INCLUDE_L3)
    164 /* Delete a match entry for the given matching key */
    165 extern int bcm_flow_match_delete(
    166     int unit, 
    167     bcm_flow_match_config_t *info, 
    168     uint32 num_of_fields, 
    169     bcm_flow_logical_field_t *field);
    170 #endif
    171 
    172 #if defined(INCLUDE_L3)
    173 /* Get a match entry for the given matching key */
    174 extern int bcm_flow_match_get(
    175     int unit, 
    176     bcm_flow_match_config_t *info, 
    177     uint32 num_of_fields, 
    178     bcm_flow_logical_field_t *field);
    179 #endif
    180 
    181 #if defined(INCLUDE_L3)
    182 /* Traverse match entries */
    183 extern int bcm_flow_match_traverse(
    184     int unit, 
    185     bcm_flow_match_traverse_cb cb, 
    186     void *user_data);
    187 #endif
    188 
    189 #endif /* BCM_HIDE_DISPATCHABLE */
    190 
    191 #if defined(INCLUDE_L3)
    192 /* Flow tunnel initiator valid elements. */
    193 #define BCM_FLOW_TUNNEL_INIT_TTL_VALID      (1 << 0)   
    194 #define BCM_FLOW_TUNNEL_INIT_DMAC_VALID     (1 << 1)   
    195 #define BCM_FLOW_TUNNEL_INIT_DIP_VALID      (1 << 2)   
    196 #define BCM_FLOW_TUNNEL_INIT_SIP_VALID      (1 << 3)   
    197 #define BCM_FLOW_TUNNEL_INIT_SIP6_VALID     (1 << 4)   
    198 #define BCM_FLOW_TUNNEL_INIT_DIP6_VALID     (1 << 5)   
    199 #define BCM_FLOW_TUNNEL_INIT_FLOW_LABEL_VALID (1 << 6)   
    200 #define BCM_FLOW_TUNNEL_INIT_DSCP_VALID     (1 << 7)   
    201 #define BCM_FLOW_TUNNEL_INIT_UDP_SPORT_VALID (1 << 8)   
    202 #define BCM_FLOW_TUNNEL_INIT_UDP_DPORT_VALID (1 << 9)   
    203 #define BCM_FLOW_TUNNEL_INIT_SMAC_VALID     (1 << 10)  
    204 #define BCM_FLOW_TUNNEL_INIT_VLAN_VALID     (1 << 11)  
    205 #define BCM_FLOW_TUNNEL_INIT_TPID_VALID     (1 << 12)  
    206 #define BCM_FLOW_TUNNEL_INIT_PKT_PRI_VALID  (1 << 13)  
    207 #define BCM_FLOW_TUNNEL_INIT_PKT_CFI_VALID  (1 << 14)  
    208 #define BCM_FLOW_TUNNEL_INIT_IP4_ID_VALID   (1 << 15)  
    209 #define BCM_FLOW_TUNNEL_INIT_FLEX_VALID     (1 << 16)  
    210 #define BCM_FLOW_TUNNEL_INIT_DSCP_ECN_VALID (1 << 17)  
    211 #endif
    212 
    213 #if defined(INCLUDE_L3)
    214 /* Flow tunneling initiator structure. */
    215 typedef struct bcm_flow_tunnel_initiator_s {
    216     uint32 flags;                       /* Configuration flags. */
    217     bcm_tunnel_type_t type;             /* Tunnel type. */
    218     int ttl;                            /* Tunnel header TTL. */
    219     bcm_mac_t dmac;                     /* Destination MAC address. */
    220     bcm_ip_t dip;                       /* Tunnel header DIP (IPv4). */
    221     bcm_ip_t sip;                       /* Tunnel header SIP (IPv4). */
    222     bcm_ip6_t sip6;                     /* Tunnel header SIP (IPv6). */
    223     bcm_ip6_t dip6;                     /* Tunnel header DIP (IPv6). */
    224     uint32 flow_label;                  /* Tunnel header flow label (IPv6). */
    225     bcm_tunnel_dscp_select_t dscp_sel;  /* Tunnel header DSCP select. */
    226     int dscp;                           /* Tunnel header DSCP value. */
    227     int dscp_map;                       /* DSCP-map ID. */
    228     bcm_gport_t tunnel_id;              /* Tunnel ID */
    229     uint16 udp_dst_port;                /* Destination UDP port */
    230     uint16 udp_src_port;                /* Source UDP port */
    231     bcm_mac_t smac;                     /* Src MAC */
    232     bcm_vlan_t vlan;                    /* Tunnel VLAN */
    233     uint16 tpid;                        /* Tunnel TPID */
    234     uint8 pkt_pri;                      /* Tunnel priority */
    235     uint8 pkt_cfi;                      /* Tunnel CFI */
    236     uint16 ip4_id;                      /* IPv4 ID. */
    237     bcm_if_t l3_intf_id;                /* l3 Interface ID. */
    238     bcm_gport_t flow_port;              /* Flow port ID */
    239     uint32 valid_elements;              /* bitmap of valid fields */
    240     uint32 flow_handle;                 /* flow handle */
    241     uint32 flow_option;                 /* flow option */
    242     bcm_tunnel_dscp_ecn_select_t dscp_ecn_sel; /* Tunnel header DSCP and ECN select. */
    243     int dscp_ecn_map;                   /* DSCP and ECN map ID. */
    244     uint8 ecn;                          /* Tunnel header ECN value */
    245 } bcm_flow_tunnel_initiator_t;
    246 #endif
    247 
    248 #if defined(INCLUDE_L3)
    249 /* Initialize bcm_flow_tunnel_initiator_t structure. */
    250 extern void bcm_flow_tunnel_initiator_t_init(
    251     bcm_flow_tunnel_initiator_t *info);
    252 #endif
    253 
    254 #ifndef BCM_HIDE_DISPATCHABLE
    255 
    256 #if defined(INCLUDE_L3)
    257 /* Create a flow tunnel initiator object */
    258 extern int bcm_flow_tunnel_initiator_create(
    259     int unit, 
    260     bcm_flow_tunnel_initiator_t *info, 
    261     uint32 num_of_fields, 
    262     bcm_flow_logical_field_t *field);
    263 #endif
    264 
    265 #if defined(INCLUDE_L3)
    266 /* Delete the flow tunnel initiator object */
    267 extern int bcm_flow_tunnel_initiator_destroy(
    268     int unit, 
    269     bcm_gport_t flow_tunnel_id);
    270 #endif
    271 
    272 #if defined(INCLUDE_L3)
    273 /* Get the flow tunnel initiator object */
    274 extern int bcm_flow_tunnel_initiator_get(
    275     int unit, 
    276     bcm_flow_tunnel_initiator_t *info, 
    277     uint32 num_of_fields, 
    278     bcm_flow_logical_field_t *field);
    279 #endif
    280 
    281 #endif /* BCM_HIDE_DISPATCHABLE */
    282 
    283 /* bcm_flow_tunnel_initiator_traverse callback */
    284 #if defined(INCLUDE_L3)
    285 typedef int (*bcm_flow_tunnel_initiator_traverse_cb)(
    286     int unit, 
    287     bcm_flow_tunnel_initiator_t *info, 
    288     uint32 num_of_fields, 
    289     bcm_flow_logical_field_t *field, 
    290     void *user_data);
    291 #endif
    292 
    293 #ifndef BCM_HIDE_DISPATCHABLE
    294 
    295 #if defined(INCLUDE_L3)
    296 /* Traverse tunnel initiator entries */
    297 extern int bcm_flow_tunnel_initiator_traverse(
    298     int unit, 
    299     bcm_flow_tunnel_initiator_traverse_cb cb, 
    300     void *user_data);
    301 #endif
    302 
    303 #endif /* BCM_HIDE_DISPATCHABLE */
    304 
    305 #if defined(INCLUDE_L3)
    306 /* Flow tunnel terminator valid elements. */
    307 #define BCM_FLOW_TUNNEL_TERM_VRF_VALID      (1 << 0)   
    308 #define BCM_FLOW_TUNNEL_TERM_SIP_VALID      (1 << 1)   
    309 #define BCM_FLOW_TUNNEL_TERM_DIP_VALID      (1 << 2)   
    310 #define BCM_FLOW_TUNNEL_TERM_SIP_MASK_VALID (1 << 3)   
    311 #define BCM_FLOW_TUNNEL_TERM_DIP_MASK_VALID (1 << 4)   
    312 #define BCM_FLOW_TUNNEL_TERM_SIP6_VALID     (1 << 5)   
    313 #define BCM_FLOW_TUNNEL_TERM_DIP6_VALID     (1 << 6)   
    314 #define BCM_FLOW_TUNNEL_TERM_SIP6_MASK_VALID (1 << 7)   
    315 #define BCM_FLOW_TUNNEL_TERM_DIP6_MASK_VALID (1 << 8)   
    316 #define BCM_FLOW_TUNNEL_TERM_UDP_SRC_PORT_VALID (1 << 9)   
    317 #define BCM_FLOW_TUNNEL_TERM_UDP_DST_PORT_VALID (1 << 10)  
    318 #define BCM_FLOW_TUNNEL_TERM_VLAN_VALID     (1 << 11)  
    319 #define BCM_FLOW_TUNNEL_TERM_PROTOCOL_VALID (1 << 12)  
    320 #define BCM_FLOW_TUNNEL_TERM_FLEX_KEY_VALID (1 << 13)  
    321 #define BCM_FLOW_TUNNEL_TERM_FLEX_DATA_VALID (1 << 14)  
    322 #define BCM_FLOW_TUNNEL_TERM_VLAN_MASK_VALID (1 << 15)  
    323 #define BCM_FLOW_TUNNEL_TERM_CLASS_ID_VALID (1 << 16)  
    324 #define BCM_FLOW_TUNNEL_TERM_PBMP_VALID     (1 << 17)  
    325 #endif
    326 
    327 #if defined(INCLUDE_L3)
    328 /* Flow tunnel terminator multicast tunnel states - bug flags */
    329 #define BCM_FLOW_MULTICAST_TUNNEL_STATE_BUD_ENABLE (1 << 1)   
    330 #define BCM_FLOW_MULTICAST_TUNNEL_STATE_BUD_DISABLE (1 << 2)   
    331 #endif
    332 
    333 #if defined(INCLUDE_L3)
    334 /* Flow tunneling terminator structure. */
    335 typedef struct bcm_flow_tunnel_terminator_s {
    336     uint32 flags;           /* Configuration flags. Use BCM_TUNNEL flags */
    337     uint32 multicast_flag;  /* VXLAN Multicast trigger flags. */
    338     bcm_vrf_t vrf;          /* Virtual router instance. */
    339     bcm_ip_t sip;           /* SIP for tunnel header match. */
    340     bcm_ip_t dip;           /* DIP for tunnel header match. */
    341     bcm_ip_t sip_mask;      /* Source IP mask. */
    342     bcm_ip_t dip_mask;      /* Destination IP mask. */
    343     bcm_ip6_t sip6;         /* SIP for tunnel header match (IPv6). */
    344     bcm_ip6_t dip6;         /* DIP for tunnel header match (IPv6). */
    345     bcm_ip6_t sip6_mask;    /* Source IP mask (IPv6). */
    346     bcm_ip6_t dip6_mask;    /* Destination IP mask (IPv6). */
    347     uint32 udp_dst_port;    /* UDP dst port for UDP packets. */
    348     uint32 udp_src_port;    /* UDP src port for UDP packets */
    349     bcm_tunnel_type_t type; /* Tunnel type */
    350     bcm_vlan_t vlan;        /* VLAN ID for tunnel header match. */
    351     uint32 protocol;        /* Protocol type */
    352     uint32 valid_elements;  /* bitmap of valid fields */
    353     uint32 flow_handle;     /* flow handle */
    354     uint32 flow_option;     /* flow option */
    355     bcm_vlan_t vlan_mask;   /* The VLAN ID mask. */
    356     uint32 class_id;        /* Class ID as a key in VFP. */
    357     bcm_pbmp_t term_pbmp;   /* Allowed port bitmap for tunnel termination. */
    358 } bcm_flow_tunnel_terminator_t;
    359 #endif
    360 
    361 #if defined(INCLUDE_L3)
    362 /* Initialize bcm_flow_tunnel_terminator_t structure. */
    363 extern void bcm_flow_tunnel_terminator_t_init(
    364     bcm_flow_tunnel_terminator_t *info);
    365 #endif
    366 
    367 #ifndef BCM_HIDE_DISPATCHABLE
    368 
    369 #if defined(INCLUDE_L3)
    370 /* Create a flow tunnel terminator object. */
    371 extern int bcm_flow_tunnel_terminator_create(
    372     int unit, 
    373     bcm_flow_tunnel_terminator_t *info, 
    374     uint32 num_of_fields, 
    375     bcm_flow_logical_field_t *field);
    376 #endif
    377 
    378 #if defined(INCLUDE_L3)
    379 /* Delete a flow tunnel terminator object. */
    380 extern int bcm_flow_tunnel_terminator_destroy(
    381     int unit, 
    382     bcm_flow_tunnel_terminator_t *info, 
    383     uint32 num_of_fields, 
    384     bcm_flow_logical_field_t *field);
    385 #endif
    386 
    387 #if defined(INCLUDE_L3)
    388 /* Get the flow tunnel terminator object. */
    389 extern int bcm_flow_tunnel_terminator_get(
    390     int unit, 
    391     bcm_flow_tunnel_terminator_t *info, 
    392     uint32 num_of_fields, 
    393     bcm_flow_logical_field_t *field);
    394 #endif
    395 
    396 #endif /* BCM_HIDE_DISPATCHABLE */
    397 
    398 /* bcm_flow_tunnel_terminator_traverse callback */
    399 #if defined(INCLUDE_L3)
    400 typedef int (*bcm_flow_tunnel_terminator_traverse_cb)(
    401     int unit, 
    402     bcm_flow_tunnel_terminator_t *info, 
    403     uint32 num_of_fields, 
    404     bcm_flow_logical_field_t *field, 
    405     void *user_data);
    406 #endif
    407 
    408 #ifndef BCM_HIDE_DISPATCHABLE
    409 
    410 #if defined(INCLUDE_L3)
    411 /* Traverse tunnel terminator entries */
    412 extern int bcm_flow_tunnel_terminator_traverse(
    413     int unit, 
    414     bcm_flow_tunnel_terminator_traverse_cb cb, 
    415     void *user_data);
    416 #endif
    417 
    418 #endif /* BCM_HIDE_DISPATCHABLE */
    419 
    420 #if defined(INCLUDE_L3)
    421 /* Flow port encap valid elements. */
    422 #define BCM_FLOW_PORT_ENCAP_PORT_VALID      (1 << 0)   /* flow port(DVP) valid */
    423 #define BCM_FLOW_PORT_ENCAP_CLASS_ID_VALID  (1 << 1)   /* class id valid. */
    424 #define BCM_FLOW_PORT_ENCAP_MTU_VALID       (1 << 2)   /* mtu valid. */
    425 #define BCM_FLOW_PORT_ENCAP_FLAGS_VALID     (1 << 3)   /* flags valid. */
    426 #define BCM_FLOW_PORT_ENCAP_NETWORK_GROUP_VALID (1 << 4)   /* network group valid. */
    427 #define BCM_FLOW_PORT_ENCAP_DVP_GROUP_VALID (1 << 5)   /* DVP group valid. */
    428 #define BCM_FLOW_PORT_ENCAP_FLEX_DATA_VALID (1 << 6)   /* logical field valid. */
    429 #define BCM_FLOW_PORT_ENCAP_PKT_PRI_VALID   (1 << 7)   /* service tag priority
    430                                                           valid. */
    431 #define BCM_FLOW_PORT_ENCAP_PKT_CFI_VALID   (1 << 8)   /* service tag CFI valid. */
    432 #define BCM_FLOW_PORT_ENCAP_TPID_VALID      (1 << 9)   /* service tag TPID
    433                                                           valid. */
    434 #define BCM_FLOW_PORT_ENCAP_VLAN_VALID      (1 << 10)  /* vlan valid */
    435 #define BCM_FLOW_PORT_ENCAP_EGRESS_IF_VALID (1 << 11)  /* egress object valid */
    436 #define BCM_FLOW_PORT_ENCAP_IP4_ID_VALID    (1 << 12)  /* IPv4 ID valid */
    437 #define BCM_FLOW_PORT_ENCAP_VLAN_PRI_MAP_ID_VALID (1 << 13)  /* vlan_pri_map_id Valid */
    438 #define BCM_FLOW_PORT_ENCAP_DST_PORT_VALID  (1 << 14)  /* Destination port
    439                                                           valid. */
    440 #define BCM_FLOW_PORT_ENCAP_ES_ID_VALID     (1 << 15)  /* Ethernet segment ID
    441                                                           valid. */
    442 #endif
    443 
    444 #if defined(INCLUDE_L3)
    445 /* Flow port encap set options */
    446 #define BCM_FLOW_PORT_ENCAP_OPTION_REPLACE  (1 << 1)   /* replace encap
    447                                                           attributes. */
    448 #define BCM_FLOW_PORT_ENCAP_OPTION_CLEAR    (1 << 2)   /* clear encap
    449                                                           attributes. */
    450 #endif
    451 
    452 #if defined(INCLUDE_L3)
    453 /* Flow port encap flags for hardware control parameters */
    454 #define BCM_FLOW_PORT_ENCAP_FLAG_SERVICE_TAGGED (1 << 0)   /* service tag mode for
    455                                                           the given encap
    456                                                           criteria. */
    457 #define BCM_FLOW_PORT_ENCAP_FLAG_SERVICE_VLAN_ADD (1 << 1)   /* Add SD-TAG vlan. */
    458 #define BCM_FLOW_PORT_ENCAP_FLAG_SERVICE_VLAN_TPID_REPLACE (1 << 2)   /* Replace Vlan and TPID. */
    459 #define BCM_FLOW_PORT_ENCAP_FLAG_VLAN_REPLACE (1 << 3)   /* Replace vlan. */
    460 #define BCM_FLOW_PORT_ENCAP_FLAG_VLAN_DELETE (1 << 4)   /* Delete vlan. */
    461 #define BCM_FLOW_PORT_ENCAP_FLAG_VLAN_PRI_TPID_REPLACE (1 << 5)   /* Replace vlan, priority
    462                                                           and tpid. */
    463 #define BCM_FLOW_PORT_ENCAP_FLAG_VLAN_PRI_REPLACE (1 << 6)   /* Replace vlan and
    464                                                           priority. */
    465 #define BCM_FLOW_PORT_ENCAP_FLAG_PRI_REPLACE (1 << 7)   /* Replace priority. */
    466 #define BCM_FLOW_PORT_ENCAP_FLAG_TPID_REPLACE (1 << 8)   /* Replace TPID. */
    467 #define BCM_FLOW_PORT_ENCAP_FLAG_LOCAL      (1 << 9)   /* Encapsulate the FLOW
    468                                                           tunnel on local device */
    469 #define BCM_FLOW_PORT_ENCAP_FLAG_DROP       (1 << 10)  /* Multicast drop control */
    470 #define BCM_FLOW_PORT_ENCAP_FLAG_MACSEC_ENCRYPT (1 << 11)  /* Enable macsec
    471                                                           encryption for this
    472                                                           flow. */
    473 #define BCM_FLOW_PORT_ENCAP_FLAG_IP4_ID_SET_FIXED (1 << 12)  /* Use fixed starting ID
    474                                                           for IPv4 tunnel */
    475 #define BCM_FLOW_PORT_ENCAP_FLAG_IP4_ID_SET_RANDOM (1 << 13)  /* Use random starting ID
    476                                                           for IPv4 tunnel */
    477 #define BCM_FLOW_PORT_ENCAP_FLAG_EGRESS_CASCADED (1 << 14)  /* Indicate the egress
    478                                                           object is linked to
    479                                                           the flow port. */
    480 #define BCM_FLOW_PORT_ENCAP_FLAG_OPAQUE_TAGGED (1 << 15)  /* Opaque tag mode. */
    481 #define BCM_FLOW_PORT_ENCAP_FLAG_OPAQUE_TAG_REPLACE (1 << 16)  /* Replace the opaque
    482                                                           tag. */
    483 #define BCM_FLOW_PORT_ENCAP_FLAG_OPAQUE_TAG_DELETE (1 << 17)  /* Delete the opaque tag. */
    484 #define BCM_FLOW_PORT_ENCAP_FLAG_OPAQUE_TAG_ADD (1 << 18)  /* Add the opaque tag. */
    485 #endif
    486 
    487 #if defined(INCLUDE_L3)
    488 /* flow port encap config structure. */
    489 typedef struct bcm_flow_port_encap_s {
    490     bcm_gport_t flow_port;          /* flow port id identifies DVP. */
    491     uint32 options;                 /* BCM_FLOW_PORT_ENCAP_xxx. */
    492     uint32 flags;                   /* BCM_FLOW_PORT_ENCAP_FLAG_xxx. */
    493     uint32 class_id;                /* class id. */
    494     uint16 mtu;                     /* MTU. */
    495     uint32 network_group;           /* network group ID */
    496     uint32 dvp_group;               /* DVP group ID */
    497     uint8 pri;                      /* service tag priority. */
    498     uint8 cfi;                      /* service tag cfi */
    499     uint16 tpid;                    /* service tag tpid */
    500     bcm_vlan_t vlan;                /* service VLAN ID. */
    501     bcm_if_t egress_if;             /* egress object */
    502     uint32 valid_elements;          /* bitmap of valid fields for hardware
    503                                        parameters */
    504     bcm_flow_handle_t flow_handle;  /* flow handle */
    505     uint32 flow_option;             /* flow option id */
    506     uint16 ip4_id;                  /* IPv4 ID */
    507     int vlan_pri_map_id;            /* Remarking map ID for the payload VLAN
    508                                        priority and CFI. */
    509     bcm_gport_t dst_port;           /* Destination port / trunk. */
    510     uint32 es_id;                   /* Ethernet segment ID. */
    511 } bcm_flow_port_encap_t;
    512 #endif
    513 
    514 #if defined(INCLUDE_L3)
    515 /* Initialize the bcm_flow_port_encap_t configuration structure */
    516 extern void bcm_flow_port_encap_t_init(
    517     bcm_flow_port_encap_t *info);
    518 #endif
    519 
    520 #ifndef BCM_HIDE_DISPATCHABLE
    521 
    522 #if defined(INCLUDE_L3)
    523 /* Set the L2 tunnel encapsulation parameters for the given flow_port */
    524 extern int bcm_flow_port_encap_set(
    525     int unit, 
    526     bcm_flow_port_encap_t *info, 
    527     uint32 num_of_fields, 
    528     bcm_flow_logical_field_t *field);
    529 #endif
    530 
    531 #if defined(INCLUDE_L3)
    532 /* Get the encapsulation configuration parameters */
    533 extern int bcm_flow_port_encap_get(
    534     int unit, 
    535     bcm_flow_port_encap_t *info, 
    536     uint32 num_of_fields, 
    537     bcm_flow_logical_field_t *field);
    538 #endif
    539 
    540 #endif /* BCM_HIDE_DISPATCHABLE */
    541 
    542 #if defined(INCLUDE_L3)
    543 /* Flow encap options */
    544 #define BCM_FLOW_ENCAP_OPTION_REPLACE   (1 << 1)   /* replace object attributes
    545                                                       for a encap criteria. */
    546 #endif
    547 
    548 #if defined(INCLUDE_L3)
    549 /* Flow encap flags for hardware control parameters */
    550 #define BCM_FLOW_ENCAP_FLAG_SERVICE_TAGGED  (1 << 0)   /* service tag mode for
    551                                                           the given encap
    552                                                           criteria. */
    553 #define BCM_FLOW_ENCAP_FLAG_SERVICE_VLAN_ADD (1 << 1)   /* Add SD-TAG vlan. */
    554 #define BCM_FLOW_ENCAP_FLAG_SERVICE_VLAN_TPID_REPLACE (1 << 2)   /* Replace Vlan and TPID. */
    555 #define BCM_FLOW_ENCAP_FLAG_VLAN_REPLACE    (1 << 3)   /* Replace vlan. */
    556 #define BCM_FLOW_ENCAP_FLAG_VLAN_DELETE     (1 << 4)   /* Delete vlan. */
    557 #define BCM_FLOW_ENCAP_FLAG_VLAN_PRI_TPID_REPLACE (1 << 5)   /* Replace vlan, priority
    558                                                           and tpid. */
    559 #define BCM_FLOW_ENCAP_FLAG_VLAN_PRI_REPLACE (1 << 6)   /* Replace vlan and
    560                                                           priority. */
    561 #define BCM_FLOW_ENCAP_FLAG_PRI_REPLACE     (1 << 7)   /* Replace priority. */
    562 #define BCM_FLOW_ENCAP_FLAG_TPID_REPLACE    (1 << 8)   /* Replace TPID. */
    563 #define BCM_FLOW_ENCAP_FLAG_DROP            (1 << 9)   /* Drop packet. */
    564 #define BCM_FLOW_ENCAP_FLAG_HIGIG3_EXTENSION_ADD (1 << 10)  /* Add a HIGIG3 extension
    565                                                           header. */
    566 #define BCM_FLOW_ENCAP_FLAG_OPAQUE_TAGGED   (1 << 11)  /* Opaque tag mode. */
    567 #define BCM_FLOW_ENCAP_FLAG_OPAQUE_TAG_REPLACE (1 << 12)  /* Replace the opaque
    568                                                           tag. */
    569 #define BCM_FLOW_ENCAP_FLAG_OPAQUE_TAG_DELETE (1 << 13)  /* Delete the opaque tag. */
    570 #define BCM_FLOW_ENCAP_FLAG_OPAQUE_TAG_ADD  (1 << 14)  /* Add the opaque tag. */
    571 #endif
    572 
    573 #if defined(INCLUDE_L3)
    574 /* Flow encap valid elements for hardware parameters. */
    575 #define BCM_FLOW_ENCAP_VNID_VALID           (1 << 0)   /* VN_ID element is valid
    576                                                           for this encap. */
    577 #define BCM_FLOW_ENCAP_VLAN_VALID           (1 << 1)   /* vlan valid */
    578 #define BCM_FLOW_ENCAP_FLOW_PORT_VALID      (1 << 2)   /* flow port valid */
    579 #define BCM_FLOW_ENCAP_VPN_VALID            (1 << 3)   /* vpn valid. */
    580 #define BCM_FLOW_ENCAP_INTF_VALID           (1 << 4)   /* interface valid. */
    581 #define BCM_FLOW_ENCAP_PKT_PRI_VALID        (1 << 5)   /* service tag priority
    582                                                           valid. */
    583 #define BCM_FLOW_ENCAP_PKT_CFI_VALID        (1 << 6)   /* service tag CFI valid. */
    584 #define BCM_FLOW_ENCAP_TPID_VALID           (1 << 7)   /* service tag TPID
    585                                                           valid. */
    586 #define BCM_FLOW_ENCAP_FLEX_KEY_VALID       (1 << 8)   /* logical fields for
    587                                                           key. */
    588 #define BCM_FLOW_ENCAP_FLEX_DATA_VALID      (1 << 9)   /* logical fields for
    589                                                           attributes. */
    590 #define BCM_FLOW_ENCAP_DVP_GROUP_VALID      (1 << 10)  /* DVP group ID. */
    591 #define BCM_FLOW_ENCAP_OIF_GROUP_VALID      (1 << 11)  /* L3 OUT interface group
    592                                                           ID. */
    593 #define BCM_FLOW_ENCAP_FLAGS_VALID          (1 << 12)  /* flags for hardware
    594                                                           control parameters. */
    595 #define BCM_FLOW_ENCAP_SRC_FLOW_PORT_VALID  (1 << 13)  /* SVP valid. */
    596 #define BCM_FLOW_ENCAP_CLASS_ID_VALID       (1 << 14)  /* CLASS_ID valid. */
    597 #define BCM_FLOW_ENCAP_INT_PRI_VALID        (1 << 15)  /* INT_PRI valid. */
    598 #define BCM_FLOW_ENCAP_PORT_GROUP_VALID     (1 << 16)  /* PORT_GROUP valid. */
    599 #endif
    600 
    601 #if defined(INCLUDE_L3)
    602 /* flow encap criteria. */
    603 typedef enum bcm_flow_encap_criteria_e {
    604     BCM_FLOW_ENCAP_CRITERIA_INVALID = 0, /* Illegal. */
    605     BCM_FLOW_ENCAP_CRITERIA_DVP = 1,    /* DVP used as a key. */
    606     BCM_FLOW_ENCAP_CRITERIA_VFI = 2,    /* VFI key. */
    607     BCM_FLOW_ENCAP_CRITERIA_VFI_DVP = 3, /* VFI + DVP key. */
    608     BCM_FLOW_ENCAP_CRITERIA_VRF_MAPPING = 4, /* VRF mapping key. */
    609     BCM_FLOW_ENCAP_CRITERIA_L3_INTF = 5, /* L3 interface key. */
    610     BCM_FLOW_ENCAP_CRITERIA_VFI_DVP_GROUP = 6, /* VFI + DVP group key. */
    611     BCM_FLOW_ENCAP_CRITERIA_FLEX = 7,   /* flex key from logical fields */
    612     BCM_FLOW_ENCAP_CRITERIA_SVP_DVP = 8, /* SVP + DVP key. */
    613     BCM_FLOW_ENCAP_CRITERIA_DGPP_INT_PRI = 9, /* DGPP + INT_PRI key. */
    614     BCM_FLOW_ENCAP_CRITERIA_DGPP_VLAN_INT_PRI = 10, /* DGPP + VLAN + INT_PRI key. */
    615     BCM_FLOW_ENCAP_CRITERIA_VFI_PORT_GROUP = 11, /* VFI + port group key. */
    616     BCM_FLOW_ENCAP_CRITERIA_COUNT = 12  /* Must be last. */
    617 } bcm_flow_encap_criteria_t;
    618 #endif
    619 
    620 #if defined(INCLUDE_L3)
    621 /* Flow encap config structure */
    622 typedef struct bcm_flow_encap_config_s {
    623     bcm_vpn_t vpn;                      /* VPN representing a vfi or vrf */
    624     bcm_gport_t flow_port;              /* flow port id representing a DVP */
    625     bcm_if_t intf_id;                   /* l3 interface id */
    626     uint32 dvp_group;                   /* DVP group ID */
    627     uint32 oif_group;                   /* L3 OUT interface group ID */
    628     uint32 vnid;                        /* VN_ID. */
    629     uint8 pri;                          /* service tag priority. */
    630     uint8 cfi;                          /* service tag cfi */
    631     uint16 tpid;                        /* service tag tpid */
    632     bcm_vlan_t vlan;                    /* service VLAN ID. */
    633     uint32 flags;                       /* BCM_FLOW_ENCAP_FLAG_xxx. */
    634     uint32 options;                     /* BCM_FLOW_ENCAP_OPTION_xxx. */
    635     bcm_flow_encap_criteria_t criteria; /* flow encap criteria. */
    636     uint32 valid_elements;              /* bitmap of valid fields for the encap
    637                                            action */
    638     bcm_flow_handle_t flow_handle;      /* flow handle derived from flow name */
    639     uint32 flow_option;                 /* flow option derived from flow option
    640                                            name */
    641     bcm_gport_t src_flow_port;          /* flow port id representing a SVP */
    642     uint32 class_id;                    /* Class ID as a key in EFP. */
    643     uint32 port_group;                  /* Port group ID. */
    644 } bcm_flow_encap_config_t;
    645 #endif
    646 
    647 /* bcm_flow_encap_traverse callback */
    648 #if defined(INCLUDE_L3)
    649 typedef int (*bcm_flow_encap_traverse_cb)(
    650     int unit, 
    651     bcm_flow_encap_config_t *info, 
    652     uint32 num_of_fields, 
    653     bcm_flow_logical_field_t *field, 
    654     void *user_data);
    655 #endif
    656 
    657 #if defined(INCLUDE_L3)
    658 /* Initialize flow encap config structure. */
    659 extern void bcm_flow_encap_config_t_init(
    660     bcm_flow_encap_config_t *flow_encap);
    661 #endif
    662 
    663 #ifndef BCM_HIDE_DISPATCHABLE
    664 
    665 #if defined(INCLUDE_L3)
    666 /* Add a flow encap entry for L2 tunnel or L3 tunnel. */
    667 extern int bcm_flow_encap_add(
    668     int unit, 
    669     bcm_flow_encap_config_t *info, 
    670     uint32 num_of_fields, 
    671     bcm_flow_logical_field_t *field);
    672 #endif
    673 
    674 #if defined(INCLUDE_L3)
    675 /* Delete a flow encap entry based on the given key. */
    676 extern int bcm_flow_encap_delete(
    677     int unit, 
    678     bcm_flow_encap_config_t *info, 
    679     uint32 num_of_fields, 
    680     bcm_flow_logical_field_t *field);
    681 #endif
    682 
    683 #if defined(INCLUDE_L3)
    684 /* Get a flow encap entry based on the given key. */
    685 extern int bcm_flow_encap_get(
    686     int unit, 
    687     bcm_flow_encap_config_t *info, 
    688     uint32 num_of_fields, 
    689     bcm_flow_logical_field_t *field);
    690 #endif
    691 
    692 #if defined(INCLUDE_L3)
    693 /* Traverse encap entries */
    694 extern int bcm_flow_encap_traverse(
    695     int unit, 
    696     bcm_flow_encap_traverse_cb cb, 
    697     void *user_data);
    698 #endif
    699 
    700 #endif /* BCM_HIDE_DISPATCHABLE */
    701 
    702 #if defined(INCLUDE_L3)
    703 /* BCM_FLOW_* flags. */
    704 #define BCM_FLOW_PORT_WITH_ID               (1 << 0)   /* create FLOW port with
    705                                                           specified ID */
    706 #define BCM_FLOW_PORT_NETWORK               (1 << 1)   /* Network facing
    707                                                           interface */
    708 #define BCM_FLOW_PORT_COUNTED               (1 << 2)   /* Maintain packet/byte
    709                                                           counts */
    710 #define BCM_FLOW_PORT_REPLACE               (1 << 3)   /* Replace existing entry */
    711 #define BCM_FLOW_PORT_SERVICE_TAGGED        (1 << 4)   /* Service tag mode */
    712 #define BCM_FLOW_PORT_DEFAULT               (1 << 5)   /* Create VXLAN Default
    713                                                           Network Port */
    714 #define BCM_FLOW_PORT_DEFAULT_L2GRE         (1 << 6)   /* Create L2GRE Default
    715                                                           Network Port */
    716 #define BCM_FLOW_PORT_DEFAULT_GPE           (1 << 7)   /* Create GPE Default
    717                                                           Network Port */
    718 #define BCM_FLOW_PORT_DEFAULT_GENEVE        (1 << 8)   /* Create GENEVE Default
    719                                                           Network Port */
    720 #define BCM_FLOW_PORT_MULTICAST_GROUP_REMAP (1 << 9)   /* Remap the multicast
    721                                                           group to a new one. */
    722 #endif
    723 
    724 /* Flow port split horizon drop mode. */
    725 typedef enum bcm_flow_port_split_horizon_drop_e {
    726     bcmFlowPortSplitHorizonDropAll = 0, /* Drop both L2 and L3 packets. */
    727     bcmFlowPortSplitHorizonDropL2 = 1,  /* Drop L2 packets. */
    728     bcmFlowPortSplitHorizonDropCount = 2 /* Must be last. */
    729 } bcm_flow_port_split_horizon_drop_t;
    730 
    731 /* Flex Flow VP Config Structure. */
    732 typedef struct bcm_flow_port_s {
    733     bcm_gport_t flow_port_id;           /* GPORT identifier. */
    734     uint32 flags;                       /* BCM_FLOW_PORT_xxx. */
    735     uint32 if_class;                    /* Interface Class ID. */
    736     bcm_switch_network_group_t network_group_id; /* Split Horizon network group
    737                                            identifier. */
    738     uint16 egress_service_tpid;         /* Service Vlan TPID Value. */
    739     int dscp_map_id;                    /* DSCP based PHB map ID. */
    740     int vlan_pri_map_id;                /* VLAN priority and CFI based PHB map
    741                                            ID. */
    742     bcm_flow_port_split_horizon_drop_t drop_mode; /* Drop mode when the split horizon
    743                                            check fails. */
    744     int ingress_opaque_ctrl_id;         /* Ingress opaque control ID. */
    745 } bcm_flow_port_t;
    746 
    747 #ifndef BCM_HIDE_DISPATCHABLE
    748 
    749 #if defined(INCLUDE_L3)
    750 /* Initialize the BCM FOW subsystem. */
    751 extern int bcm_flow_init(
    752     int unit);
    753 #endif
    754 
    755 #if defined(INCLUDE_L3)
    756 /* Detach the BCM FLOW subsystem. */
    757 extern int bcm_flow_cleanup(
    758     int unit);
    759 #endif
    760 
    761 #endif /* BCM_HIDE_DISPATCHABLE */
    762 
    763 #if defined(INCLUDE_L3)
    764 /* Initialize the bcm_flow_port_t structure */
    765 extern void bcm_flow_port_t_init(
    766     bcm_flow_port_t *flow_port);
    767 #endif
    768 
    769 #ifndef BCM_HIDE_DISPATCHABLE
    770 
    771 #if defined(INCLUDE_L3)
    772 /* 
    773  * Create a flow port
    774  * bcm_flow_port_create creates an Access or Network FLOW port
    775  */
    776 extern int bcm_flow_port_create(
    777     int unit, 
    778     bcm_vpn_t vpn, 
    779     bcm_flow_port_t *flow_port);
    780 #endif
    781 
    782 #if defined(INCLUDE_L3)
    783 /* bcm_flow_port_destroy FLOW port from FLOW network. */
    784 extern int bcm_flow_port_destroy(
    785     int unit, 
    786     bcm_vpn_t vpn, 
    787     bcm_gport_t flow_port);
    788 #endif
    789 
    790 #if defined(INCLUDE_L3)
    791 /* Get FLOW port information. */
    792 extern int bcm_flow_port_get(
    793     int unit, 
    794     bcm_vpn_t vpn, 
    795     bcm_flow_port_t *flow_port);
    796 #endif
    797 
    798 #if defined(INCLUDE_L3)
    799 /* Get all FLOW port information. */
    800 extern int bcm_flow_port_get_all(
    801     int unit, 
    802     bcm_vpn_t vpn, 
    803     int port_max, 
    804     bcm_flow_port_t *flow_port, 
    805     int *port_count);
    806 #endif
    807 
    808 #endif /* BCM_HIDE_DISPATCHABLE */
    809 
    810 #if defined(INCLUDE_L3)
    811 /* FLOW VPN Definitions. */
    812 #define BCM_FLOW_VPN_ELINE      0x0001     /* ELINE FLOW VPN */
    813 #define BCM_FLOW_VPN_ELAN       0x0002     /* ELAN FLOW VPN */
    814 #define BCM_FLOW_VPN_WITH_ID    0x0004     /* With Id FLOW VPN */
    815 #define BCM_FLOW_VPN_REPLACE    0x0008     /* Replace VPN Id FLOW VPN */
    816 #define BCM_FLOW_VPN_INVALID    0xFFFF     /* Invalid FLOW VPN */
    817 #endif
    818 
    819 /* Flow L2 VPN Config Structure. */
    820 typedef struct bcm_flow_vpn_config_s {
    821     uint32 flags;                       /* L2 VPN config flags. */
    822     bcm_multicast_t broadcast_group;    /* broadcast group. */
    823     bcm_multicast_t unknown_unicast_group; /* unknown unicast group. */
    824     bcm_multicast_t unknown_multicast_group; /* unknown multicast group. */
    825     bcm_vlan_protocol_packet_ctrl_t protocol_pkt; /* protocol packet handling */
    826     bcm_gport_t match_port_class;       /* port class */
    827 } bcm_flow_vpn_config_t;
    828 
    829 /* bcm_flow_vpn_traverse callback */
    830 #if defined(INCLUDE_L3)
    831 typedef int (*bcm_flow_vpn_traverse_cb)(
    832     int unit, 
    833     bcm_vpn_t vpn, 
    834     bcm_flow_vpn_config_t *info, 
    835     void *user_data);
    836 #endif
    837 
    838 #if defined(INCLUDE_L3)
    839 /* Initialize FLOW VPN config structure. */
    840 extern void bcm_flow_vpn_config_t_init(
    841     bcm_flow_vpn_config_t *info);
    842 #endif
    843 
    844 #ifndef BCM_HIDE_DISPATCHABLE
    845 
    846 #if defined(INCLUDE_L3)
    847 /* 
    848  * Create or update FLOW VPN. The FLOW VPN provides a forwarding domain
    849  * between FLOW ports, independent of a FLOW port's transport protocol.
    850  *  Use BCM_FLOW_VPN_REPLACE to update an existing FLOW_VPN.
    851  */
    852 extern int bcm_flow_vpn_create(
    853     int unit, 
    854     bcm_vpn_t *vpn, 
    855     bcm_flow_vpn_config_t *info);
    856 #endif
    857 
    858 #if defined(INCLUDE_L3)
    859 /* Destroy FLOW VPN. */
    860 extern int bcm_flow_vpn_destroy(
    861     int unit, 
    862     bcm_vpn_t vpn);
    863 #endif
    864 
    865 #if defined(INCLUDE_L3)
    866 /* Destroy FLOW VPN. */
    867 extern int bcm_flow_vpn_destroy_all(
    868     int unit);
    869 #endif
    870 
    871 #if defined(INCLUDE_L3)
    872 /* Get FLOW VPN. */
    873 extern int bcm_flow_vpn_get(
    874     int unit, 
    875     bcm_vpn_t vpn, 
    876     bcm_flow_vpn_config_t *info);
    877 #endif
    878 
    879 #if defined(INCLUDE_L3)
    880 /* 
    881  * Traverse all valid FLOW VPN entries and call the supplied callback
    882  * routine.
    883  */
    884 extern int bcm_flow_vpn_traverse(
    885     int unit, 
    886     bcm_flow_vpn_traverse_cb cb, 
    887     void *user_data);
    888 #endif
    889 
    890 #if defined(INCLUDE_L3)
    891 /* Get a handle for a given flow name string. */
    892 extern int bcm_flow_handle_get(
    893     int unit, 
    894     const char *flow_name, 
    895     bcm_flow_handle_t *handle);
    896 #endif
    897 
    898 #if defined(INCLUDE_L3)
    899 /* Get a flow option ID for a given flow handle and flow option name. */
    900 extern int bcm_flow_option_id_get(
    901     int unit, 
    902     bcm_flow_handle_t flow_handle, 
    903     const char *flow_option_name, 
    904     bcm_flow_option_id_t *option_id);
    905 #endif
    906 
    907 #if defined(INCLUDE_L3)
    908 /* Get the field id for logical field name in a flow. */
    909 extern int bcm_flow_logical_field_id_get(
    910     int unit, 
    911     bcm_flow_handle_t flow_handle, 
    912     const char *field_name, 
    913     bcm_flow_field_id_t *field_id);
    914 #endif
    915 
    916 #endif /* BCM_HIDE_DISPATCHABLE */
    917 
    918 #if defined(INCLUDE_L3)
    919 /* Flow Functions. */
    920 typedef enum bcm_flow_function_type_e {
    921     bcmFlowFuncTypeStart = 0,           /* Start. */
    922     bcmFlowFuncTypeMatch = 1,           /* Match. */
    923     bcmFlowFuncTypeEncap = 2,           /* Encap. */
    924     bcmFlowFuncTypeTunnelInit = 3,      /* Tunnel Initiator. */
    925     bcmFlowFuncTypeTunnelTerm = 4,      /* Tunnel Terminator. */
    926     bcmFlowFuncTypeEncapSet = 5,        /* Encap set. */
    927     bcmFlowFuncTypeL2Switch = 6,        /* L2 Switch. */
    928     bcmFlowFuncTypeL3Host = 7,          /* L3 Host. */
    929     bcmFlowFuncTypeL3Route = 8,         /* L3 Route. */
    930     bcmFlowFuncTypeEgressObj = 9,       /* Egress  Object. */
    931     bcmFlowFuncTypeEgressLabel = 10,    /* Egress Label. */
    932     bcmFlowFuncTypeEgressIntf = 11,     /* Egress Intf. */
    933     bcmFlowFuncTypeEnd = 12             /* End. */
    934 } bcm_flow_function_type_t;
    935 
    936 #define BCM_FLOW_FUNCTION_TYPE \
    937 { \
    938     "bcmFlowFuncTypeStart", \
    939     "bcmFlowFuncTypeMatch", \
    940     "bcmFlowFuncTypeEncap", \
    941     "bcmFlowFuncTypeTunnelInit", \
    942     "bcmFlowFuncTypeTunnelTerm", \
    943     "bcmFlowFuncTypeEncapSet", \
    944     "bcmFlowFuncTypeL2Switch", \
    945     "bcmFlowFuncTypeL3Host", \
    946     "bcmFlowFuncTypeL3Route", \
    947     "bcmFlowFuncTypeEgressObj", \
    948     "bcmFlowFuncTypeEgressLabel", \
    949     "bcmFlowFuncTypeEgressIntf", \
    950     "bcmFlowFuncTypeEnd"  \
    951 }
    952 #endif
    953 
    954 #if defined(INCLUDE_L3)
    955 /* Flow stat info valid elements. */
    956 #define BCM_FLOW_STAT_FLOW_PORT_VALID       (1 << 0)   /* flow port element
    957                                                           valid. */
    958 #define BCM_FLOW_STAT_PORT_VALID            (1 << 1)   /* port element valid. */
    959 #define BCM_FLOW_STAT_VPN_VALID             (1 << 2)   /* VN_ID element is valid
    960                                                           for this match. */
    961 #define BCM_FLOW_STAT_INNER_VLAN_VALID      (1 << 3)   /* Inner vlan element
    962                                                           valid. */
    963 #define BCM_FLOW_STAT_VLAN_VALID            (1 << 4)   /* vlan element valid. */
    964 #define BCM_FLOW_STAT_VNID_VALID            (1 << 5)   /* VNID element valid. */
    965 #define BCM_FLOW_STAT_SIP_VALID             (1 << 6)   /* source IPv4 address
    966                                                           element valid. */
    967 #define BCM_FLOW_STAT_DIP_VALID             (1 << 7)   /* Destination IPv4
    968                                                           address element valid. */
    969 #define BCM_FLOW_STAT_SIP_MASK_VALID        (1 << 8)   /* source IPv4 address
    970                                                           mask element valid. */
    971 #define BCM_FLOW_STAT_DIP_MASK_VALID        (1 << 9)   /* Destination IPv4
    972                                                           address mask element
    973                                                           valid. */
    974 #define BCM_FLOW_STAT_SIP6_VALID            (1 << 10)  /* source IPv6 address
    975                                                           element valid. */
    976 #define BCM_FLOW_STAT_DIP6_VALID            (1 << 11)  /* Destination IPv6
    977                                                           address element valid. */
    978 #define BCM_FLOW_STAT_SIP6_MASK_VALID       (1 << 12)  /* source IPv6 address
    979                                                           mask element valid. */
    980 #define BCM_FLOW_STAT_DIP6_MASK_VALID       (1 << 13)  /* Destination IPv6
    981                                                           address mask element
    982                                                           valid. */
    983 #define BCM_FLOW_STAT_UDP_SRC_PORT_VALID    (1 << 14)  /* UDP source port
    984                                                           element valid. */
    985 #define BCM_FLOW_STAT_UDP_DST_PORT_VALID    (1 << 15)  /* UDP Destination port
    986                                                           element valid. */
    987 #define BCM_FLOW_STAT_PROTOCOL_VALID        (1 << 16)  /* Protocol element
    988                                                           valid. */
    989 #define BCM_FLOW_STAT_TUNNEL_ID_VALID       (1 << 17)  /* Tunnel ID element
    990                                                           valid. */
    991 #define BCM_FLOW_STAT_EGRESS_IF_VALID       (1 << 18)  /* Egress nexthop object
    992                                                           index element valid. */
    993 #define BCM_FLOW_STAT_INTF_ID_VALID         (1 << 19)  /* L3 interface id
    994                                                           element valid. */
    995 #define BCM_FLOW_STAT_MAC_VALID             (1 << 20)  /* L2 MAC address element
    996                                                           valid. */
    997 #define BCM_FLOW_STAT_L3A_FLAGS_VALID       (1 << 21)  /* BCM_L3_xxx flag
    998                                                           definitions. */
    999 #define BCM_FLOW_STAT_L3A_VRF_VALID         (1 << 22)  /* Virtual router
   1000                                                           instance. */
   1001 #define BCM_FLOW_STAT_DVP_GROUP_VALID       (1 << 23)  /* DVP group ID */
   1002 #define BCM_FLOW_STAT_OIF_GROUP_VALID       (1 << 24)  /* L3 Out Interface Group
   1003                                                           ID */
   1004 #define BCM_FLOW_STAT_MATCH_CRITERIA_VALID  (1 << 25)  /* DVP group ID */
   1005 #define BCM_FLOW_STAT_ENCAP_CRITERIA_VALID  (1 << 26)  /* L3 Out Interface Group
   1006                                                           ID */
   1007 #define BCM_FLOW_STAT_MPLS_LABEL_VALID      (1 << 27)  /* Mpls Label is valid */
   1008 #define BCM_FLOW_STAT_FLEX_KEY_VALID        (1 << 28)  /* Flex Key element
   1009                                                           valid. */
   1010 #endif
   1011 
   1012 #if defined(INCLUDE_L3)
   1013 /* flow Stat. */
   1014 typedef enum bcm_flow_stat_e {
   1015     bcmFlowInPackets = 1,   /* Flow InPackets */
   1016     bcmFlowOutPackets = 2,  /* Flow OutPackets */
   1017     bcmFlowInBytes = 3,     /* Flow InBytes */
   1018     bcmFlowOutBytes = 4     /* Flow OutBytes */
   1019 } bcm_flow_stat_t;
   1020 #endif
   1021 
   1022 #if defined(INCLUDE_L3)
   1023 /* Flow stat info structure */
   1024 typedef struct bcm_flow_stat_info_s {
   1025     bcm_gport_t flow_port;              /* Flow port */
   1026     bcm_gport_t port;                   /* Match port /trunk */
   1027     bcm_vpn_t vpn;                      /* VPN representing a vfi or vrf */
   1028     bcm_vlan_t inner_vlan;              /* Inner VLAN ID to match. */
   1029     bcm_vlan_t vlan;                    /* VLAN ID to match. */
   1030     uint32 vnid;                        /* VN_ID. */
   1031     bcm_ip_t sip;                       /* source IPv4 address */
   1032     bcm_ip_t dip;                       /* destination IPv4 address */
   1033     bcm_ip_t sip_mask;                  /* source IPv4 address mask */
   1034     bcm_ip_t dip_mask;                  /* destination IPv4 address mask */
   1035     bcm_ip6_t sip6;                     /* source IPv6 address */
   1036     bcm_ip6_t dip6;                     /* destination IPv6 address */
   1037     bcm_ip6_t sip6_mask;                /* source IPv6 address mask */
   1038     bcm_ip6_t dip6_mask;                /* destination IPv6 address mask */
   1039     uint16 udp_src_port;                /* udp source port. */
   1040     uint16 udp_dst_port;                /* udp destination port. */
   1041     uint16 protocol;                    /* IP protocol type. */
   1042     bcm_gport_t tunnel_id;              /* Tunnel ID */
   1043     bcm_if_t egress_if;                 /* egress object */
   1044     bcm_if_t intf_id;                   /* l3 interface id */
   1045     bcm_mac_t mac;                      /* 802.3 MAC address. */
   1046     uint32 l3a_flags;                   /* See BCM_L3_xxx flag definitions. */
   1047     bcm_vrf_t l3a_vrf;                  /* Virtual router instance. */
   1048     uint32 oif_group;                   /* L3 OUT interface group ID */
   1049     uint32 dvp_group;                   /* DVP group ID */
   1050     bcm_flow_match_criteria_t match_criteria; /* flow match criteria. */
   1051     bcm_flow_encap_criteria_t encap_criteria; /* flow encap criteria. */
   1052     bcm_mpls_label_t mpls_label;        /* MPLS label. */
   1053     uint32 valid_elements;              /* bitmap of valid fields */
   1054     uint32 flow_handle;                 /* flow handle derived from flow name */
   1055     uint32 flow_option;                 /* flow option derived from flow option
   1056                                            name */
   1057     bcm_flow_function_type_t function_type; /* flow function type */
   1058 } bcm_flow_stat_info_t;
   1059 #endif
   1060 
   1061 #if defined(INCLUDE_L3)
   1062 /* Initialize flow stat info structure. */
   1063 extern void bcm_flow_stat_info_t_init(
   1064     bcm_flow_stat_info_t *flow_stat_info);
   1065 #endif
   1066 
   1067 #ifndef BCM_HIDE_DISPATCHABLE
   1068 
   1069 #if defined(INCLUDE_L3)
   1070 /* Get the stat object for the flex view of flexible table. */
   1071 extern int bcm_flow_stat_object_get(
   1072     int unit, 
   1073     bcm_flow_handle_t flow_handle, 
   1074     bcm_flow_option_id_t flow_option_id, 
   1075     bcm_flow_function_type_t function_type, 
   1076     bcm_stat_object_t *stat_object);
   1077 #endif
   1078 
   1079 #if defined(INCLUDE_L3)
   1080 /* Attach counter for an entry. */
   1081 extern int bcm_flow_stat_attach(
   1082     int unit, 
   1083     bcm_flow_stat_info_t *flow_stat_info, 
   1084     uint32 num_of_fields, 
   1085     bcm_flow_logical_field_t *field, 
   1086     uint32 stat_counter_id);
   1087 #endif
   1088 
   1089 #if defined(INCLUDE_L3)
   1090 /* Detach counter entries to the given flex view table. */
   1091 extern int bcm_flow_stat_detach(
   1092     int unit, 
   1093     bcm_flow_stat_info_t *flow_stat_info, 
   1094     uint32 num_of_fields, 
   1095     bcm_flow_logical_field_t *field, 
   1096     uint32 stat_counter_id);
   1097 #endif
   1098 
   1099 #if defined(INCLUDE_L3)
   1100 /* Get Stat Counter id for flow tables. */
   1101 extern int bcm_flow_stat_id_get(
   1102     int unit, 
   1103     bcm_flow_stat_info_t *flow_stat_info, 
   1104     uint32 num_of_fields, 
   1105     bcm_flow_logical_field_t *field, 
   1106     bcm_stat_object_t stat_object, 
   1107     uint32 *stat_counter_id);
   1108 #endif
   1109 
   1110 #endif /* BCM_HIDE_DISPATCHABLE */
   1111 
   1112 #if defined(INCLUDE_L3)
   1113 /* Flags for Flow handle info */
   1114 #define BCM_FLOW_HANDLE_INFO_WITH_ID    (1 << 0)   /* With ID */
   1115 #define BCM_FLOW_HANDLE_INFO_REPLACE    (1 << 1)   /* Replace */
   1116 #endif
   1117 
   1118 #if defined(INCLUDE_L3)
   1119 #define BCM_FLOW_SPECIAL_FIELD_MAX_NOF_FIELDS 32         
   1120 #endif
   1121 
   1122 #if defined(INCLUDE_L3)
   1123 /* Flow Terminator elements (for valid, clear bitmaps). */
   1124 #define BCM_FLOW_TERMINATOR_ELEMENT_VRF_VALID (1 << 0)   
   1125 #define BCM_FLOW_TERMINATOR_ELEMENT_STAT_ID_VALID (1 << 1)   
   1126 #define BCM_FLOW_TERMINATOR_ELEMENT_L3_INGRESS_INFO_VALID (1 << 2)   
   1127 #define BCM_FLOW_TERMINATOR_ELEMENT_STAT_PP_PROFILE_VALID (1 << 3)   
   1128 #define BCM_FLOW_TERMINATOR_ELEMENT_QOS_MAP_ID_VALID (1 << 4)   
   1129 #define BCM_FLOW_TERMINATOR_ELEMENT_QOS_INGRESS_MODEL_VALID (1 << 5)   
   1130 #define BCM_FLOW_TERMINATOR_ELEMENT_FLOW_SERVICE_TYPE_VALID (1 << 6)   
   1131 #define BCM_FLOW_TERMINATOR_ELEMENT_FLOW_DEST_INFO_VALID (1 << 7)   
   1132 #define BCM_FLOW_TERMINATOR_ELEMENT_ADDITIONAL_DATA_VALID (1 << 8)   
   1133 #define BCM_FLOW_TERMINATOR_ELEMENT_ACTION_GPORT_VALID (1 << 9)   
   1134 #endif
   1135 
   1136 #if defined(INCLUDE_L3)
   1137 /* Flow Initiator elements (for valid, clear bitmaps). */
   1138 #define BCM_FLOW_INITIATOR_ELEMENT_STAT_ID_VALID (1 << 0)   
   1139 #define BCM_FLOW_INITIATOR_ELEMENT_STAT_PP_PROFILE_VALID (1 << 1)   
   1140 #define BCM_FLOW_INITIATOR_ELEMENT_QOS_MAP_ID_VALID (1 << 2)   
   1141 #define BCM_FLOW_INITIATOR_ELEMENT_L3_INTF_ID_VALID (1 << 3)   
   1142 #define BCM_FLOW_INITIATOR_ELEMENT_ENCAP_ACCESS_VALID (1 << 4)   
   1143 #define BCM_FLOW_INITIATOR_ELEMENT_QOS_EGRESS_MODEL_VALID (1 << 5)   
   1144 #define BCM_FLOW_INITIATOR_ELEMENT_ACTION_GPORT_VALID (1 << 6)   
   1145 #define BCM_FLOW_INITIATOR_ELEMENT_MTU_PROFILE_VALID (1 << 7)   
   1146 #endif
   1147 
   1148 #if defined(INCLUDE_L3)
   1149 /* Service type */
   1150 typedef enum bcm_flow_service_type_e {
   1151     bcmFlowServiceTypeMultiPoint = 0, 
   1152     bcmFlowServiceTypeCrossConnect = 1, 
   1153     bcmFlowServiceTypeCount = 2 
   1154 } bcm_flow_service_type_t;
   1155 #endif
   1156 
   1157 #if defined(INCLUDE_L3)
   1158 /* Flow handle info structure */
   1159 typedef struct bcm_flow_handle_info_s {
   1160     uint32 flags;           /* BCM_FLOW_HADNLE_XXX flags */
   1161     uint32 flow_handle;     /* Flow handle */
   1162     uint32 flow_option;     /* Flow option */
   1163     bcm_gport_t flow_id;    /* Flow Gport Identifier */
   1164 } bcm_flow_handle_info_t;
   1165 #endif
   1166 
   1167 #if defined(INCLUDE_L3)
   1168 /* Flow destination info */
   1169 typedef struct bcm_flow_dest_info_s {
   1170     bcm_gport_t dest_port; 
   1171     bcm_if_t dest_encap; 
   1172 } bcm_flow_dest_info_t;
   1173 #endif
   1174 
   1175 #if defined(INCLUDE_L3)
   1176 /* L3 ingress info */
   1177 typedef struct bcm_flow_l3_ingress_info_s {
   1178     uint32 l3_ingress_flags;            /* BCM_L3_INGRESS_XXX */
   1179     bcm_l3_ingress_urpf_mode_t urpf_mode; /* URPF mode setting */
   1180 } bcm_flow_l3_ingress_info_t;
   1181 #endif
   1182 
   1183 #if defined(INCLUDE_L3)
   1184 /* Flow special field structure */
   1185 typedef struct bcm_flow_special_field_s {
   1186     bcm_flow_field_id_t field_id;   /* Field id */
   1187     uint8 is_clear;                 /* Relevant for replace, indicate field
   1188                                        should be ignored */
   1189     uint32 shr_var_uint32; 
   1190     bcm_mac_t shr_var_mac_addr; 
   1191     bcm_ip_t shr_var_ipv4; 
   1192 } bcm_flow_special_field_t;
   1193 #endif
   1194 
   1195 #if defined(INCLUDE_L3)
   1196 /* Flow special fields structure */
   1197 typedef struct bcm_flow_special_fields_s {
   1198     uint32 actual_nof_special_fields; 
   1199     bcm_flow_special_field_t special_fields[BCM_FLOW_SPECIAL_FIELD_MAX_NOF_FIELDS]; 
   1200 } bcm_flow_special_fields_t;
   1201 #endif
   1202 
   1203 #if defined(INCLUDE_L3)
   1204 /* bcm_flow_terminator_info_t header type */
   1205 typedef struct bcm_flow_terminator_info_s {
   1206     uint32 flags;                       /* Use BCM_FLOW_TERMINATOR_INFO_XXX
   1207                                            flags */
   1208     bcm_flow_l3_ingress_info_t l3_ingress_info; /* L3 ingress intf info */
   1209     bcm_vrf_t vrf;                      /* Virtual router instance */
   1210     uint32 stat_id;                     /* Statistics ID */
   1211     int stat_pp_profile;                /* Statistics PP Profile */
   1212     int qos_map_id;                     /* QOS Map ID */
   1213     bcm_qos_ingress_model_t ingress_qos_model; /* Ingress QOS and TTL model */
   1214     bcm_flow_service_type_t service_type; /* Service type */
   1215     bcm_flow_dest_info_t dest_info;     /* Destination info */
   1216     uint64 additional_data;             /* Additional data for LIF */
   1217     bcm_gport_t action_gport;           /* Hold the Trap Action-Profile */
   1218     uint32 valid_elements_set;          /* bitmap of set fields
   1219                                            BCM_FLOW_TERMINATOR_ELEMENT_XXX_VALID
   1220                                            upon creation/replace */
   1221     uint32 valid_elements_clear;        /* bitmap of clear fields
   1222                                            BCM_FLOW_TERMINATOR_ELEMENT_XXX_VALID
   1223                                            upon replace */
   1224 } bcm_flow_terminator_info_t;
   1225 #endif
   1226 
   1227 #if defined(INCLUDE_L3)
   1228 /* bcm_flow_initiator_info_t header type */
   1229 typedef struct bcm_flow_initiator_info_s {
   1230     uint32 flags;                       /* Use BCM_FLOW_INITIATOR_INFO_XXX flags */
   1231     uint32 stat_id;                     /* Statistics ID */
   1232     int stat_pp_profile;                /* Statistics PP Profile */
   1233     int qos_map_id;                     /* QOS Map ID */
   1234     bcm_qos_egress_model_t egress_qos_model; /* Egress QOS and TTL model */
   1235     bcm_if_t l3_intf_id;                /* Next intf pointing following tunnel. */
   1236     bcm_encap_access_t encap_access;    /* Encapsulation phase to be used */
   1237     uint32 valid_elements_set;          /* Bitmap of set fields
   1238                                            BCM_FLOW_INITIATOR_ELEMENT_XXX upon
   1239                                            creation/replace */
   1240     uint32 valid_elements_clear;        /* Bitmap of clear fields
   1241                                            BCM_FLOW_INITIATOR_ELEMENT_XXX upon
   1242                                            replace */
   1243     bcm_gport_t action_gport;           /* Trap action gport */
   1244     uint8 mtu_profile;                  /* Trap MTU profile */
   1245 } bcm_flow_initiator_info_t;
   1246 #endif
   1247 
   1248 #if defined(INCLUDE_L3)
   1249 /* Initialize a structure that holds flow handle information. */
   1250 extern void bcm_flow_handle_info_t_init(
   1251     bcm_flow_handle_info_t *flow_handle_info);
   1252 #endif
   1253 
   1254 #if defined(INCLUDE_L3)
   1255 /* Initialize a structure that holds L3 ingress information. */
   1256 extern void bcm_flow_l3_ingress_info_t_init(
   1257     bcm_flow_l3_ingress_info_t *flow_l3_ingress_info);
   1258 #endif
   1259 
   1260 #ifndef BCM_HIDE_DISPATCHABLE
   1261 
   1262 #if defined(INCLUDE_L3)
   1263 extern int bcm_flow_terminator_info_create(
   1264     int unit, 
   1265     bcm_flow_handle_info_t *flow_handle_info, 
   1266     bcm_flow_terminator_info_t *terminator_info, 
   1267     bcm_flow_special_fields_t *special_fields);
   1268 #endif
   1269 
   1270 #if defined(INCLUDE_L3)
   1271 extern int bcm_flow_terminator_info_destroy(
   1272     int unit, 
   1273     bcm_flow_handle_info_t *flow_handle_info);
   1274 #endif
   1275 
   1276 #if defined(INCLUDE_L3)
   1277 extern int bcm_flow_terminator_info_get(
   1278     int unit, 
   1279     bcm_flow_handle_info_t *flow_handle_info, 
   1280     bcm_flow_terminator_info_t *terminator_info, 
   1281     bcm_flow_special_fields_t *special_fields);
   1282 #endif
   1283 
   1284 #endif /* BCM_HIDE_DISPATCHABLE */
   1285 
   1286 /* bcm_flow_terminator_info_traverse_cb */
   1287 #if defined(INCLUDE_L3)
   1288 typedef int (*bcm_flow_terminator_info_traverse_cb)(
   1289     int unit, 
   1290     bcm_flow_handle_info_t *flow_handle_info, 
   1291     bcm_flow_terminator_info_t *terminator_info, 
   1292     bcm_flow_special_fields_t *special_fields, 
   1293     void *user_data);
   1294 #endif
   1295 
   1296 #ifndef BCM_HIDE_DISPATCHABLE
   1297 
   1298 #if defined(INCLUDE_L3)
   1299 extern int bcm_flow_terminator_info_traverse(
   1300     int unit, 
   1301     bcm_flow_handle_info_t *flow_handle_info, 
   1302     bcm_flow_terminator_info_traverse_cb cb, 
   1303     void *user_data);
   1304 #endif
   1305 
   1306 #if defined(INCLUDE_L3)
   1307 extern int bcm_flow_initiator_info_create(
   1308     int unit, 
   1309     bcm_flow_handle_info_t *flow_handle_info, 
   1310     bcm_flow_initiator_info_t *initiator_info, 
   1311     bcm_flow_special_fields_t *special_fields);
   1312 #endif
   1313 
   1314 #if defined(INCLUDE_L3)
   1315 extern int bcm_flow_initiator_info_destroy(
   1316     int unit, 
   1317     bcm_flow_handle_info_t *flow_handle_info);
   1318 #endif
   1319 
   1320 #if defined(INCLUDE_L3)
   1321 extern int bcm_flow_initiator_info_get(
   1322     int unit, 
   1323     bcm_flow_handle_info_t *flow_handle_info, 
   1324     bcm_flow_initiator_info_t *initiator_info, 
   1325     bcm_flow_special_fields_t *special_fields);
   1326 #endif
   1327 
   1328 #endif /* BCM_HIDE_DISPATCHABLE */
   1329 
   1330 /* bcm_flow_initiator_info_traverse_cb */
   1331 #if defined(INCLUDE_L3)
   1332 typedef int (*bcm_flow_initiator_info_traverse_cb)(
   1333     int unit, 
   1334     bcm_flow_handle_info_t *flow_handle_info, 
   1335     bcm_flow_initiator_info_t *initiator_info, 
   1336     bcm_flow_special_fields_t *special_fields, 
   1337     void *user_data);
   1338 #endif
   1339 
   1340 #ifndef BCM_HIDE_DISPATCHABLE
   1341 
   1342 #if defined(INCLUDE_L3)
   1343 extern int bcm_flow_initiator_info_traverse(
   1344     int unit, 
   1345     bcm_flow_handle_info_t *flow_handle_info, 
   1346     bcm_flow_initiator_info_traverse_cb cb, 
   1347     void *user_data);
   1348 #endif
   1349 
   1350 #if defined(INCLUDE_L3)
   1351 extern int bcm_flow_match_info_add(
   1352     int unit, 
   1353     bcm_flow_handle_info_t *flow_handle_info, 
   1354     bcm_flow_special_fields_t *key_special_fields);
   1355 #endif
   1356 
   1357 #if defined(INCLUDE_L3)
   1358 extern int bcm_flow_match_info_delete(
   1359     int unit, 
   1360     bcm_flow_handle_info_t *flow_handle_info, 
   1361     bcm_flow_special_fields_t *key_special_fields);
   1362 #endif
   1363 
   1364 #if defined(INCLUDE_L3)
   1365 extern int bcm_flow_match_info_get(
   1366     int unit, 
   1367     bcm_flow_handle_info_t *flow_handle_info, 
   1368     bcm_flow_special_fields_t *key_special_fields);
   1369 #endif
   1370 
   1371 #endif /* BCM_HIDE_DISPATCHABLE */
   1372 
   1373 /* bcm_flow_match_info_traverse callback */
   1374 #if defined(INCLUDE_L3)
   1375 typedef int (*bcm_flow_match_info_traverse_cb)(
   1376     int unit, 
   1377     bcm_flow_handle_info_t *flow_handle_info, 
   1378     bcm_flow_special_fields_t *key_special_fields, 
   1379     void *user_data);
   1380 #endif
   1381 
   1382 #ifndef BCM_HIDE_DISPATCHABLE
   1383 
   1384 #if defined(INCLUDE_L3)
   1385 extern int bcm_flow_match_info_traverse(
   1386     int unit, 
   1387     bcm_flow_handle_info_t *flow_handle_info, 
   1388     bcm_flow_match_info_traverse_cb cb, 
   1389     void *user_data);
   1390 #endif
   1391 
   1392 #endif /* BCM_HIDE_DISPATCHABLE */
   1393 
   1394 #if defined(INCLUDE_L3)
   1395 /* Flow port ethernet filtering control. */
   1396 #define BCM_FLOW_ES_FILTER_DROP_ENABLE  (1 << 0)   /* Enable/Disable ethernet
   1397                                                       segment filtering */
   1398 #endif
   1399 
   1400 #ifndef BCM_HIDE_DISPATCHABLE
   1401 
   1402 #if defined(INCLUDE_L3)
   1403 /* Specify the filter control for the given ethernet segment identifier. */
   1404 extern int bcm_flow_es_filter_set(
   1405     int unit, 
   1406     bcm_gport_t flow_port_id, 
   1407     uint32 es_id, 
   1408     uint32 flags);
   1409 #endif
   1410 
   1411 #if defined(INCLUDE_L3)
   1412 /* Get the filter status for the given ethernet segment identifier. */
   1413 extern int bcm_flow_es_filter_get(
   1414     int unit, 
   1415     bcm_gport_t flow_port_id, 
   1416     uint32 es_id, 
   1417     uint32 *flags);
   1418 #endif
   1419 
   1420 #if defined(INCLUDE_L3)
   1421 /* Set the flex counter object value to the ethernet segment filter. */
   1422 extern int bcm_flow_es_filter_flexctr_object_set(
   1423     int unit, 
   1424     bcm_gport_t flow_port_id, 
   1425     uint32 value);
   1426 #endif
   1427 
   1428 #if defined(INCLUDE_L3)
   1429 /* Get the flex counter object value from the ethernet segment filter. */
   1430 extern int bcm_flow_es_filter_flexctr_object_get(
   1431     int unit, 
   1432     bcm_gport_t flow_port_id, 
   1433     uint32 *value);
   1434 #endif
   1435 
   1436 #if defined(INCLUDE_L3)
   1437 /* Attach counter entries to the ethernet segment filter. */
   1438 extern int bcm_flow_es_filter_stat_attach(
   1439     int unit, 
   1440     bcm_gport_t flow_port_id, 
   1441     uint32 stat_counter_id);
   1442 #endif
   1443 
   1444 #if defined(INCLUDE_L3)
   1445 /* Detach counter entries from the ethernet segment filter. */
   1446 extern int bcm_flow_es_filter_stat_detach(
   1447     int unit, 
   1448     bcm_gport_t flow_port_id, 
   1449     uint32 stat_counter_id);
   1450 #endif
   1451 
   1452 #if defined(INCLUDE_L3)
   1453 /* Get stat counter id associated from ethernet segment filter. */
   1454 extern int bcm_flow_es_filter_stat_id_get(
   1455     int unit, 
   1456     bcm_gport_t flow_port_id, 
   1457     uint32 *stat_counter_id);
   1458 #endif
   1459 
   1460 #if defined(INCLUDE_L3)
   1461 /* Attach counter entries to the given flow VPN. */
   1462 extern int bcm_flow_vpn_stat_attach(
   1463     int unit, 
   1464     bcm_vpn_t vpn, 
   1465     uint32 stat_counter_id);
   1466 #endif
   1467 
   1468 #if defined(INCLUDE_L3)
   1469 /* Detach counter entries from the given flow VPN. */
   1470 extern int bcm_flow_vpn_stat_detach(
   1471     int unit, 
   1472     bcm_vpn_t vpn, 
   1473     uint32 stat_counter_id);
   1474 #endif
   1475 
   1476 #if defined(INCLUDE_L3)
   1477 /* Get stat counter ID associated to the given flow VPN. */
   1478 extern int bcm_flow_vpn_stat_id_get(
   1479     int unit, 
   1480     bcm_vpn_t vpn, 
   1481     bcm_flexctr_direction_t direction, 
   1482     uint32 *stat_counter_id);
   1483 #endif
   1484 
   1485 #if defined(INCLUDE_L3)
   1486 /* Attach counter entries to the given flow port. */
   1487 extern int bcm_flow_port_stat_attach(
   1488     int unit, 
   1489     bcm_gport_t flow_port_id, 
   1490     uint32 stat_counter_id);
   1491 #endif
   1492 
   1493 #if defined(INCLUDE_L3)
   1494 /* Detach counter entries from the given flow port. */
   1495 extern int bcm_flow_port_stat_detach(
   1496     int unit, 
   1497     bcm_gport_t flow_port_id, 
   1498     uint32 stat_counter_id);
   1499 #endif
   1500 
   1501 #if defined(INCLUDE_L3)
   1502 /* Get stat counter ID associated to the given flow port. */
   1503 extern int bcm_flow_port_stat_id_get(
   1504     int unit, 
   1505     bcm_gport_t flow_port_id, 
   1506     bcm_flexctr_direction_t direction, 
   1507     uint32 *stat_counter_id);
   1508 #endif
   1509 
   1510 #if defined(INCLUDE_L3)
   1511 /* Set the flex counter object value to the given match entry. */
   1512 extern int bcm_flow_match_flexctr_object_set(
   1513     int unit, 
   1514     bcm_flow_match_config_t *info, 
   1515     uint32 value);
   1516 #endif
   1517 
   1518 #if defined(INCLUDE_L3)
   1519 /* Get the flex counter object value from the given match entry. */
   1520 extern int bcm_flow_match_flexctr_object_get(
   1521     int unit, 
   1522     bcm_flow_match_config_t *info, 
   1523     uint32 *value);
   1524 #endif
   1525 
   1526 #if defined(INCLUDE_L3)
   1527 /* Attach counter entries to the given match entry. */
   1528 extern int bcm_flow_match_stat_attach(
   1529     int unit, 
   1530     bcm_flow_match_config_t *info, 
   1531     uint32 num_of_fields, 
   1532     bcm_flow_logical_field_t *field, 
   1533     uint32 stat_counter_id);
   1534 #endif
   1535 
   1536 #if defined(INCLUDE_L3)
   1537 /* Detach counter entries from the given match entry. */
   1538 extern int bcm_flow_match_stat_detach(
   1539     int unit, 
   1540     bcm_flow_match_config_t *info, 
   1541     uint32 num_of_fields, 
   1542     bcm_flow_logical_field_t *field, 
   1543     uint32 stat_counter_id);
   1544 #endif
   1545 
   1546 #if defined(INCLUDE_L3)
   1547 /* Get stat counter ID associated to the given match entry. */
   1548 extern int bcm_flow_match_stat_id_get(
   1549     int unit, 
   1550     bcm_flow_match_config_t *info, 
   1551     uint32 num_of_fields, 
   1552     bcm_flow_logical_field_t *field, 
   1553     uint32 *stat_counter_id);
   1554 #endif
   1555 
   1556 #if defined(INCLUDE_L3)
   1557 /* Set the flex counter object value to the encap entry. */
   1558 extern int bcm_flow_encap_flexctr_object_set(
   1559     int unit, 
   1560     bcm_flow_encap_config_t *info, 
   1561     uint32 value);
   1562 #endif
   1563 
   1564 #if defined(INCLUDE_L3)
   1565 /* Get the flex counter object value from the encap entry. */
   1566 extern int bcm_flow_encap_flexctr_object_get(
   1567     int unit, 
   1568     bcm_flow_encap_config_t *info, 
   1569     uint32 *value);
   1570 #endif
   1571 
   1572 #if defined(INCLUDE_L3)
   1573 /* Attach counter entries to the encap entry. */
   1574 extern int bcm_flow_encap_stat_attach(
   1575     int unit, 
   1576     bcm_flow_encap_config_t *info, 
   1577     uint32 num_of_fields, 
   1578     bcm_flow_logical_field_t *field, 
   1579     uint32 stat_counter_id);
   1580 #endif
   1581 
   1582 #if defined(INCLUDE_L3)
   1583 /* Detach the counter entries from the encap entry. */
   1584 extern int bcm_flow_encap_stat_detach(
   1585     int unit, 
   1586     bcm_flow_encap_config_t *info, 
   1587     uint32 num_of_fields, 
   1588     bcm_flow_logical_field_t *field, 
   1589     uint32 stat_counter_id);
   1590 #endif
   1591 
   1592 #if defined(INCLUDE_L3)
   1593 /* Get stat counter ID associated to the encap entry. */
   1594 extern int bcm_flow_encap_stat_id_get(
   1595     int unit, 
   1596     bcm_flow_encap_config_t *info, 
   1597     uint32 num_of_fields, 
   1598     bcm_flow_logical_field_t *field, 
   1599     uint32 *stat_counter_id);
   1600 #endif
   1601 
   1602 #if defined(INCLUDE_L3)
   1603 /* Attach counter entries to the flow tunnel initiator. */
   1604 extern int bcm_flow_tunnel_initiator_stat_attach(
   1605     int unit, 
   1606     bcm_gport_t tunnel_id, 
   1607     uint32 stat_counter_id);
   1608 #endif
   1609 
   1610 #if defined(INCLUDE_L3)
   1611 /* Detach counter entries from the flow tunnel initiator. */
   1612 extern int bcm_flow_tunnel_initiator_stat_detach(
   1613     int unit, 
   1614     bcm_gport_t tunnel_id, 
   1615     uint32 stat_counter_id);
   1616 #endif
   1617 
   1618 #if defined(INCLUDE_L3)
   1619 /* Get stat counter ID associated to the flow tunnel initiator. */
   1620 extern int bcm_flow_tunnel_initiator_stat_id_get(
   1621     int unit, 
   1622     bcm_gport_t tunnel_id, 
   1623     uint32 *stat_counter_id);
   1624 #endif
   1625 
   1626 #if defined(INCLUDE_L3)
   1627 /* 
   1628  * Set the flex counter object value to the flow tunnel terminator
   1629  * object.
   1630  */
   1631 extern int bcm_flow_tunnel_terminator_flexctr_object_set(
   1632     int unit, 
   1633     bcm_flow_tunnel_terminator_t *info, 
   1634     uint32 value);
   1635 #endif
   1636 
   1637 #if defined(INCLUDE_L3)
   1638 /* 
   1639  * Get the flex counter object value from the flow tunnel terminator
   1640  * object.
   1641  */
   1642 extern int bcm_flow_tunnel_terminator_flexctr_object_get(
   1643     int unit, 
   1644     bcm_flow_tunnel_terminator_t *info, 
   1645     uint32 *value);
   1646 #endif
   1647 
   1648 #if defined(INCLUDE_L3)
   1649 /* Attach counter entries to the flow tunnel terminator object. */
   1650 extern int bcm_flow_tunnel_terminator_stat_attach(
   1651     int unit, 
   1652     bcm_flow_tunnel_terminator_t *info, 
   1653     uint32 num_of_fields, 
   1654     bcm_flow_logical_field_t *field, 
   1655     uint32 stat_counter_id);
   1656 #endif
   1657 
   1658 #if defined(INCLUDE_L3)
   1659 /* Detach counter entries from the flow tunnel terminator object. */
   1660 extern int bcm_flow_tunnel_terminator_stat_detach(
   1661     int unit, 
   1662     bcm_flow_tunnel_terminator_t *info, 
   1663     uint32 num_of_fields, 
   1664     bcm_flow_logical_field_t *field, 
   1665     uint32 stat_counter_id);
   1666 #endif
   1667 
   1668 #if defined(INCLUDE_L3)
   1669 /* Get stat counter ID associated to the flow tunnel terminator object. */
   1670 extern int bcm_flow_tunnel_terminator_stat_id_get(
   1671     int unit, 
   1672     bcm_flow_tunnel_terminator_t *info, 
   1673     uint32 num_of_fields, 
   1674     bcm_flow_logical_field_t *field, 
   1675     uint32 *stat_counter_id);
   1676 #endif
   1677 
   1678 #endif /* BCM_HIDE_DISPATCHABLE */
   1679 
   1680 #endif /* __BCM_FLOW_H__ */