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

vswitch_vpn.h (5035B)


      1 /** \file vswitch_vpn.h 
      2  * General Vswitch utility functionality for DNX. 
      3  */
      4 /*
      5  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      6  * 
      7  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
      8  */
      9 
     10 #ifndef VSWITCH_VPN_H_INCLUDED
     11 /** { */
     12 #define VSWITCH_VPN_H_INCLUDED
     13 
     14 #define VSI_USAGE_VALUE_SET 1   /* value to set usage */
     15 #define VSI_USAGE_VALUE_CLEAR 0 /* value to clear usage */
     16 
     17 typedef enum _dnx_vsi_type_s
     18 {
     19     _bcmDnxVsiTypeNone,         /* None of VPN */
     20     _bcmDnxVsiTypeAny,          /* Any VPN */
     21     _bcmDnxVsiTypeMpls,         /* MPLS VPN */
     22     _bcmDnxVsiTypeVswitch,      /* VSWITCH VSI */
     23     _bcmDnxVsiTypeMim,          /* MIM VSI */
     24     _bcmDnxVsiTypeL2gre,        /* L2GRE VSI */
     25     _bcmDnxVsiTypeVxlan,        /* VXLAN */
     26     _bcmDnxVsiTypeAll,          /* All */
     27     _bcmDnxVsiTypeCount
     28 } dnx_vsi_type_e;
     29 
     30 /**
     31  * \brief
     32  *      Allocate a vsi for type.
     33  * \param [in] unit -
     34  *      Relevant unit.
     35  * \param [in,out] vsi - vsi for set/clear \n
     36  *      VSI is not allocated, use this VSI; otherwise allocate a new one \n
     37  * \param [in] flags - DNX_ALGO_RES_ALLOCATE_xxx \n
     38  * \param [in] type - see dnx_vsi_type_e \n
     39  * \param [out] was_replaced - indicate if used by other type. \n
     40  * \return
     41  *      * Zero in case of NO ERROR.
     42  *      * Negative in case of an error, see \ref shr_error_e.
     43  * \remark
     44  *      * Allocate a VSI and set usage type in SW table.
     45  * \see
     46  *      * none
     47  */
     48 
     49 shr_error_e dnx_vswitch_vsi_usage_alloc(
     50     int unit,
     51     uint32 flags,
     52     dnx_vsi_type_e type,
     53     int *vsi,
     54     uint8 *was_replaced);
     55 
     56 /**
     57  * \brief
     58  *      De-allocate a vsi for type.
     59  * \param [in] unit -
     60  *      Relevant unit.
     61  * \param [in] vsi - vsi for set/clear \n
     62  * \param [in] type - see dnx_vsi_type_e \n
     63  * \return
     64  *      \retval Zero in case of NO ERROR.
     65  *      \retval Negative in case of an error, see \ref shr_error_e.
     66  * \remark
     67  *      * Free a VSI and clear usage type in SW table.
     68  * \see
     69  *      * none
     70  */
     71 shr_error_e dnx_vswitch_vsi_usage_dealloc(
     72     int unit,
     73     dnx_vsi_type_e type,
     74     int vsi);
     75 
     76 /**
     77  * \brief
     78  *      Get a VSI usage according to input type.
     79  * \param [in] unit -
     80  *      Relevant unit.
     81  * \param [in] vsi - vsi for get operation \n
     82  * \param [in] type - see dnx_vsi_type_e, only support for following type \n
     83  *          _bcmDnxVsiTypeMpls: used for MPSL VPN \n
     84  *          _bcmDnxVsiTypeVswitch \n
     85  *          _bcmDnxVsiTypeL2gre \n
     86  *          _bcmDnxVsiTypeMim \n
     87  *          _bcmDnxVsiTypeVxlan \n
     88  * \param [out] value - usage of this type on the VSI. 
     89  * \return
     90  *      \retval Zero in case of NO ERROR.
     91  *      \retval Negative in case of an error, see \ref shr_error_e.
     92  * \remark
     93  *      * This function only support to get/check VSI for single type.
     94  * \see
     95  *      * none
     96  */
     97 
     98 shr_error_e dnx_vswitch_vsi_usage_per_type_set(
     99     int unit,
    100     int vsi,
    101     dnx_vsi_type_e type,
    102     uint8 value);
    103 
    104 /**
    105  * \brief
    106  *      Get a VSI usage according to input type.
    107  * \param [in] unit -
    108  *      Relevant unit.
    109  * \param [in] vsi - vsi for get operation \n
    110  * \param [in] type - see dnx_vsi_type_e, only support for following type \n
    111  *          _bcmDnxVsiTypeMpls: used for MPSL VPN \n
    112  *          _bcmDnxVsiTypeVswitch \n
    113  *          _bcmDnxVsiTypeL2gre \n
    114  *          _bcmDnxVsiTypeMim \n
    115  *          _bcmDnxVsiTypeVxlan \n
    116  * \param [out] is_used - usage of this type on the VSI. 
    117  * \return
    118  *      \retval Zero in case of NO ERROR.
    119  *      \retval Negative in case of an error, see \ref shr_error_e.
    120  * \remark
    121  *      * This function only support to get/check VSI for single type.
    122  * \see
    123  *      * none
    124  */
    125 shr_error_e dnx_vswitch_vsi_usage_per_type_get(
    126     int unit,
    127     int vsi,
    128     dnx_vsi_type_e type,
    129     uint8 *is_used);
    130 
    131 /**
    132  * \brief
    133  *      check all usages of this VSI except the input "type". 
    134  *      It's useful to check if VSI is empty or only used for the input "type".
    135  *      When (type==_bcmDnxVsiTypeNone), this function will check if VSI is empty.
    136  *      If VSI is used for VxLAN VPN, call type with "_bcmDnxVsiTypeVxlan", 
    137  *      then function will check if this VSI also used by other type of services(exclude VxLAN VPN).
    138  *
    139  * \param [in] unit -
    140  *      Relevant unit.
    141  * \param [in] vsi - vsi for set/clear \n
    142  * \param [in] type - see dnx_vsi_type_e, only support for following type \n
    143  *          _bcmDnxVsiTypeNone  - check all type of usages. \n
    144  *          _bcmDnxVsiTypeMpls \n
    145  *          _bcmDnxVsiTypeVswitch \n
    146  *          _bcmDnxVsiTypeL2gre \n
    147  *          _bcmDnxVsiTypeMim \n
    148  *          _bcmDnxVsiTypeVxlan \n
    149  * \param [out] *used - indicate if used by other type service. 
    150  * \return
    151  *      \retval Zero in case of NO ERROR.
    152  *      \retval Negative in case of an error, see \ref shr_error_e.
    153  * \remark
    154  *      * Check all types of usage except one/none.
    155  * \see
    156  *      * none
    157  */
    158 shr_error_e dnx_vswitch_vsi_usage_check_except_type(
    159     int unit,
    160     int vsi,
    161     dnx_vsi_type_e type,
    162     uint8 *used);
    163 
    164 /** } */
    165 #endif