techsupport.c (39316B)
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-2019 Broadcom Inc. All rights reserved. 6 * 7 * File: techsupport.c 8 * Purpose: This file contains the generic infrastructure code 9 * for techsupport utility. 10 */ 11 12 #include <appl/diag/parse.h> 13 #include <shared/bsl.h> 14 #include <bcm/error.h> 15 #include <appl/diag/shell.h> 16 #include <sal/core/time.h> 17 #include <appl/diag/techsupport.h> 18 #include <soc/drv.h> 19 #include <sal/appl/sal.h> 20 #include <bcm/types.h> 21 #include <soc/defs.h> 22 23 char command_techsupport_usage[] = 24 "Usages:\n\t" 25 #ifdef COMPILER_STRING_CONST_LIMIT 26 "techsupport <option> [args...]\n" 27 #else 28 "techsupport basic - collects basic config/setup information from switch\n\t" 29 "techSupport <feature_name> [diag] [reg] " 30 #ifndef BCM_SW_STATE_DUMP_DISABLE 31 "[mem] [list] [sw] [verbose]- collects feature specific debug information\n\t" 32 #else 33 "[mem] [list] [verbose]- collects feature specific debug information\n\t" 34 #endif /* BCM_SW_STATE_DUMP_DISABLE */ 35 "When <feature_name> is "COMMAND_ETRAP" - collects etrap related debug information\n\t" 36 "When <feature_name> is "COMMAND_INT" - collects int related debug information\n\t" 37 "When <feature_name> is "COMMAND_LATENCY_HISTOGRAM" - collects histogram related debug information\n\t" 38 "When <feature_name> is "COMMAND_ALPM" - collects alpm related debug information\n\t" 39 "When <feature_name> is "COMMAND_COS" - collects cos related debug information\n\t" 40 "When <feature_name> is "COMMAND_EFP" - collects efp related debug information\n\t" 41 "When <feature_name> is "COMMAND_IFP" - collects ifp related debug information\n\t" 42 "When <feature_name> is "COMMAND_LOAD_BALANCE" - collects RTAG7,DLB,ECMP and " 43 "trunk related debug information\n\t" 44 "When <feature_name> is "COMMAND_L3UC" - collects L3 unicast related debug information\n\t" 45 "When <feature_name> is "COMMAND_L3MC" - collects L3 multicast related debug information\n\t" 46 "When <feature_name> is "COMMAND_MPLS" - collects mpls related debug information\n\t" 47 "When <feature_name> is "COMMAND_MMU" - collects mmu related debug information\n\t" 48 "When <feature_name> is "COMMAND_NIV" - collects niv related debug information\n\t" 49 "When <feature_name> is "COMMAND_VFP" - collects vfp related debug information\n\t" 50 "When <feature_name> is "COMMAND_RIOT" - collects riot related debug information\n\t" 51 "When <feature_name> is "COMMAND_OAM" - collects oam related debug information\n\t" 52 "When <feature_name> is "COMMAND_VXLAN" - collects vxlan related debug information\n\t" 53 "When <feature_name> is "COMMAND_VLAN" - collects vlan related debug information\n\t" 54 "When <feature_name> is "COMMAND_TCB" - collects tcb related debug information\n\t" 55 "When <feature_name> is "COMMAND_DGM" - collects dgm related debug information\n\t" 56 "When <feature_name> is "COMMAND_PSTAT" - collects pstat related debug information\n\t" 57 "When <feature_name> is "COMMAND_FLEX_FLOW" - collects FlexFlow related debug information\n\t" 58 "When <feature_name> is "COMMAND_PHY" - collects Phy related debug information\n\t" 59 "When <feature_name> is "COMMAND_LEDUP" - collects CMIC led-processor debug information\n\t" 60 "When <feature_name> is "COMMAND_CMIC" - collects CMIC debug information\n\t" 61 "When <feature_name> is "COMMAND_CANCUN" - collects Cancun debug information\n\t" 62 "When <feature_name> is "COMMAND_VISIBILITY" - collects packet trace information for packet data\n\t" 63 "techsupport visibility file/data=<val> sourceport=<val> options=<flags> [raw]\n\t" 64 "file or data- packet data, sourceport- source port for packet, (mandatory)\n\t" 65 #ifdef BCM_WARM_BOOT_SUPPORT 66 "When <feature_name> is "COMMAND_WARMBOOT" - collects warmboot info\n\t" 67 #endif 68 "raw- dumps raw memory content (optional)\n\t" 69 "options- packet trace flags (optional)\n\t" 70 " - 0x1 BCM_PKT_TRACE_LEARN\n\t" 71 " - 0x2 BCM_PKT_TRACE_NO_IFP\n\t" 72 " - 0x4 BCM_PKT_TRACE_FORWARD\n\t" 73 " - 0x8 BCM_PKT_TRACE_DROP_TO_MMU\n\t" 74 " - 0x10 BCM_PKT_TRACE_DROP_TO_EGR\n" 75 #endif /* COMPILER_STRING_CONST_LIMIT */ 76 ; 77 extern cmd_result_t command_techsupport(int unit, args_t *a); 78 79 mbcm_techsupport_t *mbcm_techsupport[BCM_MAX_NUM_UNITS]; 80 81 #ifdef BCM_WARM_BOOT_SUPPORT 82 extern techsupport_data_t techsupport_warmboot_data; 83 #endif 84 85 extern techsupport_data_t techsupport_l3uc_trident2plus_data; 86 extern techsupport_data_t techsupport_l3mc_trident2plus_data; 87 extern techsupport_data_t techsupport_mmu_trident2plus_data; 88 extern techsupport_data_t techsupport_mpls_trident2plus_data; 89 extern techsupport_data_t techsupport_niv_trident2plus_data; 90 extern techsupport_data_t techsupport_riot_trident2plus_data; 91 extern techsupport_data_t techsupport_vxlan_trident2plus_data; 92 extern techsupport_data_t techsupport_vlan_trident2plus_data; 93 extern techsupport_data_t techsupport_ifp_trident2plus_data; 94 extern techsupport_data_t techsupport_vfp_trident2plus_data; 95 extern techsupport_data_t techsupport_efp_trident2plus_data; 96 extern techsupport_data_t techsupport_cos_trident2plus_data; 97 extern techsupport_data_t techsupport_loadbalance_trident2plus_data; 98 extern techsupport_data_t techsupport_oam_trident2plus_data; 99 extern techsupport_data_t techsupport_ledup_trident2plus_data; 100 101 /* Global structure that maintains different features for "Trident2plus" chipset */ 102 mbcm_techsupport_t mbcm_trident2plus_techsupport[] = { 103 {COMMAND_L3MC, &techsupport_l3mc_trident2plus_data}, 104 {COMMAND_L3UC, &techsupport_l3uc_trident2plus_data}, 105 {COMMAND_MMU, &techsupport_mmu_trident2plus_data}, 106 {COMMAND_MPLS, &techsupport_mpls_trident2plus_data}, 107 {COMMAND_NIV, &techsupport_niv_trident2plus_data}, 108 {COMMAND_RIOT, &techsupport_riot_trident2plus_data}, 109 {COMMAND_OAM, &techsupport_oam_trident2plus_data}, 110 {COMMAND_VXLAN, &techsupport_vxlan_trident2plus_data}, 111 {COMMAND_VLAN, &techsupport_vlan_trident2plus_data}, 112 {COMMAND_IFP, &techsupport_ifp_trident2plus_data}, 113 {COMMAND_VFP, &techsupport_vfp_trident2plus_data}, 114 {COMMAND_EFP, &techsupport_efp_trident2plus_data}, 115 {COMMAND_COS, &techsupport_cos_trident2plus_data}, 116 {COMMAND_LOAD_BALANCE, &techsupport_loadbalance_trident2plus_data}, 117 {COMMAND_LEDUP, &techsupport_ledup_trident2plus_data}, 118 #ifdef BCM_WARM_BOOT_SUPPORT 119 {COMMAND_WARMBOOT, &techsupport_warmboot_data}, 120 #endif 121 {NULL, NULL} /* Must be the last element in this structure */ 122 }; 123 124 extern techsupport_data_t techsupport_l3uc_apache_data; 125 extern techsupport_data_t techsupport_l3mc_apache_data; 126 extern techsupport_data_t techsupport_cos_apache_data; 127 extern techsupport_data_t techsupport_mmu_apache_data; 128 extern techsupport_data_t techsupport_ifp_apache_data; 129 extern techsupport_data_t techsupport_efp_apache_data; 130 extern techsupport_data_t techsupport_mpls_apache_data; 131 extern techsupport_data_t techsupport_vxlan_apache_data; 132 extern techsupport_data_t techsupport_vlan_apache_data; 133 extern techsupport_data_t techsupport_loadbalance_apache_data; 134 135 /* Global structure that maintains different features for "apache" chipset */ 136 mbcm_techsupport_t mbcm_apache_techsupport[] = { 137 {COMMAND_L3MC, &techsupport_l3mc_apache_data}, 138 {COMMAND_L3UC, &techsupport_l3uc_apache_data}, 139 {COMMAND_MMU, &techsupport_mmu_apache_data}, 140 {COMMAND_MPLS, &techsupport_mpls_apache_data}, 141 {COMMAND_NIV, &techsupport_niv_trident2plus_data}, 142 {COMMAND_RIOT, &techsupport_riot_trident2plus_data}, 143 {COMMAND_VXLAN, &techsupport_vxlan_apache_data}, 144 {COMMAND_VLAN, &techsupport_vlan_apache_data}, 145 {COMMAND_IFP, &techsupport_ifp_apache_data}, 146 {COMMAND_VFP, &techsupport_vfp_trident2plus_data}, 147 {COMMAND_EFP, &techsupport_efp_apache_data}, 148 {COMMAND_COS, &techsupport_cos_apache_data}, 149 {COMMAND_LOAD_BALANCE, &techsupport_loadbalance_apache_data}, 150 {COMMAND_LEDUP, &techsupport_ledup_trident2plus_data}, 151 #ifdef BCM_WARM_BOOT_SUPPORT 152 {COMMAND_WARMBOOT, &techsupport_warmboot_data}, 153 #endif 154 {NULL, NULL} /* Must be the last element in this structure */ 155 }; 156 157 #ifdef BCM_MONTEREY_SUPPORT 158 extern techsupport_data_t techsupport_mmu_monterey_data; 159 160 /* Global structure that maintains different features for "apache" chipset */ 161 mbcm_techsupport_t mbcm_monterey_techsupport[] = { 162 {COMMAND_L3MC, &techsupport_l3mc_apache_data}, 163 {COMMAND_L3UC, &techsupport_l3uc_apache_data}, 164 {COMMAND_MMU, &techsupport_mmu_monterey_data}, 165 {COMMAND_MPLS, &techsupport_mpls_apache_data}, 166 {COMMAND_NIV, &techsupport_niv_trident2plus_data}, 167 {COMMAND_RIOT, &techsupport_riot_trident2plus_data}, 168 {COMMAND_VXLAN, &techsupport_vxlan_apache_data}, 169 {COMMAND_VLAN, &techsupport_vlan_apache_data}, 170 {COMMAND_IFP, &techsupport_ifp_apache_data}, 171 {COMMAND_VFP, &techsupport_vfp_trident2plus_data}, 172 {COMMAND_EFP, &techsupport_efp_apache_data}, 173 {COMMAND_COS, &techsupport_cos_apache_data}, 174 {COMMAND_LOAD_BALANCE, &techsupport_loadbalance_apache_data}, 175 {COMMAND_LEDUP, &techsupport_ledup_trident2plus_data}, 176 #ifdef BCM_WARM_BOOT_SUPPORT 177 {COMMAND_WARMBOOT, &techsupport_warmboot_data}, 178 #endif 179 {NULL, NULL} /* Must be the last element in this structure */ 180 }; 181 #endif 182 183 #ifdef BCM_TOMAHAWK_SUPPORT 184 extern techsupport_data_t techsupport_vxlan_tomahawk_data; 185 extern techsupport_data_t techsupport_ifp_tomahawk_data; 186 extern techsupport_data_t techsupport_vfp_tomahawk_data; 187 extern techsupport_data_t techsupport_efp_tomahawk_data; 188 extern techsupport_data_t techsupport_mmu_tomahawk_data; 189 extern techsupport_data_t techsupport_oam_tomahawk_data; 190 extern techsupport_data_t techsupport_vlan_tomahawk_data; 191 extern techsupport_data_t techsupport_l3uc_tomahawk_data; 192 extern techsupport_data_t techsupport_l3mc_tomahawk_data; 193 extern techsupport_data_t techsupport_mpls_tomahawk_data; 194 extern techsupport_data_t techsupport_niv_tomahawk_data; 195 extern techsupport_data_t techsupport_loadbalance_tomahawk_data; 196 extern techsupport_data_t techsupport_cos_tomahawk_data; 197 extern techsupport_data_t techsupport_phy_tomahawk_data; 198 extern techsupport_data_t techsupport_ledup_tomahawk_data; 199 200 mbcm_techsupport_t mbcm_tomahawk_techsupport[] = { 201 {COMMAND_VXLAN, &techsupport_vxlan_tomahawk_data}, 202 {COMMAND_MMU, &techsupport_mmu_tomahawk_data}, 203 {COMMAND_OAM, &techsupport_oam_tomahawk_data}, 204 {COMMAND_IFP, &techsupport_ifp_tomahawk_data}, 205 {COMMAND_VFP, &techsupport_vfp_tomahawk_data}, 206 {COMMAND_EFP, &techsupport_efp_tomahawk_data}, 207 {COMMAND_VLAN, &techsupport_vlan_tomahawk_data}, 208 {COMMAND_L3UC, &techsupport_l3uc_tomahawk_data}, 209 {COMMAND_L3MC, &techsupport_l3mc_tomahawk_data}, 210 {COMMAND_MPLS, &techsupport_mpls_tomahawk_data}, 211 {COMMAND_NIV, &techsupport_niv_tomahawk_data}, 212 {COMMAND_LOAD_BALANCE, &techsupport_loadbalance_tomahawk_data}, 213 {COMMAND_COS, &techsupport_cos_tomahawk_data}, 214 {COMMAND_PHY, &techsupport_phy_tomahawk_data}, 215 {COMMAND_LEDUP, &techsupport_ledup_tomahawk_data}, 216 {COMMAND_VISIBILITY, NULL}, 217 #ifdef BCM_WARM_BOOT_SUPPORT 218 {COMMAND_WARMBOOT, &techsupport_warmboot_data}, 219 #endif 220 {NULL, NULL} /* Must be the last element in this structure */ 221 }; 222 #endif 223 224 #ifdef BCM_TRIDENT3_SUPPORT 225 extern techsupport_data_t techsupport_mpls_trident3_data; 226 extern techsupport_data_t techsupport_cos_trident3_data; 227 extern techsupport_data_t techsupport_mmu_trident3_data; 228 extern techsupport_data_t techsupport_vxlan_trident3_data; 229 extern techsupport_data_t techsupport_niv_trident3_data; 230 extern techsupport_data_t techsupport_vlan_trident3_data; 231 extern techsupport_data_t techsupport_flex_flow_trident3_data; 232 extern techsupport_data_t techsupport_riot_trident3_data; 233 extern techsupport_data_t techsupport_loadbalance_trident3_data; 234 extern techsupport_data_t techsupport_l3uc_trident3_data; 235 extern techsupport_data_t techsupport_l3mc_trident3_data; 236 extern techsupport_data_t techsupport_cmic_trident3_data; 237 extern techsupport_data_t techsupport_cancun_trident3_data; 238 extern techsupport_data_t techsupport_cancun_helix5_data; 239 240 mbcm_techsupport_t mbcm_trident3_techsupport[] = { 241 {COMMAND_IFP, &techsupport_ifp_tomahawk_data}, 242 {COMMAND_VFP, &techsupport_vfp_tomahawk_data}, 243 {COMMAND_EFP, &techsupport_efp_tomahawk_data}, 244 {COMMAND_MPLS,&techsupport_mpls_trident3_data}, 245 {COMMAND_COS, &techsupport_cos_trident3_data}, 246 {COMMAND_MMU, &techsupport_mmu_trident3_data}, 247 {COMMAND_VXLAN, &techsupport_vxlan_trident3_data}, 248 {COMMAND_NIV, &techsupport_niv_trident3_data}, 249 {COMMAND_VLAN, &techsupport_vlan_trident3_data}, 250 {COMMAND_RIOT, &techsupport_riot_trident3_data}, 251 {COMMAND_FLEX_FLOW, &techsupport_flex_flow_trident3_data}, 252 {COMMAND_LOAD_BALANCE, &techsupport_loadbalance_trident3_data}, 253 {COMMAND_L3UC, &techsupport_l3uc_trident3_data}, 254 {COMMAND_L3MC, &techsupport_l3mc_trident3_data}, 255 {COMMAND_CMIC, &techsupport_cmic_trident3_data}, 256 {COMMAND_VISIBILITY, NULL}, 257 #ifdef BCM_WARM_BOOT_SUPPORT 258 {COMMAND_WARMBOOT, &techsupport_warmboot_data}, 259 #endif 260 {COMMAND_CANCUN, &techsupport_cancun_trident3_data}, 261 {NULL, NULL} /* Must be the last element in this structure */ 262 }; 263 #endif 264 265 #ifdef BCM_HELIX5_SUPPORT 266 mbcm_techsupport_t mbcm_helix5_techsupport[] = { 267 {COMMAND_IFP, &techsupport_ifp_tomahawk_data}, 268 {COMMAND_VFP, &techsupport_vfp_tomahawk_data}, 269 {COMMAND_EFP, &techsupport_efp_tomahawk_data}, 270 {COMMAND_MPLS,&techsupport_mpls_trident3_data}, 271 {COMMAND_COS, &techsupport_cos_trident3_data}, 272 {COMMAND_MMU, &techsupport_mmu_trident3_data}, 273 {COMMAND_VXLAN, &techsupport_vxlan_trident3_data}, 274 {COMMAND_NIV, &techsupport_niv_trident3_data}, 275 {COMMAND_VLAN, &techsupport_vlan_trident3_data}, 276 {COMMAND_RIOT, &techsupport_riot_trident3_data}, 277 {COMMAND_FLEX_FLOW, &techsupport_flex_flow_trident3_data}, 278 {COMMAND_LOAD_BALANCE, &techsupport_loadbalance_trident3_data}, 279 {COMMAND_L3UC, &techsupport_l3uc_trident3_data}, 280 {COMMAND_L3MC, &techsupport_l3mc_trident3_data}, 281 {COMMAND_CMIC, &techsupport_cmic_trident3_data}, 282 {COMMAND_VISIBILITY, NULL}, 283 #ifdef BCM_WARM_BOOT_SUPPORT 284 {COMMAND_WARMBOOT, &techsupport_warmboot_data}, 285 #endif 286 {COMMAND_CANCUN, &techsupport_cancun_helix5_data}, 287 {NULL, NULL} /* Must be the last element in this structure */ 288 }; 289 #endif 290 291 #ifdef BCM_TOMAHAWK2_SUPPORT 292 extern techsupport_data_t techsupport_efp_tomahawk2_data; 293 extern techsupport_data_t techsupport_tcb_tomahawk2_data; 294 extern techsupport_data_t techsupport_dgm_tomahawk2_data; 295 extern techsupport_data_t techsupport_pstat_tomahawk2_data; 296 extern techsupport_data_t techsupport_vxlan_tomahawk2_data; 297 extern techsupport_data_t techsupport_mmu_tomahawk2_data; 298 extern techsupport_data_t techsupport_mpls_tomahawk2_data; 299 extern techsupport_data_t techsupport_loadbalance_tomahawk2_data; 300 extern techsupport_data_t techsupport_cos_tomahawk2_data; 301 extern techsupport_data_t techsupport_ledup_tomahawk2_data; 302 303 mbcm_techsupport_t mbcm_tomahawk2_techsupport[] = { 304 {COMMAND_IFP, &techsupport_ifp_tomahawk_data}, 305 {COMMAND_VFP, &techsupport_vfp_tomahawk_data}, 306 {COMMAND_EFP, &techsupport_efp_tomahawk2_data}, 307 {COMMAND_TCB, &techsupport_tcb_tomahawk2_data}, 308 {COMMAND_DGM, &techsupport_dgm_tomahawk2_data}, 309 {COMMAND_PSTAT, &techsupport_pstat_tomahawk2_data}, 310 {COMMAND_VLAN, &techsupport_vlan_tomahawk_data}, 311 {COMMAND_L3UC, &techsupport_l3uc_tomahawk_data}, 312 {COMMAND_L3MC, &techsupport_l3mc_tomahawk_data}, 313 {COMMAND_MPLS, &techsupport_mpls_tomahawk2_data}, 314 {COMMAND_NIV, &techsupport_niv_tomahawk_data}, 315 {COMMAND_LOAD_BALANCE, &techsupport_loadbalance_tomahawk2_data}, 316 {COMMAND_COS, &techsupport_cos_tomahawk2_data}, 317 {COMMAND_VXLAN, &techsupport_vxlan_tomahawk2_data}, 318 {COMMAND_MMU, &techsupport_mmu_tomahawk2_data}, 319 {COMMAND_PHY, &techsupport_phy_tomahawk_data}, 320 {COMMAND_LEDUP, &techsupport_ledup_tomahawk2_data}, 321 {COMMAND_VISIBILITY, NULL}, 322 #ifdef BCM_WARM_BOOT_SUPPORT 323 {COMMAND_WARMBOOT, &techsupport_warmboot_data}, 324 #endif 325 {NULL, NULL} /* Must be the last element in this structure */ 326 }; 327 #endif 328 329 #ifdef BCM_TRIDENT2_SUPPORT 330 extern techsupport_data_t techsupport_l3uc_trident2_data; 331 extern techsupport_data_t techsupport_l3mc_trident2_data; 332 extern techsupport_data_t techsupport_mmu_trident2_data; 333 extern techsupport_data_t techsupport_mpls_trident2_data; 334 extern techsupport_data_t techsupport_niv_trident2_data; 335 extern techsupport_data_t techsupport_vxlan_trident2_data; 336 extern techsupport_data_t techsupport_vlan_trident2_data; 337 extern techsupport_data_t techsupport_cos_trident2_data; 338 extern techsupport_data_t techsupport_loadbalance_trident2_data; 339 extern techsupport_data_t techsupport_efp_trident2_data; 340 extern techsupport_data_t techsupport_ifp_trident2_data; 341 extern techsupport_data_t techsupport_oam_trident2_data; 342 343 mbcm_techsupport_t mbcm_trident2_techsupport[] = { 344 {COMMAND_L3MC, &techsupport_l3mc_trident2_data}, 345 {COMMAND_L3UC, &techsupport_l3uc_trident2_data}, 346 {COMMAND_MMU, &techsupport_mmu_trident2_data}, 347 {COMMAND_OAM, &techsupport_oam_trident2_data}, 348 {COMMAND_COS, &techsupport_cos_trident2_data}, 349 {COMMAND_LOAD_BALANCE, &techsupport_loadbalance_trident2_data}, 350 {COMMAND_MPLS, &techsupport_mpls_trident2_data}, 351 {COMMAND_NIV, &techsupport_niv_trident2_data}, 352 {COMMAND_VXLAN, &techsupport_vxlan_trident2_data}, 353 {COMMAND_VLAN, &techsupport_vlan_trident2_data}, 354 /*Intentionally using td2plus data set for td2 355 * as there is no change in data for IFP/VFP*/ 356 {COMMAND_VFP, &techsupport_vfp_trident2plus_data}, 357 {COMMAND_IFP, &techsupport_ifp_trident2_data}, 358 {COMMAND_EFP, &techsupport_efp_trident2_data}, 359 #ifdef BCM_WARM_BOOT_SUPPORT 360 {COMMAND_WARMBOOT, &techsupport_warmboot_data}, 361 #endif 362 {NULL, NULL} /* Must be the last element in this structure */ 363 }; 364 #endif 365 366 #ifdef BCM_SABER2_SUPPORT 367 extern techsupport_data_t techsupport_l3uc_saber2_data; 368 extern techsupport_data_t techsupport_l3mc_saber2_data; 369 extern techsupport_data_t techsupport_mmu_saber2_data; 370 extern techsupport_data_t techsupport_mpls_saber2_data; 371 extern techsupport_data_t techsupport_niv_saber2_data; 372 extern techsupport_data_t techsupport_vxlan_saber2_data; 373 extern techsupport_data_t techsupport_vlan_saber2_data; 374 extern techsupport_data_t techsupport_cos_saber2_data; 375 extern techsupport_data_t techsupport_loadbalance_saber2_data; 376 extern techsupport_data_t techsupport_vfp_saber2_data; 377 extern techsupport_data_t techsupport_efp_saber2_data; 378 extern techsupport_data_t techsupport_ifp_saber2_data; 379 extern techsupport_data_t techsupport_oam_saber2_data; 380 381 mbcm_techsupport_t mbcm_saber2_techsupport[] = { 382 {COMMAND_L3MC, &techsupport_l3mc_saber2_data}, 383 {COMMAND_L3UC, &techsupport_l3uc_saber2_data}, 384 {COMMAND_MMU, &techsupport_mmu_saber2_data}, 385 {COMMAND_COS, &techsupport_cos_saber2_data}, 386 {COMMAND_LOAD_BALANCE, &techsupport_loadbalance_saber2_data}, 387 {COMMAND_MPLS, &techsupport_mpls_saber2_data}, 388 {COMMAND_NIV, &techsupport_niv_saber2_data}, 389 {COMMAND_VLAN, &techsupport_vlan_saber2_data}, 390 {COMMAND_VFP, &techsupport_vfp_saber2_data}, 391 {COMMAND_IFP, &techsupport_ifp_saber2_data}, 392 {COMMAND_EFP, &techsupport_efp_saber2_data}, 393 {COMMAND_OAM, &techsupport_oam_saber2_data}, 394 #ifdef BCM_WARM_BOOT_SUPPORT 395 {COMMAND_WARMBOOT, &techsupport_warmboot_data}, 396 #endif 397 {NULL, NULL} /* Must be the last element in this structure */ 398 }; 399 #endif 400 401 402 #if defined BCM_TOMAHAWK3_SUPPORT 403 extern techsupport_data_t techsupport_cos_tomahawk3_data; 404 extern techsupport_data_t techsupport_vlan_tomahawk3_data; 405 extern techsupport_data_t techsupport_ifp_tomahawk3_data; 406 extern techsupport_data_t techsupport_cmic_trident3_data; 407 extern techsupport_data_t techsupport_mpls_tomahawk3_data; 408 extern techsupport_data_t techsupport_loadbalance_tomahawk3_data; 409 extern techsupport_data_t techsupport_mmu_tomahawk3_data; 410 extern techsupport_data_t techsupport_etrap_tomahawk3_data; 411 extern techsupport_data_t techsupport_dgm_tomahawk3_data; 412 extern techsupport_data_t techsupport_efp_tomahawk3_data; 413 extern techsupport_data_t techsupport_phy_tomahawk3_data; 414 extern techsupport_data_t techsupport_pstat_tomahawk3_data; 415 extern techsupport_data_t techsupport_ledup_tomahawk3_data; 416 extern techsupport_data_t techsupport_int_tomahawk3_data; 417 extern techsupport_data_t techsupport_l3uc_tomahawk3_data; 418 extern techsupport_data_t techsupport_histogram_tomahawk3_data; 419 extern techsupport_data_t techsupport_vfp_tomahawk3_data; 420 extern techsupport_data_t techsupport_alpm_tomahawk3_data; 421 extern techsupport_data_t techsupport_l3mc_tomahawk3_data; 422 423 mbcm_techsupport_t mbcm_tomahawk3_techsupport[] = { 424 {COMMAND_COS, &techsupport_cos_tomahawk3_data}, 425 {COMMAND_VLAN, &techsupport_vlan_tomahawk3_data}, 426 {COMMAND_IFP, &techsupport_ifp_tomahawk3_data}, 427 {COMMAND_CMIC, &techsupport_cmic_trident3_data}, 428 {COMMAND_MPLS, &techsupport_mpls_tomahawk3_data}, 429 {COMMAND_LOAD_BALANCE, &techsupport_loadbalance_tomahawk3_data}, 430 {COMMAND_MMU, &techsupport_mmu_tomahawk3_data}, 431 {COMMAND_ETRAP, &techsupport_etrap_tomahawk3_data}, 432 {COMMAND_DGM, &techsupport_dgm_tomahawk3_data}, 433 {COMMAND_EFP, &techsupport_efp_tomahawk3_data}, 434 {COMMAND_PHY, &techsupport_phy_tomahawk3_data}, 435 {COMMAND_PSTAT, &techsupport_pstat_tomahawk3_data}, 436 {COMMAND_LEDUP, &techsupport_ledup_tomahawk3_data}, 437 {COMMAND_INT, &techsupport_int_tomahawk3_data}, 438 {COMMAND_L3UC, &techsupport_l3uc_tomahawk3_data}, 439 {COMMAND_LATENCY_HISTOGRAM, &techsupport_histogram_tomahawk3_data}, 440 {COMMAND_VFP, &techsupport_vfp_tomahawk3_data}, 441 {COMMAND_ALPM, &techsupport_alpm_tomahawk3_data}, 442 {COMMAND_L3MC, &techsupport_l3mc_tomahawk3_data}, 443 {COMMAND_VISIBILITY, NULL}, 444 #ifdef BCM_WARM_BOOT_SUPPORT 445 {COMMAND_WARMBOOT, &techsupport_warmboot_data}, 446 #endif 447 {NULL, NULL} /* Must be the last element in this structure */ 448 }; 449 #endif /* BCM_TOMAHAWK3_SUPPORT */ 450 451 452 #ifdef BCM_HELIX5_SUPPORT 453 soc_reg_t hx5_cmic_broadsync_reg_skip_list [] = { 454 CMIC_BROADSYNC_REF_CLK_GEN_CTRLr, 455 CMIC_BS0_CLK_CTRLr, 456 CMIC_BS0_CONFIGr, 457 CMIC_BS0_HEARTBEAT_CTRLr, 458 CMIC_BS0_HEARTBEAT_DOWN_DURATIONr, 459 CMIC_BS0_HEARTBEAT_UP_DURATIONr, 460 CMIC_BS0_INITIAL_CRCr, 461 CMIC_BS0_INPUT_TIME_0r, 462 CMIC_BS0_INPUT_TIME_1r, 463 CMIC_BS0_INPUT_TIME_2r, 464 CMIC_BS0_OUTPUT_TIME_0r, 465 CMIC_BS0_OUTPUT_TIME_1r, 466 CMIC_BS0_OUTPUT_TIME_2r, 467 CMIC_BS1_CLK_CTRLr, 468 CMIC_BS1_CONFIGr, 469 CMIC_BS1_HEARTBEAT_CTRLr, 470 CMIC_BS1_HEARTBEAT_DOWN_DURATIONr, 471 CMIC_BS1_HEARTBEAT_UP_DURATIONr, 472 CMIC_BS1_INITIAL_CRCr, 473 CMIC_BS1_INPUT_TIME_0r, 474 CMIC_BS1_INPUT_TIME_1r, 475 CMIC_BS1_INPUT_TIME_2r, 476 CMIC_BS1_OUTPUT_TIME_0r, 477 CMIC_BS1_OUTPUT_TIME_1r, 478 CMIC_BS1_OUTPUT_TIME_2r 479 }; 480 #endif 481 482 static struct techsupport_cmd { 483 const char *techsupport_cmd; 484 int (*techsupport_func) (int unit, args_t *a, 485 techsupport_data_t *techsupport_feature_data); 486 } techsupport_cmds[] = { 487 {COMMAND_BASIC, techsupport_basic}, 488 {COMMAND_L3MC, techsupport_l3mc}, 489 {COMMAND_L3UC, techsupport_l3uc}, 490 {COMMAND_MMU, techsupport_mmu}, 491 {COMMAND_MPLS, techsupport_mpls}, 492 {COMMAND_NIV, techsupport_niv}, 493 {COMMAND_RIOT, techsupport_riot}, 494 {COMMAND_VLAN, techsupport_vlan}, 495 {COMMAND_VXLAN, techsupport_vxlan}, 496 {COMMAND_IFP, techsupport_ifp}, 497 {COMMAND_VFP, techsupport_vfp}, 498 {COMMAND_EFP, techsupport_efp}, 499 {COMMAND_COS, techsupport_cos}, 500 {COMMAND_LOAD_BALANCE, techsupport_loadbalance}, 501 {COMMAND_OAM, techsupport_oam}, 502 {COMMAND_TCB, techsupport_tcb}, 503 {COMMAND_DGM, techsupport_dgm}, 504 {COMMAND_PSTAT, techsupport_pstat}, 505 {COMMAND_FLEX_FLOW, techsupport_flex_flow}, 506 {COMMAND_PHY, techsupport_phy}, 507 {COMMAND_LEDUP, techsupport_ledup}, 508 {COMMAND_CMIC, techsupport_cmic}, 509 {COMMAND_VISIBILITY, techsupport_visibility}, 510 #ifdef BCM_WARM_BOOT_SUPPORT 511 {COMMAND_WARMBOOT, techsupport_warmboot}, 512 #endif 513 {COMMAND_ETRAP, techsupport_etrap}, 514 {COMMAND_INT, techsupport_int}, 515 {COMMAND_LATENCY_HISTOGRAM, techsupport_histogram}, 516 {COMMAND_ALPM, techsupport_alpm}, 517 {COMMAND_CANCUN, techsupport_cancun}, 518 {NULL, NULL } /* Must be the last element in this structure */ 519 }; 520 521 /* Function: techsupport_calc_and_print_time_taken 522 * Purpose : Calculate and print the take taken 523 * Parameters: start_time - start time in seconds 524 * end_time - end time in seconds 525 * str - string. 526 * print_header_footer_string - 1 or 0 527 */ 528 void techsupport_calc_and_print_time_taken(sal_time_t start_time, 529 sal_time_t end_time, char *str, 530 int print_header_footer_string) 531 { 532 unsigned long hrs, mins, secs; 533 sal_time_t time_diff; 534 535 if (end_time < start_time) { 536 return ; 537 } 538 539 time_diff = end_time - start_time; 540 secs = time_diff % 60; 541 time_diff = time_diff / 60; 542 mins = time_diff % 60; 543 hrs = time_diff / 60; 544 545 if ((0 != secs) || (0 != mins) || (0 != hrs)) { 546 if (1 == print_header_footer_string) { 547 cli_out("\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); 548 } 549 cli_out("\nTime taken to execute \"%s\"" 550 " is %02d:%02d:%02d (hh:mm:ss).\n", str, (int)hrs, (int)mins, (int)secs); 551 if (1 == print_header_footer_string) { 552 cli_out(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"); 553 } 554 } 555 return; 556 } 557 /* Function: techsupport_command_execute 558 * Purpose : Executes the specified "command" and prints the time 559 * taken to execute the specified "command". 560 * Parameters: unit - Unit number 561 * command - pointer to command. 562 */ 563 void 564 techsupport_command_execute(int unit, char *command) 565 { 566 int diff = 0, diff1 = 0, j = 0; 567 char str[MAX_STR_LEN] = {0}; 568 char *pattern1 = "Output of \""; 569 char *pattern2 = "\" start"; 570 char *pattern3 = "\" end"; 571 sal_time_t start_time, end_time; 572 /* Before actually dumping the command output, head string is 573 * printed. Example of head string is something like below. 574 * >>>>>>>>>>>>>>>>>>>>>>Output of "config show" start>>>>>>>>>>>>>>>>>>> 575 * The below logic froms the head string. 576 */ 577 memset(str, 0, MAX_STR_LEN); 578 diff = MAX_STR_LEN - (strlen(command) + strlen(pattern1) + strlen(pattern2)); 579 diff = (diff % 2) == 0 ? diff : ( diff + 1 ); 580 581 for (j=0; j < (diff / 2); j++) { 582 str[j]='>'; 583 } 584 585 cli_out("\n%s%s%s%s%s\n\n", str, pattern1, command, pattern2,str); 586 start_time = sal_time(); 587 sh_process_command(unit, command); 588 end_time = sal_time(); 589 590 /* After dumping the command output, tail string is 591 * printed. Example of tail string is something like below. 592 * <<<<<<<<<<<<<<<<<<<<<<Output of "config show" end<<<<<<<<<<<<<<<<<<<<<<< 593 * The below logic froms the tail string. 594 */ 595 596 memset(str, 0, MAX_STR_LEN); 597 diff1 = MAX_STR_LEN - (strlen(command) + strlen(pattern1) + strlen(pattern3)); 598 diff1 = (diff1 % 2) == 0 ? diff1 : ( diff1 + 1 ); 599 600 for (j=0; j < (diff1 / 2); j++) { 601 str[j]='<'; 602 } 603 cli_out("\n%s%s%s%s%s\n", str, pattern1, command, pattern3, str); 604 605 techsupport_calc_and_print_time_taken(start_time, end_time, command, 0); 606 } 607 /* Function: techsupport_feature_process 608 * Purpose : Executes the following 609 * 1) diag shell comands(techsupport_feature_data->techsupport_data_diag_cmdlist[]) 610 * 2) dumps the memories(techsupport_feature_data->techsupport_data_mem_list[]) 611 * 3) dumps the registers(techsupport_feature_data->techsupport_data_reg_list[]) 612 * Parameters: unit - Unit number 613 * a - pointer to argument. 614 * techsupport_data_t -structure that maintains per chip per feature debug info. 615 * Returns: CMD_OK :done 616 * CMD_FAIL : INVALID INPUT 617 */ 618 int 619 techsupport_feature_process(int unit, args_t *a, 620 techsupport_data_t *techsupport_feature_data) 621 { 622 int i=0; 623 char *arg1; 624 char command_str[MAX_STR_LEN] ={0}, command_options_flag = 0, dump_all = 1; 625 char dont_execute = 0; 626 #ifdef BCM_HELIX5_SUPPORT 627 int j = 0, skip_hx5_cmic_reg = 0; 628 #endif 629 630 /* By default, dump only the changes */ 631 command_options_flag |= DUMP_TABLE_CHANGED; 632 633 /* Parse the options */ 634 arg1 = ARG_GET(a); 635 for (;;) { 636 if (arg1 != NULL && !sal_strcasecmp(arg1, VERBOSE)) { 637 command_options_flag &= ~(DUMP_TABLE_CHANGED); 638 arg1 = ARG_GET(a); 639 } else if (arg1 != NULL && !sal_strcasecmp(arg1, REG)) { 640 command_options_flag |= DUMP_REGISTERS; 641 arg1 = ARG_GET(a); 642 dump_all = 0; 643 } else if (arg1 != NULL && !sal_strcasecmp(arg1, MEM)) { 644 command_options_flag |= DUMP_MEMORIES; 645 arg1 = ARG_GET(a); 646 dump_all = 0; 647 } else if (arg1 != NULL && !sal_strcasecmp(arg1, DIAG)) { 648 command_options_flag |= DUMP_DIAG_CMDS; 649 arg1 = ARG_GET(a); 650 dump_all = 0; 651 #ifndef BCM_SW_STATE_DUMP_DISABLE 652 } else if (arg1 != NULL && !sal_strcasecmp(arg1, SW)) { 653 command_options_flag |= DUMP_SW; 654 arg1 = ARG_GET(a); 655 dump_all = 0; 656 #endif /* BCM_SW_STATE_DUMP_DISABLE */ 657 } else if (arg1 != NULL && !sal_strcasecmp(arg1, LIST)) { 658 command_options_flag |= DUMP_LIST; 659 arg1 = ARG_GET(a); 660 /* if "list" option is specified, just list out the following 661 * with out executing. 662 * 1)diag commands 663 * 2)Memory names 664 * 3)Register names 665 * 4)software dump commands 666 */ 667 dont_execute = 1; 668 } 669 else { 670 break; 671 } 672 } 673 674 /* Displays the output of feature specific diag commands */ 675 if (dump_all == 1 || (command_options_flag & DUMP_DIAG_CMDS)) { 676 if (1 == dont_execute) { 677 cli_out("\nList of Diag commands:\n"); 678 cli_out(">>>>>>>>>>>>>>>>>>>>>>\n"); 679 } 680 for(i = 0; techsupport_feature_data->techsupport_data_diag_cmdlist[i] != NULL; i++) { 681 if (1 == dont_execute) { 682 cli_out("%s\n", techsupport_feature_data->techsupport_data_diag_cmdlist[i]); 683 } else { 684 techsupport_command_execute(unit, techsupport_feature_data->techsupport_data_diag_cmdlist[i]); 685 } 686 } 687 688 for(i = 0; techsupport_feature_data->techsupport_data_device_diag_cmdlist[i] != NULL; i++) { 689 if (1 == dont_execute) { 690 cli_out("%s\n", techsupport_feature_data->techsupport_data_device_diag_cmdlist[i]); 691 } else { 692 techsupport_command_execute(unit, techsupport_feature_data->techsupport_data_device_diag_cmdlist[i]); 693 } 694 695 } 696 697 } 698 699 /* Dumps feature specific memory tables */ 700 if (dump_all == 1 || (command_options_flag & DUMP_MEMORIES)) { 701 if (1 == dont_execute) { 702 cli_out("\nList of Memory Table names:\n"); 703 cli_out(">>>>>>>>>>>>>>>>>>>>>>>>>>>\n"); 704 } 705 for (i=0; techsupport_feature_data->techsupport_data_mem_list[i] != INVALIDm ; i++) { 706 if (1 == dont_execute) { 707 cli_out("%s\n", SOC_MEM_UFNAME(unit, techsupport_feature_data->techsupport_data_mem_list[i])); 708 } else { 709 if (SOC_MEM_IS_VALID(unit, techsupport_feature_data->techsupport_data_mem_list[i])) { 710 sal_strncpy(command_str, DUMP, sizeof(DUMP)); 711 712 if (command_options_flag & DUMP_TABLE_CHANGED) { 713 sal_strncat(command_str, CHANGE, (MAX_STR_LEN - strlen(command_str) - 1)); 714 } 715 sal_strncat(command_str, 716 SOC_MEM_UFNAME(unit, techsupport_feature_data->techsupport_data_mem_list[i]), 717 (MAX_STR_LEN - strlen(command_str) - 1)); 718 techsupport_command_execute(unit, command_str); 719 } 720 } 721 } 722 } 723 724 #ifndef BCM_SW_STATE_DUMP_DISABLE 725 /* Displays the output of sofware dump diag commands */ 726 if (dump_all == 1 || (command_options_flag & DUMP_SW)) { 727 if (1 == dont_execute) { 728 cli_out("\nSoftware dump commands:\n"); 729 cli_out(">>>>>>>>>>>>>>>>>>>>>>\n"); 730 } 731 for(i = 0; techsupport_feature_data->techsupport_data_sw_dump_cmdlist[i] != NULL; i++) { 732 if (1 == dont_execute) { 733 cli_out("%s\n", techsupport_feature_data->techsupport_data_sw_dump_cmdlist[i]); 734 } else { 735 techsupport_command_execute(unit, techsupport_feature_data->techsupport_data_sw_dump_cmdlist[i]); 736 } 737 } 738 739 for(i = 0; techsupport_feature_data->techsupport_data_device_sw_dump_cmdlist[i] != NULL; i++) { 740 if (1 == dont_execute) { 741 cli_out("%s\n", techsupport_feature_data->techsupport_data_device_sw_dump_cmdlist[i]); 742 } else { 743 techsupport_command_execute(unit, techsupport_feature_data->techsupport_data_device_sw_dump_cmdlist[i]); 744 } 745 746 } 747 748 } 749 #endif /* BCM_SW_STATE_DUMP_DISABLE */ 750 751 /* Dumps feature specific registers */ 752 if (dump_all == 1 || (command_options_flag & DUMP_REGISTERS)) { 753 if (1 == dont_execute) { 754 cli_out("\nList of Registers:\n"); 755 cli_out(">>>>>>>>>>>>>>>>>>\n"); 756 } 757 for (i = 0; techsupport_feature_data->techsupport_data_reg_list[i].reg != INVALIDr; i++) { 758 if (1 == dont_execute) { 759 cli_out("%s\n", SOC_REG_NAME(unit, techsupport_feature_data->techsupport_data_reg_list[i].reg)); 760 } else { 761 if(SOC_REG_IS_VALID(unit, techsupport_feature_data->techsupport_data_reg_list[i].reg)) { 762 #ifdef BCM_HELIX5_SUPPORT 763 if (SOC_IS_HELIX5(unit)) { 764 skip_hx5_cmic_reg = 0; 765 /* Check if this is a skipped a reg on HX5. if so just continue */ 766 for (j = 0; j < (COUNTOF(hx5_cmic_broadsync_reg_skip_list)); j++) { 767 if (techsupport_feature_data->techsupport_data_reg_list[i].reg == 768 hx5_cmic_broadsync_reg_skip_list[j]) { 769 skip_hx5_cmic_reg = 1; 770 break; 771 } 772 } 773 774 if (skip_hx5_cmic_reg) { 775 continue; 776 } 777 } 778 #endif /* BCM_HELIX5_SUPPORT */ 779 sal_strncpy(command_str, GET_REG, sizeof(GET_REG)); 780 if (command_options_flag & DUMP_TABLE_CHANGED){ 781 sal_strncat(command_str, CHANGE, (MAX_STR_LEN - strlen(command_str) - 1)); 782 } 783 sal_strncat(command_str, SOC_REG_NAME(unit, techsupport_feature_data->techsupport_data_reg_list[i].reg), 784 (MAX_STR_LEN - strlen(command_str) - 1)); 785 techsupport_command_execute(unit, command_str); 786 } 787 } 788 } 789 } 790 return CMD_OK; 791 } 792 /* Function: command_techsupport 793 * Purpose : Displays all the debug info for a given subfeature. 794 * Parameters: unit - Unit number 795 * a - pointer to argument. 796 * Returns: CMD_OK :done 797 * CMD_FAIL : INVALID INPUT 798 */ 799 cmd_result_t 800 command_techsupport(int unit, args_t *a) 801 { 802 int rc = CMD_OK; 803 sal_time_t start_time = 0, end_time = 0; 804 char *feature_name = ARG_GET(a); 805 char feature_name_supported_flag = 0; 806 struct techsupport_cmd *command; 807 techsupport_data_t *techsupport_feature_data; 808 mbcm_techsupport_t *mbcm_techsupport_ptr; 809 char str[MAX_STR_LEN] ={0}; 810 if (feature_name == NULL) { 811 return CMD_USAGE; 812 } 813 814 if (sal_strcasecmp(feature_name, "basic") == 0) { 815 start_time = sal_time(); 816 rc = techsupport_basic(unit, a, NULL); 817 end_time = sal_time(); 818 } 819 else { 820 if (NULL == mbcm_techsupport[unit]) { 821 #if defined BCM_TOMAHAWK3_SUPPORT 822 if(SOC_IS_TOMAHAWK3(unit)) { 823 mbcm_techsupport[unit] = mbcm_tomahawk3_techsupport; 824 } else 825 #endif /* BCM_TOMAHAWK3_SUPPORT */ 826 if (SOC_IS_TRIDENT2PLUS(unit)) { 827 mbcm_techsupport[unit] = mbcm_trident2plus_techsupport; 828 } 829 #ifdef BCM_MONTEREY_SUPPORT 830 else if (SOC_IS_MONTEREY(unit)) { 831 mbcm_techsupport[unit] = mbcm_monterey_techsupport; 832 } 833 #endif 834 #ifdef BCM_APACHE_SUPPORT 835 else if (SOC_IS_APACHE(unit)) { 836 mbcm_techsupport[unit] = mbcm_apache_techsupport; 837 } 838 #endif 839 #ifdef BCM_SABER2_SUPPORT 840 else if (SOC_IS_SABER2(unit)) { 841 mbcm_techsupport[unit] = mbcm_saber2_techsupport; 842 } 843 #endif 844 #ifdef BCM_TRIDENT2_SUPPORT 845 else if (SOC_IS_TRIDENT2(unit)) { 846 mbcm_techsupport[unit] = mbcm_trident2_techsupport; 847 } 848 #endif 849 #ifdef BCM_TOMAHAWK2_SUPPORT 850 else if (SOC_IS_TOMAHAWK2(unit)) { 851 mbcm_techsupport[unit] = mbcm_tomahawk2_techsupport; 852 } 853 #endif 854 #ifdef BCM_TOMAHAWK_SUPPORT 855 else if (SOC_IS_TOMAHAWK(unit)) { 856 mbcm_techsupport[unit] = mbcm_tomahawk_techsupport; 857 } 858 #endif 859 #ifdef BCM_HELIX5_SUPPORT 860 else if (SOC_IS_HELIX5(unit)) { 861 mbcm_techsupport[unit] = mbcm_helix5_techsupport; 862 } 863 #endif 864 #ifdef BCM_TRIDENT3_SUPPORT 865 else if (SOC_IS_TRIDENT3X(unit)) { 866 mbcm_techsupport[unit] = mbcm_trident3_techsupport; 867 } 868 #endif 869 else { 870 cli_out("command \"techSupport %s\" not supported on chip %s.\n", feature_name, SOC_UNIT_NAME(unit)); 871 return CMD_FAIL; 872 } 873 } 874 875 mbcm_techsupport_ptr = mbcm_techsupport[unit]; 876 for (; mbcm_techsupport_ptr->techsupport_feature_name; mbcm_techsupport_ptr++) { 877 if (sal_strcasecmp(feature_name, mbcm_techsupport_ptr->techsupport_feature_name) == 0) { 878 techsupport_feature_data = mbcm_techsupport_ptr->techsupport_data; 879 feature_name_supported_flag = 1; 880 break; 881 } 882 } 883 884 if (feature_name_supported_flag == 0) { 885 cli_out("command \"techSupport %s\" not supported on chip %s.\n", feature_name, SOC_UNIT_NAME(unit)); 886 return CMD_FAIL; 887 } 888 889 for (command = techsupport_cmds; command->techsupport_cmd; command++) { 890 if (sal_strcasecmp(feature_name, command->techsupport_cmd) == 0) { 891 start_time = sal_time(); 892 rc = (command->techsupport_func(unit, a, techsupport_feature_data)); 893 end_time = sal_time(); 894 break; 895 } 896 } 897 } 898 sal_strncpy(str, TECHSUPPORT, sizeof(TECHSUPPORT)); 899 sal_strncat(str, feature_name, (MAX_STR_LEN - strlen(str) - 1)); 900 sal_strncat(str, " [options..]", (MAX_STR_LEN - strlen(str) - 1)); 901 techsupport_calc_and_print_time_taken(start_time, end_time, str, 1); 902 return rc; 903 }