aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ipr.c
diff options
context:
space:
mode:
authorBrian King <brking@linux.vnet.ibm.com>2007-03-29 13:43:50 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2007-04-01 12:19:12 -0400
commit51b1c7e19e18e84a44277951dd5c4c4617330baa (patch)
tree411022d7f1c4a886f331e2fa0f4f0f02ec13211d /drivers/scsi/ipr.c
parent0feeed823af05ca556087a89fdcf644f156f73b8 (diff)
[SCSI] ipr: Faster sg list fetch
Improve overall command performance by embedding the scatterlist in the command block used by the adapter. This decreases the overall number of DMAs required for a single command. Signed-off-by: Brian King <brking@linux.vnet.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/ipr.c')
-rw-r--r--drivers/scsi/ipr.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
index aa1fb72ca235..5cf1002283b4 100644
--- a/drivers/scsi/ipr.c
+++ b/drivers/scsi/ipr.c
@@ -480,12 +480,16 @@ static void ipr_reinit_ipr_cmnd(struct ipr_cmnd *ipr_cmd)
480{ 480{
481 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; 481 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb;
482 struct ipr_ioasa *ioasa = &ipr_cmd->ioasa; 482 struct ipr_ioasa *ioasa = &ipr_cmd->ioasa;
483 dma_addr_t dma_addr = be32_to_cpu(ioarcb->ioarcb_host_pci_addr);
483 484
484 memset(&ioarcb->cmd_pkt, 0, sizeof(struct ipr_cmd_pkt)); 485 memset(&ioarcb->cmd_pkt, 0, sizeof(struct ipr_cmd_pkt));
485 ioarcb->write_data_transfer_length = 0; 486 ioarcb->write_data_transfer_length = 0;
486 ioarcb->read_data_transfer_length = 0; 487 ioarcb->read_data_transfer_length = 0;
487 ioarcb->write_ioadl_len = 0; 488 ioarcb->write_ioadl_len = 0;
488 ioarcb->read_ioadl_len = 0; 489 ioarcb->read_ioadl_len = 0;
490 ioarcb->write_ioadl_addr =
491 cpu_to_be32(dma_addr + offsetof(struct ipr_cmnd, ioadl));
492 ioarcb->read_ioadl_addr = ioarcb->write_ioadl_addr;
489 ioasa->ioasc = 0; 493 ioasa->ioasc = 0;
490 ioasa->residual_data_len = 0; 494 ioasa->residual_data_len = 0;
491 ioasa->u.gata.status = 0; 495 ioasa->u.gata.status = 0;
@@ -4230,6 +4234,14 @@ static int ipr_build_ioadl(struct ipr_ioa_cfg *ioa_cfg,
4230 4234
4231 sglist = scsi_cmd->request_buffer; 4235 sglist = scsi_cmd->request_buffer;
4232 4236
4237 if (ipr_cmd->dma_use_sg <= ARRAY_SIZE(ioarcb->add_data.u.ioadl)) {
4238 ioadl = ioarcb->add_data.u.ioadl;
4239 ioarcb->write_ioadl_addr =
4240 cpu_to_be32(be32_to_cpu(ioarcb->ioarcb_host_pci_addr) +
4241 offsetof(struct ipr_ioarcb, add_data));
4242 ioarcb->read_ioadl_addr = ioarcb->write_ioadl_addr;
4243 }
4244
4233 for (i = 0; i < ipr_cmd->dma_use_sg; i++) { 4245 for (i = 0; i < ipr_cmd->dma_use_sg; i++) {
4234 ioadl[i].flags_and_data_len = 4246 ioadl[i].flags_and_data_len =
4235 cpu_to_be32(ioadl_flags | sg_dma_len(&sglist[i])); 4247 cpu_to_be32(ioadl_flags | sg_dma_len(&sglist[i]));
@@ -4260,6 +4272,11 @@ static int ipr_build_ioadl(struct ipr_ioa_cfg *ioa_cfg,
4260 scsi_cmd->sc_data_direction); 4272 scsi_cmd->sc_data_direction);
4261 4273
4262 if (likely(!pci_dma_mapping_error(ipr_cmd->dma_handle))) { 4274 if (likely(!pci_dma_mapping_error(ipr_cmd->dma_handle))) {
4275 ioadl = ioarcb->add_data.u.ioadl;
4276 ioarcb->write_ioadl_addr =
4277 cpu_to_be32(be32_to_cpu(ioarcb->ioarcb_host_pci_addr) +
4278 offsetof(struct ipr_ioarcb, add_data));
4279 ioarcb->read_ioadl_addr = ioarcb->write_ioadl_addr;
4263 ipr_cmd->dma_use_sg = 1; 4280 ipr_cmd->dma_use_sg = 1;
4264 ioadl[0].flags_and_data_len = 4281 ioadl[0].flags_and_data_len =
4265 cpu_to_be32(ioadl_flags | length | IPR_IOADL_FLAGS_LAST); 4282 cpu_to_be32(ioadl_flags | length | IPR_IOADL_FLAGS_LAST);
@@ -4346,11 +4363,9 @@ static void ipr_erp_done(struct ipr_cmnd *ipr_cmd)
4346 **/ 4363 **/
4347static void ipr_reinit_ipr_cmnd_for_erp(struct ipr_cmnd *ipr_cmd) 4364static void ipr_reinit_ipr_cmnd_for_erp(struct ipr_cmnd *ipr_cmd)
4348{ 4365{
4349 struct ipr_ioarcb *ioarcb; 4366 struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb;
4350 struct ipr_ioasa *ioasa; 4367 struct ipr_ioasa *ioasa = &ipr_cmd->ioasa;
4351 4368 dma_addr_t dma_addr = be32_to_cpu(ioarcb->ioarcb_host_pci_addr);
4352 ioarcb = &ipr_cmd->ioarcb;
4353 ioasa = &ipr_cmd->ioasa;
4354 4369
4355 memset(&ioarcb->cmd_pkt, 0, sizeof(struct ipr_cmd_pkt)); 4370 memset(&ioarcb->cmd_pkt, 0, sizeof(struct ipr_cmd_pkt));
4356 ioarcb->write_data_transfer_length = 0; 4371 ioarcb->write_data_transfer_length = 0;
@@ -4359,6 +4374,9 @@ static void ipr_reinit_ipr_cmnd_for_erp(struct ipr_cmnd *ipr_cmd)
4359 ioarcb->read_ioadl_len = 0; 4374 ioarcb->read_ioadl_len = 0;
4360 ioasa->ioasc = 0; 4375 ioasa->ioasc = 0;
4361 ioasa->residual_data_len = 0; 4376 ioasa->residual_data_len = 0;
4377 ioarcb->write_ioadl_addr =
4378 cpu_to_be32(dma_addr + offsetof(struct ipr_cmnd, ioadl));
4379 ioarcb->read_ioadl_addr = ioarcb->write_ioadl_addr;
4362} 4380}
4363 4381
4364/** 4382/**