Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[safe/jmp/linux-2.6] / drivers / s390 / scsi / zfcp_fsf.c
index fb580b1..b3b1d2f 100644 (file)
@@ -3,17 +3,20 @@
  *
  * Implementation of FSF commands.
  *
- * Copyright IBM Corporation 2002, 2009
+ * Copyright IBM Corporation 2002, 2010
  */
 
 #define KMSG_COMPONENT "zfcp"
 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
 
 #include <linux/blktrace_api.h>
+#include <linux/slab.h>
 #include <scsi/fc/fc_els.h>
 #include "zfcp_ext.h"
 #include "zfcp_fc.h"
 #include "zfcp_dbf.h"
+#include "zfcp_qdio.h"
+#include "zfcp_reqlist.h"
 
 static void zfcp_fsf_request_timeout_handler(unsigned long data)
 {
@@ -315,7 +318,6 @@ static void zfcp_fsf_fsfstatus_qual_eval(struct zfcp_fsf_req *req)
        case FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED:
                return;
        case FSF_SQ_COMMAND_ABORTED:
-               req->status |= ZFCP_STATUS_FSFREQ_ABORTED;
                break;
        case FSF_SQ_NO_RECOM:
                dev_err(&req->adapter->ccw_device->dev,
@@ -356,8 +358,7 @@ static void zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *req)
        zfcp_dbf_hba_fsf_response(req);
 
        if (req->status & ZFCP_STATUS_FSFREQ_DISMISSED) {
-               req->status |= ZFCP_STATUS_FSFREQ_ERROR |
-                       ZFCP_STATUS_FSFREQ_RETRY; /* only for SCSI cmnds. */
+               req->status |= ZFCP_STATUS_FSFREQ_ERROR;
                return;
        }
 
@@ -375,7 +376,7 @@ static void zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *req)
        case FSF_PROT_ERROR_STATE:
        case FSF_PROT_SEQ_NUMB_ERROR:
                zfcp_erp_adapter_reopen(adapter, 0, "fspse_2", req);
-               req->status |= ZFCP_STATUS_FSFREQ_RETRY;
+               req->status |= ZFCP_STATUS_FSFREQ_ERROR;
                break;
        case FSF_PROT_UNSUPP_QTCB_TYPE:
                dev_err(&adapter->ccw_device->dev,
@@ -395,7 +396,7 @@ static void zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *req)
        case FSF_PROT_LINK_DOWN:
                zfcp_fsf_link_down_info_eval(req, "fspse_5",
                                             &psq->link_down_info);
-               /* FIXME: reopening adapter now? better wait for link up */
+               /* go through reopen to flush pending requests */
                zfcp_erp_adapter_reopen(adapter, 0, "fspse_6", req);
                break;
        case FSF_PROT_REEST_QUEUE:
@@ -459,15 +460,10 @@ static void zfcp_fsf_req_complete(struct zfcp_fsf_req *req)
 void zfcp_fsf_req_dismiss_all(struct zfcp_adapter *adapter)
 {
        struct zfcp_fsf_req *req, *tmp;
-       unsigned long flags;
        LIST_HEAD(remove_queue);
-       unsigned int i;
 
        BUG_ON(atomic_read(&adapter->status) & ZFCP_STATUS_ADAPTER_QDIOUP);
-       spin_lock_irqsave(&adapter->req_list_lock, flags);
-       for (i = 0; i < REQUEST_LIST_SIZE; i++)
-               list_splice_init(&adapter->req_list[i], &remove_queue);
-       spin_unlock_irqrestore(&adapter->req_list_lock, flags);
+       zfcp_reqlist_move(adapter->req_list, &remove_queue);
 
        list_for_each_entry_safe(req, tmp, &remove_queue, list) {
                list_del(&req->list);
@@ -619,6 +615,10 @@ static void zfcp_fsf_exchange_port_evaluate(struct zfcp_fsf_req *req)
                fc_host_permanent_port_name(shost) = fc_host_port_name(shost);
        fc_host_maxframe_size(shost) = bottom->maximum_frame_size;
        fc_host_supported_speeds(shost) = bottom->supported_speed;
+       memcpy(fc_host_supported_fc4s(shost), bottom->supported_fc4_types,
+              FC_FC4_LIST_SIZE);
+       memcpy(fc_host_active_fc4s(shost), bottom->active_fc4_types,
+              FC_FC4_LIST_SIZE);
 }
 
 static void zfcp_fsf_exchange_port_data_handler(struct zfcp_fsf_req *req)
@@ -725,12 +725,12 @@ static struct zfcp_fsf_req *zfcp_fsf_req_create(struct zfcp_qdio *qdio,
        req->adapter = adapter;
        req->fsf_command = fsf_cmd;
        req->req_id = adapter->req_no;
-       req->queue_req.sbal_number = 1;
-       req->queue_req.sbal_first = req_q->first;
-       req->queue_req.sbal_last = req_q->first;
-       req->queue_req.sbale_curr = 1;
+       req->qdio_req.sbal_number = 1;
+       req->qdio_req.sbal_first = req_q->first;
+       req->qdio_req.sbal_last = req_q->first;
+       req->qdio_req.sbale_curr = 1;
 
-       sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
        sbale[0].addr = (void *) req->req_id;
        sbale[0].flags |= SBAL_FLAGS0_COMMAND;
 
@@ -745,6 +745,7 @@ static struct zfcp_fsf_req *zfcp_fsf_req_create(struct zfcp_qdio *qdio,
                        return ERR_PTR(-ENOMEM);
                }
 
+               req->seq_no = adapter->fsf_req_seq_no;
                req->qtcb->prefix.req_seq_no = adapter->fsf_req_seq_no;
                req->qtcb->prefix.req_id = req->req_id;
                req->qtcb->prefix.ulp_info = 26;
@@ -752,8 +753,6 @@ static struct zfcp_fsf_req *zfcp_fsf_req_create(struct zfcp_qdio *qdio,
                req->qtcb->prefix.qtcb_version = FSF_QTCB_CURRENT_VERSION;
                req->qtcb->header.req_handle = req->req_id;
                req->qtcb->header.fsf_command = req->fsf_command;
-               req->seq_no = adapter->fsf_req_seq_no;
-               req->qtcb->prefix.req_seq_no = adapter->fsf_req_seq_no;
                sbale[1].addr = (void *) req->qtcb;
                sbale[1].length = sizeof(struct fsf_qtcb);
        }
@@ -770,25 +769,17 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *req)
 {
        struct zfcp_adapter *adapter = req->adapter;
        struct zfcp_qdio *qdio = adapter->qdio;
-       unsigned long        flags;
-       int                  idx;
-       int                  with_qtcb = (req->qtcb != NULL);
+       int with_qtcb = (req->qtcb != NULL);
+       int req_id = req->req_id;
 
-       /* put allocated FSF request into hash table */
-       spin_lock_irqsave(&adapter->req_list_lock, flags);
-       idx = zfcp_reqlist_hash(req->req_id);
-       list_add_tail(&req->list, &adapter->req_list[idx]);
-       spin_unlock_irqrestore(&adapter->req_list_lock, flags);
+       zfcp_reqlist_add(adapter->req_list, req);
 
-       req->queue_req.qdio_outb_usage = atomic_read(&qdio->req_q.count);
+       req->qdio_req.qdio_outb_usage = atomic_read(&qdio->req_q.count);
        req->issued = get_clock();
-       if (zfcp_qdio_send(qdio, &req->queue_req)) {
+       if (zfcp_qdio_send(qdio, &req->qdio_req)) {
                del_timer(&req->timer);
-               spin_lock_irqsave(&adapter->req_list_lock, flags);
                /* lookup request again, list might have changed */
-               if (zfcp_reqlist_find_safe(adapter, req))
-                       zfcp_reqlist_remove(adapter, req);
-               spin_unlock_irqrestore(&adapter->req_list_lock, flags);
+               zfcp_reqlist_find_rm(adapter->req_list, req_id);
                zfcp_erp_adapter_reopen(adapter, 0, "fsrs__1", req);
                return -EIO;
        }
@@ -826,9 +817,9 @@ int zfcp_fsf_status_read(struct zfcp_qdio *qdio)
                goto out;
        }
 
-       sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
        sbale[2].flags |= SBAL_FLAGS_LAST_ENTRY;
-       req->queue_req.sbale_curr = 2;
+       req->qdio_req.sbale_curr = 2;
 
        sr_buf = mempool_alloc(adapter->pool.status_read_data, GFP_ATOMIC);
        if (!sr_buf) {
@@ -837,7 +828,7 @@ int zfcp_fsf_status_read(struct zfcp_qdio *qdio)
        }
        memset(sr_buf, 0, sizeof(*sr_buf));
        req->data = sr_buf;
-       sbale = zfcp_qdio_sbale_curr(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_curr(qdio, &req->qdio_req);
        sbale->addr = (void *) sr_buf;
        sbale->length = sizeof(*sr_buf);
 
@@ -884,13 +875,11 @@ static void zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *req)
                break;
        case FSF_PORT_BOXED:
                zfcp_erp_port_boxed(unit->port, "fsafch3", req);
-               req->status |= ZFCP_STATUS_FSFREQ_ERROR |
-                              ZFCP_STATUS_FSFREQ_RETRY;
+               req->status |= ZFCP_STATUS_FSFREQ_ERROR;
                break;
        case FSF_LUN_BOXED:
                zfcp_erp_unit_boxed(unit, "fsafch4", req);
-               req->status |= ZFCP_STATUS_FSFREQ_ERROR |
-                              ZFCP_STATUS_FSFREQ_RETRY;
+               req->status |= ZFCP_STATUS_FSFREQ_ERROR;
                 break;
        case FSF_ADAPTER_STATUS_AVAILABLE:
                switch (fsq->word[0]) {
@@ -936,7 +925,7 @@ struct zfcp_fsf_req *zfcp_fsf_abort_fcp_command(unsigned long old_req_id,
                       ZFCP_STATUS_COMMON_UNBLOCKED)))
                goto out_error_free;
 
-       sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
        sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
        sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
 
@@ -988,8 +977,7 @@ static void zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *req)
        case FSF_ACCESS_DENIED:
                break;
         case FSF_PORT_BOXED:
-               req->status |= ZFCP_STATUS_FSFREQ_ERROR |
-                              ZFCP_STATUS_FSFREQ_RETRY;
+               req->status |= ZFCP_STATUS_FSFREQ_ERROR;
                break;
        case FSF_PORT_HANDLE_NOT_VALID:
                zfcp_erp_adapter_reopen(adapter, 0, "fsscth1", req);
@@ -1032,7 +1020,7 @@ static int zfcp_fsf_setup_ct_els_sbals(struct zfcp_fsf_req *req,
 {
        struct zfcp_adapter *adapter = req->adapter;
        struct qdio_buffer_element *sbale = zfcp_qdio_sbale_req(adapter->qdio,
-                                                              &req->queue_req);
+                                                              &req->qdio_req);
        u32 feat = adapter->adapter_features;
        int bytes;
 
@@ -1050,15 +1038,15 @@ static int zfcp_fsf_setup_ct_els_sbals(struct zfcp_fsf_req *req,
                return 0;
        }
 
-       bytes = zfcp_qdio_sbals_from_sg(adapter->qdio, &req->queue_req,
+       bytes = zfcp_qdio_sbals_from_sg(adapter->qdio, &req->qdio_req,
                                        SBAL_FLAGS0_TYPE_WRITE_READ,
                                        sg_req, max_sbals);
        if (bytes <= 0)
                return -EIO;
        req->qtcb->bottom.support.req_buf_length = bytes;
-       req->queue_req.sbale_curr = ZFCP_LAST_SBALE_PER_SBAL;
+       req->qdio_req.sbale_curr = ZFCP_LAST_SBALE_PER_SBAL;
 
-       bytes = zfcp_qdio_sbals_from_sg(adapter->qdio, &req->queue_req,
+       bytes = zfcp_qdio_sbals_from_sg(adapter->qdio, &req->qdio_req,
                                        SBAL_FLAGS0_TYPE_WRITE_READ,
                                        sg_resp, max_sbals);
        req->qtcb->bottom.support.resp_buf_length = bytes;
@@ -1071,20 +1059,20 @@ static int zfcp_fsf_setup_ct_els_sbals(struct zfcp_fsf_req *req,
 static int zfcp_fsf_setup_ct_els(struct zfcp_fsf_req *req,
                                 struct scatterlist *sg_req,
                                 struct scatterlist *sg_resp,
-                                int max_sbals)
+                                int max_sbals, unsigned int timeout)
 {
        int ret;
-       unsigned int fcp_chan_timeout;
 
        ret = zfcp_fsf_setup_ct_els_sbals(req, sg_req, sg_resp, max_sbals);
        if (ret)
                return ret;
 
        /* common settings for ct/gs and els requests */
-       fcp_chan_timeout = 2 * FC_DEF_R_A_TOV / 1000;
+       if (timeout > 255)
+               timeout = 255; /* max value accepted by hardware */
        req->qtcb->bottom.support.service_class = FSF_CLASS_3;
-       req->qtcb->bottom.support.timeout = fcp_chan_timeout;
-       zfcp_fsf_start_timer(req, (fcp_chan_timeout + 10) * HZ);
+       req->qtcb->bottom.support.timeout = timeout;
+       zfcp_fsf_start_timer(req, (timeout + 10) * HZ);
 
        return 0;
 }
@@ -1095,7 +1083,8 @@ static int zfcp_fsf_setup_ct_els(struct zfcp_fsf_req *req,
  * @pool: if non-null this mempool is used to allocate struct zfcp_fsf_req
  */
 int zfcp_fsf_send_ct(struct zfcp_fc_wka_port *wka_port,
-                    struct zfcp_fsf_ct_els *ct, mempool_t *pool)
+                    struct zfcp_fsf_ct_els *ct, mempool_t *pool,
+                    unsigned int timeout)
 {
        struct zfcp_qdio *qdio = wka_port->adapter->qdio;
        struct zfcp_fsf_req *req;
@@ -1114,7 +1103,7 @@ int zfcp_fsf_send_ct(struct zfcp_fc_wka_port *wka_port,
 
        req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
        ret = zfcp_fsf_setup_ct_els(req, ct->req, ct->resp,
-                                   FSF_MAX_SBALS_PER_REQ);
+                                   FSF_MAX_SBALS_PER_REQ, timeout);
        if (ret)
                goto failed_send;
 
@@ -1191,7 +1180,7 @@ skip_fsfstatus:
  * @els: pointer to struct zfcp_send_els with data for the command
  */
 int zfcp_fsf_send_els(struct zfcp_adapter *adapter, u32 d_id,
-                     struct zfcp_fsf_ct_els *els)
+                     struct zfcp_fsf_ct_els *els, unsigned int timeout)
 {
        struct zfcp_fsf_req *req;
        struct zfcp_qdio *qdio = adapter->qdio;
@@ -1209,7 +1198,7 @@ int zfcp_fsf_send_els(struct zfcp_adapter *adapter, u32 d_id,
        }
 
        req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
-       ret = zfcp_fsf_setup_ct_els(req, els->req, els->resp, 2);
+       ret = zfcp_fsf_setup_ct_els(req, els->req, els->resp, 2, timeout);
 
        if (ret)
                goto failed_send;
@@ -1253,7 +1242,7 @@ int zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action)
        }
 
        req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
-       sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
        sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
        sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
 
@@ -1264,13 +1253,13 @@ int zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action)
                        FSF_FEATURE_UPDATE_ALERT;
        req->erp_action = erp_action;
        req->handler = zfcp_fsf_exchange_config_data_handler;
-       erp_action->fsf_req = req;
+       erp_action->fsf_req_id = req->req_id;
 
        zfcp_fsf_start_erp_timer(req);
        retval = zfcp_fsf_req_send(req);
        if (retval) {
                zfcp_fsf_req_free(req);
-               erp_action->fsf_req = NULL;
+               erp_action->fsf_req_id = 0;
        }
 out:
        spin_unlock_bh(&qdio->req_q_lock);
@@ -1295,7 +1284,7 @@ int zfcp_fsf_exchange_config_data_sync(struct zfcp_qdio *qdio,
                goto out_unlock;
        }
 
-       sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
        sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
        sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
        req->handler = zfcp_fsf_exchange_config_data_handler;
@@ -1351,19 +1340,19 @@ int zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action)
        }
 
        req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
