Commit 7c38c05b3ef1a8a9f7e0416072a8ea2730841c91
Committed by
James Bottomley
1 parent
61338a0b34
Exists in
master
and in
7 other branches
[SCSI] bfa: Move debugfs initialization before bfa init.
Move the initialization of debugfs before bfa init, to enable us to collect driver/firmware traces if init fails. Also add a printk to display message on bfa_init failure. Signed-off-by: Krishna Gudipati <kgudipat@brocade.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Showing 2 changed files with 27 additions and 28 deletions Side-by-side Diff
drivers/scsi/bfa/bfad.c
... | ... | @@ -232,6 +232,9 @@ |
232 | 232 | if ((bfad->bfad_flags & BFAD_HAL_INIT_DONE)) { |
233 | 233 | bfa_sm_send_event(bfad, BFAD_E_INIT_SUCCESS); |
234 | 234 | } else { |
235 | + printk(KERN_WARNING | |
236 | + "bfa %s: bfa init failed\n", | |
237 | + bfad->pci_name); | |
235 | 238 | bfad->bfad_flags |= BFAD_HAL_INIT_FAIL; |
236 | 239 | bfa_sm_send_event(bfad, BFAD_E_INIT_FAILED); |
237 | 240 | } |
... | ... | @@ -1001,10 +1004,6 @@ |
1001 | 1004 | bfad->pport.roles |= BFA_LPORT_ROLE_FCP_IM; |
1002 | 1005 | } |
1003 | 1006 | |
1004 | - /* Setup the debugfs node for this scsi_host */ | |
1005 | - if (bfa_debugfs_enable) | |
1006 | - bfad_debugfs_init(&bfad->pport); | |
1007 | - | |
1008 | 1007 | bfad->bfad_flags |= BFAD_CFG_PPORT_DONE; |
1009 | 1008 | |
1010 | 1009 | out: |
... | ... | @@ -1014,10 +1013,6 @@ |
1014 | 1013 | void |
1015 | 1014 | bfad_uncfg_pport(struct bfad_s *bfad) |
1016 | 1015 | { |
1017 | - /* Remove the debugfs node for this scsi_host */ | |
1018 | - kfree(bfad->regdata); | |
1019 | - bfad_debugfs_exit(&bfad->pport); | |
1020 | - | |
1021 | 1016 | if ((supported_fc4s & BFA_LPORT_ROLE_FCP_IM) && |
1022 | 1017 | (bfad->pport.roles & BFA_LPORT_ROLE_FCP_IM)) { |
1023 | 1018 | bfad_im_scsi_host_free(bfad, bfad->pport.im_port); |
... | ... | @@ -1399,6 +1394,10 @@ |
1399 | 1394 | bfad->pport.bfad = bfad; |
1400 | 1395 | INIT_LIST_HEAD(&bfad->pbc_vport_list); |
1401 | 1396 | |
1397 | + /* Setup the debugfs node for this bfad */ | |
1398 | + if (bfa_debugfs_enable) | |
1399 | + bfad_debugfs_init(&bfad->pport); | |
1400 | + | |
1402 | 1401 | retval = bfad_drv_init(bfad); |
1403 | 1402 | if (retval != BFA_STATUS_OK) |
1404 | 1403 | goto out_drv_init_failure; |
... | ... | @@ -1414,6 +1413,9 @@ |
1414 | 1413 | bfa_detach(&bfad->bfa); |
1415 | 1414 | bfad_hal_mem_release(bfad); |
1416 | 1415 | out_drv_init_failure: |
1416 | + /* Remove the debugfs node for this bfad */ | |
1417 | + kfree(bfad->regdata); | |
1418 | + bfad_debugfs_exit(&bfad->pport); | |
1417 | 1419 | mutex_lock(&bfad_mutex); |
1418 | 1420 | bfad_inst--; |
1419 | 1421 | list_del(&bfad->list_entry); |
... | ... | @@ -1454,6 +1456,10 @@ |
1454 | 1456 | bfa_detach(&bfad->bfa); |
1455 | 1457 | spin_unlock_irqrestore(&bfad->bfad_lock, flags); |
1456 | 1458 | bfad_hal_mem_release(bfad); |
1459 | + | |
1460 | + /* Remove the debugfs node for this bfad */ | |
1461 | + kfree(bfad->regdata); | |
1462 | + bfad_debugfs_exit(&bfad->pport); | |
1457 | 1463 | |
1458 | 1464 | /* Cleaning the BFAD instance */ |
1459 | 1465 | mutex_lock(&bfad_mutex); |
drivers/scsi/bfa/bfad_debugfs.c
... | ... | @@ -28,10 +28,10 @@ |
28 | 28 | * mount -t debugfs none /sys/kernel/debug |
29 | 29 | * |
30 | 30 | * BFA Hierarchy: |
31 | - * - bfa/host# | |
32 | - * where the host number corresponds to the one under /sys/class/scsi_host/host# | |
31 | + * - bfa/pci_dev:<pci_name> | |
32 | + * where the pci_name corresponds to the one under /sys/bus/pci/drivers/bfa | |
33 | 33 | * |
34 | - * Debugging service available per host: | |
34 | + * Debugging service available per pci_dev: | |
35 | 35 | * fwtrc: To collect current firmware trace. |
36 | 36 | * drvtrc: To collect current driver trace |
37 | 37 | * fwsave: To collect last saved fw trace as a result of firmware crash. |
38 | 38 | |
... | ... | @@ -489,11 +489,9 @@ |
489 | 489 | inline void |
490 | 490 | bfad_debugfs_init(struct bfad_port_s *port) |
491 | 491 | { |
492 | - struct bfad_im_port_s *im_port = port->im_port; | |
493 | - struct bfad_s *bfad = im_port->bfad; | |
494 | - struct Scsi_Host *shost = im_port->shost; | |
492 | + struct bfad_s *bfad = port->bfad; | |
495 | 493 | const struct bfad_debugfs_entry *file; |
496 | - char name[16]; | |
494 | + char name[64]; | |
497 | 495 | int i; |
498 | 496 | |
499 | 497 | if (!bfa_debugfs_enable) |
500 | 498 | |
... | ... | @@ -510,17 +508,15 @@ |
510 | 508 | } |
511 | 509 | } |
512 | 510 | |
513 | - /* | |
514 | - * Setup the host# directory for the port, | |
515 | - * corresponds to the scsi_host num of this port. | |
516 | - */ | |
517 | - snprintf(name, sizeof(name), "host%d", shost->host_no); | |
511 | + /* Setup the pci_dev debugfs directory for the port */ | |
512 | + snprintf(name, sizeof(name), "pci_dev:%s", bfad->pci_name); | |
518 | 513 | if (!port->port_debugfs_root) { |
519 | 514 | port->port_debugfs_root = |
520 | 515 | debugfs_create_dir(name, bfa_debugfs_root); |
521 | 516 | if (!port->port_debugfs_root) { |
522 | 517 | printk(KERN_WARNING |
523 | - "BFA host root dir creation failed\n"); | |
518 | + "bfa %s: debugfs root creation failed\n", | |
519 | + bfad->pci_name); | |
524 | 520 | goto err; |
525 | 521 | } |
526 | 522 | |
... | ... | @@ -536,8 +532,8 @@ |
536 | 532 | file->fops); |
537 | 533 | if (!bfad->bfad_dentry_files[i]) { |
538 | 534 | printk(KERN_WARNING |
539 | - "BFA host%d: create %s entry failed\n", | |
540 | - shost->host_no, file->name); | |
535 | + "bfa %s: debugfs %s creation failed\n", | |
536 | + bfad->pci_name, file->name); | |
541 | 537 | goto err; |
542 | 538 | } |
543 | 539 | } |
... | ... | @@ -550,8 +546,7 @@ |
550 | 546 | inline void |
551 | 547 | bfad_debugfs_exit(struct bfad_port_s *port) |
552 | 548 | { |
553 | - struct bfad_im_port_s *im_port = port->im_port; | |
554 | - struct bfad_s *bfad = im_port->bfad; | |
549 | + struct bfad_s *bfad = port->bfad; | |
555 | 550 | int i; |
556 | 551 | |
557 | 552 | for (i = 0; i < ARRAY_SIZE(bfad_debugfs_files); i++) { |
... | ... | @@ -562,9 +557,7 @@ |
562 | 557 | } |
563 | 558 | |
564 | 559 | /* |
565 | - * Remove the host# directory for the port, | |
566 | - * corresponds to the scsi_host num of this port. | |
567 | - */ | |
560 | + * Remove the pci_dev debugfs directory for the port */ | |
568 | 561 | if (port->port_debugfs_root) { |
569 | 562 | debugfs_remove(port->port_debugfs_root); |
570 | 563 | port->port_debugfs_root = NULL; |