Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/nvme/nvme_qpair.c
Show First 20 Lines • Show All 351 Lines • ▼ Show 20 Lines | nvme_qpair_print_completion(struct nvme_qpair *qpair, | ||||
sct = NVME_STATUS_GET_SCT(cpl->status); | sct = NVME_STATUS_GET_SCT(cpl->status); | ||||
sc = NVME_STATUS_GET_SC(cpl->status); | sc = NVME_STATUS_GET_SC(cpl->status); | ||||
nvme_printf(qpair->ctrlr, "%s (%02x/%02x) sqid:%d cid:%d cdw0:%x\n", | nvme_printf(qpair->ctrlr, "%s (%02x/%02x) sqid:%d cid:%d cdw0:%x\n", | ||||
get_status_string(sct, sc), sct, sc, cpl->sqid, cpl->cid, | get_status_string(sct, sc), sct, sc, cpl->sqid, cpl->cid, | ||||
cpl->cdw0); | cpl->cdw0); | ||||
} | } | ||||
static boolean_t | static bool | ||||
nvme_completion_is_retry(const struct nvme_completion *cpl) | nvme_completion_is_retry(const struct nvme_completion *cpl) | ||||
{ | { | ||||
uint8_t sct, sc, dnr; | uint8_t sct, sc, dnr; | ||||
sct = NVME_STATUS_GET_SCT(cpl->status); | sct = NVME_STATUS_GET_SCT(cpl->status); | ||||
sc = NVME_STATUS_GET_SC(cpl->status); | sc = NVME_STATUS_GET_SC(cpl->status); | ||||
dnr = NVME_STATUS_GET_DNR(cpl->status); /* Do Not Retry Bit */ | dnr = NVME_STATUS_GET_DNR(cpl->status); /* Do Not Retry Bit */ | ||||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
static void | static void | ||||
nvme_qpair_complete_tracker(struct nvme_tracker *tr, | nvme_qpair_complete_tracker(struct nvme_tracker *tr, | ||||
struct nvme_completion *cpl, error_print_t print_on_error) | struct nvme_completion *cpl, error_print_t print_on_error) | ||||
{ | { | ||||
struct nvme_qpair * qpair = tr->qpair; | struct nvme_qpair * qpair = tr->qpair; | ||||
struct nvme_request *req; | struct nvme_request *req; | ||||
boolean_t retry, error, retriable; | bool retry, error, retriable; | ||||
req = tr->req; | req = tr->req; | ||||
error = nvme_completion_is_error(cpl); | error = nvme_completion_is_error(cpl); | ||||
retriable = nvme_completion_is_retry(cpl); | retriable = nvme_completion_is_retry(cpl); | ||||
retry = error && retriable && req->retries < nvme_retry_count; | retry = error && retriable && req->retries < nvme_retry_count; | ||||
if (retry) | if (retry) | ||||
qpair->num_retries++; | qpair->num_retries++; | ||||
if (error && req->retries >= nvme_retry_count && retriable) | if (error && req->retries >= nvme_retry_count && retriable) | ||||
▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | nvme_qpair_manual_complete_tracker( | ||||
nvme_qpair_complete_tracker(tr, &cpl, print_on_error); | nvme_qpair_complete_tracker(tr, &cpl, print_on_error); | ||||
} | } | ||||
void | void | ||||
nvme_qpair_manual_complete_request(struct nvme_qpair *qpair, | nvme_qpair_manual_complete_request(struct nvme_qpair *qpair, | ||||
struct nvme_request *req, uint32_t sct, uint32_t sc) | struct nvme_request *req, uint32_t sct, uint32_t sc) | ||||
{ | { | ||||
struct nvme_completion cpl; | struct nvme_completion cpl; | ||||
boolean_t error; | bool error; | ||||
memset(&cpl, 0, sizeof(cpl)); | memset(&cpl, 0, sizeof(cpl)); | ||||
cpl.sqid = qpair->id; | cpl.sqid = qpair->id; | ||||
cpl.status |= (sct & NVME_STATUS_SCT_MASK) << NVME_STATUS_SCT_SHIFT; | cpl.status |= (sct & NVME_STATUS_SCT_MASK) << NVME_STATUS_SCT_SHIFT; | ||||
cpl.status |= (sc & NVME_STATUS_SC_MASK) << NVME_STATUS_SC_SHIFT; | cpl.status |= (sc & NVME_STATUS_SC_MASK) << NVME_STATUS_SC_SHIFT; | ||||
error = nvme_completion_is_error(&cpl); | error = nvme_completion_is_error(&cpl); | ||||
▲ Show 20 Lines • Show All 602 Lines • ▼ Show 20 Lines | nvme_qpair_submit_request(struct nvme_qpair *qpair, struct nvme_request *req) | ||||
_nvme_qpair_submit_request(qpair, req); | _nvme_qpair_submit_request(qpair, req); | ||||
mtx_unlock(&qpair->lock); | mtx_unlock(&qpair->lock); | ||||
} | } | ||||
static void | static void | ||||
nvme_qpair_enable(struct nvme_qpair *qpair) | nvme_qpair_enable(struct nvme_qpair *qpair) | ||||
{ | { | ||||
qpair->is_enabled = TRUE; | qpair->is_enabled = true; | ||||
} | } | ||||
void | void | ||||
nvme_qpair_reset(struct nvme_qpair *qpair) | nvme_qpair_reset(struct nvme_qpair *qpair) | ||||
{ | { | ||||
qpair->sq_head = qpair->sq_tail = qpair->cq_head = 0; | qpair->sq_head = qpair->sq_tail = qpair->cq_head = 0; | ||||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | nvme_io_qpair_enable(struct nvme_qpair *qpair) | ||||
mtx_unlock(&qpair->lock); | mtx_unlock(&qpair->lock); | ||||
} | } | ||||
static void | static void | ||||
nvme_qpair_disable(struct nvme_qpair *qpair) | nvme_qpair_disable(struct nvme_qpair *qpair) | ||||
{ | { | ||||
struct nvme_tracker *tr; | struct nvme_tracker *tr; | ||||
qpair->is_enabled = FALSE; | qpair->is_enabled = false; | ||||
mtx_lock(&qpair->lock); | mtx_lock(&qpair->lock); | ||||
TAILQ_FOREACH(tr, &qpair->outstanding_tr, tailq) | TAILQ_FOREACH(tr, &qpair->outstanding_tr, tailq) | ||||
callout_stop(&tr->timer); | callout_stop(&tr->timer); | ||||
mtx_unlock(&qpair->lock); | mtx_unlock(&qpair->lock); | ||||
} | } | ||||
void | void | ||||
nvme_admin_qpair_disable(struct nvme_qpair *qpair) | nvme_admin_qpair_disable(struct nvme_qpair *qpair) | ||||
▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines |