aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_fsf.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/scsi/zfcp_fsf.c')
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c39
1 files changed, 14 insertions, 25 deletions
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 1b25158c50f0..cc69db3b71e7 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -12,6 +12,9 @@
12#include <linux/blktrace_api.h> 12#include <linux/blktrace_api.h>
13#include "zfcp_ext.h" 13#include "zfcp_ext.h"
14 14
15#define ZFCP_REQ_AUTO_CLEANUP 0x00000002
16#define ZFCP_REQ_NO_QTCB 0x00000008
17
15static void zfcp_fsf_request_timeout_handler(unsigned long data) 18static void zfcp_fsf_request_timeout_handler(unsigned long data)
16{ 19{
17 struct zfcp_adapter *adapter = (struct zfcp_adapter *) data; 20 struct zfcp_adapter *adapter = (struct zfcp_adapter *) data;
@@ -913,27 +916,22 @@ static void zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *req)
913/** 916/**
914 * zfcp_fsf_abort_fcp_command - abort running SCSI command 917 * zfcp_fsf_abort_fcp_command - abort running SCSI command
915 * @old_req_id: unsigned long 918 * @old_req_id: unsigned long
916 * @adapter: pointer to struct zfcp_adapter
917 * @unit: pointer to struct zfcp_unit 919 * @unit: pointer to struct zfcp_unit
918 * @req_flags: integer specifying the request flags
919 * Returns: pointer to struct zfcp_fsf_req 920 * Returns: pointer to struct zfcp_fsf_req
920 *
921 * FIXME(design): should be watched by a timeout !!!
922 */ 921 */
923 922
924struct zfcp_fsf_req *zfcp_fsf_abort_fcp_command(unsigned long old_req_id, 923struct zfcp_fsf_req *zfcp_fsf_abort_fcp_command(unsigned long old_req_id,
925 struct zfcp_adapter *adapter, 924 struct zfcp_unit *unit)
926 struct zfcp_unit *unit,
927 int req_flags)
928{ 925{
929 struct qdio_buffer_element *sbale; 926 struct qdio_buffer_element *sbale;
930 struct zfcp_fsf_req *req = NULL; 927 struct zfcp_fsf_req *req = NULL;
928 struct zfcp_adapter *adapter = unit->port->adapter;
931 929
932 spin_lock_bh(&adapter->req_q_lock); 930 spin_lock_bh(&adapter->req_q_lock);
933 if (zfcp_fsf_req_sbal_get(adapter)) 931 if (zfcp_fsf_req_sbal_get(adapter))
934 goto out; 932 goto out;
935 req = zfcp_fsf_req_create(adapter, FSF_QTCB_ABORT_FCP_CMND, 933 req = zfcp_fsf_req_create(adapter, FSF_QTCB_ABORT_FCP_CMND,
936 req_flags, adapter->pool.fsf_req_abort); 934 0, adapter->pool.fsf_req_abort);
937 if (IS_ERR(req)) { 935 if (IS_ERR(req)) {
938 req = NULL; 936 req = NULL;
939 goto out; 937 goto out;
@@ -2309,21 +2307,17 @@ static void zfcp_set_fcp_dl(struct fcp_cmnd_iu *fcp_cmd, u32 fcp_dl)
2309 2307
2310/** 2308/**
2311 * zfcp_fsf_send_fcp_command_task - initiate an FCP command (for a SCSI command) 2309 * zfcp_fsf_send_fcp_command_task - initiate an FCP command (for a SCSI command)
2312 * @adapter: adapter where scsi command is issued
2313 * @unit: unit where command is sent to 2310 * @unit: unit where command is sent to
2314 * @scsi_cmnd: scsi command to be sent 2311 * @scsi_cmnd: scsi command to be sent
2315 * @timer: timer to be started when request is initiated
2316 * @req_flags: flags for fsf_request
2317 */ 2312 */
2318int zfcp_fsf_send_fcp_command_task(struct zfcp_adapter *adapter, 2313int zfcp_fsf_send_fcp_command_task(struct zfcp_unit *unit,
2319 struct zfcp_unit *unit, 2314 struct scsi_cmnd *scsi_cmnd)
2320 struct scsi_cmnd *scsi_cmnd,
2321 int use_timer, int req_flags)
2322{ 2315{
2323 struct zfcp_fsf_req *req; 2316 struct zfcp_fsf_req *req;
2324 struct fcp_cmnd_iu *fcp_cmnd_iu; 2317 struct fcp_cmnd_iu *fcp_cmnd_iu;
2325 unsigned int sbtype; 2318 unsigned int sbtype;
2326 int real_bytes, retval = -EIO; 2319 int real_bytes, retval = -EIO;
2320 struct zfcp_adapter *adapter = unit->port->adapter;
2327 2321
2328 if (unlikely(!(atomic_read(&unit->status) & 2322 if (unlikely(!(atomic_read(&unit->status) &
2329 ZFCP_STATUS_COMMON_UNBLOCKED))) 2323 ZFCP_STATUS_COMMON_UNBLOCKED)))
@@ -2332,7 +2326,8 @@ int zfcp_fsf_send_fcp_command_task(struct zfcp_adapter *adapter,
2332 spin_lock(&adapter->req_q_lock); 2326 spin_lock(&adapter->req_q_lock);
2333 if (!zfcp_fsf_sbal_available(adapter)) 2327 if (!zfcp_fsf_sbal_available(adapter))
2334 goto out; 2328 goto out;
2335 req = zfcp_fsf_req_create(adapter, FSF_QTCB_FCP_CMND, req_flags, 2329 req = zfcp_fsf_req_create(adapter, FSF_QTCB_FCP_CMND,
2330 ZFCP_REQ_AUTO_CLEANUP,
2336 adapter->pool.fsf_req_scsi); 2331 adapter->pool.fsf_req_scsi);
2337 if (IS_ERR(req)) { 2332 if (IS_ERR(req)) {
2338 retval = PTR_ERR(req); 2333 retval = PTR_ERR(req);
@@ -2414,9 +2409,6 @@ int zfcp_fsf_send_fcp_command_task(struct zfcp_adapter *adapter,
2414 2409
2415 zfcp_set_fcp_dl(fcp_cmnd_iu, real_bytes); 2410 zfcp_set_fcp_dl(fcp_cmnd_iu, real_bytes);
2416 2411
2417 if (use_timer)
2418 zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT);
2419
2420 retval = zfcp_fsf_req_send(req); 2412 retval = zfcp_fsf_req_send(req);
2421 if (unlikely(retval)) 2413 if (unlikely(retval))
2422 goto failed_scsi_cmnd; 2414 goto failed_scsi_cmnd;
@@ -2434,19 +2426,16 @@ out:
2434 2426
2435/** 2427/**
2436 * zfcp_fsf_send_fcp_ctm - send SCSI task management command 2428 * zfcp_fsf_send_fcp_ctm - send SCSI task management command
2437 * @adapter: pointer to struct zfcp-adapter
2438 * @unit: pointer to struct zfcp_unit 2429 * @unit: pointer to struct zfcp_unit
2439 * @tm_flags: unsigned byte for task management flags 2430 * @tm_flags: unsigned byte for task management flags
2440 * @req_flags: int request flags
2441 * Returns: on success pointer to struct fsf_req, NULL otherwise 2431 * Returns: on success pointer to struct fsf_req, NULL otherwise
2442 */ 2432 */
2443struct zfcp_fsf_req *zfcp_fsf_send_fcp_ctm(struct zfcp_adapter *adapter, 2433struct zfcp_fsf_req *zfcp_fsf_send_fcp_ctm(struct zfcp_unit *unit, u8 tm_flags)
2444 struct zfcp_unit *unit,
2445 u8 tm_flags, int req_flags)
2446{ 2434{
2447 struct qdio_buffer_element *sbale; 2435 struct qdio_buffer_element *sbale;
2448 struct zfcp_fsf_req *req = NULL; 2436 struct zfcp_fsf_req *req = NULL;
2449 struct fcp_cmnd_iu *fcp_cmnd_iu; 2437 struct fcp_cmnd_iu *fcp_cmnd_iu;
2438 struct zfcp_adapter *adapter = unit->port->adapter;
2450 2439
2451 if (unlikely(!(atomic_read(&unit->status) & 2440 if (unlikely(!(atomic_read(&unit->status) &
2452 ZFCP_STATUS_COMMON_UNBLOCKED))) 2441 ZFCP_STATUS_COMMON_UNBLOCKED)))
@@ -2455,7 +2444,7 @@ struct zfcp_fsf_req *zfcp_fsf_send_fcp_ctm(struct zfcp_adapter *adapter,
2455 spin_lock_bh(&adapter->req_q_lock); 2444 spin_lock_bh(&adapter->req_q_lock);
2456 if (zfcp_fsf_req_sbal_get(adapter)) 2445 if (zfcp_fsf_req_sbal_get(adapter))
2457 goto out; 2446 goto out;
2458 req = zfcp_fsf_req_create(adapter, FSF_QTCB_FCP_CMND, req_flags, 2447 req = zfcp_fsf_req_create(adapter, FSF_QTCB_FCP_CMND, 0,
2459 adapter->pool.fsf_req_scsi); 2448 adapter->pool.fsf_req_scsi);
2460 if (IS_ERR(req)) { 2449 if (IS_ERR(req)) {
2461 req = NULL; 2450 req = NULL;