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

field_tcam.h (2738B)


      1 /**
      2 * \file        field_tcam.h
      3 *
      4 * DESCRIPTION :
      5 *       This file implements the general functionality for TCAM in field.
      6 *
      7 * PUBLIC FUNCTIONS (dnx_field_tcam omitted):
      8 *       shr_error_e    sw_state_init( unit )
      9 */
     10 /**
     11  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
     12  * 
     13  * Copyright 2007-2020 Broadcom Inc. All rights reserved.
     14  */
     15 
     16 #ifndef FIELD_TCAM_H_INCLUDED
     17 /** { */
     18 #define FIELD_TCAM_H_INCLUDED
     19 
     20 #include <shared/shrextend/shrextend_error.h>
     21 
     22 /*
     23  * { Defines
     24  */
     25 
     26 /**
     27  * Indicated whether or not we keep a "shadow" for TCAM, that is keep all of the TCAM's info in SW state to be 
     28  * accessed in addition to the HW.
     29  */
     30 #define DNX_FIELD_TCAM_SHADOW_KEEP  (1)
     31 
     32 /**
     33  * Indicated whether or not we read TCAM entries from the "shadow" instead of from the HW.
     34  * Can only be true if DBX_FIELD_TCAM_SHADOW_KEEP is true.
     35  */
     36 #define DNX_FIELD_TCAM_SHADOW_READ  (1 && DNX_FIELD_TCAM_SHADOW_KEEP)
     37 
     38 /**
     39  * The size in HW in bytes of the key or mask of a single entry in a TCAQM bank.
     40  * Includes entry size but not valid bits. 
     41  * Counting key line and mask line as separate line.
     42  */
     43 #define DNX_FIELD_TCAM_ENTRY_KEY_HW_SIZE  \
     44     (((dnx_data_field.tcam.entry_size_single_key_hw_get(unit) + \
     45         dnx_data_field.tcam.entry_size_single_valid_bits_hw_get(unit)) + \
     46         (SAL_UINT8_NOF_BITS - 1)) / (SAL_UINT8_NOF_BITS))
     47 
     48 /**
     49  * The same as DNX_FIELD_TCAM_ENTRY_KEY_HW_SIZE, only with the maximum size for alll devices.
     50  */
     51 #define DNX_FIELD_TCAM_ENTRY_KEY_HW_SIZE_MAX_ALL_DEVICE  \
     52     (((DNX_DATA_MAX_FIELD_TCAM_ENTRY_SIZE_SINGLE_KEY_HW + \
     53         DNX_DATA_MAX_FIELD_TCAM_ENTRY_SIZE_SINGLE_VALID_BITS_HW) + \
     54         (SAL_UINT8_NOF_BITS - 1)) / (SAL_UINT8_NOF_BITS))
     55 
     56 /**
     57  * The size in HW in bytes of the payload of a single entry in an action table (half an entry in the TCAM bank).
     58  */
     59 #define DNX_FIELD_TCAM_ENTRY_HALF_PAYLOAD_HW_SIZE  \
     60     ((dnx_data_field.tcam.entry_size_half_payload_hw_get(unit) + (SAL_UINT8_NOF_BITS - 1)) / (SAL_UINT8_NOF_BITS))
     61 
     62 /**
     63  * The same as DNX_FIELD_TCAM_ENTRY_HALF_PAYLOAD_HW_SIZE, only with the maximum size for alll devices.
     64  */
     65 #define DNX_FIELD_TCAM_ENTRY_HALF_PAYLOAD_HW_SIZE_MAX_ALL_DEVICE  \
     66     ((DNX_DATA_MAX_FIELD_TCAM_ENTRY_SIZE_HALF_PAYLOAD_HW + (SAL_UINT8_NOF_BITS - 1)) / (SAL_UINT8_NOF_BITS))
     67 
     68 /*
     69  * } Defines
     70  */
     71 
     72 /**
     73  * \brief
     74  * shr_error_e dnx_field_tcam_sw_state_init( unit )
     75  * Inits SW STATE for the whole TCAM module
     76  *
     77  * \param [in] unit
     78  * \return
     79  *  \retval _SHR_E_NONE success
     80  * \remark
     81  * SPECIAL OUTPUT:
     82  *      SWSTATE:
     83  *          dnx_field_tcam_access_sw  The TCAM access general SWSTATE
     84  */
     85 shr_error_e dnx_field_tcam_sw_state_init(
     86     int unit);
     87 
     88 /** } */
     89 #endif