[SCSI] mpt2sas: cleanup interrupt routine and config_request optimization
Cleaned up base_interrupt routine to be more effiecent. Deleted about a third of the config page API by moving redundant code from all the calling functions to _config_request. Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Reviewed-by: Eric Moore <Eric.moore@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
This commit is contained in:
committed by
James Bottomley
parent
ed79f1280d
commit
5b768581ea
@@ -687,6 +687,14 @@ _base_unmask_interrupts(struct MPT2SAS_ADAPTER *ioc)
|
|||||||
ioc->mask_interrupts = 0;
|
ioc->mask_interrupts = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
union reply_descriptor {
|
||||||
|
u64 word;
|
||||||
|
struct {
|
||||||
|
u32 low;
|
||||||
|
u32 high;
|
||||||
|
} u;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* _base_interrupt - MPT adapter (IOC) specific interrupt handler.
|
* _base_interrupt - MPT adapter (IOC) specific interrupt handler.
|
||||||
* @irq: irq number (not used)
|
* @irq: irq number (not used)
|
||||||
@@ -698,47 +706,38 @@ _base_unmask_interrupts(struct MPT2SAS_ADAPTER *ioc)
|
|||||||
static irqreturn_t
|
static irqreturn_t
|
||||||
_base_interrupt(int irq, void *bus_id)
|
_base_interrupt(int irq, void *bus_id)
|
||||||
{
|
{
|
||||||
union reply_descriptor {
|
|
||||||
u64 word;
|
|
||||||
struct {
|
|
||||||
u32 low;
|
|
||||||
u32 high;
|
|
||||||
} u;
|
|
||||||
};
|
|
||||||
union reply_descriptor rd;
|
union reply_descriptor rd;
|
||||||
u32 post_index, post_index_next, completed_cmds;
|
u32 completed_cmds;
|
||||||
u8 request_desript_type;
|
u8 request_desript_type;
|
||||||
u16 smid;
|
u16 smid;
|
||||||
u8 cb_idx;
|
u8 cb_idx;
|
||||||
u32 reply;
|
u32 reply;
|
||||||
u8 VF_ID;
|
u8 VF_ID;
|
||||||
int i;
|
|
||||||
struct MPT2SAS_ADAPTER *ioc = bus_id;
|
struct MPT2SAS_ADAPTER *ioc = bus_id;
|
||||||
|
Mpi2ReplyDescriptorsUnion_t *rpf;
|
||||||
|
|
||||||
if (ioc->mask_interrupts)
|
if (ioc->mask_interrupts)
|
||||||
return IRQ_NONE;
|
return IRQ_NONE;
|
||||||
|
|
||||||
post_index = ioc->reply_post_host_index;
|
rpf = &ioc->reply_post_free[ioc->reply_post_host_index];
|
||||||
request_desript_type = ioc->reply_post_free[post_index].
|
request_desript_type = rpf->Default.ReplyFlags
|
||||||
Default.ReplyFlags & MPI2_RPY_DESCRIPT_FLAGS_TYPE_MASK;
|
& MPI2_RPY_DESCRIPT_FLAGS_TYPE_MASK;
|
||||||
if (request_desript_type == MPI2_RPY_DESCRIPT_FLAGS_UNUSED)
|
if (request_desript_type == MPI2_RPY_DESCRIPT_FLAGS_UNUSED)
|
||||||
return IRQ_NONE;
|
return IRQ_NONE;
|
||||||
|
|
||||||
completed_cmds = 0;
|
completed_cmds = 0;
|
||||||
do {
|
do {
|
||||||
rd.word = ioc->reply_post_free[post_index].Words;
|
rd.word = rpf->Words;
|
||||||
if (rd.u.low == UINT_MAX || rd.u.high == UINT_MAX)
|
if (rd.u.low == UINT_MAX || rd.u.high == UINT_MAX)
|
||||||
goto out;
|
goto out;
|
||||||
reply = 0;
|
reply = 0;
|
||||||
cb_idx = 0xFF;
|
cb_idx = 0xFF;
|
||||||
smid = le16_to_cpu(ioc->reply_post_free[post_index].
|
smid = le16_to_cpu(rpf->Default.DescriptorTypeDependent1);
|
||||||
Default.DescriptorTypeDependent1);
|
VF_ID = rpf->Default.VF_ID;
|
||||||
VF_ID = ioc->reply_post_free[post_index].
|
|
||||||
Default.VF_ID;
|
|
||||||
if (request_desript_type ==
|
if (request_desript_type ==
|
||||||
MPI2_RPY_DESCRIPT_FLAGS_ADDRESS_REPLY) {
|
MPI2_RPY_DESCRIPT_FLAGS_ADDRESS_REPLY) {
|
||||||
reply = le32_to_cpu(ioc->reply_post_free[post_index].
|
reply = le32_to_cpu
|
||||||
AddressReply.ReplyFrameAddress);
|
(rpf->AddressReply.ReplyFrameAddress);
|
||||||
} else if (request_desript_type ==
|
} else if (request_desript_type ==
|
||||||
MPI2_RPY_DESCRIPT_FLAGS_TARGET_COMMAND_BUFFER)
|
MPI2_RPY_DESCRIPT_FLAGS_TARGET_COMMAND_BUFFER)
|
||||||
goto next;
|
goto next;
|
||||||
@@ -765,21 +764,27 @@ _base_interrupt(int irq, void *bus_id)
|
|||||||
0 : ioc->reply_free_host_index + 1;
|
0 : ioc->reply_free_host_index + 1;
|
||||||
ioc->reply_free[ioc->reply_free_host_index] =
|
ioc->reply_free[ioc->reply_free_host_index] =
|
||||||
cpu_to_le32(reply);
|
cpu_to_le32(reply);
|
||||||
|
wmb();
|
||||||
writel(ioc->reply_free_host_index,
|
writel(ioc->reply_free_host_index,
|
||||||
&ioc->chip->ReplyFreeHostIndex);
|
&ioc->chip->ReplyFreeHostIndex);
|
||||||
wmb();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
next:
|
next:
|
||||||
post_index_next = (post_index == (ioc->reply_post_queue_depth -
|
|
||||||
1)) ? 0 : post_index + 1;
|
rpf->Words = ULLONG_MAX;
|
||||||
|
ioc->reply_post_host_index = (ioc->reply_post_host_index ==
|
||||||
|
(ioc->reply_post_queue_depth - 1)) ? 0 :
|
||||||
|
ioc->reply_post_host_index + 1;
|
||||||
request_desript_type =
|
request_desript_type =
|
||||||
ioc->reply_post_free[post_index_next].Default.ReplyFlags
|
ioc->reply_post_free[ioc->reply_post_host_index].Default.
|
||||||
& MPI2_RPY_DESCRIPT_FLAGS_TYPE_MASK;
|
ReplyFlags & MPI2_RPY_DESCRIPT_FLAGS_TYPE_MASK;
|
||||||
completed_cmds++;
|
completed_cmds++;
|
||||||
if (request_desript_type == MPI2_RPY_DESCRIPT_FLAGS_UNUSED)
|
if (request_desript_type == MPI2_RPY_DESCRIPT_FLAGS_UNUSED)
|
||||||
goto out;
|
goto out;
|
||||||
post_index = post_index_next;
|
if (!ioc->reply_post_host_index)
|
||||||
|
rpf = ioc->reply_post_free;
|
||||||
|
else
|
||||||
|
rpf++;
|
||||||
} while (1);
|
} while (1);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
@@ -787,19 +792,8 @@ _base_interrupt(int irq, void *bus_id)
|
|||||||
if (!completed_cmds)
|
if (!completed_cmds)
|
||||||
return IRQ_NONE;
|
return IRQ_NONE;
|
||||||
|
|
||||||
/* reply post descriptor handling */
|
|
||||||
post_index_next = ioc->reply_post_host_index;
|
|
||||||
for (i = 0 ; i < completed_cmds; i++) {
|
|
||||||
post_index = post_index_next;
|
|
||||||
/* poison the reply post descriptor */
|
|
||||||
ioc->reply_post_free[post_index_next].Words = ULLONG_MAX;
|
|
||||||
post_index_next = (post_index ==
|
|
||||||
(ioc->reply_post_queue_depth - 1))
|
|
||||||
? 0 : post_index + 1;
|
|
||||||
}
|
|
||||||
ioc->reply_post_host_index = post_index_next;
|
|
||||||
writel(post_index_next, &ioc->chip->ReplyPostHostIndex);
|
|
||||||
wmb();
|
wmb();
|
||||||
|
writel(ioc->reply_post_host_index, &ioc->chip->ReplyPostHostIndex);
|
||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1650,7 +1644,7 @@ _base_static_config_pages(struct MPT2SAS_ADAPTER *ioc)
|
|||||||
iounit_pg1_flags |=
|
iounit_pg1_flags |=
|
||||||
MPI2_IOUNITPAGE1_DISABLE_TASK_SET_FULL_HANDLING;
|
MPI2_IOUNITPAGE1_DISABLE_TASK_SET_FULL_HANDLING;
|
||||||
ioc->iounit_pg1.Flags = cpu_to_le32(iounit_pg1_flags);
|
ioc->iounit_pg1.Flags = cpu_to_le32(iounit_pg1_flags);
|
||||||
mpt2sas_config_set_iounit_pg1(ioc, &mpi_reply, ioc->iounit_pg1);
|
mpt2sas_config_set_iounit_pg1(ioc, &mpi_reply, &ioc->iounit_pg1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3306,13 +3300,11 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc)
|
|||||||
ioc->tm_cmds.reply = kzalloc(ioc->reply_sz, GFP_KERNEL);
|
ioc->tm_cmds.reply = kzalloc(ioc->reply_sz, GFP_KERNEL);
|
||||||
ioc->tm_cmds.status = MPT2_CMD_NOT_USED;
|
ioc->tm_cmds.status = MPT2_CMD_NOT_USED;
|
||||||
mutex_init(&ioc->tm_cmds.mutex);
|
mutex_init(&ioc->tm_cmds.mutex);
|
||||||
init_completion(&ioc->tm_cmds.done);
|
|
||||||
|
|
||||||
/* config page internal command bits */
|
/* config page internal command bits */
|
||||||
ioc->config_cmds.reply = kzalloc(ioc->reply_sz, GFP_KERNEL);
|
ioc->config_cmds.reply = kzalloc(ioc->reply_sz, GFP_KERNEL);
|
||||||
ioc->config_cmds.status = MPT2_CMD_NOT_USED;
|
ioc->config_cmds.status = MPT2_CMD_NOT_USED;
|
||||||
mutex_init(&ioc->config_cmds.mutex);
|
mutex_init(&ioc->config_cmds.mutex);
|
||||||
init_completion(&ioc->config_cmds.done);
|
|
||||||
|
|
||||||
/* ctl module internal command bits */
|
/* ctl module internal command bits */
|
||||||
ioc->ctl_cmds.reply = kzalloc(ioc->reply_sz, GFP_KERNEL);
|
ioc->ctl_cmds.reply = kzalloc(ioc->reply_sz, GFP_KERNEL);
|
||||||
@@ -3436,6 +3428,7 @@ _base_reset_handler(struct MPT2SAS_ADAPTER *ioc, int reset_phase)
|
|||||||
if (ioc->config_cmds.status & MPT2_CMD_PENDING) {
|
if (ioc->config_cmds.status & MPT2_CMD_PENDING) {
|
||||||
ioc->config_cmds.status |= MPT2_CMD_RESET;
|
ioc->config_cmds.status |= MPT2_CMD_RESET;
|
||||||
mpt2sas_base_free_smid(ioc, ioc->config_cmds.smid);
|
mpt2sas_base_free_smid(ioc, ioc->config_cmds.smid);
|
||||||
|
ioc->config_cmds.smid = USHORT_MAX;
|
||||||
complete(&ioc->config_cmds.done);
|
complete(&ioc->config_cmds.done);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@@ -785,7 +785,7 @@ int mpt2sas_config_get_sas_iounit_pg0(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigRep
|
|||||||
int mpt2sas_config_get_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
|
int mpt2sas_config_get_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
|
||||||
*mpi_reply, Mpi2IOUnitPage1_t *config_page);
|
*mpi_reply, Mpi2IOUnitPage1_t *config_page);
|
||||||
int mpt2sas_config_set_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
|
int mpt2sas_config_set_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
|
||||||
*mpi_reply, Mpi2IOUnitPage1_t config_page);
|
*mpi_reply, Mpi2IOUnitPage1_t *config_page);
|
||||||
int mpt2sas_config_get_sas_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
|
int mpt2sas_config_get_sas_iounit_pg1(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
|
||||||
*mpi_reply, Mpi2SasIOUnitPage1_t *config_page, u16 sz);
|
*mpi_reply, Mpi2SasIOUnitPage1_t *config_page, u16 sz);
|
||||||
int mpt2sas_config_get_ioc_pg8(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
|
int mpt2sas_config_get_ioc_pg8(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigReply_t
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -1836,6 +1836,7 @@ mpt2sas_scsih_issue_tm(struct MPT2SAS_ADAPTER *ioc, u16 handle, uint lun,
|
|||||||
mpi_request->TaskMID = cpu_to_le16(smid_task);
|
mpi_request->TaskMID = cpu_to_le16(smid_task);
|
||||||
int_to_scsilun(lun, (struct scsi_lun *)mpi_request->LUN);
|
int_to_scsilun(lun, (struct scsi_lun *)mpi_request->LUN);
|
||||||
mpt2sas_scsih_set_tm_flag(ioc, handle);
|
mpt2sas_scsih_set_tm_flag(ioc, handle);
|
||||||
|
init_completion(&ioc->tm_cmds.done);
|
||||||
mpt2sas_base_put_smid_hi_priority(ioc, smid, VF_ID);
|
mpt2sas_base_put_smid_hi_priority(ioc, smid, VF_ID);
|
||||||
timeleft = wait_for_completion_timeout(&ioc->tm_cmds.done, timeout*HZ);
|
timeleft = wait_for_completion_timeout(&ioc->tm_cmds.done, timeout*HZ);
|
||||||
mpt2sas_scsih_clear_tm_flag(ioc, handle);
|
mpt2sas_scsih_clear_tm_flag(ioc, handle);
|
||||||
|
Reference in New Issue
Block a user