Commit 3ac8e47b authored by Suganath Prabu's avatar Suganath Prabu Committed by Martin K. Petersen

scsi: mpt3sas: Add sysfs to know supported features

Currently with sysfs parameter "drv_support_bitmap" driver exposes whether
driver supports toolbox memory move command or not.

And application should issue the toolbox memory move command only if driver
tell that memory move tool box command is supported through this sysfs
parameter.

In future we can utilize this sysfs parameter if any new feature is added
and need to notify the same to applications.
Signed-off-by: default avatarSuganath Prabu <suganath-prabu.subramani@broadcom.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent ba630ea0
...@@ -1047,6 +1047,7 @@ typedef void (*MPT3SAS_FLUSH_RUNNING_CMDS)(struct MPT3SAS_ADAPTER *ioc); ...@@ -1047,6 +1047,7 @@ typedef void (*MPT3SAS_FLUSH_RUNNING_CMDS)(struct MPT3SAS_ADAPTER *ioc);
* @schedule_dead_ioc_flush_running_cmds: callback to flush pending commands * @schedule_dead_ioc_flush_running_cmds: callback to flush pending commands
* @thresh_hold: Max number of reply descriptors processed * @thresh_hold: Max number of reply descriptors processed
* before updating Host Index * before updating Host Index
* @drv_support_bitmap: driver's supported feature bit map
* @scsi_io_cb_idx: shost generated commands * @scsi_io_cb_idx: shost generated commands
* @tm_cb_idx: task management commands * @tm_cb_idx: task management commands
* @scsih_cb_idx: scsih internal commands * @scsih_cb_idx: scsih internal commands
...@@ -1230,6 +1231,7 @@ struct MPT3SAS_ADAPTER { ...@@ -1230,6 +1231,7 @@ struct MPT3SAS_ADAPTER {
bool msix_load_balance; bool msix_load_balance;
u16 thresh_hold; u16 thresh_hold;
u8 high_iops_queues; u8 high_iops_queues;
u32 drv_support_bitmap;
/* internal commands, callback index */ /* internal commands, callback index */
u8 scsi_io_cb_idx; u8 scsi_io_cb_idx;
...@@ -1454,6 +1456,8 @@ struct MPT3SAS_ADAPTER { ...@@ -1454,6 +1456,8 @@ struct MPT3SAS_ADAPTER {
GET_MSIX_INDEX get_msix_index_for_smlio; GET_MSIX_INDEX get_msix_index_for_smlio;
}; };
#define MPT_DRV_SUPPORT_BITMAP_MEMMOVE 0x00000001
typedef u8 (*MPT_CALLBACK)(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, typedef u8 (*MPT_CALLBACK)(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
u32 reply); u32 reply);
......
...@@ -3382,6 +3382,24 @@ static DEVICE_ATTR_RW(diag_trigger_mpi); ...@@ -3382,6 +3382,24 @@ static DEVICE_ATTR_RW(diag_trigger_mpi);
/*****************************************/ /*****************************************/
/**
* drv_support_bitmap_show - driver supported feature bitmap
* @cdev - pointer to embedded class device
* @buf - the buffer returned
*
* A sysfs 'read-only' shost attribute.
*/
static ssize_t
drv_support_bitmap_show(struct device *cdev,
struct device_attribute *attr, char *buf)
{
struct Scsi_Host *shost = class_to_shost(cdev);
struct MPT3SAS_ADAPTER *ioc = shost_priv(shost);
return snprintf(buf, PAGE_SIZE, "0x%08x\n", ioc->drv_support_bitmap);
}
static DEVICE_ATTR_RO(drv_support_bitmap);
struct device_attribute *mpt3sas_host_attrs[] = { struct device_attribute *mpt3sas_host_attrs[] = {
&dev_attr_version_fw, &dev_attr_version_fw,
&dev_attr_version_bios, &dev_attr_version_bios,
...@@ -3407,6 +3425,7 @@ struct device_attribute *mpt3sas_host_attrs[] = { ...@@ -3407,6 +3425,7 @@ struct device_attribute *mpt3sas_host_attrs[] = {
&dev_attr_diag_trigger_event, &dev_attr_diag_trigger_event,
&dev_attr_diag_trigger_scsi, &dev_attr_diag_trigger_scsi,
&dev_attr_diag_trigger_mpi, &dev_attr_diag_trigger_mpi,
&dev_attr_drv_support_bitmap,
&dev_attr_BRM_status, &dev_attr_BRM_status,
NULL, NULL,
}; };
......
...@@ -10500,6 +10500,10 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -10500,6 +10500,10 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
ioc->tm_sas_control_cb_idx = tm_sas_control_cb_idx; ioc->tm_sas_control_cb_idx = tm_sas_control_cb_idx;
ioc->logging_level = logging_level; ioc->logging_level = logging_level;
ioc->schedule_dead_ioc_flush_running_cmds = &_scsih_flush_running_cmds; ioc->schedule_dead_ioc_flush_running_cmds = &_scsih_flush_running_cmds;
/*
* Enable MEMORY MOVE support flag.
*/
ioc->drv_support_bitmap |= MPT_DRV_SUPPORT_BITMAP_MEMMOVE;
/* misc semaphores and spin locks */ /* misc semaphores and spin locks */
mutex_init(&ioc->reset_in_progress_mutex); mutex_init(&ioc->reset_in_progress_mutex);
/* initializing pci_access_mutex lock */ /* initializing pci_access_mutex lock */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment