Commit 385d70b4 authored by FUJITA Tomonori's avatar FUJITA Tomonori Committed by James Bottomley

[SCSI] qla2xxx: convert to use the data buffer accessors

- remove the unnecessary map_single path.

- convert to use the new accessors for the sg lists and the
parameters.
Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: default avatarAndrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent b1192d5e
...@@ -1411,9 +1411,9 @@ qla2x00_print_scsi_cmd(struct scsi_cmnd * cmd) ...@@ -1411,9 +1411,9 @@ qla2x00_print_scsi_cmd(struct scsi_cmnd * cmd)
printk("0x%02x ", cmd->cmnd[i]); printk("0x%02x ", cmd->cmnd[i]);
} }
printk("\n seg_cnt=%d, allowed=%d, retries=%d\n", printk("\n seg_cnt=%d, allowed=%d, retries=%d\n",
cmd->use_sg, cmd->allowed, cmd->retries); scsi_sg_count(cmd), cmd->allowed, cmd->retries);
printk(" request buffer=0x%p, request buffer len=0x%x\n", printk(" request buffer=0x%p, request buffer len=0x%x\n",
cmd->request_buffer, cmd->request_bufflen); scsi_sglist(cmd), scsi_bufflen(cmd));
printk(" tag=%d, transfersize=0x%x\n", printk(" tag=%d, transfersize=0x%x\n",
cmd->tag, cmd->transfersize); cmd->tag, cmd->transfersize);
printk(" serial_number=%lx, SP=%p\n", cmd->serial_number, sp); printk(" serial_number=%lx, SP=%p\n", cmd->serial_number, sp);
......
...@@ -155,6 +155,8 @@ void qla2x00_build_scsi_iocbs_32(srb_t *sp, cmd_entry_t *cmd_pkt, ...@@ -155,6 +155,8 @@ void qla2x00_build_scsi_iocbs_32(srb_t *sp, cmd_entry_t *cmd_pkt,
uint32_t *cur_dsd; uint32_t *cur_dsd;
scsi_qla_host_t *ha; scsi_qla_host_t *ha;
struct scsi_cmnd *cmd; struct scsi_cmnd *cmd;
struct scatterlist *sg;
int i;
cmd = sp->cmd; cmd = sp->cmd;
...@@ -163,7 +165,7 @@ void qla2x00_build_scsi_iocbs_32(srb_t *sp, cmd_entry_t *cmd_pkt, ...@@ -163,7 +165,7 @@ void qla2x00_build_scsi_iocbs_32(srb_t *sp, cmd_entry_t *cmd_pkt,
__constant_cpu_to_le32(COMMAND_TYPE); __constant_cpu_to_le32(COMMAND_TYPE);
/* No data transfer */ /* No data transfer */
if (cmd->request_bufflen == 0 || cmd->sc_data_direction == DMA_NONE) { if (!scsi_bufflen(cmd) || cmd->sc_data_direction == DMA_NONE) {
cmd_pkt->byte_count = __constant_cpu_to_le32(0); cmd_pkt->byte_count = __constant_cpu_to_le32(0);
return; return;
} }
...@@ -177,35 +179,24 @@ void qla2x00_build_scsi_iocbs_32(srb_t *sp, cmd_entry_t *cmd_pkt, ...@@ -177,35 +179,24 @@ void qla2x00_build_scsi_iocbs_32(srb_t *sp, cmd_entry_t *cmd_pkt,
cur_dsd = (uint32_t *)&cmd_pkt->dseg_0_address; cur_dsd = (uint32_t *)&cmd_pkt->dseg_0_address;
/* Load data segments */ /* Load data segments */
if (cmd->use_sg != 0) {
struct scatterlist *cur_seg; scsi_for_each_sg(cmd, sg, tot_dsds, i) {
struct scatterlist *end_seg; cont_entry_t *cont_pkt;
cur_seg = (struct scatterlist *)cmd->request_buffer; /* Allocate additional continuation packets? */
end_seg = cur_seg + tot_dsds; if (avail_dsds == 0) {
while (cur_seg < end_seg) { /*
cont_entry_t *cont_pkt; * Seven DSDs are available in the Continuation
* Type 0 IOCB.
/* Allocate additional continuation packets? */ */
if (avail_dsds == 0) { cont_pkt = qla2x00_prep_cont_type0_iocb(ha);
/* cur_dsd = (uint32_t *)&cont_pkt->dseg_0_address;
* Seven DSDs are available in the Continuation avail_dsds = 7;
* Type 0 IOCB.
*/
cont_pkt = qla2x00_prep_cont_type0_iocb(ha);
cur_dsd = (uint32_t *)&cont_pkt->dseg_0_address;
avail_dsds = 7;
}
*cur_dsd++ = cpu_to_le32(sg_dma_address(cur_seg));
*cur_dsd++ = cpu_to_le32(sg_dma_len(cur_seg));
avail_dsds--;
cur_seg++;
} }
} else {
*cur_dsd++ = cpu_to_le32(sp->dma_handle); *cur_dsd++ = cpu_to_le32(sg_dma_address(sg));
*cur_dsd++ = cpu_to_le32(cmd->request_bufflen); *cur_dsd++ = cpu_to_le32(sg_dma_len(sg));
avail_dsds--;
} }
} }
...@@ -224,6 +215,8 @@ void qla2x00_build_scsi_iocbs_64(srb_t *sp, cmd_entry_t *cmd_pkt, ...@@ -224,6 +215,8 @@ void qla2x00_build_scsi_iocbs_64(srb_t *sp, cmd_entry_t *cmd_pkt,
uint32_t *cur_dsd; uint32_t *cur_dsd;
scsi_qla_host_t *ha; scsi_qla_host_t *ha;
struct scsi_cmnd *cmd; struct scsi_cmnd *cmd;
struct scatterlist *sg;
int i;
cmd = sp->cmd; cmd = sp->cmd;
...@@ -232,7 +225,7 @@ void qla2x00_build_scsi_iocbs_64(srb_t *sp, cmd_entry_t *cmd_pkt, ...@@ -232,7 +225,7 @@ void qla2x00_build_scsi_iocbs_64(srb_t *sp, cmd_entry_t *cmd_pkt,
__constant_cpu_to_le32(COMMAND_A64_TYPE); __constant_cpu_to_le32(COMMAND_A64_TYPE);
/* No data transfer */ /* No data transfer */
if (cmd->request_bufflen == 0 || cmd->sc_data_direction == DMA_NONE) { if (!scsi_bufflen(cmd) || cmd->sc_data_direction == DMA_NONE) {
cmd_pkt->byte_count = __constant_cpu_to_le32(0); cmd_pkt->byte_count = __constant_cpu_to_le32(0);
return; return;
} }
...@@ -246,39 +239,26 @@ void qla2x00_build_scsi_iocbs_64(srb_t *sp, cmd_entry_t *cmd_pkt, ...@@ -246,39 +239,26 @@ void qla2x00_build_scsi_iocbs_64(srb_t *sp, cmd_entry_t *cmd_pkt,
cur_dsd = (uint32_t *)&cmd_pkt->dseg_0_address; cur_dsd = (uint32_t *)&cmd_pkt->dseg_0_address;
/* Load data segments */ /* Load data segments */
if (cmd->use_sg != 0) { scsi_for_each_sg(cmd, sg, tot_dsds, i) {
struct scatterlist *cur_seg; dma_addr_t sle_dma;
struct scatterlist *end_seg; cont_a64_entry_t *cont_pkt;
cur_seg = (struct scatterlist *)cmd->request_buffer; /* Allocate additional continuation packets? */
end_seg = cur_seg + tot_dsds; if (avail_dsds == 0) {
while (cur_seg < end_seg) { /*
dma_addr_t sle_dma; * Five DSDs are available in the Continuation
cont_a64_entry_t *cont_pkt; * Type 1 IOCB.
*/
/* Allocate additional continuation packets? */ cont_pkt = qla2x00_prep_cont_type1_iocb(ha);
if (avail_dsds == 0) { cur_dsd = (uint32_t *)cont_pkt->dseg_0_address;
/* avail_dsds = 5;
* Five DSDs are available in the Continuation
* Type 1 IOCB.
*/
cont_pkt = qla2x00_prep_cont_type1_iocb(ha);
cur_dsd = (uint32_t *)cont_pkt->dseg_0_address;
avail_dsds = 5;
}
sle_dma = sg_dma_address(cur_seg);
*cur_dsd++ = cpu_to_le32(LSD(sle_dma));
*cur_dsd++ = cpu_to_le32(MSD(sle_dma));
*cur_dsd++ = cpu_to_le32(sg_dma_len(cur_seg));
avail_dsds--;
cur_seg++;
} }
} else {
*cur_dsd++ = cpu_to_le32(LSD(sp->dma_handle)); sle_dma = sg_dma_address(sg);
*cur_dsd++ = cpu_to_le32(MSD(sp->dma_handle)); *cur_dsd++ = cpu_to_le32(LSD(sle_dma));
*cur_dsd++ = cpu_to_le32(cmd->request_bufflen); *cur_dsd++ = cpu_to_le32(MSD(sle_dma));
*cur_dsd++ = cpu_to_le32(sg_dma_len(sg));
avail_dsds--;
} }
} }
...@@ -291,7 +271,7 @@ void qla2x00_build_scsi_iocbs_64(srb_t *sp, cmd_entry_t *cmd_pkt, ...@@ -291,7 +271,7 @@ void qla2x00_build_scsi_iocbs_64(srb_t *sp, cmd_entry_t *cmd_pkt,
int int
qla2x00_start_scsi(srb_t *sp) qla2x00_start_scsi(srb_t *sp)
{ {
int ret; int ret, nseg;
unsigned long flags; unsigned long flags;
scsi_qla_host_t *ha; scsi_qla_host_t *ha;
struct scsi_cmnd *cmd; struct scsi_cmnd *cmd;
...@@ -299,7 +279,6 @@ qla2x00_start_scsi(srb_t *sp) ...@@ -299,7 +279,6 @@ qla2x00_start_scsi(srb_t *sp)
uint32_t index; uint32_t index;
uint32_t handle; uint32_t handle;
cmd_entry_t *cmd_pkt; cmd_entry_t *cmd_pkt;
struct scatterlist *sg;
uint16_t cnt; uint16_t cnt;
uint16_t req_cnt; uint16_t req_cnt;
uint16_t tot_dsds; uint16_t tot_dsds;
...@@ -337,23 +316,10 @@ qla2x00_start_scsi(srb_t *sp) ...@@ -337,23 +316,10 @@ qla2x00_start_scsi(srb_t *sp)
goto queuing_error; goto queuing_error;
/* Map the sg table so we have an accurate count of sg entries needed */ /* Map the sg table so we have an accurate count of sg entries needed */
if (cmd->use_sg) { nseg = scsi_dma_map(cmd);
sg = (struct scatterlist *) cmd->request_buffer; if (nseg < 0)
tot_dsds = pci_map_sg(ha->pdev, sg, cmd->use_sg, goto queuing_error;
cmd->sc_data_direction); tot_dsds = nseg;
if (tot_dsds == 0)
goto queuing_error;
} else if (cmd->request_bufflen) {
dma_addr_t req_dma;
req_dma = pci_map_single(ha->pdev, cmd->request_buffer,
cmd->request_bufflen, cmd->sc_data_direction);
if (dma_mapping_error(req_dma))
goto queuing_error;
sp->dma_handle = req_dma;
tot_dsds = 1;
}
/* Calculate the number of request entries needed. */ /* Calculate the number of request entries needed. */
req_cnt = ha->isp_ops.calc_req_entries(tot_dsds); req_cnt = ha->isp_ops.calc_req_entries(tot_dsds);
...@@ -391,7 +357,7 @@ qla2x00_start_scsi(srb_t *sp) ...@@ -391,7 +357,7 @@ qla2x00_start_scsi(srb_t *sp)
/* Load SCSI command packet. */ /* Load SCSI command packet. */
memcpy(cmd_pkt->scsi_cdb, cmd->cmnd, cmd->cmd_len); memcpy(cmd_pkt->scsi_cdb, cmd->cmnd, cmd->cmd_len);
cmd_pkt->byte_count = cpu_to_le32((uint32_t)cmd->request_bufflen); cmd_pkt->byte_count = cpu_to_le32((uint32_t)scsi_bufflen(cmd));
/* Build IOCB segments */ /* Build IOCB segments */
ha->isp_ops.build_iocbs(sp, cmd_pkt, tot_dsds); ha->isp_ops.build_iocbs(sp, cmd_pkt, tot_dsds);
...@@ -423,14 +389,9 @@ qla2x00_start_scsi(srb_t *sp) ...@@ -423,14 +389,9 @@ qla2x00_start_scsi(srb_t *sp)
return (QLA_SUCCESS); return (QLA_SUCCESS);
queuing_error: queuing_error:
if (cmd->use_sg && tot_dsds) { if (tot_dsds)
sg = (struct scatterlist *) cmd->request_buffer; scsi_dma_unmap(cmd);
pci_unmap_sg(ha->pdev, sg, cmd->use_sg,
cmd->sc_data_direction);
} else if (tot_dsds) {
pci_unmap_single(ha->pdev, sp->dma_handle,
cmd->request_bufflen, cmd->sc_data_direction);
}
spin_unlock_irqrestore(&ha->hardware_lock, flags); spin_unlock_irqrestore(&ha->hardware_lock, flags);
return (QLA_FUNCTION_FAILED); return (QLA_FUNCTION_FAILED);
...@@ -642,6 +603,8 @@ qla24xx_build_scsi_iocbs(srb_t *sp, struct cmd_type_7 *cmd_pkt, ...@@ -642,6 +603,8 @@ qla24xx_build_scsi_iocbs(srb_t *sp, struct cmd_type_7 *cmd_pkt,
uint32_t *cur_dsd; uint32_t *cur_dsd;
scsi_qla_host_t *ha; scsi_qla_host_t *ha;
struct scsi_cmnd *cmd; struct scsi_cmnd *cmd;
struct scatterlist *sg;
int i;
cmd = sp->cmd; cmd = sp->cmd;
...@@ -650,7 +613,7 @@ qla24xx_build_scsi_iocbs(srb_t *sp, struct cmd_type_7 *cmd_pkt, ...@@ -650,7 +613,7 @@ qla24xx_build_scsi_iocbs(srb_t *sp, struct cmd_type_7 *cmd_pkt,
__constant_cpu_to_le32(COMMAND_TYPE_7); __constant_cpu_to_le32(COMMAND_TYPE_7);
/* No data transfer */ /* No data transfer */
if (cmd->request_bufflen == 0 || cmd->sc_data_direction == DMA_NONE) { if (!scsi_bufflen(cmd) || cmd->sc_data_direction == DMA_NONE) {
cmd_pkt->byte_count = __constant_cpu_to_le32(0); cmd_pkt->byte_count = __constant_cpu_to_le32(0);
return; return;
} }
...@@ -670,39 +633,27 @@ qla24xx_build_scsi_iocbs(srb_t *sp, struct cmd_type_7 *cmd_pkt, ...@@ -670,39 +633,27 @@ qla24xx_build_scsi_iocbs(srb_t *sp, struct cmd_type_7 *cmd_pkt,
cur_dsd = (uint32_t *)&cmd_pkt->dseg_0_address; cur_dsd = (uint32_t *)&cmd_pkt->dseg_0_address;
/* Load data segments */ /* Load data segments */
if (cmd->use_sg != 0) {
struct scatterlist *cur_seg; scsi_for_each_sg(cmd, sg, tot_dsds, i) {
struct scatterlist *end_seg; dma_addr_t sle_dma;
cont_a64_entry_t *cont_pkt;
cur_seg = (struct scatterlist *)cmd->request_buffer;
end_seg = cur_seg + tot_dsds; /* Allocate additional continuation packets? */
while (cur_seg < end_seg) { if (avail_dsds == 0) {
dma_addr_t sle_dma; /*
cont_a64_entry_t *cont_pkt; * Five DSDs are available in the Continuation
* Type 1 IOCB.
/* Allocate additional continuation packets? */ */
if (avail_dsds == 0) { cont_pkt = qla2x00_prep_cont_type1_iocb(ha);
/* cur_dsd = (uint32_t *)cont_pkt->dseg_0_address;
* Five DSDs are available in the Continuation avail_dsds = 5;
* Type 1 IOCB.
*/
cont_pkt = qla2x00_prep_cont_type1_iocb(ha);
cur_dsd = (uint32_t *)cont_pkt->dseg_0_address;
avail_dsds = 5;
}
sle_dma = sg_dma_address(cur_seg);
*cur_dsd++ = cpu_to_le32(LSD(sle_dma));
*cur_dsd++ = cpu_to_le32(MSD(sle_dma));
*cur_dsd++ = cpu_to_le32(sg_dma_len(cur_seg));
avail_dsds--;
cur_seg++;
} }
} else {
*cur_dsd++ = cpu_to_le32(LSD(sp->dma_handle)); sle_dma = sg_dma_address(sg);
*cur_dsd++ = cpu_to_le32(MSD(sp->dma_handle)); *cur_dsd++ = cpu_to_le32(LSD(sle_dma));
*cur_dsd++ = cpu_to_le32(cmd->request_bufflen); *cur_dsd++ = cpu_to_le32(MSD(sle_dma));
*cur_dsd++ = cpu_to_le32(sg_dma_len(sg));
avail_dsds--;
} }
} }
...@@ -716,7 +667,7 @@ qla24xx_build_scsi_iocbs(srb_t *sp, struct cmd_type_7 *cmd_pkt, ...@@ -716,7 +667,7 @@ qla24xx_build_scsi_iocbs(srb_t *sp, struct cmd_type_7 *cmd_pkt,
int int
qla24xx_start_scsi(srb_t *sp) qla24xx_start_scsi(srb_t *sp)
{ {
int ret; int ret, nseg;
unsigned long flags; unsigned long flags;
scsi_qla_host_t *ha; scsi_qla_host_t *ha;
struct scsi_cmnd *cmd; struct scsi_cmnd *cmd;
...@@ -724,7 +675,6 @@ qla24xx_start_scsi(srb_t *sp) ...@@ -724,7 +675,6 @@ qla24xx_start_scsi(srb_t *sp)
uint32_t index; uint32_t index;
uint32_t handle; uint32_t handle;
struct cmd_type_7 *cmd_pkt; struct cmd_type_7 *cmd_pkt;
struct scatterlist *sg;
uint16_t cnt; uint16_t cnt;
uint16_t req_cnt; uint16_t req_cnt;
uint16_t tot_dsds; uint16_t tot_dsds;
...@@ -762,23 +712,10 @@ qla24xx_start_scsi(srb_t *sp) ...@@ -762,23 +712,10 @@ qla24xx_start_scsi(srb_t *sp)
goto queuing_error; goto queuing_error;
/* Map the sg table so we have an accurate count of sg entries needed */ /* Map the sg table so we have an accurate count of sg entries needed */
if (cmd->use_sg) { nseg = scsi_dma_map(cmd);
sg = (struct scatterlist *) cmd->request_buffer; if (nseg < 0)
tot_dsds = pci_map_sg(ha->pdev, sg, cmd->use_sg,
cmd->sc_data_direction);
if (tot_dsds == 0)
goto queuing_error; goto queuing_error;
} else if (cmd->request_bufflen) { tot_dsds = nseg;
dma_addr_t req_dma;
req_dma = pci_map_single(ha->pdev, cmd->request_buffer,
cmd->request_bufflen, cmd->sc_data_direction);
if (dma_mapping_error(req_dma))
goto queuing_error;
sp->dma_handle = req_dma;
tot_dsds = 1;
}
req_cnt = qla24xx_calc_iocbs(tot_dsds); req_cnt = qla24xx_calc_iocbs(tot_dsds);
if (ha->req_q_cnt < (req_cnt + 2)) { if (ha->req_q_cnt < (req_cnt + 2)) {
...@@ -821,7 +758,7 @@ qla24xx_start_scsi(srb_t *sp) ...@@ -821,7 +758,7 @@ qla24xx_start_scsi(srb_t *sp)
memcpy(cmd_pkt->fcp_cdb, cmd->cmnd, cmd->cmd_len); memcpy(cmd_pkt->fcp_cdb, cmd->cmnd, cmd->cmd_len);
host_to_fcp_swap(cmd_pkt->fcp_cdb, sizeof(cmd_pkt->fcp_cdb)); host_to_fcp_swap(cmd_pkt->fcp_cdb, sizeof(cmd_pkt->fcp_cdb));
cmd_pkt->byte_count = cpu_to_le32((uint32_t)cmd->request_bufflen); cmd_pkt->byte_count = cpu_to_le32((uint32_t)scsi_bufflen(cmd));
/* Build IOCB segments */ /* Build IOCB segments */
qla24xx_build_scsi_iocbs(sp, cmd_pkt, tot_dsds); qla24xx_build_scsi_iocbs(sp, cmd_pkt, tot_dsds);
...@@ -853,14 +790,9 @@ qla24xx_start_scsi(srb_t *sp) ...@@ -853,14 +790,9 @@ qla24xx_start_scsi(srb_t *sp)
return QLA_SUCCESS; return QLA_SUCCESS;
queuing_error: queuing_error:
if (cmd->use_sg && tot_dsds) { if (tot_dsds)
sg = (struct scatterlist *) cmd->request_buffer; scsi_dma_unmap(cmd);
pci_unmap_sg(ha->pdev, sg, cmd->use_sg,
cmd->sc_data_direction);
} else if (tot_dsds) {
pci_unmap_single(ha->pdev, sp->dma_handle,
cmd->request_bufflen, cmd->sc_data_direction);
}
spin_unlock_irqrestore(&ha->hardware_lock, flags); spin_unlock_irqrestore(&ha->hardware_lock, flags);
return QLA_FUNCTION_FAILED; return QLA_FUNCTION_FAILED;
......
...@@ -889,19 +889,19 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt) ...@@ -889,19 +889,19 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
} }
if (scsi_status & (SS_RESIDUAL_UNDER | SS_RESIDUAL_OVER)) { if (scsi_status & (SS_RESIDUAL_UNDER | SS_RESIDUAL_OVER)) {
resid = resid_len; resid = resid_len;
cp->resid = resid; scsi_set_resid(cp, resid);
CMD_RESID_LEN(cp) = resid; CMD_RESID_LEN(cp) = resid;
if (!lscsi_status && if (!lscsi_status &&
((unsigned)(cp->request_bufflen - resid) < ((unsigned)(scsi_bufflen(cp) - resid) <
cp->underflow)) { cp->underflow)) {
qla_printk(KERN_INFO, ha, qla_printk(KERN_INFO, ha,
"scsi(%ld:%d:%d:%d): Mid-layer underflow " "scsi(%ld:%d:%d:%d): Mid-layer underflow "
"detected (%x of %x bytes)...returning " "detected (%x of %x bytes)...returning "
"error status.\n", ha->host_no, "error status.\n", ha->host_no,
cp->device->channel, cp->device->id, cp->device->channel, cp->device->id,
cp->device->lun, resid, cp->device->lun, resid,
cp->request_bufflen); scsi_bufflen(cp));
cp->result = DID_ERROR << 16; cp->result = DID_ERROR << 16;
break; break;
...@@ -963,7 +963,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt) ...@@ -963,7 +963,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
resid = fw_resid_len; resid = fw_resid_len;
if (scsi_status & SS_RESIDUAL_UNDER) { if (scsi_status & SS_RESIDUAL_UNDER) {
cp->resid = resid; scsi_set_resid(cp, resid);
CMD_RESID_LEN(cp) = resid; CMD_RESID_LEN(cp) = resid;
} else { } else {
DEBUG2(printk(KERN_INFO DEBUG2(printk(KERN_INFO
...@@ -1042,26 +1042,26 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt) ...@@ -1042,26 +1042,26 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
*/ */
if (!(scsi_status & SS_RESIDUAL_UNDER)) { if (!(scsi_status & SS_RESIDUAL_UNDER)) {
DEBUG2(printk("scsi(%ld:%d:%d:%d) Dropped " DEBUG2(printk("scsi(%ld:%d:%d:%d) Dropped "
"frame(s) detected (%x of %x bytes)..." "frame(s) detected (%x of %x bytes)..."
"retrying command.\n", ha->host_no, "retrying command.\n", ha->host_no,
cp->device->channel, cp->device->id, cp->device->channel, cp->device->id,
cp->device->lun, resid, cp->device->lun, resid,
cp->request_bufflen)); scsi_bufflen(cp)));
cp->result = DID_BUS_BUSY << 16; cp->result = DID_BUS_BUSY << 16;
break; break;
} }
/* Handle mid-layer underflow */ /* Handle mid-layer underflow */
if ((unsigned)(cp->request_bufflen - resid) < if ((unsigned)(scsi_bufflen(cp) - resid) <
cp->underflow) { cp->underflow) {
qla_printk(KERN_INFO, ha, qla_printk(KERN_INFO, ha,
"scsi(%ld:%d:%d:%d): Mid-layer underflow " "scsi(%ld:%d:%d:%d): Mid-layer underflow "
"detected (%x of %x bytes)...returning " "detected (%x of %x bytes)...returning "
"error status.\n", ha->host_no, "error status.\n", ha->host_no,
cp->device->channel, cp->device->id, cp->device->channel, cp->device->id,
cp->device->lun, resid, cp->device->lun, resid,
cp->request_bufflen); scsi_bufflen(cp));
cp->result = DID_ERROR << 16; cp->result = DID_ERROR << 16;
break; break;
...@@ -1084,7 +1084,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt) ...@@ -1084,7 +1084,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
DEBUG2(printk(KERN_INFO DEBUG2(printk(KERN_INFO
"PID=0x%lx req=0x%x xtra=0x%x -- returning DID_ERROR " "PID=0x%lx req=0x%x xtra=0x%x -- returning DID_ERROR "
"status!\n", "status!\n",
cp->serial_number, cp->request_bufflen, resid_len)); cp->serial_number, scsi_bufflen(cp), resid_len));
cp->result = DID_ERROR << 16; cp->result = DID_ERROR << 16;
break; break;
......
...@@ -2426,13 +2426,7 @@ qla2x00_sp_free_dma(scsi_qla_host_t *ha, srb_t *sp) ...@@ -2426,13 +2426,7 @@ qla2x00_sp_free_dma(scsi_qla_host_t *ha, srb_t *sp)
struct scsi_cmnd *cmd = sp->cmd; struct scsi_cmnd *cmd = sp->cmd;
if (sp->flags & SRB_DMA_VALID) { if (sp->flags & SRB_DMA_VALID) {
if (cmd->use_sg) { scsi_dma_unmap(cmd);
dma_unmap_sg(&ha->pdev->dev, cmd->request_buffer,
cmd->use_sg, cmd->sc_data_direction);
} else if (cmd->request_bufflen) {
dma_unmap_single(&ha->pdev->dev, sp->dma_handle,
cmd->request_bufflen, cmd->sc_data_direction);
}
sp->flags &= ~SRB_DMA_VALID; sp->flags &= ~SRB_DMA_VALID;
} }
CMD_SP(cmd) = NULL; CMD_SP(cmd) = NULL;
......
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