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

trunk.h (9525B)


      1 /** \file bcm_int/dnx/trunk/trunk.h
      2  * 
      3  * Internal DNX TRUNK  APIs to be used from other modules 
      4  */
      5 
      6 /*
      7  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      8  * 
      9  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
     10  */
     11 
     12 #ifndef _BCMINT_DNX_TRUNK_TRUNK_H_INCLUDED
     13 /*
     14  * { 
     15  */
     16 #define _BCMINT_DNX_TRUNK_TRUNK_H_INCLUDED
     17 
     18 /**
     19  * \brief This file is only used by DNX (JR2 family). Including it by
     20  * software that is not specific to DNX is an error.
     21  */
     22 #ifndef BCM_DNX_SUPPORT
     23 #error "This file is for use by DNX (JR2) family only!"
     24 #endif
     25 
     26 #include <shared/shrextend/shrextend_debug.h>
     27 #include <bcm/trunk.h>
     28 
     29 typedef struct dnx_trunk_unique_member_s
     30 {
     31     uint32 system_port;
     32     int nof_replications;
     33     int is_enabled;
     34 } dnx_trunk_unique_member_t;
     35 
     36 /** prototype of trunk update CB function */
     37 typedef shr_error_e(
     38     *dnx_trunk_update_cb) (
     39     int unit,
     40     bcm_trunk_t trunk_id,
     41     uint32 core,
     42     uint32 tm_port);
     43 
     44 /** struct definition that contains the different CBs that are called when an action is performed. */
     45 typedef struct dnx_trunk_feature_update_s
     46 {
     47     /** CB that is called when creating a trunk */
     48     dnx_trunk_update_cb create_cb;
     49     /** CB that is called when destroying a trunk */
     50     dnx_trunk_update_cb destroy_cb;
     51     /** CB that is called when adding a member to a trunk */
     52     dnx_trunk_update_cb add_cb;
     53     /** CB that is called when deleting a member from a trunk */
     54     dnx_trunk_update_cb delete_cb;
     55 } dnx_trunk_feature_update_t;
     56 
     57 /** enum to represent the actions in the struct dnx_trunk_feature_update_t above */
     58 typedef enum
     59 {
     60     DNX_TRUNK_FEATURE_UPDATE_CB_CREATE,
     61     DNX_TRUNK_FEATURE_UPDATE_CB_DESTROY,
     62     DNX_TRUNK_FEATURE_UPDATE_CB_ADD,
     63     DNX_TRUNK_FEATURE_UPDATE_CB_DELETE,
     64 } dnx_trunk_feature_update_cb_types_e;
     65 
     66 /**
     67  * \brief - create an egress trunk
     68  * 
     69  * \param [in] unit - unit number
     70  * \param [in] trunk_id - trunk id for which to create an egress 
     71  *        trunk
     72  * \param [in] egress_trunk_id - returned egress trunk that was 
     73  *        created
     74  *   
     75  * \return
     76  *   shr_error_e 
     77  *   
     78  * \remark
     79  *   * None
     80  * \see
     81  *   * None
     82  */
     83 shr_error_e dnx_trunk_egress_create(
     84     int unit,
     85     bcm_trunk_t trunk_id,
     86     int *egress_trunk_id);
     87 
     88 /**
     89  * \brief - destroy an egress trunk profile
     90  * 
     91  * \param [in] unit - unit number
     92  * \param [in] trunk_id - trunk id whose profile to destroy
     93  *   
     94  * \return
     95  *   shr_error_e 
     96  *   
     97  * \remark
     98  *   * None
     99  * \see
    100  *   * None
    101  */
    102 shr_error_e dnx_trunk_egress_destroy(
    103     int unit,
    104     bcm_trunk_t trunk_id);
    105 
    106 /**
    107  * \brief - get the trunk id coresponding to the egress trunk id 
    108  *        received
    109  * 
    110  * \param [in] unit - unit number
    111  * \param [in] egress_trunk_id - source egress_trunk_id. find 
    112  *        the trunk ID coresponding to this egress trunk ID
    113  * \param [in] trunk_id - returned trunk id
    114  *   
    115  * \return
    116  *   shr_error_e 
    117  *   
    118  * \remark
    119  *   * None
    120  * \see
    121  *   * None
    122  */
    123 shr_error_e dnx_trunk_containing_egress_trunk_get(
    124     int unit,
    125     int egress_trunk_id,
    126     bcm_trunk_t * trunk_id);
    127 
    128 /**
    129  * \brief - get a trunk's pp port according to core
    130  * 
    131  * \param [in] unit - unit nubmer
    132  * \param [in] trunk_id - trunk id
    133  * \param [in] core - core index
    134  * \param [in] pp_port - returned pp port
    135  *   
    136  * \return
    137  *   shr_error_e 
    138  *   
    139  * \remark
    140  *   * None
    141  * \see
    142  *   * None
    143  */
    144 shr_error_e dnx_trunk_pp_port_get(
    145     int unit,
    146     bcm_trunk_t trunk_id,
    147     int core,
    148     uint32 *pp_port);
    149 
    150 /**
    151  * \brief - get local ports bitmap with trunk's members for 
    152  *        given core
    153  * 
    154  * \param [in] unit - unit number
    155  * \param [in] trunk_id - trunk id
    156  * \param [in] core - core index
    157  * \param [out] local_port_bmp - result local port bit map
    158  *   
    159  * \return
    160  *   shr_error_e 
    161  *   
    162  * \remark
    163  *   * None
    164  * \see
    165  *   * None
    166  */
    167 shr_error_e dnx_trunk_local_port_bmp_get(
    168     int unit,
    169     bcm_trunk_t trunk_id,
    170     int core,
    171     bcm_pbmp_t * local_port_bmp);
    172 
    173 /**
    174  * \brief - when working in graceful lag modification mode, this 
    175  *        function flips between configurations.
    176  * 
    177  * \param [in] unit - unit nubmer
    178  *   
    179  * \return
    180  *   shr_error_e 
    181  *   
    182  * \remark
    183  *   * None
    184  * \see
    185  *   * None
    186  */
    187 shr_error_e dnx_trunk_flip_active_configuration_selector(
    188     int unit);
    189 
    190 /**
    191  * \brief - when working with graceful lag modification mode, 
    192  *        this function copies the active configuration to the
    193  *        standby configuration
    194  * 
    195  * \param [in] unit - unit nubmer
    196  *   
    197  * \return
    198  *   shr_error_e 
    199  *   
    200  * \remark
    201  *   * None
    202  * \see
    203  *   * None
    204  */
    205 shr_error_e dnx_trunk_active_configuration_to_stand_by_configuration_copy(
    206     int unit);
    207 
    208 /**
    209  * \brief - Function to check whether a system port is spa or just a physical system port.
    210  *
    211  * \param [in] unit - unit number
    212  * \param [in] system_port - system port to check.
    213  * \param [out] is_spa - will be filled with boolean indication of the system port
    214  *                          being a SPA
    215  *
    216  * \return
    217  *   shr_error_e
    218  *
    219  * \remark
    220  *   * None
    221  * \see
    222  *   * None
    223  */
    224 shr_error_e dnx_trunk_system_port_is_spa(
    225     int unit,
    226     int system_port,
    227     int *is_spa);
    228 
    229 /**
    230  * \brief - function to return the system port aggregate id from trunk gport
    231  *
    232  * \param [in] unit - unit number
    233  * \param [in] trunk_gport - trunk gport
    234  * \param [in] member - trunk member
    235  * \param [out] spa - pointer for result spa
    236  *
    237  * \return
    238  *   shr_error_e
    239  *
    240  * \remark
    241  *   * None
    242  * \see
    243  *   * None
    244  */
    245 shr_error_e dnx_trunk_gport_to_spa(
    246     int unit,
    247     bcm_gport_t trunk_gport,
    248     int member,
    249     uint32 *spa);
    250 
    251 /**
    252  * \brief - function to return the trunk gport id from system port aggregate
    253  *
    254  * \param [in] unit - unit number
    255  * \param [in] spa - spa, the system port aggregate
    256  * \param [out] member - trunk member (not available in gport)
    257  * \param [out] trunk_gport - pointer for result trunk gport
    258  *
    259  * \return
    260  *   shr_error_e
    261  *
    262  * \remark
    263  *   * None
    264  * \see
    265  *   * None
    266  */
    267 shr_error_e dnx_trunk_spa_to_gport(
    268     int unit,
    269     uint32 spa,
    270     int *member,
    271     bcm_gport_t * trunk_gport);
    272 
    273 /**
    274  * \brief - mask the member part of given SPA (remaining parts are the pool and the group)
    275  *
    276  * \param [in] unit - unit number
    277  * \param [in] spa - spa
    278  * \param [out] spa_with_masked_member - spa with masked member
    279  *
    280  * \return
    281  *   shr_error_e
    282  *
    283  * \remark
    284  *   * None
    285  * \see
    286  *   * None
    287  */
    288 shr_error_e dnx_trunk_spa_member_mask(
    289     int unit,
    290     uint32 spa,
    291     uint32 *spa_with_masked_member);
    292 
    293 /**
    294  * \brief - function to return the trunk gport id from system port aggregate
    295  *
    296  * \param [in] unit - unit number
    297  * \param [in] spa_id - spa_id, the system port aggregate id is defined as spa
    298  *                       without the bit responsible for defining the system port as spa.
    299  * \param [out] member - trunk member (not available in gport)
    300  * \param [out] trunk_gport - pointer for result trunk gport
    301  *
    302  * \return
    303  *   shr_error_e
    304  *
    305  * \remark
    306  *   * None
    307  * \see
    308  *   * None
    309  */
    310 shr_error_e dnx_trunk_spa_id_to_gport(
    311     int unit,
    312     uint32 spa_id,
    313     int *member,
    314     bcm_gport_t * trunk_gport);
    315 
    316 /**
    317  * \brief - get from trunk's SW DB the header types configured to it
    318  *
    319  * \param [in] unit - unit number
    320  * \param [in] trunk_id - trunk id
    321  * \param [out] in_header_type - in direction header type
    322  * \param [out] out_header_type -  out direction header type
    323  *
    324  * \return
    325  *   shr_error_e
    326  *
    327  * \remark
    328  *   * None
    329  * \see
    330  *   * None
    331  */
    332 shr_error_e dnx_trunk_header_types_get(
    333     int unit,
    334     bcm_trunk_t trunk_id,
    335     uint32 *in_header_type,
    336     uint32 *out_header_type);
    337 
    338 /**
    339  * \brief - set to trunk SW DB its header types
    340  *
    341  * \param [in] unit - unit number
    342  * \param [in] trunk_id - trunk id
    343  * \param [in] in_header_type - in direction header type
    344  * \param [in] out_header_type -  out direction header type
    345  *
    346  * \return
    347  *   shr_error_e
    348  *
    349  * \remark
    350  *   * None
    351  * \see
    352  *   * None
    353  */
    354 shr_error_e dnx_trunk_header_types_set(
    355     int unit,
    356     bcm_trunk_t trunk_id,
    357     uint32 in_header_type,
    358     uint32 out_header_type);
    359 
    360 /**
    361  * \brief - check if trunk group is used
    362  *
    363  * \param [in] unit - unit number
    364  * \param [in] pool - pool id
    365  * \param [in] group - group id
    366  * \param [out] is_used -  returned indication if trunk group is used.
    367  *
    368  * \return
    369  *   shr_error_e
    370  *
    371  * \remark
    372  *   * None
    373  * \see
    374  *   * None
    375  */
    376 shr_error_e dnx_trunk_is_used_get(
    377     int unit,
    378     uint32 pool,
    379     uint32 group,
    380     int *is_used);
    381 
    382 /**
    383  * \brief - get an entry from trunk system port sw db
    384  * 
    385  * \param [in] unit - unit number
    386  * \param [in] system_port - (valid) system port
    387  * \param [in] trunk_id - ptr to returned trunk ID
    388  * \param [in] flags - ptr to returned flags
    389  *   
    390  * \return
    391  *   shr_error_e 
    392  *   
    393  * \remark
    394  *   * None
    395  * \see
    396  *   * None
    397  */
    398 shr_error_e dnx_trunk_sw_db_trunk_system_port_db_get(
    399     int unit,
    400     uint32 system_port,
    401     bcm_trunk_t * trunk_id,
    402     uint32 *flags);
    403 
    404 /**
    405  * \brief - Get the lsb and msb bits of the trunk members from trunk spa
    406  *
    407  * \param [in] unit - unit number
    408  * \param [in] spa - system port aggegrate
    409  * \param [in] members_lsb - least significant bit of trunk members bits encoded in spa
    410  * \param [in] members_msb - most significant bit of trunk members bits encoded in spa
    411  *
    412  * \return
    413  *   shr_error_e
    414  *
    415  * \remark
    416  *   * None
    417  * \see
    418  *   * None
    419  */
    420 shr_error_e dnx_trunk_utils_members_bits_get(
    421     int unit,
    422     uint32 spa,
    423     uint32 *members_lsb,
    424     uint32 *members_msb);
    425 /*
    426  * }
    427  */
    428 #endif /* _BCMINT_DNX_TRUNK_TRUNK_H_INCLUDED */