aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/mps
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/mps
parente2997a03b7f76a19fc56a6d8c3536c76617a7ad7 (diff)
Notes
Diffstat (limited to 'sys/dev/mps')
-rw-r--r--sys/dev/mps/mps.c3
-rw-r--r--sys/dev/mps/mps_sas.c7
-rw-r--r--sys/dev/mps/mpsvar.h1
3 files changed, 7 insertions, 4 deletions
diff --git a/sys/dev/mps/mps.c b/sys/dev/mps/mps.c
index 12085c645a0b..50f7ec467bb3 100644
--- a/sys/dev/mps/mps.c
+++ b/sys/dev/mps/mps.c
@@ -394,6 +394,7 @@ mps_resize_queues(struct mps_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;
@@ -1453,7 +1454,7 @@ mps_alloc_requests(struct mps_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)
mps_free_high_priority_command(sc, cm);
else
mps_free_command(sc, cm);
diff --git a/sys/dev/mps/mps_sas.c b/sys/dev/mps/mps_sas.c
index 1ccb8b93b54d..3f3b0f24453e 100644
--- a/sys/dev/mps/mps_sas.c
+++ b/sys/dev/mps/mps_sas.c
@@ -718,7 +718,7 @@ mps_attach_sas(struct mps_softc *sc)
{
struct mpssas_softc *sassc;
cam_status status;
- int unit, error = 0;
+ int unit, error = 0, reqs;
MPS_FUNCTRACE(sc);
mps_dprint(sc, MPS_INIT, "%s entered\n", __func__);
@@ -748,7 +748,8 @@ mps_attach_sas(struct mps_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) {
mps_dprint(sc, MPS_ERROR, "Cannot allocate SIMQ\n");
error = ENOMEM;
goto out;
@@ -756,7 +757,7 @@ mps_attach_sas(struct mps_softc *sc)
unit = device_get_unit(sc->mps_dev);
sassc->sim = cam_sim_alloc(mpssas_action, mpssas_poll, "mps", sassc,
- unit, &sc->mps_mtx, sc->num_reqs, sc->num_reqs, sassc->devq);
+ unit, &sc->mps_mtx, reqs, reqs, sassc->devq);
if (sassc->sim == NULL) {
mps_dprint(sc, MPS_INIT|MPS_ERROR, "Cannot allocate SIM\n");
error = EINVAL;
diff --git a/sys/dev/mps/mpsvar.h b/sys/dev/mps/mpsvar.h
index b0efb9da37df..4387b1fdd801 100644
--- a/sys/dev/mps/mpsvar.h
+++ b/sys/dev/mps/mpsvar.h
@@ -345,6 +345,7 @@ struct mps_softc {
MPI2_IOC_FACTS_REPLY *facts;
int num_reqs;
+ int num_prireqs;
int num_replies;
int fqdepth; /* Free queue */
int pqdepth; /* Post queue */