From aca663ba18b9060642fa1756b7bf3379434f4de4 Mon Sep 17 00:00:00 2001 From: Mike Christie Date: Mon, 18 Aug 2008 01:10:12 -0500 Subject: [PATCH 21/23] libfc: requeue on fc_fcp_send_cmd failures If fc_fcp_send_cmd fails, we can just have scsi-ml requeue instead of internally looping on the timer. Signed-off-by: Mike Christie --- drivers/scsi/libfc/fc_fcp.c | 24 ++++++++++-------------- 1 files changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c index 95605a1..8acf95b 100644 --- a/drivers/scsi/libfc/fc_fcp.c +++ b/drivers/scsi/libfc/fc_fcp.c @@ -947,10 +947,6 @@ static int fc_fcp_pkt_send(struct fc_lport *lp, struct fc_fcp_pkt *fsp) return rc; } -static void fc_fcp_retry_send_cmd(unsigned long data) -{ - fc_fcp_send_cmd((struct fc_fcp_pkt *)data); -} static int fc_fcp_send_cmd(struct fc_fcp_pkt *fsp) { @@ -959,17 +955,21 @@ static int fc_fcp_send_cmd(struct fc_fcp_pkt *fsp) struct fc_seq *sp; struct fc_rport *rport; struct fc_rport_libfc_priv *rp; + int rc = 0; if (fc_fcp_lock_pkt(fsp)) - return -1; + return 0; if (fsp->state & FC_SRB_COMPL) goto unlock; lp = fsp->lp; fp = fc_frame_alloc(lp, sizeof(fsp->cdb_cmd)); - if (!fp) - goto retry; + if (!fp) { + rc = -1; + goto unlock; + } + memcpy(fc_frame_payload_get(fp, sizeof(fsp->cdb_cmd)), &fsp->cdb_cmd, sizeof(fsp->cdb_cmd)); fc_frame_setup(fp, FC_RCTL_DD_UNSOL_CMD, FC_TYPE_FCP); @@ -985,7 +985,8 @@ static int fc_fcp_send_cmd(struct fc_fcp_pkt *fsp) FC_FC_SEQ_INIT | FC_FC_END_SEQ); if (!sp) { fc_frame_free(fp); - goto retry; + rc = -1; + goto unlock; } fsp->seq_ptr = sp; @@ -995,12 +996,7 @@ static int fc_fcp_send_cmd(struct fc_fcp_pkt *fsp) FC_SCSI_REC_TOV : FC_SCSI_ER_TIMEOUT); unlock: fc_fcp_unlock_pkt(fsp); - return 0; -retry: - setup_timer(&fsp->timer, fc_fcp_retry_send_cmd, (unsigned long)fsp); - fc_fcp_timer_set(fsp, FC_SCSI_REC_TOV); - fc_fcp_unlock_pkt(fsp); - return 0; + return rc; } /* -- 1.5.5.1