Commit 42428f747a8a0db9c6de03e105932316defad65d
Committed by
James Bottomley
1 parent
4544683a4b
Exists in
master
and in
20 other branches
[SCSI] zfcp: Separate qdio attributes from zfcp_fsf_req
Split all qdio related attributes out of zfcp_fsf_req and put it in new structure. Signed-off-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Showing 5 changed files with 160 additions and 115 deletions Side-by-side Diff
drivers/s390/scsi/zfcp_dbf.c
... | ... | @@ -152,9 +152,9 @@ |
152 | 152 | memcpy(response->fsf_status_qual, |
153 | 153 | fsf_status_qual, FSF_STATUS_QUALIFIER_SIZE); |
154 | 154 | response->fsf_req_status = fsf_req->status; |
155 | - response->sbal_first = fsf_req->sbal_first; | |
156 | - response->sbal_last = fsf_req->sbal_last; | |
157 | - response->sbal_response = fsf_req->sbal_response; | |
155 | + response->sbal_first = fsf_req->queue_req.sbal_first; | |
156 | + response->sbal_last = fsf_req->queue_req.sbal_last; | |
157 | + response->sbal_response = fsf_req->queue_req.sbal_response; | |
158 | 158 | response->pool = fsf_req->pool != NULL; |
159 | 159 | response->erp_action = (unsigned long)fsf_req->erp_action; |
160 | 160 |
drivers/s390/scsi/zfcp_def.h
... | ... | @@ -529,36 +529,64 @@ |
529 | 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 | + */ | |
543 | +struct 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 | + */ | |
533 | 573 | struct zfcp_fsf_req { |
534 | - struct list_head list; /* list of FSF requests */ | |
535 | - unsigned long req_id; /* unique request ID */ | |
536 | - struct zfcp_adapter *adapter; /* adapter request belongs to */ | |
537 | - u8 sbal_number; /* nr of SBALs free for use */ | |
538 | - u8 sbal_first; /* first SBAL for this request */ | |
539 | - u8 sbal_last; /* last SBAL for this request */ | |
540 | - u8 sbal_limit; /* last possible SBAL for | |
541 | - this reuest */ | |
542 | - u8 sbale_curr; /* current SBALE during creation | |
543 | - of request */ | |
544 | - u8 sbal_response; /* SBAL used in interrupt */ | |
545 | - struct completion completion; /* can be used by a routine | |
546 | - to wait for completion */ | |
547 | - u32 status; /* status of this request */ | |
548 | - u32 fsf_command; /* FSF Command copy */ | |
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; | |
574 | + struct list_head list; | |
575 | + unsigned long req_id; | |
576 | + struct zfcp_adapter *adapter; | |
577 | + struct zfcp_queue_req queue_req; | |
578 | + struct completion completion; | |
579 | + u32 status; | |
580 | + u32 fsf_command; | |
581 | + struct fsf_qtcb *qtcb; | |
582 | + u32 seq_no; | |
583 | + void *data; | |
584 | + struct timer_list timer; | |
585 | + struct zfcp_erp_action *erp_action; | |
586 | + mempool_t *pool; | |
587 | + unsigned long long issued; | |
588 | + struct zfcp_unit *unit; | |
559 | 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 | 592 | /* driver data */ |
drivers/s390/scsi/zfcp_ext.h
... | ... | @@ -142,10 +142,13 @@ |
142 | 142 | /* zfcp_qdio.c */ |
143 | 143 | extern int zfcp_qdio_allocate(struct zfcp_adapter *); |
144 | 144 | extern void zfcp_qdio_free(struct zfcp_adapter *); |
145 | -extern int zfcp_qdio_send(struct zfcp_fsf_req *); | |
146 | -extern struct qdio_buffer_element *zfcp_qdio_sbale_req(struct zfcp_fsf_req *); | |
147 | -extern struct qdio_buffer_element *zfcp_qdio_sbale_curr(struct zfcp_fsf_req *); | |
148 | -extern int zfcp_qdio_sbals_from_sg(struct zfcp_fsf_req *, unsigned long, | |
145 | +extern int zfcp_qdio_send(struct zfcp_adapter *, struct zfcp_queue_req *); | |
146 | +extern struct qdio_buffer_element | |
147 | + *zfcp_qdio_sbale_req(struct zfcp_adapter *, struct zfcp_queue_req *); | |
148 | +extern struct qdio_buffer_element | |
149 | + *zfcp_qdio_sbale_curr(struct zfcp_adapter *, struct zfcp_queue_req *); | |
150 | +extern int zfcp_qdio_sbals_from_sg(struct zfcp_adapter *, | |
151 | + struct zfcp_queue_req *, unsigned long, | |
149 | 152 | struct scatterlist *, int); |
150 | 153 | extern int zfcp_qdio_open(struct zfcp_adapter *); |
151 | 154 | extern void zfcp_qdio_close(struct zfcp_adapter *); |
drivers/s390/scsi/zfcp_fsf.c
... | ... | @@ -720,12 +720,12 @@ |
720 | 720 | req->adapter = adapter; |
721 | 721 | req->fsf_command = fsf_cmd; |
722 | 722 | req->req_id = adapter->req_no; |
723 | - req->sbal_number = 1; | |
724 | - req->sbal_first = req_q->first; | |
725 | - req->sbal_last = req_q->first; | |
726 | - req->sbale_curr = 1; | |
723 | + req->queue_req.sbal_number = 1; | |
724 | + req->queue_req.sbal_first = req_q->first; | |
725 | + req->queue_req.sbal_last = req_q->first; | |
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 | 729 | sbale[0].addr = (void *) req->req_id; |
730 | 730 | sbale[0].flags |= SBAL_FLAGS0_COMMAND; |
731 | 731 | |
732 | 732 | |
... | ... | @@ -774,9 +774,9 @@ |
774 | 774 | list_add_tail(&req->list, &adapter->req_list[idx]); |
775 | 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 | 778 | req->issued = get_clock(); |
779 | - if (zfcp_qdio_send(req)) { | |
779 | + if (zfcp_qdio_send(adapter, &req->queue_req)) { | |
780 | 780 | del_timer(&req->timer); |
781 | 781 | spin_lock_irqsave(&adapter->req_list_lock, flags); |
782 | 782 | /* lookup request again, list might have changed */ |
783 | 783 | |
... | ... | @@ -819,9 +819,9 @@ |
819 | 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 | 823 | sbale[2].flags |= SBAL_FLAGS_LAST_ENTRY; |
824 | - req->sbale_curr = 2; | |
824 | + req->queue_req.sbale_curr = 2; | |
825 | 825 | |
826 | 826 | sr_buf = mempool_alloc(adapter->pool.status_read_data, GFP_ATOMIC); |
827 | 827 | if (!sr_buf) { |
... | ... | @@ -830,7 +830,7 @@ |
830 | 830 | } |
831 | 831 | memset(sr_buf, 0, sizeof(*sr_buf)); |
832 | 832 | req->data = sr_buf; |
833 | - sbale = zfcp_qdio_sbale_curr(req); | |
833 | + sbale = zfcp_qdio_sbale_curr(adapter, &req->queue_req); | |
834 | 834 | sbale->addr = (void *) sr_buf; |
835 | 835 | sbale->length = sizeof(*sr_buf); |
836 | 836 | |
... | ... | @@ -929,7 +929,7 @@ |
929 | 929 | ZFCP_STATUS_COMMON_UNBLOCKED))) |
930 | 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 | 933 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; |
934 | 934 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; |
935 | 935 | |
... | ... | @@ -1023,8 +1023,10 @@ |
1023 | 1023 | struct scatterlist *sg_resp, |
1024 | 1024 | int max_sbals) |
1025 | 1025 | { |
1026 | - struct qdio_buffer_element *sbale = zfcp_qdio_sbale_req(req); | |
1027 | - u32 feat = req->adapter->adapter_features; | |
1026 | + struct zfcp_adapter *adapter = req->adapter; | |
1027 | + struct qdio_buffer_element *sbale = zfcp_qdio_sbale_req(adapter, | |
1028 | + &req->queue_req); | |
1029 | + u32 feat = adapter->adapter_features; | |
1028 | 1030 | int bytes; |
1029 | 1031 | |
1030 | 1032 | if (!(feat & FSF_FEATURE_ELS_CT_CHAINED_SBALS)) { |
1031 | 1033 | |
1032 | 1034 | |
... | ... | @@ -1041,14 +1043,16 @@ |
1041 | 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 | 1048 | sg_req, max_sbals); |
1046 | 1049 | if (bytes <= 0) |
1047 | 1050 | return -EIO; |
1048 | 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 | 1056 | sg_resp, max_sbals); |
1053 | 1057 | if (bytes <= 0) |
1054 | 1058 | return -EIO; |
... | ... | @@ -1241,7 +1245,7 @@ |
1241 | 1245 | } |
1242 | 1246 | |
1243 | 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 | 1249 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; |
1246 | 1250 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; |
1247 | 1251 | |
... | ... | @@ -1283,7 +1287,7 @@ |
1283 | 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 | 1291 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; |
1288 | 1292 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; |
1289 | 1293 | req->handler = zfcp_fsf_exchange_config_data_handler; |
... | ... | @@ -1339,7 +1343,7 @@ |
1339 | 1343 | } |
1340 | 1344 | |
1341 | 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 | 1347 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; |
1344 | 1348 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; |
1345 | 1349 | |
... | ... | @@ -1388,7 +1392,7 @@ |
1388 | 1392 | if (data) |
1389 | 1393 | req->data = data; |
1390 | 1394 | |
1391 | - sbale = zfcp_qdio_sbale_req(req); | |
1395 | + sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req); | |
1392 | 1396 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; |
1393 | 1397 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; |
1394 | 1398 | |
... | ... | @@ -1509,7 +1513,7 @@ |
1509 | 1513 | } |
1510 | 1514 | |
1511 | 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 | 1517 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; |
1514 | 1518 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; |
1515 | 1519 | |
... | ... | @@ -1579,7 +1583,7 @@ |
1579 | 1583 | } |
1580 | 1584 | |
1581 | 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 | 1587 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; |
1584 | 1588 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; |
1585 | 1589 | |
... | ... | @@ -1656,7 +1660,7 @@ |
1656 | 1660 | } |
1657 | 1661 | |
1658 | 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 | 1664 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; |
1661 | 1665 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; |
1662 | 1666 | |
... | ... | @@ -1711,7 +1715,7 @@ |
1711 | 1715 | } |
1712 | 1716 | |
1713 | 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 | 1719 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; |
1716 | 1720 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; |
1717 | 1721 | |
... | ... | @@ -1803,7 +1807,7 @@ |
1803 | 1807 | } |
1804 | 1808 | |
1805 | 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 | 1811 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; |
1808 | 1812 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; |
1809 | 1813 | |
... | ... | @@ -1976,7 +1980,7 @@ |
1976 | 1980 | } |
1977 | 1981 | |
1978 | 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 | 1984 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; |
1981 | 1985 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; |
1982 | 1986 | |
... | ... | @@ -2063,7 +2067,7 @@ |
2063 | 2067 | } |
2064 | 2068 | |
2065 | 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 | 2071 | sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; |
2068 | 2072 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; |
2069 | 2073 | |
... | ... | @@ -2140,8 +2144,8 @@ |
2140 | 2144 | } |
2141 | 2145 | if (fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR) |
2142 | 2146 | trace.flags |= ZFCP_BLK_REQ_ERROR; |
2143 | - trace.inb_usage = fsf_req->qdio_inb_usage; | |
2144 | - trace.outb_usage = fsf_req->qdio_outb_usage; | |
2147 | + trace.inb_usage = fsf_req->queue_req.qdio_inb_usage; | |
2148 | + trace.outb_usage = fsf_req->queue_req.qdio_outb_usage; | |
2145 | 2149 | |
2146 | 2150 | blk_add_driver_data(req->q, req, &trace, sizeof(trace)); |
2147 | 2151 | } |
2148 | 2152 | |
... | ... | @@ -2420,11 +2424,11 @@ |
2420 | 2424 | req->qtcb->bottom.io.fcp_cmnd_length = sizeof(struct fcp_cmnd_iu) + |
2421 | 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 | 2428 | scsi_sglist(scsi_cmnd), |
2425 | 2429 | FSF_MAX_SBALS_PER_REQ); |
2426 | 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 | 2432 | dev_err(&adapter->ccw_device->dev, |
2429 | 2433 | "Oversize data package, unit 0x%016Lx " |
2430 | 2434 | "on port 0x%016Lx closed\n", |
... | ... | @@ -2492,7 +2496,7 @@ |
2492 | 2496 | req->qtcb->bottom.io.fcp_cmnd_length = sizeof(struct fcp_cmnd_iu) + |
2493 | 2497 | sizeof(u32); |
2494 | 2498 | |
2495 | - sbale = zfcp_qdio_sbale_req(req); | |
2499 | + sbale = zfcp_qdio_sbale_req(adapter, &req->queue_req); | |
2496 | 2500 | sbale[0].flags |= SBAL_FLAGS0_TYPE_WRITE; |
2497 | 2501 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; |
2498 | 2502 | |
2499 | 2503 | |
... | ... | @@ -2555,15 +2559,15 @@ |
2555 | 2559 | |
2556 | 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 | 2563 | sbale[0].flags |= direction; |
2560 | 2564 | |
2561 | 2565 | bottom = &req->qtcb->bottom.support; |
2562 | 2566 | bottom->operation_subtype = FSF_CFDC_OPERATION_SUBTYPE; |
2563 | 2567 | bottom->option = fsf_cfdc->option; |
2564 | 2568 | |
2565 | - bytes = zfcp_qdio_sbals_from_sg(req, direction, fsf_cfdc->sg, | |
2566 | - FSF_MAX_SBALS_PER_REQ); | |
2569 | + bytes = zfcp_qdio_sbals_from_sg(adapter, &req->queue_req, direction, | |
2570 | + fsf_cfdc->sg, FSF_MAX_SBALS_PER_REQ); | |
2567 | 2571 | if (bytes != ZFCP_CFDC_MAX_SIZE) { |
2568 | 2572 | zfcp_fsf_req_free(req); |
2569 | 2573 | goto out; |
... | ... | @@ -2612,8 +2616,9 @@ |
2612 | 2616 | list_del(&fsf_req->list); |
2613 | 2617 | spin_unlock_irqrestore(&adapter->req_list_lock, flags); |
2614 | 2618 | |
2615 | - fsf_req->sbal_response = sbal_idx; | |
2616 | - fsf_req->qdio_inb_usage = atomic_read(&adapter->resp_q.count); | |
2619 | + fsf_req->queue_req.sbal_response = sbal_idx; | |
2620 | + fsf_req->queue_req.qdio_inb_usage = | |
2621 | + atomic_read(&adapter->resp_q.count); | |
2617 | 2622 | zfcp_fsf_req_complete(fsf_req); |
2618 | 2623 | |
2619 | 2624 | if (likely(sbale->flags & SBAL_FLAGS_LAST_ENTRY)) |
drivers/s390/scsi/zfcp_qdio.c
... | ... | @@ -3,7 +3,7 @@ |
3 | 3 | * |
4 | 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 | 9 | #define KMSG_COMPONENT "zfcp" |
10 | 10 | |
11 | 11 | |
... | ... | @@ -165,12 +165,14 @@ |
165 | 165 | |
166 | 166 | /** |
167 | 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 | 170 | * Returns: pointer to qdio_buffer_element (SBALE) structure |
170 | 171 | */ |
171 | -struct qdio_buffer_element *zfcp_qdio_sbale_req(struct zfcp_fsf_req *req) | |
172 | +struct 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 | /** |
177 | 179 | |
178 | 180 | |
179 | 181 | |
180 | 182 | |
181 | 183 | |
182 | 184 | |
183 | 185 | |
184 | 186 | |
185 | 187 | |
186 | 188 | |
187 | 189 | |
188 | 190 | |
189 | 191 | |
190 | 192 | |
191 | 193 | |
192 | 194 | |
193 | 195 | |
... | ... | @@ -178,74 +180,80 @@ |
178 | 180 | * @fsf_req: pointer to struct fsf_req |
179 | 181 | * Returns: pointer to qdio_buffer_element (SBALE) structure |
180 | 182 | */ |
181 | -struct qdio_buffer_element *zfcp_qdio_sbale_curr(struct zfcp_fsf_req *req) | |
183 | +struct 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, | |
184 | - req->sbale_curr); | |
186 | + return zfcp_qdio_sbale(&adapter->req_q, q_req->sbal_last, | |
187 | + q_req->sbale_curr); | |
185 | 188 | } |
186 | 189 | |
187 | -static void zfcp_qdio_sbal_limit(struct zfcp_fsf_req *fsf_req, int max_sbals) | |
190 | +static 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 | 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 | 196 | % QDIO_MAX_BUFFERS_PER_Q; |
193 | 197 | } |
194 | 198 | |
195 | 199 | static struct qdio_buffer_element * |
196 | -zfcp_qdio_sbal_chain(struct zfcp_fsf_req *fsf_req, unsigned long sbtype) | |
200 | +zfcp_qdio_sbal_chain(struct zfcp_adapter *adapter, struct zfcp_queue_req *q_req, | |
201 | + unsigned long sbtype) | |
197 | 202 | { |
198 | 203 | struct qdio_buffer_element *sbale; |
199 | 204 | |
200 | 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 | 207 | sbale->flags |= SBAL_FLAGS_LAST_ENTRY; |
203 | 208 | |
204 | 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 | 211 | return NULL; |
207 | 212 | |
208 | 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 | 215 | sbale->flags |= SBAL_FLAGS0_MORE_SBALS; |
211 | 216 | |
212 | 217 | /* calculate index of next SBAL */ |
213 | - fsf_req->sbal_last++; | |
214 | - fsf_req->sbal_last %= QDIO_MAX_BUFFERS_PER_Q; | |
218 | + q_req->sbal_last++; | |
219 | + q_req->sbal_last %= QDIO_MAX_BUFFERS_PER_Q; | |
215 | 220 | |
216 | 221 | /* keep this requests number of SBALs up-to-date */ |
217 | - fsf_req->sbal_number++; | |
222 | + q_req->sbal_number++; | |
218 | 223 | |
219 | 224 | /* start at first SBALE of new SBAL */ |
220 | - fsf_req->sbale_curr = 0; | |
225 | + q_req->sbale_curr = 0; | |
221 | 226 | |
222 | 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 | 229 | sbale->flags |= sbtype; |
225 | 230 | |
226 | 231 | return sbale; |
227 | 232 | } |
228 | 233 | |
229 | 234 | static struct qdio_buffer_element * |
230 | -zfcp_qdio_sbale_next(struct zfcp_fsf_req *fsf_req, unsigned long sbtype) | |
235 | +zfcp_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) | |
233 | - return zfcp_qdio_sbal_chain(fsf_req, sbtype); | |
234 | - fsf_req->sbale_curr++; | |
235 | - return zfcp_qdio_sbale_curr(fsf_req); | |
238 | + if (q_req->sbale_curr == ZFCP_LAST_SBALE_PER_SBAL) | |
239 | + return zfcp_qdio_sbal_chain(adapter, q_req, sbtype); | |
240 | + q_req->sbale_curr++; | |
241 | + return zfcp_qdio_sbale_curr(adapter, q_req); | |
236 | 242 | } |
237 | 243 | |
238 | -static void zfcp_qdio_undo_sbals(struct zfcp_fsf_req *fsf_req) | |
244 | +static 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; | |
241 | - int first = fsf_req->sbal_first; | |
242 | - int last = fsf_req->sbal_last; | |
247 | + struct qdio_buffer **sbal = adapter->req_q.sbal; | |
248 | + int first = q_req->sbal_first; | |
249 | + int last = q_req->sbal_last; | |
243 | 250 | int count = (last - first + QDIO_MAX_BUFFERS_PER_Q) % |
244 | 251 | QDIO_MAX_BUFFERS_PER_Q + 1; |
245 | 252 | zfcp_qdio_zero_sbals(sbal, first, count); |
246 | 253 | } |
247 | 254 | |
248 | -static int zfcp_qdio_fill_sbals(struct zfcp_fsf_req *fsf_req, | |
255 | +static int zfcp_qdio_fill_sbals(struct zfcp_adapter *adapter, | |
256 | + struct zfcp_queue_req *q_req, | |
249 | 257 | unsigned int sbtype, void *start_addr, |
250 | 258 | unsigned int total_length) |
251 | 259 | { |
252 | 260 | |
... | ... | @@ -256,10 +264,10 @@ |
256 | 264 | /* split segment up */ |
257 | 265 | for (addr = start_addr, remaining = total_length; remaining > 0; |
258 | 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 | 268 | if (!sbale) { |
261 | - atomic_inc(&fsf_req->adapter->qdio_outb_full); | |
262 | - zfcp_qdio_undo_sbals(fsf_req); | |
269 | + atomic_inc(&adapter->qdio_outb_full); | |
270 | + zfcp_qdio_undo_sbals(adapter, q_req); | |
263 | 271 | return -EINVAL; |
264 | 272 | } |
265 | 273 | |
266 | 274 | |
267 | 275 | |
268 | 276 | |
269 | 277 | |
... | ... | @@ -281,29 +289,31 @@ |
281 | 289 | * @max_sbals: upper bound for number of SBALs to be used |
282 | 290 | * Returns: number of bytes, or error (negativ) |
283 | 291 | */ |
284 | -int zfcp_qdio_sbals_from_sg(struct zfcp_fsf_req *fsf_req, unsigned long sbtype, | |
285 | - struct scatterlist *sg, int max_sbals) | |
292 | +int zfcp_qdio_sbals_from_sg(struct zfcp_adapter *adapter, | |
293 | + struct zfcp_queue_req *q_req, | |
294 | + unsigned long sbtype, struct scatterlist *sg, | |
295 | + int max_sbals) | |
286 | 296 | { |
287 | 297 | struct qdio_buffer_element *sbale; |
288 | 298 | int retval, bytes = 0; |
289 | 299 | |
290 | 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 | 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 | 305 | sbale->flags |= sbtype; |
296 | 306 | |
297 | 307 | for (; sg; sg = sg_next(sg)) { |
298 | - retval = zfcp_qdio_fill_sbals(fsf_req, sbtype, sg_virt(sg), | |
299 | - sg->length); | |
308 | + retval = zfcp_qdio_fill_sbals(adapter, q_req, sbtype, | |
309 | + sg_virt(sg), sg->length); | |
300 | 310 | if (retval < 0) |
301 | 311 | return retval; |
302 | 312 | bytes += sg->length; |
303 | 313 | } |
304 | 314 | |
305 | 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 | 317 | sbale->flags |= SBAL_FLAGS_LAST_ENTRY; |
308 | 318 | |
309 | 319 | return bytes; |
310 | 320 | |
311 | 321 | |
... | ... | @@ -314,12 +324,11 @@ |
314 | 324 | * @fsf_req: pointer to struct zfcp_fsf_req |
315 | 325 | * Returns: 0 on success, error otherwise |
316 | 326 | */ |
317 | -int zfcp_qdio_send(struct zfcp_fsf_req *fsf_req) | |
327 | +int zfcp_qdio_send(struct zfcp_adapter *adapter, struct zfcp_queue_req *q_req) | |
318 | 328 | { |
319 | - struct zfcp_adapter *adapter = fsf_req->adapter; | |
320 | 329 | struct zfcp_qdio_queue *req_q = &adapter->req_q; |
321 | - int first = fsf_req->sbal_first; | |
322 | - int count = fsf_req->sbal_number; | |
330 | + int first = q_req->sbal_first; | |
331 | + int count = q_req->sbal_number; | |
323 | 332 | int retval; |
324 | 333 | unsigned int qdio_flags = QDIO_FLAG_SYNC_OUTPUT; |
325 | 334 |