summaryrefslogtreecommitdiff
path: root/sys/dev/mpr
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2018-02-06 16:02:25 +0000
committerAlexander Motin <mav@FreeBSD.org>2018-02-06 16:02:25 +0000
commit62a09ee9768521caf4111938c81a8b64fb5715c5 (patch)
tree2d577c13c6a9b56ec0a11aa9a86c1592e0d74e3e /sys/dev/mpr
parente2997a03b7f76a19fc56a6d8c3536c76617a7ad7 (diff)
Notes
Diffstat (limited to 'sys/dev/mpr')
-rw-r--r--sys/dev/mpr/mpr.c3
-rw-r--r--sys/dev/mpr/mpr_sas.c7
-rw-r--r--sys/dev/mpr/mprvar.h1
3 files changed, 7 insertions, 4 deletions
diff --git a/sys/dev/mpr/mpr.c b/sys/dev/mpr/mpr.c
index 9e9459cfde76..feb14b01f771 100644
--- a/sys/dev/mpr/mpr.c
+++ b/sys/dev/mpr/mpr.c
@@ -397,6 +397,7 @@ mpr_resize_queues(struct mpr_softc *sc)
reqcr = MIN(reqcr, sc->facts->RequestCredit);
sc->num_reqs = prireqcr + reqcr;
+ sc->num_prireqs = prireqcr;
sc->num_replies = MIN(sc->max_replyframes + sc->max_evtframes,
sc->facts->MaxReplyDescriptorPostQueueDepth) - 1;
@@ -1507,7 +1508,7 @@ mpr_alloc_requests(struct mpr_softc *sc)
/* XXX Is a failure here a critical problem? */
if (bus_dmamap_create(sc->buffer_dmat, 0, &cm->cm_dmamap)
== 0) {
- if (i <= sc->facts->HighPriorityCredit)
+ if (i <= sc->num_prireqs)
mpr_free_high_priority_command(sc, cm);
else
mpr_free_command(sc, cm);
diff --git a/sys/dev/mpr/mpr_sas.c b/sys/dev/mpr/mpr_sas.c
index e683e508db7d..70c5da8984d3 100644
--- a/sys/dev/mpr/mpr_sas.c
+++ b/sys/dev/mpr/mpr_sas.c
@@ -728,7 +728,7 @@ mpr_attach_sas(struct mpr_softc *sc)
{
struct mprsas_softc *sassc;
cam_status status;
- int unit, error = 0;
+ int unit, error = 0, reqs;
MPR_FUNCTRACE(sc);
mpr_dprint(sc, MPR_INIT, "%s entered\n", __func__);
@@ -758,7 +758,8 @@ mpr_attach_sas(struct mpr_softc *sc)
sc->sassc = sassc;
sassc->sc = sc;
- if ((sassc->devq = cam_simq_alloc(sc->num_reqs)) == NULL) {
+ reqs = sc->num_reqs - sc->num_prireqs - 1;
+ if ((sassc->devq = cam_simq_alloc(reqs)) == NULL) {
mpr_dprint(sc, MPR_INIT|MPR_ERROR, "Cannot allocate SIMQ\n");
error = ENOMEM;
goto out;
@@ -766,7 +767,7 @@ mpr_attach_sas(struct mpr_softc *sc)
unit = device_get_unit(sc->mpr_dev);
sassc->sim = cam_sim_alloc(mprsas_action, mprsas_poll, "mpr", sassc,
- unit, &sc->mpr_mtx, sc->num_reqs, sc->num_reqs, sassc->devq);
+ unit, &sc->mpr_mtx, reqs, reqs, sassc->devq);
if (sassc->sim == NULL) {
mpr_dprint(sc, MPR_INIT|MPR_ERROR, "Cannot allocate SIM\n");
error = EINVAL;
diff --git a/sys/dev/mpr/mprvar.h b/sys/dev/mpr/mprvar.h
index 2eecd98d3a15..7d3af3a95c1b 100644
--- a/sys/dev/mpr/mprvar.h
+++ b/sys/dev/mpr/mprvar.h
@@ -357,6 +357,7 @@ struct mpr_softc {
MPI2_IOC_FACTS_REPLY *facts;
int num_reqs;
+ int num_prireqs;
int num_replies;
int fqdepth; /* Free queue */
int pqdepth; /* Post queue */