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

stg.h (4275B)


      1 /*! \file bcm_int/dnx/stg/stg.h
      2  *
      3  *  Internal DNX STG APIs
      4  */
      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  *  All Rights Reserved.
     10  */
     11 #include <bcm_int/dnx_dispatch.h>
     12 #ifndef STG_H_INCLUDED
     13 /* { */
     14 #define STG_H_INCLUDED
     15 
     16 #ifndef BCM_DNX_SUPPORT
     17 #error "This file is for use by DNX (JR2) family only!"
     18 #endif
     19 
     20 /*
     21  * DEFINEs
     22  * {
     23  */
     24 #define BCM_STG_MIN             BCM_STG_DEFAULT
     25 
     26 /*
     27  * }
     28  */
     29 /*
     30  * MACROs
     31  * {
     32  */
     33 
     34 /** Encode topology_id with BCM stg_id.*/
     35 #define BCM_DNX_STG_TO_TOPOLOGY_ID_GET(stg_id)             (stg_id - 1)
     36 
     37 /** Encode BCM stg_id with topology_id.*/
     38 #define BCM_DNX_TOPOLOGY_ID_TO_STG_GET(stg_topology_id)    (stg_topology_id + 1)
     39 
     40 /*
     41  * }
     42  */
     43 
     44 /*
     45  * DECLARATIONs
     46  * {
     47  */
     48 
     49 /**
     50  * \brief
     51  *  Initialize BCM STG module.
     52  *  The actions include: create the default stg, initialize all ports in it with
     53  *  forward state and add the default vlan to the stg.
     54  *
     55  * \param [in] unit - Unit-ID 
     56  *
     57  * \return
     58  *   \retval Zero if no error was detected
     59  *   \retval Negative if error was detected. See \ref shr_error_e
     60  *
     61  * \remark
     62  *  The function is used on init time.
     63  *  It is also a API can be called in applications.
     64  *
     65  * \see
     66  *  None.
     67  */
     68 shr_error_e dnx_stg_init(
     69     int unit);
     70 
     71 /**
     72  * \brief
     73  *   Set the spanning tree state for a port.
     74  *
     75  * \param [in] unit - Relevant unit.
     76  * \param [in] port - Port - physical port or logical port
     77  * \param [in] state - State to place port in, one of BCM_PORT_STP_xxx.
     78  *
     79  * \return
     80  *   \retval Zero if no error was detected
     81  *   \retval Negative if error was detected. See \ref shr_error_e
     82  *
     83  * \remark
     84  *   All STGs containing all VLANs containing the given port are updated.
     85  *
     86  * \see
     87  *   dnx_port_stp_get
     88  */
     89 shr_error_e dnx_port_stp_set(
     90     int unit,
     91     bcm_port_t port,
     92     int state);
     93 
     94 /**
     95  * \brief
     96  *   Get the spanning tree state for a port in the default STG.
     97  *
     98  * \param [in] unit - Relevant unit.
     99  * \param [in] port - Port - physical port or logical port
    100  * \param [out] state - Pointer where state stored.
    101  *
    102  * \return
    103  *   \retval Zero if no error was detected
    104  *   \retval Negative if error was detected. See \ref shr_error_e
    105  *
    106  * \remark
    107  *   None.
    108  *
    109  * \see
    110  *   dnx_port_stp_get
    111  */
    112 shr_error_e dnx_port_stp_get(
    113     int unit,
    114     bcm_port_t port,
    115     int *state);
    116 
    117 /**
    118  * \brief
    119  *   Removes a VSI from a spanning tree group.
    120  *   The VSI is placed back in the default spanning tree group.
    121  *
    122  * \param [in] unit - Relevant unit.
    123  * \param [in] stg - The specified Spanning Tree Group.
    124  * \param [in] vsi - The incoming VSI
    125  * \param [in] add_defl - Whether add the VSI to default STG or not.
    126  *
    127  * \return
    128  *   \retval Zero if no error was detected
    129  *   \retval Negative if error was detected. See \ref shr_error_e
    130  *
    131  * \remark
    132  *   If this procedure is called in destroy operation, like destroy vlan,
    133  *   then should add_defl=FALSE. With this flag, the VSI won't be added to
    134  *   default STG.
    135  *
    136  * \see
    137  *   None.
    138  */
    139 shr_error_e dnx_stg_vlan_remove(
    140     int unit,
    141     bcm_stg_t stg,
    142     bcm_vlan_t vsi,
    143     int add_defl);
    144 
    145 /**
    146  * \brief
    147  *   Check if the port is applicable to spanning tree protocol.
    148  *
    149  * \param [in] unit - Relevant unit.
    150  * \param [in] port - port that will be set with spanning tree protocol state.
    151  *
    152  * \return
    153  *   \retval Zero if no error was detected
    154  *   \retval Negative if error was detected. See \ref shr_error_e
    155  *
    156  * \remark
    157  *   None
    158  *
    159  * \see
    160  *   None.
    161  */
    162 shr_error_e dnx_stg_port_verify(
    163     int unit,
    164     bcm_port_t port);
    165 
    166 /**
    167  * \brief - Add the given VSI to the specified stg.
    168  *
    169  * \param [in] unit - The unit ID
    170  * \param [in] stg  - The given stg_id
    171  * \param [in] vsi  - The given vsi
    172  *
    173  * \return
    174  *   \retval  Zero if no error was detected
    175  *   \retval  Negative if error was detected. See \ref shr_error_e
    176  *
    177  * \remark
    178  *   Add the VSI to the stg linked list first (sw_state), then update The VSI
    179  *   information with the stg (ING_VSI_INFO/EGR_VSI_INFO) in MDB.
    180  *
    181  * \see
    182  *   dnx_stg_vlan_first_set
    183  *   dnx_vlan_stg_set
    184  */
    185 shr_error_e dnx_stg_vlan_map_add(
    186     int unit,
    187     bcm_stg_t stg,
    188     bcm_vlan_t vsi);
    189 
    190 /*
    191  * }
    192  */
    193 #endif /* STG_H_INCLUDED */