diff options
Diffstat (limited to 'drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c')
| -rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 388 |
1 files changed, 330 insertions, 58 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c index 371f75e782e5..a11485fbb33f 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | |||
| @@ -182,6 +182,95 @@ static const struct file_operations cim_la_fops = { | |||
| 182 | .release = seq_release_private | 182 | .release = seq_release_private |
| 183 | }; | 183 | }; |
| 184 | 184 | ||
| 185 | static int cim_pif_la_show(struct seq_file *seq, void *v, int idx) | ||
| 186 | { | ||
| 187 | const u32 *p = v; | ||
| 188 | |||
| 189 | if (v == SEQ_START_TOKEN) { | ||
| 190 | seq_puts(seq, "Cntl ID DataBE Addr Data\n"); | ||
| 191 | } else if (idx < CIM_PIFLA_SIZE) { | ||
| 192 | seq_printf(seq, " %02x %02x %04x %08x %08x%08x%08x%08x\n", | ||
| 193 | (p[5] >> 22) & 0xff, (p[5] >> 16) & 0x3f, | ||
| 194 | p[5] & 0xffff, p[4], p[3], p[2], p[1], p[0]); | ||
| 195 | } else { | ||
| 196 | if (idx == CIM_PIFLA_SIZE) | ||
| 197 | seq_puts(seq, "\nCntl ID Data\n"); | ||
| 198 | seq_printf(seq, " %02x %02x %08x%08x%08x%08x\n", | ||
| 199 | (p[4] >> 6) & 0xff, p[4] & 0x3f, | ||
| 200 | p[3], p[2], p[1], p[0]); | ||
| 201 | } | ||
| 202 | return 0; | ||
| 203 | } | ||
| 204 | |||
| 205 | static int cim_pif_la_open(struct inode *inode, struct file *file) | ||
| 206 | { | ||
| 207 | struct seq_tab *p; | ||
| 208 | struct adapter *adap = inode->i_private; | ||
| 209 | |||
| 210 | p = seq_open_tab(file, 2 * CIM_PIFLA_SIZE, 6 * sizeof(u32), 1, | ||
| 211 | cim_pif_la_show); | ||
| 212 | if (!p) | ||
| 213 | return -ENOMEM; | ||
| 214 | |||
| 215 | t4_cim_read_pif_la(adap, (u32 *)p->data, | ||
| 216 | (u32 *)p->data + 6 * CIM_PIFLA_SIZE, NULL, NULL); | ||
| 217 | return 0; | ||
| 218 | } | ||
| 219 | |||
| 220 | static const struct file_operations cim_pif_la_fops = { | ||
| 221 | .owner = THIS_MODULE, | ||
| 222 | .open = cim_pif_la_open, | ||
| 223 | .read = seq_read, | ||
| 224 | .llseek = seq_lseek, | ||
| 225 | .release = seq_release_private | ||
| 226 | }; | ||
| 227 | |||
| 228 | static int cim_ma_la_show(struct seq_file *seq, void *v, int idx) | ||
| 229 | { | ||
| 230 | const u32 *p = v; | ||
| 231 | |||
| 232 | if (v == SEQ_START_TOKEN) { | ||
| 233 | seq_puts(seq, "\n"); | ||
| 234 | } else if (idx < CIM_MALA_SIZE) { | ||
| 235 | seq_printf(seq, "%02x%08x%08x%08x%08x\n", | ||
| 236 | p[4], p[3], p[2], p[1], p[0]); | ||
| 237 | } else { | ||
| 238 | if (idx == CIM_MALA_SIZE) | ||
| 239 | seq_puts(seq, | ||
| 240 | "\nCnt ID Tag UE Data RDY VLD\n"); | ||
| 241 | seq_printf(seq, "%3u %2u %x %u %08x%08x %u %u\n", | ||
| 242 | (p[2] >> 10) & 0xff, (p[2] >> 7) & 7, | ||
| 243 | (p[2] >> 3) & 0xf, (p[2] >> 2) & 1, | ||
| 244 | (p[1] >> 2) | ((p[2] & 3) << 30), | ||
| 245 | (p[0] >> 2) | ((p[1] & 3) << 30), (p[0] >> 1) & 1, | ||
| 246 | p[0] & 1); | ||
| 247 | } | ||
| 248 | return 0; | ||
| 249 | } | ||
| 250 | |||
| 251 | static int cim_ma_la_open(struct inode *inode, struct file *file) | ||
| 252 | { | ||
| 253 | struct seq_tab *p; | ||
| 254 | struct adapter *adap = inode->i_private; | ||
| 255 | |||
| 256 | p = seq_open_tab(file, 2 * CIM_MALA_SIZE, 5 * sizeof(u32), 1, | ||
| 257 | cim_ma_la_show); | ||
| 258 | if (!p) | ||
| 259 | return -ENOMEM; | ||
| 260 | |||
| 261 | t4_cim_read_ma_la(adap, (u32 *)p->data, | ||
| 262 | (u32 *)p->data + 5 * CIM_MALA_SIZE); | ||
| 263 | return 0; | ||
| 264 | } | ||
| 265 | |||
| 266 | static const struct file_operations cim_ma_la_fops = { | ||
| 267 | .owner = THIS_MODULE, | ||
| 268 | .open = cim_ma_la_open, | ||
| 269 | .read = seq_read, | ||
| 270 | .llseek = seq_lseek, | ||
| 271 | .release = seq_release_private | ||
| 272 | }; | ||
| 273 | |||
| 185 | static int cim_qcfg_show(struct seq_file *seq, void *v) | 274 | static int cim_qcfg_show(struct seq_file *seq, void *v) |
| 186 | { | 275 | { |
| 187 | static const char * const qname[] = { | 276 | static const char * const qname[] = { |
| @@ -663,6 +752,39 @@ static const struct file_operations pm_stats_debugfs_fops = { | |||
| 663 | .write = pm_stats_clear | 752 | .write = pm_stats_clear |
| 664 | }; | 753 | }; |
| 665 | 754 | ||
| 755 | static int tx_rate_show(struct seq_file *seq, void *v) | ||
| 756 | { | ||
| 757 | u64 nrate[NCHAN], orate[NCHAN]; | ||
| 758 | struct adapter *adap = seq->private; | ||
| 759 | |||
| 760 | t4_get_chan_txrate(adap, nrate, orate); | ||
| 761 | if (adap->params.arch.nchan == NCHAN) { | ||
| 762 | seq_puts(seq, " channel 0 channel 1 " | ||
| 763 | "channel 2 channel 3\n"); | ||
| 764 | seq_printf(seq, "NIC B/s: %10llu %10llu %10llu %10llu\n", | ||
| 765 | (unsigned long long)nrate[0], | ||
| 766 | (unsigned long long)nrate[1], | ||
| 767 | (unsigned long long)nrate[2], | ||
| 768 | (unsigned long long)nrate[3]); | ||
| 769 | seq_printf(seq, "Offload B/s: %10llu %10llu %10llu %10llu\n", | ||
| 770 | (unsigned long long)orate[0], | ||
| 771 | (unsigned long long)orate[1], | ||
| 772 | (unsigned long long)orate[2], | ||
| 773 | (unsigned long long)orate[3]); | ||
| 774 | } else { | ||
| 775 | seq_puts(seq, " channel 0 channel 1\n"); | ||
| 776 | seq_printf(seq, "NIC B/s: %10llu %10llu\n", | ||
| 777 | (unsigned long long)nrate[0], | ||
| 778 | (unsigned long long)nrate[1]); | ||
| 779 | seq_printf(seq, "Offload B/s: %10llu %10llu\n", | ||
| 780 | (unsigned long long)orate[0], | ||
| 781 | (unsigned long long)orate[1]); | ||
| 782 | } | ||
| 783 | return 0; | ||
| 784 | } | ||
| 785 | |||
| 786 | DEFINE_SIMPLE_DEBUGFS_FILE(tx_rate); | ||
| 787 | |||
| 666 | static int cctrl_tbl_show(struct seq_file *seq, void *v) | 788 | static int cctrl_tbl_show(struct seq_file *seq, void *v) |
| 667 | { | 789 | { |
| 668 | static const char * const dec_fac[] = { | 790 | static const char * const dec_fac[] = { |
| @@ -830,16 +952,23 @@ static int devlog_show(struct seq_file *seq, void *v) | |||
| 830 | * eventually have to put a format interpreter in here ... | 952 | * eventually have to put a format interpreter in here ... |
| 831 | */ | 953 | */ |
| 832 | seq_printf(seq, "%10d %15llu %8s %8s ", | 954 | seq_printf(seq, "%10d %15llu %8s %8s ", |
| 833 | e->seqno, e->timestamp, | 955 | be32_to_cpu(e->seqno), |
| 956 | be64_to_cpu(e->timestamp), | ||
| 834 | (e->level < ARRAY_SIZE(devlog_level_strings) | 957 | (e->level < ARRAY_SIZE(devlog_level_strings) |
| 835 | ? devlog_level_strings[e->level] | 958 | ? devlog_level_strings[e->level] |
| 836 | : "UNKNOWN"), | 959 | : "UNKNOWN"), |
| 837 | (e->facility < ARRAY_SIZE(devlog_facility_strings) | 960 | (e->facility < ARRAY_SIZE(devlog_facility_strings) |
| 838 | ? devlog_facility_strings[e->facility] | 961 | ? devlog_facility_strings[e->facility] |
| 839 | : "UNKNOWN")); | 962 | : "UNKNOWN")); |
| 840 | seq_printf(seq, e->fmt, e->params[0], e->params[1], | 963 | seq_printf(seq, e->fmt, |
| 841 | e->params[2], e->params[3], e->params[4], | 964 | be32_to_cpu(e->params[0]), |
| 842 | e->params[5], e->params[6], e->params[7]); | 965 | be32_to_cpu(e->params[1]), |
| 966 | be32_to_cpu(e->params[2]), | ||
| 967 | be32_to_cpu(e->params[3]), | ||
| 968 | be32_to_cpu(e->params[4]), | ||
| 969 | be32_to_cpu(e->params[5]), | ||
| 970 | be32_to_cpu(e->params[6]), | ||
| 971 | be32_to_cpu(e->params[7])); | ||
| 843 | } | 972 | } |
| 844 | return 0; | 973 | return 0; |
| 845 | } | 974 | } |
| @@ -921,23 +1050,17 @@ static int devlog_open(struct inode *inode, struct file *file) | |||
| 921 | return ret; | 1050 | return ret; |
| 922 | } | 1051 | } |
| 923 | 1052 | ||
| 924 | /* Translate log multi-byte integral elements into host native format | 1053 | /* Find the earliest (lowest Sequence Number) log entry in the |
| 925 | * and determine where the first entry in the log is. | 1054 | * circular Device Log. |
| 926 | */ | 1055 | */ |
| 927 | for (fseqno = ~((u32)0), index = 0; index < dinfo->nentries; index++) { | 1056 | for (fseqno = ~((u32)0), index = 0; index < dinfo->nentries; index++) { |
| 928 | struct fw_devlog_e *e = &dinfo->log[index]; | 1057 | struct fw_devlog_e *e = &dinfo->log[index]; |
| 929 | int i; | ||
| 930 | __u32 seqno; | 1058 | __u32 seqno; |
| 931 | 1059 | ||
| 932 | if (e->timestamp == 0) | 1060 | if (e->timestamp == 0) |
| 933 | continue; | 1061 | continue; |
| 934 | 1062 | ||
| 935 | e->timestamp = (__force __be64)be64_to_cpu(e->timestamp); | ||
| 936 | seqno = be32_to_cpu(e->seqno); | 1063 | seqno = be32_to_cpu(e->seqno); |
| 937 | for (i = 0; i < 8; i++) | ||
| 938 | e->params[i] = | ||
| 939 | (__force __be32)be32_to_cpu(e->params[i]); | ||
| 940 | |||
| 941 | if (seqno < fseqno) { | 1064 | if (seqno < fseqno) { |
| 942 | fseqno = seqno; | 1065 | fseqno = seqno; |
| 943 | dinfo->first = index; | 1066 | dinfo->first = index; |
| @@ -1084,41 +1207,89 @@ static inline void tcamxy2valmask(u64 x, u64 y, u8 *addr, u64 *mask) | |||
| 1084 | 1207 | ||
| 1085 | static int mps_tcam_show(struct seq_file *seq, void *v) | 1208 | static int mps_tcam_show(struct seq_file *seq, void *v) |
| 1086 | { | 1209 | { |
| 1087 | if (v == SEQ_START_TOKEN) | 1210 | struct adapter *adap = seq->private; |
| 1088 | seq_puts(seq, "Idx Ethernet address Mask Vld Ports PF" | 1211 | unsigned int chip_ver = CHELSIO_CHIP_VERSION(adap->params.chip); |
| 1089 | " VF Replication " | 1212 | |
| 1090 | "P0 P1 P2 P3 ML\n"); | 1213 | if (v == SEQ_START_TOKEN) { |
| 1091 | else { | 1214 | if (adap->params.arch.mps_rplc_size > 128) |
| 1215 | seq_puts(seq, "Idx Ethernet address Mask " | ||
| 1216 | "Vld Ports PF VF " | ||
| 1217 | "Replication " | ||
| 1218 | " P0 P1 P2 P3 ML\n"); | ||
| 1219 | else | ||
| 1220 | seq_puts(seq, "Idx Ethernet address Mask " | ||
| 1221 | "Vld Ports PF VF Replication" | ||
| 1222 | " P0 P1 P2 P3 ML\n"); | ||
| 1223 | } else { | ||
| 1092 | u64 mask; | 1224 | u64 mask; |
| 1093 | u8 addr[ETH_ALEN]; | 1225 | u8 addr[ETH_ALEN]; |
| 1094 | struct adapter *adap = seq->private; | 1226 | bool replicate; |
| 1095 | unsigned int idx = (uintptr_t)v - 2; | 1227 | unsigned int idx = (uintptr_t)v - 2; |
| 1096 | u64 tcamy = t4_read_reg64(adap, MPS_CLS_TCAM_Y_L(idx)); | 1228 | u64 tcamy, tcamx, val; |
| 1097 | u64 tcamx = t4_read_reg64(adap, MPS_CLS_TCAM_X_L(idx)); | 1229 | u32 cls_lo, cls_hi, ctl; |
| 1098 | u32 cls_lo = t4_read_reg(adap, MPS_CLS_SRAM_L(idx)); | 1230 | u32 rplc[8] = {0}; |
| 1099 | u32 cls_hi = t4_read_reg(adap, MPS_CLS_SRAM_H(idx)); | 1231 | |
| 1100 | u32 rplc[4] = {0, 0, 0, 0}; | 1232 | if (chip_ver > CHELSIO_T5) { |
| 1233 | /* CtlCmdType - 0: Read, 1: Write | ||
| 1234 | * CtlTcamSel - 0: TCAM0, 1: TCAM1 | ||
| 1235 | * CtlXYBitSel- 0: Y bit, 1: X bit | ||
| 1236 | */ | ||
| 1237 | |||
| 1238 | /* Read tcamy */ | ||
| 1239 | ctl = CTLCMDTYPE_V(0) | CTLXYBITSEL_V(0); | ||
| 1240 | if (idx < 256) | ||
| 1241 | ctl |= CTLTCAMINDEX_V(idx) | CTLTCAMSEL_V(0); | ||
| 1242 | else | ||
| 1243 | ctl |= CTLTCAMINDEX_V(idx - 256) | | ||
| 1244 | CTLTCAMSEL_V(1); | ||
| 1245 | t4_write_reg(adap, MPS_CLS_TCAM_DATA2_CTL_A, ctl); | ||
| 1246 | val = t4_read_reg(adap, MPS_CLS_TCAM_DATA1_A); | ||
| 1247 | tcamy = DMACH_G(val) << 32; | ||
| 1248 | tcamy |= t4_read_reg(adap, MPS_CLS_TCAM_DATA0_A); | ||
| 1249 | |||
| 1250 | /* Read tcamx. Change the control param */ | ||
| 1251 | ctl |= CTLXYBITSEL_V(1); | ||
| 1252 | t4_write_reg(adap, MPS_CLS_TCAM_DATA2_CTL_A, ctl); | ||
| 1253 | val = t4_read_reg(adap, MPS_CLS_TCAM_DATA1_A); | ||
| 1254 | tcamx = DMACH_G(val) << 32; | ||
| 1255 | tcamx |= t4_read_reg(adap, MPS_CLS_TCAM_DATA0_A); | ||
| 1256 | } else { | ||
| 1257 | tcamy = t4_read_reg64(adap, MPS_CLS_TCAM_Y_L(idx)); | ||
| 1258 | tcamx = t4_read_reg64(adap, MPS_CLS_TCAM_X_L(idx)); | ||
| 1259 | } | ||
| 1260 | |||
| 1261 | cls_lo = t4_read_reg(adap, MPS_CLS_SRAM_L(idx)); | ||
| 1262 | cls_hi = t4_read_reg(adap, MPS_CLS_SRAM_H(idx)); | ||
| 1101 | 1263 | ||
| 1102 | if (tcamx & tcamy) { | 1264 | if (tcamx & tcamy) { |
| 1103 | seq_printf(seq, "%3u -\n", idx); | 1265 | seq_printf(seq, "%3u -\n", idx); |
| 1104 | goto out; | 1266 | goto out; |
| 1105 | } | 1267 | } |
| 1106 | 1268 | ||
| 1107 | if (cls_lo & REPLICATE_F) { | 1269 | rplc[0] = rplc[1] = rplc[2] = rplc[3] = 0; |
| 1270 | if (chip_ver > CHELSIO_T5) | ||
| 1271 | replicate = (cls_lo & T6_REPLICATE_F); | ||
| 1272 | else | ||
| 1273 | replicate = (cls_lo & REPLICATE_F); | ||
| 1274 | |||
| 1275 | if (replicate) { | ||
| 1108 | struct fw_ldst_cmd ldst_cmd; | 1276 | struct fw_ldst_cmd ldst_cmd; |
| 1109 | int ret; | 1277 | int ret; |
| 1278 | struct fw_ldst_mps_rplc mps_rplc; | ||
| 1279 | u32 ldst_addrspc; | ||
| 1110 | 1280 | ||
| 1111 | memset(&ldst_cmd, 0, sizeof(ldst_cmd)); | 1281 | memset(&ldst_cmd, 0, sizeof(ldst_cmd)); |
| 1282 | ldst_addrspc = | ||
| 1283 | FW_LDST_CMD_ADDRSPACE_V(FW_LDST_ADDRSPC_MPS); | ||
| 1112 | ldst_cmd.op_to_addrspace = | 1284 | ldst_cmd.op_to_addrspace = |
| 1113 | htonl(FW_CMD_OP_V(FW_LDST_CMD) | | 1285 | htonl(FW_CMD_OP_V(FW_LDST_CMD) | |
| 1114 | FW_CMD_REQUEST_F | | 1286 | FW_CMD_REQUEST_F | |
| 1115 | FW_CMD_READ_F | | 1287 | FW_CMD_READ_F | |
| 1116 | FW_LDST_CMD_ADDRSPACE_V( | 1288 | ldst_addrspc); |
| 1117 | FW_LDST_ADDRSPC_MPS)); | ||
| 1118 | ldst_cmd.cycles_to_len16 = htonl(FW_LEN16(ldst_cmd)); | 1289 | ldst_cmd.cycles_to_len16 = htonl(FW_LEN16(ldst_cmd)); |
| 1119 | ldst_cmd.u.mps.fid_ctl = | 1290 | ldst_cmd.u.mps.rplc.fid_idx = |
| 1120 | htons(FW_LDST_CMD_FID_V(FW_LDST_MPS_RPLC) | | 1291 | htons(FW_LDST_CMD_FID_V(FW_LDST_MPS_RPLC) | |
| 1121 | FW_LDST_CMD_CTL_V(idx)); | 1292 | FW_LDST_CMD_IDX_V(idx)); |
| 1122 | ret = t4_wr_mbox(adap, adap->mbox, &ldst_cmd, | 1293 | ret = t4_wr_mbox(adap, adap->mbox, &ldst_cmd, |
| 1123 | sizeof(ldst_cmd), &ldst_cmd); | 1294 | sizeof(ldst_cmd), &ldst_cmd); |
| 1124 | if (ret) | 1295 | if (ret) |
| @@ -1126,30 +1297,69 @@ static int mps_tcam_show(struct seq_file *seq, void *v) | |||
| 1126 | "replication map for idx %d: %d\n", | 1297 | "replication map for idx %d: %d\n", |
| 1127 | idx, -ret); | 1298 | idx, -ret); |
| 1128 | else { | 1299 | else { |
| 1129 | rplc[0] = ntohl(ldst_cmd.u.mps.rplc31_0); | 1300 | mps_rplc = ldst_cmd.u.mps.rplc; |
| 1130 | rplc[1] = ntohl(ldst_cmd.u.mps.rplc63_32); | 1301 | rplc[0] = ntohl(mps_rplc.rplc31_0); |
| 1131 | rplc[2] = ntohl(ldst_cmd.u.mps.rplc95_64); | 1302 | rplc[1] = ntohl(mps_rplc.rplc63_32); |
| 1132 | rplc[3] = ntohl(ldst_cmd.u.mps.rplc127_96); | 1303 | rplc[2] = ntohl(mps_rplc.rplc95_64); |
| 1304 | rplc[3] = ntohl(mps_rplc.rplc127_96); | ||
| 1305 | if (adap->params.arch.mps_rplc_size > 128) { | ||
| 1306 | rplc[4] = ntohl(mps_rplc.rplc159_128); | ||
| 1307 | rplc[5] = ntohl(mps_rplc.rplc191_160); | ||
| 1308 | rplc[6] = ntohl(mps_rplc.rplc223_192); | ||
| 1309 | rplc[7] = ntohl(mps_rplc.rplc255_224); | ||
| 1310 | } | ||
| 1133 | } | 1311 | } |
| 1134 | } | 1312 | } |
| 1135 | 1313 | ||
| 1136 | tcamxy2valmask(tcamx, tcamy, addr, &mask); | 1314 | tcamxy2valmask(tcamx, tcamy, addr, &mask); |
| 1137 | seq_printf(seq, "%3u %02x:%02x:%02x:%02x:%02x:%02x %012llx" | 1315 | if (chip_ver > CHELSIO_T5) |
| 1138 | "%3c %#x%4u%4d", | 1316 | seq_printf(seq, "%3u %02x:%02x:%02x:%02x:%02x:%02x " |
| 1139 | idx, addr[0], addr[1], addr[2], addr[3], addr[4], | 1317 | "%012llx%3c %#x%4u%4d", |
| 1140 | addr[5], (unsigned long long)mask, | 1318 | idx, addr[0], addr[1], addr[2], addr[3], |
| 1141 | (cls_lo & SRAM_VLD_F) ? 'Y' : 'N', PORTMAP_G(cls_hi), | 1319 | addr[4], addr[5], (unsigned long long)mask, |
| 1142 | PF_G(cls_lo), | 1320 | (cls_lo & T6_SRAM_VLD_F) ? 'Y' : 'N', |
| 1143 | (cls_lo & VF_VALID_F) ? VF_G(cls_lo) : -1); | 1321 | PORTMAP_G(cls_hi), |
| 1144 | if (cls_lo & REPLICATE_F) | 1322 | T6_PF_G(cls_lo), |
| 1145 | seq_printf(seq, " %08x %08x %08x %08x", | 1323 | (cls_lo & T6_VF_VALID_F) ? |
| 1146 | rplc[3], rplc[2], rplc[1], rplc[0]); | 1324 | T6_VF_G(cls_lo) : -1); |
| 1325 | else | ||
| 1326 | seq_printf(seq, "%3u %02x:%02x:%02x:%02x:%02x:%02x " | ||
| 1327 | "%012llx%3c %#x%4u%4d", | ||
| 1328 | idx, addr[0], addr[1], addr[2], addr[3], | ||
| 1329 | addr[4], addr[5], (unsigned long long)mask, | ||
| 1330 | (cls_lo & SRAM_VLD_F) ? 'Y' : 'N', | ||
| 1331 | PORTMAP_G(cls_hi), | ||
| 1332 | PF_G(cls_lo), | ||
| 1333 | (cls_lo & VF_VALID_F) ? VF_G(cls_lo) : -1); | ||
| 1334 | |||
| 1335 | if (replicate) { | ||
| 1336 | if (adap->params.arch.mps_rplc_size > 128) | ||
| 1337 | seq_printf(seq, " %08x %08x %08x %08x " | ||
| 1338 | "%08x %08x %08x %08x", | ||
| 1339 | rplc[7], rplc[6], rplc[5], rplc[4], | ||
| 1340 | rplc[3], rplc[2], rplc[1], rplc[0]); | ||
| 1341 | else | ||
| 1342 | seq_printf(seq, " %08x %08x %08x %08x", | ||
| 1343 | rplc[3], rplc[2], rplc[1], rplc[0]); | ||
| 1344 | } else { | ||
| 1345 | if (adap->params.arch.mps_rplc_size > 128) | ||
| 1346 | seq_printf(seq, "%72c", ' '); | ||
| 1347 | else | ||
| 1348 | seq_printf(seq, "%36c", ' '); | ||
| 1349 | } | ||
| 1350 | |||
| 1351 | if (chip_ver > CHELSIO_T5) | ||
| 1352 | seq_printf(seq, "%4u%3u%3u%3u %#x\n", | ||
| 1353 | T6_SRAM_PRIO0_G(cls_lo), | ||
| 1354 | T6_SRAM_PRIO1_G(cls_lo), | ||
| 1355 | T6_SRAM_PRIO2_G(cls_lo), | ||
| 1356 | T6_SRAM_PRIO3_G(cls_lo), | ||
| 1357 | (cls_lo >> T6_MULTILISTEN0_S) & 0xf); | ||
| 1147 | else | 1358 | else |
| 1148 | seq_printf(seq, "%36c", ' '); | 1359 | seq_printf(seq, "%4u%3u%3u%3u %#x\n", |
| 1149 | seq_printf(seq, "%4u%3u%3u%3u %#x\n", | 1360 | SRAM_PRIO0_G(cls_lo), SRAM_PRIO1_G(cls_lo), |
| 1150 | SRAM_PRIO0_G(cls_lo), SRAM_PRIO1_G(cls_lo), | 1361 | SRAM_PRIO2_G(cls_lo), SRAM_PRIO3_G(cls_lo), |
| 1151 | SRAM_PRIO2_G(cls_lo), SRAM_PRIO3_G(cls_lo), | 1362 | (cls_lo >> MULTILISTEN0_S) & 0xf); |
| 1152 | (cls_lo >> MULTILISTEN0_S) & 0xf); | ||
| 1153 | } | 1363 | } |
| 1154 | out: return 0; | 1364 | out: return 0; |
| 1155 | } | 1365 | } |
| @@ -1222,7 +1432,7 @@ static int sensors_show(struct seq_file *seq, void *v) | |||
| 1222 | param[1] = (FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DEV) | | 1432 | param[1] = (FW_PARAMS_MNEM_V(FW_PARAMS_MNEM_DEV) | |
| 1223 | FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_DIAG) | | 1433 | FW_PARAMS_PARAM_X_V(FW_PARAMS_PARAM_DEV_DIAG) | |
| 1224 | FW_PARAMS_PARAM_Y_V(FW_PARAM_DEV_DIAG_VDD)); | 1434 | FW_PARAMS_PARAM_Y_V(FW_PARAM_DEV_DIAG_VDD)); |
| 1225 | ret = t4_query_params(adap, adap->mbox, adap->fn, 0, 2, | 1435 | ret = t4_query_params(adap, adap->mbox, adap->pf, 0, 2, |
| 1226 | param, val); | 1436 | param, val); |
| 1227 | 1437 | ||
| 1228 | if (ret < 0 || val[0] == 0) | 1438 | if (ret < 0 || val[0] == 0) |
| @@ -1416,6 +1626,9 @@ static int rss_config_show(struct seq_file *seq, void *v) | |||
| 1416 | seq_printf(seq, " HashDelay: %3d\n", HASHDELAY_G(rssconf)); | 1626 | seq_printf(seq, " HashDelay: %3d\n", HASHDELAY_G(rssconf)); |
| 1417 | if (CHELSIO_CHIP_VERSION(adapter->params.chip) <= CHELSIO_T5) | 1627 | if (CHELSIO_CHIP_VERSION(adapter->params.chip) <= CHELSIO_T5) |
| 1418 | seq_printf(seq, " VfWrAddr: %3d\n", VFWRADDR_G(rssconf)); | 1628 | seq_printf(seq, " VfWrAddr: %3d\n", VFWRADDR_G(rssconf)); |
| 1629 | else | ||
| 1630 | seq_printf(seq, " VfWrAddr: %3d\n", | ||
| 1631 | T6_VFWRADDR_G(rssconf)); | ||
| 1419 | seq_printf(seq, " KeyMode: %s\n", keymode[KEYMODE_G(rssconf)]); | 1632 | seq_printf(seq, " KeyMode: %s\n", keymode[KEYMODE_G(rssconf)]); |
| 1420 | seq_printf(seq, " VfWrEn: %3s\n", yesno(rssconf & VFWREN_F)); | 1633 | seq_printf(seq, " VfWrEn: %3s\n", yesno(rssconf & VFWREN_F)); |
| 1421 | seq_printf(seq, " KeyWrEn: %3s\n", yesno(rssconf & KEYWREN_F)); | 1634 | seq_printf(seq, " KeyWrEn: %3s\n", yesno(rssconf & KEYWREN_F)); |
| @@ -1634,14 +1847,14 @@ static int rss_vf_config_open(struct inode *inode, struct file *file) | |||
| 1634 | struct adapter *adapter = inode->i_private; | 1847 | struct adapter *adapter = inode->i_private; |
| 1635 | struct seq_tab *p; | 1848 | struct seq_tab *p; |
| 1636 | struct rss_vf_conf *vfconf; | 1849 | struct rss_vf_conf *vfconf; |
| 1637 | int vf; | 1850 | int vf, vfcount = adapter->params.arch.vfcount; |
| 1638 | 1851 | ||
| 1639 | p = seq_open_tab(file, 128, sizeof(*vfconf), 1, rss_vf_config_show); | 1852 | p = seq_open_tab(file, vfcount, sizeof(*vfconf), 1, rss_vf_config_show); |
| 1640 | if (!p) | 1853 | if (!p) |
| 1641 | return -ENOMEM; | 1854 | return -ENOMEM; |
| 1642 | 1855 | ||
| 1643 | vfconf = (struct rss_vf_conf *)p->data; | 1856 | vfconf = (struct rss_vf_conf *)p->data; |
| 1644 | for (vf = 0; vf < 128; vf++) { | 1857 | for (vf = 0; vf < vfcount; vf++) { |
| 1645 | t4_read_rss_vf_config(adapter, vf, &vfconf[vf].rss_vf_vfl, | 1858 | t4_read_rss_vf_config(adapter, vf, &vfconf[vf].rss_vf_vfl, |
| 1646 | &vfconf[vf].rss_vf_vfh); | 1859 | &vfconf[vf].rss_vf_vfh); |
| 1647 | } | 1860 | } |
| @@ -1959,6 +2172,61 @@ static void add_debugfs_mem(struct adapter *adap, const char *name, | |||
| 1959 | size_mb << 20); | 2172 | size_mb << 20); |
| 1960 | } | 2173 | } |
| 1961 | 2174 | ||
| 2175 | static int blocked_fl_open(struct inode *inode, struct file *file) | ||
| 2176 | { | ||
| 2177 | file->private_data = inode->i_private; | ||
| 2178 | return 0; | ||
| 2179 | } | ||
| 2180 | |||
| 2181 | static ssize_t blocked_fl_read(struct file *filp, char __user *ubuf, | ||
| 2182 | size_t count, loff_t *ppos) | ||
| 2183 | { | ||
| 2184 | int len; | ||
| 2185 | const struct adapter *adap = filp->private_data; | ||
| 2186 | char *buf; | ||
| 2187 | ssize_t size = (adap->sge.egr_sz + 3) / 4 + | ||
| 2188 | adap->sge.egr_sz / 32 + 2; /* includes ,/\n/\0 */ | ||
| 2189 | |||
| 2190 | buf = kzalloc(size, GFP_KERNEL); | ||
| 2191 | if (!buf) | ||
| 2192 | return -ENOMEM; | ||
| 2193 | |||
| 2194 | len = snprintf(buf, size - 1, "%*pb\n", | ||
| 2195 | adap->sge.egr_sz, adap->sge.blocked_fl); | ||
| 2196 | len += sprintf(buf + len, "\n"); | ||
| 2197 | size = simple_read_from_buffer(ubuf, count, ppos, buf, len); | ||
| 2198 | t4_free_mem(buf); | ||
| 2199 | return size; | ||
| 2200 | } | ||
| 2201 | |||
| 2202 | static ssize_t blocked_fl_write(struct file *filp, const char __user *ubuf, | ||
| 2203 | size_t count, loff_t *ppos) | ||
| 2204 | { | ||
| 2205 | int err; | ||
| 2206 | unsigned long *t; | ||
| 2207 | struct adapter *adap = filp->private_data; | ||
| 2208 | |||
| 2209 | t = kcalloc(BITS_TO_LONGS(adap->sge.egr_sz), sizeof(long), GFP_KERNEL); | ||
| 2210 | if (!t) | ||
| 2211 | return -ENOMEM; | ||
| 2212 | |||
| 2213 | err = bitmap_parse_user(ubuf, count, t, adap->sge.egr_sz); | ||
| 2214 | if (err) | ||
| 2215 | return err; | ||
| 2216 | |||
| 2217 | bitmap_copy(adap->sge.blocked_fl, t, adap->sge.egr_sz); | ||
| 2218 | t4_free_mem(t); | ||
| 2219 | return count; | ||
| 2220 | } | ||
| 2221 | |||
| 2222 | static const struct file_operations blocked_fl_fops = { | ||
| 2223 | .owner = THIS_MODULE, | ||
| 2224 | .open = blocked_fl_open, | ||
| 2225 | .read = blocked_fl_read, | ||
| 2226 | .write = blocked_fl_write, | ||
| 2227 | .llseek = generic_file_llseek, | ||
| 2228 | }; | ||
| 2229 | |||
| 1962 | /* Add an array of Debug FS files. | 2230 | /* Add an array of Debug FS files. |
| 1963 | */ | 2231 | */ |
| 1964 | void add_debugfs_files(struct adapter *adap, | 2232 | void add_debugfs_files(struct adapter *adap, |
| @@ -1978,11 +2246,13 @@ void add_debugfs_files(struct adapter *adap, | |||
| 1978 | int t4_setup_debugfs(struct adapter *adap) | 2246 | int t4_setup_debugfs(struct adapter *adap) |
| 1979 | { | 2247 | { |
| 1980 | int i; | 2248 | int i; |
| 1981 | u32 size; | 2249 | u32 size = 0; |
| 1982 | struct dentry *de; | 2250 | struct dentry *de; |
| 1983 | 2251 | ||
| 1984 | static struct t4_debugfs_entry t4_debugfs_files[] = { | 2252 | static struct t4_debugfs_entry t4_debugfs_files[] = { |
| 1985 | { "cim_la", &cim_la_fops, S_IRUSR, 0 }, | 2253 | { "cim_la", &cim_la_fops, S_IRUSR, 0 }, |
| 2254 | { "cim_pif_la", &cim_pif_la_fops, S_IRUSR, 0 }, | ||
| 2255 | { "cim_ma_la", &cim_ma_la_fops, S_IRUSR, 0 }, | ||
| 1986 | { "cim_qcfg", &cim_qcfg_fops, S_IRUSR, 0 }, | 2256 | { "cim_qcfg", &cim_qcfg_fops, S_IRUSR, 0 }, |
| 1987 | { "clk", &clk_debugfs_fops, S_IRUSR, 0 }, | 2257 | { "clk", &clk_debugfs_fops, S_IRUSR, 0 }, |
| 1988 | { "devlog", &devlog_fops, S_IRUSR, 0 }, | 2258 | { "devlog", &devlog_fops, S_IRUSR, 0 }, |
| @@ -2018,10 +2288,12 @@ int t4_setup_debugfs(struct adapter *adap) | |||
| 2018 | { "ulprx_la", &ulprx_la_fops, S_IRUSR, 0 }, | 2288 | { "ulprx_la", &ulprx_la_fops, S_IRUSR, 0 }, |
| 2019 | { "sensors", &sensors_debugfs_fops, S_IRUSR, 0 }, | 2289 | { "sensors", &sensors_debugfs_fops, S_IRUSR, 0 }, |
| 2020 | { "pm_stats", &pm_stats_debugfs_fops, S_IRUSR, 0 }, | 2290 | { "pm_stats", &pm_stats_debugfs_fops, S_IRUSR, 0 }, |
| 2291 | { "tx_rate", &tx_rate_debugfs_fops, S_IRUSR, 0 }, | ||
| 2021 | { "cctrl", &cctrl_tbl_debugfs_fops, S_IRUSR, 0 }, | 2292 | { "cctrl", &cctrl_tbl_debugfs_fops, S_IRUSR, 0 }, |
| 2022 | #if IS_ENABLED(CONFIG_IPV6) | 2293 | #if IS_ENABLED(CONFIG_IPV6) |
| 2023 | { "clip_tbl", &clip_tbl_debugfs_fops, S_IRUSR, 0 }, | 2294 | { "clip_tbl", &clip_tbl_debugfs_fops, S_IRUSR, 0 }, |
| 2024 | #endif | 2295 | #endif |
| 2296 | { "blocked_fl", &blocked_fl_fops, S_IRUSR | S_IWUSR, 0 }, | ||
| 2025 | }; | 2297 | }; |
| 2026 | 2298 | ||
| 2027 | /* Debug FS nodes common to all T5 and later adapters. | 2299 | /* Debug FS nodes common to all T5 and later adapters. |
| @@ -2048,12 +2320,7 @@ int t4_setup_debugfs(struct adapter *adap) | |||
| 2048 | size = t4_read_reg(adap, MA_EDRAM1_BAR_A); | 2320 | size = t4_read_reg(adap, MA_EDRAM1_BAR_A); |
| 2049 | add_debugfs_mem(adap, "edc1", MEM_EDC1, EDRAM1_SIZE_G(size)); | 2321 | add_debugfs_mem(adap, "edc1", MEM_EDC1, EDRAM1_SIZE_G(size)); |
| 2050 | } | 2322 | } |
| 2051 | if (is_t4(adap->params.chip)) { | 2323 | if (is_t5(adap->params.chip)) { |
| 2052 | size = t4_read_reg(adap, MA_EXT_MEMORY_BAR_A); | ||
| 2053 | if (i & EXT_MEM_ENABLE_F) | ||
| 2054 | add_debugfs_mem(adap, "mc", MEM_MC, | ||
| 2055 | EXT_MEM_SIZE_G(size)); | ||
| 2056 | } else { | ||
| 2057 | if (i & EXT_MEM0_ENABLE_F) { | 2324 | if (i & EXT_MEM0_ENABLE_F) { |
| 2058 | size = t4_read_reg(adap, MA_EXT_MEMORY0_BAR_A); | 2325 | size = t4_read_reg(adap, MA_EXT_MEMORY0_BAR_A); |
| 2059 | add_debugfs_mem(adap, "mc0", MEM_MC0, | 2326 | add_debugfs_mem(adap, "mc0", MEM_MC0, |
| @@ -2064,6 +2331,11 @@ int t4_setup_debugfs(struct adapter *adap) | |||
| 2064 | add_debugfs_mem(adap, "mc1", MEM_MC1, | 2331 | add_debugfs_mem(adap, "mc1", MEM_MC1, |
| 2065 | EXT_MEM1_SIZE_G(size)); | 2332 | EXT_MEM1_SIZE_G(size)); |
| 2066 | } | 2333 | } |
| 2334 | } else { | ||
| 2335 | if (i & EXT_MEM_ENABLE_F) | ||
| 2336 | size = t4_read_reg(adap, MA_EXT_MEMORY_BAR_A); | ||
| 2337 | add_debugfs_mem(adap, "mc", MEM_MC, | ||
| 2338 | EXT_MEM_SIZE_G(size)); | ||
| 2067 | } | 2339 | } |
| 2068 | 2340 | ||
| 2069 | de = debugfs_create_file_size("flash", S_IRUSR, adap->debugfs_root, adap, | 2341 | de = debugfs_create_file_size("flash", S_IRUSR, adap->debugfs_root, adap, |
