aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/scsi/zfcp_dbf.c6
-rw-r--r--drivers/s390/scsi/zfcp_def.h84
-rw-r--r--drivers/s390/scsi/zfcp_ext.h11
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c79
-rw-r--r--drivers/s390/scsi/zfcp_qdio.c95
5 files changed, 160 insertions, 115 deletions
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c
index 5568440ec2fc..fc7f3d66fe37 100644
--- a/drivers/s390/scsi/zfcp_dbf.c
+++ b/drivers/s390/scsi/zfcp_dbf.c
@@ -152,9 +152,9 @@ void _zfcp_hba_dbf_event_fsf_response(const char *tag2, int level,
152 memcpy(response->fsf_status_qual, 152 memcpy(response->fsf_status_qual,
153 fsf_status_qual, FSF_STATUS_QUALIFIER_SIZE); 153 fsf_status_qual, FSF_STATUS_QUALIFIER_SIZE);
154 response->fsf_req_status = fsf_req->status; 154 response->fsf_req_status = fsf_req->status;
155 response->sbal_first = fsf_req->sbal_first; 155 response->sbal_first = fsf_req->queue_req.sbal_first;
156 response->sbal_last = fsf_req->sbal_last; 156 response->sbal_last = fsf_req->queue_req.sbal_last;
157 response->sbal_response = fsf_req->sbal_response; 157 response->sbal_response = fsf_req->queue_req.sbal_response;
158 response->pool = fsf_req->pool != NULL; 158 response->pool = fsf_req->pool != NULL;
159 response->erp_action = (unsigned long)fsf_req->erp_action; 159 response->erp_action = (unsigned long)fsf_req->erp_action;
160 160
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index 2715a103e5a8..a04bdfd4d2f6 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -529,36 +529,64 @@ struct zfcp_unit {
529 struct work_struct scsi_work; 529 struct work_struct scsi_work;
530}; 530};
531 531
532/* FSF request */ 532/**
533 * struct zfcp_queue_req - queue related values for a request
534 * @sbal_number: number of free SBALs
535 * @sbal_first: first SBAL for this request
536 * @sbal_last: last SBAL for this request
537 * @sbal_limit: last possible SBAL for this request
538 * @sbale_curr: current SBALE at creation of this request
539 * @sbal_response: SBAL used in interrupt
540 * @qdio_outb_usage: usage of outbound queue
541 * @qdio_inb_usage: usage of inbound queue
542 */
543struct zfcp_queue_req {
544 u8 sbal_number;
545 u8 sbal_first;
546 u8 sbal_last;
547 u8 sbal_limit;
548 u8 sbale_curr;
549 u8 sbal_response;
550 u16 qdio_outb_usage;
551 u16 qdio_inb_usage;
552};
553
554/**
555 * struct zfcp_fsf_req - basic FSF request structure
556 * @list: list of FSF requests
557 * @req_id: unique request ID
558 * @adapter: adapter this request belongs to
559 * @queue_req: queue related values
560 * @completion: used to signal the completion of the request
561 * @status: status of the request
562 * @fsf_command: FSF command issued
563 * @qtcb: associated QTCB
564 * @seq_no: sequence number of this request
565 * @data: private data
566 * @timer: timer data of this request
567 * @erp_action: reference to erp action if request issued on behalf of ERP
568 * @pool: reference to memory pool if used for this request
569 * @issued: time when request was send (STCK)
570 * @unit: reference to unit if this request is a SCSI request
571 * @handler: handler which should be called to process response
572 */
533struct zfcp_fsf_req { 573struct zfcp_fsf_req {
534 struct list_head list; /* list of FSF requests */ 574 struct list_head list;
535 unsigned long req_id; /* unique request ID */ 575 unsigned long req_id;
536 struct zfcp_adapter *adapter; /* adapter request belongs to */ 576 struct zfcp_adapter *adapter;
537 u8 sbal_number; /* nr of SBALs free for use */ 577 struct zfcp_queue_req queue_req;
538 u8 sbal_first; /* first SBAL for this request */ 578 struct completion completion;
539 u8 sbal_last; /* last SBAL for this request */ 579 u32 status;
540 u8 sbal_limit; /* last possible SBAL for 580 u32 fsf_command;
541 this reuest */ 581 struct fsf_qtcb *qtcb;
542 u8 sbale_curr; /* current SBALE during creation 582 u32 seq_no;
543 of request */ 583 void *data;
544 u8 sbal_response; /* SBAL used in interrupt */ 584 struct timer_list timer;
545 struct completion completion; /* can be used by a routine 585 struct zfcp_erp_action *erp_action;
546 to wait for completion */ 586 mempool_t *pool;
547 u32 status; /* status of this request */ 587 unsigned long long issued;
548 u32 fsf_command; /* FSF Command copy */ 588 struct zfcp_unit *unit;
549 struct fsf_qtcb *qtcb; /* address of associated QTCB */
550 u32 seq_no; /* Sequence number of request */
551 void *data; /* private data of request */
552 struct timer_list timer; /* used for erp or scsi er */
553 struct zfcp_erp_action *erp_action; /* used if this request is
554 issued on behalf of erp */
555 mempool_t *pool; /* used if request was alloacted
556 from emergency pool */
557 unsigned long long issued; /* request sent time (STCK) */
558 struct zfcp_unit *unit;
559 void (*handler)(struct zfcp_fsf_req *); 589 void (*handler)(struct zfcp_fsf_req *);
560 u16 qdio_outb_usage;/* usage of outbound queue */
561 u16 qdio_inb_usage; /* usage of inbound queue */
562}; 590};
563 591
564/* driver data */ 592/* driver data */
diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h
index 6a3727bdb386..d11c0f44dad3 100644
--- a/drivers/s390/scsi/zfcp_ext.h
+++ b/drivers/s390/scsi/zfcp_ext.h
@@ -142,10 +142,13 @@ extern void zfcp_fsf_reqid_check(struct zfcp_adapter *, int);
142/* zfcp_qdio.c */ 142/* zfcp_qdio.c */
143extern int zfcp_qdio_allocate(struct zfcp_adapter *); 143extern int zfcp_qdio_allocate(struct zfcp_adapter *);
144extern void zfcp_qdio_free(struct zfcp_adapter *); 144extern void zfcp_qdio_free(struct zfcp_adapter *);
145extern int zfcp_qdio_send(struct zfcp_fsf_req *); 145extern int zfcp_qdio_send(struct zfcp_adapter *, struct zfcp_queue_req *);
146extern struct qdio_buffer_element *zfcp_qdio_sbale_req(struct zfcp_fsf_req *); 146extern struct qdio_buffer_element
147extern struct qdio_buffer_element *zfcp_qdio_sbale_curr(struct zfcp_fsf_req *); 147 *zfcp_qdio_sbale_req(struct zfcp_adapter *, struct zfcp_queue_req *);
148extern int zfcp_qdio_sbals_from_sg(struct zfcp_fsf_req *, unsigned long, 148extern struct qdio_buffer_element
149 *zfcp_qdio_sbale_curr(struct zfcp_adapter *, struct zfcp_queue_req *);
150extern int zfcp_qdio_sbals_from_sg(struct zfcp_adapter *,
151 struct zfcp_queue_req *, unsigned long,
149 struct scatterlist *, int); 152 struct scatterlist *, int);
150extern int zfcp_qdio_open(struct zfcp_adapter *); 153extern int zfcp_qdio_open(struct zfcp_adapter *);
151extern void zfcp_qdio_close(struct zfcp_adapter *); 154extern void zfcp_qdio_close(struct zfcp_adapter *);
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 5b73f989a629..e88b7804780b 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -720,12 +720,12 @@ static struct zfcp_fsf_req *zfcp_fsf_req_create(struct zfcp_adapter *adapter,
720 req->adapter = adapter; 720 req->adapter = adapter;
721 req->fsf_command = fsf_cmd; 721 req->fsf_command = fsf_cmd;
722 req->req_id = adapter->req_no; 722 req->req_id = adapter->req_no;
723 req->sbal_number = 1; 723 req->queue_req.sbal_number = 1;
724 req->sbal_first = req_q->first; 724 req->queue_req.sbal_first = req_q->first;
725 req->sbal_last = req_q->first; 725 req->queue_req.sbal_last = req_q->first;
726 req->sbale_curr = 1; 726 req->queue_req.sbale_curr = 1;
727 727
728 sbale = zfcp_qdio_sbale_req(req); 728 sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req);
729 sbale[0].addr = (void *) req->req_id; 729 sbale[0].addr = (void *) req->req_id;
730 sbale[0].flags |= SBAL_FLAGS0_COMMAND; 730 sbale[0].flags |= SBAL_FLAGS0_COMMAND;
731 731
@@ -774,9 +774,9 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *req)
774 list_add_tail(&req->list, &adapter->req_list[idx]); 774 list_add_tail(&req->list, &adapter->req_list[idx]);
775 spin_unlock_irqrestore(&adapter->req_list_lock, flags); 775 spin_unlock_irqrestore(&adapter->req_list_lock, flags);
776 776
777 req->qdio_outb_usage = atomic_read(&adapter->req_q.count); 777 req->queue_req.qdio_outb_usage = atomic_read(&adapter->req_q.count);
778 req->issued = get_clock(); 778 req->issued = get_clock();
779 if (zfcp_qdio_send(req)) { 779 if (zfcp_qdio_send(adapter, &req->queue_req)) {
780 del_timer(&req->timer); 780 del_timer(&req->timer);
781 spin_lock_irqsave(&adapter->req_list_lock, flags); 781 spin_lock_irqsave(&adapter->req_list_lock, flags);
782 /* lookup request again, list might have changed */ 782 /* lookup request again, list might have changed */
@@ -819,9 +819,9 @@ int zfcp_fsf_status_read(struct zfcp_adapter *adapter)
819 goto out; 819 goto out;
820 } 820 }
821 821
822 sbale = zfcp_qdio_sbale_req(req); 822 sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req);
823 sbale[2].flags |= SBAL_FLAGS_LAST_ENTRY; 823 sbale[2].flags |= SBAL_FLAGS_LAST_ENTRY;
824 req->sbale_curr = 2; 824 req->queue_req.sbale_curr = 2;
825 825
826 sr_buf = mempool_alloc(adapter->pool.status_read_data, GFP_ATOMIC); 826 sr_buf = mempool_alloc(adapter->pool.status_read_data, GFP_ATOMIC);
827 if (!sr_buf) { 827 if (!sr_buf) {
@@ -830,7 +830,7 @@ int zfcp_fsf_status_read(struct zfcp_adapter *adapter)
830 } 830 }
831 memset(sr_buf, 0, sizeof(*sr_buf)); 831 memset(sr_buf, 0, sizeof(*sr_buf));
832 req->data = sr_buf; 832 req->data = sr_buf;
833 sbale = zfcp_qdio_sbale_curr(req); 833 sbale = zfcp_qdio_sbale_curr(adapter, &req->queue_req);
834 sbale->addr = (void *) sr_buf; 834 sbale->addr = (void *) sr_buf;
835 sbale->length = sizeof(*sr_buf); 835 sbale->length = sizeof(*sr_buf);
836 836
@@ -929,7 +929,7 @@ struct zfcp_fsf_req *zfcp_fsf_abort_fcp_command(unsigned long old_req_id,
929 ZFCP_STATUS_COMMON_UNBLOCKED))) 929 ZFCP_STATUS_COMMON_UNBLOCKED)))
930 goto out_error_free; 930 goto out_error_free;
931 931
932 sbale = zfcp_qdio_sbale_req(req); 932 sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req);
933 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 933 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
934 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; 934 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
935 935
@@ -1023,8 +1023,10 @@ static int zfcp_fsf_setup_ct_els_sbals(struct zfcp_fsf_req *req,
1023 struct scatterlist *sg_resp, 1023 struct scatterlist *sg_resp,
1024 int max_sbals) 1024 int max_sbals)
1025{ 1025{
1026 struct qdio_buffer_element *sbale = zfcp_qdio_sbale_req(req); 1026 struct zfcp_adapter *adapter = req->adapter;
1027 u32 feat = req->adapter->adapter_features; 1027 struct qdio_buffer_element *sbale = zfcp_qdio_sbale_req(adapter,
1028 &req->queue_req);
1029 u32 feat = adapter->adapter_features;
1028 int bytes; 1030 int bytes;
1029 1031
1030 if (!(feat & FSF_FEATURE_ELS_CT_CHAINED_SBALS)) { 1032 if (!(feat & FSF_FEATURE_ELS_CT_CHAINED_SBALS)) {
@@ -1041,14 +1043,16 @@ static int zfcp_fsf_setup_ct_els_sbals(struct zfcp_fsf_req *req,
1041 return 0; 1043 return 0;
1042 } 1044 }
1043 1045
1044 bytes = zfcp_qdio_sbals_from_sg(req, SBAL_FLAGS0_TYPE_WRITE_READ, 1046 bytes = zfcp_qdio_sbals_from_sg(adapter, &req->queue_req,
1047 SBAL_FLAGS0_TYPE_WRITE_READ,
1045 sg_req, max_sbals); 1048 sg_req, max_sbals);
1046 if (bytes <= 0) 1049 if (bytes <= 0)
1047 return -EIO; 1050 return -EIO;
1048 req->qtcb->bottom.support.req_buf_length = bytes; 1051 req->qtcb->bottom.support.req_buf_length = bytes;
1049 req->sbale_curr = ZFCP_LAST_SBALE_PER_SBAL; 1052 req->queue_req.sbale_curr = ZFCP_LAST_SBALE_PER_SBAL;
1050 1053
1051 bytes = zfcp_qdio_sbals_from_sg(req, SBAL_FLAGS0_TYPE_WRITE_READ, 1054 bytes = zfcp_qdio_sbals_from_sg(adapter, &req->queue_req,
1055 SBAL_FLAGS0_TYPE_WRITE_READ,
1052 sg_resp, max_sbals); 1056 sg_resp, max_sbals);
1053 if (bytes <= 0) 1057 if (bytes <= 0)
1054 return -EIO; 1058 return -EIO;
@@ -1241,7 +1245,7 @@ int zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action)
1241 } 1245 }
1242 1246
1243 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; 1247 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
1244 sbale = zfcp_qdio_sbale_req(req); 1248 sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req);
1245 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 1249 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
1246 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; 1250 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
1247 1251
@@ -1283,7 +1287,7 @@ int zfcp_fsf_exchange_config_data_sync(struct zfcp_adapter *adapter,
1283 goto out_unlock; 1287 goto out_unlock;
1284 } 1288 }
1285 1289
1286 sbale = zfcp_qdio_sbale_req(req); 1290 sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req);
1287 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 1291 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
1288 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; 1292 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
1289 req->handler = zfcp_fsf_exchange_config_data_handler; 1293 req->handler = zfcp_fsf_exchange_config_data_handler;
@@ -1339,7 +1343,7 @@ int zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action)
1339 } 1343 }
1340 1344
1341 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; 1345 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
1342 sbale = zfcp_qdio_sbale_req(req); 1346 sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req);
1343 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 1347 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
1344 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; 1348 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
1345 1349
@@ -1388,7 +1392,7 @@ int zfcp_fsf_exchange_port_data_sync(struct zfcp_adapter *adapter,
1388 if (data) 1392 if (data)
1389 req->data = data; 1393 req->data = data;
1390 1394
1391 sbale = zfcp_qdio_sbale_req(req); 1395 sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req);
1392 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 1396 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
1393 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; 1397 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
1394 1398
@@ -1509,7 +1513,7 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action)
1509 } 1513 }
1510 1514
1511 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; 1515 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
1512 sbale = zfcp_qdio_sbale_req(req); 1516 sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req);
1513 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 1517 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
1514 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; 1518 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
1515 1519
@@ -1579,7 +1583,7 @@ int zfcp_fsf_close_port(struct zfcp_erp_action *erp_action)
1579 } 1583 }
1580 1584
1581 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; 1585 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
1582 sbale = zfcp_qdio_sbale_req(req); 1586 sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req);
1583 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 1587 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
1584 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; 1588 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
1585 1589
@@ -1656,7 +1660,7 @@ int zfcp_fsf_open_wka_port(struct zfcp_wka_port *wka_port)
1656 } 1660 }
1657 1661
1658 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; 1662 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
1659 sbale = zfcp_qdio_sbale_req(req); 1663 sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req);
1660 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 1664 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
1661 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; 1665 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
1662 1666
@@ -1711,7 +1715,7 @@ int zfcp_fsf_close_wka_port(struct zfcp_wka_port *wka_port)
1711 } 1715 }
1712 1716
1713 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; 1717 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
1714 sbale = zfcp_qdio_sbale_req(req); 1718 sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req);
1715 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 1719 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
1716 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; 1720 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
1717 1721
@@ -1803,7 +1807,7 @@ int zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action)
1803 } 1807 }
1804 1808
1805 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; 1809 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
1806 sbale = zfcp_qdio_sbale_req(req); 1810 sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req);
1807 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 1811 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
1808 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; 1812 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
1809 1813
@@ -1976,7 +1980,7 @@ int zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action)
1976 } 1980 }
1977 1981
1978 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; 1982 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
1979 sbale = zfcp_qdio_sbale_req(req); 1983 sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req);
1980 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 1984 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
1981 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; 1985 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
1982 1986
@@ -2063,7 +2067,7 @@ int zfcp_fsf_close_unit(struct zfcp_erp_action *erp_action)
2063 } 2067 }
2064 2068
2065 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP; 2069 req->status |= ZFCP_STATUS_FSFREQ_CLEANUP;
2066 sbale = zfcp_qdio_sbale_req(req); 2070 sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req);
2067 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 2071 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
2068 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; 2072 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
2069 2073
@@ -2140,8 +2144,8 @@ static void zfcp_fsf_trace_latency(struct zfcp_fsf_req *fsf_req)
2140 } 2144 }
2141 if (fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR) 2145 if (fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR)
2142 trace.flags |= ZFCP_BLK_REQ_ERROR; 2146 trace.flags |= ZFCP_BLK_REQ_ERROR;
2143 trace.inb_usage = fsf_req->qdio_inb_usage; 2147 trace.inb_usage = fsf_req->queue_req.qdio_inb_usage;
2144 trace.outb_usage = fsf_req->qdio_outb_usage; 2148 trace.outb_usage = fsf_req->queue_req.qdio_outb_usage;
2145 2149
2146 blk_add_driver_data(req->q, req, &trace, sizeof(trace)); 2150 blk_add_driver_data(req->q, req, &trace, sizeof(trace));
2147} 2151}
@@ -2420,11 +2424,11 @@ int zfcp_fsf_send_fcp_command_task(struct zfcp_unit *unit,
2420 req->qtcb->bottom.io.fcp_cmnd_length = sizeof(struct fcp_cmnd_iu) + 2424 req->qtcb->bottom.io.fcp_cmnd_length = sizeof(struct fcp_cmnd_iu) +
2421 fcp_cmnd_iu->add_fcp_cdb_length + sizeof(u32); 2425 fcp_cmnd_iu->add_fcp_cdb_length + sizeof(u32);
2422 2426
2423 real_bytes = zfcp_qdio_sbals_from_sg(req, sbtype, 2427 real_bytes = zfcp_qdio_sbals_from_sg(adapter, &req->queue_req, sbtype,
2424 scsi_sglist(scsi_cmnd), 2428 scsi_sglist(scsi_cmnd),
2425 FSF_MAX_SBALS_PER_REQ); 2429 FSF_MAX_SBALS_PER_REQ);
2426 if (unlikely(real_bytes < 0)) { 2430 if (unlikely(real_bytes < 0)) {
2427 if (req->sbal_number >= FSF_MAX_SBALS_PER_REQ) { 2431 if (req->queue_req.sbal_number >= FSF_MAX_SBALS_PER_REQ) {
2428 dev_err(&adapter->ccw_device->dev, 2432 dev_err(&adapter->ccw_device->dev,
2429 "Oversize data package, unit 0x%016Lx " 2433 "Oversize data package, unit 0x%016Lx "
2430 "on port 0x%016Lx closed\n", 2434 "on port 0x%016Lx closed\n",
@@ -2492,7 +2496,7 @@ struct zfcp_fsf_req *zfcp_fsf_send_fcp_ctm(struct zfcp_unit *unit, u8 tm_flags)
2492 req->qtcb->bottom.io.fcp_cmnd_length = sizeof(struct fcp_cmnd_iu) + 2496 req->qtcb->bottom.io.fcp_cmnd_length = sizeof(struct fcp_cmnd_iu) +
2493 sizeof(u32); 2497 sizeof(u32);
2494 2498
2495 sbale = zfcp_qdio_sbale_req(req); 2499 sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req);
2496 sbale[0].flags |= SBAL_FLAGS0_TYPE_WRITE; 2500 sbale[0].flags |= SBAL_FLAGS0_TYPE_WRITE;
2497 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; 2501 sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
2498 2502
@@ -2555,15 +2559,15 @@ struct zfcp_fsf_req *zfcp_fsf_control_file(struct zfcp_adapter *adapter,
2555 2559
2556 req->handler = zfcp_fsf_control_file_handler; 2560 req->handler = zfcp_fsf_control_file_handler;
2557 2561
2558 sbale = zfcp_qdio_sbale_req(req); 2562 sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req);
2559 sbale[0].flags |= direction; 2563 sbale[0].flags |= direction;
2560 2564
2561 bottom = &req->qtcb->bottom.support; 2565 bottom = &req->qtcb->bottom.support;
2562 bottom->operation_subtype = FSF_CFDC_OPERATION_SUBTYPE; 2566 bottom->operation_subtype = FSF_CFDC_OPERATION_SUBTYPE;
2563 bottom->option = fsf_cfdc->option; 2567 bottom->option = fsf_cfdc->option;
2564 2568
2565 bytes = zfcp_qdio_sbals_from_sg(req, direction, fsf_cfdc->sg, 2569 bytes = zfcp_qdio_sbals_from_sg(adapter, &req->queue_req, direction,
2566 FSF_MAX_SBALS_PER_REQ); 2570 fsf_cfdc->sg, FSF_MAX_SBALS_PER_REQ);
2567 if (bytes != ZFCP_CFDC_MAX_SIZE) { 2571 if (bytes != ZFCP_CFDC_MAX_SIZE) {
2568 zfcp_fsf_req_free(req); 2572 zfcp_fsf_req_free(req);
2569 goto out; 2573 goto out;
@@ -2612,8 +2616,9 @@ void zfcp_fsf_reqid_check(struct zfcp_adapter *adapter, int sbal_idx)
2612 list_del(&fsf_req->list); 2616 list_del(&fsf_req->list);
2613 spin_unlock_irqrestore(&adapter->req_list_lock, flags); 2617 spin_unlock_irqrestore(&adapter->req_list_lock, flags);
2614 2618
2615 fsf_req->sbal_response = sbal_idx; 2619 fsf_req->queue_req.sbal_response = sbal_idx;
2616 fsf_req->qdio_inb_usage = atomic_read(&adapter->resp_q.count); 2620 fsf_req->queue_req.qdio_inb_usage =
2621 atomic_read(&adapter->resp_q.count);
2617 zfcp_fsf_req_complete(fsf_req); 2622 zfcp_fsf_req_complete(fsf_req);
2618 2623
2619 if (likely(sbale->flags & SBAL_FLAGS_LAST_ENTRY)) 2624 if (likely(sbale->flags & SBAL_FLAGS_LAST_ENTRY))
diff --git a/drivers/s390/scsi/zfcp_qdio.c b/drivers/s390/scsi/zfcp_qdio.c
index 2e9b3a9cebd9..e118874976f0 100644
--- a/drivers/s390/scsi/zfcp_qdio.c
+++ b/drivers/s390/scsi/zfcp_qdio.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Setup and helper functions to access QDIO. 4 * Setup and helper functions to access QDIO.
5 * 5 *
6 * Copyright IBM Corporation 2002, 2008 6 * Copyright IBM Corporation 2002, 2009
7 */ 7 */
8 8
9#define KMSG_COMPONENT "zfcp" 9#define KMSG_COMPONENT "zfcp"
@@ -165,12 +165,14 @@ static void zfcp_qdio_int_resp(struct ccw_device *cdev, unsigned int qdio_err,
165 165
166/** 166/**
167 * zfcp_qdio_sbale_req - return ptr to SBALE of req_q for a struct zfcp_fsf_req 167 * zfcp_qdio_sbale_req - return ptr to SBALE of req_q for a struct zfcp_fsf_req
168 * @fsf_req: pointer to struct fsf_req 168 * @adapter: pointer to struct zfcp_adapter
169 * @q_rec: pointer to struct zfcp_queue_rec
169 * Returns: pointer to qdio_buffer_element (SBALE) structure 170 * Returns: pointer to qdio_buffer_element (SBALE) structure
170 */ 171 */
171struct qdio_buffer_element *zfcp_qdio_sbale_req(struct zfcp_fsf_req *req) 172struct qdio_buffer_element *zfcp_qdio_sbale_req(struct zfcp_adapter *adapter,
173 struct zfcp_queue_req *q_req)
172{ 174{
173 return zfcp_qdio_sbale(&req->adapter->req_q, req->sbal_last, 0); 175 return zfcp_qdio_sbale(&adapter->req_q, q_req->sbal_last, 0);
174} 176}
175 177
176/** 178/**
@@ -178,74 +180,80 @@ struct qdio_buffer_element *zfcp_qdio_sbale_req(struct zfcp_fsf_req *req)
178 * @fsf_req: pointer to struct fsf_req 180 * @fsf_req: pointer to struct fsf_req
179 * Returns: pointer to qdio_buffer_element (SBALE) structure 181 * Returns: pointer to qdio_buffer_element (SBALE) structure
180 */ 182 */
181struct qdio_buffer_element *zfcp_qdio_sbale_curr(struct zfcp_fsf_req *req) 183struct qdio_buffer_element *zfcp_qdio_sbale_curr(struct zfcp_adapter *adapter,
184 struct zfcp_queue_req *q_req)
182{ 185{
183 return zfcp_qdio_sbale(&req->adapter->req_q, req->sbal_last, 186 return zfcp_qdio_sbale(&adapter->req_q, q_req->sbal_last,
184 req->sbale_curr); 187 q_req->sbale_curr);
185} 188}
186 189
187static void zfcp_qdio_sbal_limit(struct zfcp_fsf_req *fsf_req, int max_sbals) 190static void zfcp_qdio_sbal_limit(struct zfcp_adapter *adapter,
191 struct zfcp_queue_req *q_req, int max_sbals)
188{ 192{
189 int count = atomic_read(&fsf_req->adapter->req_q.count); 193 int count = atomic_read(&adapter->req_q.count);
190 count = min(count, max_sbals); 194 count = min(count, max_sbals);
191 fsf_req->sbal_limit = (fsf_req->sbal_first + count - 1) 195 q_req->sbal_limit = (q_req->sbal_first + count - 1)
192 % QDIO_MAX_BUFFERS_PER_Q; 196 % QDIO_MAX_BUFFERS_PER_Q;
193} 197}
194 198
195static struct qdio_buffer_element * 199static struct qdio_buffer_element *
196zfcp_qdio_sbal_chain(struct zfcp_fsf_req *fsf_req, unsigned long sbtype) 200zfcp_qdio_sbal_chain(struct zfcp_adapter *adapter, struct zfcp_queue_req *q_req,
201 unsigned long sbtype)
197{ 202{
198 struct qdio_buffer_element *sbale; 203 struct qdio_buffer_element *sbale;
199 204
200 /* set last entry flag in current SBALE of current SBAL */ 205 /* set last entry flag in current SBALE of current SBAL */
201 sbale = zfcp_qdio_sbale_curr(fsf_req); 206 sbale = zfcp_qdio_sbale_curr(adapter, q_req);
202 sbale->flags |= SBAL_FLAGS_LAST_ENTRY; 207 sbale->flags |= SBAL_FLAGS_LAST_ENTRY;
203 208
204 /* don't exceed last allowed SBAL */ 209 /* don't exceed last allowed SBAL */
205 if (fsf_req->sbal_last == fsf_req->sbal_limit) 210 if (q_req->sbal_last == q_req->sbal_limit)
206 return NULL; 211 return NULL;
207 212
208 /* set chaining flag in first SBALE of current SBAL */ 213 /* set chaining flag in first SBALE of current SBAL */
209 sbale = zfcp_qdio_sbale_req(fsf_req); 214 sbale = zfcp_qdio_sbale_req(adapter, q_req);
210 sbale->flags |= SBAL_FLAGS0_MORE_SBALS; 215 sbale->flags |= SBAL_FLAGS0_MORE_SBALS;
211 216
212 /* calculate index of next SBAL */ 217 /* calculate index of next SBAL */
213 fsf_req->sbal_last++; 218 q_req->sbal_last++;
214 fsf_req->sbal_last %= QDIO_MAX_BUFFERS_PER_Q; 219 q_req->sbal_last %= QDIO_MAX_BUFFERS_PER_Q;
215 220
216 /* keep this requests number of SBALs up-to-date */ 221 /* keep this requests number of SBALs up-to-date */
217 fsf_req->sbal_number++; 222 q_req->sbal_number++;
218 223
219 /* start at first SBALE of new SBAL */ 224 /* start at first SBALE of new SBAL */
220 fsf_req->sbale_curr = 0; 225 q_req->sbale_curr = 0;
221 226
222 /* set storage-block type for new SBAL */ 227 /* set storage-block type for new SBAL */
223 sbale = zfcp_qdio_sbale_curr(fsf_req); 228 sbale = zfcp_qdio_sbale_curr(adapter, q_req);
224 sbale->flags |= sbtype; 229 sbale->flags |= sbtype;
225 230
226 return sbale; 231 return sbale;
227} 232}
228 233
229static struct qdio_buffer_element * 234static struct qdio_buffer_element *
230zfcp_qdio_sbale_next(struct zfcp_fsf_req *fsf_req, unsigned long sbtype) 235zfcp_qdio_sbale_next(struct zfcp_adapter *adapter, struct zfcp_queue_req *q_req,
236 unsigned int sbtype)
231{ 237{
232 if (fsf_req->sbale_curr == ZFCP_LAST_SBALE_PER_SBAL) 238 if (q_req->sbale_curr == ZFCP_LAST_SBALE_PER_SBAL)
233 return zfcp_qdio_sbal_chain(fsf_req, sbtype); 239 return zfcp_qdio_sbal_chain(adapter, q_req, sbtype);
234 fsf_req->sbale_curr++; 240 q_req->sbale_curr++;
235 return zfcp_qdio_sbale_curr(fsf_req); 241 return zfcp_qdio_sbale_curr(adapter, q_req);
236} 242}
237 243
238static void zfcp_qdio_undo_sbals(struct zfcp_fsf_req *fsf_req) 244static void zfcp_qdio_undo_sbals(struct zfcp_adapter *adapter,
245 struct zfcp_queue_req *q_req)
239{ 246{
240 struct qdio_buffer **sbal = fsf_req->adapter->req_q.sbal; 247 struct qdio_buffer **sbal = adapter->req_q.sbal;
241 int first = fsf_req->sbal_first; 248 int first = q_req->sbal_first;
242 int last = fsf_req->sbal_last; 249 int last = q_req->sbal_last;
243 int count = (last - first + QDIO_MAX_BUFFERS_PER_Q) % 250 int count = (last - first + QDIO_MAX_BUFFERS_PER_Q) %
244 QDIO_MAX_BUFFERS_PER_Q + 1; 251 QDIO_MAX_BUFFERS_PER_Q + 1;
245 zfcp_qdio_zero_sbals(sbal, first, count); 252 zfcp_qdio_zero_sbals(sbal, first, count);
246} 253}
247 254
248static int zfcp_qdio_fill_sbals(struct zfcp_fsf_req *fsf_req, 255static int zfcp_qdio_fill_sbals(struct zfcp_adapter *adapter,
256 struct zfcp_queue_req *q_req,
249 unsigned int sbtype, void *start_addr, 257 unsigned int sbtype, void *start_addr,
250 unsigned int total_length) 258 unsigned int total_length)
251{ 259{
@@ -256,10 +264,10 @@ static int zfcp_qdio_fill_sbals(struct zfcp_fsf_req *fsf_req,
256 /* split segment up */ 264 /* split segment up */
257 for (addr = start_addr, remaining = total_length; remaining > 0; 265 for (addr = start_addr, remaining = total_length; remaining > 0;
258 addr += length, remaining -= length) { 266 addr += length, remaining -= length) {
259 sbale = zfcp_qdio_sbale_next(fsf_req, sbtype); 267 sbale = zfcp_qdio_sbale_next(adapter, q_req, sbtype);
260 if (!sbale) { 268 if (!sbale) {
261 atomic_inc(&fsf_req->adapter->qdio_outb_full); 269 atomic_inc(&adapter->qdio_outb_full);
262 zfcp_qdio_undo_sbals(fsf_req); 270 zfcp_qdio_undo_sbals(adapter, q_req);
263 return -EINVAL; 271 return -EINVAL;
264 } 272 }
265 273
@@ -281,29 +289,31 @@ static int zfcp_qdio_fill_sbals(struct zfcp_fsf_req *fsf_req,
281 * @max_sbals: upper bound for number of SBALs to be used 289 * @max_sbals: upper bound for number of SBALs to be used
282 * Returns: number of bytes, or error (negativ) 290 * Returns: number of bytes, or error (negativ)
283 */ 291 */
284int zfcp_qdio_sbals_from_sg(struct zfcp_fsf_req *fsf_req, unsigned long sbtype, 292int zfcp_qdio_sbals_from_sg(struct zfcp_adapter *adapter,
285 struct scatterlist *sg, int max_sbals) 293 struct zfcp_queue_req *q_req,
294 unsigned long sbtype, struct scatterlist *sg,
295 int max_sbals)
286{ 296{
287 struct qdio_buffer_element *sbale; 297 struct qdio_buffer_element *sbale;
288 int retval, bytes = 0; 298 int retval, bytes = 0;
289 299
290 /* figure out last allowed SBAL */ 300 /* figure out last allowed SBAL */
291 zfcp_qdio_sbal_limit(fsf_req, max_sbals); 301 zfcp_qdio_sbal_limit(adapter, q_req, max_sbals);
292 302
293 /* set storage-block type for this request */ 303 /* set storage-block type for this request */
294 sbale = zfcp_qdio_sbale_req(fsf_req); 304 sbale = zfcp_qdio_sbale_req(adapter, q_req);
295 sbale->flags |= sbtype; 305 sbale->flags |= sbtype;
296 306
297 for (; sg; sg = sg_next(sg)) { 307 for (; sg; sg = sg_next(sg)) {
298 retval = zfcp_qdio_fill_sbals(fsf_req, sbtype, sg_virt(sg), 308 retval = zfcp_qdio_fill_sbals(adapter, q_req, sbtype,
299 sg->length); 309 sg_virt(sg), sg->length);
300 if (retval < 0) 310 if (retval < 0)
301 return retval; 311 return retval;
302 bytes += sg->length; 312 bytes += sg->length;
303 } 313 }
304 314
305 /* assume that no other SBALEs are to follow in the same SBAL */ 315 /* assume that no other SBALEs are to follow in the same SBAL */
306 sbale = zfcp_qdio_sbale_curr(fsf_req); 316 sbale = zfcp_qdio_sbale_curr(adapter, q_req);
307 sbale->flags |= SBAL_FLAGS_LAST_ENTRY; 317 sbale->flags |= SBAL_FLAGS_LAST_ENTRY;
308 318
309 return bytes; 319 return bytes;
@@ -314,12 +324,11 @@ int zfcp_qdio_sbals_from_sg(struct zfcp_fsf_req *fsf_req, unsigned long sbtype,
314 * @fsf_req: pointer to struct zfcp_fsf_req 324 * @fsf_req: pointer to struct zfcp_fsf_req
315 * Returns: 0 on success, error otherwise 325 * Returns: 0 on success, error otherwise
316 */ 326 */
317int zfcp_qdio_send(struct zfcp_fsf_req *fsf_req) 327int zfcp_qdio_send(struct zfcp_adapter *adapter, struct zfcp_queue_req *q_req)
318{ 328{
319 struct zfcp_adapter *adapter = fsf_req->adapter;
320 struct zfcp_qdio_queue *req_q = &adapter->req_q; 329 struct zfcp_qdio_queue *req_q = &adapter->req_q;
321 int first = fsf_req->sbal_first; 330 int first = q_req->sbal_first;
322 int count = fsf_req->sbal_number; 331 int count = q_req->sbal_number;
323 int retval; 332 int retval;
324 unsigned int qdio_flags = QDIO_FLAG_SYNC_OUTPUT; 333 unsigned int qdio_flags = QDIO_FLAG_SYNC_OUTPUT;
325 334