aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/mpt2sas/mpt2sas_ctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/mpt2sas/mpt2sas_ctl.c')
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_ctl.c38
1 files changed, 35 insertions, 3 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_ctl.c b/drivers/scsi/mpt2sas/mpt2sas_ctl.c
index 38ed0260959d..aabcb911706e 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_ctl.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_ctl.c
@@ -42,7 +42,6 @@
42 * USA. 42 * USA.
43 */ 43 */
44 44
45#include <linux/version.h>
46#include <linux/kernel.h> 45#include <linux/kernel.h>
47#include <linux/module.h> 46#include <linux/module.h>
48#include <linux/errno.h> 47#include <linux/errno.h>
@@ -1208,6 +1207,9 @@ _ctl_do_reset(void __user *arg)
1208 if (_ctl_verify_adapter(karg.hdr.ioc_number, &ioc) == -1 || !ioc) 1207 if (_ctl_verify_adapter(karg.hdr.ioc_number, &ioc) == -1 || !ioc)
1209 return -ENODEV; 1208 return -ENODEV;
1210 1209
1210 if (ioc->shost_recovery || ioc->pci_error_recovery ||
1211 ioc->is_driver_loading)
1212 return -EAGAIN;
1211 dctlprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: enter\n", ioc->name, 1213 dctlprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: enter\n", ioc->name,
1212 __func__)); 1214 __func__));
1213 1215
@@ -2179,7 +2181,8 @@ _ctl_ioctl_main(struct file *file, unsigned int cmd, void __user *arg)
2179 !ioc) 2181 !ioc)
2180 return -ENODEV; 2182 return -ENODEV;
2181 2183
2182 if (ioc->shost_recovery || ioc->pci_error_recovery) 2184 if (ioc->shost_recovery || ioc->pci_error_recovery ||
2185 ioc->is_driver_loading)
2183 return -EAGAIN; 2186 return -EAGAIN;
2184 2187
2185 if (_IOC_SIZE(cmd) == sizeof(struct mpt2_ioctl_command)) { 2188 if (_IOC_SIZE(cmd) == sizeof(struct mpt2_ioctl_command)) {
@@ -2298,7 +2301,8 @@ _ctl_compat_mpt_command(struct file *file, unsigned cmd, unsigned long arg)
2298 if (_ctl_verify_adapter(karg32.hdr.ioc_number, &ioc) == -1 || !ioc) 2301 if (_ctl_verify_adapter(karg32.hdr.ioc_number, &ioc) == -1 || !ioc)
2299 return -ENODEV; 2302 return -ENODEV;
2300 2303
2301 if (ioc->shost_recovery || ioc->pci_error_recovery) 2304 if (ioc->shost_recovery || ioc->pci_error_recovery ||
2305 ioc->is_driver_loading)
2302 return -EAGAIN; 2306 return -EAGAIN;
2303 2307
2304 memset(&karg, 0, sizeof(struct mpt2_ioctl_command)); 2308 memset(&karg, 0, sizeof(struct mpt2_ioctl_command));
@@ -2705,6 +2709,33 @@ _ctl_ioc_reset_count_show(struct device *cdev, struct device_attribute *attr,
2705static DEVICE_ATTR(ioc_reset_count, S_IRUGO, 2709static DEVICE_ATTR(ioc_reset_count, S_IRUGO,
2706 _ctl_ioc_reset_count_show, NULL); 2710 _ctl_ioc_reset_count_show, NULL);
2707 2711
2712/**
2713 * _ctl_ioc_reply_queue_count_show - number of reply queues
2714 * @cdev - pointer to embedded class device
2715 * @buf - the buffer returned
2716 *
2717 * This is number of reply queues
2718 *
2719 * A sysfs 'read-only' shost attribute.
2720 */
2721static ssize_t
2722_ctl_ioc_reply_queue_count_show(struct device *cdev,
2723 struct device_attribute *attr, char *buf)
2724{
2725 u8 reply_queue_count;
2726 struct Scsi_Host *shost = class_to_shost(cdev);
2727 struct MPT2SAS_ADAPTER *ioc = shost_priv(shost);
2728
2729 if ((ioc->facts.IOCCapabilities &
2730 MPI2_IOCFACTS_CAPABILITY_MSI_X_INDEX) && ioc->msix_enable)
2731 reply_queue_count = ioc->reply_queue_count;
2732 else
2733 reply_queue_count = 1;
2734 return snprintf(buf, PAGE_SIZE, "%d\n", reply_queue_count);
2735}
2736static DEVICE_ATTR(reply_queue_count, S_IRUGO,
2737 _ctl_ioc_reply_queue_count_show, NULL);
2738
2708struct DIAG_BUFFER_START { 2739struct DIAG_BUFFER_START {
2709 __le32 Size; 2740 __le32 Size;
2710 __le32 DiagVersion; 2741 __le32 DiagVersion;
@@ -2915,6 +2946,7 @@ struct device_attribute *mpt2sas_host_attrs[] = {
2915 &dev_attr_host_trace_buffer_size, 2946 &dev_attr_host_trace_buffer_size,
2916 &dev_attr_host_trace_buffer, 2947 &dev_attr_host_trace_buffer,
2917 &dev_attr_host_trace_buffer_enable, 2948 &dev_attr_host_trace_buffer_enable,
2949 &dev_attr_reply_queue_count,
2918 NULL, 2950 NULL,
2919}; 2951};
2920 2952