Commit ea2a788d authored by Kashyap, Desai's avatar Kashyap, Desai Committed by James Bottomley

[SCSI] mpt fusion: rewrite of ioctl_cmds internal generated function

1) rewrite of ioctl_cmds internal generated function that issue commands to
firmware, porting them to be single threaded using the generic MPT_MGMT
struct. All wait Queues are replace by completion Queue.
2) added seperate callback handler for ioctl task managment
(mptctl_taskmgmt_reply), to handle command that timeout
3) rewrite mptctl_bus_reset
Signed-off-by: default avatarKashyap Desai <kadesai@lsi.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent e7deff33
...@@ -434,18 +434,6 @@ do { \ ...@@ -434,18 +434,6 @@ do { \
#define MPTCTL_RESET_OK 0x01 /* Issue Bus Reset */ #define MPTCTL_RESET_OK 0x01 /* Issue Bus Reset */
typedef struct _MPT_IOCTL {
struct _MPT_ADAPTER *ioc;
u8 ReplyFrame[MPT_DEFAULT_FRAME_SIZE]; /* reply frame data */
u8 sense[MPT_SENSE_BUFFER_ALLOC];
int wait_done; /* wake-up value for this ioc */
u8 rsvd;
u8 status; /* current command status */
u8 reset; /* 1 if bus reset allowed */
u8 id; /* target for reset */
struct mutex ioctl_mutex;
} MPT_IOCTL;
#define MPT_MGMT_STATUS_RF_VALID 0x01 /* The Reply Frame is VALID */ #define MPT_MGMT_STATUS_RF_VALID 0x01 /* The Reply Frame is VALID */
#define MPT_MGMT_STATUS_COMMAND_GOOD 0x02 /* Command Status GOOD */ #define MPT_MGMT_STATUS_COMMAND_GOOD 0x02 /* Command Status GOOD */
#define MPT_MGMT_STATUS_PENDING 0x04 /* command is pending */ #define MPT_MGMT_STATUS_PENDING 0x04 /* command is pending */
...@@ -460,6 +448,10 @@ typedef struct _MPT_IOCTL { ...@@ -460,6 +448,10 @@ typedef struct _MPT_IOCTL {
status = MPT_MGMT_STATUS_PENDING; status = MPT_MGMT_STATUS_PENDING;
#define CLEAR_MGMT_STATUS(status) \ #define CLEAR_MGMT_STATUS(status) \
status = 0; status = 0;
#define CLEAR_MGMT_PENDING_STATUS(status) \
status &= ~MPT_MGMT_STATUS_PENDING;
#define SET_MGMT_MSG_CONTEXT(msg_context, value) \
msg_context = value;
typedef struct _MPT_MGMT { typedef struct _MPT_MGMT {
struct mutex mutex; struct mutex mutex;
...@@ -468,6 +460,7 @@ typedef struct _MPT_MGMT { ...@@ -468,6 +460,7 @@ typedef struct _MPT_MGMT {
u8 sense[MPT_SENSE_BUFFER_ALLOC]; u8 sense[MPT_SENSE_BUFFER_ALLOC];
u8 status; /* current command status */ u8 status; /* current command status */
int completion_code; int completion_code;
u32 msg_context;
} MPT_MGMT; } MPT_MGMT;
/* /*
...@@ -654,7 +647,6 @@ typedef struct _MPT_ADAPTER ...@@ -654,7 +647,6 @@ typedef struct _MPT_ADAPTER
RaidCfgData raid_data; /* Raid config. data */ RaidCfgData raid_data; /* Raid config. data */
SasCfgData sas_data; /* Sas config. data */ SasCfgData sas_data; /* Sas config. data */
FcCfgData fc_data; /* Fc config. data */ FcCfgData fc_data; /* Fc config. data */
MPT_IOCTL *ioctl; /* ioctl data pointer */
struct proc_dir_entry *ioc_dentry; struct proc_dir_entry *ioc_dentry;
struct _MPT_ADAPTER *alt_ioc; /* ptr to 929 bound adapter port */ struct _MPT_ADAPTER *alt_ioc; /* ptr to 929 bound adapter port */
u32 biosVersion; /* BIOS version from IO Unit Page 2 */ u32 biosVersion; /* BIOS version from IO Unit Page 2 */
...@@ -711,6 +703,7 @@ typedef struct _MPT_ADAPTER ...@@ -711,6 +703,7 @@ typedef struct _MPT_ADAPTER
MPT_MGMT mptbase_cmds; /* for sending config pages */ MPT_MGMT mptbase_cmds; /* for sending config pages */
MPT_MGMT internal_cmds; MPT_MGMT internal_cmds;
MPT_MGMT taskmgmt_cmds; MPT_MGMT taskmgmt_cmds;
MPT_MGMT ioctl_cmds;
spinlock_t taskmgmt_lock; /* diagnostic reset lock */ spinlock_t taskmgmt_lock; /* diagnostic reset lock */
int taskmgmt_in_progress; int taskmgmt_in_progress;
u8 taskmgmt_quiesce_io; u8 taskmgmt_quiesce_io;
...@@ -855,10 +848,8 @@ typedef struct _MPT_SCSI_HOST { ...@@ -855,10 +848,8 @@ typedef struct _MPT_SCSI_HOST {
/* Pool of memory for holding SCpnts before doing /* Pool of memory for holding SCpnts before doing
* OS callbacks. freeQ is the free pool. * OS callbacks. freeQ is the free pool.
*/ */
u8 tmPending;
u8 negoNvram; /* DV disabled, nego NVRAM */ u8 negoNvram; /* DV disabled, nego NVRAM */
u8 pad1; u8 pad1;
u8 tmState;
u8 rsvd[2]; u8 rsvd[2];
MPT_FRAME_HDR *cmdPtr; /* Ptr to nonOS request */ MPT_FRAME_HDR *cmdPtr; /* Ptr to nonOS request */
struct scsi_cmnd *abortSCpnt; struct scsi_cmnd *abortSCpnt;
......
This diff is collapsed.
...@@ -1290,8 +1290,6 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1290,8 +1290,6 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id)
/* Clear the TM flags /* Clear the TM flags
*/ */
hd->tmPending = 0;
hd->tmState = TM_STATE_NONE;
hd->abortSCpnt = NULL; hd->abortSCpnt = NULL;
/* Clear the pointer used to store /* Clear the pointer used to store
......
...@@ -553,15 +553,21 @@ mptsas_target_reset(MPT_ADAPTER *ioc, u8 channel, u8 id) ...@@ -553,15 +553,21 @@ mptsas_target_reset(MPT_ADAPTER *ioc, u8 channel, u8 id)
{ {
MPT_FRAME_HDR *mf; MPT_FRAME_HDR *mf;
SCSITaskMgmt_t *pScsiTm; SCSITaskMgmt_t *pScsiTm;
if (mpt_set_taskmgmt_in_progress_flag(ioc) != 0)
return 0;
mf = mpt_get_msg_frame(mptsasDeviceResetCtx, ioc); mf = mpt_get_msg_frame(mptsasDeviceResetCtx, ioc);
if (mf == NULL) { if (mf == NULL) {
dfailprintk(ioc, printk(MYIOC_s_WARN_FMT dfailprintk(ioc, printk(MYIOC_s_WARN_FMT
"%s, no msg frames @%d!!\n", "%s, no msg frames @%d!!\n", ioc->name,
ioc->name, __func__, __LINE__)); __func__, __LINE__));
return 0; goto out_fail;
} }
dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "TaskMgmt request (mf=%p)\n",
ioc->name, mf));
/* Format the Request /* Format the Request
*/ */
pScsiTm = (SCSITaskMgmt_t *) mf; pScsiTm = (SCSITaskMgmt_t *) mf;
...@@ -574,9 +580,18 @@ mptsas_target_reset(MPT_ADAPTER *ioc, u8 channel, u8 id) ...@@ -574,9 +580,18 @@ mptsas_target_reset(MPT_ADAPTER *ioc, u8 channel, u8 id)
DBG_DUMP_TM_REQUEST_FRAME(ioc, (u32 *)mf); DBG_DUMP_TM_REQUEST_FRAME(ioc, (u32 *)mf);
dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
"TaskMgmt type=%d (sas device delete) fw_channel = %d fw_id = %d)\n",
ioc->name, MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET, channel, id));
mpt_put_msg_frame_hi_pri(mptsasDeviceResetCtx, ioc, mf); mpt_put_msg_frame_hi_pri(mptsasDeviceResetCtx, ioc, mf);
return 1; return 1;
out_fail:
mpt_clear_taskmgmt_in_progress_flag(ioc);
return 0;
} }
/** /**
...@@ -719,9 +734,12 @@ mptsas_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr) ...@@ -719,9 +734,12 @@ mptsas_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
if (!ev) { if (!ev) {
dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s, failed to allocate mem @%d..!!\n", dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s, failed to allocate mem @%d..!!\n",
ioc->name,__func__, __LINE__)); ioc->name,__func__, __LINE__));
return 0; goto out_fail;
} }
dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "TaskMgmt request (mf=%p)\n",
ioc->name, mf));
INIT_WORK(&ev->work, mptsas_hotplug_work); INIT_WORK(&ev->work, mptsas_hotplug_work);
ev->ioc = ioc; ev->ioc = ioc;
ev->handle = le16_to_cpu(sas_event_data->DevHandle); ev->handle = le16_to_cpu(sas_event_data->DevHandle);
...@@ -734,10 +752,19 @@ mptsas_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr) ...@@ -734,10 +752,19 @@ mptsas_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
sizeof(__le64)); sizeof(__le64));
ev->sas_address = le64_to_cpu(sas_address); ev->sas_address = le64_to_cpu(sas_address);
ev->device_info = le32_to_cpu(sas_event_data->DeviceInfo); ev->device_info = le32_to_cpu(sas_event_data->DeviceInfo);
dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
"TaskMgmt type=%d (sas device delete) fw_channel = %d fw_id = %d)\n",
ioc->name, MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET, channel, id));
ev->event_type = MPTSAS_DEL_DEVICE; ev->event_type = MPTSAS_DEL_DEVICE;
schedule_work(&ev->work); schedule_work(&ev->work);
kfree(target_reset_list); kfree(target_reset_list);
out_fail:
mpt_clear_taskmgmt_in_progress_flag(ioc);
return 0;
/* /*
* issue target reset to next device in the queue * issue target reset to next device in the queue
...@@ -3291,8 +3318,6 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -3291,8 +3318,6 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id)
/* Clear the TM flags /* Clear the TM flags
*/ */
hd->tmPending = 0;
hd->tmState = TM_STATE_NONE;
hd->abortSCpnt = NULL; hd->abortSCpnt = NULL;
/* Clear the pointer used to store /* Clear the pointer used to store
......
...@@ -1895,8 +1895,6 @@ mptscsih_host_reset(struct scsi_cmnd *SCpnt) ...@@ -1895,8 +1895,6 @@ mptscsih_host_reset(struct scsi_cmnd *SCpnt)
* NONE. * NONE.
*/ */
retval = 0; retval = 0;
hd->tmPending = 0;
hd->tmState = TM_STATE_NONE;
} }
printk(MYIOC_s_INFO_FMT "host reset: %s (sc=%p)\n", printk(MYIOC_s_INFO_FMT "host reset: %s (sc=%p)\n",
......
...@@ -1474,8 +1474,6 @@ mptspi_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1474,8 +1474,6 @@ mptspi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
/* Clear the TM flags /* Clear the TM flags
*/ */
hd->tmPending = 0;
hd->tmState = TM_STATE_NONE;
hd->abortSCpnt = NULL; hd->abortSCpnt = NULL;
/* Clear the pointer used to store /* Clear the pointer used to store
......
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