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

algo_ppmc.h (3338B)


      1 /**
      2  * \file algo_ppmc.h
      3  * Internal DNX PP Multicast Management APIs
      4  *
      5  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      6  * 
      7  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
      8  */
      9 
     10 #ifndef ALGO_PPMC_H_INCLUDED
     11 
     12 #define ALGO_PPMC_H_INCLUDED
     13 /*
     14  * Includes
     15  * {
     16  */
     17 #include <shared/shrextend/shrextend_debug.h>
     18 #include <soc/dnx/dnx_data/auto_generated/dnx_data_ppmc.h>
     19 
     20 /*
     21  * }
     22  */
     23 
     24 #ifndef BCM_DNX_SUPPORT
     25 #error "This file is for use by DNX (JR2) family only!"
     26 #endif
     27 
     28 /** Define the name of the PPMC resource */
     29 #define DNX_ALGO_PPMC "DNX_ALGO_PPMC"
     30 
     31 /** Verify if the mc_rep_id is in the valid range for MC replication indexes - between 0x300000 and 0x3BFFFF */
     32 #define DNX_ALGO_PPMC_IS_MC_REPLICATION_ID(unit, mc_rep_id) ((mc_rep_id) >= dnx_data_ppmc.param.min_mc_replication_id_get(unit)\
     33         && (mc_rep_id) <= dnx_data_ppmc.param.max_mc_replication_id_get(unit))
     34 
     35 /**
     36  * \brief
     37  *   Initialize the ppmc algorithms.
     38  * \param [in] unit - The unit number.
     39  * \return
     40  *   \retval Zero if no error was detected
     41  *   \retval Negative if error was detected. See \ref shr_error_e
     42  * \see
     43  *  * init_seq - ALGO
     44  */
     45 shr_error_e dnx_algo_ppmc_init(
     46     int unit);
     47 
     48 /**
     49  * \brief
     50  *  Allocate a PPMC key in the resource manager.
     51  * \param [in] unit - The unit number.
     52  * \param [in,out] mc_replication_id - The MC replication key of the entry
     53  * \param [in] flags - Control flags for the allocation:
     54  *      * DNX_FIELD_ACE_ENTRY_ADD_FLAG_WITH_ID - indicates that allocation will happen with a given ID in mc_replication_id
     55  * \return
     56  *   \retval Zero if no error was detected
     57  *   \retval Negative if error was detected. See \ref shr_error_e
     58  * \see
     59  *  * dnx_field_ace_entry_add
     60  *  * bcm_dnx_multicast_encap_extension_create
     61  */
     62 shr_error_e dnx_algo_ppmc_mc_replication_id_alloc(
     63     int unit,
     64     uint32 flags,
     65     int *mc_replication_id);
     66 
     67 /**
     68  * \brief
     69  *  Free a PPMC key from the resource manager.
     70  * \param [in] unit - The unit number.
     71  * \param [in] mc_replication_id - The MC replication key of the entry
     72  * \return
     73  *   \retval Zero if no error was detected
     74  *   \retval Negative if error was detected. See \ref shr_error_e
     75  * \see
     76  *  * dnx_field_ace_entry_delete
     77  *  * bcm_dnx_multicast_encap_extension_destroy
     78  */
     79 shr_error_e dnx_algo_ppmc_mc_replication_id_free(
     80     int unit,
     81     int mc_replication_id);
     82 
     83 /**
     84  * \brief
     85  *  Verify whether a PPMC key exists in the resource manager.
     86  * \param [in] unit - The unit number.
     87  * \param [in] mc_replication_id - The MC replication key of the entry
     88  * \param [out] is_allocated - Indication whether the key is allocated or not.
     89  * \return
     90  *   \retval Zero if no error was detected
     91  *   \retval Negative if error was detected. See \ref shr_error_e
     92  * \see
     93  *  * dnx_field_ace_entry_add_verify
     94  */
     95 shr_error_e dnx_algo_ppmc_mc_replication_id_is_allocated(
     96     int unit,
     97     int mc_replication_id,
     98     uint8 *is_allocated);
     99 
    100 /**
    101  * \brief
    102  *  Clear All PPMC keys from the resource manager.
    103  * \param [in] unit - The unit number.
    104  * \return
    105  *   \retval Zero if no error was detected
    106  *   \retval Negative if error was detected. See \ref shr_error_e
    107  * \see
    108  *  * dnx_field_ace_entry_add_verify
    109  */
    110 shr_error_e dnx_algo_ppmc_clear_all(
    111     int unit);
    112 
    113 #endif /* ALGO_PPMC_H_INCLUDED */