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

[SCSI] mpt fusion: config path optimized, completion queue is used

1) 	Previously we had mutliple #defines to use same values.
	Now those #defines are optimized.
	MPT_IOCTL_STATUS_* is removed and  MPT_MGMT_STATUS_* are new
	#defines.
2.)	config path is optimized.
	Instead of wait Queue and timer, using completion Q.
3.)	mpt_timer_expired is not used.

[jejb: elide patch to eliminate mpt_timer_expired]
Signed-off-by: default avatarKashyap Desai <kadesai@lsi.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent fd76175a
This diff is collapsed.
......@@ -432,14 +432,6 @@ do { \
* IOCTL structure and associated defines
*/
#define MPT_IOCTL_STATUS_DID_IOCRESET 0x01 /* IOC Reset occurred on the current*/
#define MPT_IOCTL_STATUS_RF_VALID 0x02 /* The Reply Frame is VALID */
#define MPT_IOCTL_STATUS_TIMER_ACTIVE 0x04 /* The timer is running */
#define MPT_IOCTL_STATUS_SENSE_VALID 0x08 /* Sense data is valid */
#define MPT_IOCTL_STATUS_COMMAND_GOOD 0x10 /* Command Status GOOD */
#define MPT_IOCTL_STATUS_TMTIMER_ACTIVE 0x20 /* The TM timer is running */
#define MPT_IOCTL_STATUS_TM_FAILED 0x40 /* User TM request failed */
#define MPTCTL_RESET_OK 0x01 /* Issue Bus Reset */
typedef struct _MPT_IOCTL {
......@@ -454,16 +446,27 @@ typedef struct _MPT_IOCTL {
struct mutex ioctl_mutex;
} MPT_IOCTL;
#define MPT_SAS_MGMT_STATUS_RF_VALID 0x02 /* The Reply Frame is VALID */
#define MPT_SAS_MGMT_STATUS_COMMAND_GOOD 0x10 /* Command Status GOOD */
#define MPT_SAS_MGMT_STATUS_TM_FAILED 0x40 /* User TM request failed */
typedef struct _MPT_SAS_MGMT {
#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_PENDING 0x04 /* command is pending */
#define MPT_MGMT_STATUS_DID_IOCRESET 0x08 /* IOC Reset occurred
on the current*/
#define MPT_MGMT_STATUS_SENSE_VALID 0x10 /* valid sense info */
#define MPT_MGMT_STATUS_TIMER_ACTIVE 0x20 /* obsolete */
#define MPT_MGMT_STATUS_FREE_MF 0x40 /* free the mf from
complete routine */
#define INITIALIZE_MGMT_STATUS(status) \
status = MPT_MGMT_STATUS_PENDING;
#define CLEAR_MGMT_STATUS(status) \
status = 0;
typedef struct _MPT_MGMT {
struct mutex mutex;
struct completion done;
u8 reply[MPT_DEFAULT_FRAME_SIZE]; /* reply frame data */
u8 status; /* current command status */
}MPT_SAS_MGMT;
} MPT_MGMT;
/*
* Event Structure and define
......@@ -661,7 +664,6 @@ typedef struct _MPT_ADAPTER
struct _mpt_ioctl_events *events; /* pointer to event log */
u8 *cached_fw; /* Pointer to FW */
dma_addr_t cached_fw_dma;
struct list_head configQ; /* linked list of config. requests */
int hs_reply_idx;
#ifndef MFCNT
u32 pad0;
......@@ -674,9 +676,6 @@ typedef struct _MPT_ADAPTER
IOCFactsReply_t facts;
PortFactsReply_t pfacts[2];
FCPortPage0_t fc_port_page0[2];
struct timer_list persist_timer; /* persist table timer */
int persist_wait_done; /* persist completion flag */
u8 persist_reply_frame[MPT_DEFAULT_FRAME_SIZE]; /* persist reply */
LANPage0_t lan_cnfg_page0;
LANPage1_t lan_cnfg_page1;
......@@ -708,7 +707,8 @@ typedef struct _MPT_ADAPTER
u8 sas_discovery_ignore_events;
u8 sas_discovery_quiesce_io;
int sas_index; /* index refrencing */
MPT_SAS_MGMT sas_mgmt;
MPT_MGMT sas_mgmt;
MPT_MGMT mptbase_cmds; /* for sending config pages */
struct work_struct sas_persist_task;
struct work_struct fc_setup_reset_work;
......@@ -884,21 +884,16 @@ struct scsi_cmnd;
* Generic structure passed to the base mpt_config function.
*/
typedef struct _x_config_parms {
struct list_head linkage; /* linked list */
struct timer_list timer; /* timer function for this request */
union {
ConfigExtendedPageHeader_t *ehdr;
ConfigPageHeader_t *hdr;
} cfghdr;
dma_addr_t physAddr;
int wait_done; /* wait for this request */
u32 pageAddr; /* properly formatted */
u16 status;
u8 action;
u8 dir;
u8 timeout; /* seconds */
u8 pad1;
u16 status;
u16 pad2;
} CONFIGPARMS;
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
......
......@@ -221,7 +221,7 @@ mptctl_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, MPT_FRAME_HDR *reply)
dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_reply() NULL Reply "
"Function=%x!\n", ioc->name, cmd));
ioc->ioctl->status |= MPT_IOCTL_STATUS_COMMAND_GOOD;
ioc->ioctl->status |= MPT_MGMT_STATUS_COMMAND_GOOD;
ioc->ioctl->reset &= ~MPTCTL_RESET_OK;
/* We are done, issue wake up
......@@ -237,14 +237,14 @@ mptctl_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, MPT_FRAME_HDR *reply)
*/
memcpy(ioc->ioctl->ReplyFrame, reply,
min(ioc->reply_sz, 4*reply->u.reply.MsgLength));
ioc->ioctl->status |= MPT_IOCTL_STATUS_RF_VALID;
ioc->ioctl->status |= MPT_MGMT_STATUS_RF_VALID;
/* Set the command status to GOOD if IOC Status is GOOD
* OR if SCSI I/O cmd and data underrun or recovered error.
*/
iocStatus = le16_to_cpu(reply->u.reply.IOCStatus) & MPI_IOCSTATUS_MASK;
if (iocStatus == MPI_IOCSTATUS_SUCCESS)
ioc->ioctl->status |= MPT_IOCTL_STATUS_COMMAND_GOOD;
ioc->ioctl->status |= MPT_MGMT_STATUS_COMMAND_GOOD;
if (iocStatus || reply->u.reply.IOCLogInfo)
dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "\tiocstatus (0x%04X), "
......@@ -268,7 +268,8 @@ mptctl_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, MPT_FRAME_HDR *reply)
if ((iocStatus == MPI_IOCSTATUS_SCSI_DATA_UNDERRUN) ||
(iocStatus == MPI_IOCSTATUS_SCSI_RECOVERED_ERROR)) {
ioc->ioctl->status |= MPT_IOCTL_STATUS_COMMAND_GOOD;
ioc->ioctl->status |=
MPT_MGMT_STATUS_COMMAND_GOOD;
}
}
......@@ -284,7 +285,7 @@ mptctl_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, MPT_FRAME_HDR *reply)
((u8 *)ioc->sense_buf_pool +
(req_index * MPT_SENSE_BUFFER_ALLOC));
memcpy(ioc->ioctl->sense, sense_data, sz);
ioc->ioctl->status |= MPT_IOCTL_STATUS_SENSE_VALID;
ioc->ioctl->status |= MPT_MGMT_STATUS_SENSE_VALID;
}
if (cmd == MPI_FUNCTION_SCSI_TASK_MGMT)
......@@ -483,10 +484,10 @@ mptctl_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
switch(reset_phase) {
case MPT_IOC_SETUP_RESET:
ioctl->status |= MPT_IOCTL_STATUS_DID_IOCRESET;
ioctl->status |= MPT_MGMT_STATUS_DID_IOCRESET;
break;
case MPT_IOC_POST_RESET:
ioctl->status &= ~MPT_IOCTL_STATUS_DID_IOCRESET;
ioctl->status &= ~MPT_MGMT_STATUS_DID_IOCRESET;
break;
case MPT_IOC_PRE_RESET:
default:
......@@ -1791,7 +1792,7 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
"No memory available during driver init.\n",
__FILE__, __LINE__);
return -ENOMEM;
} else if (ioc->ioctl->status & MPT_IOCTL_STATUS_DID_IOCRESET) {
} else if (ioc->ioctl->status & MPT_MGMT_STATUS_DID_IOCRESET) {
printk(KERN_ERR MYNAM "%s@%d::mptctl_do_mpt_command - "
"Busy with IOC Reset \n", __FILE__, __LINE__);
return -EBUSY;
......@@ -2231,7 +2232,7 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
/* If a valid reply frame, copy to the user.
* Offset 2: reply length in U32's
*/
if (ioc->ioctl->status & MPT_IOCTL_STATUS_RF_VALID) {
if (ioc->ioctl->status & MPT_MGMT_STATUS_RF_VALID) {
if (karg.maxReplyBytes < ioc->reply_sz) {
sz = min(karg.maxReplyBytes, 4*ioc->ioctl->ReplyFrame[2]);
} else {
......@@ -2253,7 +2254,7 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
/* If valid sense data, copy to user.
*/
if (ioc->ioctl->status & MPT_IOCTL_STATUS_SENSE_VALID) {
if (ioc->ioctl->status & MPT_MGMT_STATUS_SENSE_VALID) {
sz = min(karg.maxSenseBytes, MPT_SENSE_BUFFER_SIZE);
if (sz > 0) {
if (copy_to_user(karg.senseDataPtr, ioc->ioctl->sense, sz)) {
......@@ -2270,7 +2271,7 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
/* If the overall status is _GOOD and data in, copy data
* to user.
*/
if ((ioc->ioctl->status & MPT_IOCTL_STATUS_COMMAND_GOOD) &&
if ((ioc->ioctl->status & MPT_MGMT_STATUS_COMMAND_GOOD) &&
(karg.dataInSize > 0) && (bufIn.kptr)) {
if (copy_to_user(karg.dataInBufPtr,
......@@ -2285,9 +2286,9 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
done_free_mem:
ioc->ioctl->status &= ~(MPT_IOCTL_STATUS_COMMAND_GOOD |
MPT_IOCTL_STATUS_SENSE_VALID |
MPT_IOCTL_STATUS_RF_VALID );
ioc->ioctl->status &= ~(MPT_MGMT_STATUS_COMMAND_GOOD |
MPT_MGMT_STATUS_SENSE_VALID |
MPT_MGMT_STATUS_RF_VALID);
/* Free the allocated memory.
*/
......@@ -2527,7 +2528,7 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
* bays have drives in them
* pbuf[3] = Checksum (0x100 = (byte0 + byte2 + byte3)
*/
if (ioc->ioctl->status & MPT_IOCTL_STATUS_RF_VALID)
if (ioc->ioctl->status & MPT_MGMT_STATUS_RF_VALID)
karg.rsvd = *(u32 *)pbuf;
out:
......
......@@ -1122,9 +1122,9 @@ static int mptsas_get_linkerrors(struct sas_phy *phy)
static int mptsas_mgmt_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req,
MPT_FRAME_HDR *reply)
{
ioc->sas_mgmt.status |= MPT_SAS_MGMT_STATUS_COMMAND_GOOD;
ioc->sas_mgmt.status |= MPT_MGMT_STATUS_COMMAND_GOOD;
if (reply != NULL) {
ioc->sas_mgmt.status |= MPT_SAS_MGMT_STATUS_RF_VALID;
ioc->sas_mgmt.status |= MPT_MGMT_STATUS_RF_VALID;
memcpy(ioc->sas_mgmt.reply, reply,
min(ioc->reply_sz, 4 * reply->u.reply.MsgLength));
}
......@@ -1182,7 +1182,7 @@ static int mptsas_phy_reset(struct sas_phy *phy, int hard_reset)
/* a reply frame is expected */
if ((ioc->sas_mgmt.status &
MPT_IOCTL_STATUS_RF_VALID) == 0) {
MPT_MGMT_STATUS_RF_VALID) == 0) {
error = -ENXIO;
goto out_unlock;
}
......@@ -1359,7 +1359,7 @@ static int mptsas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy,
}
mf = NULL;
if (ioc->sas_mgmt.status & MPT_IOCTL_STATUS_RF_VALID) {
if (ioc->sas_mgmt.status & MPT_MGMT_STATUS_RF_VALID) {
SmpPassthroughReply_t *smprep;
smprep = (SmpPassthroughReply_t *)ioc->sas_mgmt.reply;
......
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