lls.c (5844B)
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 * Diag CLI Buffer command 8 */ 9 10 #include <soc/defs.h> 11 #include <shared/bsl.h> 12 #if defined(BCM_TRIUMPH3_SUPPORT) || defined(BCM_KATANA_SUPPORT) 13 14 #include <appl/diag/system.h> 15 #include <appl/diag/parse.h> 16 17 #include <bcm/error.h> 18 19 #include <soc/triumph3.h> 20 #include <soc/trident2.h> 21 #include <soc/katana2.h> 22 #include <soc/katana.h> 23 #include <bcm_int/esw/katana.h> 24 #include <bcm_int/esw/katana2.h> 25 #if defined(BCM_HELIX5_SUPPORT) 26 #include <bcm_int/esw/helix5.h> 27 #endif 28 #if defined(BCM_APACHE_SUPPORT) 29 #include <bcm_int/esw/apache.h> 30 #endif 31 #if defined(BCM_MONTEREY_SUPPORT) 32 #include <bcm_int/esw/monterey.h> 33 #endif 34 #include <soc/apache.h> 35 #include <soc/monterey.h> 36 37 char cmd_lls_usage[] = 38 "Usages:\n\t" 39 " lls [PortBitMap=<pbm>]\n" 40 " - Show the schedule tree(s) for the LLS port(s)\n"; 41 42 #if defined(BCM_TRIDENT2_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) 43 char cmd_hsp_usage[] = 44 "Usages:\n\t" 45 " hsp [PortBitMap=<pbm>]\n" 46 " - Show the schedule tree(s) for the HSP port(s)\n"; 47 #endif /* BCM_TRIDENT2_SUPPORT */ 48 49 cmd_result_t 50 cmd_lls(int unit, args_t *a) 51 { 52 int p; 53 #if defined(BCM_APACHE_SUPPORT) || defined(BCM_SABER2_SUPPORT) 54 int subcmd = 0; 55 #endif 56 soc_pbmp_t pbmp; 57 parse_table_t pt; 58 #ifdef BCM_KATANA2_SUPPORT 59 soc_info_t *si = &SOC_INFO(unit); 60 int pp_port; 61 int start_pp_port, end_pp_port; 62 #endif 63 64 SOC_PBMP_ASSIGN(pbmp, PBMP_PORT_ALL(unit)); 65 66 parse_table_init(unit, &pt); 67 parse_table_add(&pt, "PortBitMap", PQ_DFL|PQ_PBMP, 68 (void *)(0), &pbmp, NULL); 69 70 #if defined(BCM_APACHE_SUPPORT) || defined(BCM_SABER2_SUPPORT) 71 if (SOC_IS_APACHE(unit) || SOC_IS_SABER2(unit)) { 72 parse_table_add(&pt, "sw", PQ_DFL | PQ_NO_EQ_OPT | PQ_BOOL, 0, 73 (void *)&subcmd, 0); 74 } 75 #endif 76 if (parse_arg_eq(a, &pt) < 0) { 77 cli_out("%s: Error: Unknown option: %s\n", ARG_CMD(a), ARG_CUR(a)); 78 parse_arg_eq_done(&pt); 79 return(CMD_FAIL); 80 } 81 parse_arg_eq_done(&pt); 82 83 PBMP_ITER(pbmp, p) { 84 if (SOC_IS_TRIUMPH3(unit)) { 85 soc_tr3_dump_port_lls(unit, p); 86 } else if (SOC_IS_TOMAHAWKX(unit)) { 87 cli_out("LLS command not supported on this device\n"); 88 return CMD_FAIL; 89 #if defined(BCM_APACHE_SUPPORT) 90 } else if (SOC_IS_APACHE(unit)) { 91 if (subcmd) { 92 bcm_apache_dump_port_lls_sw(unit, p); 93 } else { 94 soc_apache_dump_port_lls(unit, p); 95 } 96 #endif 97 } else if (SOC_IS_TD2_TT2(unit)) { 98 soc_td2_dump_port_lls(unit, p); 99 } 100 #ifdef BCM_KATANA2_SUPPORT 101 else if (SOC_IS_KATANA2(unit)) { 102 #if defined(BCM_SABER2_SUPPORT) 103 if (SOC_IS_SABER2(unit) && (subcmd)) { 104 /* Display LLS details from SW */ 105 bcm_kt2_dump_port_lls(unit, p); 106 } else 107 #endif 108 if (SOC_PBMP_MEMBER(si->linkphy_pbm, p)) { 109 bcm_kt2_dump_port_lls(unit, p); 110 } else { 111 #if defined BCM_METROLITE_SUPPORT 112 if (soc_feature(unit, soc_feature_discontinuous_pp_port)) { 113 soc_kt2_dump_port_lls(unit, p, 0); 114 if (si->port_num_subport[p] > 0) { 115 SOC_PBMP_ITER(SOC_PORT_PP_BITMAP(unit, p), pp_port) { 116 soc_kt2_dump_port_lls(unit, p, pp_port); 117 } 118 } 119 } else 120 #endif 121 { 122 soc_kt2_dump_port_lls(unit, p, 0); 123 if (si->port_num_subport[p] > 0) { 124 start_pp_port = si->port_subport_base[p]; 125 end_pp_port = si->port_subport_base[p] + 126 si->port_num_subport[p]; 127 for (pp_port = start_pp_port; pp_port < 128 end_pp_port; pp_port++) { 129 soc_kt2_dump_port_lls(unit, p, pp_port); 130 } 131 } 132 } 133 } 134 } 135 #endif 136 #ifdef BCM_KATANA_SUPPORT 137 else if (SOC_IS_KATANA(unit)) { 138 bcm_kt_dump_port_lls(unit, p); 139 } 140 #endif 141 sal_thread_yield(); 142 } 143 144 return CMD_OK; 145 } 146 147 #if defined(BCM_TRIDENT2_SUPPORT) || defined(BCM_TRIUMPH3_SUPPORT) || defined(BCM_HELIX5_SUPPORT) 148 cmd_result_t 149 cmd_hsp(int unit, args_t *a) 150 { 151 int p; 152 soc_pbmp_t pbmp; 153 parse_table_t pt; 154 155 SOC_PBMP_ASSIGN(pbmp, PBMP_PORT_ALL(unit)); 156 157 parse_table_init(unit, &pt); 158 parse_table_add(&pt, "PortBitMap", PQ_DFL|PQ_PBMP, 159 (void *)(0), &pbmp, NULL); 160 161 if (parse_arg_eq(a, &pt) < 0) { 162 cli_out("%s: Error: Unknown option: %s\n", ARG_CMD(a), ARG_CUR(a)); 163 parse_arg_eq_done(&pt); 164 return(CMD_FAIL); 165 } 166 parse_arg_eq_done(&pt); 167 168 PBMP_ITER(pbmp, p) { 169 if (SOC_IS_TOMAHAWKX(unit)) { 170 cli_out("HSP command not supported on this device\n"); 171 return CMD_FAIL; 172 #if defined(BCM_MONTEREY_SUPPORT) 173 } else if (SOC_IS_MONTEREY(unit)) { 174 soc_monterey_dump_port_hsp(unit, p); 175 #endif 176 #if defined(BCM_HELIX5_SUPPORT) 177 } else if (SOC_IS_HELIX5(unit)) { 178 bcm_hx5_dump_port_hsp(unit, p); 179 #endif 180 } else if (SOC_IS_APACHE(unit)) { 181 soc_apache_dump_port_hsp(unit, p); 182 } else if ((SOC_IS_TRIDENT2X(unit) || SOC_IS_TITAN2PLUS(unit))) { 183 soc_td2_dump_port_hsp(unit, p); 184 } else if (SOC_IS_TRIUMPH3(unit)) { 185 soc_tr3_dump_port_hsp(unit, p); 186 } 187 } 188 189 return CMD_OK; 190 } 191 #endif /* BCM_TRIDENT2_SUPPORT */ 192 193 #endif /* (BCM_TRIUMPH3_SUPPORT | BCM_KATANA_SUPPORT) */ 194