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

idxres_mdb.h (22595B)


      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-2019 Broadcom Inc. All rights reserved.
      6  *
      7  * Module: Aligned Indexed Resource Multilist management, using banked lists
      8  */
      9 
     10 #ifndef _SHARED_IDXRES_MDB_H_INCLUDED
     11 #define _SHARED_IDXRES_MDB_H_INCLUDED
     12 
     13 typedef uint32 shr_mdb_elem_index_t;
     14 typedef uint16 shr_mdb_elem_bank_index_t;
     15 typedef uint16 shr_mdb_bank_index_t;
     16 
     17 /*
     18  *  This defines the type that is used as a handle for an mdb object.
     19  */
     20 struct shr_mdb_list_s;
     21 typedef struct shr_mdb_list_s *shr_mdb_list_handle_t;
     22 
     23 /*
     24  *  When querying information about a block within an mdb object, this
     25  *  structure is used for results.
     26  *
     27  *  head is the actual head element of the block.
     28  *
     29  *  size is the number of elements in the block.
     30  *
     31  *  list indicates the list to which the block belongs, or any number 0xFFF0 or
     32  *  higher indicates it is not in a list.
     33  */
     34 typedef struct shr_mdb_block_info_s {
     35     shr_mdb_elem_index_t head;
     36     shr_mdb_elem_bank_index_t size;
     37     shr_mdb_elem_bank_index_t list;
     38 } shr_mdb_block_info_t;
     39 
     40 /*
     41  *  When querying information about a list within an mdb object, this structure
     42  *  is used for results.
     43  *
     44  *  block_size only applies to free lists, and specifies the size in elements
     45  *  of blocks on that list.  User lists do not have a 'block size' (so the
     46  *  field is zero) since they can have any size blocks.
     47  *
     48  *  blocks indicates how many blocks are on the list.
     49  *
     50  *  elements indicates how many elements are on the list.
     51  */
     52 typedef struct shr_mdb_list_info_s {
     53     shr_mdb_elem_bank_index_t block_size;
     54     shr_mdb_elem_index_t      blocks;
     55     shr_mdb_elem_index_t      elements;
     56 } shr_mdb_list_info_t;
     57 
     58 /*
     59  *  When querying information about the a whole mdb object, this structure is
     60  *  used for results.
     61  *
     62  *  free_elems and free blocks indicate the overall quantity and makeup of the
     63  *  free space in the list.  The free lists may themselves be queried for
     64  *  further information.
     65  *
     66  *  first and last are the first valid and last valid element numbers.
     67  *
     68  *  bank_size indicates how many elements are in a complete bank.  It is
     69  *  possible that the final bank might be incomplete.
     70  *
     71  *  free_lists indicates how many free lists there are.
     72  *
     73  *  user_lists indicates how many user lists there are.
     74  *
     75  *  lock indicates whether the mdb object protects itself.
     76  */
     77 typedef struct shr_mdb_info_s {
     78     shr_mdb_elem_index_t      free_elems;
     79     shr_mdb_elem_index_t      free_blocks;
     80     shr_mdb_elem_index_t      first;
     81     shr_mdb_elem_index_t      last;
     82     shr_mdb_elem_bank_index_t bank_size;
     83     shr_mdb_elem_bank_index_t free_lists;
     84     shr_mdb_elem_bank_index_t user_lists;
     85     int                       lock;
     86 } shr_mdb_info_t;
     87 
     88 /*
     89  *  This defines the bitmap that is used to control allocation and freeing
     90  *  behaviour of an mdb object.  Note that there are several bitfields here,
     91  *  not just a few bits or a set of values, and that the setting is specific to
     92  *  a single mdb object (many can exist with different settings).
     93  *
     94  *  The alloc_bank set chooses the initial mechanism used to find the free
     95  *  space as the first part of the alloc process.  The 'first' setting does not
     96  *  mean 'low numbers', it basically means pick the space of the appropriate
     97  *  size which is fastest to locate, and is the fastest mechanism, plus it has
     98  *  the best cache use in case of high-speed thrashing that can fall within a
     99  *  single bank.  The 'high' setting means search for space from the highest
    100  *  bank toward the lowest; the 'low' setting means search for space from the
    101  *  lowest bank toward the highest.  Both of these settings are much slower but
    102  *  can be helpful if trying to collect allocated blocks toward one end of the
    103  *  space.  Only pick one from this set of options.
    104  *
    105  *  The alloc_block setting chooses whether to bias an alloc block toward the
    106  *  high end or low end of a free block that is too large (which it will be
    107  *  unless the alloc block is exactly one of the free lists sizes, and it may
    108  *  still be in that case if there were no exact size free blocks).  This
    109  *  setting takes effect AFTER the alloc join setting.  Only pick one from this
    110  *  set of options.
    111  *
    112  *  The free_block setting chooses whether to bias a freed block that is not an
    113  *  exact number of elements for any free list so that the largest block is on
    114  *  the high or low end of the block.  This setting takes effect AFTER the free
    115  *  join setting.  Only pick one from this set of options.
    116  *
    117  *  The join_alloc and join_free options indicate whether adjacent free blocks
    118  *  are combined on alloc and free.  If neither is chosen, free is assumed.
    119  *  Selecting free tends to coalesce larger free blocks, making larger alloc
    120  *  requests possible (can't alloc a block that is bigger than the largest free
    121  *  block); selecting alloc tends to reduce free space fragmentation (by
    122  *  coalescing the allocated blocks in a given bank); selecting both gains both
    123  *  features, at a slight performance cost compared to only one or the other.
    124  *
    125  *  The join directions indicate which direction will be searched for adjacent
    126  *  free blocks when joining.  It should be reasonably efficient to allow both
    127  *  directions.  If neither is chosen, high is assumed.
    128  */
    129 typedef enum shr_mdb_alloc_pref_e {
    130     /* alloc mechanism */
    131     shr_mdb_alloc_bank_first =     0x0000,
    132     shr_mdb_alloc_bank_high =      0x0001,
    133     shr_mdb_alloc_bank_low =       0x0002,
    134     shr_mdb_alloc_bank_reserved =  0x0003,
    135     shr_mdb_alloc_bank_mask =      0x0003,
    136     /* where to place new alloc block in the found space */
    137     shr_mdb_alloc_block_high =     0x0004,
    138     shr_mdb_alloc_block_low =      0x0000,
    139     /* where to place largest subblock when freeing */
    140     shr_mdb_free_block_high =      0x0008,
    141     shr_mdb_free_block_low =       0x0000,
    142     /* whether to join adjacent free spaces on alloc or free */
    143     shr_mdb_join_alloc =           0x0010,
    144     shr_mdb_join_free =            0x0020,
    145     shr_mdb_join_alloc_and_free =  0x0030,
    146     /* join directions */
    147     shr_mdb_join_high =            0x0040,
    148     shr_mdb_join_low =             0x0080,
    149     shr_mdb_join_high_and_low =    0x00C0
    150 } shr_mdb_alloc_pref_t;
    151 
    152 /*
    153  *  Function
    154  *    shr_mdb_create
    155  *
    156  *  Purpose
    157  *    Create an mdb type indexed resource management object, given the
    158  *    specified parameters for the object.
    159  *
    160  *    Elements per bank will be rounded up to the next integral power of two,
    161  *    and that must be <=32768.
    162  *
    163  *    A free list of block size = 1 is obligatory (and implied); additional
    164  *    free lists (as specified by freeLists) have their block sizes given in an
    165  *    array pointed to by freeCnts.
    166  *
    167  *    FreeCnts entries must be in strictly increasing order, and the largest
    168  *    must be less than or equal to bankSize.  The largest freeCnts entry will
    169  *    be the largest block that can be allocated, so at least one freeCnts
    170  *    entry must be greater than or equal to the largest block you will need.
    171  *    Ideally, freeCnts entries will tend to be the most commonly used block
    172  *    sizes, plus possibly some larger block sizes for more efficient
    173  *    management of free space.
    174  *
    175  *    UserLists specifies the number of user lists that will be included.
    176  *    These allow in-place use of the existing management memory to track lists
    177  *    of blocks for whatever purpose is necessary, and allow any size block,
    178  *    but these lists will be unsorted and unordered.
    179  *
    180  *  Arguments
    181  *    (out) shr_mdb_list_handle_t *handle = where to put the handle
    182  *    (in) shr_mdb_elem_bank_index_t bankSize = elements per bank
    183  *    (in) shr_mdb_elem_bank_index_t freeLists = number of additional free lists
    184  *    (in) shr_mdb_elem_bank_index_t *freeCnts = free lists elements per block
    185  *    (in) shr_mdb_elem_bank_index_t userLists = number of user lists
    186  *    (in) shr_mdb_elem_index_t first = lowest element number to manage
    187  *    (in) shr_mdb_elem_index_t last = highest element number to manage
    188  *    (in) int lock = TRUE if should be a lock; FALSE if caller will protect
    189  *
    190  *  Return
    191  *    bcm_error_t cast as int
    192  *      BCM_E_NONE if successful
    193  *      BCM_E_* otherwise as appropriate
    194  *
    195  *  Notes
    196  *    none
    197  */
    198 extern int
    199 shr_mdb_create(shr_mdb_list_handle_t *handle,
    200                shr_mdb_elem_bank_index_t bankSize,
    201                shr_mdb_elem_bank_index_t freeLists,
    202                shr_mdb_elem_bank_index_t *freeCnts,
    203                shr_mdb_elem_bank_index_t userLists,
    204                shr_mdb_elem_index_t first,
    205                shr_mdb_elem_index_t last,
    206                int lock);
    207 
    208 /*
    209  *  Function
    210  *    shr_mdb_destroy
    211  *
    212  *  Purpose
    213  *    Destroy and mdb type indexed resource management object, given the object
    214  *    handle.
    215  *
    216  *  Arguments
    217  *    (in) shr_mdb_list_handle_t handle = the handle
    218  *
    219  *  Return
    220  *    bcm_error_t cast as int
    221  *      BCM_E_NONE if successful
    222  *      BCM_E_* otherwise as appropriate
    223  *
    224  *  Notes
    225  *    none
    226  */
    227 extern int
    228 shr_mdb_destroy(shr_mdb_list_handle_t handle);
    229 
    230 /*
    231  *  Function
    232  *    shr_mdb_reserve
    233  *
    234  *  Purpose
    235  *    Resevere elements directly.
    236  *
    237  *  Arguments
    238  *    (in) shr_mdb_list_handle_t handle = the handle
    239  *    (in) shr_mdb_elem_index_t first = the first element to reserve
    240  *    (in) shr_mdb_elem_index_t last = the last element to reserve
    241  *
    242  *  Return
    243  *    bcm_error_t cast as int
    244  *      BCM_E_NONE if successful
    245  *      BCM_E_* otherwise as appropriate
    246  *
    247  *  Notes
    248  *    Elements to be reserved must be free, else the call will fail.
    249  */
    250 extern int
    251 shr_mdb_reserve(shr_mdb_list_handle_t handle,
    252                 shr_mdb_elem_index_t first,
    253                 shr_mdb_elem_index_t last);
    254 
    255 /*
    256  *  Function
    257  *    shr_mdb_unreserve
    258  *
    259  *  Purpose
    260  *    Unresevere elements directly.
    261  *
    262  *  Arguments
    263  *    (in) shr_mdb_list_handle_t handle = the handle
    264  *    (in) shr_mdb_elem_index_t first = the first element to unreserve
    265  *    (in) shr_mdb_elem_index_t last = the last element to unreserve
    266  *
    267  *  Return
    268  *    bcm_error_t cast as int
    269  *      BCM_E_NONE if successful
    270  *      BCM_E_* otherwise as appropriate
    271  *
    272  *  Notes
    273  *    Elements to be unreserved must be singly allocated, else it will fail.
    274  */
    275 extern int
    276 shr_mdb_unreserve(shr_mdb_list_handle_t handle,
    277                   shr_mdb_elem_index_t first,
    278                   shr_mdb_elem_index_t last);
    279 
    280 /*
    281  *  Function
    282  *    shr_mdb_reserve_to_block
    283  *
    284  *  Purpose
    285  *    Convert a set of reserved elements to a usable block.  This is meant to
    286  *    be used in case a reserved range must be converted into a standard block,
    287  *    and it must be done so in-place.
    288  *
    289  *  Arguments
    290  *    (in) shr_mdb_list_handle_t handle = the handle
    291  *    (in) shr_mdb_elem_index_t first = the first element to convert
    292  *    (in) shr_mdb_elem_index_t last = the last element to convert
    293  *
    294  *  Return
    295  *    bcm_error_t cast as int
    296  *      BCM_E_NONE if successful
    297  *      BCM_E_* otherwise as appropriate
    298  *
    299  *  Notes
    300  *    Elements must be singly allocated, else it will fail.
    301  *    The resulting block's head will be at first if this is successful.
    302  */
    303 int
    304 shr_mdb_reserve_to_block(shr_mdb_list_handle_t handle,
    305                          shr_mdb_elem_index_t first,
    306                          shr_mdb_elem_index_t last);
    307 
    308 /*
    309  *  Function
    310  *    shr_mdb_alloc
    311  *
    312  *  Purpose
    313  *    Allocate a block of elements.
    314  *
    315  *  Arguments
    316  *    (in) shr_mdb_list_handle_t handle = the handle
    317  *    (out) shr_mdb_elem_index_t *block = where to put the block
    318  *    (in) shr_mdb_elem_bank_index_t count = number of elements
    319  *
    320  *  Return
    321  *    bcm_error_t cast as int
    322  *      BCM_E_NONE if successful
    323  *      BCM_E_* otherwise as appropriate
    324  *
    325  *  Notes
    326  *    none
    327  */
    328 extern int
    329 shr_mdb_alloc(shr_mdb_list_handle_t handle,
    330               shr_mdb_elem_index_t *block,
    331               shr_mdb_elem_bank_index_t count);
    332 
    333 /*
    334  *  Function
    335  *    shr_mdb_alloc_id
    336  *
    337  *  Purpose
    338  *    Allocate a specific block of elements.
    339  *
    340  *  Arguments
    341  *    (in) shr_mdb_list_handle_t handle = the handle
    342  *    (in) shr_mdb_elem_index_t block = the block
    343  *    (in) shr_mdb_elem_bank_index_t count = number of elements
    344  *
    345  *  Return
    346  *    bcm_error_t cast as int
    347  *      BCM_E_NONE if successful
    348  *      BCM_E_* otherwise as appropriate
    349  *
    350  *  Notes
    351  *    none
    352  */
    353 extern int
    354 shr_mdb_alloc_id(shr_mdb_list_handle_t handle,
    355                  shr_mdb_elem_index_t block,
    356                  shr_mdb_elem_bank_index_t count);
    357 
    358 /*
    359  *  Function
    360  *    shr_mdb_free
    361  *
    362  *  Purpose
    363  *    Free a block of elements.
    364  *
    365  *  Arguments
    366  *    (in) shr_mdb_list_handle_t handle = the handle
    367  *    (in) shr_mdb_elem_index_t block = the block
    368  *
    369  *  Return
    370  *    bcm_error_t cast as int
    371  *      BCM_E_NONE if successful
    372  *      BCM_E_* otherwise as appropriate
    373  *
    374  *  Notes
    375  *    none
    376  */
    377 extern int
    378 shr_mdb_free(shr_mdb_list_handle_t handle,
    379              shr_mdb_elem_index_t block);
    380 
    381 /*
    382  *  Function
    383  *    shr_mdb_block_size_get
    384  *
    385  *  Purpose
    386  *    Get the number of elements in a particular block.
    387  *
    388  *  Arguments
    389  *    (in) shr_mdb_list_handle_t handle = the handle
    390  *    (in) shr_mdb_elem_index_t *block = the block to check
    391  *    (out) shr_mdb_elem_bank_index_t *count = where to put the count
    392  *
    393  *  Return
    394  *    bcm_error_t cast as int
    395  *      BCM_E_NONE if successful
    396  *      BCM_E_* otherwise as appropriate
    397  *
    398  *  Notes
    399  *    none
    400  */
    401 extern int
    402 shr_mdb_block_size_get(shr_mdb_list_handle_t handle,
    403                        shr_mdb_elem_index_t block,
    404                        shr_mdb_elem_bank_index_t *count);
    405 
    406 /*
    407  *  Function
    408  *    shr_mdb_list_insert
    409  *
    410  *  Purpose
    411  *    Insert a block of elements to a user list.
    412  *
    413  *  Arguments
    414  *    (in) shr_mdb_list_handle_t handle = the handle
    415  *    (in) shr_mdb_elem_bank_index_t list = the user list on which to insert
    416  *    (in) shr_mdb_elem_index_t block = the block
    417  *
    418  *  Return
    419  *    bcm_error_t cast as int
    420  *      BCM_E_NONE if successful
    421  *      BCM_E_* otherwise as appropriate
    422  *
    423  *  Notes
    424  *    none
    425  */
    426 extern int
    427 shr_mdb_list_insert(shr_mdb_list_handle_t handle,
    428                     shr_mdb_elem_bank_index_t list,
    429                     shr_mdb_elem_index_t block);
    430 
    431 /*
    432  *  Function
    433  *    shr_mdb_list_remove
    434  *
    435  *  Purpose
    436  *    Insert a block of elements to a user list.
    437  *
    438  *  Arguments
    439  *    (in) shr_mdb_list_handle_t handle = the handle
    440  *    (in) shr_mdb_elem_index_t block = the block
    441  *
    442  *  Return
    443  *    bcm_error_t cast as int
    444  *      BCM_E_NONE if successful
    445  *      BCM_E_* otherwise as appropriate
    446  *
    447  *  Notes
    448  *    none
    449  */
    450 extern int
    451 shr_mdb_list_remove(shr_mdb_list_handle_t handle,
    452                     shr_mdb_elem_index_t block);
    453 
    454 /*
    455  *  Function
    456  *    shr_mdb_list_get
    457  *
    458  *  Purpose
    459  *    Get the user list to which a block belongs.
    460  *
    461  *  Arguments
    462  *    (in) shr_mdb_list_handle_t handle = the handle
    463  *    (in) shr_mdb_elem_index_t *block = the block to check
    464  *    (out) shr_mdb_elem_bank_index_t *list = where to put the user list
    465  *
    466  *  Return
    467  *    bcm_error_t cast as int
    468  *      BCM_E_NONE if successful
    469  *      BCM_E_* otherwise as appropriate
    470  *
    471  *  Notes
    472  *    none
    473  */
    474 extern int
    475 shr_mdb_list_get(shr_mdb_list_handle_t handle,
    476                  shr_mdb_elem_index_t block,
    477                  shr_mdb_elem_bank_index_t *list);
    478 
    479 /*
    480  *  Function
    481  *    shr_mdb_list_head
    482  *
    483  *  Purpose
    484  *    Get the head block of a user list.
    485  *
    486  *  Arguments
    487  *    (in) shr_mdb_list_handle_t handle = the handle
    488  *    (in) shr_mdb_elem_bank_index_t list = the user list on which to insert
    489  *    (in) shr_mdb_elem_index_t *head = where to put the head
    490  *
    491  *  Return
    492  *    bcm_error_t cast as int
    493  *      BCM_E_NONE if successful
    494  *      BCM_E_* otherwise as appropriate
    495  *
    496  *  Notes
    497  *    none
    498  */
    499 extern int
    500 shr_mdb_list_head(shr_mdb_list_handle_t handle,
    501                   shr_mdb_elem_bank_index_t list,
    502                   shr_mdb_elem_index_t *head);
    503 
    504 
    505 /*
    506  *  Function
    507  *    shr_mdb_list_tail
    508  *
    509  *  Purpose
    510  *    Get the tail block of a user list.
    511  *
    512  *  Arguments
    513  *    (in) shr_mdb_list_handle_t handle = the handle
    514  *    (in) shr_mdb_elem_bank_index_t list = the user list on which to insert
    515  *    (in) shr_mdb_elem_index_t *tail = where to put the tail
    516  *
    517  *  Return
    518  *    bcm_error_t cast as int
    519  *      BCM_E_NONE if successful
    520  *      BCM_E_* otherwise as appropriate
    521  *
    522  *  Notes
    523  *    none
    524  */
    525 extern int
    526 shr_mdb_list_tail(shr_mdb_list_handle_t handle,
    527                   shr_mdb_elem_bank_index_t list,
    528                   shr_mdb_elem_index_t *tail);
    529 
    530 /*
    531  *  Function
    532  *    shr_mdb_list_pred
    533  *
    534  *  Purpose
    535  *    Get the predecessor of a block in its list.
    536  *
    537  *  Arguments
    538  *    (in) shr_mdb_list_handle_t handle = the handle
    539  *    (in) shr_mdb_elem_index_t block = the block
    540  *    (in) shr_mdb_elem_index_t *pred = where to put the predecessor
    541  *
    542  *  Return
    543  *    bcm_error_t cast as int
    544  *      BCM_E_NONE if successful
    545  *      BCM_E_* otherwise as appropriate
    546  *
    547  *  Notes
    548  *    none
    549  */
    550 extern int
    551 shr_mdb_list_pred(shr_mdb_list_handle_t handle,
    552                   shr_mdb_elem_index_t block,
    553                   shr_mdb_elem_index_t *pred);
    554 
    555 /*
    556  *  Function
    557  *    shr_mdb_list_succ
    558  *
    559  *  Purpose
    560  *    Get the successor of a block in its list.
    561  *
    562  *  Arguments
    563  *    (in) shr_mdb_list_handle_t handle = the handle
    564  *    (in) shr_mdb_elem_index_t block = the block
    565  *    (in) shr_mdb_elem_index_t *succ = where to put the successor
    566  *
    567  *  Return
    568  *    bcm_error_t cast as int
    569  *      BCM_E_NONE if successful
    570  *      BCM_E_* otherwise as appropriate
    571  *
    572  *  Notes
    573  *    none
    574  */
    575 extern int
    576 shr_mdb_list_succ(shr_mdb_list_handle_t handle,
    577                   shr_mdb_elem_index_t block,
    578                   shr_mdb_elem_index_t *succ);
    579 
    580 /*
    581  *  Function
    582  *    shr_mdb_list_purge
    583  *
    584  *  Purpose
    585  *    Free all blocks on the user list.
    586  *
    587  *  Arguments
    588  *    (in) shr_mdb_list_handle_t handle = the handle
    589  *    (in) shr_mdb_elem_bank_index_t list = the list to purge
    590  *
    591  *  Return
    592  *    bcm_error_t cast as int
    593  *      BCM_E_NONE if successful
    594  *      BCM_E_* otherwise as appropriate
    595  *
    596  *  Notes
    597  *    none
    598  */
    599 extern int
    600 shr_mdb_list_purge(shr_mdb_list_handle_t handle,
    601                    shr_mdb_elem_bank_index_t list);
    602 
    603 /*
    604  *  Function
    605  *    shr_mdb_block_info
    606  *
    607  *  Purpose
    608  *    Get information about a block
    609  *
    610  *  Arguments
    611  *    (in) shr_mdb_list_handle_t handle = the handle
    612  *    (in) shr_mdb_elem_index_t block = an element in the block
    613  *    (out) shr_mdb_block_info_t *blockInfo = ptr to where to put list info
    614  *
    615  *  Return
    616  *    bcm_error_t cast as int
    617  *      BCM_E_NONE if successful
    618  *      BCM_E_* otherwise as appropriate
    619  *
    620  *  Notes
    621  *    This only supports allocated blocks, not free blocks.
    622  */
    623 extern int
    624 shr_mdb_block_info(shr_mdb_list_handle_t handle,
    625                    shr_mdb_elem_index_t block,
    626                    shr_mdb_block_info_t *blockInfo);
    627 
    628 /*
    629  *  Function
    630  *    shr_mdb_block_check_all
    631  *
    632  *  Purpose
    633  *    Find out whether a group of elements is free, used by a single block,
    634  *    used by more than one block, or a combination of free and used.
    635  *
    636  *  Arguments
    637  *    (in) shr_mdb_list_handle_t handle = the handle
    638  *    (in) shr_mdb_elem_index_t first = first element to check
    639  *    (in) shr_mdb_elem_bank_index_t count = number of elements to check
    640  *
    641  *  Return
    642  *    bcm_error_t cast as int
    643  *      BCM_E_EMPTY if none of the elements are in use
    644  *      BCM_E_FULL if all of the elements are in use
    645  *      BCM_E_CONFIG if elements are in use but block(s) do not match
    646  *      BCM_E_EXISTS if some of the elements are in use but not all of them
    647  *      BCM_E_PARAM if any of the elements is not valid
    648  *      BCM_E_* otherwise as appropriate
    649  *
    650  *  Notes
    651  */
    652 extern int
    653 shr_mdb_block_check_all(shr_mdb_list_handle_t handle,
    654                         shr_mdb_elem_index_t first,
    655                         shr_mdb_elem_bank_index_t count);
    656 
    657 /*
    658  *  Function
    659  *    shr_mdb_list_info
    660  *
    661  *  Purpose
    662  *    Get information about a list (user or free)
    663  *
    664  *  Arguments
    665  *    (in) shr_mdb_list_handle_t handle = the handle
    666  *    (in) shr_mdb_elem_bank_index_t list = the list to check
    667  *    (in) int free = TRUE to query a free list, FALSE for a user list
    668  *    (out) shr_mdb_list_info_t *listInfo = ptr to where to put list info
    669  *
    670  *  Return
    671  *    bcm_error_t cast as int
    672  *      BCM_E_NONE if successful
    673  *      BCM_E_* otherwise as appropriate
    674  *
    675  *  Notes
    676  *    none
    677  */
    678 extern int
    679 shr_mdb_list_info(shr_mdb_list_handle_t handle,
    680                   shr_mdb_elem_bank_index_t list,
    681                   int free,
    682                   shr_mdb_list_info_t *listInfo);
    683 
    684 /*
    685  *  Function
    686  *    shr_mdb_info
    687  *
    688  *  Purpose
    689  *    Get information about an mdb object
    690  *
    691  *  Arguments
    692  *    (in) shr_mdb_list_handle_t handle = the handle
    693  *    (out) shr_mdb_list_info_t *mdbInfo = where to put mdb information
    694  *
    695  *  Return
    696  *    bcm_error_t cast as int
    697  *      BCM_E_NONE if successful
    698  *      BCM_E_* otherwise as appropriate
    699  *
    700  *  Notes
    701  *    none
    702  */
    703 extern int
    704 shr_mdb_info(shr_mdb_list_handle_t handle,
    705              shr_mdb_info_t *mdbInfo);
    706 
    707 /*
    708  *  Function
    709  *    shr_mdb_allocmode_get
    710  *
    711  *  Purpose
    712  *    Get an mdb object's current allocation mode
    713  *
    714  *  Arguments
    715  *    (in) shr_mdb_list_handle_t handle = the handle
    716  *    (out) shr_mdb_alloc_pref_t *allocmode = where to put alloc mode
    717  *
    718  *  Return
    719  *    bcm_error_t cast as int
    720  *      BCM_E_NONE if successful
    721  *      BCM_E_* otherwise as appropriate
    722  *
    723  *  Notes
    724  *    none
    725  */
    726 extern int
    727 shr_mdb_allocmode_get(shr_mdb_list_handle_t handle,
    728                       shr_mdb_alloc_pref_t *allocmode);
    729 
    730 /*
    731  *  Function
    732  *    shr_mdb_allocmode_set
    733  *
    734  *  Purpose
    735  *    Set an mdb object's current allocation mode
    736  *
    737  *  Arguments
    738  *    (in) shr_mdb_list_handle_t handle = the handle
    739  *    (in) shr_mdb_alloc_pref_t allocmode = new alloc mode
    740  *
    741  *  Return
    742  *    bcm_error_t cast as int
    743  *      BCM_E_NONE if successful
    744  *      BCM_E_* otherwise as appropriate
    745  *
    746  *  Notes
    747  *    none
    748  */
    749 extern int
    750 shr_mdb_allocmode_set(shr_mdb_list_handle_t handle,
    751                       shr_mdb_alloc_pref_t allocmode);
    752 
    753 /*
    754  *  Function
    755  *    shr_mdb_all_free_to_user_list
    756  *
    757  *  Purpose
    758  *    Collect all free blocks and place them on a specific user list
    759  *
    760  *  Arguments
    761  *    (in) shr_mdb_list_handle_t handle = the handle
    762  *    (in) shr_mdb_elem_bank_index_t list = the target user list
    763  *
    764  *  Return
    765  *    bcm_error_t cast as int
    766  *      BCM_E_NONE if successful
    767  *      BCM_E_* otherwise as appropriate
    768  *
    769  *  Notes
    770  *    none
    771  */
    772 extern int
    773 shr_mdb_all_free_to_user_list(shr_mdb_list_handle_t handle,
    774                               shr_mdb_elem_bank_index_t userList);
    775 
    776 #endif /* ndef _SHARED_IDXRES_MDB_H_INCLUDED */
    777