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

ft_group.h (60242B)


      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-2020 Broadcom Inc. All rights reserved.
      6  *
      7  * File:        ft_group.h
      8  * Purpose:     Function declarations for flowtracker group.
      9  */
     10 
     11 #ifndef _BCM_INT_FT_GROUP_H_
     12 #define _BCM_INT_FT_GROUP_H_
     13 
     14 #include <soc/defs.h>
     15 #include <sal/core/libc.h>
     16 #include <shared/bsl.h>
     17 
     18 #if defined(BCM_FLOWTRACKER_SUPPORT)
     19 #include <shared/bsl.h>
     20 #include <soc/helix5.h>
     21 #include <soc/drv.h>
     22 #include <bcm/error.h>
     23 #include <soc/debug.h>
     24 #include <soc/mem.h>
     25 #include <soc/profile_mem.h>
     26 #include <soc/mspi.h>
     27 #include <soc/format.h>
     28 #include <bcm/module.h>
     29 #include <soc/scache.h>
     30 #include <bcm_int/esw/trx.h>
     31 #include <bcm/flowtracker.h>
     32 #include <bcm_int/esw/flowtracker/ft_alu.h>
     33 
     34 #define BCMI_CLEANUP_IF_ERROR(rv)      \
     35             do {                       \
     36                 if (BCM_FAILURE(rv)) { \
     37                     goto cleanup;      \
     38                 }                      \
     39             } while(0)
     40 
     41 #define BCMI_CLEANUP1_IF_ERROR(rv)     \
     42             do {                       \
     43                 if (BCM_FAILURE(rv)) { \
     44                     goto cleanup1;     \
     45                 }                      \
     46             } while(0)
     47 
     48 /**************************************************************************
     49  | Start - Flowtracker group defines & structs                            |
     50  */
     51 
     52 /* Refresh interval is 15.625us in HX5 and 7.8125us in HR4/FB6 */
     53 #define BCMI_FT_METER_REFRESH_RATE_FLAG_SET(_u_, _f_)               \
     54     do {                                                            \
     55         if (SOC_IS_HELIX5(_u_)) {                                   \
     56             (_f_) |=  _BCM_XGS_METER_FLAG_REFRESH_RATE_15p625;      \
     57         }                                                           \
     58     } while (0)
     59 
     60 typedef enum bcmi_ft_tcp_flags_e {
     61     bcmiFtTcpFlagsSYN = 0,
     62     bcmiFtTcpFlagsACK = 1,
     63     bcmiFtTcpFlagsRST = 2,
     64     bcmiFtTcpFlagsPSH = 3,
     65     bcmiFtTcpFlagsFIN = 4,
     66     bcmiFtTcpFlagsURG = 5,
     67     bcmiFtTcpFlagsECE = 6,
     68     bcmiFtTcpFlagsCWR = 7
     69 } bcmi_ft_tcp_flags_t;
     70 
     71 typedef struct bcmi_ft_state_transition_s {
     72     int current_state;
     73     int tcp_flags[2];
     74     int bidirectional;
     75     int new_learn;
     76     int next_state;
     77     int ts_triggers;
     78     uint32 event_flags;
     79 } bcmi_ft_state_transition_t;
     80 
     81 typedef enum bcmi_ft_group_param_type_e {
     82     bcmiFtGroupParamTypeTracking = 0,
     83     bcmiFtGroupParamTypeFlowchecker = 1,
     84     bcmiFtGroupParamTypeCollectorCopy = 2,
     85     bcmiFtGroupParamTypeMeter = 3,
     86     bcmiFtGroupParamTypeTsNewLearn = 4,
     87     bcmiFtGroupParamTypeTsFlowStart = 5,
     88     bcmiFtGroupParamTypeTsFlowEnd = 6,
     89     bcmiFtGroupParamTypeTsCheckEvent1 = 7,
     90     bcmiFtGroupParamTypeTsCheckEvent2 = 8,
     91     bcmiFtGroupParamTypeTsCheckEvent3 = 9,
     92     bcmiFtGroupParamTypeTsCheckEvent4 = 10,
     93     bcmiFtGroupParamTypeTsIngress = 11,
     94     bcmiFtGroupParamTypeTsEgress = 12
     95 } bcmi_ft_group_param_type_t;
     96 
     97 #define BCMI_FT_GROUP_PARAM_TYPE_STRINGS \
     98 { \
     99     "Tracking", \
    100     "Flowchecker", \
    101     "CollectorCopy", \
    102     "Meter", \
    103     "TsNewLearn",  \
    104     "TsFlowStart", \
    105     "TsFlowEnd", \
    106     "TsCheckEvent1", \
    107     "TsCheckEvent2", \
    108     "TsCheckEvent3", \
    109     "TsCheckEvent4", \
    110     "TsIngress", \
    111     "TsEgress" \
    112 }
    113 
    114 /* Number of tracking params for normalization */
    115 #define BCMI_FT_GROUP_NORM_TRACKING_PARAMS         12
    116 
    117 /**************************************************************************
    118  | Start - Flowtracker timestamp defines & structs                        |
    119  */
    120 
    121 /* max 4 timestamps allowed in one group */
    122 #define BCMI_FT_GROUP_MAX_TS                        4
    123 #define BCMI_FT_GROUP_MAX_TS_TYPE                   9
    124 
    125 /* internal group flags to manage run time timestamps */
    126 #define BCMI_FT_GROUP_TS_NEW_LEARN                 (0)
    127 #define BCMI_FT_GROUP_TS_FLOW_START                (1)
    128 #define BCMI_FT_GROUP_TS_FLOW_END                  (2)
    129 #define BCMI_FT_GROUP_TS_CHECK_EVENT1              (3)
    130 #define BCMI_FT_GROUP_TS_CHECK_EVENT2              (4)
    131 #define BCMI_FT_GROUP_TS_CHECK_EVENT3              (5)
    132 #define BCMI_FT_GROUP_TS_CHECK_EVENT4              (6)
    133 #define BCMI_FT_GROUP_TS_INGRESS                   (7)
    134 #define BCMI_FT_GROUP_TS_EGRESS                    (8)
    135 
    136 /* Timestamp internal flags */
    137 #define BCMI_FT_TS_INTERNAL_IPAT              (1 << 0)
    138 #define BCMI_FT_TS_INTERNAL_IPDT              (1 << 1)
    139 #define BCMI_FT_TS_INTERNAL_ASSIGNED_IFT_TYPE (1 << 2)
    140 #define BCMI_FT_TS_RESERVED_NEW_LEARN         (1 << 3)
    141 #define BCMI_FT_TS_RESERVED_FLOW_START        (1 << 4)
    142 #define BCMI_FT_TS_RESERVED_FLOW_END          (1 << 5)
    143 #define BCMI_FT_TS_RESERVED_INGRESS           (1 << 6)
    144 #define BCMI_FT_TS_RESERVED_EGRESS            (1 << 7)
    145 
    146 /* Timestamp engine selection flags */
    147 #define BCMI_FT_TS_ENGINE_SELECT_ANY               (0)
    148 #define BCMI_FT_TS_ENGINE_SELECT_0            (1 << 0)
    149 #define BCMI_FT_TS_ENGINE_SELECT_1            (1 << 1)
    150 #define BCMI_FT_TS_ENGINE_SELECT_2            (1 << 2)
    151 #define BCMI_FT_TS_ENGINE_SELECT_3            (1 << 3)
    152 
    153 
    154 /* Tracking param trigger type */
    155 #define BCMI_FT_TS_TYPE_TP                    (1 << 0)
    156 /* Flow check trigger type */
    157 #define BCMI_FT_TS_TYPE_FC                    (1 << 1)
    158 
    159 /* Timestamp position in session data bus for
    160    upper 16bits
    161  */
    162 #define BCMI_FT_TS_NTP64_UPPER16_LOC              240
    163 
    164 #define BCMI_FT_PARAM_TS_ENGINE_SEL_GET(_u_, _flags_, _ts_eng_sel_) \
    165     do {                                                            \
    166         _ts_eng_sel_ = BCMI_FT_TS_ENGINE_SELECT_ANY;                \
    167         if (!soc_feature(_u_, soc_feature_flex_flowtracker_ver_2)) {\
    168             break;                                                  \
    169         }                                                           \
    170         if (_flags_ & BCM_FLOWTRACKER_TRACKING_PARAM_TIMESTAMP_EVENT1){\
    171             _ts_eng_sel_ |= BCMI_FT_TS_ENGINE_SELECT_0;             \
    172         }                                                           \
    173         if (_flags_ & BCM_FLOWTRACKER_TRACKING_PARAM_TIMESTAMP_EVENT2){\
    174             _ts_eng_sel_ |= BCMI_FT_TS_ENGINE_SELECT_1;             \
    175         }                                                           \
    176         if (_flags_ & BCM_FLOWTRACKER_TRACKING_PARAM_TIMESTAMP_EVENT3){\
    177             _ts_eng_sel_ |= BCMI_FT_TS_ENGINE_SELECT_2;             \
    178         }                                                           \
    179         if (_flags_ & BCM_FLOWTRACKER_TRACKING_PARAM_TIMESTAMP_EVENT4){\
    180             _ts_eng_sel_ |= BCMI_FT_TS_ENGINE_SELECT_3;             \
    181         }                                                           \
    182     } while(0)
    183 
    184 
    185 #define BCMI_FT_CHECK_TS_ENGINE_SEL_GET(_u_, _flags_, _ts_eng_sel_) \
    186     do {                                                            \
    187         _ts_eng_sel_ = BCMI_FT_TS_ENGINE_SELECT_ANY;                \
    188         if (!soc_feature(_u_, soc_feature_flex_flowtracker_ver_2)) {\
    189             break;                                                  \
    190         }                                                           \
    191         if (_flags_ & BCM_FLOWTRACKER_CHECK_TIMESTAMP_CHECK_EVENT1){\
    192             _ts_eng_sel_ |= BCMI_FT_TS_ENGINE_SELECT_0;             \
    193         }                                                           \
    194         if (_flags_ & BCM_FLOWTRACKER_CHECK_TIMESTAMP_CHECK_EVENT2){\
    195             _ts_eng_sel_ |= BCMI_FT_TS_ENGINE_SELECT_1;             \
    196         }                                                           \
    197         if (_flags_ & BCM_FLOWTRACKER_CHECK_TIMESTAMP_CHECK_EVENT3){\
    198             _ts_eng_sel_ |= BCMI_FT_TS_ENGINE_SELECT_2;             \
    199         }                                                           \
    200         if (_flags_ & BCM_FLOWTRACKER_CHECK_TIMESTAMP_CHECK_EVENT4){\
    201             _ts_eng_sel_ |= BCMI_FT_TS_ENGINE_SELECT_3;             \
    202         }                                                           \
    203     } while(0)
    204 
    205 #if defined(BCM_FLOWTRACKER_V2_SUPPORT)
    206 #define BCMI_FT_TS_ENGINE_SEL_FT_TYPE_CHECK(_u_, _sel_, _ft_type_, _r_)\
    207     do {                                                            \
    208         int _i_ = 0;                                                \
    209         (_r_) = TRUE;                                               \
    210         if ((_sel_) == BCMI_FT_TS_ENGINE_SELECT_ANY) {              \
    211             break;                                                  \
    212         }                                                           \
    213         for (_i_ = 0; _i_ < 4; _i_++) {                             \
    214             if ((_sel_) & (BCMI_FT_TS_ENGINE_SELECT_0 << _i_)) {    \
    215                 if (BCMI_FT_TIMESTAMP_ENGINE_FT_TYPE(_u_, _i_)      \
    216                                                     != _ft_type_) { \
    217                     (_r_) = FALSE;                                  \
    218                     break;                                          \
    219                 }                                                   \
    220             }                                                       \
    221         }                                                           \
    222     } while(0)
    223 #else
    224 #define BCMI_FT_TS_ENGINE_SEL_FT_TYPE_CHECK(_u_, _sel_, _ft_type_, _r_)\
    225         (_r_) = TRUE
    226 #endif
    227 
    228 #define BCMI_FT_TS_ENGINE_SEL_TO_GROUP_TS_TRIGGER(_sel_, _trig_)    \
    229     do {                                                            \
    230         if ((_sel_) == BCMI_FT_TS_ENGINE_SELECT_0) {                \
    231             (_trig_) = BCMI_FT_GROUP_TS_CHECK_EVENT1;               \
    232         } else if ((_sel_) == BCMI_FT_TS_ENGINE_SELECT_1) {         \
    233             (_trig_) = BCMI_FT_GROUP_TS_CHECK_EVENT2;               \
    234         } else if ((_sel_) == BCMI_FT_TS_ENGINE_SELECT_2) {         \
    235             (_trig_) = BCMI_FT_GROUP_TS_CHECK_EVENT3;               \
    236         } else /* ((_sel_) == BCMI_FT_TS_ENGINE_SELECT_3) */ {      \
    237             (_trig_) = BCMI_FT_GROUP_TS_CHECK_EVENT4;               \
    238         }                                                           \
    239     } while(0)
    240 
    241 #define BCMI_FT_TS_GROUP_TRIGGER_TO_TS_ENGINE_SEL(_trig_, _sel_)    \
    242     do {                                                            \
    243         if ((_trig_) == BCMI_FT_GROUP_TS_CHECK_EVENT1) {            \
    244             (_sel_) = BCMI_FT_TS_ENGINE_SELECT_0;                   \
    245         } else if ((_trig_) == BCMI_FT_GROUP_TS_CHECK_EVENT2) {     \
    246             (_sel_) = BCMI_FT_TS_ENGINE_SELECT_1;                   \
    247         } else if ((_trig_) == BCMI_FT_GROUP_TS_CHECK_EVENT3) {     \
    248             (_sel_) = BCMI_FT_TS_ENGINE_SELECT_2;                   \
    249         } else /* (_trig_) == BCMI_FT_GROUP_TS_CHECK_EVENT4 */ {    \
    250             (_sel_) = BCMI_FT_TS_ENGINE_SELECT_3;                   \
    251         }                                                           \
    252     } while(0)
    253 
    254 /* Internal MACROs for FlowExceed Profile usage */
    255 #define BCMI_FT_GROUP_FLOW_EXCEED_PROFILE_FLOW_LIMIT    (1 << 0)
    256 #define BCMI_FT_GROUP_FLOW_EXCEED_PROFILE_RESERVATION   (1 << 1)
    257 
    258 #if defined(BCM_FLOWTRACKER_V2_SUPPORT)
    259 
    260 /* Timestamp Source related base structure. */
    261 typedef struct bcmi_ft_group_ts_source_s {
    262 
    263     /* Delay mode value. */
    264     uint8 delay_mode;
    265 
    266     /* TS_PROFILE hw trigger value. */
    267     uint8 ts_profile_hw_trig_val;
    268 
    269     /* Alu16/32 hw trigger value. */
    270     uint8 check_hw_trig_val;
    271 
    272     /* Internal trigger source. */
    273     uint8 trig;
    274 
    275 } bcmi_ft_group_ts_source_t;
    276 
    277 extern
    278 bcmi_ft_group_ts_source_t
    279     bcmi_ft_group_ts_source_info[bcmFlowtrackerTimestampSourceCount];
    280 
    281 #define BCMI_FT_GROUP_TS_SOURCE_DELAY_MODE(ts_src)  \
    282     (bcmi_ft_group_ts_source_info[ts_src].delay_mode)
    283 
    284 #define BCMI_FT_GROUP_TS_PROFILE_HW_SOURCE(ts_src)  \
    285     (bcmi_ft_group_ts_source_info[ts_src].ts_profile_hw_trig_val)
    286 
    287 #define BCMI_FT_GROUP_TS_CHECK_HW_SOURCE(ts_src)  \
    288     (bcmi_ft_group_ts_source_info[ts_src].check_hw_trig_val)
    289 
    290 #define BCMI_FT_GROUP_TS_TRIGGER(ts_src)  \
    291     (bcmi_ft_group_ts_source_info[ts_src].trig)
    292 
    293 #endif /* BCM_FLOWTRACKER_V2_SUPPORT */
    294 
    295 /**************************************************************************
    296  | End - Flowtracker timestamp defines & structs                          |
    297  */
    298 
    299 /**************************************************************************
    300  | Start - Flowtracker data engine defines & structs                      |
    301  */
    302 #if defined(BCM_FLOWTRACKER_V2_SUPPORT)
    303 
    304 /* Index to Internal Flowchecks */
    305 #define BCMI_FT_INT_CHECK_FLOWSTART_IDX     0
    306 #define BCMI_FT_INT_CHECK_FLOWEND_IDX       1
    307 #define BCMI_FT_INT_CHECK_CHECKEVENT1_IDX   2
    308 #define BCMI_FT_INT_CHECK_CHECKEVENT2_IDX   3
    309 #define BCMI_FT_INT_CHECK_CHECKEVENT3_IDX   4
    310 #define BCMI_FT_INT_CHECK_CHECKEVENT4_IDX   5
    311 #define BCMI_FT_INT_CHECK_MAX               6
    312 
    313 /* Total Internal Group ALU info */
    314 #define BCMI_FT_INT_ALU_INFO_MAX           10
    315 
    316 /* Enum for Data Engine */
    317 typedef enum bcmi_ft_data_engine_type_e {
    318     /* Data engine type Timestamp (48b) */
    319     bcmiFtDataEngineTypeTimestamp     = 0,
    320 
    321     /* Data engine type Metering */
    322     bcmiFtDataEngineTypeMeter         = 1,
    323 
    324     /* Data engine type ALU32 */
    325     bcmiFtDataEngineTypeAlu32         = 2,
    326 
    327     /* Data engine type LOAD16 */
    328     bcmiFtDataEngineTypeLoad16        = 3,
    329 
    330     /* Data engine type ALU16 */
    331     bcmiFtDataEngineTypeAlu16         = 4,
    332 
    333     /* Data engine type Copy to Collector */
    334     bcmiFtDataEngineTypeCollectorCopy = 5,
    335 
    336     /* Data engine type LOAD8 */
    337     bcmiFtDataEngineTypeLoad8         = 6,
    338 
    339     /* Data engine type Flow State index */
    340     bcmiFtDataEngineTypeFlowState     = 7,
    341 
    342     bcmiFtDataEngineTypeCount
    343 } bcmi_ft_data_engine_type_t;
    344 
    345 #define BCM_FT_DATA_ENGINE_TYPE_STRINGS \
    346 {  \
    347     "Timestamp", \
    348     "Meter", \
    349     "Alu32", \
    350     "Load16", \
    351     "Alu16", \
    352     "CollectorCopy", \
    353     "Load8", \
    354     "FlowState", \
    355     "Count"  \
    356 }
    357 
    358 /* Next data engine in the list is linked */
    359 #define BCMI_FT_DATA_ENGINE_NEXT_ATTACH (1 << 0)
    360 
    361 /* Struct for data engine info */
    362 typedef struct bcmi_ft_data_engine_info_s {
    363     /* Flags */
    364     uint32 flags;
    365 
    366     /* Data engine type */
    367     bcmi_ft_data_engine_type_t engine_type;
    368 
    369     /* Index to data engine */
    370     int index;
    371 
    372     /* H/w field for the data engine */
    373     soc_field_t field;
    374 
    375     /* Number of bits used by the data engine */
    376     int size;
    377 
    378     /* Offset from end in expanded form */
    379     int rev_pde_data_offset;
    380 
    381     /* Offset in PDD profile */
    382     int pdd_offset;
    383 
    384     /* Pointer to group alu info using this data engine */
    385     bcmi_ft_group_alu_info_t *alu_info;
    386 
    387     /* Is the data engine used by FT Group */
    388     uint8 enabled;
    389 
    390 } bcmi_ft_data_engine_info_t;
    391 
    392 /* Total FT Data Engines */
    393 #define TOTAL_FT_DATA_ENGINES       \
    394     (TOTAL_GROUP_ALU32_MEM   +      \
    395      TOTAL_GROUP_ALU16_MEM   +      \
    396      TOTAL_GROUP_LOAD16_DATA_NUM  +      \
    397      TOTAL_GROUP_LOAD8_DATA_NUM   +      \
    398      TOTAL_GROUP_TIMESTAMP_ENGINE_DATA_NUM + \
    399      1 + 1 + 1)  /* meter + state + copyToCpu */
    400 
    401 /* Struct for data engine order mapping */
    402 typedef struct bcmi_ft_data_engine_per_ft_type_map_s {
    403     /* Number of data engine in use */
    404     int count;
    405 
    406     /* Ordered list of data engines */
    407     bcmi_ft_data_engine_info_t *list[TOTAL_FT_DATA_ENGINES];
    408 
    409 } bcmi_ft_data_engine_per_ft_type_map_t;
    410 
    411 /* Struct for data engine db */
    412 typedef struct bcmi_ft_data_engine_db_s {
    413     /* Total bits in expanded form */
    414     int total_bits;
    415 
    416     /* mapping of data engines per ft type */
    417     bcmi_ft_data_engine_per_ft_type_map_t ft_type_map[bcmiFtTypeCount];
    418 
    419     /* Number of Timestamp engines */
    420     int ts_count;
    421 
    422     /* List of data engines for timestamp */
    423     bcmi_ft_data_engine_info_t ts[TOTAL_GROUP_TIMESTAMP_ENGINE_DATA_NUM];
    424 
    425     /* Data engine for Meter */
    426     bcmi_ft_data_engine_info_t meter;
    427 
    428     /* Number of ALU32 data engines */
    429     int alu32_count;
    430 
    431     /* List of data engines for ALU32 */
    432     bcmi_ft_data_engine_info_t alu32[TOTAL_GROUP_ALU32_MEM];
    433 
    434     /* Number of LOAD16 data engines */
    435     int load16_count;
    436 
    437     /* List of data engines for LOAD16 */
    438     bcmi_ft_data_engine_info_t load16[TOTAL_GROUP_LOAD16_DATA_NUM];
    439 
    440     /* Number of ALU16 data engines */
    441     int alu16_count;
    442 
    443     /* List of data engiens for ALU16 */
    444     bcmi_ft_data_engine_info_t alu16[TOTAL_GROUP_ALU16_MEM];
    445 
    446     /* Data engine for Copy to Collector */
    447     bcmi_ft_data_engine_info_t collector_copy;
    448 
    449     /* Number of LAOD8 data engines */
    450     int load8_count;
    451 
    452     /* List of data engines for LOAD8 */
    453     bcmi_ft_data_engine_info_t load8[TOTAL_GROUP_LOAD8_DATA_NUM];
    454 
    455     /* Data engine for Flow State */
    456     bcmi_ft_data_engine_info_t flow_state;
    457 
    458 } bcmi_ft_data_engine_db_t;
    459 #endif
    460 
    461 /**************************************************************************
    462  | Ends - Flowtracker data engine defines & structs                       |
    463  */
    464 
    465 
    466 typedef enum bcmi_ft_group_key_data_mode_s {
    467     bcmiFtGroupModeSingle = 0,
    468     bcmiFtGroupModeDouble = 1
    469 } bcmi_ft_group_key_data_mode_t;
    470 
    471 typedef uint32 bcmi_ft_hw_extractor_info_t;
    472 
    473 /* extraction info. */
    474 typedef struct bcmi_ft_group_extractor_info_s {
    475     bcmi_ft_group_key_data_mode_t ft_key_mode;
    476     bcmi_ft_group_key_data_mode_t ft_data_mode;
    477     int num_ft_key;
    478     bcmi_ft_hw_extractor_info_t *ft_key;
    479     int num_ft_data;
    480     bcmi_ft_hw_extractor_info_t *ft_data;
    481 } bcmi_ft_group_extractor_info_t;
    482 
    483 /* Structure to maintain session profiles. */
    484 /* Populated and used by FTFP sub-module. */
    485 typedef struct bcmi_ft_session_profiles_s {
    486 
    487     /* Session Key Profile Index. */
    488     uint32 session_key_profile_idx;
    489 
    490     /* Session Data Profile index. */
    491     uint32 session_data_profile_idx;
    492 
    493     /* Session Alu Data Profile index. */
    494     uint32 alu_data_profile_idx;
    495 
    496 } bcmi_ft_session_profiles_t;
    497 
    498 typedef struct bcmi_ft_group_ftfp_data_s {
    499 
    500     bcm_flowtracker_group_control_type_t dir_ctrl_type;
    501 
    502     bcm_flowtracker_direction_t direction;
    503 
    504     int flowtrack;
    505 
    506     int new_learn;
    507 
    508     uint32 session_key_type;
    509 
    510     /* Session key mode. */
    511     bcmi_ft_group_key_data_mode_t session_key_mode;
    512 
    513     /* FTFP profile information. */
    514     bcmi_ft_session_profiles_t profiles;
    515 
    516 } bcmi_ft_group_ftfp_data_t;
    517 
    518 
    519 /* template info linked list. */
    520 typedef struct bcmi_ft_group_template_info_s {
    521 
    522     /* alu/load flags. */
    523     uint32 flags;
    524 
    525     /* Container offset from start of Session Data PDD */
    526     int cont_offset;
    527 
    528     /* Data shift from start of Container */
    529     int data_shift;
    530 
    531     /* Data width */
    532     int data_width;
    533 
    534     /* Width of Container */
    535     int cont_width;
    536 
    537     /* Tracking param Type */
    538     bcmi_ft_group_param_type_t param_type;
    539 
    540     /* Tracking param */
    541     bcm_flowtracker_tracking_param_type_t param;
    542 
    543     /* Flowtracker Check */
    544     bcm_flowtracker_check_t check_id;
    545 
    546     /* Index in ALU/Load Engine */
    547     int index;
    548 
    549     /* Hw Engine */
    550     bcmi_ft_alu_load_type_t type;
    551 
    552     /* Flow Direction */
    553     bcm_flowtracker_direction_t direction;
    554 
    555     /* Custom Id */
    556     uint16 custom_id;
    557 
    558 } bcmi_ft_group_template_info_t;
    559 
    560 typedef struct bcmi_ft_group_config_s {
    561 
    562     /* User tracking params. */
    563     int num_tracking_params;
    564     bcm_flowtracker_tracking_param_info_t *list_of_tracking_params;
    565 
    566     /* Ordered tracking params. */
    567     int num_ordered_template_params;
    568     bcm_flowtracker_tracking_param_info_t *list_of_ordered_template_params;
    569 
    570     /* Group Class. */
    571     uint32 class_id;
    572 
    573     /* State transition type */
    574     bcm_flowtracker_state_transition_type_t st_type;
    575 
    576 } bcmi_ft_group_config_t;
    577 
    578 typedef struct bcmi_ft_group_meter_s {
    579 
    580     uint32 sw_ckbits_sec;
    581 
    582     uint32 sw_ckbits_burst;
    583 
    584 } bcmi_ft_group_meter_t;
    585 
    586 typedef struct bcmi_ft_group_extraction_info_s {
    587 
    588     /* Inforamtion needed for ALU allocation scheme. */
    589     int num_data_info;
    590     bcmi_ft_group_alu_info_t *ft_data_info;
    591 
    592     /* Session key information for the FT. */
    593     int num_key_info;
    594     bcmi_ft_group_alu_info_t *ft_key_info;
    595 
    596     /* Hardware extractor inforamtion needed for FT. */
    597     bcmi_ft_group_extractor_info_t ft_ext_info;
    598 
    599 #if defined(BCM_FLOWTRACKER_V2_SUPPORT)
    600     /* VFP OpaqueCtrlId2 start bit for NTP64b war */
    601     int vfp_opaque2_start_bit;
    602 #endif
    603 } bcmi_ft_group_extraction_info_t;
    604 
    605 /* The linked list used to form export template */
    606 typedef struct bcmi_ft_group_template_list_s {
    607 
    608     bcmi_ft_group_template_info_t info;
    609 
    610     struct bcmi_ft_group_template_list_s *next;
    611 
    612 } bcmi_ft_group_template_list_t;
    613 
    614 /* Trigger info for a group */
    615 typedef struct bcmi_ft_group_trigger_info_s {
    616 
    617     /* Timestamp flags. */
    618     uint8 ts_flags;
    619 
    620     /* Timestamp bank. */
    621     uint8 ts_bank;
    622 
    623     /* Timestamp reference count. */
    624     uint16 ts_ref_count;
    625 
    626     /* Timestamp flowtracker type. */
    627     bcmi_ft_type_t ts_ft_type;
    628 
    629     /* Timestamp engine selection, Sync/Recv not req */
    630     uint8 ts_engine_sel;
    631 
    632 } bcmi_ft_group_trigger_info_t;
    633 
    634 /* User entries are supported on this group */
    635 #define BCMI_FT_GROUP_INFO_F_USER_ENTRIES_ONLY  (1 << 0)
    636 
    637 /* Periodic export enabled */
    638 #define BCMI_FT_GROUP_INFO_F_PERIODIC_EXPORT    (1 << 1)
    639 
    640 /* Main internal group info db structure */
    641 typedef struct bcmi_ft_group_info_s {
    642 
    643     /* Group config. */
    644     bcmi_ft_group_config_t group_config;
    645 
    646     /* Associated meter info. */
    647     bcmi_ft_group_meter_t meter_info;
    648 
    649     /* Group flow checker list. */
    650     bcmi_ft_flowchecker_list_t *head;
    651 
    652     /* Associated collector id. */
    653     bcm_flowtracker_collector_t  collector_id;
    654 
    655     /* Associated template id */
    656     bcm_flowtracker_export_template_t template_id;
    657 
    658     /* Group extraction information. */
    659     bcmi_ft_group_extraction_info_t group_ext_info;
    660 
    661     /* Flags */
    662     uint32 flags;
    663 
    664     /* Total number of ftfp entries pointing to this group. */
    665     uint32 num_ftfp_entries;
    666 
    667     /* FTFP data in group state. */
    668     bcmi_ft_group_ftfp_data_t ftfp_data;
    669 
    670     /* We will have a pdd profile entry here. */
    671     bsd_policy_action_profile_entry_t pdd_entry;
    672 
    673     /* ALU32 MEM allocation bitmap. */
    674     uint32 *ALU32_MEM_USE;
    675 
    676     /* ALU16 MEM allocation bitmap. */
    677     uint32 ALU16_MEM_USE[TOTAL_GROUP_ALU16_MEM];
    678 
    679     /* List for template information. */
    680     bcmi_ft_group_template_list_t *template_head;
    681 
    682     /* Timestamps triggers on this group. */
    683     uint32 ts_triggers;
    684 
    685     /* Trigger internal information. */
    686     bcmi_ft_group_trigger_info_t ts_info[BCMI_FT_GROUP_MAX_TS_TYPE];
    687 
    688 #if defined(BCM_FLOWTRACKER_V2_SUPPORT)
    689     /* Session Data Engine db */
    690     bcmi_ft_data_engine_db_t *engine_db;
    691 
    692     /* Internal Flowchecks */
    693     bcmi_flowtracker_flowchecker_info_t *int_fc_info_arr[BCMI_FT_INT_CHECK_MAX];
    694 #endif
    695 
    696     /* Timestamp triggers for tracking params */
    697     uint32 param_ts_triggers;
    698 
    699     /* Validation status. */
    700     int validated;
    701 
    702 } bcmi_ft_group_sw_info_t;
    703 
    704  typedef struct bcmi_ft_group_bitmap_s {
    705      SHR_BITDCL *ft_group_bitmap;
    706  } bcmi_ft_group_bitmap_t;
    707 
    708 /* Macro for flowtracker group type */
    709 #define BCMI_FT_GROUP_TYPE_COUNT bcmFlowtrackerGroupTypeCount
    710 
    711 /* Flowtracker Group Info */
    712 typedef struct bcmi_ft_group_info_db_s {
    713     /* Group Sw State */
    714     bcmi_ft_group_sw_info_t **sw_info[BCMI_FT_GROUP_TYPE_COUNT];
    715 
    716     /* Group Bitmap */
    717     bcmi_ft_group_bitmap_t bitmap[BCMI_FT_GROUP_TYPE_COUNT];
    718 
    719     /* Group Count */
    720     uint32 count[BCMI_FT_GROUP_TYPE_COUNT];
    721 
    722     /* Aggregate Periodic Export Interva */
    723     uint32 aft_periodic_interval;
    724 
    725 } bcmi_ft_group_info_db_t;
    726 
    727 /* Get Group Type from Flow group Id */
    728 #define BCMI_FT_GROUP_TYPE_GET(_id_)                                    \
    729         (((_id_) >> BCM_FLOWTRACKER_GROUP_TYPE_SHIFT) & 0x3F)
    730 
    731 /* Get Group Index from Flow group Id */
    732 #define BCMI_FT_GROUP_INDEX_GET(_id_)                                   \
    733         ((_id_) & ((1 << BCM_FLOWTRACKER_GROUP_TYPE_SHIFT) - 1))
    734 
    735 #define BCMI_FT_GROUP_TYPE_IS_AGGREGATE(_id_)                           \
    736         ((BCMI_FT_GROUP_TYPE_GET(_id_) ==                               \
    737           bcmFlowtrackerGroupTypeAggregateIngress) ||                   \
    738          (BCMI_FT_GROUP_TYPE_GET(_id_) ==                               \
    739           bcmFlowtrackerGroupTypeAggregateMmu)     ||                   \
    740          (BCMI_FT_GROUP_TYPE_GET(_id_) ==                               \
    741           bcmFlowtrackerGroupTypeAggregateEgress))
    742 
    743 /* Internal flowtracker group info db*/
    744  extern
    745 bcmi_ft_group_info_db_t bcmi_ft_group_info_db[BCM_MAX_NUM_UNITS];
    746 
    747 #define BCMI_FT_GROUP_INFO(_unit_) (&bcmi_ft_group_info_db[(_unit_)])
    748 
    749 #define BCMI_FT_GROUP_BITMAP(_unit_, _group_type_)         \
    750     (bcmi_ft_group_info_db[(_unit_)].bitmap[(_group_type_)].ft_group_bitmap)
    751 
    752 #define BCMI_FT_GROUP_SW_STATE(_unit_, _group_type_)        \
    753     (bcmi_ft_group_info_db[(_unit_)].sw_info[_group_type_])
    754 
    755 #define BCMI_FT_GROUP_PER_TYPE(_unit_, _group_type_, _index_)       \
    756     (bcmi_ft_group_info_db[(_unit_)].sw_info[(_group_type_)][(_index_)])
    757 
    758 #define BCMI_FT_GROUP_TYPE_MAX_COUNT(_unit_, _group_type_)       \
    759     (bcmi_ft_group_info_db[(_unit_)].count[(_group_type_)])
    760 
    761 #define BCMI_FT_GROUP(_unit_, _id_)                         \
    762     BCMI_FT_GROUP_PER_TYPE((_unit_), BCMI_FT_GROUP_TYPE_GET(_id_),  \
    763             BCMI_FT_GROUP_INDEX_GET(_id_))
    764 
    765 #define BCMI_FT_GROUP_CONFIG(unit, id)  \
    766      ((BCMI_FT_GROUP(unit, id))->group_config)
    767 
    768 #define BCMI_FT_GROUP_IS_BUSY(unit, id)  \
    769      ((BCMI_FT_GROUP(unit, id))->num_ftfp_entries != 0)
    770 
    771 #define BCMI_FT_GROUP_IS_VALIDATED(unit, id)  \
    772      ((BCMI_FT_GROUP(unit, id))->validated)
    773 
    774 #define BCMI_FT_GROUP_FTFP_DATA(unit, id) \
    775      ((BCMI_FT_GROUP(unit, id))->ftfp_data)
    776 
    777 #define BCMI_FT_GROUP_TRACK_PARAM(unit, id)  \
    778      (((BCMI_FT_GROUP(unit, id))->group_config).list_of_tracking_params)
    779 
    780 #define BCMI_FT_GROUP_TRACK_PARAM_NUM(unit, id)  \
    781      (((BCMI_FT_GROUP(unit, id))->group_config).num_tracking_params)
    782 
    783 #define BCMI_FT_GROUP_ORDERED_TRACK_PARAM_NUM(unit, id)  \
    784      (((BCMI_FT_GROUP(unit, id))->group_config).num_ordered_template_params)
    785 
    786 #define BCMI_FT_GROUP_ORDERED_TRACK_PARAM(unit, id)  \
    787      (((BCMI_FT_GROUP(unit, id))->group_config).list_of_ordered_template_params)
    788 
    789 #define BCMI_FT_GROUP_CHECK_LIST(unit, id)  \
    790      ((BCMI_FT_GROUP(unit, id))->head)
    791 
    792 #define BCMI_FT_GROUP_EXT_INFO(unit, id)  \
    793      ((BCMI_FT_GROUP(unit, id))->group_ext_info)
    794 
    795 #define BCMI_FT_GROUP_EXT_DATA_INFO(unit, id)  \
    796      (((BCMI_FT_GROUP(unit, id))->group_ext_info).ft_data_info)
    797 
    798 #define BCMI_FT_GROUP_EXT_KEY_INFO(unit, id)  \
    799      (((BCMI_FT_GROUP(unit, id))->group_ext_info).ft_key_info)
    800 
    801 #define BCMI_FT_GROUP_EXT_HW_INFO(unit, id)  \
    802      (((BCMI_FT_GROUP(unit, id))->group_ext_info).ft_ext_info)
    803 
    804 #if defined(BCM_FLOWTRACKER_V2_SUPPORT)
    805 #define BCMI_FT_GROUP_EXT_HW_INFO_VFP_OPAQUEID2_START_BIT(unit, id)  \
    806     (((BCMI_FT_GROUP(unit, id))->group_ext_info).vfp_opaque2_start_bit)
    807 #endif
    808 
    809 #define BCMI_FT_GROUP_FLOWCHECKER_HEAD(unit, id)  \
    810      (BCMI_FT_GROUP(unit, id)->head)
    811 
    812 #define BCMI_FT_GROUP_METER_INFO(unit, id)  \
    813      (BCMI_FT_GROUP(unit, id)->meter_info)
    814 
    815 #define BCMI_FT_GROUP_ALU32_MEM_USE(unit, id) \
    816      (BCMI_FT_GROUP(unit, id)->ALU32_MEM_USE)
    817 
    818 #define BCMI_FT_GROUP_ALU16_MEM_USE(unit, id) \
    819      (BCMI_FT_GROUP(unit, id)->ALU16_MEM_USE)
    820 
    821 #define BCMI_FT_GROUP_ALU32_MEM_USE_GET(unit, id, mem_idx) \
    822      (BCMI_FT_GROUP(unit, id)->ALU32_MEM_USE[mem_idx])
    823 
    824 #define BCMI_FT_GROUP_ALU16_MEM_USE_GET(unit, id, mem_idx) \
    825      (BCMI_FT_GROUP(unit, id)->ALU16_MEM_USE[mem_idx])
    826 
    827 #define BCMI_FT_GROUP_TS_TRIGGERS(unit, id) \
    828      (BCMI_FT_GROUP(unit, id)->ts_triggers)
    829 
    830 #define BCMI_FT_GROUP_TS_TRIGGER_INFO(unit, id) \
    831      (BCMI_FT_GROUP(unit, id)->ts_info)
    832 
    833 #define BCMI_FT_GROUP_TS_TRIGGER_FLAGS(unit, id, trig) \
    834      (BCMI_FT_GROUP(unit, id)->ts_info[trig].ts_flags)
    835 
    836 #define BCMI_FT_GROUP_TS_TRIGGER_ENGINE_SEL(unit, id, trig) \
    837      (BCMI_FT_GROUP(unit, id)->ts_info[trig].ts_engine_sel)
    838 
    839 #define BCMI_FT_GROUP_TS_TRIGGER_BANK(unit, id, trig) \
    840      (BCMI_FT_GROUP(unit, id)->ts_info[trig].ts_bank)
    841 
    842 #define BCMI_FT_GROUP_TS_TRIGGER_REF_COUNT(unit, id, trig) \
    843      (BCMI_FT_GROUP(unit, id)->ts_info[trig].ts_ref_count)
    844 
    845 #define BCMI_FT_GROUP_TS_TRIGGER_REF_COUNT_INCR(unit, id, trig) \
    846      (BCMI_FT_GROUP(unit, id)->ts_info[trig].ts_ref_count++)
    847 
    848 #define BCMI_FT_GROUP_TS_TRIGGER_REF_COUNT_DECR(unit, id, trig)    \
    849     if (BCMI_FT_GROUP(unit, id)->ts_info[trig].ts_ref_count > 0) { \
    850         (BCMI_FT_GROUP(unit, id)->ts_info[trig].ts_ref_count--);   \
    851     }
    852 
    853 #define BCMI_FT_GROUP_TS_TRIGGER_FT_TYPE(unit, id, trig) \
    854      (BCMI_FT_GROUP(unit, id)->ts_info[trig].ts_ft_type)
    855 
    856 #define BCMI_FT_GROUP_PARAM_TS_TRIGGERS(unit, id) \
    857     (BCMI_FT_GROUP(unit, id)->param_ts_triggers)
    858 
    859 #define BCMI_FT_GROUP_EXT_DATA_OR_TS_TRIGGERS_SET(unit, id) \
    860             ((BCMI_FT_GROUP_EXT_DATA_INFO(unit, id) != NULL) || \
    861              (BCMI_FT_GROUP_TS_TRIGGERS(unit, id) != 0))
    862 
    863 typedef enum bcmi_ft_group_param_e {
    864     bcmiFtGroupParamFtfpEntryNum,
    865     bcmiFtGroupParamCount
    866 } bcmi_ft_group_params_t;
    867 
    868 typedef enum bcmi_ft_group_params_operation_e {
    869     bcmiFtGroupParamsOprInc,
    870     bcmiFtGroupParamsOprDec,
    871     bcmiFtGroupParamsOprUpdate,
    872     bcmiFtGroupParamOprCount
    873 } bcmi_ft_group_params_operation_t;
    874 
    875 /* MAximum 4 groups can be flushed one time.*/
    876 #define BCMI_FT_GROUP_FLUSH_MAX_SCALE             4
    877 
    878 typedef struct bcmi_ft_group_flushinfo_s {
    879     uint32 group_valid;
    880     bcm_flowtracker_group_t group_id;
    881 } bcmi_ft_group_flush_info_t;
    882 /**************************************************************************/
    883 
    884 
    885 
    886 /**************************************************************************
    887  | Start - Flow checker defines & structs                                 |
    888  */
    889 
    890 /* Flowtracker Index generation. */
    891 #define  BCM_FT_IDX_TYPE_CHECK               1
    892 #define  BCM_FT_IDX_TYPE_2ND_CHECK           2
    893 #define  BCM_FT_IDX_TYPE_INTERNAL            0x3f      /* For Internal use */
    894 #define  BCM_FT_IDX_TYPE_SHIFT               26
    895 #define  BCM_FT_IDX_MASK                     0x3ffffff
    896 
    897 #define BCMI_FT_FLOWCHECKER_INDEX_SET(index, type) \
    898     ((type << BCM_FT_IDX_TYPE_SHIFT) | (index))
    899 
    900 #define BCMI_FT_FLOWCHECKER_INDEX_GET(index) \
    901     ((index) & BCM_FT_IDX_MASK)
    902 
    903 #define BCMI_FT_IDX_IS_CHECK(index) \
    904     ((((index) >> BCM_FT_IDX_TYPE_SHIFT) == BCM_FT_IDX_TYPE_CHECK) || \
    905      (((index) >> BCM_FT_IDX_TYPE_SHIFT) == BCM_FT_IDX_TYPE_2ND_CHECK))
    906 
    907 #define BCMI_FT_IDX_IS_PRIMARY_CHECK(index) \
    908     (((index) >> BCM_FT_IDX_TYPE_SHIFT) == BCM_FT_IDX_TYPE_CHECK)
    909 
    910 #define BCMI_FT_IDX_IS_2ND_CHECK(index) \
    911     (((index) >> BCM_FT_IDX_TYPE_SHIFT) == BCM_FT_IDX_TYPE_2ND_CHECK)
    912 
    913 /* For Internal Flowcheck 6b(checktype)+16b(group idx)+10b(internal check idx)*/
    914 #define BCMI_FT_INT_CHECK_GROUP_IDX_SHIFT    10
    915 #define BCMI_FT_INT_CHECK_GROUP_IDX_MASK     0xffff
    916 #define BCMI_FT_INT_CHECK_IDX_MASK           0x3ff
    917 
    918 #define BCMI_FT_IDX_IS_INT_CHECK(index) \
    919     (((index) >> BCM_FT_IDX_TYPE_SHIFT) == BCM_FT_IDX_TYPE_INTERNAL)
    920 
    921 /* Get FT Group Index (only for Internal Flowcheck) */
    922 #define BCMI_FT_INT_CHECK_GROUP_IDX_GET(index)          \
    923     (((index) >> BCMI_FT_INT_CHECK_GROUP_IDX_SHIFT) &   \
    924             BCMI_FT_INT_CHECK_GROUP_IDX_MASK)
    925 
    926 /* Set FT Group Index (only for Internal Flowcheck) */
    927 #define BCMI_FT_INT_CHECK_GROUP_IDX_SET(index, group_id) \
    928     ((((group_id) & BCMI_FT_INT_CHECK_GROUP_IDX_MASK) << \
    929       BCMI_FT_INT_CHECK_GROUP_IDX_SHIFT) | index)
    930 
    931 /* Get FT Internal check Index (only for Internal Flowcheck) */
    932 #define BCMI_FT_INT_CHECK_IDX_GET(index) \
    933     ((index) & BCMI_FT_INT_CHECK_IDX_MASK)
    934 
    935 /* Options for bcmi_ft_group_check_validate */
    936 #define BCMI_FT_GROUP_CHECK_MATCH_GROUP      (1 << 0)
    937 #define BCMI_FT_GROUP_CHECK_MATCH_PRIMARY    (1 << 1)
    938 
    939 /* Group Record Traverse metadata */
    940 typedef struct bcmi_ft_group_record_trav_data_s {
    941     /* Metadata flags */
    942     uint32 flags;
    943 
    944     /* Traverse group */
    945     bcm_flowtracker_group_t group_id;
    946 
    947     /* FT type bitmap for group */
    948     uint32 ft_type_bmp;
    949 
    950     /* Current traverse index */
    951     uint32 index;
    952 
    953     /* Group Record content type */
    954     bcm_flowtracker_group_record_type_t record_type;
    955 
    956     /* Pointer to group record info*/
    957     bcm_flowtracker_group_record_info_t *record_info;
    958 
    959     /* User callback function */
    960     bcm_flowtracker_group_record_traverse_cb cb;
    961 
    962     /* User data */
    963     void *user_data;
    964 
    965     /* Export record metadata offset */
    966     int md_offset;
    967 
    968     /* Export record key offset */
    969     int key_offset;
    970 
    971     /* Export record data offset */
    972     int data_offset;
    973 
    974     /* Number of bits in Flow Group */
    975     int group_idx_bits;
    976 
    977     /* uint8 buffers */
    978     uint8 *u8buffer1;
    979     uint8 *u8buffer2;
    980 
    981     /* uint32 buffers */
    982     uint32 *u32buffer1;
    983     uint32 *u32buffer2;
    984     uint32 *u32buffer3;
    985 
    986 } bcmi_ft_group_record_trav_data_t;
    987 
    988 #define BCMI_FT_GROUP_RECORD_TRV_F_GROUP            (1 << 0)
    989 #define BCMI_FT_GROUP_RECORD_TRV_F_KEY              (1 << 1)
    990 #define BCMI_FT_GROUP_RECORD_TRV_F_DATA             (1 << 2)
    991 
    992 typedef int (*bcmi_ft_group_hw_entry_get_cb_f)(int unit,
    993                 soc_mem_t mem, uint32 index, void *entry,
    994                 void *user_data, int *move);
    995 
    996 
    997 /**************************************************************************
    998  | End - Flow checker defines & structs                                   |
    999  */
   1000 
   1001 
   1002 /*****************************************************
   1003  | Start - Flowtracker module utility Methods.       |
   1004  */
   1005 extern int
   1006 ft_initialized[BCM_MAX_NUM_UNITS];
   1007 
   1008 extern int
   1009 bcmi_ft_init(int unit);
   1010 
   1011 extern int
   1012 bcmi_ft_cleanup(int unit);
   1013 /*****************************************************
   1014  | End - Flowtracker module utility Methods.         |
   1015  */
   1016 
   1017 
   1018 
   1019 /*****************************************************
   1020  | Start - Flow Checker utility Methods.             |
   1021  */
   1022 /* Init routines */
   1023 extern int
   1024 bcmi_ft_flowchecker_init(int unit);
   1025 
   1026 extern void
   1027 bcmi_ft_flowchecker_cleanup(int unit);
   1028 
   1029 /* Create Flow check and return software ID. */
   1030 extern int
   1031 bcmi_ft_check_create(int unit,
   1032                      uint32 options,
   1033                      bcm_flowtracker_check_info_t check_info,
   1034                      bcm_flowtracker_check_t *check_id);
   1035 
   1036 /* Destroy flow check corresponding to this software ID. */
   1037 extern int
   1038 bcmi_ft_check_destroy(int unit,
   1039                       bcm_flowtracker_check_t check_id);
   1040 
   1041 /* Destroy all flow checks not linked to any group. */
   1042 extern int
   1043 bcmi_ft_check_destroy_all(int unit);
   1044 
   1045 /* Get information of flow check. */
   1046 extern int
   1047 bcmi_ft_check_get(int unit,
   1048                   bcm_flowtracker_check_t check_id,
   1049                   bcm_flowtracker_check_info_t *check_info,
   1050                   uint16 *ft_type_bmp);
   1051 
   1052 /* Routine to traverse through all the flowcheckers. */
   1053 extern int
   1054 bcmi_ft_check_traverse(int unit,
   1055                        bcm_flowtracker_check_traverse_cb cb,
   1056                        void *user_data);
   1057 
   1058 /* Get information of flow check for complete info */
   1059 extern int
   1060 bcmi_ft_flowchecker_get(int unit,
   1061                         bcm_flowtracker_check_t flowchecker_id,
   1062                         bcmi_flowtracker_flowchecker_info_t *flow_check_info);
   1063 
   1064 extern int
   1065 bcmi_ft_check_action_info_set(int unit,
   1066                               bcm_flowtracker_check_t check_id,
   1067                               bcm_flowtracker_check_action_info_t info);
   1068 
   1069 extern int
   1070 bcmi_ft_check_action_info_get(int unit,
   1071                               bcm_flowtracker_check_t check_id,
   1072                               bcm_flowtracker_check_action_info_t *info);
   1073 
   1074 extern int
   1075 bcmi_ft_check_export_info_get(int unit,
   1076                               bcm_flowtracker_check_t check_id,
   1077                               bcm_flowtracker_check_export_info_t *info);
   1078 
   1079 extern int
   1080 bcmi_ft_check_export_info_set(int unit,
   1081                               bcm_flowtracker_check_t check_id,
   1082                               bcm_flowtracker_check_export_info_t info);
   1083 
   1084 extern int
   1085 bcmi_ft_check_action_num_operands_get(int unit,
   1086                               bcm_flowtracker_check_action_t action,
   1087                               int *num_operands);
   1088 
   1089 #if defined(BCM_FLOWTRACKER_V2_SUPPORT)
   1090 extern int
   1091 bcmi_ftv2_check_delay_info_get(int unit,
   1092                                bcm_flowtracker_check_t check_id,
   1093                                bcm_flowtracker_check_delay_info_t *info);
   1094 
   1095 extern int
   1096 bcmi_ftv2_check_delay_info_set(int unit,
   1097                                bcm_flowtracker_check_t check_id,
   1098                                bcm_flowtracker_check_delay_info_t info);
   1099 #endif /* BCM_FLOWTRACKER_V2_SUPPORT */
   1100 
   1101 extern int
   1102 bcmi_ft_flowchecker_list_length_get(int unit,
   1103                                     bcmi_ft_flowchecker_list_t **head);
   1104 
   1105 extern int
   1106 bcmi_ft_flowchecker_list_add(int unit,
   1107                              bcmi_ft_flowchecker_list_t **head,
   1108                              bcm_flowtracker_check_t flowchecker_id);
   1109 
   1110 extern int
   1111 bcmi_ft_flowchecker_list_delete(int unit,
   1112                                 bcmi_ft_flowchecker_list_t **head,
   1113                                 bcm_flowtracker_check_t flowchecker_id);
   1114 
   1115 extern int
   1116 bcmi_ft_group_flowchecker_add(int unit,
   1117                               bcm_flowtracker_group_t id,
   1118                               bcm_flowtracker_check_t flowchecker_id);
   1119 
   1120 extern int
   1121 bcmi_ft_group_flowchecker_delete(int unit,
   1122                                  bcm_flowtracker_group_t id,
   1123                                  bcm_flowtracker_check_t flowchecker_id);
   1124 
   1125 extern int
   1126 bcmi_flowtracker_check_get_all(int unit,
   1127                                bcm_flowtracker_group_t group_id,
   1128                                int skip_non_primary,
   1129                                int max_checks,
   1130                                bcm_flowtracker_check_t *list_of_check_ids,
   1131                                int *num_checks);
   1132 
   1133 extern int
   1134 bcmi_ft_check_compare(int unit,
   1135                       bcm_flowtracker_check_t check_id1,
   1136                       bcm_flowtracker_check_t check_id2);
   1137 
   1138 extern int
   1139 bcmi_ft_check_list_compare(int unit,
   1140                            bcmi_ft_flowchecker_list_t **head,
   1141                            bcm_flowtracker_check_t check_id);
   1142 
   1143 extern int
   1144 bcmi_ft_group_check_validate(int unit,
   1145                              uint32 options,
   1146                              bcm_flowtracker_group_t id,
   1147                              bcm_flowtracker_check_t check_id);
   1148 /*****************************************************
   1149  | End - Flow Checker utility Methods.               |
   1150  */
   1151 
   1152 
   1153 /*****************************************************
   1154  | Start - FT Group utility Methods.                 |
   1155  */
   1156 
   1157 /* Init Routines. */
   1158 extern int
   1159 bcmi_ft_group_state_init(int unit);
   1160 
   1161 extern void
   1162 bcmi_ft_group_state_clear(int unit);
   1163 
   1164 extern int
   1165 bcmi_ft_group_profile_init(int unit);
   1166 
   1167 extern int
   1168 bcmi_ft_group_is_invalid(int unit, bcm_flowtracker_group_t group_index);
   1169 
   1170 extern int
   1171 bcmi_ft_group_collector_is_valid(int unit, bcm_flowtracker_group_t id);
   1172 
   1173 /* Group Creation/Deletion Methods. */
   1174 extern int
   1175 bcmi_ft_group_create(
   1176         int unit,
   1177         uint32 options,
   1178         bcm_flowtracker_group_t *id,
   1179         bcm_flowtracker_group_info_t *flow_group_info);
   1180 
   1181 extern int
   1182 bcmi_ft_group_get(
   1183         int unit,
   1184         bcm_flowtracker_group_t id,
   1185         bcm_flowtracker_group_info_t *flow_group_info);
   1186 
   1187 extern int
   1188 bcmi_ft_group_clear(
   1189         int unit,
   1190         bcm_flowtracker_group_t id);
   1191 
   1192 extern int
   1193 bcmi_ft_group_destroy(
   1194         int unit,
   1195         bcm_flowtracker_group_t id);
   1196 
   1197 extern int
   1198 bcmi_ft_group_profiles_destroy(
   1199         int unit,
   1200         bcm_flowtracker_group_t id);
   1201 
   1202 extern int
   1203 bcmi_ft_group_get_all(
   1204         int unit,
   1205         int max_size,
   1206         bcm_flowtracker_group_t *idz,
   1207         int *list_size);
   1208 
   1209 extern int
   1210 bcmi_ft_group_entry_update(
   1211         int unit,
   1212         bcm_flowtracker_group_t group_id,
   1213         bcm_flowtracker_group_info_t *flow_group_info,
   1214         int create);
   1215 
   1216 extern int
   1217 bcmi_ft_group_flow_limit_get(
   1218         int unit,
   1219         bcm_flowtracker_group_t id,
   1220         uint32 *flow_limit);
   1221 
   1222 extern int
   1223 bcmi_ft_group_flow_limit_set(
   1224         int unit,
   1225         bcm_flowtracker_group_t id,
   1226         uint32 flow_limit);
   1227 
   1228 extern int
   1229 bcmi_ft_group_age_out_get(
   1230         int unit,
   1231         bcm_flowtracker_group_t id,
   1232         uint32 *aging_interval_ms);
   1233 
   1234 extern int
   1235 bcmi_ft_group_age_out_set(
   1236         int unit,
   1237         bcm_flowtracker_group_t id,
   1238         uint32 aging_interval_ms);
   1239 
   1240 extern int
   1241 bcmi_ft_group_age_export_trigger_set(
   1242         int unit,
   1243         bcm_flowtracker_group_t id,
   1244         uint32 flags,
   1245         uint32 enable);
   1246 
   1247 extern int
   1248 bcmi_ft_group_age_export_trigger_get(
   1249         int unit,
   1250         bcm_flowtracker_group_t id,
   1251         uint32 *flags,
   1252         uint32 *enable);
   1253 
   1254 extern int
   1255 bcmi_ft_group_meter_profile_set(
   1256     int unit,
   1257     bcm_flowtracker_group_t id,
   1258     bcm_flowtracker_meter_info_t info);
   1259 
   1260 extern int
   1261 bcmi_ft_group_meter_profile_get(
   1262     int unit,
   1263     bcm_flowtracker_group_t id,
   1264     bcm_flowtracker_meter_info_t *info);
   1265 
   1266 extern int
   1267 bcmi_ft_group_collector_copy_set(
   1268     int unit,
   1269     bcm_flowtracker_group_t id,
   1270     bcm_flowtracker_collector_copy_info_t info);
   1271 
   1272 extern int
   1273 bcmi_ft_group_collector_copy_get(
   1274     int unit,
   1275     bcm_flowtracker_group_t id,
   1276     bcm_flowtracker_collector_copy_info_t *info);
   1277 
   1278 /* Export Triggers. */
   1279 extern int
   1280 bcmi_ft_group_export_trigger_get(
   1281         int unit,
   1282         bcm_flowtracker_group_t id,
   1283         bcm_flowtracker_export_trigger_info_t *export_trigger_info);
   1284 extern int
   1285 bcmi_ft_group_export_trigger_set(
   1286         int unit,
   1287         bcm_flowtracker_group_t id,
   1288         bcm_flowtracker_export_trigger_info_t *export_trigger_info);
   1289 
   1290 /* Group Tracking Params. */
   1291 extern int
   1292 bcmi_ft_group_param_element_validate (
   1293     int unit,
   1294     bcm_flowtracker_group_t flow_group_id,
   1295     int num_tracking_elements,
   1296     bcm_flowtracker_tracking_param_info_t *list_of_tracking_elements);
   1297 
   1298 extern int bcmi_ft_group_tracking_param_set(
   1299     int unit,
   1300     bcm_flowtracker_group_t id,
   1301     int num_tracking_elements,
   1302     bcm_flowtracker_tracking_param_info_t *list_of_tracking_elements);
   1303 
   1304 extern int
   1305 bcmi_ft_group_tracking_param_get(
   1306         int unit,
   1307         bcm_flowtracker_group_t id,
   1308         int max_size,
   1309         bcm_flowtracker_tracking_param_info_t *list_of_tracking_elements,
   1310         int *num_tracking_elements);
   1311 
   1312 extern int
   1313 bcmi_ft_group_tracking_param_mask_status_get(
   1314         int unit,
   1315         bcm_flowtracker_tracking_param_info_t *tp_info,
   1316         uint16 qual_size,
   1317         int *mask_present,
   1318         int *partial_mask);
   1319 
   1320 /* Template list Addition and delettion. */
   1321 extern int
   1322 bcmi_ft_group_template_list_add(
   1323         int unit,
   1324         bcmi_ft_group_template_list_t **head,
   1325         int start,
   1326         int length,
   1327         bcmi_ft_group_param_type_t type,
   1328         bcmi_ft_group_alu_info_t *info);
   1329 
   1330 extern void
   1331 bcmi_ft_group_template_list_delete_all(
   1332         int unit,
   1333         bcmi_ft_group_template_list_t **head);
   1334 
   1335 extern int
   1336 bcmi_ft_group_template_data_create(
   1337         int unit,
   1338         bcm_flowtracker_group_t id,
   1339         int *load16_indexes,
   1340         int *load8_indexes);
   1341 
   1342 extern int
   1343 bcmi_ft_group_flush_set(
   1344         int unit,
   1345         uint32 flags,
   1346         int num_groups,
   1347         bcm_flowtracker_group_t *idz);
   1348 
   1349 extern int
   1350 bcmi_flowtracker_group_control_get(
   1351         int unit,
   1352         bcm_flowtracker_group_t id,
   1353         bcm_flowtracker_group_control_type_t type,
   1354         int *arg);
   1355 
   1356 extern int
   1357 bcmi_flowtracker_group_control_set(
   1358         int unit,
   1359         bcm_flowtracker_group_t id,
   1360         bcm_flowtracker_group_control_type_t type,
   1361         int arg);
   1362 
   1363 extern int
   1364 bcmi_ft_group_stat_get(
   1365         int unit,
   1366         bcm_flowtracker_group_t id,
   1367         bcm_flowtracker_group_stat_t *group_stats);
   1368 
   1369 extern int
   1370 bcmi_ft_group_stat_set(
   1371         int unit,
   1372         bcm_flowtracker_group_t id,
   1373         bcm_flowtracker_group_stat_t *group_stats);
   1374 
   1375 /* PDD profile methods. */
   1376 extern int
   1377 bcmi_ft_group_pdd_policy_profile_add(
   1378         int unit,
   1379         bcm_flowtracker_group_t id);
   1380 
   1381 extern int
   1382 bcmi_ft_group_pdd_policy_profile_delete(
   1383         int unit,
   1384         bcm_flowtracker_group_t id);
   1385 
   1386 extern int
   1387 bcmi_ft_group_pdd_to_pde_coversion(
   1388         int unit,
   1389         bcm_flowtracker_group_t id,
   1390         bsc_dt_pde_profile_entry_t *pde_entry);
   1391 
   1392 extern int
   1393 bcmi_ft_group_ft_mode_update(
   1394         int unit,
   1395         bcm_flowtracker_group_t id);
   1396 
   1397 /* Group install routines */
   1398 extern int
   1399 bcmi_ft_group_hw_install(int unit,
   1400                          bcm_flowtracker_group_t id);
   1401 
   1402 extern int
   1403 bcmi_ft_group_hw_uninstall(int unit,
   1404                            bcm_flowtracker_group_t id);
   1405 
   1406 extern int
   1407 bcmi_ft_group_norm_tracking_params_info_get(
   1408     int unit,
   1409     bcm_flowtracker_group_t id,
   1410     bcm_flowtracker_tracking_param_info_t **norm_tracking_params_info);
   1411 
   1412 extern int
   1413 bcmi_ft_group_export_checks_validate(int unit,
   1414         bcm_flowtracker_group_t id,
   1415         int num_in_export_elements,
   1416         bcm_flowtracker_export_element_info_t *in_export_elements);
   1417 
   1418 extern int
   1419 bcmi_ft_group_entry_add_check(int unit,
   1420         bcm_flowtracker_group_type_t group_type,
   1421         bcm_flowtracker_group_t id);
   1422 
   1423 extern bcm_flowtracker_tracking_param_type_t
   1424 bcmi_ft_group_get_tracking_param(int unit,
   1425         bcmi_ft_group_param_type_t pram_type);
   1426 
   1427 extern int
   1428 bcmi_ft_group_check_ts_set(int unit,
   1429         bcm_flowtracker_group_t id,
   1430         bcm_flowtracker_check_t flowchecker_id,
   1431         bcmi_flowtracker_check_set_t reset);
   1432 
   1433 extern int
   1434 bcmi_ft_group_ts_triggers_set(int unit,
   1435         bcm_flowtracker_group_t id,
   1436         bcmi_ft_type_t ft_type,
   1437         uint32 flags,
   1438         int trigger_type,
   1439         bcmi_flowtracker_check_set_t reset);
   1440 
   1441 extern bcmi_ft_group_param_type_t
   1442 bcmi_ft_group_get_ts_type(int unit,
   1443         bcm_flowtracker_group_t id,
   1444         int ts_bank);
   1445 
   1446 extern int
   1447 bcmi_ft_group_timestamp_set(int unit,
   1448           bcm_flowtracker_group_t id);
   1449 
   1450 extern void
   1451 bcmi_ft_group_timestamp_trig_info_clear(int unit,
   1452                       bcm_flowtracker_group_t id);
   1453 
   1454 extern void
   1455 bcmi_ft_group_param_ts_trig_info_clear(int unit,
   1456                       bcm_flowtracker_group_t id,
   1457                       uint32 *ts_triggers);
   1458 
   1459 extern void
   1460 bcmi_ft_group_param_int_ts_trig_info_clear(int unit,
   1461                       bcm_flowtracker_group_t id);
   1462 
   1463 extern void
   1464 bcmi_ft_group_param_ts_checkevent_trig_set(int unit,
   1465                       bcm_flowtracker_group_t id);
   1466 
   1467 extern int
   1468 bcmi_ft_alu_load_type_resolve(int unit,
   1469         bcm_flowtracker_group_t id,
   1470         bcmi_ft_group_alu_info_t *alu_info,
   1471         bcmi_ft_alu_load_type_t *type);
   1472 
   1473 extern int
   1474 bcmi_ft_group_ft_mode_recompute(int unit,
   1475         bcm_flowtracker_group_t id);
   1476 
   1477 extern int
   1478 bcmi_ft_group_new_learn_export_trigger_set(int unit,
   1479         bcm_flowtracker_group_t id,
   1480         uint32 flags,
   1481         uint32 val);
   1482 
   1483 extern int
   1484 bcmi_ft_group_new_learn_export_trigger_get(int unit,
   1485         bcm_flowtracker_group_t id,
   1486         uint32 *flags,
   1487         uint32 *val);
   1488 
   1489 extern int
   1490 bcmi_ft_group_timer_export_trigger_set(int unit,
   1491         bcm_flowtracker_group_t id,
   1492         uint32 val);
   1493 
   1494 extern int
   1495 bcmi_ft_group_timer_export_trigger_get(int unit,
   1496         bcm_flowtracker_group_t id,
   1497         uint32 *val);
   1498 
   1499 extern int bcmi_ft_group_flow_exceed_profile_set(int unit,
   1500         bcm_flowtracker_group_t id,
   1501         uint32 *kg_entry,
   1502         uint32 flags,
   1503         uint32 value);
   1504 
   1505 /*****************************************************
   1506  |           End -  FT Group utility Methods.        |
   1507  */
   1508 
   1509 
   1510 
   1511 
   1512 
   1513 
   1514 /*****************************************************
   1515  | Start -  FTFP utility Methods.                    |
   1516  */
   1517 extern int
   1518 bcmi_ft_group_extraction_alu_info_set(
   1519         int unit,
   1520         bcm_flowtracker_group_t id,
   1521         int key_or_data,
   1522         int num_alu_info,
   1523         bcmi_ft_group_alu_info_t *alu_info);
   1524 
   1525 extern int
   1526 bcmi_ft_group_extraction_alu_info_get(
   1527         int unit,
   1528         bcm_flowtracker_group_t id,
   1529         int key_or_data,
   1530         int max_alu_info,
   1531         bcmi_ft_group_alu_info_t *alu_info,
   1532         int *num_alu_info);
   1533 
   1534 extern int
   1535 bcmi_ft_group_extraction_hw_info_set(
   1536         int unit,
   1537         bcm_flowtracker_group_t id,
   1538         int key_or_data,
   1539         int num_elements,
   1540         bcmi_ft_hw_extractor_info_t *elements);
   1541 
   1542 extern int
   1543 bcmi_ft_group_extraction_hw_info_get(
   1544         int unit,
   1545         int key_or_data,
   1546         bcm_flowtracker_group_t id,
   1547         int max_elements,
   1548         bcmi_ft_hw_extractor_info_t *elements,
   1549         int *num_elements);
   1550 
   1551 extern int
   1552 bcmi_ft_group_extraction_mode_set(
   1553         int unit,
   1554         int key_or_data,
   1555         bcm_flowtracker_group_t id,
   1556         bcmi_ft_group_key_data_mode_t mode);
   1557 
   1558 extern int
   1559 bcmi_ft_group_extraction_mode_get(
   1560         int unit,
   1561         int key_or_data,
   1562         bcm_flowtracker_group_t id,
   1563         bcmi_ft_group_key_data_mode_t *mode);
   1564 
   1565 
   1566 extern int
   1567 bcmi_ft_group_session_key_type_set(
   1568         int unit,
   1569         bcm_flowtracker_group_t id,
   1570         uint32 key_type);
   1571 
   1572 extern int
   1573 bcmi_ft_group_session_key_type_get(
   1574         int unit,
   1575         bcm_flowtracker_group_t id,
   1576         uint32 *key_type);
   1577 
   1578 extern int
   1579 bcmi_ft_group_ftfp_profiles_get(
   1580         int unit,
   1581         bcm_flowtracker_group_t id,
   1582         bcmi_ft_session_profiles_t *profile_info);
   1583 
   1584 extern int
   1585 bcmi_ft_group_ftfp_profiles_set(
   1586         int unit,
   1587         bcm_flowtracker_group_t id,
   1588         bcmi_ft_session_profiles_t *profile_info);
   1589 
   1590 extern int
   1591 bcmi_ft_group_ftfp_data_get(
   1592         int unit,
   1593         bcm_flowtracker_group_t id,
   1594         bcmi_ft_group_ftfp_data_t *data);
   1595 
   1596 extern int
   1597 bcmi_ft_group_param_retrieve(int unit,
   1598         bcm_flowtracker_group_t id,
   1599         bcmi_ft_group_params_t param,
   1600         int *arg);
   1601 
   1602 extern int
   1603 bcmi_ft_group_param_update(int unit,
   1604         bcm_flowtracker_group_t id,
   1605         bcmi_ft_group_params_t param,
   1606         bcmi_ft_group_params_operation_t opr,
   1607         int arg);
   1608 
   1609 extern int
   1610 bcmi_ft_group_param_present(int unit,
   1611         bcm_flowtracker_group_t id,
   1612         bcm_flowtracker_tracking_param_type_t tparam,
   1613         int *index);
   1614 /*****************************************************
   1615  | End  -  FTFP utility Methods.                     |
   1616  */
   1617 
   1618 
   1619 
   1620 /*****************************************************
   1621  | Start - Warmboot Methods.                         |
   1622  */
   1623 
   1624 /* Recover PDD entry for group. */
   1625 extern int
   1626 bcmi_ft_group_pdd_pde_policy_recover(
   1627               int unit, bcm_flowtracker_group_t id);
   1628 
   1629 /* Recover group profiles. */
   1630 extern int
   1631 bcmi_ft_group_profile_recover(
   1632               int unit, bcm_flowtracker_group_t id);
   1633 
   1634 extern int
   1635 bcmi_ft_group_alu_load_wb_recover(
   1636               int unit, bcm_flowtracker_group_t id,
   1637               bcmi_ft_group_alu_info_t *info,
   1638               int *load16_indexes,
   1639               int *load8_indexes,
   1640               bcmi_ft_alu_load_type_t alu_load_type);
   1641 
   1642 extern int
   1643 bcmi_ft_recover(int unit);
   1644 
   1645 extern int
   1646 bcmi_ft_group_sw_reinstall(int unit, bcm_flowtracker_group_t id);
   1647 
   1648 extern int
   1649 bcmi_ft_sync(int unit);
   1650 
   1651 extern void
   1652 bcmi_ft_wb_alloc_size(int unit, int *size);
   1653 
   1654 extern int
   1655 bcmi_ft_warm_boot_alloc(int unit);
   1656 
   1657 /*****************************************************
   1658  | End - Warmboot Methods.                           |
   1659  */
   1660 
   1661 
   1662 /*****************************************************
   1663  | Start - ESW layer methods.                        |
   1664  */
   1665 extern int
   1666 bcm_esw_flowtracker_sync(int unit);
   1667 
   1668 extern int
   1669 bcm_esw_flowtracker_group_stat_set(int unit,
   1670                 bcm_flowtracker_group_t id,
   1671                 bcm_flowtracker_group_stat_t *group_stat);
   1672 /*****************************************************
   1673  | End - ESW layer methods.                          |
   1674  */
   1675 
   1676 
   1677 /*****************************************************
   1678  | Start - Flowtracker sw dump methods               |
   1679  */
   1680 extern void
   1681 bcmi_esw_flowtracker_sw_dump(int unit);
   1682 
   1683 extern void
   1684 bcmi_ft_state_dump(int unit, int brief);
   1685 
   1686 extern void
   1687 bcmi_ft_group_tracking_params_list(int unit,
   1688         uint16 ft_type_tmp);
   1689 
   1690 /*****************************************************
   1691  | End - Flowtracker sw dump methods                 |
   1692  */
   1693 
   1694 
   1695 
   1696 /*****************************************************
   1697  | Start - Flowtracker diag methods                  |
   1698  */
   1699 extern int
   1700 bcmi_ft_table_insert(int unit,
   1701                      bcm_ip_t dip,
   1702                      bcm_ip_t sip,
   1703                      uint16 l4destport,
   1704                      uint16 l4srcport,
   1705                      uint8 proto);
   1706 
   1707 extern int
   1708 bcmi_ft_table_lookup(int unit,
   1709                      bcm_flowtracker_group_t id,
   1710                      bcm_ip_t dip,
   1711                      bcm_ip_t sip,
   1712                      uint16 l4destport,
   1713                      uint16 l4srcport,
   1714                      uint8 proto,
   1715                      int *index);
   1716 
   1717 extern int
   1718 bcmi_ft_group_state_dump(int unit,
   1719                          bcm_flowtracker_group_t id,
   1720                          int brief);
   1721 
   1722 extern int
   1723 bcmi_ft_group_session_data_dump(int unit,
   1724                                 bcm_flowtracker_group_t id,
   1725                                 int index);
   1726 
   1727 extern int
   1728 bcmi_ft_alu32_dump(int unit,
   1729                    bcmi_ft_alu_load_type_t alu_load_type,
   1730                    int global_index);
   1731 
   1732 extern int
   1733 bcmi_ft_alu16_dump(int unit,
   1734                    int global_index);
   1735 
   1736 extern void
   1737 bcmi_ft_group_hw_entries_decode(int unit,
   1738         uint32 flags, bcm_flowtracker_group_t id,
   1739         char *table_name, int index, int count);
   1740 
   1741 /*****************************************************
   1742  | End - Flowtracker diag methods                    |
   1743  */
   1744 
   1745 /*****************************************************
   1746  | Start - ALU/LOAD HW structs & defines             |
   1747  */
   1748 int
   1749 bcmi_ft_group_alu16_trigger_set(
   1750     int unit,
   1751     int mem_idx,
   1752     int index,
   1753     bcm_flowtracker_direction_t direction);
   1754 
   1755 int
   1756 bcmi_ft_group_alu32_trigger_set(
   1757     int unit,
   1758     int mem_idx,
   1759     int index,
   1760     bcm_flowtracker_direction_t direction);
   1761 int
   1762 bcmi_ft_group_load8_trigger_set(
   1763     int unit,
   1764     int mem_idx,
   1765     int index,
   1766     bcm_flowtracker_direction_t direction);
   1767 
   1768 int
   1769 bcmi_ft_group_load16_trigger_set(
   1770     int unit,
   1771     int mem_idx,
   1772     int index,
   1773     bcm_flowtracker_direction_t direction);
   1774 
   1775 /*****************************************************
   1776  | End - ALU/LOAD HW structs & defines               |
   1777  */
   1778 
   1779 extern int
   1780 bcmi_ft_tracking_param_is_timestamp(int unit,
   1781         bcm_flowtracker_tracking_param_type_t t_param);
   1782 
   1783 extern bcmi_ft_group_param_type_t
   1784 bcmi_ft_group_get_param_type(int unit,
   1785         bcm_flowtracker_tracking_param_type_t t_param);
   1786 
   1787 extern bcmi_ft_group_param_type_t
   1788 bcmi_ft_group_get_ts_type(int unit,
   1789         bcm_flowtracker_group_t id,
   1790         soc_field_t fid);
   1791 
   1792 extern int
   1793 bcmi_ft_group_pdd_pde_policy_add(int unit,
   1794         bcm_flowtracker_group_t id);
   1795 
   1796 extern int
   1797 bcmi_ft_group_template_data_add(int unit,
   1798         bcm_flowtracker_group_t id,
   1799         int *load16_indexes,
   1800         int *load8_indexes);
   1801 
   1802 extern int
   1803 bcmi_ft_group_stage_pde_policy_add(int unit,
   1804         bcm_flowtracker_group_t id,
   1805         int index,
   1806         uint32 **pdd_entry_arr);
   1807 
   1808 extern int
   1809 bcmi_ft_group_export_pde_policy_add(int unit,
   1810         bcm_flowtracker_group_t id,
   1811         int index,
   1812         uint32 **pdd_entry_arr);
   1813 
   1814 extern int
   1815 bcmi_ft_group_extended_alu_info_process(int unit,
   1816         bcm_flowtracker_group_t id);
   1817 
   1818 extern int
   1819 bcmi_ft_group_template_data_add(int unit,
   1820         bcm_flowtracker_group_t id,
   1821         int *load16_indexes,
   1822         int *load8_indexes);
   1823 
   1824 extern int
   1825 bcmi_ft_group_ts_type_src_get(int unit,
   1826         bcm_flowtracker_group_t id,
   1827         int ts_type,
   1828         bcm_flowtracker_timestamp_source_t *ts_src);
   1829 
   1830 extern int
   1831 bcmi_ft_group_timestamp_trigger_bit_get(int unit,
   1832         bcm_flowtracker_group_t id,
   1833         int ts_type,
   1834         int *bit_sel);
   1835 
   1836 extern int
   1837 bcmi_ft_group_timestamp_trig_param_get(int unit,
   1838         bcm_flowtracker_group_t id,
   1839         int ts_type,
   1840         bcm_flowtracker_tracking_param_type_t *param);
   1841 
   1842 extern int
   1843 bcmi_ft_group_state_transition_type_get(int unit,
   1844         bcm_flowtracker_group_t id,
   1845         bcm_flowtracker_state_transition_type_t *st_type);
   1846 
   1847 extern int
   1848 bcmi_ft_control_set(int unit,
   1849         bcm_flowtracker_control_type_t type,
   1850         int arg);
   1851 
   1852 extern int
   1853 bcmi_ft_control_get(int unit,
   1854         bcm_flowtracker_control_type_t type,
   1855         int *arg);
   1856 
   1857 extern int
   1858 bcmi_ft_group_record_traverse(int unit,
   1859         bcm_flowtracker_group_t group_id,
   1860         bcm_flowtracker_group_record_type_t type,
   1861         bcm_flowtracker_group_record_traverse_cb cb,
   1862         void *user_data);
   1863 
   1864 extern int
   1865 bcmi_ft_group_checks_bitmap_get(
   1866         int unit,
   1867         bcm_flowtracker_group_t id,
   1868         uint32 num_checks,
   1869         bcm_field_flowtrackercheck_t *check_list,
   1870         uint32 *check_bmp_data,
   1871         uint32 *check_bmp_mask);
   1872 
   1873 extern int
   1874 bcmi_ft_group_checks_list_get(
   1875         int unit,
   1876         bcm_flowtracker_group_t id,
   1877         uint32 check_bmp_data,
   1878         uint32 check_bmp_mask,
   1879         uint32 num_checks,
   1880         bcm_field_flowtrackercheck_t *check_list,
   1881         uint32 *actual_num_checks);
   1882 
   1883 /*****************************************************
   1884  | Start - Flowtracker v2 methods                    |
   1885  */
   1886 #if defined(BCM_FLOWTRACKER_V2_SUPPORT)
   1887 extern int
   1888 bcmi_ftv2_group_ft_mode_update(int unit,
   1889                                bcm_flowtracker_group_t id);
   1890 
   1891 extern int
   1892 bcmi_ftv2_group_param_ts_src_get(int unit,
   1893                                  bcm_flowtracker_group_t id,
   1894                                  bcm_flowtracker_tracking_param_type_t tparam,
   1895                                  uint8 ts_flags,
   1896                                  bcm_flowtracker_timestamp_source_t *ts_src);
   1897 
   1898 extern int
   1899 bcmi_ftv2_legacy_group_pdd_policy_profile_add(int unit,
   1900                                               bcm_flowtracker_group_t id);
   1901 
   1902 extern int
   1903 bcmi_ftv2_legacy_group_template_data_create(int unit,
   1904                                      bcm_flowtracker_group_t id,
   1905                                      int *load16_indexes,
   1906                                      int *load8_indexes);
   1907 
   1908 extern int
   1909 bcmi_ftv2_internal_flowchecker_get(int unit,
   1910             bcm_flowtracker_check_t flowchecker_id,
   1911             bcmi_flowtracker_flowchecker_info_t *flow_check_info);
   1912 
   1913 extern int
   1914 bcmi_ftv2_group_internal_flowcheck_create(int unit,
   1915             bcm_flowtracker_group_t id,
   1916             bcm_flowtracker_tracking_param_type_t param,
   1917             bcmi_ft_group_alu_info_t *check_alu_info,
   1918             bcm_flowtracker_check_t *int_check_id);
   1919 
   1920 extern int
   1921 bcmi_ftv2_group_template_data_create(int unit,
   1922             bcm_flowtracker_group_t id,
   1923             int *load16_indexes,
   1924             int *load8_indexes);
   1925 
   1926 extern int
   1927 bcmi_ftv2_group_pdd_policy_profile_add(int unit,
   1928                     bcm_flowtracker_group_t id);
   1929 
   1930 extern int
   1931 bcmi_ftv2_group_pdd_to_pde_conversion(int unit,
   1932                     bcm_flowtracker_group_t id,
   1933                     bcmi_ft_type_t ft_type,
   1934                     uint32 flags,
   1935                     uint32 *pdd_entry,
   1936                     uint32 *pde_entry);
   1937 
   1938 extern int
   1939 bcmi_ftv2_data_engine_db_create(int unit,
   1940                     bcm_flowtracker_group_t id,
   1941                     int *load16_indexes,
   1942                     int *load8_indexes);
   1943 
   1944 extern int
   1945 bcmi_ftv2_group_internal_alu_info_add(int unit,
   1946                     bcm_flowtracker_group_t id);
   1947 
   1948 #endif /* BCM_FLOWTRACKER_V2_SUPPORT */
   1949 /*****************************************************
   1950  | End - Flowtracker v2 methods                      |
   1951  */
   1952 
   1953 
   1954 /*****************************************************
   1955  | Start - Flowtracker v3 methods                    |
   1956  */
   1957 #if defined(BCM_FLOWTRACKER_V3_SUPPORT)
   1958 extern int
   1959 bcmi_ftv3_group_aggregate_entry_update(int unit,
   1960         bcm_flowtracker_group_t id,
   1961         bcm_flowtracker_group_info_t *info,
   1962         int create);
   1963 
   1964 extern int
   1965 bcmi_ftv3_group_aggregate_template_data_create(int unit,
   1966         bcm_flowtracker_group_t id);
   1967 
   1968 extern int
   1969 bcmi_ftv3_alu_load_info_flags_set(
   1970         int unit,
   1971         bcm_flowtracker_group_t id,
   1972         bcmi_ft_group_alu_info_t *alu_info);
   1973 
   1974 extern int
   1975 bcmi_ftv3_user_entry_entry_add_check(int unit,
   1976         bcm_flowtracker_group_type_t group_type,
   1977         bcm_flowtracker_group_t id,
   1978         int flow_index);
   1979 
   1980 extern int
   1981 bcmi_ftv3_flow_transition_alu_trigger_set(int unit,
   1982         uint32 event_flag,
   1983         int index,
   1984         int set);
   1985 
   1986 extern int
   1987 bcmi_ftv3_group_flow_transition_state_set(int unit,
   1988         bcm_flowtracker_group_t id,
   1989         uint32 enable);
   1990 
   1991 extern int
   1992 bcmi_ftv3_aft_group_periodic_export_en(int unit,
   1993         bcm_flowtracker_group_t group_id,
   1994         uint32 enable);
   1995 
   1996 extern int
   1997 bcmi_ftv3_group_user_entry_hw_update(int unit,
   1998         bcm_flowtracker_group_t group_id,
   1999         int count);
   2000 
   2001 extern int
   2002 bcmi_ftv3_agg_group_record_traverse(int unit,
   2003         bcm_flowtracker_group_t group_id,
   2004         bcm_flowtracker_group_record_type_t type,
   2005         bcm_flowtracker_group_record_traverse_cb cb,
   2006         void *user_data);
   2007 
   2008 #endif /* BCM_FLOWTRACKER_V3_SUPPORT */
   2009 /*****************************************************
   2010  | End - Flowtracker v3 methods                      |
   2011  */
   2012 
   2013 #endif /* BCM_FLOWTRACKER_SUPPORT */
   2014 #endif /* _BCM_INT_FT_GROUP_H_ */