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

vlan.h (28564B)


      1 /**
      2  * \file bcm_int/dnx/vlan/vlan.h
      3  *
      4  * Internal DNX VLAN APIs
      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 #include <bcm_int/dnx_dispatch.h>
     12 #include <soc/dnx/dbal/dbal.h>
     13 #include <bcm_int/dnx/algo/swstate/auto_generated/access/vlan_access.h>
     14 #include <bcm_int/dnx/algo/algo_gpm.h>
     15 
     16 #ifndef _VLAN_API_INCLUDED__
     17 /*
     18  * {
     19  */
     20 #define _VLAN_API_INCLUDED__
     21 
     22 #ifndef BCM_DNX_SUPPORT
     23 #error "This file is for use by DNX (JR2) family only!"
     24 #endif
     25 
     26 /*
     27  * Include files
     28  * {
     29  */
     30 
     31 /*
     32  * }
     33  */
     34 
     35 /*
     36  * DEFINEs
     37  * {
     38  */
     39 
     40 /**
     41  * Defines for virtual gport subfields - VLAN-Domain and VSI in ESEM subtype and
     42  * AC-Profile in Egress Port Default subtype
     43  * Those won't be required once the ESEM entry will have a hashed representation
     44  */
     45 
     46 #define VIRTUAL_ESEM_GPORT_VD_SHIFT                        (0)
     47 #define VIRTUAL_ESEM_GPORT_VD_MASK                      (0xFF)
     48 
     49 #define VIRTUAL_ESEM_GPORT_VSI_SHIFT                       (8)
     50 #define VIRTUAL_ESEM_GPORT_VSI_MASK                   (0x3FFF)
     51 
     52 #define VIRTUAL_EGRESS_PORT_DEFAULT_AC_PROFILE_SHIFT       (0)
     53 #define VIRTUAL_EGRESS_PORT_DEFAULT_AC_PROFILE_MASK     (0xFF)
     54 #define BCM_DNX_PCP_MAX                                    (7)
     55 #define BCM_DNX_PCP_INVALID                                (BCM_DNX_PCP_MAX+1)
     56 
     57 /**
     58  * \brief
     59  *      Temporary value - setting FODO (Forward Domain) Assignment Mode to INVALID
     60  *      just before setting it to correct value.
     61  *      Used for checking that the FODO (Forward Domain) Assignment Mode is set to a valid value.
     62  */
     63 #define FODO_ASSIGNMENT_MODE_INVALID   (-1)
     64 
     65 /*
     66  * }
     67  */
     68 /*
     69  * MACROs
     70  * {
     71  */
     72 
     73 /**
     74  * \brief
     75  * Verify vlanId is within range (0-4K, not including 4K).
     76  */
     77 #define BCM_DNX_VLAN_CHK_ID(unit, vid) { \
     78   if (vid > BCM_VLAN_MAX) SHR_ERR_EXIT(_SHR_E_PARAM, "Invalid VID\r\n"); \
     79   }
     80 
     81 /**
     82  * \brief
     83  * Verify vlanId is within range (0-4K, not including 4K).
     84  */
     85 #define BCM_DNX_PCP_CHK_ID(unit, pcp) { \
     86   if (pcp > BCM_DNX_PCP_MAX) SHR_ERR_EXIT(_SHR_E_PARAM, "Invalid PCP\r\n"); \
     87   }
     88 
     89 /**
     90  * \brief
     91  * Verify vlanId is none (0).
     92  */
     93 #define BCM_DNX_VLAN_CHK_ID_NONE(unit, vid, err_code) {                    \
     94     if ((vid) == BCM_VLAN_NONE)                                            \
     95     {                                                                      \
     96         if (SHR_FAILURE(err_code))                                         \
     97         {                                                                  \
     98             LOG_ERROR_EX(BSL_LOG_MODULE,                                   \
     99                          " Error: %s, because vlan_id is NONE %s%s%s\r\n", \
    100                          shrextend_errmsg_get(err_code), EMPTY, EMPTY, EMPTY); \
    101         }                                                                  \
    102         _func_rv = err_code;                                               \
    103         SHR_EXIT();                                                        \
    104     }                                                                      \
    105 }
    106 
    107 /**
    108  * \brief
    109  * Check that the ESEM result-type is NAMESPACE-VSI
    110  */
    111 #define BCM_DNX_ESEM_IS_RESULT_TYPE_NAMESPACE_VSI(resultType) \
    112     ((resultType == DBAL_RESULT_TYPE_ESEM_FORWARD_DOMAIN_MAPPING_DB_ETPS_L2_FODO) || \
    113      (resultType == DBAL_RESULT_TYPE_ESEM_FORWARD_DOMAIN_MAPPING_DB_ETPS_L2_FODO_VLANS))
    114 
    115 /**
    116  * \brief
    117  * Is ESEM Entry size should be "large" (ETPS_AC_STAT) or not (ETPS_AC):
    118  * For ETPS_AC_STAT:
    119  *   - "two vlans" flag is set. Or
    120  *   - "statistic enable" flag is set. Or
    121  *   - nwk_qos_idx is not invalid.
    122  * Else ETPS_AC.
    123  */
    124 #define BCM_DNX_ESEM_IS_LARGE_ENTRY_NEEDED(flags,nwk_qos_idx)  \
    125     (_SHR_IS_FLAG_SET(flags, BCM_VLAN_PORT_VLAN_TRANSLATION_TWO_VLAN_TAGS)) || \
    126     (_SHR_IS_FLAG_SET(flags, BCM_VLAN_PORT_STAT_EGRESS_ENABLE)) || \
    127     (nwk_qos_idx != DNX_QOS_INVALID_MAP_ID);
    128 
    129 /*
    130  * }
    131  */
    132 
    133 /*
    134  * INERNAL TYPES
    135  * {
    136  */
    137 
    138 /**
    139  * \brief
    140  *  Virtual Native-AC DB in ESEM - key values.
    141  */
    142 typedef struct
    143 {
    144     /**
    145      * \brief
    146      *   Local out-LIF field of the key
    147      */
    148     uint32 local_out_lif;
    149     /**
    150      * \brief
    151      *   VSI field of the key
    152      */
    153     uint32 vsi;
    154 } dnx_egress_virtual_native_ac_info_t;
    155 
    156 /**
    157  * \brief
    158  *  Virtual ingress native AC are not managed by GPort mgmt.
    159  *  This structure can be used to get similar information.
    160  */
    161 typedef struct
    162 {
    163     /**
    164      * \brief
    165      *   Local In-LIF. Key to the table below.
    166      */
    167     uint32 local_in_lif;
    168     /**
    169      * \brief
    170      *   InLIF App-DB logical table ID.
    171      */
    172     uint32 dbal_table_id;
    173     /**
    174      * \brief
    175      *   Result type in the App-DB
    176      */
    177     uint32 dbal_result_type;
    178 } dnx_ingress_virtual_native_ac_info_t;
    179 typedef struct
    180 {
    181     uint32 vlan_range_outer_index;
    182     uint32 vlan_range_outer_mask;
    183     uint32 vlan_range_inner_index;
    184     uint32 vlan_range_inner_mask;
    185 } dnx_vlan_domain_info_t;
    186 
    187 typedef struct
    188 {
    189     uint32 vlan_range_lower;
    190     uint32 vlan_range_upper;
    191     uint8 is_outer;
    192     uint8 is_add;
    193 
    194 } dnx_vlan_range_info_t;
    195 
    196 /*
    197  * }
    198  */
    199 /**
    200  * \brief
    201  * Initialize BCM VLAN module
    202  *
    203  * \par DIRECT INPUT
    204  *    \param [in] unit -
    205  *     Relevant unit.
    206  * \par INDIRECT INPUT:
    207  *   * None
    208  * \par DIRECT OUTPUT:
    209  *   * None
    210  * \par INDIRECT OUTPUT
    211  *   * Initialized BCM VLAN module
    212  * \remark
    213  *   * The function is used on init time
    214  */
    215 shr_error_e dnx_vlan_init(
    216     int unit);
    217 
    218 /**
    219  * \brief
    220  * Set default vlan value to the sw state, based on the incoming vid
    221  *
    222  * \par DIRECT INPUT
    223  *    \param [in] unit -
    224  *     Relevant unit.
    225  *    \param [in] vid -
    226  *     Relevant vid.
    227  *    \param [in] is_init -
    228  *     Indicates if the function is called on init time or not
    229  * \par INDIRECT INPUT:
    230  *   * None
    231  * \par DIRECT OUTPUT:
    232  *   \retval Negative in case of an error.
    233  *   \retval Zero in case of NO ERROR
    234  * \par INDIRECT OUTPUT
    235  *   * Write to SW state the value of the default vlan on init and non init time
    236  * \remark
    237  *   * None
    238  */
    239 shr_error_e dnx_vlan_default_set_internal(
    240     int unit,
    241     bcm_vlan_t vid,
    242     int is_init);
    243 
    244 /**
    245  * \brief - Configure VLAN PORT default ingress configuration
    246  *          (ac inlif) per port
    247  * Called by:
    248  *              - bcm_dnx_vlan_port_create
    249  *              - bcm_dnx_port_match_add
    250  *
    251  * Parameters:
    252  *              - bcm_gport_t port(in)
    253  *              - bcm_gport_t local_in_lif(in)
    254  */
    255 shr_error_e dnx_vlan_port_create_ingress_match_port_default(
    256     int unit,
    257     bcm_gport_t port,
    258     bcm_gport_t local_in_lif);
    259 
    260 /**
    261  * \brief - Configure PORT x VLAN in ingress configuration.
    262  *          ISEM lookup, result is ac inlif
    263  *
    264  * Called by:
    265  *              - bcm_dnx_vlan_port_create
    266  *              - bcm_dnx_port_match_add
    267  * Parameters:
    268  *              - bcm_gport_t port (in)
    269  *              - bcm_vlan_t match_vlan (in)
    270  *              - bcm_gport_t local_in_lif (in)
    271  *              - int is_local_in_lif_update (in)
    272  */
    273 shr_error_e dnx_vlan_port_create_ingress_match_port_vlan(
    274     int unit,
    275     bcm_gport_t port,
    276     bcm_vlan_t match_vlan,
    277     bcm_gport_t local_in_lif,
    278     int is_local_in_lif_update);
    279 
    280 /**
    281  * \brief - Configure PORT x INNER_VLAN in ingress configuration.
    282  *          ISEM lookup, result is ac inlif
    283  *
    284  * \param [in] unit - relevant unit.
    285  * \param [in] port - port for match,
    286  * \param [in] match_c_vlan - customer vlan for match.
    287  * \param [in] local_in_lif - Ac lif, the match result.
    288  * \param [in] is_local_in_lif_update - Indication to only
    289  *        Update the local In-LIF for an existing entry.
    290  *
    291  * \return
    292  *   shr_error_e
    293  *
    294  * \remark
    295  *   * None
    296  * \see
    297  * bcm_dnx_vlan_port_create
    298  * bcm_dnx_port_match_add
    299  */
    300 shr_error_e dnx_vlan_port_create_ingress_match_port_c_vlan(
    301     int unit,
    302     bcm_gport_t port,
    303     bcm_vlan_t match_c_vlan,
    304     bcm_gport_t local_in_lif,
    305     int is_local_in_lif_update);
    306 
    307 /**
    308  * \brief - Configure PORT x untag ingress configuration.
    309  *          ISEM lookup (port X untag), result is ingress ac
    310  * Called by:
    311  *              - bcm_dnx_vlan_port_create
    312  *              - bcm_dnx_port_match_add
    313  *
    314  * Parameters:
    315  *              - bcm_gport_t port(in)
    316  *              - bcm_gport_t local_in_lif(in)
    317  *              - int is_local_in_lif_update(in)
    318  */
    319 shr_error_e dnx_vlan_port_create_ingress_match_port_untagged(
    320     int unit,
    321     bcm_gport_t port,
    322     bcm_gport_t local_in_lif,
    323     int is_local_in_lif_update);
    324 
    325 /**
    326  * \brief - Configure PORT x CVLAN x CVLAN in ingress configuration.
    327  *          ISEM lookup, result is ac inlif
    328  *
    329  * Called by:
    330  *              - bcm_dnx_vlan_port_create
    331  *              - bcm_dnx_port_match_add
    332  * Parameters:
    333  *              - bcm_gport_t port (in)
    334  *              - bcm_vlan_t match_vlan (in)
    335  *              - bcm_vlan_t match_inner_vlan (in)
    336  *              - bcm_gport_t bcm_gport_t (in)
    337  *              - int is_local_in_lif_update (in) - Indication
    338  *                to only update the local In-LIF for an
    339  *                existing entry.
    340  */
    341 shr_error_e dnx_vlan_port_create_ingress_match_port_cvlan_cvlan(
    342     int unit,
    343     bcm_gport_t port,
    344     bcm_vlan_t match_vlan,
    345     bcm_vlan_t match_inner_vlan,
    346     bcm_gport_t local_in_lif,
    347     int is_local_in_lif_update);
    348 
    349 /**
    350  * \brief - Configure PORT x SVLAN x SVLAN in ingress configuration.
    351  *          ISEM lookup, result is ac inlif
    352  *
    353  * Called by:
    354  *              - bcm_dnx_vlan_port_create
    355  *              - bcm_dnx_port_match_add
    356  * Parameters:
    357  *              - bcm_gport_t port (in)
    358  *              - bcm_vlan_t match_vlan (in)
    359  *              - bcm_vlan_t match_inner_vlan (in)
    360  *              - bcm_gport_t bcm_gport_t (in)
    361  *              - int is_local_in_lif_update (in)
    362  */
    363 shr_error_e dnx_vlan_port_create_ingress_match_port_svlan_svlan(
    364     int unit,
    365     bcm_gport_t port,
    366     bcm_vlan_t match_vlan,
    367     bcm_vlan_t match_inner_vlan,
    368     bcm_gport_t local_in_lif,
    369     int is_local_in_lif_update);
    370 
    371 /**
    372  * \brief - Configure PORT x VLAN x VLAN in ingress configuration.
    373  *          ISEM lookup, result is ac inlif
    374  *
    375  * Called by:
    376  *              - bcm_dnx_vlan_port_create
    377  *              - bcm_dnx_port_match_add
    378  * Parameters:
    379  *              - bcm_gport_t port (in)
    380  *              - bcm_vlan_t match_vlan (in)
    381  *              - bcm_vlan_t match_inner_vlan (in)
    382  *              - bcm_gport_t bcm_gport_t (in)
    383  *              - int is_local_in_lif_update (in)
    384  */
    385 shr_error_e dnx_vlan_port_create_ingress_match_port_vlan_vlan(
    386     int unit,
    387     bcm_gport_t port,
    388     bcm_vlan_t match_vlan,
    389     bcm_vlan_t match_inner_vlan,
    390     bcm_gport_t local_in_lif,
    391     int is_local_in_lif_update);
    392 
    393 /**
    394  * \brief - Configure PORT x VLAN x VLAN x PCP x ETHERTYPE in ingress configuration.
    395  *          TCAM lookup, result is ac inlif
    396  *
    397  * \param [in] unit - relevant unit.
    398  * \param [in] port - port for match,
    399  * \param [in] match_vlan - outer vlan for match.
    400  * \param [in] match_inner_vlan - outer vlan for match.
    401  * \param [in] match_ethertype - outer vlan for match.
    402  * \param [in] match_pcp - outer vlan for match.
    403  * \param [in] local_in_lif - Ac lif, the match result.
    404  * \param [in] is_local_in_lif_update - Indication to only
    405  *        Update the local In-LIF for an existing entry.
    406  *
    407  * \return
    408  *   shr_error_e
    409  *
    410  * \remark
    411  *   * None
    412  * \see
    413  * bcm_dnx_vlan_port_create
    414  * bcm_dnx_port_match_add
    415  */
    416 shr_error_e dnx_vlan_port_create_ingress_match_port_vlan_vlan_pcp_ethertype(
    417     int unit,
    418     bcm_gport_t port,
    419     bcm_vlan_t match_vlan,
    420     bcm_vlan_t match_inner_vlan,
    421     bcm_port_ethertype_t match_ethertype,
    422     int match_pcp,
    423     bcm_gport_t local_in_lif,
    424     int is_local_in_lif_update);
    425 
    426 /**
    427  * \brief - Configure PORT x TUNNEL in ingress configuration.
    428  *          ISEM lookup, result is ac inlif
    429  *
    430  * Called by:
    431  *              - bcm_dnx_vlan_port_create
    432  *              - bcm_dnx_port_match_add
    433  * Parameters:
    434  *              - bcm_gport_t port (in)
    435  *              - bcm_vlan_t tunnel_id (in)
    436  *              - bcm_gport_t local_in_lif (in)
    437  */
    438 shr_error_e dnx_vlan_port_create_ingress_match_port_tunnel_unmatched(
    439     int unit,
    440     bcm_gport_t port,
    441     bcm_vlan_t tunnel_id,
    442     bcm_gport_t local_in_lif);
    443 
    444 /**
    445  * \brief - Configure PORT x TUNNEL in ingress configuration.
    446  *          ISEM lookup, result is ac inlif
    447  *
    448  * Called by:
    449  *              - bcm_dnx_vlan_port_create
    450  *              - bcm_dnx_port_match_add
    451  * Parameters:
    452  *              - bcm_gport_t port (in)
    453  *              - bcm_vlan_t tunnel_id (in)
    454  *              - bcm_gport_t local_in_lif (in)
    455  */
    456 shr_error_e dnx_vlan_port_create_ingress_match_port_tunnel_untagged(
    457     int unit,
    458     bcm_gport_t port,
    459     bcm_vlan_t tunnel_id,
    460     bcm_gport_t local_in_lif);
    461 
    462 /**
    463  * \brief - Configure PORT x TUNNEL x VLAN in ingress configuration.
    464  *          ISEM lookup, result is ac inlif
    465  *
    466  * Called by:
    467  *              - bcm_dnx_vlan_port_create
    468  *              - bcm_dnx_port_match_add
    469  * Parameters:
    470  *              - bcm_gport_t port (in)
    471  *              - bcm_vlan_t tunnel_id (in)
    472  *              - bcm_vlan_t match_vlan (in)
    473  *              - bcm_gport_t local_in_lif (in)
    474  */
    475 shr_error_e dnx_vlan_port_create_ingress_match_port_tunnel_svlan(
    476     int unit,
    477     bcm_gport_t port,
    478     bcm_vlan_t tunnel_id,
    479     bcm_vlan_t match_vlan,
    480     bcm_gport_t local_in_lif);
    481 
    482 /**
    483  * \brief - Configure PORT x TUNNEL x CVLAN in ingress configuration.
    484  *          ISEM lookup, result is ac inlif
    485  *
    486  * Called by:
    487  *              - bcm_dnx_vlan_port_create
    488  *              - bcm_dnx_port_match_add
    489  * Parameters:
    490  *              - bcm_gport_t port (in)
    491  *              - bcm_vlan_t tunnel_id (in)
    492  *              - bcm_vlan_t match_vlan (in)
    493  *              - bcm_gport_t local_in_lif (in)
    494  */
    495 shr_error_e dnx_vlan_port_create_ingress_match_port_tunnel_cvlan(
    496     int unit,
    497     bcm_gport_t port,
    498     bcm_vlan_t tunnel_id,
    499     bcm_vlan_t match_vlan,
    500     bcm_gport_t local_in_lif);
    501 
    502 /**
    503  * \brief - Configure PORT x TUNNEL x SVLAN x CVLAN in ingress configuration.
    504  *          ISEM lookup, result is ac inlif
    505  *
    506  * Called by:
    507  *              - bcm_dnx_vlan_port_create
    508  *              - bcm_dnx_port_match_add
    509  * Parameters:
    510  *              - bcm_gport_t port (in)
    511  *              - bcm_vlan_t tunnel_id (in)
    512  *              - bcm_vlan_t match_vlan (in)
    513  *              - bcm_vlan_t match_inner_vlan (in)
    514  *              - bcm_gport_t local_in_lif (in)
    515  */
    516 shr_error_e dnx_vlan_port_create_ingress_match_port_tunnel_svlan_cvlan(
    517     int unit,
    518     bcm_gport_t port,
    519     bcm_vlan_t tunnel_id,
    520     bcm_vlan_t match_vlan,
    521     bcm_vlan_t match_inner_vlan,
    522     bcm_gport_t local_in_lif);
    523 
    524 /**
    525  * \brief - Configure PORT x TUNNEL x CVLAN x CVLAN in ingress configuration.
    526  *          ISEM lookup, result is ac inlif
    527  *
    528  * Called by:
    529  *              - bcm_dnx_vlan_port_create
    530  *              - bcm_dnx_port_match_add
    531  * Parameters:
    532  *              - bcm_gport_t port (in)
    533  *              - bcm_vlan_t tunnel_id (in)
    534  *              - bcm_vlan_t match_vlan (in)
    535  *              - bcm_vlan_t match_inner_vlan (in)
    536  *              - bcm_gport_t local_in_lif (in)
    537  */
    538 shr_error_e dnx_vlan_port_create_ingress_match_port_tunnel_cvlan_cvlan(
    539     int unit,
    540     bcm_gport_t port,
    541     bcm_vlan_t tunnel_id,
    542     bcm_vlan_t match_vlan,
    543     bcm_vlan_t match_inner_vlan,
    544     bcm_gport_t local_in_lif);
    545 
    546 /**
    547  * \brief - Configure PORT x TUNNEL x SVLAN x SVLAN in ingress configuration.
    548  *          ISEM lookup, result is ac inlif
    549  *
    550  * Called by:
    551  *              - bcm_dnx_vlan_port_create
    552  *              - bcm_dnx_port_match_add
    553  * Parameters:
    554  *              - bcm_gport_t port (in)
    555  *              - bcm_vlan_t tunnel_id (in)
    556  *              - bcm_vlan_t match_vlan (in)
    557  *              - bcm_vlan_t match_inner_vlan (in)
    558  *              - bcm_gport_t local_in_lif (in)
    559  */
    560 shr_error_e dnx_vlan_port_create_ingress_match_port_tunnel_svlan_svlan(
    561     int unit,
    562     bcm_gport_t port,
    563     bcm_vlan_t tunnel_id,
    564     bcm_vlan_t match_vlan,
    565     bcm_vlan_t match_inner_vlan,
    566     bcm_gport_t local_in_lif);
    567 
    568 /**
    569  * \brief -
    570  * This function returns the default (local) lif value of the given port
    571  */
    572 shr_error_e dnx_vlan_control_port_default_lif_get(
    573     int unit,
    574     int port,
    575     uint32 *default_lif);
    576 
    577 /**
    578  * \brief
    579  *   Set default LIF for the given pp-port
    580  */
    581 shr_error_e dnx_vlan_control_port_default_lif_set(
    582     int unit,
    583     int port,
    584     uint32 default_lif);
    585 
    586 /**
    587  * \brief -
    588  * This function updates SW table with the local lif value of the created initial bridge In-LIF
    589  */
    590 shr_error_e dnx_vlan_port_ingress_initial_bridge_lif_set(
    591     int unit,
    592     int initial_bridge_lif);
    593 
    594 /**
    595  * \brief -
    596  * This function returns the local lif value of the created initial bridge In-LIF
    597  */
    598 shr_error_e dnx_vlan_port_ingress_initial_bridge_lif_get(
    599     int unit,
    600     int *initial_bridge_lif);
    601 
    602 /**
    603  * \brief -
    604  * This function updates SW table with the local lif value of the created initial default In-LIF
    605  */
    606 shr_error_e dnx_vlan_port_ingress_initial_default_lif_set(
    607     int unit,
    608     int initial_default_lif);
    609 
    610 /**
    611  * \brief -
    612  * This function returns the local lif value of the created initial default In-LIF
    613  */
    614 shr_error_e dnx_vlan_port_ingress_initial_default_lif_get(
    615     int unit,
    616     int *initial_default_lif);
    617 
    618 /**
    619  * \brief -
    620  * This function returns the local lif value of the
    621  * initial default recycle port In-LIF.
    622  * Initial default recycle port in-lif is created at init.
    623  */
    624 shr_error_e dnx_vlan_port_ingress_default_recyle_lif_get(
    625     int unit,
    626     uint32 *default_recycle_lif);
    627 
    628 /**
    629  * \brief -
    630  * Initialization function for VLAN-PORT module.
    631  * This function creates an Ingress VLAN-Port (In-LIF) to be used as
    632  * default In-LIF per port (all ETH PP ports are set to this In-LIF at initialization).
    633  * The default In-LIF properites are:
    634  *      - ingress only.
    635  *      - VSI = VID.
    636  *      - VLAN Edit profile = 0
    637  *
    638  * DBAL SW database is updated with the local lif value of this LIF.
    639  * In addtion, drop In-LIF is initialized to be used as a LIF for dropping a packet per port.
    640  * \param [in] unit - Relevant unit.
    641  * \return
    642  *   shr_error_e
    643  *
    644  * \remark
    645  * None
    646  * \see
    647  * dnx_vlan_init
    648  * dnx_port_initial_eth_properties_set
    649  * vlan_port_db.in_lif.default_in_lif
    650  * dnx_data_lif.in_lif.drop_in_lif
    651  */
    652 shr_error_e dnx_vlan_port_default_init(
    653     int unit);
    654 
    655 /**
    656  * \brief -
    657  * Initialization function for VLAN-PORT module.
    658  * Allocates and sets Default ESEM reserved AC entries. Those
    659  * entries can't be deleted.
    660  * The entries are set mostely with reset value.
    661  * \param [in] unit - Relevant unit.
    662  * \return
    663  *   shr_error_e
    664  *
    665  * \remark
    666  * None
    667  * \see
    668  * dnx_vlan_init
    669  */
    670 shr_error_e dnx_vlan_port_default_esem_init(
    671     int unit);
    672 /**
    673  * \brief
    674  *  Set VSI table entry to its default values
    675  *
    676  * \param [in] unit -
    677  *  Relevant unit.
    678  * \param [in] vsi -
    679  *   The incoming VSI ID, must be in the range from 0-nof_vsis.
    680  *   VSI - Virtual Switching Instance is a generalization of the VLAN concept used primarily in advanced bridging application.
    681  *   A VSI interconnects Logical Interfaces (LIFs). VSI is a logical partition of the MAC table and a flooding domain
    682  *   (comprising its member interfaces). For more information about VSI , see the Programmer's Guide PP document.
    683  * \return
    684  *   \retval Negative in case of an error.
    685  *   \retval Zero in case of NO ERROR
    686  * \remark
    687  *   * None
    688  * \see
    689  *   * None
    690  */
    691 shr_error_e dnx_vsi_table_default_set(
    692     int unit,
    693     bcm_vlan_t vsi);
    694 
    695 /**
    696  * \brief
    697  *  Clear VSI fields to its default values
    698  *  Should be called when VSI is destroy (the opposite of dnx_vsi_table_default_set)
    699  *
    700  * \param [in] unit -
    701  *  Relevant unit.
    702  * \param [in] vsi -
    703  *   The incoming VSI ID, must be in the range from 0-nof_vsis.
    704  *   VSI - Virtual Switching Instance is a generalization of the VLAN concept used primarily in advanced bridging application.
    705  *   A VSI interconnects Logical Interfaces (LIFs). VSI is a logical partition of the MAC table and a flooding domain
    706  *   (comprising its member interfaces). For more information about VSI , see the Programmer's Guide PP document.
    707  * \return
    708  *   \retval Negative in case of an error.
    709  *   \retval Zero in case of NO ERROR
    710  * \remark
    711  *   * None
    712  * \see
    713  *   * None
    714  */
    715 shr_error_e dnx_vsi_table_clear_set(
    716     int unit,
    717     bcm_vlan_t vsi);
    718 
    719 /**
    720  * \brief - Iinitlize the Vlan range template
    721  *
    722  * \param [in] unit - unit id
    723  *
    724  * \return
    725  *   shr_error_e
    726  *
    727  * \remark
    728  *   * None
    729  * \see
    730  *   * None
    731  */
    732 shr_error_e dnx_vlan_range_template_init(
    733     int unit);
    734 /**
    735  * \brief - Clears match in ingress non-native configuration.
    736  * - Port is set back to default-LIF
    737  * - ISEM lookup is cleared.
    738  * \see
    739  *  bcm_dnx_vlan_port_destroy_ingress
    740  *  bcm_dnx_port_match_delete
    741  */
    742 shr_error_e dnx_vlan_port_destroy_ingress_non_native_match_clear(
    743     int unit,
    744     bcm_vlan_port_t * vlan_port);
    745 
    746 /**
    747  * \brief - Clears match in ingress native configuration.
    748  * - ISEM lookup is cleared.
    749  * \see
    750  *  bcm_dnx_vlan_port_destroy_ingress
    751  *  bcm_dnx_port_match_delete
    752  */
    753 shr_error_e dnx_vlan_port_destroy_ingress_native_match_clear(
    754     int unit,
    755     bcm_vlan_port_t * vlan_port);
    756 
    757 /**
    758  * \brief -
    759  * This function gets from SW data base the ESEM Virtual LIF match-info: Native/non-Native/Namespace-vsi/Namespace-port.
    760  * It "gets" from the SW handle "ALL fields" so consecutive code can get it's relevant fields.
    761  * \param [in] unit -
    762  * \param [in] gport - ESEM Virtual GPort which is the handle for the SW DB.
    763  * \param [in] sw_table_handle_id - the sw table entry containing all info.
    764  * \return shr_error_e Standard error handeling
    765  * \see
    766  * bcm_dnx_vlan_port_translation_set
    767  * bcm_dnx_vlan_port_translation_get
    768  * bcm_dnx_gport_stat_set
    769  * bcm_dnx_gport_stat_get
    770  */
    771 shr_error_e dnx_vlan_port_egress_virtual_ac_match_info_get(
    772     int unit,
    773     bcm_gport_t gport,
    774     uint32 sw_table_handle_id);
    775 
    776 /**
    777  * \brief -
    778  * This function sets ESEM table handler with the access keys.
    779  * \param [in] unit -
    780  * \param [in] sw_table_handle_id - the sw table entry containing the match-info.
    781  * \param [in] entry_handle_id -ESEM table handler to be used to update the access keys.
    782  * \return shr_error_e Standard error handeling
    783  * \see
    784  * bcm_dnx_vlan_port_translation_set
    785  * bcm_dnx_vlan_port_translation_get
    786  * bcm_dnx_gport_stat_set
    787  * bcm_dnx_gport_stat_get
    788  */
    789 shr_error_e dnx_vlan_port_egress_virtual_key_set(
    790     int unit,
    791     uint32 sw_table_handle_id,
    792     uint32 entry_handle_id);
    793 
    794 /**
    795  * \brief -
    796  * This function sets ESEM Namespace-vsi table handler with the access keys.
    797  * \param [in] unit -
    798  * \param [in] sw_table_handle_id - the sw table entry containing all info
    799  * \param [out] entry_handle_id -ESEM table handler updated with the access keys
    800  * \return shr_error_e Standard error handeling
    801  * \see
    802  * bcm_dnx_vlan_port_find
    803  * bcm_dnx_vlan_port_translation_get
    804  */
    805 shr_error_e dnx_vlan_port_egress_virtual_namespace_vsi_key_set(
    806     int unit,
    807     uint32 sw_table_handle_id,
    808     uint32 entry_handle_id);
    809 
    810 /**
    811  * \brief -
    812  * This function gets the ESEM Namespace-vsi access keys from the given SW table.
    813  * In addition, it sets the ESEM acces keys (if the ESEM table handler is not NULL).
    814  * \param [in] unit -
    815  * \param [in] sw_table_handle_id - the sw table entry containing all info.
    816  * \param [in] entry_handle_id -ESEM table handler updated with the access keys.
    817  * \param [out] vsi -pointer to the vsi.
    818  * \param [out] match_class_id -pointer to the namespace.
    819  * \return shr_error_e Standard error handeling
    820  * \see
    821  * bcm_dnx_vlan_port_translation_set
    822  */
    823 shr_error_e dnx_vlan_port_egress_virtual_namespace_vsi_key_get(
    824     int unit,
    825     uint32 sw_table_handle_id,
    826     uint32 *entry_handle_id,
    827     bcm_vlan_t * vsi,
    828     uint32 *match_class_id);
    829 
    830 /**
    831  * \brief -
    832  * This function sets ESEM Namespace-port table handler with the access keys.
    833  * \param [in] unit -
    834  * \param [in] sw_table_handle_id - the sw table entry containing all info
    835  * \param [out] entry_handle_id -ESEM table handler updated with the access keys
    836  * \return shr_error_e Standard error handeling
    837  * \see
    838  * bcm_dnx_vlan_port_translation_set
    839  * bcm_dnx_vlan_port_translation_get
    840  * bcm_dnx_gport_stat_set
    841  * bcm_dnx_gport_stat_get
    842  */
    843 shr_error_e dnx_vlan_port_egress_virtual_namespace_port_key_set(
    844     int unit,
    845     uint32 sw_table_handle_id,
    846     uint32 entry_handle_id);
    847 
    848 /**
    849  * \brief -
    850  * This function sets ESEM native table handler with the access keys.
    851  * \param [in] unit -
    852  * \param [in] sw_table_handle_id - the sw table entry containing all info
    853  * \param [in] entry_handle_id - ESEM table handler updated with the access keys
    854  * \param [out] vlan_port - pointer to vlan port. Can be NULL if not make sense.
    855  * \return shr_error_e Standard error handeling
    856  * \see
    857  * None
    858  */
    859 shr_error_e dnx_vlan_port_egress_virtual_native_key_get(
    860     int unit,
    861     uint32 sw_table_handle_id,
    862     uint32 entry_handle_id,
    863     bcm_vlan_port_t * vlan_port);
    864 
    865 /*
    866  * This function returns the gport value of the Ingress Virtual Native LIF for the given local in-lif
    867  * \see
    868  * bcm_dnx_vlan_port_find
    869  * bcm_dnx_vlan_port_traverse
    870  * bcm_dnx_vswitch_cross_connect_traverse
    871  */
    872 shr_error_e dnx_vlan_port_find_ingress_native_virtual_match_sw_state(
    873     int unit,
    874     int local_in_lif,
    875     bcm_gport_t * vlan_port_id);
    876 
    877 /**
    878 * \brief
    879 *  Allocates inlif-profile.
    880 *  It takes the inlif-profile and updates its in_lif_orientation value.
    881 *  A new inlif-profile may be allocated (by the "exchange" function).
    882 * \see
    883 *  bcm_dnx_vlan_port_create
    884 */
    885 shr_error_e dnx_ingress_inlif_profile_alloc(
    886     int unit,
    887     bcm_switch_network_group_t network_group_id,
    888     int native_indexed_mode,
    889     int in_lif_profile,
    890     int *new_in_lif_profile,
    891     dbal_tables_e inlif_dbal_table_id);
    892 
    893 /**
    894 * \brief
    895 *  Allocates outlif-profile.
    896 *  It takes default outlif-profile and updates its out_lif_orientation value.
    897 *  A new outlif-profile may be allocated (by the "exchange" function).
    898 * \see
    899 *  bcm_dnx_vlan_port_create
    900 */
    901 shr_error_e dnx_egress_outlif_profile_alloc(
    902     int unit,
    903     bcm_switch_network_group_t network_group_id,
    904     int out_lif_profile,
    905     int *new_out_lif_profile,
    906     dbal_tables_e dbal_table_id,
    907     uint32 flags);
    908 
    909 /**
    910  * \brief
    911  *  Replaces a created Ingress P2P VLAN PORT to Ingress P2P VLAN PORT -
    912  *  for the case were the new forward information is different then current forward information, the In-LIF
    913  *  is "replaced" to accommodate the new forward information.
    914  * \param [in] unit - Unit #
    915  * \param [in] gport1 -the MP-LIF's gport to be changed to P2P-LIF.
    916  * \param [in] entry_handle_id -table handler to be used to update the fields and commit.
    917  * \param [in] forward_info2 -pointer to the forward-information of the destiantion port.
    918  *
    919  * \return
    920  *   shr_error_e
    921  *
    922  * \remark
    923  * \see
    924  * bcm_dnx_vswitch_cross_connect_add
    925  */
    926 shr_error_e dnx_vlan_port_replace_ingress_p2p_to_p2p(
    927     int unit,
    928     bcm_gport_t gport1,
    929     uint32 entry_handle_id,
    930     dnx_algo_gpm_forward_info_t * forward_info2);
    931 
    932 /**
    933  * \brief
    934  *  Replaces a created Ingress MP VLAN PORT to Ingress P2P VLAN PORT.
    935  * \param [in] unit - Unit #
    936  * \param [in] gport1 -the MP-LIF's gport to be changed to P2P-LIF.
    937  * \param [in] forward_info2 -pointer to the forward-information of the destiantion port.
    938  *
    939  * \return
    940  *   shr_error_e
    941  *
    942  * \remark
    943  * \see
    944  * bcm_dnx_vswitch_cross_connect_add
    945  */
    946 shr_error_e dnx_vlan_port_replace_ingress_mp_to_p2p(
    947     int unit,
    948     bcm_gport_t gport1,
    949     dnx_algo_gpm_forward_info_t * forward_info2);
    950 
    951 /**
    952  * \brief
    953  *  Replaces a created Ingress P2P VLAN PORT to Ingress MP VLAN PORT.
    954  * \param [in] unit - Unit #
    955  * \param [in] gport -the P2P-LIF's gport to be changed to MP-LIF.
    956  *
    957  * \return
    958  *   shr_error_e
    959  *
    960  * \remark
    961  * \see
    962  * bcm_dnx_vswitch_cross_connect_delete
    963  */
    964 shr_error_e dnx_vlan_port_replace_ingress_p2p_to_mp(
    965     int unit,
    966     bcm_gport_t gport);
    967 
    968 /**
    969  * \brief - Set the match HW entry for a VLAN-Port In-LIF.
    970  *
    971  *   \param [in] unit - unit id
    972  *   \param [in] vlan_port - Pointer to the VLAN-Port struct the
    973  *          stores all the required match parameters.
    974  *   \param [in] local_in_lif_id - The value of the local In-LIF
    975  *          ID to be set as the match result.
    976  *   \param [in] is_local_in_lif_update - Indication to only
    977  *          Update the local In-LIF for an existing entry.
    978  * \return DIRECT OUTPUT
    979  *   shr_error_e
    980  * \see
    981  *   dnx_vlan_port_create_ingress
    982  *   dnx_vlan_port_match_inlif_update
    983  *   bcm_dnx_port_match_add
    984  *   dnx_port_match_inlif_update
    985  */
    986 shr_error_e dnx_vlan_port_match_inlif_set(
    987     int unit,
    988     bcm_vlan_port_t * vlan_port,
    989     uint32 local_in_lif_id,
    990     int is_local_in_lif_update);
    991 
    992 /*
    993  * }
    994  */
    995 #endif/*_VLAN_API_INCLUDED__*/