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

fabric_if.h (9161B)


      1 /*
      2  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      3  * 
      4  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
      5  */
      6 /*
      7  * ! \file bcm_int/dnx/fabric/fabric_if.h
      8  * Reserved.$ 
      9  */
     10 
     11 #ifndef _DNX_FABRIC_IF_H_INCLUDED_
     12 /*
     13  * { 
     14  */
     15 #define _DNX_FABRIC_IF_H_INCLUDED_
     16 
     17 #ifndef BCM_DNX_SUPPORT
     18 #error "This file is for use by DNX (JR2) family only!"
     19 #endif
     20 
     21 #include <bcm/types.h>
     22 
     23 /**
     24  * \brief
     25  *   Force traffic through fabric or to local cores
     26  */
     27 typedef enum
     28 {
     29     /**
     30      * Force Fabric
     31      */
     32     DNX_FABRIC_FORCE_FABRIC = 0,        /* Force Fabric */
     33     /**
     34      * Force Local Core 0
     35      */
     36     DNX_FABRIC_FORCE_LOCAL0,    /* Force Local Core 0 */
     37     /**
     38      * Force Local Core 1
     39      */
     40     DNX_FABRIC_FORCE_LOCAL1,    /* Force Local Core 1 */
     41     /**
     42      * Restore default
     43      */
     44     DNX_FABRIC_FORCE_RESTORE    /* Restore default */
     45 } dnx_fabric_force_e;
     46 
     47 /**
     48  * \brief
     49  *   When link is disabled, we need to force the signal, otherwise it
     50  *   can cause other blocks to get stuck.
     51  * \param [in] unit -
     52  *   The unit number.
     53  * \param [in] link -
     54  *   Fabric link id.
     55  * \param [in] force_signal -
     56  *   1 - force signal.
     57  *   0 - don't force signal.
     58  * \return
     59  *   See \ref shr_error_e
     60  * \remark
     61  *   * None.
     62  * \see
     63  *   * None.
     64  */
     65 shr_error_e dnx_fabric_if_link_force_signal_set(
     66     int unit,
     67     int link,
     68     int force_signal);
     69 
     70 /**
     71  * \brief
     72  *   Initialize FMAC configurations
     73  * \param [in] unit -
     74  *   The unit number.
     75  * \param [in] fmac_index -
     76  *   The index of the FMAC.
     77  * \return
     78  *   See \ref shr_error_e
     79  * \remark
     80  *   * None.
     81  * \see
     82  *   * None.
     83  */
     84 shr_error_e dnx_fabric_if_mac_init(
     85     int unit,
     86     int fmac_index);
     87 
     88 /**
     89  * \brief
     90  *   Enable/Disable fabric port
     91  * \param [in] unit -
     92  *   The unit number.
     93  * \param [in] logical_port -
     94  *  Fabric logical port to enable/disable.
     95  * \param [in] enable -
     96  *   1 - Enable.
     97  *   2 - Disable.
     98  * \return
     99  *   See \ref shr_error_e
    100  * \remark
    101  *   * None.
    102  * \see
    103  *   * None.
    104  */
    105 shr_error_e dnx_fabric_if_port_enable_set(
    106     int unit,
    107     bcm_port_t logical_port,
    108     int enable);
    109 
    110 /**
    111  * \brief
    112  *   Enable/Disable fabric port pahse 1
    113  *   To complete the operation _phase2 API must follow.
    114  *   Between the 2 APIs a delay of 1 milisec is mandatory
    115  * \param [in] unit -
    116  *   The unit number.
    117  * \param [in] logical_port -
    118  *  Fabric logical port to enable/disable.
    119  * \param [in] enable -
    120  *   1 - Enable.
    121  *   2 - Disable.
    122  * \return
    123  *   See \ref shr_error_e
    124  * \remark
    125  *   * None.
    126  * \see
    127  *   * None.
    128  */
    129 shr_error_e dnx_fabric_if_port_enable_set_phase1(
    130     int unit,
    131     bcm_port_t logical_port,
    132     int enable);
    133 
    134 /**
    135  * \brief
    136  *   Enable/Disable fabric port pahse 2
    137  *   To complete the operation _phase1 API must precede.
    138  *   Between the 2 APIs a delay of 1 milisec is mandatory
    139  * \param [in] unit -
    140  *   The unit number.
    141  * \param [in] logical_port -
    142  *  Fabric logical port to enable/disable.
    143  * \param [in] enable -
    144  *   1 - Enable.
    145  *   2 - Disable.
    146  * \return
    147  *   See \ref shr_error_e
    148  * \remark
    149  *   * None.
    150  * \see
    151  *   * None.
    152  */
    153 shr_error_e dnx_fabric_if_port_enable_set_phase2(
    154     int unit,
    155     bcm_port_t logical_port,
    156     int enable);
    157 
    158 /**
    159  * \brief - 
    160  *   Power up fabric ports.
    161  *   The function adds all given ports to fabric ports bitmap, and power them
    162  *   up (probe them).
    163  *  
    164  * \param [in] unit - Unit-ID 
    165  * \param [in] pbmp - Bitmap of fabric ports to power up.
    166  * \param [out] okay_pbmp - Bitmap of fabric ports that were powered up.
    167  * \return
    168  *   See \ref shr_error_e 
    169  * \remark
    170  *   * None
    171  * \see
    172  *   * None
    173  */
    174 shr_error_e dnx_fabric_if_port_probe(
    175     int unit,
    176     bcm_pbmp_t pbmp,
    177     bcm_pbmp_t * okay_pbmp);
    178 
    179 /**
    180  * \brief - 
    181  *   Power down fabric ports.
    182  *   The function removes all given ports from fabric ports bitmap, and power them
    183  *   down (detach them).
    184  *  
    185  * \param [in] unit - Unit-ID 
    186  * \param [in] pbmp - Bitmap of fabric ports to power down.
    187  * \param [out] detached - Bitmap of fabric ports that were powered down.
    188  * \return
    189  *   See \ref shr_error_e 
    190  * \remark
    191  *   * None
    192  * \see
    193  *   * None
    194  */
    195 shr_error_e dnx_fabric_if_port_detach(
    196     int unit,
    197     bcm_pbmp_t pbmp,
    198     bcm_pbmp_t * detached);
    199 
    200 /**
    201  * \brief - 
    202  *   Set shaper on fabric link.
    203  *  
    204  * \param [in] unit - 
    205  *   The unit-ID 
    206  * \param [in] port -
    207  *   The port id to set shaper upon.
    208  * \param [in] pps -
    209  *   Packets Per Second limit.
    210  * \param [in] burst -
    211  *   Burst limit.
    212  * \return
    213  *   See \ref shr_error_e 
    214  * \remark
    215  *   * Used for connecting the device to a repeater.
    216  * \see
    217  *   * None
    218  */
    219 shr_error_e dnx_fabric_if_link_rate_egress_pps_set(
    220     int unit,
    221     bcm_port_t port,
    222     uint32 pps,
    223     uint32 burst);
    224 
    225 /**
    226  * \brief - 
    227  *   Get shaper of fabric link.
    228  *  
    229  * \param [in] unit - 
    230  *   The unit-ID 
    231  * \param [in] port -
    232  *   The port id to get its shaper.
    233  * \param [out] pps -
    234  *   Packets Per Second limit.
    235  *   0 means shaper is disabled.
    236  * \param [out] burst -
    237  *   Burst limit.
    238  *   0 means shaper is disabled.
    239  * \return
    240  *   See \ref shr_error_e 
    241  * \remark
    242  *   * None
    243  * \see
    244  *   * None
    245  */
    246 shr_error_e dnx_fabric_if_link_rate_egress_pps_get(
    247     int unit,
    248     bcm_port_t port,
    249     uint32 *pps,
    250     uint32 *burst);
    251 
    252 /**
    253  * \brief
    254  *   Checks if any of the Fabric Quads are disabled and according to that sets
    255  *   the LAST_IN_CHAIN for the FSRD and FMAC.
    256  * \param [in] unit -
    257  *   The unit number.
    258  * \return
    259  *   See \ref shr_error_e
    260  * \remark
    261  *   None
    262  * \see
    263  *   None.
    264  */
    265 shr_error_e dnx_fabric_if_brdc_fsrd_blk_id_set(
    266     int unit);
    267 
    268 /**
    269  * \brief
    270  *   Get FSRD's clock power state.
    271  * \param [in] unit -
    272  *   The unit number.
    273  * \param [in] fsrd_id -
    274  *   FSRD block id
    275  * \param [out] enable -
    276  *   1:enable, 0:disable
    277  * \return
    278  *   See \ref shr_error_e
    279  * \remark
    280  *   None
    281  * \see
    282  *   None.
    283  */
    284 shr_error_e dnx_fabric_if_fsrd_clock_power_get(
    285     int unit,
    286     int fsrd_id,
    287     int *enable);
    288 
    289 /**
    290  * \brief
    291  *   Get whether FSRD block is enabled.
    292  * \param [in] unit -
    293  *   The unit number.
    294  * \param [in] fsrd_block -
    295  *   FSRD block 
    296  * \param [out] enable -
    297  *   1:enable, 0:disable
    298  * \return
    299  *   See \ref shr_error_e
    300  * \remark
    301  *   None
    302  * \see
    303  *   None.
    304  */
    305 shr_error_e dnx_fabric_if_fsrd_block_enable_get(
    306     int unit,
    307     int fsrd_block,
    308     int *enable);
    309 
    310 /**
    311  * \brief
    312  *   Power up/down a FSRD's clock power.
    313  * \param [in] unit -
    314  *   The unit number.
    315  * \param [in] fsrd_id -
    316  *   FSRD block id
    317  * \param [in] enable -
    318  *   1:enable, 0:disable
    319  * \return
    320  *   See \ref shr_error_e
    321  * \remark
    322  *   None
    323  * \see
    324  *   None.
    325  */
    326 shr_error_e dnx_fabric_if_fsrd_clock_power_set(
    327     int unit,
    328     int fsrd_id,
    329     int enable);
    330 
    331 /**
    332  * \brief
    333  *   enable/disable a FSRD block.
    334  * \param [in] unit -
    335  *   The unit number.
    336  * \param [in] fsrd_block -
    337  *   FSRD block id
    338  * \param [in] enable -
    339  *   1:enable, 0:disable
    340  * \return
    341  *   See \ref shr_error_e
    342  * \remark
    343  *   None
    344  * \see
    345  *   None.
    346  */
    347 shr_error_e dnx_fabric_if_fsrd_block_enable_set(
    348     int unit,
    349     int fsrd_block,
    350     int enable);
    351 
    352 /**
    353  * \brief
    354  *   Power up/down a FSRD block.
    355  * \param [in] unit -
    356  *   The unit number.
    357  * \param [in] logical_port -
    358  *   The port which its FSRD block should be enabled.
    359  * \param [in] enable -
    360  *   1:enable, 0:disable
    361  * \return
    362  *   See \ref shr_error_e
    363  * \remark
    364  *   None
    365  * \see
    366  *   None.
    367  */
    368 shr_error_e dnx_fabric_if_port_fsrd_block_enable_set(
    369     int unit,
    370     bcm_port_t logical_port,
    371     int enable);
    372 
    373 /**
    374  * \brief
    375  *   Initialize all FSRD blocks power .
    376  * \param [in] unit -
    377  *   The unit number.
    378  * \return
    379  *   See \ref shr_error_e
    380  * \remark
    381  *   None
    382  * \see
    383  *   None.
    384  */
    385 shr_error_e dnx_fabric_if_fsrd_blocks_power_init(
    386     int unit);
    387 
    388 /**
    389  * \brief
    390  *   Get a bitmap of all supported FSRDs.
    391  * \param [in] unit -
    392  *   The unit number.
    393  * \param [out] supported_fsrds -
    394  *   A bitmap of the supported FSRDs.
    395  * \return
    396  *   See \ref shr_error_e
    397  * \remark
    398  *   None
    399  * \see
    400  *   None.
    401  */
    402 shr_error_e dnx_fabric_if_supported_fsrd_get(
    403     int unit,
    404     bcm_pbmp_t * supported_fsrds);
    405 
    406 /**
    407  * \brief
    408  *   Get whether a FMAC block is enabled.
    409  * \param [in] unit -
    410  *   The unit number.
    411  * \param [in] fmac_block -
    412  *   The FMAC block index.
    413  * \param [out] enable -
    414  *   1 - FMAC block is enabled.
    415  *   0 - FMAC block is disabled.
    416  * \return
    417  *   See \ref shr_error_e
    418  * \remark
    419  *   None
    420  * \see
    421  *   None.
    422  */
    423 shr_error_e dnx_fabric_if_fmac_block_enable_get(
    424     int unit,
    425     int fmac_block,
    426     int *enable);
    427 
    428 /**
    429  * \brief
    430  *   Set fabric force
    431  * \param [in] unit -
    432  *   The unit number.
    433  * \param [in] force -
    434  *   Force type.
    435  * \return
    436  *   See \ref shr_error_e
    437  * \remark
    438  *   * None.
    439  * \see
    440  *   * None.
    441  */
    442 shr_error_e dnx_fabric_force_set(
    443     int unit,
    444     dnx_fabric_force_e force);
    445 
    446 /**
    447  * \brief
    448  *   Initialize fabric force tdm to default values according to device
    449  *   mode.
    450  * \param [in] unit -
    451  *   The unit number.
    452  * \return
    453  *   See \ref shr_error_e
    454  * \remark
    455  *   * Called as part of init sequence.
    456  * \see
    457  *   * None.
    458  */
    459 shr_error_e dnx_fabric_force_tdm_init(
    460     int unit);
    461 
    462 #endif /*_DNX_FABRIC_IF_H_INCLUDED_*/