Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: bfa: move bus reset to target reset

The bus reset handler is just calling target reset on all targets, which
is exactly what SCSI EH will be doing anyway. So move the bus reset
function to target reset and drop the loop.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Hannes Reinecke and committed by
Martin K. Petersen
1b7092f3 cc199e78

+15 -22
+15 -22
drivers/scsi/bfa/bfad_im.c
··· 373 373 } 374 374 375 375 /* 376 - * Scsi_Host template entry, resets the bus and abort all commands. 376 + * Scsi_Host template entry, resets the target and abort all commands. 377 377 */ 378 378 static int 379 - bfad_im_reset_bus_handler(struct scsi_cmnd *cmnd) 379 + bfad_im_reset_target_handler(struct scsi_cmnd *cmnd) 380 380 { 381 381 struct Scsi_Host *shost = cmnd->device->host; 382 + struct scsi_target *starget = scsi_target(cmnd->device); 382 383 struct bfad_im_port_s *im_port = 383 384 (struct bfad_im_port_s *) shost->hostdata[0]; 384 385 struct bfad_s *bfad = im_port->bfad; 385 386 struct bfad_itnim_s *itnim; 386 387 unsigned long flags; 387 - u32 i, rc, err_cnt = 0; 388 + u32 rc, rtn = FAILED; 388 389 DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wq); 389 390 enum bfi_tskim_status task_status; 390 391 391 392 spin_lock_irqsave(&bfad->bfad_lock, flags); 392 - for (i = 0; i < MAX_FCP_TARGET; i++) { 393 - itnim = bfad_get_itnim(im_port, i); 394 - if (itnim) { 395 - cmnd->SCp.ptr = (char *)&wq; 396 - rc = bfad_im_target_reset_send(bfad, cmnd, itnim); 397 - if (rc != BFA_STATUS_OK) { 398 - err_cnt++; 399 - continue; 400 - } 401 - 393 + itnim = bfad_get_itnim(im_port, starget->id); 394 + if (itnim) { 395 + cmnd->SCp.ptr = (char *)&wq; 396 + rc = bfad_im_target_reset_send(bfad, cmnd, itnim); 397 + if (rc == BFA_STATUS_OK) { 402 398 /* wait target reset to complete */ 403 399 spin_unlock_irqrestore(&bfad->bfad_lock, flags); 404 400 wait_event(wq, test_bit(IO_DONE_BIT, ··· 402 406 spin_lock_irqsave(&bfad->bfad_lock, flags); 403 407 404 408 task_status = cmnd->SCp.Status >> 1; 405 - if (task_status != BFI_TSKIM_STS_OK) { 409 + if (task_status != BFI_TSKIM_STS_OK) 406 410 BFA_LOG(KERN_ERR, bfad, bfa_log_level, 407 411 "target reset failure," 408 412 " status: %d\n", task_status); 409 - err_cnt++; 410 - } 413 + else 414 + rtn = SUCCESS; 411 415 } 412 416 } 413 417 spin_unlock_irqrestore(&bfad->bfad_lock, flags); 414 418 415 - if (err_cnt) 416 - return FAILED; 417 - 418 - return SUCCESS; 419 + return rtn; 419 420 } 420 421 421 422 /* ··· 809 816 .eh_timed_out = fc_eh_timed_out, 810 817 .eh_abort_handler = bfad_im_abort_handler, 811 818 .eh_device_reset_handler = bfad_im_reset_lun_handler, 812 - .eh_bus_reset_handler = bfad_im_reset_bus_handler, 819 + .eh_target_reset_handler = bfad_im_reset_target_handler, 813 820 814 821 .slave_alloc = bfad_im_slave_alloc, 815 822 .slave_configure = bfad_im_slave_configure, ··· 832 839 .eh_timed_out = fc_eh_timed_out, 833 840 .eh_abort_handler = bfad_im_abort_handler, 834 841 .eh_device_reset_handler = bfad_im_reset_lun_handler, 835 - .eh_bus_reset_handler = bfad_im_reset_bus_handler, 842 + .eh_target_reset_handler = bfad_im_reset_target_handler, 836 843 837 844 .slave_alloc = bfad_im_slave_alloc, 838 845 .slave_configure = bfad_im_slave_configure,