-       sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
        sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
        sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
 
        req->handler = zfcp_fsf_exchange_port_data_handler;
        req->erp_action = erp_action;
-       erp_action->fsf_req = req;
+       erp_action->fsf_req_id = req->req_id;
 
        zfcp_fsf_start_erp_timer(req);
        retval = zfcp_fsf_req_send(req);
        if (retval) {
                zfcp_fsf_req_free(req);
-               erp_action->fsf_req = NULL;
+               erp_action->fsf_req_id = 0;
        }
 out:
        spin_unlock_bh(&qdio->req_q_lock);
@@ -1400,7 +1389,7 @@ int zfcp_fsf_exchange_port_data_sync(struct zfcp_qdio *qdio,
        if (data)
                req->data = data;
 
-       sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
        sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
        sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
 
@@ -1486,7 +1475,7 @@ static void zfcp_fsf_open_port_handler(struct zfcp_fsf_req *req)
        }
 
 out:
-       put_device(&port->sysfs_device);
+       put_device(&port->dev);
 }
 
 /**
@@ -1515,7 +1504,7 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action)
        }
 
        req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
-       sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
         sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
         sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
 
@@ -1523,15 +1512,15 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action)
        hton24(req->qtcb->bottom.support.d_id, port->d_id);
        req->data = port;
        req->erp_action = erp_action;
-       erp_action->fsf_req = req;
-       get_device(&port->sysfs_device);
+       erp_action->fsf_req_id = req->req_id;
+       get_device(&port->dev);
 
        zfcp_fsf_start_erp_timer(req);
        retval = zfcp_fsf_req_send(req);
        if (retval) {
                zfcp_fsf_req_free(req);
-               erp_action->fsf_req = NULL;
-               put_device(&port->sysfs_device);
+               erp_action->fsf_req_id = 0;
+               put_device(&port->dev);
        }
 out:
        spin_unlock_bh(&qdio->req_q_lock);
@@ -1585,7 +1574,7 @@ int zfcp_fsf_close_port(struct zfcp_erp_action *erp_action)
        }
 
        req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
-       sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
        sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
        sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
 
@@ -1593,13 +1582,13 @@ int zfcp_fsf_close_port(struct zfcp_erp_action *erp_action)
        req->data = erp_action->port;
        req->erp_action = erp_action;
        req->qtcb->header.port_handle = erp_action->port->handle;
-       erp_action->fsf_req = req;
+       erp_action->fsf_req_id = req->req_id;
 
        zfcp_fsf_start_erp_timer(req);
        retval = zfcp_fsf_req_send(req);
        if (retval) {
                zfcp_fsf_req_free(req);
-               erp_action->fsf_req = NULL;
+               erp_action->fsf_req_id = 0;
        }
 out:
        spin_unlock_bh(&qdio->req_q_lock);
@@ -1662,7 +1651,7 @@ int zfcp_fsf_open_wka_port(struct zfcp_fc_wka_port *wka_port)
        }
 
        req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
-       sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
        sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
        sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
 
@@ -1717,7 +1706,7 @@ int zfcp_fsf_close_wka_port(struct zfcp_fc_wka_port *wka_port)
        }
 
        req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
-       sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
        sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
        sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
 
@@ -1761,9 +1750,7 @@ static void zfcp_fsf_close_physical_port_handler(struct zfcp_fsf_req *req)
                                          &unit->status);
                read_unlock(&port->unit_list_lock);
                zfcp_erp_port_boxed(port, "fscpph2", req);
-               req->status |= ZFCP_STATUS_FSFREQ_ERROR |
-                              ZFCP_STATUS_FSFREQ_RETRY;
-
+               req->status |= ZFCP_STATUS_FSFREQ_ERROR;
                break;
        case FSF_ADAPTER_STATUS_AVAILABLE:
                switch (header->fsf_status_qual.word[0]) {
@@ -1813,7 +1800,7 @@ int zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action)
        }
 
        req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
-       sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
        sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
        sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
 
@@ -1821,13 +1808,13 @@ int zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action)
        req->qtcb->header.port_handle = erp_action->port->handle;
        req->erp_action = erp_action;
        req->handler = zfcp_fsf_close_physical_port_handler;
-       erp_action->fsf_req = req;
+       erp_action->fsf_req_id = req->req_id;
 
        zfcp_fsf_start_erp_timer(req);
        retval = zfcp_fsf_req_send(req);
        if (retval) {
                zfcp_fsf_req_free(req);
-               erp_action->fsf_req = NULL;
+               erp_action->fsf_req_id = 0;
        }
 out:
        spin_unlock_bh(&qdio->req_q_lock);
@@ -1867,8 +1854,7 @@ static void zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *req)
                break;
        case FSF_PORT_BOXED:
                zfcp_erp_port_boxed(unit->port, "fsouh_2", req);
-               req->status |= ZFCP_STATUS_FSFREQ_ERROR |
-                              ZFCP_STATUS_FSFREQ_RETRY;
+               req->status |= ZFCP_STATUS_FSFREQ_ERROR;
                break;
        case FSF_LUN_SHARING_VIOLATION:
                if (header->fsf_status_qual.word[0])
@@ -1987,7 +1973,7 @@ int zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action)
        }
 
        req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
-       sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
         sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
         sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
 
@@ -1996,7 +1982,7 @@ int zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action)
        req->handler = zfcp_fsf_open_unit_handler;
        req->data = erp_action->unit;
        req->erp_action = erp_action;
-       erp_action->fsf_req = req;
+       erp_action->fsf_req_id = req->req_id;
 
        if (!(adapter->connection_features & FSF_FEATURE_NPIV_MODE))
                req->qtcb->bottom.support.option = FSF_OPEN_LUN_SUPPRESS_BOXING;
@@ -2005,7 +1991,7 @@ int zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action)
        retval = zfcp_fsf_req_send(req);
        if (retval) {
                zfcp_fsf_req_free(req);
-               erp_action->fsf_req = NULL;
+               erp_action->fsf_req_id = 0;
        }
 out:
        spin_unlock_bh(&qdio->req_q_lock);
@@ -2030,8 +2016,7 @@ static void zfcp_fsf_close_unit_handler(struct zfcp_fsf_req *req)
                break;
        case FSF_PORT_BOXED:
                zfcp_erp_port_boxed(unit->port, "fscuh_3", req);
-               req->status |= ZFCP_STATUS_FSFREQ_ERROR |
-                              ZFCP_STATUS_FSFREQ_RETRY;
+               req->status |= ZFCP_STATUS_FSFREQ_ERROR;
                break;
        case FSF_ADAPTER_STATUS_AVAILABLE:
                switch (req->qtcb->header.fsf_status_qual.word[0]) {
@@ -2074,7 +2059,7 @@ int zfcp_fsf_close_unit(struct zfcp_erp_action *erp_action)
        }
 
        req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
-       sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
        sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
        sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
 
@@ -2083,13 +2068,13 @@ int zfcp_fsf_close_unit(struct zfcp_erp_action *erp_action)
        req->handler = zfcp_fsf_close_unit_handler;
        req->data = erp_action->unit;
        req->erp_action = erp_action;
-       erp_action->fsf_req = req;
+       erp_action->fsf_req_id = req->req_id;
 
        zfcp_fsf_start_erp_timer(req);
        retval = zfcp_fsf_req_send(req);
        if (retval) {
                zfcp_fsf_req_free(req);
-               erp_action->fsf_req = NULL;
+               erp_action->fsf_req_id = 0;
        }
 out:
        spin_unlock_bh(&qdio->req_q_lock);
@@ -2117,10 +2102,11 @@ static void zfcp_fsf_req_trace(struct zfcp_fsf_req *req, struct scsi_cmnd *scsi)
        blktrc.magic = ZFCP_BLK_DRV_DATA_MAGIC;
        if (req->status & ZFCP_STATUS_FSFREQ_ERROR)
                blktrc.flags |= ZFCP_BLK_REQ_ERROR;
-       blktrc.inb_usage = req->queue_req.qdio_inb_usage;
-       blktrc.outb_usage = req->queue_req.qdio_outb_usage;
+       blktrc.inb_usage = req->qdio_req.qdio_inb_usage;
+       blktrc.outb_usage = req->qdio_req.qdio_outb_usage;
 
-       if (req->adapter->adapter_features & FSF_FEATURE_MEASUREMENT_DATA) {
+       if (req->adapter->adapter_features & FSF_FEATURE_MEASUREMENT_DATA &&
+           !(req->status & ZFCP_STATUS_FSFREQ_ERROR)) {
                blktrc.flags |= ZFCP_BLK_LAT_VALID;
                blktrc.channel_lat = lat_in->channel_lat * ticks;
                blktrc.fabric_lat = lat_in->fabric_lat * ticks;
@@ -2164,28 +2150,17 @@ static void zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *req)
                return;
        }
 
-       if (unlikely(req->status & ZFCP_STATUS_FSFREQ_ABORTED)) {
-               set_host_byte(scpnt, DID_SOFT_ERROR);
-               goto skip_fsfstatus;
-       }
-
        if (unlikely(req->status & ZFCP_STATUS_FSFREQ_ERROR)) {
-               set_host_byte(scpnt, DID_ERROR);
+               set_host_byte(scpnt, DID_TRANSPORT_DISRUPTED);
                goto skip_fsfstatus;
        }
 
        fcp_rsp = (struct fcp_resp_with_ext *) &req->qtcb->bottom.io.fcp_rsp;
        zfcp_fc_eval_fcp_rsp(fcp_rsp, scpnt);
 
-       zfcp_fsf_req_trace(req, scpnt);
-
 skip_fsfstatus:
-       if (scpnt->result != 0)
-               zfcp_dbf_scsi_result("erro", 3, req->adapter->dbf, scpnt, req);
-       else if (scpnt->retries > 0)
-               zfcp_dbf_scsi_result("retr", 4, req->adapter->dbf, scpnt, req);
-       else
-               zfcp_dbf_scsi_result("norm", 6, req->adapter->dbf, scpnt, req);
+       zfcp_fsf_req_trace(req, scpnt);
+       zfcp_dbf_scsi_result(req->adapter->dbf, scpnt, req);
 
        scpnt->host_scribble = NULL;
        (scpnt->scsi_done) (scpnt);
@@ -2266,13 +2241,11 @@ static void zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *req)
                break;
        case FSF_PORT_BOXED:
                zfcp_erp_port_boxed(unit->port, "fssfch5", req);
-               req->status |= ZFCP_STATUS_FSFREQ_ERROR |
-                              ZFCP_STATUS_FSFREQ_RETRY;
+               req->status |= ZFCP_STATUS_FSFREQ_ERROR;
                break;
        case FSF_LUN_BOXED:
                zfcp_erp_unit_boxed(unit, "fssfch6", req);
-               req->status |= ZFCP_STATUS_FSFREQ_ERROR |
-                              ZFCP_STATUS_FSFREQ_RETRY;
+               req->status |= ZFCP_STATUS_FSFREQ_ERROR;
                break;
        case FSF_ADAPTER_STATUS_AVAILABLE:
                if (header->fsf_status_qual.word[0] ==
@@ -2287,7 +2260,7 @@ skip_fsfstatus:
        else {
                zfcp_fsf_send_fcp_command_task_handler(req);
                req->unit = NULL;
-               put_device(&unit->sysfs_device);
+               put_device(&unit->dev);
        }
 }
 
@@ -2325,7 +2298,7 @@ int zfcp_fsf_send_fcp_command_task(struct zfcp_unit *unit,
        }
 
        req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
-       get_device(&unit->sysfs_device);
+       get_device(&unit->dev);
        req->unit = unit;
        req->data = scsi_cmnd;
        req->handler = zfcp_fsf_send_fcp_command_handler;
@@ -2359,11 +2332,11 @@ int zfcp_fsf_send_fcp_command_task(struct zfcp_unit *unit,
        fcp_cmnd = (struct fcp_cmnd *) &req->qtcb->bottom.io.fcp_cmnd;
        zfcp_fc_scsi_to_fcp(fcp_cmnd, scsi_cmnd);
 
-       real_bytes = zfcp_qdio_sbals_from_sg(qdio, &req->queue_req, sbtype,
+       real_bytes = zfcp_qdio_sbals_from_sg(qdio, &req->qdio_req, sbtype,
                                             scsi_sglist(scsi_cmnd),
                                             FSF_MAX_SBALS_PER_REQ);
        if (unlikely(real_bytes < 0)) {
-               if (req->queue_req.sbal_number >= FSF_MAX_SBALS_PER_REQ) {
+               if (req->qdio_req.sbal_number >= FSF_MAX_SBALS_PER_REQ) {
                        dev_err(&adapter->ccw_device->dev,
                                "Oversize data package, unit 0x%016Lx "
                                "on port 0x%016Lx closed\n",
@@ -2382,7 +2355,7 @@ int zfcp_fsf_send_fcp_command_task(struct zfcp_unit *unit,
        goto out;
 
 failed_scsi_cmnd:
-       put_device(&unit->sysfs_device);
+       put_device(&unit->dev);
        zfcp_fsf_req_free(req);
        scsi_cmnd->host_scribble = NULL;
 out:
@@ -2428,7 +2401,7 @@ struct zfcp_fsf_req *zfcp_fsf_send_fcp_ctm(struct zfcp_unit *unit, u8 tm_flags)
        req->qtcb->bottom.io.service_class = FSF_CLASS_3;
        req->qtcb->bottom.io.fcp_cmnd_length = FCP_CMND_LEN;
 
-       sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
        sbale[0].flags |= SBAL_FLAGS0_TYPE_WRITE;
        sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
 
@@ -2491,14 +2464,14 @@ struct zfcp_fsf_req *zfcp_fsf_control_file(struct zfcp_adapter *adapter,
 
        req->handler = zfcp_fsf_control_file_handler;
 
-       sbale = zfcp_qdio_sbale_req(qdio, &req->queue_req);
+       sbale = zfcp_qdio_sbale_req(qdio, &req->qdio_req);
        sbale[0].flags |= direction;
 
        bottom = &req->qtcb->bottom.support;
        bottom->operation_subtype = FSF_CFDC_OPERATION_SUBTYPE;
        bottom->option = fsf_cfdc->option;
 
-       bytes = zfcp_qdio_sbals_from_sg(qdio, &req->queue_req,
+       bytes = zfcp_qdio_sbals_from_sg(qdio, &req->qdio_req,
                                        direction, fsf_cfdc->sg,
                                        FSF_MAX_SBALS_PER_REQ);
        if (bytes != ZFCP_CFDC_MAX_SIZE) {
@@ -2529,15 +2502,14 @@ void zfcp_fsf_reqid_check(struct zfcp_qdio *qdio, int sbal_idx)
        struct qdio_buffer *sbal = qdio->resp_q.sbal[sbal_idx];
        struct qdio_buffer_element *sbale;
        struct zfcp_fsf_req *fsf_req;
-       unsigned long flags, req_id;
+       unsigned long req_id;
        int idx;
 
        for (idx = 0; idx < QDIO_MAX_ELEMENTS_PER_BUFFER; idx++) {
 
                sbale = &sbal->element[idx];
                req_id = (unsigned long) sbale->addr;
-               spin_lock_irqsave(&adapter->req_list_lock, flags);
-               fsf_req = zfcp_reqlist_find(adapter, req_id);
+               fsf_req = zfcp_reqlist_find_rm(adapter->req_list, req_id);
 
                if (!fsf_req)
                        /*
@@ -2547,11 +2519,8 @@ void zfcp_fsf_reqid_check(struct zfcp_qdio *qdio, int sbal_idx)
                        panic("error: unknown req_id (%lx) on adapter %s.\n",
                              req_id, dev_name(&adapter->ccw_device->dev));
 
-               list_del(&fsf_req->list);
-               spin_unlock_irqrestore(&adapter->req_list_lock, flags);
-
-               fsf_req->queue_req.sbal_response = sbal_idx;
-               fsf_req->queue_req.qdio_inb_usage =
+               fsf_req->qdio_req.sbal_response = sbal_idx;
+               fsf_req->qdio_req.qdio_inb_usage =
                        atomic_read(&qdio->resp_q.count);
                zfcp_fsf_req_complete(fsf_req);