qdio_debug.c (ec208491936d6adb8a70c3dd4a517cdfe54e823d) qdio_debug.c (6486cda6c6b15368e2c925d89b4e9ed13e67b91b)
1/*
2 * drivers/s390/cio/qdio_debug.c
3 *
4 * Copyright IBM Corp. 2008,2009
5 *
6 * Author: Jan Glauber (jang@linux.vnet.ibm.com)
7 */
8#include <linux/seq_file.h>

--- 41 unchanged lines hidden (view full) ---

50{
51 unsigned char state;
52 struct qdio_q *q = m->private;
53 int i;
54
55 if (!q)
56 return 0;
57
1/*
2 * drivers/s390/cio/qdio_debug.c
3 *
4 * Copyright IBM Corp. 2008,2009
5 *
6 * Author: Jan Glauber (jang@linux.vnet.ibm.com)
7 */
8#include <linux/seq_file.h>

--- 41 unchanged lines hidden (view full) ---

50{
51 unsigned char state;
52 struct qdio_q *q = m->private;
53 int i;
54
55 if (!q)
56 return 0;
57
58 seq_printf(m, "device state indicator: %d\n", *(u32 *)q->irq_ptr->dsci);
59 seq_printf(m, "nr_used: %d\n", atomic_read(&q->nr_buf_used));
60 seq_printf(m, "ftc: %d\n", q->first_to_check);
61 seq_printf(m, "last_move: %d\n", q->last_move);
62 seq_printf(m, "polling: %d\n", q->u.in.polling);
63 seq_printf(m, "ack start: %d\n", q->u.in.ack_start);
64 seq_printf(m, "ack count: %d\n", q->u.in.ack_count);
58 seq_printf(m, "DSCI: %d nr_used: %d\n",
59 *(u32 *)q->irq_ptr->dsci, atomic_read(&q->nr_buf_used));
60 seq_printf(m, "ftc: %d last_move: %d\n", q->first_to_check, q->last_move);
61 seq_printf(m, "polling: %d ack start: %d ack count: %d\n",
62 q->u.in.polling, q->u.in.ack_start, q->u.in.ack_count);
65 seq_printf(m, "slsb buffer states:\n");
66 seq_printf(m, "|0 |8 |16 |24 |32 |40 |48 |56 63|\n");
67
68 for (i = 0; i < QDIO_MAX_BUFFERS_PER_Q; i++) {
69 debug_get_buf_state(q, i, &state);
70 switch (state) {
71 case SLSB_P_INPUT_NOT_INIT:
72 case SLSB_P_OUTPUT_NOT_INIT:

--- 32 unchanged lines hidden (view full) ---

105static ssize_t qstat_seq_write(struct file *file, const char __user *buf,
106 size_t count, loff_t *off)
107{
108 struct seq_file *seq = file->private_data;
109 struct qdio_q *q = seq->private;
110
111 if (!q)
112 return 0;
63 seq_printf(m, "slsb buffer states:\n");
64 seq_printf(m, "|0 |8 |16 |24 |32 |40 |48 |56 63|\n");
65
66 for (i = 0; i < QDIO_MAX_BUFFERS_PER_Q; i++) {
67 debug_get_buf_state(q, i, &state);
68 switch (state) {
69 case SLSB_P_INPUT_NOT_INIT:
70 case SLSB_P_OUTPUT_NOT_INIT:

--- 32 unchanged lines hidden (view full) ---

103static ssize_t qstat_seq_write(struct file *file, const char __user *buf,
104 size_t count, loff_t *off)
105{
106 struct seq_file *seq = file->private_data;
107 struct qdio_q *q = seq->private;
108
109 if (!q)
110 return 0;
113
114 if (q->is_input_q)
115 xchg(q->irq_ptr->dsci, 1);
116 local_bh_disable();
117 tasklet_schedule(&q->tasklet);
118 local_bh_enable();
119 return count;
120}
121

--- 7 unchanged lines hidden (view full) ---

129 .owner = THIS_MODULE,
130 .open = qstat_seq_open,
131 .read = seq_read,
132 .write = qstat_seq_write,
133 .llseek = seq_lseek,
134 .release = single_release,
135};
136
111 if (q->is_input_q)
112 xchg(q->irq_ptr->dsci, 1);
113 local_bh_disable();
114 tasklet_schedule(&q->tasklet);
115 local_bh_enable();
116 return count;
117}
118

--- 7 unchanged lines hidden (view full) ---

126 .owner = THIS_MODULE,
127 .open = qstat_seq_open,
128 .read = seq_read,
129 .write = qstat_seq_write,
130 .llseek = seq_lseek,
131 .release = single_release,
132};
133
134static char *qperf_names[] = {
135 "Assumed adapter interrupts",
136 "QDIO interrupts",
137 "Requested PCIs",
138 "Inbound tasklet runs",
139 "Inbound tasklet resched",
140 "Inbound tasklet resched2",
141 "Outbound tasklet runs",
142 "SIGA read",
143 "SIGA write",
144 "SIGA sync",
145 "Inbound calls",
146 "Inbound handler",
147 "Inbound stop_polling",
148 "Inbound queue full",
149 "Outbound calls",
150 "Outbound handler",
151 "Outbound fast_requeue",
152 "Outbound target_full",
153 "QEBSM eqbs",
154 "QEBSM eqbs partial",
155 "QEBSM sqbs",
156 "QEBSM sqbs partial"
157};
158
159static int qperf_show(struct seq_file *m, void *v)
160{
161 struct qdio_irq *irq_ptr = m->private;
162 unsigned int *stat;
163 int i;
164
165 if (!irq_ptr)
166 return 0;
167 if (!irq_ptr->perf_stat_enabled) {
168 seq_printf(m, "disabled\n");
169 return 0;
170 }
171 stat = (unsigned int *)&irq_ptr->perf_stat;
172
173 for (i = 0; i < ARRAY_SIZE(qperf_names); i++)
174 seq_printf(m, "%26s:\t%u\n",
175 qperf_names[i], *(stat + i));
176 return 0;
177}
178
179static ssize_t qperf_seq_write(struct file *file, const char __user *ubuf,
180 size_t count, loff_t *off)
181{
182 struct seq_file *seq = file->private_data;
183 struct qdio_irq *irq_ptr = seq->private;
184 unsigned long val;
185 char buf[8];
186 int ret;
187
188 if (!irq_ptr)
189 return 0;
190 if (count >= sizeof(buf))
191 return -EINVAL;
192 if (copy_from_user(&buf, ubuf, count))
193 return -EFAULT;
194 buf[count] = 0;
195
196 ret = strict_strtoul(buf, 10, &val);
197 if (ret < 0)
198 return ret;
199
200 switch (val) {
201 case 0:
202 irq_ptr->perf_stat_enabled = 0;
203 memset(&irq_ptr->perf_stat, 0, sizeof(irq_ptr->perf_stat));
204 break;
205 case 1:
206 irq_ptr->perf_stat_enabled = 1;
207 break;
208 }
209 return count;
210}
211
212static int qperf_seq_open(struct inode *inode, struct file *filp)
213{
214 return single_open(filp, qperf_show,
215 filp->f_path.dentry->d_inode->i_private);
216}
217
218static struct file_operations debugfs_perf_fops = {
219 .owner = THIS_MODULE,
220 .open = qperf_seq_open,
221 .read = seq_read,
222 .write = qperf_seq_write,
223 .llseek = seq_lseek,
224 .release = single_release,
225};
137static void setup_debugfs_entry(struct qdio_q *q, struct ccw_device *cdev)
138{
139 char name[QDIO_DEBUGFS_NAME_LEN];
140
141 snprintf(name, QDIO_DEBUGFS_NAME_LEN, "%s_%d",
142 q->is_input_q ? "input" : "output",
143 q->nr);
144 q->debugfs_q = debugfs_create_file(name, S_IFREG | S_IRUGO | S_IWUSR,

--- 6 unchanged lines hidden (view full) ---

151{
152 struct qdio_q *q;
153 int i;
154
155 irq_ptr->debugfs_dev = debugfs_create_dir(dev_name(&cdev->dev),
156 debugfs_root);
157 if (IS_ERR(irq_ptr->debugfs_dev))
158 irq_ptr->debugfs_dev = NULL;
226static void setup_debugfs_entry(struct qdio_q *q, struct ccw_device *cdev)
227{
228 char name[QDIO_DEBUGFS_NAME_LEN];
229
230 snprintf(name, QDIO_DEBUGFS_NAME_LEN, "%s_%d",
231 q->is_input_q ? "input" : "output",
232 q->nr);
233 q->debugfs_q = debugfs_create_file(name, S_IFREG | S_IRUGO | S_IWUSR,

--- 6 unchanged lines hidden (view full) ---

240{
241 struct qdio_q *q;
242 int i;
243
244 irq_ptr->debugfs_dev = debugfs_create_dir(dev_name(&cdev->dev),
245 debugfs_root);
246 if (IS_ERR(irq_ptr->debugfs_dev))
247 irq_ptr->debugfs_dev = NULL;
248
249 irq_ptr->debugfs_perf = debugfs_create_file("statistics",
250 S_IFREG | S_IRUGO | S_IWUSR,
251 irq_ptr->debugfs_dev, irq_ptr,
252 &debugfs_perf_fops);
253 if (IS_ERR(irq_ptr->debugfs_perf))
254 irq_ptr->debugfs_perf = NULL;
255
159 for_each_input_queue(irq_ptr, q, i)
160 setup_debugfs_entry(q, cdev);
161 for_each_output_queue(irq_ptr, q, i)
162 setup_debugfs_entry(q, cdev);
163}
164
165void qdio_shutdown_debug_entries(struct qdio_irq *irq_ptr, struct ccw_device *cdev)
166{
167 struct qdio_q *q;
168 int i;
169
170 for_each_input_queue(irq_ptr, q, i)
171 debugfs_remove(q->debugfs_q);
172 for_each_output_queue(irq_ptr, q, i)
173 debugfs_remove(q->debugfs_q);
256 for_each_input_queue(irq_ptr, q, i)
257 setup_debugfs_entry(q, cdev);
258 for_each_output_queue(irq_ptr, q, i)
259 setup_debugfs_entry(q, cdev);
260}
261
262void qdio_shutdown_debug_entries(struct qdio_irq *irq_ptr, struct ccw_device *cdev)
263{
264 struct qdio_q *q;
265 int i;
266
267 for_each_input_queue(irq_ptr, q, i)
268 debugfs_remove(q->debugfs_q);
269 for_each_output_queue(irq_ptr, q, i)
270 debugfs_remove(q->debugfs_q);
271 debugfs_remove(irq_ptr->debugfs_perf);
174 debugfs_remove(irq_ptr->debugfs_dev);
175}
176
177int __init qdio_debug_init(void)
178{
179 debugfs_root = debugfs_create_dir("qdio", NULL);
180
181 qdio_dbf_setup = debug_register("qdio_setup", 16, 1, 16);

--- 19 unchanged lines hidden ---
272 debugfs_remove(irq_ptr->debugfs_dev);
273}
274
275int __init qdio_debug_init(void)
276{
277 debugfs_root = debugfs_create_dir("qdio", NULL);
278
279 qdio_dbf_setup = debug_register("qdio_setup", 16, 1, 16);

--- 19 unchanged lines hidden ---