diff options
author | Swen Schillig <swen@vnet.ibm.com> | 2010-07-16 15:37:37 +0200 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-07-28 09:48:49 -0500 |
commit | 01b047599ade30051bf6c14fbe64181d1fec3dfa (patch) | |
tree | 3a44039ec1c48b41ba8e988c230291aca20b833c /drivers/s390/scsi/zfcp_qdio.h | |
parent | faf4cd854203b26527d81e7e13d66e78774dad44 (diff) |
[SCSI] zfcp: Cleanup function parameters for sbal value.
A lot of functions require the amount of SBALs as one of their
parameter which is most times invariable. Therefore remove this
parameter and set the SBAL value explicitly if a non standard value is
required. In addition the warning message "oversized data" is
replaced with a BUG_ON() statement assuring the limits defined and
requested by zfcp.
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>
Diffstat (limited to 'drivers/s390/scsi/zfcp_qdio.h')
-rw-r--r-- | drivers/s390/scsi/zfcp_qdio.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/s390/scsi/zfcp_qdio.h b/drivers/s390/scsi/zfcp_qdio.h index 138fba577b4..8bb00545f19 100644 --- a/drivers/s390/scsi/zfcp_qdio.h +++ b/drivers/s390/scsi/zfcp_qdio.h @@ -19,6 +19,14 @@ /* index of last SBALE (with respect to DMQ bug workaround) */ #define ZFCP_QDIO_LAST_SBALE_PER_SBAL (ZFCP_QDIO_MAX_SBALES_PER_SBAL - 1) +/* Max SBALS for chaining */ +#define ZFCP_QDIO_MAX_SBALS_PER_REQ 36 + +/* max. number of (data buffer) SBALEs in largest SBAL chain + * request ID + QTCB in SBALE 0 + 1 of first SBAL in chain */ +#define ZFCP_QDIO_MAX_SBALES_PER_REQ \ + (ZFCP_QDIO_MAX_SBALS_PER_REQ * ZFCP_QDIO_MAX_SBALES_PER_SBAL - 2) + /** * struct zfcp_qdio_queue - qdio queue buffer, zfcp index and free count * @sbal: qdio buffers @@ -134,10 +142,14 @@ void zfcp_qdio_req_init(struct zfcp_qdio *qdio, struct zfcp_qdio_req *q_req, unsigned long req_id, u32 sbtype, void *data, u32 len) { struct qdio_buffer_element *sbale; + int count = min(atomic_read(&qdio->req_q.count), + ZFCP_QDIO_MAX_SBALS_PER_REQ); q_req->sbal_first = q_req->sbal_last = qdio->req_q.first; q_req->sbal_number = 1; q_req->sbtype = sbtype; + q_req->sbal_limit = (q_req->sbal_first + count - 1) + % QDIO_MAX_BUFFERS_PER_Q; sbale = zfcp_qdio_sbale_req(qdio, q_req); sbale->addr = (void *) req_id; @@ -210,4 +222,20 @@ void zfcp_qdio_skip_to_last_sbale(struct zfcp_qdio_req *q_req) q_req->sbale_curr = ZFCP_QDIO_LAST_SBALE_PER_SBAL; } +/** + * zfcp_qdio_sbal_limit - set the sbal limit for a request in q_req + * @qdio: pointer to struct zfcp_qdio + * @q_req: The current zfcp_qdio_req + * @max_sbals: maximum number of SBALs allowed + */ +static inline +void zfcp_qdio_sbal_limit(struct zfcp_qdio *qdio, + struct zfcp_qdio_req *q_req, int max_sbals) +{ + int count = min(atomic_read(&qdio->req_q.count), max_sbals); + + q_req->sbal_limit = (q_req->sbal_first + count - 1) % + QDIO_MAX_BUFFERS_PER_Q; +} + #endif /* ZFCP_QDIO_H */ |