diff options
-rw-r--r-- | drivers/infiniband/hw/qib/Makefile | 1 | ||||
-rw-r--r-- | drivers/infiniband/hw/qib/qib.h | 36 | ||||
-rw-r--r-- | drivers/infiniband/hw/qib/qib_debugfs.c | 166 | ||||
-rw-r--r-- | drivers/infiniband/hw/qib/qib_debugfs.h | 45 | ||||
-rw-r--r-- | drivers/infiniband/hw/qib/qib_driver.c | 1 | ||||
-rw-r--r-- | drivers/infiniband/hw/qib/qib_init.c | 41 | ||||
-rw-r--r-- | drivers/infiniband/hw/qib/qib_verbs.c | 8 | ||||
-rw-r--r-- | drivers/infiniband/hw/qib/qib_verbs.h | 9 |
8 files changed, 284 insertions, 23 deletions
diff --git a/drivers/infiniband/hw/qib/Makefile b/drivers/infiniband/hw/qib/Makefile index f12d7bb8b39f..57f8103e51f8 100644 --- a/drivers/infiniband/hw/qib/Makefile +++ b/drivers/infiniband/hw/qib/Makefile | |||
@@ -13,3 +13,4 @@ ib_qib-$(CONFIG_PCI_MSI) += qib_iba6120.o | |||
13 | 13 | ||
14 | ib_qib-$(CONFIG_X86_64) += qib_wc_x86_64.o | 14 | ib_qib-$(CONFIG_X86_64) += qib_wc_x86_64.o |
15 | ib_qib-$(CONFIG_PPC64) += qib_wc_ppc64.o | 15 | ib_qib-$(CONFIG_PPC64) += qib_wc_ppc64.o |
16 | ib_qib-$(CONFIG_DEBUG_FS) += qib_debugfs.o | ||
diff --git a/drivers/infiniband/hw/qib/qib.h b/drivers/infiniband/hw/qib/qib.h index 3a78b92cbd4e..5453e2b36567 100644 --- a/drivers/infiniband/hw/qib/qib.h +++ b/drivers/infiniband/hw/qib/qib.h | |||
@@ -115,6 +115,11 @@ struct qib_eep_log_mask { | |||
115 | /* | 115 | /* |
116 | * Below contains all data related to a single context (formerly called port). | 116 | * Below contains all data related to a single context (formerly called port). |
117 | */ | 117 | */ |
118 | |||
119 | #ifdef CONFIG_DEBUG_FS | ||
120 | struct qib_opcode_stats_perctx; | ||
121 | #endif | ||
122 | |||
118 | struct qib_ctxtdata { | 123 | struct qib_ctxtdata { |
119 | void **rcvegrbuf; | 124 | void **rcvegrbuf; |
120 | dma_addr_t *rcvegrbuf_phys; | 125 | dma_addr_t *rcvegrbuf_phys; |
@@ -225,12 +230,15 @@ struct qib_ctxtdata { | |||
225 | u8 redirect_seq_cnt; | 230 | u8 redirect_seq_cnt; |
226 | /* ctxt rcvhdrq head offset */ | 231 | /* ctxt rcvhdrq head offset */ |
227 | u32 head; | 232 | u32 head; |
228 | u32 pkt_count; | ||
229 | /* lookaside fields */ | 233 | /* lookaside fields */ |
230 | struct qib_qp *lookaside_qp; | 234 | struct qib_qp *lookaside_qp; |
231 | u32 lookaside_qpn; | 235 | u32 lookaside_qpn; |
232 | /* QPs waiting for context processing */ | 236 | /* QPs waiting for context processing */ |
233 | struct list_head qp_wait_list; | 237 | struct list_head qp_wait_list; |
238 | #ifdef CONFIG_DEBUG_FS | ||
239 | /* verbs stats per CTX */ | ||
240 | struct qib_opcode_stats_perctx *opstats; | ||
241 | #endif | ||
234 | }; | 242 | }; |
235 | 243 | ||
236 | struct qib_sge_state; | 244 | struct qib_sge_state; |
@@ -1495,27 +1503,23 @@ extern struct mutex qib_mutex; | |||
1495 | * first to avoid possible serial port delays from printk. | 1503 | * first to avoid possible serial port delays from printk. |
1496 | */ | 1504 | */ |
1497 | #define qib_early_err(dev, fmt, ...) \ | 1505 | #define qib_early_err(dev, fmt, ...) \ |
1498 | do { \ | 1506 | dev_err(dev, fmt, ##__VA_ARGS__) |
1499 | dev_err(dev, fmt, ##__VA_ARGS__); \ | ||
1500 | } while (0) | ||
1501 | 1507 | ||
1502 | #define qib_dev_err(dd, fmt, ...) \ | 1508 | #define qib_dev_err(dd, fmt, ...) \ |
1503 | do { \ | 1509 | dev_err(&(dd)->pcidev->dev, "%s: " fmt, \ |
1504 | dev_err(&(dd)->pcidev->dev, "%s: " fmt, \ | 1510 | qib_get_unit_name((dd)->unit), ##__VA_ARGS__) |
1505 | qib_get_unit_name((dd)->unit), ##__VA_ARGS__); \ | 1511 | |
1506 | } while (0) | 1512 | #define qib_dev_warn(dd, fmt, ...) \ |
1513 | dev_warn(&(dd)->pcidev->dev, "%s: " fmt, \ | ||
1514 | qib_get_unit_name((dd)->unit), ##__VA_ARGS__) | ||
1507 | 1515 | ||
1508 | #define qib_dev_porterr(dd, port, fmt, ...) \ | 1516 | #define qib_dev_porterr(dd, port, fmt, ...) \ |
1509 | do { \ | 1517 | dev_err(&(dd)->pcidev->dev, "%s: IB%u:%u " fmt, \ |
1510 | dev_err(&(dd)->pcidev->dev, "%s: IB%u:%u " fmt, \ | 1518 | qib_get_unit_name((dd)->unit), (dd)->unit, (port), \ |
1511 | qib_get_unit_name((dd)->unit), (dd)->unit, (port), \ | 1519 | ##__VA_ARGS__) |
1512 | ##__VA_ARGS__); \ | ||
1513 | } while (0) | ||
1514 | 1520 | ||
1515 | #define qib_devinfo(pcidev, fmt, ...) \ | 1521 | #define qib_devinfo(pcidev, fmt, ...) \ |
1516 | do { \ | 1522 | dev_info(&(pcidev)->dev, fmt, ##__VA_ARGS__) |
1517 | dev_info(&(pcidev)->dev, fmt, ##__VA_ARGS__); \ | ||
1518 | } while (0) | ||
1519 | 1523 | ||
1520 | /* | 1524 | /* |
1521 | * this is used for formatting hw error messages... | 1525 | * this is used for formatting hw error messages... |
diff --git a/drivers/infiniband/hw/qib/qib_debugfs.c b/drivers/infiniband/hw/qib/qib_debugfs.c new file mode 100644 index 000000000000..47d01164cc91 --- /dev/null +++ b/drivers/infiniband/hw/qib/qib_debugfs.c | |||
@@ -0,0 +1,166 @@ | |||
1 | #ifdef CONFIG_DEBUG_FS | ||
2 | /* | ||
3 | * Copyright (c) 2013 Intel Corporation. All rights reserved. | ||
4 | * | ||
5 | * This software is available to you under a choice of one of two | ||
6 | * licenses. You may choose to be licensed under the terms of the GNU | ||
7 | * General Public License (GPL) Version 2, available from the file | ||
8 | * COPYING in the main directory of this source tree, or the | ||
9 | * OpenIB.org BSD license below: | ||
10 | * | ||
11 | * Redistribution and use in source and binary forms, with or | ||
12 | * without modification, are permitted provided that the following | ||
13 | * conditions are met: | ||
14 | * | ||
15 | * - Redistributions of source code must retain the above | ||
16 | * copyright notice, this list of conditions and the following | ||
17 | * disclaimer. | ||
18 | * | ||
19 | * - Redistributions in binary form must reproduce the above | ||
20 | * copyright notice, this list of conditions and the following | ||
21 | * disclaimer in the documentation and/or other materials | ||
22 | * provided with the distribution. | ||
23 | * | ||
24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | ||
28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | ||
29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
31 | * SOFTWARE. | ||
32 | */ | ||
33 | #include <linux/debugfs.h> | ||
34 | #include <linux/seq_file.h> | ||
35 | #include <linux/kernel.h> | ||
36 | #include <linux/export.h> | ||
37 | |||
38 | #include "qib.h" | ||
39 | #include "qib_verbs.h" | ||
40 | #include "qib_debugfs.h" | ||
41 | |||
42 | static struct dentry *qib_dbg_root; | ||
43 | |||
44 | #define DEBUGFS_FILE(name) \ | ||
45 | static const struct seq_operations _##name##_seq_ops = { \ | ||
46 | .start = _##name##_seq_start, \ | ||
47 | .next = _##name##_seq_next, \ | ||
48 | .stop = _##name##_seq_stop, \ | ||
49 | .show = _##name##_seq_show \ | ||
50 | }; \ | ||
51 | static int _##name##_open(struct inode *inode, struct file *s) \ | ||
52 | { \ | ||
53 | struct seq_file *seq; \ | ||
54 | int ret; \ | ||
55 | ret = seq_open(s, &_##name##_seq_ops); \ | ||
56 | if (ret) \ | ||
57 | return ret; \ | ||
58 | seq = s->private_data; \ | ||
59 | seq->private = inode->i_private; \ | ||
60 | return 0; \ | ||
61 | } \ | ||
62 | static const struct file_operations _##name##_file_ops = { \ | ||
63 | .owner = THIS_MODULE, \ | ||
64 | .open = _##name##_open, \ | ||
65 | .read = seq_read, \ | ||
66 | .llseek = seq_lseek, \ | ||
67 | .release = seq_release \ | ||
68 | }; | ||
69 | |||
70 | #define DEBUGFS_FILE_CREATE(name) \ | ||
71 | do { \ | ||
72 | struct dentry *ent; \ | ||
73 | ent = debugfs_create_file(#name , 0400, ibd->qib_ibdev_dbg, \ | ||
74 | ibd, &_##name##_file_ops); \ | ||
75 | if (!ent) \ | ||
76 | pr_warn("create of " #name " failed\n"); \ | ||
77 | } while (0) | ||
78 | |||
79 | static void *_opcode_stats_seq_start(struct seq_file *s, loff_t *pos) | ||
80 | { | ||
81 | struct qib_opcode_stats_perctx *opstats; | ||
82 | |||
83 | if (*pos >= ARRAY_SIZE(opstats->stats)) | ||
84 | return NULL; | ||
85 | return pos; | ||
86 | } | ||
87 | |||
88 | static void *_opcode_stats_seq_next(struct seq_file *s, void *v, loff_t *pos) | ||
89 | { | ||
90 | struct qib_opcode_stats_perctx *opstats; | ||
91 | |||
92 | ++*pos; | ||
93 | if (*pos >= ARRAY_SIZE(opstats->stats)) | ||
94 | return NULL; | ||
95 | return pos; | ||
96 | } | ||
97 | |||
98 | |||
99 | static void _opcode_stats_seq_stop(struct seq_file *s, void *v) | ||
100 | { | ||
101 | /* nothing allocated */ | ||
102 | } | ||
103 | |||
104 | static int _opcode_stats_seq_show(struct seq_file *s, void *v) | ||
105 | { | ||
106 | loff_t *spos = v; | ||
107 | loff_t i = *spos, j; | ||
108 | u64 n_packets = 0, n_bytes = 0; | ||
109 | struct qib_ibdev *ibd = (struct qib_ibdev *)s->private; | ||
110 | struct qib_devdata *dd = dd_from_dev(ibd); | ||
111 | |||
112 | for (j = 0; j < dd->first_user_ctxt; j++) { | ||
113 | if (!dd->rcd[j]) | ||
114 | continue; | ||
115 | n_packets += dd->rcd[j]->opstats->stats[i].n_packets; | ||
116 | n_bytes += dd->rcd[j]->opstats->stats[i].n_bytes; | ||
117 | } | ||
118 | if (!n_packets && !n_bytes) | ||
119 | return SEQ_SKIP; | ||
120 | seq_printf(s, "%02llx %llu/%llu\n", i, | ||
121 | (unsigned long long) n_packets, | ||
122 | (unsigned long long) n_bytes); | ||
123 | |||
124 | return 0; | ||
125 | } | ||
126 | |||
127 | DEBUGFS_FILE(opcode_stats) | ||
128 | |||
129 | void qib_dbg_ibdev_init(struct qib_ibdev *ibd) | ||
130 | { | ||
131 | char name[10]; | ||
132 | |||
133 | snprintf(name, sizeof(name), "qib%d", dd_from_dev(ibd)->unit); | ||
134 | ibd->qib_ibdev_dbg = debugfs_create_dir(name, qib_dbg_root); | ||
135 | if (!ibd->qib_ibdev_dbg) { | ||
136 | pr_warn("create of %s failed\n", name); | ||
137 | return; | ||
138 | } | ||
139 | DEBUGFS_FILE_CREATE(opcode_stats); | ||
140 | return; | ||
141 | } | ||
142 | |||
143 | void qib_dbg_ibdev_exit(struct qib_ibdev *ibd) | ||
144 | { | ||
145 | if (!qib_dbg_root) | ||
146 | goto out; | ||
147 | debugfs_remove_recursive(ibd->qib_ibdev_dbg); | ||
148 | out: | ||
149 | ibd->qib_ibdev_dbg = NULL; | ||
150 | } | ||
151 | |||
152 | void qib_dbg_init(void) | ||
153 | { | ||
154 | qib_dbg_root = debugfs_create_dir(QIB_DRV_NAME, NULL); | ||
155 | if (!qib_dbg_root) | ||
156 | pr_warn("init of debugfs failed\n"); | ||
157 | } | ||
158 | |||
159 | void qib_dbg_exit(void) | ||
160 | { | ||
161 | debugfs_remove_recursive(qib_dbg_root); | ||
162 | qib_dbg_root = NULL; | ||
163 | } | ||
164 | |||
165 | #endif | ||
166 | |||
diff --git a/drivers/infiniband/hw/qib/qib_debugfs.h b/drivers/infiniband/hw/qib/qib_debugfs.h new file mode 100644 index 000000000000..7ae983a91b8b --- /dev/null +++ b/drivers/infiniband/hw/qib/qib_debugfs.h | |||
@@ -0,0 +1,45 @@ | |||
1 | #ifndef _QIB_DEBUGFS_H | ||
2 | #define _QIB_DEBUGFS_H | ||
3 | |||
4 | #ifdef CONFIG_DEBUG_FS | ||
5 | /* | ||
6 | * Copyright (c) 2013 Intel Corporation. All rights reserved. | ||
7 | * | ||
8 | * This software is available to you under a choice of one of two | ||
9 | * licenses. You may choose to be licensed under the terms of the GNU | ||
10 | * General Public License (GPL) Version 2, available from the file | ||
11 | * COPYING in the main directory of this source tree, or the | ||
12 | * OpenIB.org BSD license below: | ||
13 | * | ||
14 | * Redistribution and use in source and binary forms, with or | ||
15 | * without modification, are permitted provided that the following | ||
16 | * conditions are met: | ||
17 | * | ||
18 | * - Redistributions of source code must retain the above | ||
19 | * copyright notice, this list of conditions and the following | ||
20 | * disclaimer. | ||
21 | * | ||
22 | * - Redistributions in binary form must reproduce the above | ||
23 | * copyright notice, this list of conditions and the following | ||
24 | * disclaimer in the documentation and/or other materials | ||
25 | * provided with the distribution. | ||
26 | * | ||
27 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
28 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
29 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
30 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | ||
31 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | ||
32 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
33 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
34 | * SOFTWARE. | ||
35 | */ | ||
36 | |||
37 | struct qib_ibdev; | ||
38 | void qib_dbg_ibdev_init(struct qib_ibdev *ibd); | ||
39 | void qib_dbg_ibdev_exit(struct qib_ibdev *ibd); | ||
40 | void qib_dbg_init(void); | ||
41 | void qib_dbg_exit(void); | ||
42 | |||
43 | #endif | ||
44 | |||
45 | #endif /* _QIB_DEBUGFS_H */ | ||
diff --git a/drivers/infiniband/hw/qib/qib_driver.c b/drivers/infiniband/hw/qib/qib_driver.c index 216092477dfc..5bee08f16d74 100644 --- a/drivers/infiniband/hw/qib/qib_driver.c +++ b/drivers/infiniband/hw/qib/qib_driver.c | |||
@@ -558,7 +558,6 @@ move_along: | |||
558 | } | 558 | } |
559 | 559 | ||
560 | rcd->head = l; | 560 | rcd->head = l; |
561 | rcd->pkt_count += i; | ||
562 | 561 | ||
563 | /* | 562 | /* |
564 | * Iterate over all QPs waiting to respond. | 563 | * Iterate over all QPs waiting to respond. |
diff --git a/drivers/infiniband/hw/qib/qib_init.c b/drivers/infiniband/hw/qib/qib_init.c index ff36903474ea..fdae42973056 100644 --- a/drivers/infiniband/hw/qib/qib_init.c +++ b/drivers/infiniband/hw/qib/qib_init.c | |||
@@ -46,6 +46,10 @@ | |||
46 | #include "qib.h" | 46 | #include "qib.h" |
47 | #include "qib_common.h" | 47 | #include "qib_common.h" |
48 | #include "qib_mad.h" | 48 | #include "qib_mad.h" |
49 | #ifdef CONFIG_DEBUG_FS | ||
50 | #include "qib_debugfs.h" | ||
51 | #include "qib_verbs.h" | ||
52 | #endif | ||
49 | 53 | ||
50 | #undef pr_fmt | 54 | #undef pr_fmt |
51 | #define pr_fmt(fmt) QIB_DRV_NAME ": " fmt | 55 | #define pr_fmt(fmt) QIB_DRV_NAME ": " fmt |
@@ -188,7 +192,18 @@ struct qib_ctxtdata *qib_create_ctxtdata(struct qib_pportdata *ppd, u32 ctxt, | |||
188 | rcd->cnt = 1; | 192 | rcd->cnt = 1; |
189 | rcd->ctxt = ctxt; | 193 | rcd->ctxt = ctxt; |
190 | dd->rcd[ctxt] = rcd; | 194 | dd->rcd[ctxt] = rcd; |
191 | 195 | #ifdef CONFIG_DEBUG_FS | |
196 | if (ctxt < dd->first_user_ctxt) { /* N/A for PSM contexts */ | ||
197 | rcd->opstats = kzalloc_node(sizeof(*rcd->opstats), | ||
198 | GFP_KERNEL, node_id); | ||
199 | if (!rcd->opstats) { | ||
200 | kfree(rcd); | ||
201 | qib_dev_err(dd, | ||
202 | "Unable to allocate per ctxt stats buffer\n"); | ||
203 | return NULL; | ||
204 | } | ||
205 | } | ||
206 | #endif | ||
192 | dd->f_init_ctxt(rcd); | 207 | dd->f_init_ctxt(rcd); |
193 | 208 | ||
194 | /* | 209 | /* |
@@ -959,6 +974,10 @@ void qib_free_ctxtdata(struct qib_devdata *dd, struct qib_ctxtdata *rcd) | |||
959 | vfree(rcd->subctxt_uregbase); | 974 | vfree(rcd->subctxt_uregbase); |
960 | vfree(rcd->subctxt_rcvegrbuf); | 975 | vfree(rcd->subctxt_rcvegrbuf); |
961 | vfree(rcd->subctxt_rcvhdr_base); | 976 | vfree(rcd->subctxt_rcvhdr_base); |
977 | #ifdef CONFIG_DEBUG_FS | ||
978 | kfree(rcd->opstats); | ||
979 | rcd->opstats = NULL; | ||
980 | #endif | ||
962 | kfree(rcd); | 981 | kfree(rcd); |
963 | } | 982 | } |
964 | 983 | ||
@@ -1048,7 +1067,6 @@ done: | |||
1048 | dd->f_set_armlaunch(dd, 1); | 1067 | dd->f_set_armlaunch(dd, 1); |
1049 | } | 1068 | } |
1050 | 1069 | ||
1051 | |||
1052 | void qib_free_devdata(struct qib_devdata *dd) | 1070 | void qib_free_devdata(struct qib_devdata *dd) |
1053 | { | 1071 | { |
1054 | unsigned long flags; | 1072 | unsigned long flags; |
@@ -1058,6 +1076,9 @@ void qib_free_devdata(struct qib_devdata *dd) | |||
1058 | list_del(&dd->list); | 1076 | list_del(&dd->list); |
1059 | spin_unlock_irqrestore(&qib_devs_lock, flags); | 1077 | spin_unlock_irqrestore(&qib_devs_lock, flags); |
1060 | 1078 | ||
1079 | #ifdef CONFIG_DEBUG_FS | ||
1080 | qib_dbg_ibdev_exit(&dd->verbs_dev); | ||
1081 | #endif | ||
1061 | ib_dealloc_device(&dd->verbs_dev.ibdev); | 1082 | ib_dealloc_device(&dd->verbs_dev.ibdev); |
1062 | } | 1083 | } |
1063 | 1084 | ||
@@ -1081,6 +1102,10 @@ struct qib_devdata *qib_alloc_devdata(struct pci_dev *pdev, size_t extra) | |||
1081 | goto bail; | 1102 | goto bail; |
1082 | } | 1103 | } |
1083 | 1104 | ||
1105 | #ifdef CONFIG_DEBUG_FS | ||
1106 | qib_dbg_ibdev_init(&dd->verbs_dev); | ||
1107 | #endif | ||
1108 | |||
1084 | idr_preload(GFP_KERNEL); | 1109 | idr_preload(GFP_KERNEL); |
1085 | spin_lock_irqsave(&qib_devs_lock, flags); | 1110 | spin_lock_irqsave(&qib_devs_lock, flags); |
1086 | 1111 | ||
@@ -1096,6 +1121,9 @@ struct qib_devdata *qib_alloc_devdata(struct pci_dev *pdev, size_t extra) | |||
1096 | if (ret < 0) { | 1121 | if (ret < 0) { |
1097 | qib_early_err(&pdev->dev, | 1122 | qib_early_err(&pdev->dev, |
1098 | "Could not allocate unit ID: error %d\n", -ret); | 1123 | "Could not allocate unit ID: error %d\n", -ret); |
1124 | #ifdef CONFIG_DEBUG_FS | ||
1125 | qib_dbg_ibdev_exit(&dd->verbs_dev); | ||
1126 | #endif | ||
1099 | ib_dealloc_device(&dd->verbs_dev.ibdev); | 1127 | ib_dealloc_device(&dd->verbs_dev.ibdev); |
1100 | dd = ERR_PTR(ret); | 1128 | dd = ERR_PTR(ret); |
1101 | goto bail; | 1129 | goto bail; |
@@ -1223,6 +1251,9 @@ static int __init qlogic_ib_init(void) | |||
1223 | #ifdef CONFIG_INFINIBAND_QIB_DCA | 1251 | #ifdef CONFIG_INFINIBAND_QIB_DCA |
1224 | dca_register_notify(&dca_notifier); | 1252 | dca_register_notify(&dca_notifier); |
1225 | #endif | 1253 | #endif |
1254 | #ifdef CONFIG_DEBUG_FS | ||
1255 | qib_dbg_init(); | ||
1256 | #endif | ||
1226 | ret = pci_register_driver(&qib_driver); | 1257 | ret = pci_register_driver(&qib_driver); |
1227 | if (ret < 0) { | 1258 | if (ret < 0) { |
1228 | pr_err("Unable to register driver: error %d\n", -ret); | 1259 | pr_err("Unable to register driver: error %d\n", -ret); |
@@ -1238,6 +1269,9 @@ bail_dev: | |||
1238 | #ifdef CONFIG_INFINIBAND_QIB_DCA | 1269 | #ifdef CONFIG_INFINIBAND_QIB_DCA |
1239 | dca_unregister_notify(&dca_notifier); | 1270 | dca_unregister_notify(&dca_notifier); |
1240 | #endif | 1271 | #endif |
1272 | #ifdef CONFIG_DEBUG_FS | ||
1273 | qib_dbg_exit(); | ||
1274 | #endif | ||
1241 | idr_destroy(&qib_unit_table); | 1275 | idr_destroy(&qib_unit_table); |
1242 | qib_dev_cleanup(); | 1276 | qib_dev_cleanup(); |
1243 | bail: | 1277 | bail: |
@@ -1263,6 +1297,9 @@ static void __exit qlogic_ib_cleanup(void) | |||
1263 | dca_unregister_notify(&dca_notifier); | 1297 | dca_unregister_notify(&dca_notifier); |
1264 | #endif | 1298 | #endif |
1265 | pci_unregister_driver(&qib_driver); | 1299 | pci_unregister_driver(&qib_driver); |
1300 | #ifdef CONFIG_DEBUG_FS | ||
1301 | qib_dbg_exit(); | ||
1302 | #endif | ||
1266 | 1303 | ||
1267 | qib_cpulist_count = 0; | 1304 | qib_cpulist_count = 0; |
1268 | kfree(qib_cpulist); | 1305 | kfree(qib_cpulist); |
diff --git a/drivers/infiniband/hw/qib/qib_verbs.c b/drivers/infiniband/hw/qib/qib_verbs.c index 904c384aa361..092b0bb1bb78 100644 --- a/drivers/infiniband/hw/qib/qib_verbs.c +++ b/drivers/infiniband/hw/qib/qib_verbs.c | |||
@@ -645,9 +645,11 @@ void qib_ib_rcv(struct qib_ctxtdata *rcd, void *rhdr, void *data, u32 tlen) | |||
645 | } else | 645 | } else |
646 | goto drop; | 646 | goto drop; |
647 | 647 | ||
648 | opcode = be32_to_cpu(ohdr->bth[0]) >> 24; | 648 | opcode = (be32_to_cpu(ohdr->bth[0]) >> 24) & 0x7f; |
649 | ibp->opstats[opcode & 0x7f].n_bytes += tlen; | 649 | #ifdef CONFIG_DEBUG_FS |
650 | ibp->opstats[opcode & 0x7f].n_packets++; | 650 | rcd->opstats->stats[opcode].n_bytes += tlen; |
651 | rcd->opstats->stats[opcode].n_packets++; | ||
652 | #endif | ||
651 | 653 | ||
652 | /* Get the destination QP number. */ | 654 | /* Get the destination QP number. */ |
653 | qp_num = be32_to_cpu(ohdr->bth[1]) & QIB_QPN_MASK; | 655 | qp_num = be32_to_cpu(ohdr->bth[1]) & QIB_QPN_MASK; |
diff --git a/drivers/infiniband/hw/qib/qib_verbs.h b/drivers/infiniband/hw/qib/qib_verbs.h index 86c2cb3c9caf..4a22a85b9f03 100644 --- a/drivers/infiniband/hw/qib/qib_verbs.h +++ b/drivers/infiniband/hw/qib/qib_verbs.h | |||
@@ -660,6 +660,10 @@ struct qib_opcode_stats { | |||
660 | u64 n_bytes; /* total number of bytes */ | 660 | u64 n_bytes; /* total number of bytes */ |
661 | }; | 661 | }; |
662 | 662 | ||
663 | struct qib_opcode_stats_perctx { | ||
664 | struct qib_opcode_stats stats[128]; | ||
665 | }; | ||
666 | |||
663 | struct qib_ibport { | 667 | struct qib_ibport { |
664 | struct qib_qp __rcu *qp0; | 668 | struct qib_qp __rcu *qp0; |
665 | struct qib_qp __rcu *qp1; | 669 | struct qib_qp __rcu *qp1; |
@@ -726,7 +730,6 @@ struct qib_ibport { | |||
726 | u8 vl_high_limit; | 730 | u8 vl_high_limit; |
727 | u8 sl_to_vl[16]; | 731 | u8 sl_to_vl[16]; |
728 | 732 | ||
729 | struct qib_opcode_stats opstats[128]; | ||
730 | }; | 733 | }; |
731 | 734 | ||
732 | 735 | ||
@@ -770,6 +773,10 @@ struct qib_ibdev { | |||
770 | spinlock_t n_srqs_lock; | 773 | spinlock_t n_srqs_lock; |
771 | u32 n_mcast_grps_allocated; /* number of mcast groups allocated */ | 774 | u32 n_mcast_grps_allocated; /* number of mcast groups allocated */ |
772 | spinlock_t n_mcast_grps_lock; | 775 | spinlock_t n_mcast_grps_lock; |
776 | #ifdef CONFIG_DEBUG_FS | ||
777 | /* per HCA debugfs */ | ||
778 | struct dentry *qib_ibdev_dbg; | ||
779 | #endif | ||
773 | }; | 780 | }; |
774 | 781 | ||
775 | struct qib_verbs_counters { | 782 | struct qib_verbs_counters { |