mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-24 09:50:04 +00:00
[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>
This commit is contained in:
parent
61338a0b34
commit
7c38c05b3e
2 changed files with 27 additions and 28 deletions
|
@ -232,6 +232,9 @@ bfad_sm_created(struct bfad_s *bfad, enum bfad_sm_event event)
|
||||||
if ((bfad->bfad_flags & BFAD_HAL_INIT_DONE)) {
|
if ((bfad->bfad_flags & BFAD_HAL_INIT_DONE)) {
|
||||||
bfa_sm_send_event(bfad, BFAD_E_INIT_SUCCESS);
|
bfa_sm_send_event(bfad, BFAD_E_INIT_SUCCESS);
|
||||||
} else {
|
} else {
|
||||||
|
printk(KERN_WARNING
|
||||||
|
"bfa %s: bfa init failed\n",
|
||||||
|
bfad->pci_name);
|
||||||
bfad->bfad_flags |= BFAD_HAL_INIT_FAIL;
|
bfad->bfad_flags |= BFAD_HAL_INIT_FAIL;
|
||||||
bfa_sm_send_event(bfad, BFAD_E_INIT_FAILED);
|
bfa_sm_send_event(bfad, BFAD_E_INIT_FAILED);
|
||||||
}
|
}
|
||||||
|
@ -1001,10 +1004,6 @@ bfad_cfg_pport(struct bfad_s *bfad, enum bfa_lport_role role)
|
||||||
bfad->pport.roles |= BFA_LPORT_ROLE_FCP_IM;
|
bfad->pport.roles |= BFA_LPORT_ROLE_FCP_IM;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup the debugfs node for this scsi_host */
|
|
||||||
if (bfa_debugfs_enable)
|
|
||||||
bfad_debugfs_init(&bfad->pport);
|
|
||||||
|
|
||||||
bfad->bfad_flags |= BFAD_CFG_PPORT_DONE;
|
bfad->bfad_flags |= BFAD_CFG_PPORT_DONE;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
@ -1014,10 +1013,6 @@ bfad_cfg_pport(struct bfad_s *bfad, enum bfa_lport_role role)
|
||||||
void
|
void
|
||||||
bfad_uncfg_pport(struct bfad_s *bfad)
|
bfad_uncfg_pport(struct bfad_s *bfad)
|
||||||
{
|
{
|
||||||
/* Remove the debugfs node for this scsi_host */
|
|
||||||
kfree(bfad->regdata);
|
|
||||||
bfad_debugfs_exit(&bfad->pport);
|
|
||||||
|
|
||||||
if ((supported_fc4s & BFA_LPORT_ROLE_FCP_IM) &&
|
if ((supported_fc4s & BFA_LPORT_ROLE_FCP_IM) &&
|
||||||
(bfad->pport.roles & BFA_LPORT_ROLE_FCP_IM)) {
|
(bfad->pport.roles & BFA_LPORT_ROLE_FCP_IM)) {
|
||||||
bfad_im_scsi_host_free(bfad, bfad->pport.im_port);
|
bfad_im_scsi_host_free(bfad, bfad->pport.im_port);
|
||||||
|
@ -1399,6 +1394,10 @@ bfad_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid)
|
||||||
bfad->pport.bfad = bfad;
|
bfad->pport.bfad = bfad;
|
||||||
INIT_LIST_HEAD(&bfad->pbc_vport_list);
|
INIT_LIST_HEAD(&bfad->pbc_vport_list);
|
||||||
|
|
||||||
|
/* Setup the debugfs node for this bfad */
|
||||||
|
if (bfa_debugfs_enable)
|
||||||
|
bfad_debugfs_init(&bfad->pport);
|
||||||
|
|
||||||
retval = bfad_drv_init(bfad);
|
retval = bfad_drv_init(bfad);
|
||||||
if (retval != BFA_STATUS_OK)
|
if (retval != BFA_STATUS_OK)
|
||||||
goto out_drv_init_failure;
|
goto out_drv_init_failure;
|
||||||
|
@ -1414,6 +1413,9 @@ bfad_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid)
|
||||||
bfa_detach(&bfad->bfa);
|
bfa_detach(&bfad->bfa);
|
||||||
bfad_hal_mem_release(bfad);
|
bfad_hal_mem_release(bfad);
|
||||||
out_drv_init_failure:
|
out_drv_init_failure:
|
||||||
|
/* Remove the debugfs node for this bfad */
|
||||||
|
kfree(bfad->regdata);
|
||||||
|
bfad_debugfs_exit(&bfad->pport);
|
||||||
mutex_lock(&bfad_mutex);
|
mutex_lock(&bfad_mutex);
|
||||||
bfad_inst--;
|
bfad_inst--;
|
||||||
list_del(&bfad->list_entry);
|
list_del(&bfad->list_entry);
|
||||||
|
@ -1455,6 +1457,10 @@ bfad_pci_remove(struct pci_dev *pdev)
|
||||||
spin_unlock_irqrestore(&bfad->bfad_lock, flags);
|
spin_unlock_irqrestore(&bfad->bfad_lock, flags);
|
||||||
bfad_hal_mem_release(bfad);
|
bfad_hal_mem_release(bfad);
|
||||||
|
|
||||||
|
/* Remove the debugfs node for this bfad */
|
||||||
|
kfree(bfad->regdata);
|
||||||
|
bfad_debugfs_exit(&bfad->pport);
|
||||||
|
|
||||||
/* Cleaning the BFAD instance */
|
/* Cleaning the BFAD instance */
|
||||||
mutex_lock(&bfad_mutex);
|
mutex_lock(&bfad_mutex);
|
||||||
bfad_inst--;
|
bfad_inst--;
|
||||||
|
|
|
@ -28,10 +28,10 @@
|
||||||
* mount -t debugfs none /sys/kernel/debug
|
* mount -t debugfs none /sys/kernel/debug
|
||||||
*
|
*
|
||||||
* BFA Hierarchy:
|
* BFA Hierarchy:
|
||||||
* - bfa/host#
|
* - bfa/pci_dev:<pci_name>
|
||||||
* where the host number corresponds to the one under /sys/class/scsi_host/host#
|
* where the pci_name corresponds to the one under /sys/bus/pci/drivers/bfa
|
||||||
*
|
*
|
||||||
* Debugging service available per host:
|
* Debugging service available per pci_dev:
|
||||||
* fwtrc: To collect current firmware trace.
|
* fwtrc: To collect current firmware trace.
|
||||||
* drvtrc: To collect current driver trace
|
* drvtrc: To collect current driver trace
|
||||||
* fwsave: To collect last saved fw trace as a result of firmware crash.
|
* fwsave: To collect last saved fw trace as a result of firmware crash.
|
||||||
|
@ -489,11 +489,9 @@ static atomic_t bfa_debugfs_port_count;
|
||||||
inline void
|
inline void
|
||||||
bfad_debugfs_init(struct bfad_port_s *port)
|
bfad_debugfs_init(struct bfad_port_s *port)
|
||||||
{
|
{
|
||||||
struct bfad_im_port_s *im_port = port->im_port;
|
struct bfad_s *bfad = port->bfad;
|
||||||
struct bfad_s *bfad = im_port->bfad;
|
|
||||||
struct Scsi_Host *shost = im_port->shost;
|
|
||||||
const struct bfad_debugfs_entry *file;
|
const struct bfad_debugfs_entry *file;
|
||||||
char name[16];
|
char name[64];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!bfa_debugfs_enable)
|
if (!bfa_debugfs_enable)
|
||||||
|
@ -510,17 +508,15 @@ bfad_debugfs_init(struct bfad_port_s *port)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Setup the pci_dev debugfs directory for the port */
|
||||||
* Setup the host# directory for the port,
|
snprintf(name, sizeof(name), "pci_dev:%s", bfad->pci_name);
|
||||||
* corresponds to the scsi_host num of this port.
|
|
||||||
*/
|
|
||||||
snprintf(name, sizeof(name), "host%d", shost->host_no);
|
|
||||||
if (!port->port_debugfs_root) {
|
if (!port->port_debugfs_root) {
|
||||||
port->port_debugfs_root =
|
port->port_debugfs_root =
|
||||||
debugfs_create_dir(name, bfa_debugfs_root);
|
debugfs_create_dir(name, bfa_debugfs_root);
|
||||||
if (!port->port_debugfs_root) {
|
if (!port->port_debugfs_root) {
|
||||||
printk(KERN_WARNING
|
printk(KERN_WARNING
|
||||||
"BFA host root dir creation failed\n");
|
"bfa %s: debugfs root creation failed\n",
|
||||||
|
bfad->pci_name);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -536,8 +532,8 @@ bfad_debugfs_init(struct bfad_port_s *port)
|
||||||
file->fops);
|
file->fops);
|
||||||
if (!bfad->bfad_dentry_files[i]) {
|
if (!bfad->bfad_dentry_files[i]) {
|
||||||
printk(KERN_WARNING
|
printk(KERN_WARNING
|
||||||
"BFA host%d: create %s entry failed\n",
|
"bfa %s: debugfs %s creation failed\n",
|
||||||
shost->host_no, file->name);
|
bfad->pci_name, file->name);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -550,8 +546,7 @@ bfad_debugfs_init(struct bfad_port_s *port)
|
||||||
inline void
|
inline void
|
||||||
bfad_debugfs_exit(struct bfad_port_s *port)
|
bfad_debugfs_exit(struct bfad_port_s *port)
|
||||||
{
|
{
|
||||||
struct bfad_im_port_s *im_port = port->im_port;
|
struct bfad_s *bfad = port->bfad;
|
||||||
struct bfad_s *bfad = im_port->bfad;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(bfad_debugfs_files); i++) {
|
for (i = 0; i < ARRAY_SIZE(bfad_debugfs_files); i++) {
|
||||||
|
@ -562,9 +557,7 @@ bfad_debugfs_exit(struct bfad_port_s *port)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Remove the host# directory for the port,
|
* Remove the pci_dev debugfs directory for the port */
|
||||||
* corresponds to the scsi_host num of this port.
|
|
||||||
*/
|
|
||||||
if (port->port_debugfs_root) {
|
if (port->port_debugfs_root) {
|
||||||
debugfs_remove(port->port_debugfs_root);
|
debugfs_remove(port->port_debugfs_root);
|
||||||
port->port_debugfs_root = NULL;
|
port->port_debugfs_root = NULL;
|
||||||
|
|
Loading…
Reference in a new issue