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

mim.h (2920B)


      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  * Soc_petra-B Layer 2 Management
      9  */
     10 
     11 #ifndef   _BCM_INT_DPP_MIM_H_
     12 #define   _BCM_INT_DPP_MIM_H_
     13 
     14 #include <bcm_int/dpp/error.h>
     15 
     16 #include <bcm/mim.h>
     17 #include <bcm/types.h>
     18 
     19 #include <soc/dpp/drv.h>
     20 
     21 
     22 /* 
     23  * Defines
     24  */
     25 
     26 #define BCM_PETRA_MIM_VPN_INVALID(_unit_) ((SOC_IS_JERICHO_A0(_unit_) | SOC_IS_JERICHO_B0(_unit_) | SOC_IS_QMX(_unit_)) ? 0x7fff: 0xffff)
     27 
     28 #define BCM_PETRA_MIM_BTAG_TPID    (0x81a8)
     29 #define BCM_PETRA_MIM_ITAG_TPID    (0x88e7)
     30 
     31 #define BCM_PETRA_MIM_BVID_MC_GROUP_BASE    (12*1024)
     32 
     33 #define MIM_ACCESS sw_state_access[unit].dpp.bcm.mim
     34 
     35 /* Defines for support of SW State to hold INGRESS/EGRESS only status for each VPN */
     36 #define _BCM_DPP_MIM_VPN_FLAGS_SET(_is_ingress, _is_egress, _is_valid, _isid) ((_isid << 8) | (_is_valid << 2) | (_is_egress << 1) | _is_ingress)
     37 #define _BCM_DPP_MIM_VPN_BSA_NICKNAME_SET(_is_valid, _bsa_nickname) ((_is_valid << 20) | (_bsa_nickname & 0xFFFFF))
     38 #define _BCM_DPP_MIM_VPN_ISID_GET(_val) ((_val >> 8) & 0xFFFFFF)
     39 #define _BCM_DPP_MIM_VPN_IS_EGRESS(_val) ((_val >> 1) & 0x1)
     40 #define _BCM_DPP_MIM_VPN_IS_INGRESS(_val) (_val & 0x1)
     41 #define _BCM_DPP_MIM_VPN_IS_VALID(_val) ((_val >> 0x2) & 0x1)
     42 #define _BCM_DPP_MIM_VPN_BSA_NICKNAME_GET(_val) (_val & 0xFFFFF)
     43 #define _BCM_DPP_MIM_VPN_IS_BSA_NICKNAME_VALID(_val) ((_val >> 20) & 0x1)
     44 #define _BCM_DPP_MIM_NUM_OF_VSI (32*1024)
     45 /*
     46  * MiM Module Helper functions
     47  */
     48 
     49 uint8
     50   __dpp_mim_initialized_get(int unit);
     51 
     52 SOC_PPC_LIF_ID
     53   __dpp_mim_lif_ndx_get(int unit);
     54 
     55 SOC_PPC_AC_ID
     56   __dpp_mim_global_out_ac_get(int unit);
     57 
     58 
     59 int dpp_mim_set_global_mim_tpid(int unit, uint16 tpid);
     60 int dpp_mim_get_global_mim_tpid(int unit, uint16 *tpid);
     61 
     62 
     63 
     64 int _bcm_dpp_in_lif_mim_match_add(int unit, bcm_mim_port_t *mim_port, int lif);
     65 int _bcm_dpp_in_lif_mim_match_get(int unit, bcm_mim_port_t *mim_port, int lif);
     66 
     67 /* 
     68  * Macros
     69  */
     70 
     71 #define MIM_INIT(unit)                                    \
     72     do {                                                  \
     73         if (!__dpp_mim_initialized_get(unit)) {           \
     74             return BCM_E_INIT;                            \
     75         }                                                 \
     76     } while (0)
     77 
     78 #define MIM_IS_INIT(unit)   (__dpp_mim_initialized_get(unit))
     79 
     80 
     81 typedef struct bcm_dpp_mim_info_s {
     82     SOC_PPC_LIF_ID    mim_local_lif_ndx; /* default local lif, used only for MiM */
     83     SOC_PPC_AC_ID     mim_local_out_ac; /* default out-ac, used only for MiM */
     84     uint32            mim_vpn_flags[_BCM_DPP_MIM_NUM_OF_VSI]; /* INGRESS/EGRESS only flags per VPN and ISID for INGRESS_ONLY VPNs */
     85     uint32            mim_vpn_bsa_nickname[_BCM_DPP_MIM_NUM_OF_VSI]; /* BSA nicknames for INGRESS_ONLY VPNs */
     86 } bcm_dpp_mim_info_t;
     87 
     88 
     89 #endif /* _BCM_INT_DPP_MIM_H_ */
     90