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

tcam_defrag.h (3216B)


      1 /**
      2 * \file        tcam_defrag.h
      3 *
      4 * DESCRIPTION :
      5 *       This file represents the defragment component. It exposes
      6 *       funcionality which allows the user to order and organize
      7 *       the TCAM banks in order to make room for other entries to add.
      8 *
      9 *
     10 * PUBLIC FUNCTIONS (dnx_field_tcam omitted):
     11 *       shr_error_e    defrag( unit, db, priority )
     12 *       shr_error_e    defrag_mode( unit, db, priority, mode )
     13 */
     14 /**
     15  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
     16  * 
     17  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
     18  */
     19 
     20 #ifndef TCAM_DEFRAG_H_INCLUDED
     21 /** { */
     22 #define TCAM_DEFRAG_H_INCLUDED
     23 
     24 #include <bcm_int/dnx/field/tcam/tcam_location_manager.h>
     25 
     26 /**
     27  * Default defrag mode
     28  */
     29 #define DNX_FIELD_TCAM_DEFRAG_MODE_DEFAULT 0
     30 
     31 /**
     32  * \brief
     33  *  Calls "defrag_mode(handler_id, location, 0)" which is the default mode for defrag.
     34  *
     35  * \param [in] unit       - Device ID
     36  * \param [in] core       - Core ID
     37  * \param [in] handler_id - The handler ID associated with this location
     38  * \param [in] location   - The location to make room for
     39  *
     40  * \return
     41  *  \retval _SHR_E_NONE - success
     42  */
     43 shr_error_e dnx_field_tcam_defrag(
     44     int unit,
     45     int core,
     46     uint32 handler_id,
     47     dnx_field_tcam_location_t * location);
     48 
     49 /**
     50  * \brief
     51  *  Makes room for the given location, according to the mode specified
     52  *
     53  * \param [in] unit       - Device ID
     54  * \param [in] core       - Core ID
     55  * \param [in] handler_id - The handler ID associated with this location
     56  * \param [in] location   - The location to make room for
     57  * \param [in] mode       - The mode of the defrag
     58  *
     59  * \return
     60  *  \retval _SHR_E_NONE - success
     61  */
     62 shr_error_e dnx_field_tcam_defrag_mode(
     63     int unit,
     64     int core,
     65     uint32 handler_id,
     66     dnx_field_tcam_location_t * location,
     67     int mode);
     68 
     69 /**
     70  * \brief
     71  * Evacuates the given handler_id from the given bank_id on all cores.
     72  * The evacuation process involves moving all handler's entries on the
     73  * given bank to other banks allocated by the same handler.
     74  * If the evacuation process succeeds, the handler is removed from the bank (therefore,
     75  * helping to remove constraints for other handlers to use the evacuated bank).
     76  *
     77  * This function starts moving entries to other banks allocated by the given handler
     78  * until either all handler's entries on the bank are moved to other banks, or no
     79  * more empty space is left in the other banks allocated by the given handler.
     80  * In case no empty space is left, all the entries that were moved until this point stay
     81  * as-is and the function fails.
     82  *
     83  * \param[in] unit       - Device ID
     84  * \param[in] handler_id - Handler ID to move its entries from given bank
     85  * \param[in] nof_banks  - Number of banks to evacuate
     86  * \param[in] bank_ids   - Array of bank IDs to evacuate
     87  *
     88  * \return
     89  *  \retval _SHR_E_NONE     - Success
     90  *  \retval _SHR_E_FAIL     - No more space left to move entries to
     91  *  \retval _SHR_E_INTERNAL - Something wrong happened with the algorithm (sanity checks failure)
     92  */
     93 shr_error_e dnx_field_tcam_defrag_bank_evacuate(
     94     int unit,
     95     uint32 handler_id,
     96     int nof_banks,
     97     int bank_ids[]);
     98 
     99 /** } */
    100 #endif