diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-11-13 23:35:54 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-11-13 23:35:54 -0500 |
commit | d83763f4a6adb2f417c3288ee903982985ae949c (patch) | |
tree | 610a7cfd32935ce4b555dc832c26ddeb13dcd003 /drivers/scsi/bnx2fc/bnx2fc_io.c | |
parent | 9aa3d651a9199103eb6451aeb0ac1b66a6d770a6 (diff) | |
parent | 0a5149ba02bdf75281b8bc94cf6dfa94c527fa6f (diff) |
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull final round of SCSI updates from James Bottomley:
"Sorry for the delay in this patch which was mostly caused by getting
the merger of the mpt2/mpt3sas driver, which was seen as an essential
item of maintenance work to do before the drivers diverge too much.
Unfortunately, this caused a compile failure (detected by linux-next),
which then had to be fixed up and incubated.
In addition to the mpt2/3sas rework, there are updates from pm80xx,
lpfc, bnx2fc, hpsa, ipr, aacraid, megaraid_sas, storvsc and ufs plus
an assortment of changes including some year 2038 issues, a fix for a
remove before detach issue in some drivers and a couple of other minor
issues"
* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (141 commits)
mpt3sas: fix inline markers on non inline function declarations
sd: Clear PS bit before Mode Select.
ibmvscsi: set max_lun to 32
ibmvscsi: display default value for max_id, max_lun and max_channel.
mptfusion: don't allow negative bytes in kbuf_alloc_2_sgl()
scsi: pmcraid: replace struct timeval with ktime_get_real_seconds()
mvumi: 64bit value for seconds_since1970
be2iscsi: Fix bogus WARN_ON length check
scsi_scan: don't dump trace when scsi_prep_async_scan() is called twice
mpt3sas: Bump mpt3sas driver version to 09.102.00.00
mpt3sas: Single driver module which supports both SAS 2.0 & SAS 3.0 HBAs
mpt2sas, mpt3sas: Update the driver versions
mpt3sas: setpci reset kernel oops fix
mpt3sas: Added OEM Gen2 PnP ID branding names
mpt3sas: Refcount fw_events and fix unsafe list usage
mpt3sas: Refcount sas_device objects and fix unsafe list usage
mpt3sas: sysfs attribute to report Backup Rail Monitor Status
mpt3sas: Ported WarpDrive product SSS6200 support
mpt3sas: fix for driver fails EEH, recovery from injected pci bus error
mpt3sas: Manage MSI-X vectors according to HBA device type
...
Diffstat (limited to 'drivers/scsi/bnx2fc/bnx2fc_io.c')
-rw-r--r-- | drivers/scsi/bnx2fc/bnx2fc_io.c | 106 |
1 files changed, 24 insertions, 82 deletions
diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c index 9ecca8504f60..0002caf687dd 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_io.c +++ b/drivers/scsi/bnx2fc/bnx2fc_io.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* bnx2fc_io.c: QLogic NetXtreme II Linux FCoE offload driver. | 1 | /* bnx2fc_io.c: QLogic Linux FCoE offload driver. |
2 | * IO manager and SCSI IO processing. | 2 | * IO manager and SCSI IO processing. |
3 | * | 3 | * |
4 | * Copyright (c) 2008 - 2013 Broadcom Corporation | 4 | * Copyright (c) 2008-2013 Broadcom Corporation |
5 | * Copyright (c) 2014, QLogic Corporation | 5 | * Copyright (c) 2014-2015 QLogic Corporation |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License as published by |
@@ -40,11 +40,8 @@ static void bnx2fc_cmd_timeout(struct work_struct *work) | |||
40 | { | 40 | { |
41 | struct bnx2fc_cmd *io_req = container_of(work, struct bnx2fc_cmd, | 41 | struct bnx2fc_cmd *io_req = container_of(work, struct bnx2fc_cmd, |
42 | timeout_work.work); | 42 | timeout_work.work); |
43 | struct fc_lport *lport; | ||
44 | struct fc_rport_priv *rdata; | ||
45 | u8 cmd_type = io_req->cmd_type; | 43 | u8 cmd_type = io_req->cmd_type; |
46 | struct bnx2fc_rport *tgt = io_req->tgt; | 44 | struct bnx2fc_rport *tgt = io_req->tgt; |
47 | int logo_issued; | ||
48 | int rc; | 45 | int rc; |
49 | 46 | ||
50 | BNX2FC_IO_DBG(io_req, "cmd_timeout, cmd_type = %d," | 47 | BNX2FC_IO_DBG(io_req, "cmd_timeout, cmd_type = %d," |
@@ -80,25 +77,14 @@ static void bnx2fc_cmd_timeout(struct work_struct *work) | |||
80 | io_req->refcount.refcount.counter); | 77 | io_req->refcount.refcount.counter); |
81 | if (!(test_and_set_bit(BNX2FC_FLAG_ABTS_DONE, | 78 | if (!(test_and_set_bit(BNX2FC_FLAG_ABTS_DONE, |
82 | &io_req->req_flags))) { | 79 | &io_req->req_flags))) { |
83 | 80 | /* | |
84 | lport = io_req->port->lport; | 81 | * Cleanup and return original command to |
85 | rdata = io_req->tgt->rdata; | 82 | * mid-layer. |
86 | logo_issued = test_and_set_bit( | 83 | */ |
87 | BNX2FC_FLAG_EXPL_LOGO, | 84 | bnx2fc_initiate_cleanup(io_req); |
88 | &tgt->flags); | ||
89 | kref_put(&io_req->refcount, bnx2fc_cmd_release); | 85 | kref_put(&io_req->refcount, bnx2fc_cmd_release); |
90 | spin_unlock_bh(&tgt->tgt_lock); | 86 | spin_unlock_bh(&tgt->tgt_lock); |
91 | 87 | ||
92 | /* Explicitly logo the target */ | ||
93 | if (!logo_issued) { | ||
94 | BNX2FC_IO_DBG(io_req, "Explicit " | ||
95 | "logo - tgt flags = 0x%lx\n", | ||
96 | tgt->flags); | ||
97 | |||
98 | mutex_lock(&lport->disc.disc_mutex); | ||
99 | lport->tt.rport_logoff(rdata); | ||
100 | mutex_unlock(&lport->disc.disc_mutex); | ||
101 | } | ||
102 | return; | 88 | return; |
103 | } | 89 | } |
104 | } else { | 90 | } else { |
@@ -116,28 +102,10 @@ static void bnx2fc_cmd_timeout(struct work_struct *work) | |||
116 | rc = bnx2fc_initiate_abts(io_req); | 102 | rc = bnx2fc_initiate_abts(io_req); |
117 | if (rc == SUCCESS) | 103 | if (rc == SUCCESS) |
118 | goto done; | 104 | goto done; |
119 | /* | 105 | |
120 | * Explicitly logo the target if | ||
121 | * abts initiation fails | ||
122 | */ | ||
123 | lport = io_req->port->lport; | ||
124 | rdata = io_req->tgt->rdata; | ||
125 | logo_issued = test_and_set_bit( | ||
126 | BNX2FC_FLAG_EXPL_LOGO, | ||
127 | &tgt->flags); | ||
128 | kref_put(&io_req->refcount, bnx2fc_cmd_release); | 106 | kref_put(&io_req->refcount, bnx2fc_cmd_release); |
129 | spin_unlock_bh(&tgt->tgt_lock); | 107 | spin_unlock_bh(&tgt->tgt_lock); |
130 | 108 | ||
131 | if (!logo_issued) { | ||
132 | BNX2FC_IO_DBG(io_req, "Explicit " | ||
133 | "logo - tgt flags = 0x%lx\n", | ||
134 | tgt->flags); | ||
135 | |||
136 | |||
137 | mutex_lock(&lport->disc.disc_mutex); | ||
138 | lport->tt.rport_logoff(rdata); | ||
139 | mutex_unlock(&lport->disc.disc_mutex); | ||
140 | } | ||
141 | return; | 109 | return; |
142 | } else { | 110 | } else { |
143 | BNX2FC_IO_DBG(io_req, "IO already in " | 111 | BNX2FC_IO_DBG(io_req, "IO already in " |
@@ -152,22 +120,9 @@ static void bnx2fc_cmd_timeout(struct work_struct *work) | |||
152 | 120 | ||
153 | if (!test_and_set_bit(BNX2FC_FLAG_ABTS_DONE, | 121 | if (!test_and_set_bit(BNX2FC_FLAG_ABTS_DONE, |
154 | &io_req->req_flags)) { | 122 | &io_req->req_flags)) { |
155 | lport = io_req->port->lport; | ||
156 | rdata = io_req->tgt->rdata; | ||
157 | logo_issued = test_and_set_bit( | ||
158 | BNX2FC_FLAG_EXPL_LOGO, | ||
159 | &tgt->flags); | ||
160 | kref_put(&io_req->refcount, bnx2fc_cmd_release); | 123 | kref_put(&io_req->refcount, bnx2fc_cmd_release); |
161 | spin_unlock_bh(&tgt->tgt_lock); | 124 | spin_unlock_bh(&tgt->tgt_lock); |
162 | 125 | ||
163 | /* Explicitly logo the target */ | ||
164 | if (!logo_issued) { | ||
165 | BNX2FC_IO_DBG(io_req, "Explicitly logo" | ||
166 | "(els)\n"); | ||
167 | mutex_lock(&lport->disc.disc_mutex); | ||
168 | lport->tt.rport_logoff(rdata); | ||
169 | mutex_unlock(&lport->disc.disc_mutex); | ||
170 | } | ||
171 | return; | 126 | return; |
172 | } | 127 | } |
173 | } else { | 128 | } else { |
@@ -623,8 +578,12 @@ int bnx2fc_init_mp_req(struct bnx2fc_cmd *io_req) | |||
623 | mp_req = (struct bnx2fc_mp_req *)&(io_req->mp_req); | 578 | mp_req = (struct bnx2fc_mp_req *)&(io_req->mp_req); |
624 | memset(mp_req, 0, sizeof(struct bnx2fc_mp_req)); | 579 | memset(mp_req, 0, sizeof(struct bnx2fc_mp_req)); |
625 | 580 | ||
626 | mp_req->req_len = sizeof(struct fcp_cmnd); | 581 | if (io_req->cmd_type != BNX2FC_ELS) { |
627 | io_req->data_xfer_len = mp_req->req_len; | 582 | mp_req->req_len = sizeof(struct fcp_cmnd); |
583 | io_req->data_xfer_len = mp_req->req_len; | ||
584 | } else | ||
585 | mp_req->req_len = io_req->data_xfer_len; | ||
586 | |||
628 | mp_req->req_buf = dma_alloc_coherent(&hba->pcidev->dev, CNIC_PAGE_SIZE, | 587 | mp_req->req_buf = dma_alloc_coherent(&hba->pcidev->dev, CNIC_PAGE_SIZE, |
629 | &mp_req->req_buf_dma, | 588 | &mp_req->req_buf_dma, |
630 | GFP_ATOMIC); | 589 | GFP_ATOMIC); |
@@ -1108,18 +1067,11 @@ int bnx2fc_eh_device_reset(struct scsi_cmnd *sc_cmd) | |||
1108 | return bnx2fc_initiate_tmf(sc_cmd, FCP_TMF_LUN_RESET); | 1067 | return bnx2fc_initiate_tmf(sc_cmd, FCP_TMF_LUN_RESET); |
1109 | } | 1068 | } |
1110 | 1069 | ||
1111 | int bnx2fc_expl_logo(struct fc_lport *lport, struct bnx2fc_cmd *io_req) | 1070 | int bnx2fc_abts_cleanup(struct bnx2fc_cmd *io_req) |
1112 | { | 1071 | { |
1113 | struct bnx2fc_rport *tgt = io_req->tgt; | 1072 | struct bnx2fc_rport *tgt = io_req->tgt; |
1114 | struct fc_rport_priv *rdata = tgt->rdata; | ||
1115 | int logo_issued; | ||
1116 | int rc = SUCCESS; | 1073 | int rc = SUCCESS; |
1117 | int wait_cnt = 0; | ||
1118 | 1074 | ||
1119 | BNX2FC_IO_DBG(io_req, "Expl logo - tgt flags = 0x%lx\n", | ||
1120 | tgt->flags); | ||
1121 | logo_issued = test_and_set_bit(BNX2FC_FLAG_EXPL_LOGO, | ||
1122 | &tgt->flags); | ||
1123 | io_req->wait_for_comp = 1; | 1075 | io_req->wait_for_comp = 1; |
1124 | bnx2fc_initiate_cleanup(io_req); | 1076 | bnx2fc_initiate_cleanup(io_req); |
1125 | 1077 | ||
@@ -1132,21 +1084,8 @@ int bnx2fc_expl_logo(struct fc_lport *lport, struct bnx2fc_cmd *io_req) | |||
1132 | * release the reference taken in eh_abort to allow the | 1084 | * release the reference taken in eh_abort to allow the |
1133 | * target to re-login after flushing IOs | 1085 | * target to re-login after flushing IOs |
1134 | */ | 1086 | */ |
1135 | kref_put(&io_req->refcount, bnx2fc_cmd_release); | 1087 | kref_put(&io_req->refcount, bnx2fc_cmd_release); |
1136 | 1088 | ||
1137 | if (!logo_issued) { | ||
1138 | clear_bit(BNX2FC_FLAG_SESSION_READY, &tgt->flags); | ||
1139 | mutex_lock(&lport->disc.disc_mutex); | ||
1140 | lport->tt.rport_logoff(rdata); | ||
1141 | mutex_unlock(&lport->disc.disc_mutex); | ||
1142 | do { | ||
1143 | msleep(BNX2FC_RELOGIN_WAIT_TIME); | ||
1144 | if (wait_cnt++ > BNX2FC_RELOGIN_WAIT_CNT) { | ||
1145 | rc = FAILED; | ||
1146 | break; | ||
1147 | } | ||
1148 | } while (!test_bit(BNX2FC_FLAG_SESSION_READY, &tgt->flags)); | ||
1149 | } | ||
1150 | spin_lock_bh(&tgt->tgt_lock); | 1089 | spin_lock_bh(&tgt->tgt_lock); |
1151 | return rc; | 1090 | return rc; |
1152 | } | 1091 | } |
@@ -1248,7 +1187,7 @@ int bnx2fc_eh_abort(struct scsi_cmnd *sc_cmd) | |||
1248 | if (cancel_delayed_work(&io_req->timeout_work)) | 1187 | if (cancel_delayed_work(&io_req->timeout_work)) |
1249 | kref_put(&io_req->refcount, | 1188 | kref_put(&io_req->refcount, |
1250 | bnx2fc_cmd_release); /* drop timer hold */ | 1189 | bnx2fc_cmd_release); /* drop timer hold */ |
1251 | rc = bnx2fc_expl_logo(lport, io_req); | 1190 | rc = bnx2fc_abts_cleanup(io_req); |
1252 | /* This only occurs when an task abort was requested while ABTS | 1191 | /* This only occurs when an task abort was requested while ABTS |
1253 | is in progress. Setting the IO_CLEANUP flag will skip the | 1192 | is in progress. Setting the IO_CLEANUP flag will skip the |
1254 | RRQ process in the case when the fw generated SCSI_CMD cmpl | 1193 | RRQ process in the case when the fw generated SCSI_CMD cmpl |
@@ -1287,7 +1226,7 @@ int bnx2fc_eh_abort(struct scsi_cmnd *sc_cmd) | |||
1287 | /* Let the scsi-ml try to recover this command */ | 1226 | /* Let the scsi-ml try to recover this command */ |
1288 | printk(KERN_ERR PFX "abort failed, xid = 0x%x\n", | 1227 | printk(KERN_ERR PFX "abort failed, xid = 0x%x\n", |
1289 | io_req->xid); | 1228 | io_req->xid); |
1290 | rc = bnx2fc_expl_logo(lport, io_req); | 1229 | rc = bnx2fc_abts_cleanup(io_req); |
1291 | goto out; | 1230 | goto out; |
1292 | } else { | 1231 | } else { |
1293 | /* | 1232 | /* |
@@ -1755,7 +1694,10 @@ static void bnx2fc_parse_fcp_rsp(struct bnx2fc_cmd *io_req, | |||
1755 | int fcp_rsp_len = 0; | 1694 | int fcp_rsp_len = 0; |
1756 | 1695 | ||
1757 | io_req->fcp_status = FC_GOOD; | 1696 | io_req->fcp_status = FC_GOOD; |
1758 | io_req->fcp_resid = fcp_rsp->fcp_resid; | 1697 | io_req->fcp_resid = 0; |
1698 | if (rsp_flags & (FCOE_FCP_RSP_FLAGS_FCP_RESID_OVER | | ||
1699 | FCOE_FCP_RSP_FLAGS_FCP_RESID_UNDER)) | ||
1700 | io_req->fcp_resid = fcp_rsp->fcp_resid; | ||
1759 | 1701 | ||
1760 | io_req->scsi_comp_flags = rsp_flags; | 1702 | io_req->scsi_comp_flags = rsp_flags; |
1761 | CMD_SCSI_STATUS(sc_cmd) = io_req->cdb_status = | 1703 | CMD_SCSI_STATUS(sc_cmd) = io_req->cdb_status = |