summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2014-03-07 22:17:04 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2014-03-07 22:17:04 +0000
commit4c26d533db46fd9ce60c0565529995ec30c8165c (patch)
tree33d60073c9574a0cb1cb2c0a3da89a33af8bdafc /sys
parent951ecdf98f87786cff16eaadb10e547fe0ffb7be (diff)
Reduce the number of ccbs by a factor three since we need up to three request
entries per SCSI command.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/qlw.c15
-rw-r--r--sys/dev/ic/qlwvar.h3
2 files changed, 11 insertions, 7 deletions
diff --git a/sys/dev/ic/qlw.c b/sys/dev/ic/qlw.c
index e270e78770b..ddf602a839f 100644
--- a/sys/dev/ic/qlw.c
+++ b/sys/dev/ic/qlw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: qlw.c,v 1.2 2014/03/07 12:45:49 kettenis Exp $ */
+/* $OpenBSD: qlw.c,v 1.3 2014/03/07 22:17:02 kettenis Exp $ */
/*
* Copyright (c) 2011 David Gwynne <dlg@openbsd.org>
@@ -222,6 +222,9 @@ qlw_attach(struct qlw_softc *sc)
sc->sc_max_queue_depth[bus] = sc->sc_maxcmds;
}
+ /* We may need up to 3 request entries per SCSI command. */
+ sc->sc_maxccbs = sc->sc_maxcmds / 3;
+
#if 0
qlw_write(sc, QLW_CFG1, sc->sc_nvram.isp_config | (1 << 13));
#endif
@@ -531,9 +534,9 @@ qlw_handle_resp(struct qlw_softc *sc, u_int16_t id)
case QLW_IOCB_STATUS:
status = (struct qla_iocb_status *)entry;
handle = letoh32(status->handle);
- if (handle > sc->sc_maxcmds) {
+ if (handle > sc->sc_maxccbs) {
panic("bad completed command handle: %d (> %d)",
- handle, sc->sc_maxcmds);
+ handle, sc->sc_maxccbs);
}
ccb = &sc->sc_ccbs[handle];
@@ -1569,7 +1572,7 @@ qlw_alloc_ccbs(struct qlw_softc *sc)
mtx_init(&sc->sc_ccb_mtx, IPL_BIO);
mtx_init(&sc->sc_queue_mtx, IPL_BIO);
- sc->sc_ccbs = malloc(sizeof(struct qlw_ccb) * sc->sc_maxcmds,
+ sc->sc_ccbs = malloc(sizeof(struct qlw_ccb) * sc->sc_maxccbs,
M_DEVBUF, M_WAITOK | M_CANFAIL | M_ZERO);
if (sc->sc_ccbs == NULL) {
printf("%s: unable to allocate ccbs\n", DEVNAME(sc));
@@ -1590,8 +1593,8 @@ qlw_alloc_ccbs(struct qlw_softc *sc)
}
cmd = QLW_DMA_KVA(sc->sc_requests);
- memset(cmd, 0, QLW_QUEUE_ENTRY_SIZE * sc->sc_maxcmds);
- for (i = 0; i < sc->sc_maxcmds; i++) {
+ memset(cmd, 0, QLW_QUEUE_ENTRY_SIZE * sc->sc_maxccbs);
+ for (i = 0; i < sc->sc_maxccbs; i++) {
ccb = &sc->sc_ccbs[i];
if (bus_dmamap_create(sc->sc_dmat, MAXPHYS,
diff --git a/sys/dev/ic/qlwvar.h b/sys/dev/ic/qlwvar.h
index 64eacaf3cf8..1a306a64100 100644
--- a/sys/dev/ic/qlwvar.h
+++ b/sys/dev/ic/qlwvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: qlwvar.h,v 1.3 2014/03/07 12:45:49 kettenis Exp $ */
+/* $OpenBSD: qlwvar.h,v 1.4 2014/03/07 22:17:03 kettenis Exp $ */
/*
* Copyright (c) 2013, 2014 Jonathan Matthew <jmatthew@openbsd.org>
@@ -98,6 +98,7 @@ struct qlw_softc {
int sc_maxcmds;
struct qlw_dmamem *sc_requests;
struct qlw_dmamem *sc_responses;
+ int sc_maxccbs;
struct qlw_ccb *sc_ccbs;
struct qlw_ccb_list sc_ccb_free;
struct mutex sc_ccb_mtx;