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

virtual.h (7258B)


      1 /*
      2  * 
      3  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4  * 
      5  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
      6  *
      7  * File:        virtual.h
      8  * Purpose:     Function declarations for VP / VFI resource management
      9  */
     10 
     11 #ifndef _BCM_INT_RESOURCE_H_
     12 #define _BCM_INT_RESOURCE_H_
     13 
     14 typedef struct _bcm_virtual_bookkeeping_s {
     15     SHR_BITDCL  *vfi_bitmap;         /* Global VFI bitmap */
     16     SHR_BITDCL  *vp_bitmap;          /* Global Virtual Port bitmap */
     17     SHR_BITDCL  *mpls_vfi_bitmap;    /* MPLS VFI bitmap */
     18     SHR_BITDCL  *mpls_vp_bitmap;     /* MPLS Virtual Port bitmap */
     19     SHR_BITDCL  *mim_vfi_bitmap;     /* MIM VFI bitmap */
     20     SHR_BITDCL  *mim_vp_bitmap;      /* MIM Virtual Port bitmap */
     21     SHR_BITDCL  *l2gre_vfi_bitmap;   /* L2GRE VFI bitmap */
     22     SHR_BITDCL  *l2gre_vp_bitmap;    /* L2GRE Virtual Port bitmap */
     23     SHR_BITDCL  *vxlan_vfi_bitmap;   /* VXLAN VFI bitmap */
     24     SHR_BITDCL  *vxlan_vp_bitmap;    /* VXLAN Virtual Port bitmap */
     25     SHR_BITDCL  *flow_vfi_bitmap;    /* FLOW VFI bitmap */
     26     SHR_BITDCL  *flow_vp_bitmap;     /* FLOW Virtual Port bitmap */
     27     SHR_BITDCL  *subport_vp_bitmap;  /* Subport Virtual Port bitmap */
     28     SHR_BITDCL  *wlan_vp_bitmap;     /* WLAN Virtual Port bitmap */
     29     SHR_BITDCL  *trill_vp_bitmap;    /* TRILL Virtual Port bitmap */
     30     SHR_BITDCL  *vlan_vp_bitmap;     /* VLAN Virtual Port bitmap */
     31     SHR_BITDCL  *niv_vp_bitmap;      /* NIV Virtual Port bitmap */
     32     SHR_BITDCL  *extender_vp_bitmap; /* Extender Virtual Port bitmap */
     33     SHR_BITDCL  *vp_lag_vp_bitmap;   /* VP LAG Virtual Port bitmap */
     34     SHR_BITDCL  *vp_shared_vp_bitmap;   /* Shared Virtual Port bitmap */
     35     SHR_BITDCL  *vp_network_vp_bitmap;  /* Network Virtual Port bitmap */
     36     SHR_BITDCL  *vlan_vfi_bitmap;    /*VLAN VFI BITMAP*/
     37     uint16      *vp_to_vpn; /* VP-to-VPN cache */
     38 } _bcm_virtual_bookkeeping_t;
     39 
     40 extern _bcm_virtual_bookkeeping_t  _bcm_virtual_bk_info[BCM_MAX_NUM_UNITS];
     41 
     42 #if defined(BCM_TRX_SUPPORT)
     43 #include <bcm_int/esw/mbcm.h>
     44 
     45 /****************************************************************
     46  *
     47  * Virtual resource management functions
     48  */
     49 #if defined(INCLUDE_L3)
     50 typedef enum _bcm_vp_type_s {
     51     _bcmVpTypeMpls,      /* MPLS VP */
     52     _bcmVpTypeMim,       /* MIM VP */
     53     _bcmVpTypeSubport,   /* Subport VP */
     54     _bcmVpTypeWlan,      /* WLAN VP */
     55     _bcmVpTypeTrill,     /* TRILL VP */
     56     _bcmVpTypeVlan,      /* VLAN VP */
     57     _bcmVpTypeNiv,       /* NIV VP */
     58     _bcmVpTypeL2Gre,     /* L2GRE VP */
     59     _bcmVpTypeVxlan,     /* VXLAN VP */
     60     _bcmVpTypeExtender,  /* Extender VP */
     61     _bcmVpTypeVpLag,     /* VP LAG VP */
     62     _bcmVpTypeFlow,      /* FLOW VP */
     63     _bcmVpTypeAny        /* Any VP */
     64 } _bcm_vp_type_e;
     65 
     66 #define _BCM_VP_INFO_NETWORK_PORT 0x00000001 /* Network side port for VP applications */
     67 #define _BCM_VP_INFO_SHARED_PORT  0x00000002 /* Shared virtual port for VP applications */
     68 
     69 typedef struct _bcm_vp_info_s {
     70     _bcm_vp_type_e vp_type;
     71     uint32 flags;
     72 } _bcm_vp_info_t;
     73 
     74 typedef enum _bcm_vfi_type_s {
     75     _bcmVfiTypeMpls,     /* MPLS VFI */
     76     _bcmVfiTypeMim,      /* MIM VFI */
     77     _bcmVfiTypeL2Gre,   /* L2GRE VFI */
     78     _bcmVfiTypeVxlan,   /* VXLAN VFI */
     79     _bcmVfiTypeVlan,    /* VLAN VFI */
     80     _bcmVfiTypeFlow,    /* FLEX FLOW VFI */
     81     _bcmVfiTypeAny       /* Any VFI */
     82 } _bcm_vfi_type_e;
     83 
     84 typedef enum _bcm_vp_ing_dvp_config_op_e {
     85     _bcmVpIngDvpConfigClear,  /* Clear ING_DVP_* tables                    */
     86     _bcmVpIngDvpConfigSet,    /* Set input data in ING_DVP_* tables        */
     87     _bcmVpIngDvpConfigUpdate  /* Update the input data in ING_DVP_* tables */
     88 } _bcm_vp_ing_dvp_config_op_t;
     89 
     90 typedef enum _bcm_vp_ing_dvp_vp_type_e {
     91     _bcmVpIngDvpVpTypeMPLS_MIM_NIV,  /* MPLS/MIM/NIV */
     92     _bcmVpIngDvpVpTypeTRILL,    /* TRILL */
     93     _bcmVpIngDvpVpTypeL2GRE,  /* L2GRE */
     94     _bcmVpIngDvpVpTypeVXLAN,  /* VXLAN */
     95     _bcmVpIngDvpVpTypeCount
     96 } _bcm_vp_ing_dvp_vp_type_t;
     97 
     98 typedef enum _bcm_vp_ing_dvp_port_type_e {
     99     _bcmVpIngDvpVpPortTypeDefault,  /* vp is  not network port */
    100     _bcmVpIngDvpPortTypeNetwork,    /* vp is network port */
    101     _bcmVpIngDvpPortTypeCount
    102 } _bcm_vp_ing_dvp_port_type_t;
    103 
    104 
    105 #define ING_DVP_CONFIG_INVALID_INTF_ID    -1   /* invalid intf id */
    106 #define ING_DVP_CONFIG_INVALID_PORT_TYPE  -1   /* invalid port type */
    107 #define ING_DVP_CONFIG_INVALID_VP_TYPE    -1   /* invalid vp type */
    108 
    109 /*
    110  * Split Horizon Network Group Id Validation
    111  */
    112 #define _BCM_SWITCH_NETWORK_GROUP_ID_VALID(unit, gid)    \
    113                     (((gid) >= 0) && ((gid) <= 7))
    114 
    115 
    116 #define _BCM_SWITCH_RESERVED_NETWORK_GROUP_IDS(unit, gid)    \
    117                     (((gid) >= 0) && ((gid) <= 1))
    118 
    119 
    120 extern int _bcm_virtual_init(int unit, soc_mem_t vp_mem, soc_mem_t vfi_mem);
    121 extern int _bcm_virtual_deinit(int unit);
    122 extern void _bcm_vp_info_init (_bcm_vp_info_t *vp_info);
    123 
    124 #ifdef BCM_WARM_BOOT_SUPPORT
    125 extern int _bcm_esw_virtual_sync(int unit);
    126 #endif
    127 extern int _bcm_vp_alloc(int unit, int start, int end, int count, soc_mem_t vp_mem, 
    128                          _bcm_vp_info_t type, int *base_vp);
    129 extern int _bcm_vp_free(int unit, _bcm_vp_type_e type, int count, int base_vp);
    130 extern int _bcm_vp_used_set(int unit, int vp, _bcm_vp_info_t vp_info);
    131 extern int _bcm_vp_used_get(int unit, int vp, _bcm_vp_type_e type);
    132 extern int _bcm_vp_info_get(int unit, int vp, _bcm_vp_info_t *vp_info);
    133 extern int _bcm_vp_gport_dest_fill(int unit, int vp,
    134                                         _bcm_gport_dest_t *gport_dest);
    135 
    136 extern int _bcm_vp_default_cml_mode_get (int unit, int *cml_default_enable, int *cml_new, int *cml_move);
    137 extern int _bcm_vfi_alloc(int unit, soc_mem_t vp_mem, _bcm_vfi_type_e type, int *vfi);
    138 extern int _bcm_vfi_alloc_with_id(int unit, soc_mem_t vfi_mem, _bcm_vfi_type_e type, int vfi);
    139 extern int _bcm_vfi_free(int unit, _bcm_vfi_type_e type, int vfi);
    140 extern int _bcm_vfi_used_get(int unit, int vfi, _bcm_vfi_type_e type);
    141 extern int _bcm_vfi_flex_stat_index_set(int unit, int vfi,
    142                                _bcm_vfi_type_e type, int fs_idx,uint32 flags);
    143 extern int _bcm_vp_ing_dvp_config(int unit, _bcm_vp_ing_dvp_config_op_t op, 
    144                                            int vp,int vp_type, bcm_if_t intf, 
    145                                            int network_port);
    146 extern int _bcm_vp_ing_dvp_to_ing_dvp2(int unit, ing_dvp_table_entry_t *dvp,
    147         int vp);
    148 extern int _bcm_vp_ing_dvp_to_ing_dvp2_2(int unit,
    149         ing_dvp_table_entry_t *dvp, int vp, int network_group_id);
    150 extern int
    151 _bcm_validate_splithorizon_network_group(int unit,int nw_flag,
    152         int *network_group);
    153 extern int _bcm_vp_encode_gport(int unit, int vp, int *gport);
    154 extern int _bcm_vp_is_vfi_type(int unit, bcm_gport_t gport);
    155 extern int _bcm_vp_vfi_type_vp_get(int unit, bcm_gport_t gport, int *vp);
    156 extern int _bcm_vp_lag_member_is_vfi_type(int unit, bcm_gport_t gport);
    157 extern void _bcm_vp_vfi_set(int unit, int vp, int vfi);
    158 extern int _bcm_vp_vfi_get(int unit, int vp);
    159 #endif /* INCLUDE_L3 */
    160 extern int
    161 _bcm_switch_network_group_pruning(int unit,
    162      bcm_switch_network_group_t source_network_group_id,
    163      bcm_switch_network_group_config_t *config);
    164 
    165 
    166 #endif /* BCM_TRX_SUPPORT */
    167 #endif  /* !_BCM_INT_RESOURCE_H_ */
    168 
    169