Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/mps/mps.c
Show First 20 Lines • Show All 388 Lines • ▼ Show 20 Lines | mps_resize_queues(struct mps_softc *sc) | ||||
*/ | */ | ||||
prireqcr = MAX(1, sc->max_prireqframes); | prireqcr = MAX(1, sc->max_prireqframes); | ||||
prireqcr = MIN(prireqcr, sc->facts->HighPriorityCredit); | prireqcr = MIN(prireqcr, sc->facts->HighPriorityCredit); | ||||
reqcr = MAX(2, sc->max_reqframes); | reqcr = MAX(2, sc->max_reqframes); | ||||
reqcr = MIN(reqcr, sc->facts->RequestCredit); | reqcr = MIN(reqcr, sc->facts->RequestCredit); | ||||
sc->num_reqs = prireqcr + reqcr; | sc->num_reqs = prireqcr + reqcr; | ||||
sc->num_prireqs = prireqcr; | |||||
sc->num_replies = MIN(sc->max_replyframes + sc->max_evtframes, | sc->num_replies = MIN(sc->max_replyframes + sc->max_evtframes, | ||||
sc->facts->MaxReplyDescriptorPostQueueDepth) - 1; | sc->facts->MaxReplyDescriptorPostQueueDepth) - 1; | ||||
/* | /* | ||||
* Figure out the number of MSIx-based queues. If the firmware or | * Figure out the number of MSIx-based queues. If the firmware or | ||||
* user has done something crazy and not allowed enough credit for | * user has done something crazy and not allowed enough credit for | ||||
* the queues to be useful then don't enable multi-queue. | * the queues to be useful then don't enable multi-queue. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 1,043 Lines • ▼ Show 20 Lines | for (i = 1; i < sc->num_reqs; i++) { | ||||
cm->cm_sense_busaddr = sc->sense_busaddr + i * MPS_SENSE_LEN; | cm->cm_sense_busaddr = sc->sense_busaddr + i * MPS_SENSE_LEN; | ||||
cm->cm_desc.Default.SMID = i; | cm->cm_desc.Default.SMID = i; | ||||
cm->cm_sc = sc; | cm->cm_sc = sc; | ||||
TAILQ_INIT(&cm->cm_chain_list); | TAILQ_INIT(&cm->cm_chain_list); | ||||
callout_init_mtx(&cm->cm_callout, &sc->mps_mtx, 0); | callout_init_mtx(&cm->cm_callout, &sc->mps_mtx, 0); | ||||
/* XXX Is a failure here a critical problem? */ | /* XXX Is a failure here a critical problem? */ | ||||
if (bus_dmamap_create(sc->buffer_dmat, 0, &cm->cm_dmamap) == 0) | 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); | mps_free_high_priority_command(sc, cm); | ||||
else | else | ||||
mps_free_command(sc, cm); | mps_free_command(sc, cm); | ||||
else { | else { | ||||
panic("failed to allocate command %d\n", i); | panic("failed to allocate command %d\n", i); | ||||
sc->num_reqs = i; | sc->num_reqs = i; | ||||
break; | break; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,628 Lines • Show Last 20 Lines |