aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKashyap, Desai <kashyap.desai@lsi.com>2010-06-17 04:06:53 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-07-27 13:02:11 -0400
commitd32a8c15e1116e87f0105356eca1afb99842ab49 (patch)
tree3795c1d0bd520021a21613ec063b557e51955cd0
parentb8d7d7bb37b5e25ea740369eb12de5279fe6ab30 (diff)
[SCSI] mpt2sas: Added sysfs counter for ioc reset
Added a new sysfs shost attribute called ioc_reset_count. This will keep count of host resets (both diagnostic and message unit). Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_base.c9
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_base.h1
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_ctl.c24
3 files changed, 32 insertions, 2 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
index 68cb000bf486..88befc798469 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -3402,6 +3402,7 @@ _base_make_ioc_ready(struct MPT2SAS_ADAPTER *ioc, int sleep_flag,
3402 enum reset_type type) 3402 enum reset_type type)
3403{ 3403{
3404 u32 ioc_state; 3404 u32 ioc_state;
3405 int rc;
3405 3406
3406 dinitprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s\n", ioc->name, 3407 dinitprintk(ioc, printk(MPT2SAS_DEBUG_FMT "%s\n", ioc->name,
3407 __func__)); 3408 __func__));
@@ -3430,11 +3431,15 @@ _base_make_ioc_ready(struct MPT2SAS_ADAPTER *ioc, int sleep_flag,
3430 3431
3431 if ((ioc_state & MPI2_IOC_STATE_MASK) == MPI2_IOC_STATE_OPERATIONAL) 3432 if ((ioc_state & MPI2_IOC_STATE_MASK) == MPI2_IOC_STATE_OPERATIONAL)
3432 if (!(_base_send_ioc_reset(ioc, 3433 if (!(_base_send_ioc_reset(ioc,
3433 MPI2_FUNCTION_IOC_MESSAGE_UNIT_RESET, 15, CAN_SLEEP))) 3434 MPI2_FUNCTION_IOC_MESSAGE_UNIT_RESET, 15, CAN_SLEEP))) {
3435 ioc->ioc_reset_count++;
3434 return 0; 3436 return 0;
3437 }
3435 3438
3436 issue_diag_reset: 3439 issue_diag_reset:
3437 return _base_diag_reset(ioc, CAN_SLEEP); 3440 rc = _base_diag_reset(ioc, CAN_SLEEP);
3441 ioc->ioc_reset_count++;
3442 return rc;
3438} 3443}
3439 3444
3440/** 3445/**
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.h b/drivers/scsi/mpt2sas/mpt2sas_base.h
index 6032cbf31c7e..a4a731529226 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.h
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.h
@@ -615,6 +615,7 @@ struct MPT2SAS_ADAPTER {
615 u16 msix_vector_count; 615 u16 msix_vector_count;
616 u32 *msix_table; 616 u32 *msix_table;
617 u32 *msix_table_backup; 617 u32 *msix_table_backup;
618 u32 ioc_reset_count;
618 619
619 /* internal commands, callback index */ 620 /* internal commands, callback index */
620 u8 scsi_io_cb_idx; 621 u8 scsi_io_cb_idx;
diff --git a/drivers/scsi/mpt2sas/mpt2sas_ctl.c b/drivers/scsi/mpt2sas/mpt2sas_ctl.c
index d88e9756d8f5..25c866e3e900 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_ctl.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_ctl.c
@@ -2581,6 +2581,29 @@ _ctl_fwfault_debug_store(struct device *cdev,
2581static DEVICE_ATTR(fwfault_debug, S_IRUGO | S_IWUSR, 2581static DEVICE_ATTR(fwfault_debug, S_IRUGO | S_IWUSR,
2582 _ctl_fwfault_debug_show, _ctl_fwfault_debug_store); 2582 _ctl_fwfault_debug_show, _ctl_fwfault_debug_store);
2583 2583
2584
2585/**
2586 * _ctl_ioc_reset_count_show - ioc reset count
2587 * @cdev - pointer to embedded class device
2588 * @buf - the buffer returned
2589 *
2590 * This is firmware queue depth limit
2591 *
2592 * A sysfs 'read-only' shost attribute.
2593 */
2594static ssize_t
2595_ctl_ioc_reset_count_show(struct device *cdev, struct device_attribute *attr,
2596 char *buf)
2597{
2598 struct Scsi_Host *shost = class_to_shost(cdev);
2599 struct MPT2SAS_ADAPTER *ioc = shost_priv(shost);
2600
2601 return snprintf(buf, PAGE_SIZE, "%08d\n", ioc->ioc_reset_count);
2602}
2603static DEVICE_ATTR(ioc_reset_count, S_IRUGO,
2604 _ctl_ioc_reset_count_show, NULL);
2605
2606
2584struct device_attribute *mpt2sas_host_attrs[] = { 2607struct device_attribute *mpt2sas_host_attrs[] = {
2585 &dev_attr_version_fw, 2608 &dev_attr_version_fw,
2586 &dev_attr_version_bios, 2609 &dev_attr_version_bios,
@@ -2597,6 +2620,7 @@ struct device_attribute *mpt2sas_host_attrs[] = {
2597 &dev_attr_fwfault_debug, 2620 &dev_attr_fwfault_debug,
2598 &dev_attr_fw_queue_depth, 2621 &dev_attr_fw_queue_depth,
2599 &dev_attr_host_sas_address, 2622 &dev_attr_host_sas_address,
2623 &dev_attr_ioc_reset_count,
2600 NULL, 2624 NULL,
2601}; 2625};
2602 2626