diff options
author | nagalakshmi.nandigama@lsi.com <nagalakshmi.nandigama@lsi.com> | 2011-11-30 21:13:58 -0500 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2011-12-15 01:57:32 -0500 |
commit | f01690d31d905d46aaf2df8021a33231a71cd744 (patch) | |
tree | 05a0250988347c5a861cfbd10ff7a7129dde1080 /drivers/scsi/mpt2sas | |
parent | 23edb6e71696a5da9c5f3987d22221e12370dbce (diff) |
[SCSI] mpt2sas: Rearrange the the code so that the completion queues are initialized prior to sending the request to controller firmware
Signed-off-by: Nagalakshmi Nandigama <nagalakshmi.nandigama@lsi.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/mpt2sas')
-rw-r--r-- | drivers/scsi/mpt2sas/mpt2sas_base.c | 6 | ||||
-rw-r--r-- | drivers/scsi/mpt2sas/mpt2sas_ctl.c | 8 | ||||
-rw-r--r-- | drivers/scsi/mpt2sas/mpt2sas_transport.c | 9 |
3 files changed, 12 insertions, 11 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c index 0cca61def30a..4a8706867700 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c | |||
@@ -3199,8 +3199,8 @@ mpt2sas_base_sas_iounit_control(struct MPT2SAS_ADAPTER *ioc, | |||
3199 | if (mpi_request->Operation == MPI2_SAS_OP_PHY_HARD_RESET || | 3199 | if (mpi_request->Operation == MPI2_SAS_OP_PHY_HARD_RESET || |
3200 | mpi_request->Operation == MPI2_SAS_OP_PHY_LINK_RESET) | 3200 | mpi_request->Operation == MPI2_SAS_OP_PHY_LINK_RESET) |
3201 | ioc->ioc_link_reset_in_progress = 1; | 3201 | ioc->ioc_link_reset_in_progress = 1; |
3202 | mpt2sas_base_put_smid_default(ioc, smid); | ||
3203 | init_completion(&ioc->base_cmds.done); | 3202 | init_completion(&ioc->base_cmds.done); |
3203 | mpt2sas_base_put_smid_default(ioc, smid); | ||
3204 | timeleft = wait_for_completion_timeout(&ioc->base_cmds.done, | 3204 | timeleft = wait_for_completion_timeout(&ioc->base_cmds.done, |
3205 | msecs_to_jiffies(10000)); | 3205 | msecs_to_jiffies(10000)); |
3206 | if ((mpi_request->Operation == MPI2_SAS_OP_PHY_HARD_RESET || | 3206 | if ((mpi_request->Operation == MPI2_SAS_OP_PHY_HARD_RESET || |
@@ -3301,8 +3301,8 @@ mpt2sas_base_scsi_enclosure_processor(struct MPT2SAS_ADAPTER *ioc, | |||
3301 | request = mpt2sas_base_get_msg_frame(ioc, smid); | 3301 | request = mpt2sas_base_get_msg_frame(ioc, smid); |
3302 | ioc->base_cmds.smid = smid; | 3302 | ioc->base_cmds.smid = smid; |
3303 | memcpy(request, mpi_request, sizeof(Mpi2SepReply_t)); | 3303 | memcpy(request, mpi_request, sizeof(Mpi2SepReply_t)); |
3304 | mpt2sas_base_put_smid_default(ioc, smid); | ||
3305 | init_completion(&ioc->base_cmds.done); | 3304 | init_completion(&ioc->base_cmds.done); |
3305 | mpt2sas_base_put_smid_default(ioc, smid); | ||
3306 | timeleft = wait_for_completion_timeout(&ioc->base_cmds.done, | 3306 | timeleft = wait_for_completion_timeout(&ioc->base_cmds.done, |
3307 | msecs_to_jiffies(10000)); | 3307 | msecs_to_jiffies(10000)); |
3308 | if (!(ioc->base_cmds.status & MPT2_CMD_COMPLETE)) { | 3308 | if (!(ioc->base_cmds.status & MPT2_CMD_COMPLETE)) { |
@@ -3809,8 +3809,8 @@ _base_event_notification(struct MPT2SAS_ADAPTER *ioc, int sleep_flag) | |||
3809 | for (i = 0; i < MPI2_EVENT_NOTIFY_EVENTMASK_WORDS; i++) | 3809 | for (i = 0; i < MPI2_EVENT_NOTIFY_EVENTMASK_WORDS; i++) |
3810 | mpi_request->EventMasks[i] = | 3810 | mpi_request->EventMasks[i] = |
3811 | cpu_to_le32(ioc->event_masks[i]); | 3811 | cpu_to_le32(ioc->event_masks[i]); |
3812 | mpt2sas_base_put_smid_default(ioc, smid); | ||
3813 | init_completion(&ioc->base_cmds.done); | 3812 | init_completion(&ioc->base_cmds.done); |
3813 | mpt2sas_base_put_smid_default(ioc, smid); | ||
3814 | timeleft = wait_for_completion_timeout(&ioc->base_cmds.done, 30*HZ); | 3814 | timeleft = wait_for_completion_timeout(&ioc->base_cmds.done, 30*HZ); |
3815 | if (!(ioc->base_cmds.status & MPT2_CMD_COMPLETE)) { | 3815 | if (!(ioc->base_cmds.status & MPT2_CMD_COMPLETE)) { |
3816 | printk(MPT2SAS_ERR_FMT "%s: timeout\n", | 3816 | printk(MPT2SAS_ERR_FMT "%s: timeout\n", |
diff --git a/drivers/scsi/mpt2sas/mpt2sas_ctl.c b/drivers/scsi/mpt2sas/mpt2sas_ctl.c index aabcb911706e..7fceb899029e 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_ctl.c +++ b/drivers/scsi/mpt2sas/mpt2sas_ctl.c | |||
@@ -818,6 +818,7 @@ _ctl_do_mpt_command(struct MPT2SAS_ADAPTER *ioc, | |||
818 | _ctl_display_some_debug(ioc, smid, "ctl_request", NULL); | 818 | _ctl_display_some_debug(ioc, smid, "ctl_request", NULL); |
819 | #endif | 819 | #endif |
820 | 820 | ||
821 | init_completion(&ioc->ctl_cmds.done); | ||
821 | switch (mpi_request->Function) { | 822 | switch (mpi_request->Function) { |
822 | case MPI2_FUNCTION_SCSI_IO_REQUEST: | 823 | case MPI2_FUNCTION_SCSI_IO_REQUEST: |
823 | case MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH: | 824 | case MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH: |
@@ -903,7 +904,6 @@ _ctl_do_mpt_command(struct MPT2SAS_ADAPTER *ioc, | |||
903 | timeout = MPT2_IOCTL_DEFAULT_TIMEOUT; | 904 | timeout = MPT2_IOCTL_DEFAULT_TIMEOUT; |
904 | else | 905 | else |
905 | timeout = karg.timeout; | 906 | timeout = karg.timeout; |
906 | init_completion(&ioc->ctl_cmds.done); | ||
907 | timeleft = wait_for_completion_timeout(&ioc->ctl_cmds.done, | 907 | timeleft = wait_for_completion_timeout(&ioc->ctl_cmds.done, |
908 | timeout*HZ); | 908 | timeout*HZ); |
909 | if (mpi_request->Function == MPI2_FUNCTION_SCSI_TASK_MGMT) { | 909 | if (mpi_request->Function == MPI2_FUNCTION_SCSI_TASK_MGMT) { |
@@ -1477,8 +1477,8 @@ _ctl_diag_register_2(struct MPT2SAS_ADAPTER *ioc, | |||
1477 | mpi_request->ProductSpecific[i] = | 1477 | mpi_request->ProductSpecific[i] = |
1478 | cpu_to_le32(ioc->product_specific[buffer_type][i]); | 1478 | cpu_to_le32(ioc->product_specific[buffer_type][i]); |
1479 | 1479 | ||
1480 | mpt2sas_base_put_smid_default(ioc, smid); | ||
1481 | init_completion(&ioc->ctl_cmds.done); | 1480 | init_completion(&ioc->ctl_cmds.done); |
1481 | mpt2sas_base_put_smid_default(ioc, smid); | ||
1482 | timeleft = wait_for_completion_timeout(&ioc->ctl_cmds.done, | 1482 | timeleft = wait_for_completion_timeout(&ioc->ctl_cmds.done, |
1483 | MPT2_IOCTL_DEFAULT_TIMEOUT*HZ); | 1483 | MPT2_IOCTL_DEFAULT_TIMEOUT*HZ); |
1484 | 1484 | ||
@@ -1821,8 +1821,8 @@ _ctl_send_release(struct MPT2SAS_ADAPTER *ioc, u8 buffer_type, u8 *issue_reset) | |||
1821 | mpi_request->VF_ID = 0; /* TODO */ | 1821 | mpi_request->VF_ID = 0; /* TODO */ |
1822 | mpi_request->VP_ID = 0; | 1822 | mpi_request->VP_ID = 0; |
1823 | 1823 | ||
1824 | mpt2sas_base_put_smid_default(ioc, smid); | ||
1825 | init_completion(&ioc->ctl_cmds.done); | 1824 | init_completion(&ioc->ctl_cmds.done); |
1825 | mpt2sas_base_put_smid_default(ioc, smid); | ||
1826 | timeleft = wait_for_completion_timeout(&ioc->ctl_cmds.done, | 1826 | timeleft = wait_for_completion_timeout(&ioc->ctl_cmds.done, |
1827 | MPT2_IOCTL_DEFAULT_TIMEOUT*HZ); | 1827 | MPT2_IOCTL_DEFAULT_TIMEOUT*HZ); |
1828 | 1828 | ||
@@ -2095,8 +2095,8 @@ _ctl_diag_read_buffer(void __user *arg, enum block_state state) | |||
2095 | mpi_request->VF_ID = 0; /* TODO */ | 2095 | mpi_request->VF_ID = 0; /* TODO */ |
2096 | mpi_request->VP_ID = 0; | 2096 | mpi_request->VP_ID = 0; |
2097 | 2097 | ||
2098 | mpt2sas_base_put_smid_default(ioc, smid); | ||
2099 | init_completion(&ioc->ctl_cmds.done); | 2098 | init_completion(&ioc->ctl_cmds.done); |
2099 | mpt2sas_base_put_smid_default(ioc, smid); | ||
2100 | timeleft = wait_for_completion_timeout(&ioc->ctl_cmds.done, | 2100 | timeleft = wait_for_completion_timeout(&ioc->ctl_cmds.done, |
2101 | MPT2_IOCTL_DEFAULT_TIMEOUT*HZ); | 2101 | MPT2_IOCTL_DEFAULT_TIMEOUT*HZ); |
2102 | 2102 | ||
diff --git a/drivers/scsi/mpt2sas/mpt2sas_transport.c b/drivers/scsi/mpt2sas/mpt2sas_transport.c index 230732241aa2..831047466a5a 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_transport.c +++ b/drivers/scsi/mpt2sas/mpt2sas_transport.c | |||
@@ -398,8 +398,8 @@ _transport_expander_report_manufacture(struct MPT2SAS_ADAPTER *ioc, | |||
398 | dtransportprintk(ioc, printk(MPT2SAS_INFO_FMT "report_manufacture - " | 398 | dtransportprintk(ioc, printk(MPT2SAS_INFO_FMT "report_manufacture - " |
399 | "send to sas_addr(0x%016llx)\n", ioc->name, | 399 | "send to sas_addr(0x%016llx)\n", ioc->name, |
400 | (unsigned long long)sas_address)); | 400 | (unsigned long long)sas_address)); |
401 | mpt2sas_base_put_smid_default(ioc, smid); | ||
402 | init_completion(&ioc->transport_cmds.done); | 401 | init_completion(&ioc->transport_cmds.done); |
402 | mpt2sas_base_put_smid_default(ioc, smid); | ||
403 | timeleft = wait_for_completion_timeout(&ioc->transport_cmds.done, | 403 | timeleft = wait_for_completion_timeout(&ioc->transport_cmds.done, |
404 | 10*HZ); | 404 | 10*HZ); |
405 | 405 | ||
@@ -1184,8 +1184,8 @@ _transport_get_expander_phy_error_log(struct MPT2SAS_ADAPTER *ioc, | |||
1184 | dtransportprintk(ioc, printk(MPT2SAS_INFO_FMT "phy_error_log - " | 1184 | dtransportprintk(ioc, printk(MPT2SAS_INFO_FMT "phy_error_log - " |
1185 | "send to sas_addr(0x%016llx), phy(%d)\n", ioc->name, | 1185 | "send to sas_addr(0x%016llx), phy(%d)\n", ioc->name, |
1186 | (unsigned long long)phy->identify.sas_address, phy->number)); | 1186 | (unsigned long long)phy->identify.sas_address, phy->number)); |
1187 | mpt2sas_base_put_smid_default(ioc, smid); | ||
1188 | init_completion(&ioc->transport_cmds.done); | 1187 | init_completion(&ioc->transport_cmds.done); |
1188 | mpt2sas_base_put_smid_default(ioc, smid); | ||
1189 | timeleft = wait_for_completion_timeout(&ioc->transport_cmds.done, | 1189 | timeleft = wait_for_completion_timeout(&ioc->transport_cmds.done, |
1190 | 10*HZ); | 1190 | 10*HZ); |
1191 | 1191 | ||
@@ -1509,8 +1509,9 @@ _transport_expander_phy_control(struct MPT2SAS_ADAPTER *ioc, | |||
1509 | "send to sas_addr(0x%016llx), phy(%d), opcode(%d)\n", ioc->name, | 1509 | "send to sas_addr(0x%016llx), phy(%d), opcode(%d)\n", ioc->name, |
1510 | (unsigned long long)phy->identify.sas_address, phy->number, | 1510 | (unsigned long long)phy->identify.sas_address, phy->number, |
1511 | phy_operation)); | 1511 | phy_operation)); |
1512 | mpt2sas_base_put_smid_default(ioc, smid); | 1512 | |
1513 | init_completion(&ioc->transport_cmds.done); | 1513 | init_completion(&ioc->transport_cmds.done); |
1514 | mpt2sas_base_put_smid_default(ioc, smid); | ||
1514 | timeleft = wait_for_completion_timeout(&ioc->transport_cmds.done, | 1515 | timeleft = wait_for_completion_timeout(&ioc->transport_cmds.done, |
1515 | 10*HZ); | 1516 | 10*HZ); |
1516 | 1517 | ||
@@ -1949,8 +1950,8 @@ _transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1949 | dtransportprintk(ioc, printk(MPT2SAS_INFO_FMT "%s - " | 1950 | dtransportprintk(ioc, printk(MPT2SAS_INFO_FMT "%s - " |
1950 | "sending smp request\n", ioc->name, __func__)); | 1951 | "sending smp request\n", ioc->name, __func__)); |
1951 | 1952 | ||
1952 | mpt2sas_base_put_smid_default(ioc, smid); | ||
1953 | init_completion(&ioc->transport_cmds.done); | 1953 | init_completion(&ioc->transport_cmds.done); |
1954 | mpt2sas_base_put_smid_default(ioc, smid); | ||
1954 | timeleft = wait_for_completion_timeout(&ioc->transport_cmds.done, | 1955 | timeleft = wait_for_completion_timeout(&ioc->transport_cmds.done, |
1955 | 10*HZ); | 1956 | 10*HZ); |
1956 | 1957 | ||