| .. | .. |
|---|
| 58 | 58 | mutex_unlock(&qdio_dbf_list_mutex); |
|---|
| 59 | 59 | } |
|---|
| 60 | 60 | |
|---|
| 61 | | -int qdio_allocate_dbf(struct qdio_initialize *init_data, |
|---|
| 62 | | - struct qdio_irq *irq_ptr) |
|---|
| 61 | +int qdio_allocate_dbf(struct qdio_irq *irq_ptr) |
|---|
| 63 | 62 | { |
|---|
| 64 | 63 | char text[QDIO_DBF_NAME_LEN]; |
|---|
| 65 | 64 | struct qdio_dbf_entry *new_entry; |
|---|
| 66 | 65 | |
|---|
| 67 | | - DBF_EVENT("qfmt:%1d", init_data->q_format); |
|---|
| 68 | | - DBF_HEX(init_data->adapter_name, 8); |
|---|
| 69 | | - DBF_EVENT("qpff%4x", init_data->qib_param_field_format); |
|---|
| 70 | | - DBF_HEX(&init_data->qib_param_field, sizeof(void *)); |
|---|
| 71 | | - DBF_HEX(&init_data->input_slib_elements, sizeof(void *)); |
|---|
| 72 | | - DBF_HEX(&init_data->output_slib_elements, sizeof(void *)); |
|---|
| 73 | | - DBF_EVENT("niq:%1d noq:%1d", init_data->no_input_qs, |
|---|
| 74 | | - init_data->no_output_qs); |
|---|
| 75 | | - DBF_HEX(&init_data->input_handler, sizeof(void *)); |
|---|
| 76 | | - DBF_HEX(&init_data->output_handler, sizeof(void *)); |
|---|
| 77 | | - DBF_HEX(&init_data->int_parm, sizeof(long)); |
|---|
| 78 | | - DBF_HEX(&init_data->input_sbal_addr_array, sizeof(void *)); |
|---|
| 79 | | - DBF_HEX(&init_data->output_sbal_addr_array, sizeof(void *)); |
|---|
| 80 | 66 | DBF_EVENT("irq:%8lx", (unsigned long)irq_ptr); |
|---|
| 81 | 67 | |
|---|
| 82 | 68 | /* allocate trace view for the interface */ |
|---|
| 83 | 69 | snprintf(text, QDIO_DBF_NAME_LEN, "qdio_%s", |
|---|
| 84 | | - dev_name(&init_data->cdev->dev)); |
|---|
| 70 | + dev_name(&irq_ptr->cdev->dev)); |
|---|
| 85 | 71 | irq_ptr->debug_area = qdio_get_dbf_entry(text); |
|---|
| 86 | 72 | if (irq_ptr->debug_area) |
|---|
| 87 | 73 | DBF_DEV_EVENT(DBF_ERR, irq_ptr, "dbf reused"); |
|---|
| .. | .. |
|---|
| 121 | 107 | |
|---|
| 122 | 108 | seq_printf(m, "Timestamp: %Lx Last AI: %Lx\n", |
|---|
| 123 | 109 | q->timestamp, last_ai_time); |
|---|
| 124 | | - seq_printf(m, "nr_used: %d ftc: %d last_move: %d\n", |
|---|
| 125 | | - atomic_read(&q->nr_buf_used), |
|---|
| 126 | | - q->first_to_check, q->last_move); |
|---|
| 110 | + seq_printf(m, "nr_used: %d ftc: %d\n", |
|---|
| 111 | + atomic_read(&q->nr_buf_used), q->first_to_check); |
|---|
| 127 | 112 | if (q->is_input_q) { |
|---|
| 128 | | - seq_printf(m, "polling: %d ack start: %d ack count: %d\n", |
|---|
| 129 | | - q->u.in.polling, q->u.in.ack_start, |
|---|
| 130 | | - q->u.in.ack_count); |
|---|
| 131 | | - seq_printf(m, "DSCI: %d IRQs disabled: %u\n", |
|---|
| 132 | | - *(u32 *)q->irq_ptr->dsci, |
|---|
| 133 | | - test_bit(QDIO_QUEUE_IRQS_DISABLED, |
|---|
| 134 | | - &q->u.in.queue_irq_state)); |
|---|
| 113 | + seq_printf(m, "batch start: %u batch count: %u\n", |
|---|
| 114 | + q->u.in.batch_start, q->u.in.batch_count); |
|---|
| 115 | + seq_printf(m, "DSCI: %x IRQs disabled: %u\n", |
|---|
| 116 | + *(u8 *)q->irq_ptr->dsci, |
|---|
| 117 | + test_bit(QDIO_IRQ_DISABLED, |
|---|
| 118 | + &q->irq_ptr->poll_state)); |
|---|
| 135 | 119 | } |
|---|
| 136 | 120 | seq_printf(m, "SBAL states:\n"); |
|---|
| 137 | 121 | seq_printf(m, "|0 |8 |16 |24 |32 |40 |48 |56 63|\n"); |
|---|
| .. | .. |
|---|
| 181 | 165 | } |
|---|
| 182 | 166 | |
|---|
| 183 | 167 | seq_printf(m, "\n1 2.. 4.. 8.. " |
|---|
| 184 | | - "16.. 32.. 64.. 127\n"); |
|---|
| 168 | + "16.. 32.. 64.. 128\n"); |
|---|
| 185 | 169 | for (i = 0; i < ARRAY_SIZE(q->q_stats.nr_sbals); i++) |
|---|
| 186 | 170 | seq_printf(m, "%-10u ", q->q_stats.nr_sbals[i]); |
|---|
| 187 | 171 | seq_printf(m, "\nError NOP Total\n%-10u %-10u %-10u\n\n", |
|---|
| .. | .. |
|---|
| 190 | 174 | return 0; |
|---|
| 191 | 175 | } |
|---|
| 192 | 176 | |
|---|
| 193 | | -static int qstat_seq_open(struct inode *inode, struct file *filp) |
|---|
| 177 | +DEFINE_SHOW_ATTRIBUTE(qstat); |
|---|
| 178 | + |
|---|
| 179 | +static int ssqd_show(struct seq_file *m, void *v) |
|---|
| 194 | 180 | { |
|---|
| 195 | | - return single_open(filp, qstat_show, |
|---|
| 196 | | - file_inode(filp)->i_private); |
|---|
| 181 | + struct ccw_device *cdev = m->private; |
|---|
| 182 | + struct qdio_ssqd_desc ssqd; |
|---|
| 183 | + int rc; |
|---|
| 184 | + |
|---|
| 185 | + rc = qdio_get_ssqd_desc(cdev, &ssqd); |
|---|
| 186 | + if (rc) |
|---|
| 187 | + return rc; |
|---|
| 188 | + |
|---|
| 189 | + seq_hex_dump(m, "", DUMP_PREFIX_NONE, 16, 4, &ssqd, sizeof(ssqd), |
|---|
| 190 | + false); |
|---|
| 191 | + return 0; |
|---|
| 197 | 192 | } |
|---|
| 198 | 193 | |
|---|
| 199 | | -static const struct file_operations debugfs_fops = { |
|---|
| 200 | | - .owner = THIS_MODULE, |
|---|
| 201 | | - .open = qstat_seq_open, |
|---|
| 202 | | - .read = seq_read, |
|---|
| 203 | | - .llseek = seq_lseek, |
|---|
| 204 | | - .release = single_release, |
|---|
| 205 | | -}; |
|---|
| 194 | +DEFINE_SHOW_ATTRIBUTE(ssqd); |
|---|
| 206 | 195 | |
|---|
| 207 | 196 | static char *qperf_names[] = { |
|---|
| 208 | 197 | "Assumed adapter interrupts", |
|---|
| .. | .. |
|---|
| 298 | 287 | .release = single_release, |
|---|
| 299 | 288 | }; |
|---|
| 300 | 289 | |
|---|
| 301 | | -static void setup_debugfs_entry(struct qdio_q *q) |
|---|
| 290 | +static void setup_debugfs_entry(struct dentry *parent, struct qdio_q *q) |
|---|
| 302 | 291 | { |
|---|
| 303 | 292 | char name[QDIO_DEBUGFS_NAME_LEN]; |
|---|
| 304 | 293 | |
|---|
| 305 | 294 | snprintf(name, QDIO_DEBUGFS_NAME_LEN, "%s_%d", |
|---|
| 306 | 295 | q->is_input_q ? "input" : "output", |
|---|
| 307 | 296 | q->nr); |
|---|
| 308 | | - q->debugfs_q = debugfs_create_file(name, S_IFREG | S_IRUGO | S_IWUSR, |
|---|
| 309 | | - q->irq_ptr->debugfs_dev, q, &debugfs_fops); |
|---|
| 310 | | - if (IS_ERR(q->debugfs_q)) |
|---|
| 311 | | - q->debugfs_q = NULL; |
|---|
| 297 | + debugfs_create_file(name, 0444, parent, q, &qstat_fops); |
|---|
| 312 | 298 | } |
|---|
| 313 | 299 | |
|---|
| 314 | | -void qdio_setup_debug_entries(struct qdio_irq *irq_ptr, struct ccw_device *cdev) |
|---|
| 300 | +void qdio_setup_debug_entries(struct qdio_irq *irq_ptr) |
|---|
| 315 | 301 | { |
|---|
| 316 | 302 | struct qdio_q *q; |
|---|
| 317 | 303 | int i; |
|---|
| 318 | 304 | |
|---|
| 319 | | - irq_ptr->debugfs_dev = debugfs_create_dir(dev_name(&cdev->dev), |
|---|
| 305 | + irq_ptr->debugfs_dev = debugfs_create_dir(dev_name(&irq_ptr->cdev->dev), |
|---|
| 320 | 306 | debugfs_root); |
|---|
| 321 | | - if (IS_ERR(irq_ptr->debugfs_dev)) |
|---|
| 322 | | - irq_ptr->debugfs_dev = NULL; |
|---|
| 323 | | - |
|---|
| 324 | | - irq_ptr->debugfs_perf = debugfs_create_file("statistics", |
|---|
| 325 | | - S_IFREG | S_IRUGO | S_IWUSR, |
|---|
| 326 | | - irq_ptr->debugfs_dev, irq_ptr, |
|---|
| 327 | | - &debugfs_perf_fops); |
|---|
| 328 | | - if (IS_ERR(irq_ptr->debugfs_perf)) |
|---|
| 329 | | - irq_ptr->debugfs_perf = NULL; |
|---|
| 307 | + debugfs_create_file("statistics", S_IFREG | S_IRUGO | S_IWUSR, |
|---|
| 308 | + irq_ptr->debugfs_dev, irq_ptr, &debugfs_perf_fops); |
|---|
| 309 | + debugfs_create_file("ssqd", 0444, irq_ptr->debugfs_dev, irq_ptr->cdev, |
|---|
| 310 | + &ssqd_fops); |
|---|
| 330 | 311 | |
|---|
| 331 | 312 | for_each_input_queue(irq_ptr, q, i) |
|---|
| 332 | | - setup_debugfs_entry(q); |
|---|
| 313 | + setup_debugfs_entry(irq_ptr->debugfs_dev, q); |
|---|
| 333 | 314 | for_each_output_queue(irq_ptr, q, i) |
|---|
| 334 | | - setup_debugfs_entry(q); |
|---|
| 315 | + setup_debugfs_entry(irq_ptr->debugfs_dev, q); |
|---|
| 335 | 316 | } |
|---|
| 336 | 317 | |
|---|
| 337 | 318 | void qdio_shutdown_debug_entries(struct qdio_irq *irq_ptr) |
|---|
| 338 | 319 | { |
|---|
| 339 | | - struct qdio_q *q; |
|---|
| 340 | | - int i; |
|---|
| 341 | | - |
|---|
| 342 | | - for_each_input_queue(irq_ptr, q, i) |
|---|
| 343 | | - debugfs_remove(q->debugfs_q); |
|---|
| 344 | | - for_each_output_queue(irq_ptr, q, i) |
|---|
| 345 | | - debugfs_remove(q->debugfs_q); |
|---|
| 346 | | - debugfs_remove(irq_ptr->debugfs_perf); |
|---|
| 347 | | - debugfs_remove(irq_ptr->debugfs_dev); |
|---|
| 320 | + debugfs_remove_recursive(irq_ptr->debugfs_dev); |
|---|
| 348 | 321 | } |
|---|
| 349 | 322 | |
|---|
| 350 | 323 | int __init qdio_debug_init(void) |
|---|
| .. | .. |
|---|
| 366 | 339 | void qdio_debug_exit(void) |
|---|
| 367 | 340 | { |
|---|
| 368 | 341 | qdio_clear_dbf_list(); |
|---|
| 369 | | - debugfs_remove(debugfs_root); |
|---|
| 342 | + debugfs_remove_recursive(debugfs_root); |
|---|
| 370 | 343 | debug_unregister(qdio_dbf_setup); |
|---|
| 371 | 344 | debug_unregister(qdio_dbf_error); |
|---|
| 372 | 345 | } |
|---|