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

diag_alloc.h (5436B)


      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:        diag_alloc.h
      8  * Purpose:     
      9  */
     10 
     11 #ifndef   _DIAG_ALLOC_H_
     12 #define   _DIAG_ALLOC_H_
     13 
     14 #include <appl/diag/shell.h>
     15 #include <appl/diag/parse.h>
     16 
     17 #ifdef BCM_PETRA_SUPPORT
     18 #include <bcm_int/dpp/gport_mgmt.h>
     19 #include <soc/dpp/PPD/ppd_api_lif_table.h>
     20 #endif
     21 
     22 /* check if the gport is supported */
     23 #define diag_alloc_gport_type_is_supported(gport_id) (BCM_GPORT_IS_VLAN_PORT(gport_id) || BCM_GPORT_IS_MPLS_PORT(gport_id))
     24 
     25 
     26 /* *******************************************************************************************************
     27                                  enums and structs for diag alloc
     28  */
     29 
     30 /* parameters of diag alloc  */
     31 typedef struct
     32 {
     33     int from; /* optional parameter: start range, if unused -1  */
     34     int to; /* optional parameter: end range, if unused -1 */
     35     int info;  /* optional parameter: get more info from the current id */
     36     int direct;    /*optional parameter: get directly from hardware */
     37 } diag_alloc_system_table_parameters;
     38 
     39 typedef struct
     40 {
     41    const char     *poolDescription;
     42    const char     *poolName;
     43    const char     *shortPoolName;
     44    int            pool_id;
     45    cmd_result_t  (*info_print_cb) (int,int); /* define callback for print */
     46    cmd_result_t  (*cmd_diag_alloc_hw_block) (int, diag_alloc_system_table_parameters *); /* define callback for HW info print */
     47    
     48 } DIAG_ALLOC_POOL_DEF;
     49 
     50 /* exist resource */
     51 typedef enum diag_alloc_gport_resource_exist_e {
     52     diag_alloc_gport_resource_not_exist = 1,  /* SHOULD BE FIRST */
     53     diag_alloc_gport_resource_exist, 
     54     diag_alloc_gport_resource_remote
     55 } diag_alloc_gport_resource_exist_t;
     56 
     57 /* gport type supported in diag alloc gport */
     58 typedef enum diag_alloc_gport_info_gport_type_e {
     59     diag_alloc_gport_info_gport_type_vlan = 1, /* SHOULD BE FIRST */
     60     diag_alloc_gport_info_gport_type_mpls 
     61 } diag_alloc_gport_info_gport_type_t;
     62 
     63 
     64 /* encoding */
     65 typedef enum diag_alloc_gport_info_encoding_e {
     66     diag_alloc_gport_info_encoding_no_protection = 1, /*SHOULD BE FIRST */
     67     diag_alloc_gport_info_encoding_one_plus_one_protection, 
     68     diag_alloc_gport_info_encoding_one_one_protection
     69 } diag_alloc_gport_info_encoding_t ;
     70 
     71 
     72 /* params of the diag pp gport call */
     73 typedef struct
     74 {
     75   /* 
     76    * gport id
     77    */
     78    uint32 gport_id;
     79   /* 
     80    * indicate if the user wants general information on inLif,outLif,FEC MC-ID. 
     81    */
     82   uint32 resource;
     83   /* 
     84    * indicate if the user wants information on FEC db
     85    */
     86   uint32 forwarding_database;
     87   /* 
     88    * indicate if the user wants information on LIF database
     89    */
     90   uint32 lif_database;
     91 } DIAG_ALLOC_GPORT_PARAMS;
     92 
     93 #ifdef BCM_PETRA_SUPPORT
     94 /* diag pp gport infos */
     95 typedef struct
     96 {
     97     /* 
     98      * Gport type: VLAN, MPLS, ...
     99      */
    100     diag_alloc_gport_info_gport_type_t gport_type;
    101     /* 
    102      * Gport id
    103      */
    104     uint32 gport_id;
    105     /* 
    106      * GlobalInLif
    107      */
    108     int global_lif_id;
    109 
    110     /* 
    111      * inLif
    112      */
    113     int lif_id;
    114 
    115     /* 
    116      * outLif
    117      */
    118     int out_lif_id;
    119 
    120     /*
    121      * indicate if lif are remote
    122      */
    123     int is_remote;
    124 
    125     /* 
    126      * fec 
    127      */
    128     int fec_id;
    129 
    130     /* 
    131      * Forwarding info 
    132      */
    133     _BCM_GPORT_PHY_PORT_INFO *forwarding_info_data;
    134 
    135     /* 
    136      * multicast id
    137      */
    138     int multicast_id; 
    139 
    140     /* 
    141      * is the multicast is primary or secondary
    142      */
    143     int multicast_is_primary; 
    144 
    145     /* 
    146      * Encoding: 1+1 protection, No protection or 1:1 protection
    147      */
    148     diag_alloc_gport_info_encoding_t encoding;
    149 } DIAG_ALLOC_GPORT_INFO;
    150 
    151  
    152 
    153 
    154 /* Functions diag alloc */
    155 cmd_result_t
    156 cmd_dpp_diag_alloc(int unit, args_t* a); 
    157 
    158 void
    159 print_alloc_usage(int unit);
    160 
    161 cmd_result_t
    162 cmd_dpp_diag_tmplt(int unit, args_t* a); 
    163 
    164 void
    165 print_tmplt_usage(int unit);
    166 
    167 
    168 /* Utils function for diag pp gport:*/
    169 /* clear gport_param */
    170 void diag_alloc_gport_param_init(DIAG_ALLOC_GPORT_PARAMS* gport_params);
    171 /* clear gport_info */
    172 void diag_alloc_gport_info_init(DIAG_ALLOC_GPORT_INFO* gport_info);
    173 
    174 
    175 cmd_result_t 
    176 diag_alloc_gport_info_get(int unit, 
    177                           DIAG_ALLOC_GPORT_PARAMS* gport_params, 
    178                           DIAG_ALLOC_GPORT_INFO* gport_info);
    179 
    180 void 
    181 diag_alloc_gport_info_print(int unit, 
    182                             DIAG_ALLOC_GPORT_PARAMS* gport_params,
    183                             DIAG_ALLOC_GPORT_INFO* gport_info);
    184 
    185 int 
    186 cmd_diag_alloc_hw_fec_get_block_and_print(int unit, 
    187                                           SOC_PPC_FRWRD_FEC_MATCH_RULE *prm_rule, 
    188                                           SOC_SAND_TABLE_BLOCK_RANGE   *prm_block_range, 
    189                                           int                          block_size);
    190 
    191 int 
    192 cmd_diag_alloc_hw_lif_table_get_block_and_print(int unit, 
    193                                           SOC_PPC_LIF_TBL_TRAVERSE_MATCH_RULE *prm_rule, 
    194                                           SOC_SAND_TABLE_BLOCK_RANGE   *prm_block_range, 
    195                                           int                          block_size);
    196 cmd_result_t 
    197 dpp_diag_alloc_cosq_sched_print(int unit,
    198                                 int core,
    199                                 int flow_id,
    200                                 int flow_count,
    201                                 char* allocated_resource);
    202 #endif /* BCM_PETRA_SUPPORT */
    203 #endif /* _DIAG_ALLOC_H_ */
    204