@@ -347,6 +347,94 @@ qla2x00_async_tm_cmd(fc_port_t *fcport, uint32_t flags, uint32_t lun,
347347 return rval ;
348348}
349349
350+ static void
351+ qla24xx_abort_iocb_timeout (void * data )
352+ {
353+ srb_t * sp = (srb_t * )data ;
354+ struct srb_iocb * abt = & sp -> u .iocb_cmd ;
355+
356+ abt -> u .abt .comp_status = CS_TIMEOUT ;
357+ complete (& abt -> u .abt .comp );
358+ }
359+
360+ static void
361+ qla24xx_abort_sp_done (void * data , void * ptr , int res )
362+ {
363+ srb_t * sp = (srb_t * )ptr ;
364+ struct srb_iocb * abt = & sp -> u .iocb_cmd ;
365+
366+ complete (& abt -> u .abt .comp );
367+ }
368+
369+ static int
370+ qla24xx_async_abort_cmd (srb_t * cmd_sp )
371+ {
372+ scsi_qla_host_t * vha = cmd_sp -> fcport -> vha ;
373+ fc_port_t * fcport = cmd_sp -> fcport ;
374+ struct srb_iocb * abt_iocb ;
375+ srb_t * sp ;
376+ int rval = QLA_FUNCTION_FAILED ;
377+
378+ sp = qla2x00_get_sp (vha , fcport , GFP_KERNEL );
379+ if (!sp )
380+ goto done ;
381+
382+ abt_iocb = & sp -> u .iocb_cmd ;
383+ sp -> type = SRB_ABT_CMD ;
384+ sp -> name = "abort" ;
385+ qla2x00_init_timer (sp , qla2x00_get_async_timeout (vha ));
386+ abt_iocb -> u .abt .cmd_hndl = cmd_sp -> handle ;
387+ sp -> done = qla24xx_abort_sp_done ;
388+ abt_iocb -> timeout = qla24xx_abort_iocb_timeout ;
389+ init_completion (& abt_iocb -> u .abt .comp );
390+
391+ rval = qla2x00_start_sp (sp );
392+ if (rval != QLA_SUCCESS )
393+ goto done_free_sp ;
394+
395+ ql_dbg (ql_dbg_async , vha , 0x507c ,
396+ "Abort command issued - hdl=%x, target_id=%x\n" ,
397+ cmd_sp -> handle , fcport -> tgt_id );
398+
399+ wait_for_completion (& abt_iocb -> u .abt .comp );
400+
401+ rval = abt_iocb -> u .abt .comp_status == CS_COMPLETE ?
402+ QLA_SUCCESS : QLA_FUNCTION_FAILED ;
403+
404+ done_free_sp :
405+ sp -> free (vha , sp );
406+ done :
407+ return rval ;
408+ }
409+
410+ int
411+ qla24xx_async_abort_command (srb_t * sp )
412+ {
413+ unsigned long flags = 0 ;
414+
415+ uint32_t handle ;
416+ fc_port_t * fcport = sp -> fcport ;
417+ struct scsi_qla_host * vha = fcport -> vha ;
418+ struct qla_hw_data * ha = vha -> hw ;
419+ struct req_que * req = vha -> req ;
420+
421+ spin_lock_irqsave (& ha -> hardware_lock , flags );
422+ for (handle = 1 ; handle < req -> num_outstanding_cmds ; handle ++ ) {
423+ if (req -> outstanding_cmds [handle ] == sp )
424+ break ;
425+ }
426+ spin_unlock_irqrestore (& ha -> hardware_lock , flags );
427+ if (handle == req -> num_outstanding_cmds ) {
428+ /* Command not found. */
429+ return QLA_FUNCTION_FAILED ;
430+ }
431+ if (sp -> type == SRB_FXIOCB_DCMD )
432+ return qlafx00_fx_disc (vha , & vha -> hw -> mr .fcport ,
433+ FXDISC_ABORT_IOCTL );
434+
435+ return qla24xx_async_abort_cmd (sp );
436+ }
437+
350438void
351439qla2x00_async_login_done (struct scsi_qla_host * vha , fc_port_t * fcport ,
352440 uint16_t * data )
0 commit comments