diff options
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_iocb.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_iocb.c | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index a8abbb95730d..13396beae2ce 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c | |||
@@ -15,6 +15,7 @@ static request_t *qla2x00_req_pkt(struct scsi_qla_host *, struct req_que *, | |||
15 | struct rsp_que *rsp); | 15 | struct rsp_que *rsp); |
16 | static void qla2x00_isp_cmd(struct scsi_qla_host *, struct req_que *); | 16 | static void qla2x00_isp_cmd(struct scsi_qla_host *, struct req_que *); |
17 | 17 | ||
18 | static void qla25xx_set_que(srb_t *, struct rsp_que **); | ||
18 | /** | 19 | /** |
19 | * qla2x00_get_cmd_direction() - Determine control_flag data direction. | 20 | * qla2x00_get_cmd_direction() - Determine control_flag data direction. |
20 | * @cmd: SCSI command | 21 | * @cmd: SCSI command |
@@ -92,9 +93,10 @@ qla2x00_calc_iocbs_64(uint16_t dsds) | |||
92 | * Returns a pointer to the Continuation Type 0 IOCB packet. | 93 | * Returns a pointer to the Continuation Type 0 IOCB packet. |
93 | */ | 94 | */ |
94 | static inline cont_entry_t * | 95 | static inline cont_entry_t * |
95 | qla2x00_prep_cont_type0_iocb(struct req_que *req, struct scsi_qla_host *vha) | 96 | qla2x00_prep_cont_type0_iocb(struct scsi_qla_host *vha) |
96 | { | 97 | { |
97 | cont_entry_t *cont_pkt; | 98 | cont_entry_t *cont_pkt; |
99 | struct req_que *req = vha->req; | ||
98 | /* Adjust ring index. */ | 100 | /* Adjust ring index. */ |
99 | req->ring_index++; | 101 | req->ring_index++; |
100 | if (req->ring_index == req->length) { | 102 | if (req->ring_index == req->length) { |
@@ -120,10 +122,11 @@ qla2x00_prep_cont_type0_iocb(struct req_que *req, struct scsi_qla_host *vha) | |||
120 | * Returns a pointer to the continuation type 1 IOCB packet. | 122 | * Returns a pointer to the continuation type 1 IOCB packet. |
121 | */ | 123 | */ |
122 | static inline cont_a64_entry_t * | 124 | static inline cont_a64_entry_t * |
123 | qla2x00_prep_cont_type1_iocb(struct req_que *req, scsi_qla_host_t *vha) | 125 | qla2x00_prep_cont_type1_iocb(scsi_qla_host_t *vha) |
124 | { | 126 | { |
125 | cont_a64_entry_t *cont_pkt; | 127 | cont_a64_entry_t *cont_pkt; |
126 | 128 | ||
129 | struct req_que *req = vha->req; | ||
127 | /* Adjust ring index. */ | 130 | /* Adjust ring index. */ |
128 | req->ring_index++; | 131 | req->ring_index++; |
129 | if (req->ring_index == req->length) { | 132 | if (req->ring_index == req->length) { |
@@ -159,7 +162,6 @@ void qla2x00_build_scsi_iocbs_32(srb_t *sp, cmd_entry_t *cmd_pkt, | |||
159 | struct scsi_cmnd *cmd; | 162 | struct scsi_cmnd *cmd; |
160 | struct scatterlist *sg; | 163 | struct scatterlist *sg; |
161 | int i; | 164 | int i; |
162 | struct req_que *req; | ||
163 | 165 | ||
164 | cmd = sp->cmd; | 166 | cmd = sp->cmd; |
165 | 167 | ||
@@ -174,8 +176,6 @@ void qla2x00_build_scsi_iocbs_32(srb_t *sp, cmd_entry_t *cmd_pkt, | |||
174 | } | 176 | } |
175 | 177 | ||
176 | vha = sp->fcport->vha; | 178 | vha = sp->fcport->vha; |
177 | req = sp->que; | ||
178 | |||
179 | cmd_pkt->control_flags |= cpu_to_le16(qla2x00_get_cmd_direction(sp)); | 179 | cmd_pkt->control_flags |= cpu_to_le16(qla2x00_get_cmd_direction(sp)); |
180 | 180 | ||
181 | /* Three DSDs are available in the Command Type 2 IOCB */ | 181 | /* Three DSDs are available in the Command Type 2 IOCB */ |
@@ -192,7 +192,7 @@ void qla2x00_build_scsi_iocbs_32(srb_t *sp, cmd_entry_t *cmd_pkt, | |||
192 | * Seven DSDs are available in the Continuation | 192 | * Seven DSDs are available in the Continuation |
193 | * Type 0 IOCB. | 193 | * Type 0 IOCB. |
194 | */ | 194 | */ |
195 | cont_pkt = qla2x00_prep_cont_type0_iocb(req, vha); | 195 | cont_pkt = qla2x00_prep_cont_type0_iocb(vha); |
196 | cur_dsd = (uint32_t *)&cont_pkt->dseg_0_address; | 196 | cur_dsd = (uint32_t *)&cont_pkt->dseg_0_address; |
197 | avail_dsds = 7; | 197 | avail_dsds = 7; |
198 | } | 198 | } |
@@ -220,7 +220,6 @@ void qla2x00_build_scsi_iocbs_64(srb_t *sp, cmd_entry_t *cmd_pkt, | |||
220 | struct scsi_cmnd *cmd; | 220 | struct scsi_cmnd *cmd; |
221 | struct scatterlist *sg; | 221 | struct scatterlist *sg; |
222 | int i; | 222 | int i; |
223 | struct req_que *req; | ||
224 | 223 | ||
225 | cmd = sp->cmd; | 224 | cmd = sp->cmd; |
226 | 225 | ||
@@ -235,8 +234,6 @@ void qla2x00_build_scsi_iocbs_64(srb_t *sp, cmd_entry_t *cmd_pkt, | |||
235 | } | 234 | } |
236 | 235 | ||
237 | vha = sp->fcport->vha; | 236 | vha = sp->fcport->vha; |
238 | req = sp->que; | ||
239 | |||
240 | cmd_pkt->control_flags |= cpu_to_le16(qla2x00_get_cmd_direction(sp)); | 237 | cmd_pkt->control_flags |= cpu_to_le16(qla2x00_get_cmd_direction(sp)); |
241 | 238 | ||
242 | /* Two DSDs are available in the Command Type 3 IOCB */ | 239 | /* Two DSDs are available in the Command Type 3 IOCB */ |
@@ -254,7 +251,7 @@ void qla2x00_build_scsi_iocbs_64(srb_t *sp, cmd_entry_t *cmd_pkt, | |||
254 | * Five DSDs are available in the Continuation | 251 | * Five DSDs are available in the Continuation |
255 | * Type 1 IOCB. | 252 | * Type 1 IOCB. |
256 | */ | 253 | */ |
257 | cont_pkt = qla2x00_prep_cont_type1_iocb(req, vha); | 254 | cont_pkt = qla2x00_prep_cont_type1_iocb(vha); |
258 | cur_dsd = (uint32_t *)cont_pkt->dseg_0_address; | 255 | cur_dsd = (uint32_t *)cont_pkt->dseg_0_address; |
259 | avail_dsds = 5; | 256 | avail_dsds = 5; |
260 | } | 257 | } |
@@ -353,7 +350,6 @@ qla2x00_start_scsi(srb_t *sp) | |||
353 | /* Build command packet */ | 350 | /* Build command packet */ |
354 | req->current_outstanding_cmd = handle; | 351 | req->current_outstanding_cmd = handle; |
355 | req->outstanding_cmds[handle] = sp; | 352 | req->outstanding_cmds[handle] = sp; |
356 | sp->que = req; | ||
357 | sp->cmd->host_scribble = (unsigned char *)(unsigned long)handle; | 353 | sp->cmd->host_scribble = (unsigned char *)(unsigned long)handle; |
358 | req->cnt -= req_cnt; | 354 | req->cnt -= req_cnt; |
359 | 355 | ||
@@ -453,6 +449,7 @@ __qla2x00_marker(struct scsi_qla_host *vha, struct req_que *req, | |||
453 | mrk24->lun[2] = MSB(lun); | 449 | mrk24->lun[2] = MSB(lun); |
454 | host_to_fcp_swap(mrk24->lun, sizeof(mrk24->lun)); | 450 | host_to_fcp_swap(mrk24->lun, sizeof(mrk24->lun)); |
455 | mrk24->vp_index = vha->vp_idx; | 451 | mrk24->vp_index = vha->vp_idx; |
452 | mrk24->handle = MAKE_HANDLE(req->id, mrk24->handle); | ||
456 | } else { | 453 | } else { |
457 | SET_TARGET_ID(ha, mrk->target, loop_id); | 454 | SET_TARGET_ID(ha, mrk->target, loop_id); |
458 | mrk->lun = cpu_to_le16(lun); | 455 | mrk->lun = cpu_to_le16(lun); |
@@ -531,9 +528,6 @@ qla2x00_req_pkt(struct scsi_qla_host *vha, struct req_que *req, | |||
531 | for (cnt = 0; cnt < REQUEST_ENTRY_SIZE / 4; cnt++) | 528 | for (cnt = 0; cnt < REQUEST_ENTRY_SIZE / 4; cnt++) |
532 | *dword_ptr++ = 0; | 529 | *dword_ptr++ = 0; |
533 | 530 | ||
534 | /* Set system defined field. */ | ||
535 | pkt->sys_define = (uint8_t)req->ring_index; | ||
536 | |||
537 | /* Set entry count. */ | 531 | /* Set entry count. */ |
538 | pkt->entry_count = 1; | 532 | pkt->entry_count = 1; |
539 | 533 | ||
@@ -656,7 +650,7 @@ qla24xx_build_scsi_iocbs(srb_t *sp, struct cmd_type_7 *cmd_pkt, | |||
656 | } | 650 | } |
657 | 651 | ||
658 | vha = sp->fcport->vha; | 652 | vha = sp->fcport->vha; |
659 | req = sp->que; | 653 | req = vha->req; |
660 | 654 | ||
661 | /* Set transfer direction */ | 655 | /* Set transfer direction */ |
662 | if (cmd->sc_data_direction == DMA_TO_DEVICE) { | 656 | if (cmd->sc_data_direction == DMA_TO_DEVICE) { |
@@ -687,7 +681,7 @@ qla24xx_build_scsi_iocbs(srb_t *sp, struct cmd_type_7 *cmd_pkt, | |||
687 | * Five DSDs are available in the Continuation | 681 | * Five DSDs are available in the Continuation |
688 | * Type 1 IOCB. | 682 | * Type 1 IOCB. |
689 | */ | 683 | */ |
690 | cont_pkt = qla2x00_prep_cont_type1_iocb(req, vha); | 684 | cont_pkt = qla2x00_prep_cont_type1_iocb(vha); |
691 | cur_dsd = (uint32_t *)cont_pkt->dseg_0_address; | 685 | cur_dsd = (uint32_t *)cont_pkt->dseg_0_address; |
692 | avail_dsds = 5; | 686 | avail_dsds = 5; |
693 | } | 687 | } |
@@ -724,19 +718,13 @@ qla24xx_start_scsi(srb_t *sp) | |||
724 | struct scsi_cmnd *cmd = sp->cmd; | 718 | struct scsi_cmnd *cmd = sp->cmd; |
725 | struct scsi_qla_host *vha = sp->fcport->vha; | 719 | struct scsi_qla_host *vha = sp->fcport->vha; |
726 | struct qla_hw_data *ha = vha->hw; | 720 | struct qla_hw_data *ha = vha->hw; |
727 | uint16_t que_id; | ||
728 | 721 | ||
729 | /* Setup device pointers. */ | 722 | /* Setup device pointers. */ |
730 | ret = 0; | 723 | ret = 0; |
731 | que_id = vha->req_ques[0]; | ||
732 | 724 | ||
733 | req = ha->req_q_map[que_id]; | 725 | qla25xx_set_que(sp, &rsp); |
734 | sp->que = req; | 726 | req = vha->req; |
735 | 727 | ||
736 | if (req->rsp) | ||
737 | rsp = req->rsp; | ||
738 | else | ||
739 | rsp = ha->rsp_q_map[que_id]; | ||
740 | /* So we know we haven't pci_map'ed anything yet */ | 728 | /* So we know we haven't pci_map'ed anything yet */ |
741 | tot_dsds = 0; | 729 | tot_dsds = 0; |
742 | 730 | ||
@@ -794,7 +782,7 @@ qla24xx_start_scsi(srb_t *sp) | |||
794 | req->cnt -= req_cnt; | 782 | req->cnt -= req_cnt; |
795 | 783 | ||
796 | cmd_pkt = (struct cmd_type_7 *)req->ring_ptr; | 784 | cmd_pkt = (struct cmd_type_7 *)req->ring_ptr; |
797 | cmd_pkt->handle = handle; | 785 | cmd_pkt->handle = MAKE_HANDLE(req->id, handle); |
798 | 786 | ||
799 | /* Zero out remaining portion of packet. */ | 787 | /* Zero out remaining portion of packet. */ |
800 | /* tagged queuing modifier -- default is TSK_SIMPLE (0). */ | 788 | /* tagged queuing modifier -- default is TSK_SIMPLE (0). */ |
@@ -823,6 +811,8 @@ qla24xx_start_scsi(srb_t *sp) | |||
823 | 811 | ||
824 | /* Set total data segment count. */ | 812 | /* Set total data segment count. */ |
825 | cmd_pkt->entry_count = (uint8_t)req_cnt; | 813 | cmd_pkt->entry_count = (uint8_t)req_cnt; |
814 | /* Specify response queue number where completion should happen */ | ||
815 | cmd_pkt->entry_status = (uint8_t) rsp->id; | ||
826 | wmb(); | 816 | wmb(); |
827 | 817 | ||
828 | /* Adjust ring index. */ | 818 | /* Adjust ring index. */ |
@@ -842,7 +832,7 @@ qla24xx_start_scsi(srb_t *sp) | |||
842 | /* Manage unprocessed RIO/ZIO commands in response queue. */ | 832 | /* Manage unprocessed RIO/ZIO commands in response queue. */ |
843 | if (vha->flags.process_response_queue && | 833 | if (vha->flags.process_response_queue && |
844 | rsp->ring_ptr->signature != RESPONSE_PROCESSED) | 834 | rsp->ring_ptr->signature != RESPONSE_PROCESSED) |
845 | qla24xx_process_response_queue(rsp); | 835 | qla24xx_process_response_queue(vha, rsp); |
846 | 836 | ||
847 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 837 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
848 | return QLA_SUCCESS; | 838 | return QLA_SUCCESS; |
@@ -855,3 +845,16 @@ queuing_error: | |||
855 | 845 | ||
856 | return QLA_FUNCTION_FAILED; | 846 | return QLA_FUNCTION_FAILED; |
857 | } | 847 | } |
848 | |||
849 | static void qla25xx_set_que(srb_t *sp, struct rsp_que **rsp) | ||
850 | { | ||
851 | struct scsi_cmnd *cmd = sp->cmd; | ||
852 | struct qla_hw_data *ha = sp->fcport->vha->hw; | ||
853 | int affinity = cmd->request->cpu; | ||
854 | |||
855 | if (ql2xmultique_tag && affinity >= 0 && | ||
856 | affinity < ha->max_rsp_queues - 1) | ||
857 | *rsp = ha->rsp_q_map[affinity + 1]; | ||
858 | else | ||
859 | *rsp = ha->rsp_q_map[0]; | ||
860 | } | ||