diff options
author | Hariprasad Shenai <hariprasad@chelsio.com> | 2015-01-27 03:17:46 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-01-27 03:15:01 -0500 |
commit | e5f0e43bee31d38fa5a2e9f9c0fc288b2bca6c88 (patch) | |
tree | 26e0be2b7dbf54febbadb0db79c141687b8d2ac9 /drivers/net/ethernet/chelsio | |
parent | dc9daab226aaacc2402d46af79a8a4a1765ca53a (diff) |
cxgb4: Added support in debugfs to dump cim ingress bound queue contents
Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/chelsio')
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | 42 | ||||
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 42 | ||||
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/t4_hw.h | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/t4_regs.h | 17 |
5 files changed, 104 insertions, 0 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h index 533a69106513..368b5ad20835 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | |||
@@ -1054,6 +1054,8 @@ int t4_mc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, | |||
1054 | u64 *parity); | 1054 | u64 *parity); |
1055 | int t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, | 1055 | int t4_edc_read(struct adapter *adap, int idx, u32 addr, __be32 *data, |
1056 | u64 *parity); | 1056 | u64 *parity); |
1057 | int t4_read_cim_ibq(struct adapter *adap, unsigned int qid, u32 *data, | ||
1058 | size_t n); | ||
1057 | int t4_cim_read(struct adapter *adap, unsigned int addr, unsigned int n, | 1059 | int t4_cim_read(struct adapter *adap, unsigned int addr, unsigned int n, |
1058 | unsigned int *valp); | 1060 | unsigned int *valp); |
1059 | int t4_cim_write(struct adapter *adap, unsigned int addr, unsigned int n, | 1061 | int t4_cim_write(struct adapter *adap, unsigned int addr, unsigned int n, |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c index eb420e182084..3f4b07ef580e 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c | |||
@@ -239,6 +239,42 @@ static const struct file_operations cim_qcfg_fops = { | |||
239 | .release = single_release, | 239 | .release = single_release, |
240 | }; | 240 | }; |
241 | 241 | ||
242 | static int cimq_show(struct seq_file *seq, void *v, int idx) | ||
243 | { | ||
244 | const u32 *p = v; | ||
245 | |||
246 | seq_printf(seq, "%#06x: %08x %08x %08x %08x\n", idx * 16, p[0], p[1], | ||
247 | p[2], p[3]); | ||
248 | return 0; | ||
249 | } | ||
250 | |||
251 | static int cim_ibq_open(struct inode *inode, struct file *file) | ||
252 | { | ||
253 | int ret; | ||
254 | struct seq_tab *p; | ||
255 | unsigned int qid = (uintptr_t)inode->i_private & 7; | ||
256 | struct adapter *adap = inode->i_private - qid; | ||
257 | |||
258 | p = seq_open_tab(file, CIM_IBQ_SIZE, 4 * sizeof(u32), 0, cimq_show); | ||
259 | if (!p) | ||
260 | return -ENOMEM; | ||
261 | |||
262 | ret = t4_read_cim_ibq(adap, qid, (u32 *)p->data, CIM_IBQ_SIZE * 4); | ||
263 | if (ret < 0) | ||
264 | seq_release_private(inode, file); | ||
265 | else | ||
266 | ret = 0; | ||
267 | return ret; | ||
268 | } | ||
269 | |||
270 | static const struct file_operations cim_ibq_fops = { | ||
271 | .owner = THIS_MODULE, | ||
272 | .open = cim_ibq_open, | ||
273 | .read = seq_read, | ||
274 | .llseek = seq_lseek, | ||
275 | .release = seq_release_private | ||
276 | }; | ||
277 | |||
242 | /* Firmware Device Log dump. */ | 278 | /* Firmware Device Log dump. */ |
243 | static const char * const devlog_level_strings[] = { | 279 | static const char * const devlog_level_strings[] = { |
244 | [FW_DEVLOG_LEVEL_EMERG] = "EMERG", | 280 | [FW_DEVLOG_LEVEL_EMERG] = "EMERG", |
@@ -1346,6 +1382,12 @@ int t4_setup_debugfs(struct adapter *adap) | |||
1346 | { "rss_pf_config", &rss_pf_config_debugfs_fops, S_IRUSR, 0 }, | 1382 | { "rss_pf_config", &rss_pf_config_debugfs_fops, S_IRUSR, 0 }, |
1347 | { "rss_vf_config", &rss_vf_config_debugfs_fops, S_IRUSR, 0 }, | 1383 | { "rss_vf_config", &rss_vf_config_debugfs_fops, S_IRUSR, 0 }, |
1348 | { "sge_qinfo", &sge_qinfo_debugfs_fops, S_IRUSR, 0 }, | 1384 | { "sge_qinfo", &sge_qinfo_debugfs_fops, S_IRUSR, 0 }, |
1385 | { "ibq_tp0", &cim_ibq_fops, S_IRUSR, 0 }, | ||
1386 | { "ibq_tp1", &cim_ibq_fops, S_IRUSR, 1 }, | ||
1387 | { "ibq_ulp", &cim_ibq_fops, S_IRUSR, 2 }, | ||
1388 | { "ibq_sge0", &cim_ibq_fops, S_IRUSR, 3 }, | ||
1389 | { "ibq_sge1", &cim_ibq_fops, S_IRUSR, 4 }, | ||
1390 | { "ibq_ncsi", &cim_ibq_fops, S_IRUSR, 5 }, | ||
1349 | #if IS_ENABLED(CONFIG_IPV6) | 1391 | #if IS_ENABLED(CONFIG_IPV6) |
1350 | { "clip_tbl", &clip_tbl_debugfs_fops, S_IRUSR, 0 }, | 1392 | { "clip_tbl", &clip_tbl_debugfs_fops, S_IRUSR, 0 }, |
1351 | #endif | 1393 | #endif |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c index 8f99878a4913..4ea4a4a9c426 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | |||
@@ -4526,6 +4526,48 @@ void t4_read_cimq_cfg(struct adapter *adap, u16 *base, u16 *size, u16 *thres) | |||
4526 | } | 4526 | } |
4527 | 4527 | ||
4528 | /** | 4528 | /** |
4529 | * t4_read_cim_ibq - read the contents of a CIM inbound queue | ||
4530 | * @adap: the adapter | ||
4531 | * @qid: the queue index | ||
4532 | * @data: where to store the queue contents | ||
4533 | * @n: capacity of @data in 32-bit words | ||
4534 | * | ||
4535 | * Reads the contents of the selected CIM queue starting at address 0 up | ||
4536 | * to the capacity of @data. @n must be a multiple of 4. Returns < 0 on | ||
4537 | * error and the number of 32-bit words actually read on success. | ||
4538 | */ | ||
4539 | int t4_read_cim_ibq(struct adapter *adap, unsigned int qid, u32 *data, size_t n) | ||
4540 | { | ||
4541 | int i, err, attempts; | ||
4542 | unsigned int addr; | ||
4543 | const unsigned int nwords = CIM_IBQ_SIZE * 4; | ||
4544 | |||
4545 | if (qid > 5 || (n & 3)) | ||
4546 | return -EINVAL; | ||
4547 | |||
4548 | addr = qid * nwords; | ||
4549 | if (n > nwords) | ||
4550 | n = nwords; | ||
4551 | |||
4552 | /* It might take 3-10ms before the IBQ debug read access is allowed. | ||
4553 | * Wait for 1 Sec with a delay of 1 usec. | ||
4554 | */ | ||
4555 | attempts = 1000000; | ||
4556 | |||
4557 | for (i = 0; i < n; i++, addr++) { | ||
4558 | t4_write_reg(adap, CIM_IBQ_DBG_CFG_A, IBQDBGADDR_V(addr) | | ||
4559 | IBQDBGEN_F); | ||
4560 | err = t4_wait_op_done(adap, CIM_IBQ_DBG_CFG_A, IBQDBGBUSY_F, 0, | ||
4561 | attempts, 1); | ||
4562 | if (err) | ||
4563 | return err; | ||
4564 | *data++ = t4_read_reg(adap, CIM_IBQ_DBG_DATA_A); | ||
4565 | } | ||
4566 | t4_write_reg(adap, CIM_IBQ_DBG_CFG_A, 0); | ||
4567 | return i; | ||
4568 | } | ||
4569 | |||
4570 | /** | ||
4529 | * t4_cim_read - read a block from CIM internal address space | 4571 | * t4_cim_read - read a block from CIM internal address space |
4530 | * @adap: the adapter | 4572 | * @adap: the adapter |
4531 | * @addr: the start address within the CIM address space | 4573 | * @addr: the start address within the CIM address space |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.h b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.h index f6b82da350e2..6581cd5949d1 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.h +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.h | |||
@@ -60,6 +60,7 @@ enum { | |||
60 | CIM_NUM_OBQ = 6, /* # of CIM OBQs */ | 60 | CIM_NUM_OBQ = 6, /* # of CIM OBQs */ |
61 | CIM_NUM_OBQ_T5 = 8, /* # of CIM OBQs for T5 adapter */ | 61 | CIM_NUM_OBQ_T5 = 8, /* # of CIM OBQs for T5 adapter */ |
62 | CIMLA_SIZE = 2048, /* # of 32-bit words in CIM LA */ | 62 | CIMLA_SIZE = 2048, /* # of 32-bit words in CIM LA */ |
63 | CIM_IBQ_SIZE = 128, /* # of 128-bit words in a CIM IBQ */ | ||
63 | }; | 64 | }; |
64 | 65 | ||
65 | enum { | 66 | enum { |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h b/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h index e036b563bf3c..39e4b7565a34 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h | |||
@@ -2538,6 +2538,23 @@ | |||
2538 | #define HOSTWRITE_V(x) ((x) << HOSTWRITE_S) | 2538 | #define HOSTWRITE_V(x) ((x) << HOSTWRITE_S) |
2539 | #define HOSTWRITE_F HOSTWRITE_V(1U) | 2539 | #define HOSTWRITE_F HOSTWRITE_V(1U) |
2540 | 2540 | ||
2541 | #define CIM_IBQ_DBG_CFG_A 0x7b60 | ||
2542 | |||
2543 | #define IBQDBGADDR_S 16 | ||
2544 | #define IBQDBGADDR_M 0xfffU | ||
2545 | #define IBQDBGADDR_V(x) ((x) << IBQDBGADDR_S) | ||
2546 | #define IBQDBGADDR_G(x) (((x) >> IBQDBGADDR_S) & IBQDBGADDR_M) | ||
2547 | |||
2548 | #define IBQDBGBUSY_S 1 | ||
2549 | #define IBQDBGBUSY_V(x) ((x) << IBQDBGBUSY_S) | ||
2550 | #define IBQDBGBUSY_F IBQDBGBUSY_V(1U) | ||
2551 | |||
2552 | #define IBQDBGEN_S 0 | ||
2553 | #define IBQDBGEN_V(x) ((x) << IBQDBGEN_S) | ||
2554 | #define IBQDBGEN_F IBQDBGEN_V(1U) | ||
2555 | |||
2556 | #define CIM_IBQ_DBG_DATA_A 0x7b68 | ||
2557 | |||
2541 | #define UPDBGLARDEN_S 1 | 2558 | #define UPDBGLARDEN_S 1 |
2542 | #define UPDBGLARDEN_V(x) ((x) << UPDBGLARDEN_S) | 2559 | #define UPDBGLARDEN_V(x) ((x) << UPDBGLARDEN_S) |
2543 | #define UPDBGLARDEN_F UPDBGLARDEN_V(1U) | 2560 | #define UPDBGLARDEN_F UPDBGLARDEN_V(1U) |