aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libfc
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2010-12-22 12:57:02 -0500
committerJiri Kosina <jkosina@suse.cz>2010-12-22 12:57:02 -0500
commit4b7bd364700d9ac8372eff48832062b936d0793b (patch)
tree0dbf78c95456a0b02d07fcd473281f04a87e266d /drivers/scsi/libfc
parentc0d8768af260e2cbb4bf659ae6094a262c86b085 (diff)
parent90a8a73c06cc32b609a880d48449d7083327e11a (diff)
Merge branch 'master' into for-next
Conflicts: MAINTAINERS arch/arm/mach-omap2/pm24xx.c drivers/scsi/bfa/bfa_fcpim.c Needed to update to apply fixes for which the old branch was too outdated.
Diffstat (limited to 'drivers/scsi/libfc')
-rw-r--r--drivers/scsi/libfc/fc_disc.c5
-rw-r--r--drivers/scsi/libfc/fc_fcp.c28
-rw-r--r--drivers/scsi/libfc/fc_lport.c12
-rw-r--r--drivers/scsi/libfc/fc_rport.c4
4 files changed, 19 insertions, 30 deletions
diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c
index 32f67c4b03fc..911b2736cafa 100644
--- a/drivers/scsi/libfc/fc_disc.c
+++ b/drivers/scsi/libfc/fc_disc.c
@@ -684,10 +684,9 @@ void fc_disc_stop(struct fc_lport *lport)
684{ 684{
685 struct fc_disc *disc = &lport->disc; 685 struct fc_disc *disc = &lport->disc;
686 686
687 if (disc) { 687 if (disc->pending)
688 cancel_delayed_work_sync(&disc->disc_work); 688 cancel_delayed_work_sync(&disc->disc_work);
689 fc_disc_stop_rports(disc); 689 fc_disc_stop_rports(disc);
690 }
691} 690}
692 691
693/** 692/**
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index 54a6ec8e131d..071cf082d342 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -58,8 +58,7 @@ struct kmem_cache *scsi_pkt_cachep;
58#define FC_SRB_WRITE (1 << 0) 58#define FC_SRB_WRITE (1 << 0)
59 59
60/* 60/*
61 * The SCp.ptr should be tested and set under the host lock. NULL indicates 61 * The SCp.ptr should be tested and set under the scsi_pkt_queue lock
62 * that the command has been retruned to the scsi layer.
63 */ 62 */
64#define CMD_SP(Cmnd) ((struct fc_fcp_pkt *)(Cmnd)->SCp.ptr) 63#define CMD_SP(Cmnd) ((struct fc_fcp_pkt *)(Cmnd)->SCp.ptr)
65#define CMD_ENTRY_STATUS(Cmnd) ((Cmnd)->SCp.have_data_in) 64#define CMD_ENTRY_STATUS(Cmnd) ((Cmnd)->SCp.have_data_in)
@@ -1754,7 +1753,7 @@ static inline int fc_fcp_lport_queue_ready(struct fc_lport *lport)
1754 * This is the i/o strategy routine, called by the SCSI layer. This routine 1753 * This is the i/o strategy routine, called by the SCSI layer. This routine
1755 * is called with the host_lock held. 1754 * is called with the host_lock held.
1756 */ 1755 */
1757int fc_queuecommand(struct scsi_cmnd *sc_cmd, void (*done)(struct scsi_cmnd *)) 1756static int fc_queuecommand_lck(struct scsi_cmnd *sc_cmd, void (*done)(struct scsi_cmnd *))
1758{ 1757{
1759 struct fc_lport *lport; 1758 struct fc_lport *lport;
1760 struct fc_rport *rport = starget_to_rport(scsi_target(sc_cmd->device)); 1759 struct fc_rport *rport = starget_to_rport(scsi_target(sc_cmd->device));
@@ -1852,6 +1851,8 @@ out:
1852 spin_lock_irq(lport->host->host_lock); 1851 spin_lock_irq(lport->host->host_lock);
1853 return rc; 1852 return rc;
1854} 1853}
1854
1855DEF_SCSI_QCMD(fc_queuecommand)
1855EXPORT_SYMBOL(fc_queuecommand); 1856EXPORT_SYMBOL(fc_queuecommand);
1856 1857
1857/** 1858/**
@@ -1880,8 +1881,6 @@ static void fc_io_compl(struct fc_fcp_pkt *fsp)
1880 1881
1881 lport = fsp->lp; 1882 lport = fsp->lp;
1882 si = fc_get_scsi_internal(lport); 1883 si = fc_get_scsi_internal(lport);
1883 if (!fsp->cmd)
1884 return;
1885 1884
1886 /* 1885 /*
1887 * if can_queue ramp down is done then try can_queue ramp up 1886 * if can_queue ramp down is done then try can_queue ramp up
@@ -1891,11 +1890,6 @@ static void fc_io_compl(struct fc_fcp_pkt *fsp)
1891 fc_fcp_can_queue_ramp_up(lport); 1890 fc_fcp_can_queue_ramp_up(lport);
1892 1891
1893 sc_cmd = fsp->cmd; 1892 sc_cmd = fsp->cmd;
1894 fsp->cmd = NULL;
1895
1896 if (!sc_cmd->SCp.ptr)
1897 return;
1898
1899 CMD_SCSI_STATUS(sc_cmd) = fsp->cdb_status; 1893 CMD_SCSI_STATUS(sc_cmd) = fsp->cdb_status;
1900 switch (fsp->status_code) { 1894 switch (fsp->status_code) {
1901 case FC_COMPLETE: 1895 case FC_COMPLETE:
@@ -1971,15 +1965,13 @@ static void fc_io_compl(struct fc_fcp_pkt *fsp)
1971 break; 1965 break;
1972 } 1966 }
1973 1967
1974 if (lport->state != LPORT_ST_READY && fsp->status_code != FC_COMPLETE) { 1968 if (lport->state != LPORT_ST_READY && fsp->status_code != FC_COMPLETE)
1975 sc_cmd->result = (DID_REQUEUE << 16); 1969 sc_cmd->result = (DID_TRANSPORT_DISRUPTED << 16);
1976 FC_FCP_DBG(fsp, "Returning DID_REQUEUE to scsi-ml\n");
1977 }
1978 1970
1979 spin_lock_irqsave(&si->scsi_queue_lock, flags); 1971 spin_lock_irqsave(&si->scsi_queue_lock, flags);
1980 list_del(&fsp->list); 1972 list_del(&fsp->list);
1981 spin_unlock_irqrestore(&si->scsi_queue_lock, flags);
1982 sc_cmd->SCp.ptr = NULL; 1973 sc_cmd->SCp.ptr = NULL;
1974 spin_unlock_irqrestore(&si->scsi_queue_lock, flags);
1983 sc_cmd->scsi_done(sc_cmd); 1975 sc_cmd->scsi_done(sc_cmd);
1984 1976
1985 /* release ref from initial allocation in queue command */ 1977 /* release ref from initial allocation in queue command */
@@ -1997,6 +1989,7 @@ int fc_eh_abort(struct scsi_cmnd *sc_cmd)
1997{ 1989{
1998 struct fc_fcp_pkt *fsp; 1990 struct fc_fcp_pkt *fsp;
1999 struct fc_lport *lport; 1991 struct fc_lport *lport;
1992 struct fc_fcp_internal *si;
2000 int rc = FAILED; 1993 int rc = FAILED;
2001 unsigned long flags; 1994 unsigned long flags;
2002 1995
@@ -2006,7 +1999,8 @@ int fc_eh_abort(struct scsi_cmnd *sc_cmd)
2006 else if (!lport->link_up) 1999 else if (!lport->link_up)
2007 return rc; 2000 return rc;
2008 2001
2009 spin_lock_irqsave(lport->host->host_lock, flags); 2002 si = fc_get_scsi_internal(lport);
2003 spin_lock_irqsave(&si->scsi_queue_lock, flags);
2010 fsp = CMD_SP(sc_cmd); 2004 fsp = CMD_SP(sc_cmd);
2011 if (!fsp) { 2005 if (!fsp) {
2012 /* command completed while scsi eh was setting up */ 2006 /* command completed while scsi eh was setting up */
@@ -2015,7 +2009,7 @@ int fc_eh_abort(struct scsi_cmnd *sc_cmd)
2015 } 2009 }
2016 /* grab a ref so the fsp and sc_cmd cannot be relased from under us */ 2010 /* grab a ref so the fsp and sc_cmd cannot be relased from under us */
2017 fc_fcp_pkt_hold(fsp); 2011 fc_fcp_pkt_hold(fsp);
2018 spin_unlock_irqrestore(lport->host->host_lock, flags); 2012 spin_unlock_irqrestore(&si->scsi_queue_lock, flags);
2019 2013
2020 if (fc_fcp_lock_pkt(fsp)) { 2014 if (fc_fcp_lock_pkt(fsp)) {
2021 /* completed while we were waiting for timer to be deleted */ 2015 /* completed while we were waiting for timer to be deleted */
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index d9b6e11b0e88..9be63edbf8fb 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -1447,13 +1447,7 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,
1447 } 1447 }
1448 1448
1449 did = fc_frame_did(fp); 1449 did = fc_frame_did(fp);
1450 1450 if (fc_frame_payload_op(fp) == ELS_LS_ACC && did) {
1451 if (!did) {
1452 FC_LPORT_DBG(lport, "Bad FLOGI response\n");
1453 goto out;
1454 }
1455
1456 if (fc_frame_payload_op(fp) == ELS_LS_ACC) {
1457 flp = fc_frame_payload_get(fp, sizeof(*flp)); 1451 flp = fc_frame_payload_get(fp, sizeof(*flp));
1458 if (flp) { 1452 if (flp) {
1459 mfs = ntohs(flp->fl_csp.sp_bb_data) & 1453 mfs = ntohs(flp->fl_csp.sp_bb_data) &
@@ -1492,8 +1486,10 @@ void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,
1492 fc_lport_enter_dns(lport); 1486 fc_lport_enter_dns(lport);
1493 } 1487 }
1494 } 1488 }
1495 } else 1489 } else {
1490 FC_LPORT_DBG(lport, "FLOGI RJT or bad response\n");
1496 fc_lport_error(lport, fp); 1491 fc_lport_error(lport, fp);
1492 }
1497 1493
1498out: 1494out:
1499 fc_frame_free(fp); 1495 fc_frame_free(fp);
diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
index b9f2286fe0cb..a84ef13ed74a 100644
--- a/drivers/scsi/libfc/fc_rport.c
+++ b/drivers/scsi/libfc/fc_rport.c
@@ -196,9 +196,9 @@ static const char *fc_rport_state(struct fc_rport_priv *rdata)
196void fc_set_rport_loss_tmo(struct fc_rport *rport, u32 timeout) 196void fc_set_rport_loss_tmo(struct fc_rport *rport, u32 timeout)
197{ 197{
198 if (timeout) 198 if (timeout)
199 rport->dev_loss_tmo = timeout + 5; 199 rport->dev_loss_tmo = timeout;
200 else 200 else
201 rport->dev_loss_tmo = 30; 201 rport->dev_loss_tmo = 1;
202} 202}
203EXPORT_SYMBOL(fc_set_rport_loss_tmo); 203EXPORT_SYMBOL(fc_set_rport_loss_tmo);
204 204