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

l2_int.h (21797B)


      1 /*
      2  * DO NOT EDIT THIS FILE!
      3  * This file is auto-generated.
      4  * Edits to this file will be lost when it is regenerated.
      5  *
      6  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      7  * 
      8  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
      9  */
     10 
     11 #ifndef BCMINT_LTSW_L2_INT_H
     12 #define BCMINT_LTSW_L2_INT_H
     13 
     14 #include <bcm/l2.h>
     15 #include <bcm/types.h>
     16 #include <bcm/trunk.h>
     17 
     18 #include <bcmlt/bcmlt.h>
     19 #include <sal/sal_types.h>
     20 
     21 /*!
     22  * \brief HA subcomponent id for L2 module.
     23  */
     24 /*! L2 station control structure. */
     25 #define BCMINT_L2_SUB_COMP_ID_STATION_CTRL 0
     26 
     27 /*! L2 age interval. */
     28 #define BCMINT_L2_SUB_COMP_ID_AGE_INTERVAL 1
     29 
     30 /*! L2 table view. */
     31 #define BCMINT_L2_SUB_COMP_ID_L2_TABLE_VIEW 2
     32 
     33 /*! L2 pvlan port info. */
     34 #define BCMINT_L2_SUB_COMP_ID_L2_PVLAN_PORT_INFO 3
     35 
     36 /*! L2 flexctr info for L2 hitbit. */
     37 #define BCMINT_L2_SUB_COMP_ID_L2_FLEXCTR_INFO 4
     38 
     39 /*! L2 opaque tag. */
     40 #define BCMINT_L2_SUB_COMP_ID_OPAQUE_TAG 5
     41 
     42 /*!
     43  * \brief Internal L2 traverse callback function.
     44  *
     45  * \param [in] unit Unit Number.
     46  * \param [in] trav_st Traverse cookie.
     47  *
     48  * \retval SHR_E_NONE No errors.
     49  * \retval !SHR_E_NONE Failure.
     50  */
     51 typedef int (*l2_traverse_cb_f)(
     52     int unit,
     53     void *trav_st);
     54 
     55 /*! Traverse entries from H/W. */
     56 #define BCMINT_L2_TRAVERSE_HW 0x0001
     57 
     58 /*! Traverse entry with lock. */
     59 #define BCMINT_L2_TRAVERSE_WITH_LOCK 0x0002
     60 
     61 /*! Traverse entry with snapshot. */
     62 #define BCMINT_L2_TRAVERSE_WITH_SNAPSHOT 0x0004
     63 
     64 /*!
     65  * \brief L2 traverse structure. This data structure is used to specify LT name, LT entry handle, internal callback for traversing operation.
     66  */
     67 typedef struct bcmint_l2_traverse_s {
     68 
     69     /*! LT name. */
     70     const char *lt;
     71 
     72     /*! LT entry handle. */
     73     bcmlt_entry_handle_t eh;
     74 
     75     /*! Traverse flags. */
     76     uint32_t flags;
     77 
     78     /*! User callback function. */
     79     bcm_l2_traverse_cb user_cb;
     80 
     81     /*! Data provided by the user, cookie. */
     82     void *user_data;
     83 
     84     /*! Internal callback function. */
     85     l2_traverse_cb_f int_cb;
     86 
     87     /*! Table id(used for ID based API). */
     88     uint32_t tid;
     89 
     90     /*! Field count in the table(used for ID based API). */
     91     size_t fld_cnt;
     92 
     93     /*! Internal data. */
     94     void *internal_data;
     95 
     96 } bcmint_l2_traverse_t;
     97 
     98 /*!
     99  * \brief L2 replace destination structure. This data structure is used to specify destination structure for L2 replace op.
    100  */
    101 typedef struct bcmint_l2_replace_dest_s {
    102 
    103     /*! Module id. */
    104     bcm_module_t module;
    105 
    106     /*! Port number. */
    107     bcm_port_t port;
    108 
    109     /*! Trunk group id. */
    110     bcm_trunk_t trunk;
    111 
    112     /*! Virtual port id. */
    113     int vp;
    114 
    115 } bcmint_l2_replace_dest_t;
    116 
    117 /*! Internal flags for L2 replace op. */
    118 #define BCMINT_L2_REPLACE_IGNORE_PORTID 0x0001
    119 
    120 /*! Internal flags for L2 hit bit clear op. */
    121 #define BCMINT_L2_REPLACE_CLEAR_HIT_ONLY 0x0002
    122 
    123 /*!
    124  * \brief L2 replace structure. This structure specifies flags, keys, destination, etc info needed for L2 replace op.
    125  */
    126 typedef struct bcmint_l2_replace_s {
    127 
    128     /*! Replace flags (BCM_L2_REPLACE_XXX). */
    129     uint32_t flags;
    130 
    131     /*! Internal flags (BCMINT_L2_REPLACE_XXX). */
    132     uint32_t int_flags;
    133 
    134     /*! L2 address flags. */
    135     uint32_t key_l2_flags;
    136 
    137     /*! Match key type. */
    138     int key_type;
    139 
    140     /*! Match mac address. */
    141     bcm_mac_t key_mac;
    142 
    143     /*! Match vlan. */
    144     bcm_vlan_t key_vlan;
    145 
    146     /*! Match class id. */
    147     int key_class_id;
    148 
    149     /*! Match internal priority. */
    150     int key_int_pri;
    151 
    152     /*! Match destination. */
    153     bcmint_l2_replace_dest_t match_dest;
    154 
    155     /*! Replacing destination. */
    156     bcmint_l2_replace_dest_t new_dest;
    157 
    158     /*! User callback. */
    159     bcm_l2_traverse_cb trav_fn;
    160 
    161     /*! User data. */
    162     void *user_data;
    163 
    164 } bcmint_l2_replace_t;
    165 
    166 /*! This flag indicates enable all tunnels termination. */
    167 #define BCMINT_L2_STATION_TUNNEL 0x00000001
    168 
    169 /*! This flag indicates configure data to MY_STATION tables. */
    170 #define BCMINT_L2_STATION_OVERLAY 0x00000002
    171 
    172 /*!
    173  * \brief The tupple structure carries one (vlan, gport) tuple info.
    174  */
    175 typedef struct bcmint_l2_vlan_gport_tuple_s {
    176 
    177     /*! Vlan info. */
    178     int vlan;
    179 
    180     /*! Gport info. */
    181     bcm_gport_t gport;
    182 
    183 } bcmint_l2_vlan_gport_tuple_t;
    184 
    185 /*!
    186  * \brief This is a tuple link list, each node stores one (vlan, gport) tuple used to exact-match in deleting op.
    187  */
    188 typedef struct bcmint_l2_tuple_list_s {
    189 
    190     /*! Pointer of next tuple. */
    191     struct bcmint_l2_tuple_list_s *next;
    192 
    193     /*! Tuple element. */
    194     bcmint_l2_vlan_gport_tuple_t tuple;
    195 
    196 } bcmint_l2_tuple_list_t;
    197 
    198 /*! Number of tupple list in hash table. */
    199 #define BCMINT_L2_MAX_HASH_TUPLE_COUNT 61
    200 
    201 /*!
    202  * \brief Internal flags used by tupple control structure.
    203  */
    204 /*! Do not care VLAN when matching (vlan, gport) tuple. */
    205 #define BCMINT_L2_DONT_CARE_VLAN (1 << 0)
    206 
    207 /*! Do not care GPORT when matching (vlan, gport) tuple. */
    208 #define BCMINT_L2_DONT_CARE_GPORT (1 << 1)
    209 
    210 /*!
    211  * \brief The tuple control structure, it contains control info and one hash table of BCMINT_MAX_HASH_TUPLE_COUNT depth, which saves tuple list.
    212  */
    213 typedef struct bcmint_l2_tuple_ctrl_s {
    214 
    215     /*! Internal flags to indicate there is tuple does not care vlan,gport when matching. */
    216     uint32_t int_flags;
    217 
    218     /*! Tuple list hash table. */
    219     bcmint_l2_tuple_list_t *tuple_list[BCMINT_L2_MAX_HASH_TUPLE_COUNT];
    220 
    221     /*! API flags BCM_L2_REPLACE_xxx. */
    222     uint32_t flags;
    223 
    224 } bcmint_l2_tuple_ctrl_t;
    225 
    226 /*!
    227  * \brief L2 event type.
    228  */
    229 typedef enum bcmint_l2_event_type_s {
    230 
    231     /*! Add event. */
    232     L2_EVENT_ADD = 0,
    233 
    234     /*! Delete event. */
    235     L2_EVENT_DELETE = 1,
    236 
    237     /*! Update event. */
    238     L2_EVENT_UPDATE = 2,
    239 
    240     /*! Learn event. */
    241     L2_EVENT_LEARN = 3,
    242 
    243     /*! Age event. */
    244     L2_EVENT_AGE = 4,
    245 
    246     /*! Station movement event. */
    247     L2_EVENT_MOVE = 5,
    248 
    249     /*! Last of enum, invalid. */
    250     L2_EVENT_MAX = 6
    251 
    252 } bcmint_l2_event_type_t;
    253 
    254 #define BCMINT_L2_EVENT_TYPE_STR \
    255 { \
    256     "ADD", \
    257     "DELETE", \
    258     "UPDATE", \
    259     "LEARN", \
    260     "AGE", \
    261     "MOVE", \
    262     "MAX" \
    263 }
    264 
    265 /*!
    266  * \brief L2 event info structure.
    267  */
    268 typedef struct bcmint_l2_event_info_s {
    269 
    270     /*! Deleted L2 entry. */
    271     bcm_l2_addr_t del;
    272 
    273     /*! Added L2 entry. */
    274     bcm_l2_addr_t add;
    275 
    276     /*! Event type. */
    277     bcmint_l2_event_type_t type;
    278 
    279 } bcmint_l2_event_info_t;
    280 
    281 /*!
    282  * \brief L2 host table enum.
    283  */
    284 typedef enum bcmint_l2_host_table_s {
    285 
    286     /*! L2 host table. */
    287     BCMINT_L2_HOST_TBL = 0,
    288 
    289     /*! MAC address field. */
    290     BCMINT_L2_HOST_FLD_MAC_ADDR = 1,
    291 
    292     /*! Virtual forwarding domain field. */
    293     BCMINT_L2_HOST_FLD_VFI = 2,
    294 
    295     /*! Index of the strength profile table. */
    296     BCMINT_L2_HOST_FLD_STRENGTH_PROFILE_INDEX = 3,
    297 
    298     /*! Destination object field. */
    299     BCMINT_L2_HOST_FLD_DESTINATION = 4,
    300 
    301     /*! Destination type field. */
    302     BCMINT_L2_HOST_FLD_DESTINATION_TYPE = 5,
    303 
    304     /*! Class id field. */
    305     BCMINT_L2_HOST_FLD_CLASS_ID = 6,
    306 
    307     /*! Destination private VLAN port type field. */
    308     BCMINT_L2_HOST_FLD_DST_PVLAN_PORT_TYPE = 7,
    309 
    310     /*! VP LAG indicator field. */
    311     BCMINT_L2_HOST_FLD_DST_VP_GROUP = 8,
    312 
    313     /*! Community private VLAN id field. */
    314     BCMINT_L2_HOST_FLD_COMMUNITY_PVLAN_ID = 9,
    315 
    316     /*! Nexthop 2 table index or ECMP group 2 table index field. */
    317     BCMINT_L2_HOST_FLD_NHOP_2_OR_ECMP_GROUP_INDEX_1 = 10,
    318 
    319     /*! ECMP and protection switch profile index field. */
    320     BCMINT_L2_HOST_FLD_ECMP_AND_PROT_SWT_SFC_PROFILE_INDEX = 11,
    321 
    322     /*! Flex ctr action field. */
    323     BCMINT_L2_HOST_FLD_FLEX_CTR_ACTION = 12,
    324 
    325     /*! Misc ctrl 0 field. */
    326     BCMINT_L2_HOST_FLD_MISC_CTRL_0 = 13,
    327 
    328     /*! Misc ctrl 1 field. */
    329     BCMINT_L2_HOST_FLD_MISC_CTRL_1 = 14,
    330 
    331     /*! Destination entry index field. */
    332     BCMINT_L2_HOST_FLD_DST_ENTRY_INDEX = 15,
    333 
    334     /*! Source entry index field. */
    335     BCMINT_L2_HOST_FLD_SRC_ENTRY_INDEX = 16,
    336 
    337     /*! Field element count. */
    338     BCMINT_L2_HOST_FLD_ELEMENT_CNT = 17,
    339 
    340     /*! The last one, not valid. */
    341     BCMINT_L2_HOST_COUNT = 18
    342 
    343 } bcmint_l2_host_table_t;
    344 
    345 #define BCMINT_L2_HOST_TABLE_STR \
    346 { \
    347     "TBL", \
    348     "FLD_MAC_ADDR", \
    349     "FLD_VFI", \
    350     "FLD_STRENGTH_PROFILE_INDEX", \
    351     "FLD_DESTINATION", \
    352     "FLD_DESTINATION_TYPE", \
    353     "FLD_CLASS_ID", \
    354     "FLD_DST_PVLAN_PORT_TYPE", \
    355     "FLD_DST_VP_GROUP", \
    356     "FLD_COMMUNITY_PVLAN_ID", \
    357     "FLD_NHOP_2_OR_ECMP_GROUP_INDEX_1", \
    358     "FLD_ECMP_AND_PROT_SWT_SFC_PROFILE_INDEX", \
    359     "FLD_FLEX_CTR_ACTION", \
    360     "FLD_MISC_CTRL_0", \
    361     "FLD_MISC_CTRL_1", \
    362     "FLD_DST_ENTRY_INDEX", \
    363     "FLD_SRC_ENTRY_INDEX", \
    364     "FLD_ELEMENT_CNT" \
    365 }
    366 
    367 /*!
    368  * \brief L2 host narrow table enum.
    369  */
    370 typedef enum bcmint_l2_host_narrow_table_s {
    371 
    372     /*! L2 host narrow table. */
    373     BCMINT_L2_HOST_NARROW_TBL = 0,
    374 
    375     /*! MAC address field. */
    376     BCMINT_L2_HOST_NARROW_FLD_MAC_ADDR = 1,
    377 
    378     /*! Virtual forwarding domain field. */
    379     BCMINT_L2_HOST_NARROW_FLD_VFI = 2,
    380 
    381     /*! Index of the strength profile table. */
    382     BCMINT_L2_HOST_NARROW_FLD_STRENGTH_PROFILE_INDEX = 3,
    383 
    384     /*! Destination object field. */
    385     BCMINT_L2_HOST_NARROW_FLD_DESTINATION = 4,
    386 
    387     /*! Destination type field. */
    388     BCMINT_L2_HOST_NARROW_FLD_DESTINATION_TYPE = 5,
    389 
    390     /*! Misc ctrl 0 field. */
    391     BCMINT_L2_HOST_NARROW_FLD_MISC_CTRL_0 = 6,
    392 
    393     /*! Misc ctrl 1 field. */
    394     BCMINT_L2_HOST_NARROW_FLD_MISC_CTRL_1 = 7,
    395 
    396     /*! Flex ctr action field. */
    397     BCMINT_L2_HOST_NARROW_FLD_FLEX_CTR_ACTION = 8,
    398 
    399     /*! Destination entry index field. */
    400     BCMINT_L2_HOST_NARROW_FLD_DST_ENTRY_INDEX = 9,
    401 
    402     /*! Source entry index field. */
    403     BCMINT_L2_HOST_NARROW_FLD_SRC_ENTRY_INDEX = 10,
    404 
    405     /*! Field element count. */
    406     BCMINT_L2_HOST_NARROW_FLD_ELEMENT_CNT = 11,
    407 
    408     /*! The last one, not valid. */
    409     BCMINT_L2_HOST_NARROW_COUNT = 12
    410 
    411 } bcmint_l2_host_narrow_table_t;
    412 
    413 #define BCMINT_L2_HOST_NARROW_TABLE_STR \
    414 { \
    415     "TBL", \
    416     "FLD_MAC_ADDR", \
    417     "FLD_VFI", \
    418     "FLD_STRENGTH_PROFILE_INDEX", \
    419     "FLD_DESTINATION", \
    420     "FLD_DESTINATION_TYPE", \
    421     "FLD_MISC_CTRL_0", \
    422     "FLD_MISC_CTRL_1", \
    423     "FLD_FLEX_CTR_ACTION", \
    424     "FLD_DST_ENTRY_INDEX", \
    425     "FLD_SRC_ENTRY_INDEX", \
    426     "FLD_ELEMENT_CNT" \
    427 }
    428 
    429 /*!
    430  * \brief L2 learn cache data table enum.
    431  */
    432 typedef enum bcmint_l2_learn_cache_data_table_s {
    433 
    434     /*! L2 learn cache data table. */
    435     BCMINT_L2_LEARN_CACHE_DATA_TBL = 0,
    436 
    437     /*! Cache field 0. */
    438     BCMINT_L2_LEARN_CACHE_DATA_FLD_CACHE_FIELD0 = 1,
    439 
    440     /*! Cache field 1. */
    441     BCMINT_L2_LEARN_CACHE_DATA_FLD_CACHE_FIELD1 = 2,
    442 
    443     /*! Cache field 2. */
    444     BCMINT_L2_LEARN_CACHE_DATA_FLD_CACHE_FIELD2 = 3,
    445 
    446     /*! Cache field 3. */
    447     BCMINT_L2_LEARN_CACHE_DATA_FLD_CACHE_FIELD3 = 4,
    448 
    449     /*! Cache field 4. */
    450     BCMINT_L2_LEARN_CACHE_DATA_FLD_CACHE_FIELD4 = 5,
    451 
    452     /*! Cache field 5. */
    453     BCMINT_L2_LEARN_CACHE_DATA_FLD_CACHE_FIELD5 = 6,
    454 
    455     /*! Cache field 6. */
    456     BCMINT_L2_LEARN_CACHE_DATA_FLD_CACHE_FIELD6 = 7,
    457 
    458     /*! Cache field 7. */
    459     BCMINT_L2_LEARN_CACHE_DATA_FLD_CACHE_FIELD7 = 8,
    460 
    461     /*! LEARN_CACHE_DATA_INFO logical table index. */
    462     BCMINT_L2_LEARN_CACHE_DATA_FLD_LEARN_CACHE_DATA_INFO_ID = 9,
    463 
    464     /*! LEARN_CACHE_DATA logical table pipe index. */
    465     BCMINT_L2_LEARN_CACHE_DATA_FLD_PIPE = 10,
    466 
    467     /*! LEARN_CACHE_DATA logical table index. */
    468     BCMINT_L2_LEARN_CACHE_DATA_FLD_LEARN_CACHE_DATA_ID = 11,
    469 
    470     /*! Field element count. */
    471     BCMINT_L2_LEARN_CACHE_DATA_FLD_ELEMENT_CNT = 12,
    472 
    473     /*! The last one, not valid. */
    474     BCMINT_L2_LEARN_CACHE_DATA_COUNT = 13
    475 
    476 } bcmint_l2_learn_cache_data_table_t;
    477 
    478 #define BCMINT_L2_LEARN_CACHE_DATA_TABLE_STR \
    479 { \
    480     "TBL", \
    481     "FLD_CACHE_FIELD0", \
    482     "FLD_CACHE_FIELD1", \
    483     "FLD_CACHE_FIELD2", \
    484     "FLD_CACHE_FIELD3", \
    485     "FLD_CACHE_FIELD4", \
    486     "FLD_CACHE_FIELD5", \
    487     "FLD_CACHE_FIELD6", \
    488     "FLD_CACHE_FIELD7", \
    489     "FLD_LEARN_CACHE_DATA_INFO_ID", \
    490     "FLD_PIPE", \
    491     "FLD_LEARN_CACHE_DATA_ID", \
    492     "FLD_ELEMENT_CNT" \
    493 }
    494 
    495 /*!
    496  * \brief L2 destination type enum.
    497  */
    498 typedef enum bcmint_l2_dest_type_s {
    499 
    500     /*! No operation. */
    501     BCMINT_L2_DEST_TYPE_NO_OP = 0,
    502 
    503     /*! L2 out interface. */
    504     BCMINT_L2_DEST_TYPE_L2_OIF = 1,
    505 
    506     /*! Reserved. */
    507     BCMINT_L2_DEST_TYPE_RSVD = 2,
    508 
    509     /*! Virtual port. */
    510     BCMINT_L2_DEST_TYPE_VP = 3,
    511 
    512     /*! ECMP group. */
    513     BCMINT_L2_DEST_TYPE_ECMP = 4,
    514 
    515     /*! Nexthop. */
    516     BCMINT_L2_DEST_TYPE_NHOP = 5,
    517 
    518     /*! L2 multicast group. */
    519     BCMINT_L2_DEST_TYPE_L2MC_GROUP = 6,
    520 
    521     /*! L3 multicast group. */
    522     BCMINT_L2_DEST_TYPE_L3MC_GROUP = 7,
    523 
    524     /*! Reserved. */
    525     BCMINT_L2_DEST_TYPE_RSVD_1 = 8,
    526 
    527     /*! ECMP member. */
    528     BCMINT_L2_DEST_TYPE_ECMP_MEMBER = 9,
    529 
    530     /*! The last one, not valid. */
    531     BCMINT_L2_DEST_TYPE_COUNT = 10
    532 
    533 } bcmint_l2_dest_type_t;
    534 
    535 #define BCMINT_L2_DEST_TYPE_STR \
    536 { \
    537     "NO_OP", \
    538     "L2_OIF", \
    539     "RSVD", \
    540     "VP", \
    541     "ECMP", \
    542     "NHOP", \
    543     "L2MC_GROUP", \
    544     "L3MC_GROUP", \
    545     "RSVD_1", \
    546     "ECMP_MEMBER" \
    547 }
    548 
    549 /*!
    550  * \brief L2 destination Private VLAN port type enum.
    551  */
    552 typedef enum bcmint_l2_dst_pvlan_port_type_s {
    553 
    554     /*! Promiscuous type. */
    555     BCMINT_L2_DST_PVLAN_PORT_TYPE_PROMISCUOUS = 0,
    556 
    557     /*! Community type. */
    558     BCMINT_L2_DST_PVLAN_PORT_TYPE_COMMUNITY = 1,
    559 
    560     /*! Isolated type. */
    561     BCMINT_L2_DST_PVLAN_PORT_TYPE_ISOLATED = 2,
    562 
    563     /*! The last one, not valid. */
    564     BCMINT_L2_DST_PVLAN_PORT_TYPE_COUNT = 3
    565 
    566 } bcmint_l2_dst_pvlan_port_type_t;
    567 
    568 #define BCMINT_L2_DST_PVLAN_PORT_TYPE_STR \
    569 { \
    570     "PROMISCUOUS", \
    571     "COMMUNITY", \
    572     "ISOLATED" \
    573 }
    574 
    575 /*!
    576  * \brief LT ID defined by HSDK.
    577  */
    578 typedef enum bcmint_l2_xgs_lt_id_s {
    579 
    580     /*! L2 host table. */
    581     XGS_L2_HOST_TAB_ID = 0,
    582 
    583     /*! L2 my station table. */
    584     XGS_L2_MY_STATION_ID = 1,
    585 
    586     /*! L2 my station table. */
    587     XGS_L2_MY_STATION_TRUNK_ID = 2,
    588 
    589     /*! L2 my station table. */
    590     XGS_L2_MY_STATION_MODPORT_ID = 3,
    591 
    592     /*! L2 underlay my station table. */
    593     XGS_L2_UNDERLAY_MY_STATION_ID = 4,
    594 
    595     /*! L2 underlay my station table. */
    596     XGS_L2_UNDERLAY_MY_STATION_TRUNK_ID = 5,
    597 
    598     /*! L2 underlay my station table. */
    599     XGS_L2_UNDERLAY_MY_STATION_MODPORT_ID = 6,
    600 
    601     /*! L2 cache table. */
    602     XGS_L2_CACHE_ID = 7,
    603 
    604     /*! L2 dst block table. */
    605     XGS_L2_DST_BLOCK_ID = 8,
    606 
    607     /*! L2 learn cache table. */
    608     XGS_L2_LEARN_DATA_ID = 9,
    609 
    610     /*! L2 learn control table. */
    611     XGS_L2_LEARN_CTRL_ID = 10,
    612 
    613     /*! L2 opaque tag table. */
    614     XGS_L2_OPAQUE_TAG_ID = 11,
    615 
    616     /*! L2 learn override table. */
    617     XGS_L2_LEARN_OVERRIDE_ID = 12,
    618 
    619     /*! L2 payload opaque tag table. */
    620     XGS_L2_PAYLOAD_OPAQUE_TAG_ID = 13,
    621 
    622     /*! Number of L2 table. */
    623     XGS_L2_MAX_NUM = 14
    624 
    625 } bcmint_l2_xgs_lt_id_t;
    626 
    627 #define BCMINT_L2_XGS_LT_ID_STR \
    628 { \
    629     "HOST_TAB_ID", \
    630     "MY_STATION_ID", \
    631     "MY_STATION_TRUNK_ID", \
    632     "MY_STATION_MODPORT_ID", \
    633     "UNDERLAY_MY_STATION_ID", \
    634     "UNDERLAY_MY_STATION_TRUNK_ID", \
    635     "UNDERLAY_MY_STATION_MODPORT_ID", \
    636     "CACHE_ID", \
    637     "DST_BLOCK_ID", \
    638     "LEARN_DATA_ID", \
    639     "LEARN_CTRL_ID", \
    640     "OPAQUE_TAG_ID", \
    641     "LEARN_OVERRIDE_ID", \
    642     "PAYLOAD_OPAQUE_TAG_ID", \
    643     "MAX_NUM" \
    644 }
    645 
    646 /*!
    647  * \brief User data passed to transfer routines.
    648  */
    649 typedef struct bcmint_l2_trans_data_s {
    650 
    651     /*! LT ID defined by HSDK. */
    652     bcmint_l2_xgs_lt_id_t hsdk_tid;
    653 
    654     /*! Base address of data structure. */
    655     void *struct_data;
    656 
    657     /*! Internal offset of a structure member. */
    658     uint64_t offset;
    659 
    660     /*! Type of a structure member. */
    661     const char *type;
    662 
    663     /*! Value gotten from or set to a LT field. */
    664     uint64_t *fld_val;
    665 
    666     /*! String value gotten from or set to a LT field. */
    667     const char **fld_str_val;
    668 
    669     /*! Value gotten from or set to assistant fields. */
    670     uint64_t *ass_fld_val;
    671 
    672     /*! Depth of an array field. */
    673     int array_depth;
    674 
    675     /*! User data. */
    676     void *cookie;
    677 
    678 } bcmint_l2_trans_data_t;
    679 
    680 /*!
    681  * \brief Transfer data of LT field to value of structure member variables. Vice versa.
    682  *
    683  * \param [in] unit Unit Number.
    684  * \param [in/out] param Parameters used to transfer data.
    685  * \param [in] dir Parse data from LT field, or populate data to LT field.
    686  *
    687  * \retval SHR_E_NONE No errors.
    688  * \retval !SHR_E_NONE Failure.
    689  */
    690 typedef int (*l2_fld_to_mem_trans_f)(
    691     int unit,
    692     bcmint_l2_trans_data_t *param,
    693     int dir);
    694 
    695 /*!
    696  * \brief Map value of a master field to value of a structure member.
    697  */
    698 typedef struct bcmint_l2_sym_map_s {
    699 
    700     /*! String value of master field. */
    701     const char *sym_str_val;
    702 
    703     /*! Value of master field. */
    704     uint64_t sym_val;
    705 
    706     /*! If field value is matched, value of mem_val will be assigned to the structure member. */
    707     uint64_t mem_val;
    708 
    709     /*! |, =, & or n. */
    710     char op;
    711 
    712     /*! ID of assist fields. */
    713     uint32_t ass_fid;
    714 
    715 } bcmint_l2_sym_map_t;
    716 
    717 /*!
    718  * \brief Map value of fields to value of a structure member.
    719  */
    720 typedef struct bcmint_l2_fld_map_s {
    721 
    722     /*! Internal offset of a structure member. */
    723     uint64_t offset;
    724 
    725     /*! Type of a structure member. */
    726     const char *type;
    727 
    728     /*! Master field can have slave fields.\n One slave field can be selected and decoded \n according to current value of master field. */
    729     const bcmint_l2_sym_map_t *sym_map;
    730 
    731     /*! If field value is 1, the value of flags_val will be used by | mode. */
    732     uint32_t flag_val;
    733 
    734     /*! Routine transfers field data to structure member value. Vice versa. */
    735     l2_fld_to_mem_trans_f trans;
    736 
    737     /*! Depth of an array field. */
    738     int array_depth;
    739 
    740     /*! Field can be filtered out. */
    741     uint32_t filter;
    742 
    743 } bcmint_l2_fld_map_t;
    744 
    745 /*!
    746  * \brief L2 id map structure.
    747  */
    748 typedef struct bcmint_l2_id_map_s {
    749 
    750     /*! Index of the mapped object. */
    751     int idx;
    752 
    753     /*! Map value. */
    754     uint32_t val;
    755 
    756     /*! Bind LT field to structure member variable. */
    757     const bcmint_l2_fld_map_t *map;
    758 
    759 } bcmint_l2_id_map_t;
    760 
    761 /*!
    762  * \brief Transfer data of fields to value of members of structure. Vice versa.\n And map global LT ID defined by HSDK with chip specific LT ID defined by SDKLT.
    763  */
    764 typedef struct bcmint_l2_map_info_s {
    765 
    766     /*!  LT ID defined by HSDK. */
    767     bcmint_l2_xgs_lt_id_t hsdk_tid;
    768 
    769     /*! LT ID defined by SDKLT per chip. */
    770     uint32_t sdklt_tid;
    771 
    772     /*! LT Name defined by SDKLT per chip. */
    773     const char *lt_name;
    774 
    775     /*! Field count of LT. */
    776     uint32_t fld_cnt;
    777 
    778     /*! Information used to transfer data. */
    779     const bcmint_l2_id_map_t *id_map;
    780 
    781     /*! Depth of id_map. */
    782     int depth;
    783 
    784 } bcmint_l2_map_info_t;
    785 
    786 /*!
    787  * \brief L2 id map handle.
    788  */
    789 /*! L2 host table handle. */
    790 #define BCMINT_L2_MAP_IH_HOST_TABLE 0
    791 
    792 /*! L2 host narrow table handle. */
    793 #define BCMINT_L2_MAP_IH_HOST_NARROW_TABLE 1
    794 
    795 /*! L2 learn cache data table handle. */
    796 #define BCMINT_L2_MAP_IH_LEARN_CACHE_DATA_TABLE 2
    797 
    798 /*!
    799  * \brief L2 id map database structure.
    800  */
    801 typedef struct bcmint_l2_id_map_db_s {
    802 
    803     /*! L2 id map handle(BCMINT_L2_MAP_IH_XXX). */
    804     int hdl;
    805 
    806     /*! Map info. */
    807     const bcmint_l2_id_map_t *info;
    808 
    809     /*! Num of elements in map info. */
    810     int num;
    811 
    812 } bcmint_l2_id_map_db_t;
    813 
    814 /*!
    815  * \brief L2 string map structure.
    816  */
    817 typedef struct bcmint_l2_str_map_s {
    818 
    819     /*! Index of the mapped object. */
    820     int idx;
    821 
    822     /*! Map string. */
    823     const char * str;
    824 
    825 } bcmint_l2_str_map_t;
    826 
    827 /*!
    828  * \brief L2 string map handle.
    829  */
    830 /*! L2 destination type handle. */
    831 #define BCMINT_L2_MAP_SH_DEST_TYPE 0
    832 
    833 /*! Destination Private VLAN port type handle. */
    834 #define BCMINT_L2_MAP_SH_DST_PVLAN_PORT_TYPE 1
    835 
    836 /*!
    837  * \brief L2 string map database structure.
    838  */
    839 typedef struct bcmint_l2_str_map_db_s {
    840 
    841     /*! L2 string map handle(BCMINT_L2_MAP_SH_XXX). */
    842     int hdl;
    843 
    844     /*! Map info. */
    845     const bcmint_l2_str_map_t *info;
    846 
    847     /*! Num of elements in map info. */
    848     int num;
    849 
    850 } bcmint_l2_str_map_db_t;
    851 
    852 /*!
    853  * \brief L2 map database structure.
    854  */
    855 typedef struct bcmint_l2_map_db_s {
    856 
    857     /*! ID database. */
    858     const bcmint_l2_id_map_db_t *id_db;
    859 
    860     /*! Num of elements in ID database. */
    861     int id_num;
    862 
    863     /*! String database. */
    864     const bcmint_l2_str_map_db_t *str_db;
    865 
    866     /*! Num of elements in string database. */
    867     int str_num;
    868 
    869 } bcmint_l2_map_db_t;
    870 
    871 /*!
    872  * \brief Flexctr info structure for L2 hit.
    873  */
    874 typedef struct bcmint_l2_flexctr_info_s {
    875 
    876     /*! Counter id for UFT dest hit action. */
    877     uint32_t uft_dst_id;
    878 
    879     /*! Counter id for UFT src hit action. */
    880     uint32_t uft_src_id;
    881 
    882     /*! counter id for non-UFT dst hit action. */
    883     uint32_t dst_id;
    884 
    885     /*! Counter id for non-UFT src hit action. */
    886     uint32_t src_id;
    887 
    888     /*! Counter group id for dst group action. */
    889     uint32_t dst_grp_id;
    890 
    891     /*! Counter group id for src group action. */
    892     uint32_t src_grp_id;
    893 
    894 } bcmint_l2_flexctr_info_t;
    895 
    896 /*!
    897  * \brief The function is to find if one (vlan, gport) tuple exists in given tuple array.
    898  *
    899  * \param [in] unit Unit Number.
    900  * \param [in] tuple_ctrl Tuple control structure.
    901  * \param [in] tuple Tuple to match.
    902  */
    903 extern bool
    904 bcmint_l2_tuple_find(
    905     int unit,
    906     bcmint_l2_tuple_ctrl_t *tuple_ctrl,
    907     bcmint_l2_vlan_gport_tuple_t tuple);
    908 
    909 /*!
    910  * \brief Get L2 station entry from data base with given key.
    911  *
    912  * \param [in] unit Unit Number.
    913  * \param [in] station L2 station entry.
    914  * \param [out] tnl tunnel.
    915  */
    916 extern bool
    917 bcmint_l2_station_db_get(
    918     int unit,
    919     bcm_l2_station_t *station,
    920     bool *tnl);
    921 
    922 /*!
    923  * \brief Get amount of customer callbacks.
    924  *
    925  * \param [in] unit Unit Number.
    926  *
    927  * \retval SHR_E_NONE No errors.
    928  * \retval !SHR_E_NONE Failure.
    929  */
    930 extern int
    931 bcmint_l2_callback_num(int unit);
    932 
    933 /*!
    934  * \brief This function is to notify assist thread of corresponding L2 event.
    935  *
    936  * \param [in] unit Unit Number.
    937  * \param [in] l2_addr_add Added L2 entry.
    938  * \param [in] l2_addr_del Deleted L2 entry.
    939  * \param [in] type Entry type.
    940  */
    941 extern void
    942 bcmint_l2_event_notify(
    943     int unit,
    944     bcm_l2_addr_t *l2_addr_add,
    945     bcm_l2_addr_t *l2_addr_del,
    946     bcmint_l2_event_type_t type);
    947 
    948 #endif /* BCMINT_LTSW_L2_INT_H */