sym2: streamlinke queuecommand path
PATCH 1/1 sym2: streamlinke queuecommand path
Merge sym_queue_command, sym_setup_cdb and sym_setup_data_and_start into sym53c8xx_queue_command. Rename sym_queue_scsiio into sym_init_scsiio now that it doesn't start I/O anymore but is simply a helper for sym53c8xx_queue_command.
Signed-off-by Christoph Hellwig <[email protected]>
drivers/scsi/sym53c8xx_2/sym_glue.c +28 -65
@@ -401,15 +401,38 @@ }/* -* Queue a SCSI command. +* queuecommand method. Entered with the host adapter lock held and +* interrupts disabled. */ -static int sym_queue_command (struct sym_hcb *np,struct scsi_cmnd *cmd) +static int sym53c8xx_queue_command (struct scsi_cmnd *cmd, +void (*done)(struct scsi_cmnd *)) {struct scsi_device *sdev = cmd->device; +struct sym_hcb *np =SYM_SOFTC_PTR (cmd); +struct sym_ucmd *ucp =SYM_UCMD_PTR (cmd);struct sym_tcb *tp;struct sym_lcb *lp;struct sym_ccb *cp; -int order; +u32 lastp, goalp; +int dir, order; + + cmd->scsi_done = done; +memset (ucp,0 ,sizeof (*ucp)); + +/* +* Shorten our settle_time if needed for +* this command not to time out. +*/ +if (np->s.settle_time_valid && cmd->timeout_per_command) { +unsigned long tlimit = jiffies + cmd->timeout_per_command; + tlimit -=SYM_CONF_TIMER_INTERVAL *2 ; +if (time_after (np->s.settle_time, tlimit)) { + np->s.settle_time = tlimit; + } + } + +if (np->s.settle_time_valid) +return SCSI_MLQUEUE_HOST_BUSY ;/* * Minimal checkings, so that we will not
@@ -436,38 +459,13 @@*/ cp =sym_get_ccb (np, cmd, order);if (!cp) -return 1 ;/* Means resource shortage */ -sym_queue_scsiio (np, cmd, cp); -return 0 ; -} +return SCSI_MLQUEUE_HOST_BUSY ; +sym_init_scsiio (np, cmd, cp); -/* -* Setup buffers and pointers that address the CDB. -*/ -static inline int sym_setup_cdb (struct sym_hcb *np,struct scsi_cmnd *cmd,struct sym_ccb *cp) -{memcpy (cp->cdb_buf, cmd->cmnd, cmd->cmd_len); - cp->phys.cmd.addr =CCB_BA (cp, cdb_buf[0 ]); cp->phys.cmd.size =cpu_to_scr (cmd->cmd_len); -return 0 ; -} - -/* -* Setup pointers that address the data and start the I/O. -*/ -int sym_setup_data_and_start (struct sym_hcb *np,struct scsi_cmnd *cmd,struct sym_ccb *cp) -{ -u32 lastp, goalp; -int dir; - -/* -* Build the CDB. -*/ -if (sym_setup_cdb (np, cmd, cp)) - goto out_abort; -/* * No direction means no data. */
@@ -615,41 +613,6 @@ }/* -* queuecommand method. Entered with the host adapter lock held and -* interrupts disabled. -*/ -static int sym53c8xx_queue_command (struct scsi_cmnd *cmd, -void (*done)(struct scsi_cmnd *)) -{ -struct sym_hcb *np =SYM_SOFTC_PTR (cmd); -struct sym_ucmd *ucp =SYM_UCMD_PTR (cmd); -int sts =0 ; - - cmd->scsi_done = done; -memset (ucp,0 ,sizeof (*ucp)); - -/* -* Shorten our settle_time if needed for -* this command not to time out. -*/ -if (np->s.settle_time_valid && cmd->timeout_per_command) { -unsigned long tlimit = jiffies + cmd->timeout_per_command; - tlimit -=SYM_CONF_TIMER_INTERVAL *2 ; -if (time_after (np->s.settle_time, tlimit)) { - np->s.settle_time = tlimit; - } - } - -if (np->s.settle_time_valid) -return SCSI_MLQUEUE_HOST_BUSY ; - - sts =sym_queue_command (np, cmd); -if (sts) -return SCSI_MLQUEUE_HOST_BUSY ; -return 0 ; -} - -/* * Linux entry point of the interrupt handler. */ static irqreturn_t sym53c8xx_intr (int irq,void *dev_id)
drivers/scsi/sym53c8xx_2/sym_glue.h +0 -1
@@ -264,7 +264,6 @@ #define sym_print_addr(cmd, arg...) dev_info(&cmd->device->sdev_gendev , ## arg)void sym_xpt_async_bus_reset (struct sym_hcb *np);void sym_xpt_async_sent_bdr (struct sym_hcb *np,int target); -int sym_setup_data_and_start (struct sym_hcb *np,struct scsi_cmnd *csio,struct sym_ccb *cp);void sym_log_bus_error (struct sym_hcb *np);#endif /* SYM_GLUE_H */
drivers/scsi/sym53c8xx_2/sym_hipd.c +1 -7
@@ -5030,7 +5030,7 @@/* * Queue a SCSI IO to the controller. */ -int sym_queue_scsiio (struct sym_hcb *np,struct scsi_cmnd *cmd,struct sym_ccb *cp) +void sym_init_scsiio (struct sym_hcb *np,struct scsi_cmnd *cmd,struct sym_ccb *cp) {struct scsi_device *sdev = cmd->device;struct sym_tcb *tp;
@@ -5155,12 +5155,6 @@*/ cp->ext_sg =-1 ; cp->ext_ofs =0 ; - -/* -* Build the CDB and DATA descriptor block -* and start the IO. -*/ -return sym_setup_data_and_start (np, cmd, cp); }/*
drivers/scsi/sym53c8xx_2/sym_hipd.h +1 -1
@@ -1058,7 +1058,7 @@struct sym_ccb *sym_get_ccb (struct sym_hcb *np,struct scsi_cmnd *cmd,u_char tag_order);void sym_free_ccb (struct sym_hcb *np,struct sym_ccb *cp);struct sym_lcb *sym_alloc_lcb (struct sym_hcb *np,u_char tn,u_char ln); -int sym_queue_scsiio (struct sym_hcb *np,struct scsi_cmnd *csio,struct sym_ccb *cp); +void sym_init_scsiio (struct sym_hcb *np,struct scsi_cmnd *csio,struct sym_ccb *cp);int sym_abort_scsiio (struct sym_hcb *np,struct scsi_cmnd *ccb,int timed_out);int sym_reset_scsi_target (struct sym_hcb *np,int target);void sym_hcb_free (struct sym_hcb *np);