void CIDAcceptedIOSQ_r10b::ReapVerifyCID(SharedIOSQPtr iosq, SharedIOCQPtr iocq, uint16_t expCID) { uint32_t isrCount; uint32_t ceRemain; uint32_t numReaped; uint32_t numCE; if (iocq->ReapInquiryWaitSpecify(CALC_TIMEOUT_ms(1), 1, numCE, isrCount) == false) { iocq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq.fail"), "Dump Entire IOCQ"); iosq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iosq.fail"), "Dump Entire IOSQ"); throw FrmwkEx(HERE, "Unable to see CEs for issued cmd"); } SharedMemBufferPtr ceMem = SharedMemBufferPtr(new MemBuffer()); if ((numReaped = iocq->Reap(ceRemain, ceMem, isrCount, numCE, true)) != 1) { iocq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq.fail"), "Dump Entire IOCQ"); iosq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iosq.fail"), "Dump Entire IOSQ"); throw FrmwkEx(HERE, "Unable to reap on IOCQ"); } union CE *ce = (union CE *)ceMem->GetBuffer(); ProcessCE::Validate(*ce); // throws upon error if (ce->n.CID != expCID) { iocq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq.fail"), "Dump Entire IOCQ"); iosq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iosq.fail"), "Dump Entire IOSQ"); throw FrmwkEx(HERE, "Received CID %d but expected %d", ce->n.CID, expCID); } if (ce->n.SQID != iosq->GetQId()) { iocq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq.fail"), "Dump Entire IOCQ"); iosq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iosq.fail"), "Dump Entire IOSQ"); throw FrmwkEx(HERE, "Rx'd SDID %d but expt'd %d", ce->n.SQID, iosq->GetQId()); } }
void WriteDataPat_r10b::SendToIOSQ(SharedIOSQPtr iosq, SharedIOCQPtr iocq, SharedWritePtr writeCmd, string qualifier) { uint32_t numCE; uint32_t ceRemain; uint32_t numReaped; uint32_t isrCount; uint16_t uniqueId; LOG_NRM("Send the cmd to hdw via %s IOSQ", qualifier.c_str()); iosq->Send(writeCmd, uniqueId); iosq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iosq", qualifier), "Just B4 ringing SQ doorbell, dump entire IOSQ contents"); iosq->Ring(); LOG_NRM("Wait for the CE to arrive in IOCQ"); if (iocq->ReapInquiryWaitSpecify(CALC_TIMEOUT_ms(1), 1, numCE, isrCount) == false) { iocq->Dump( FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq", qualifier), "Unable to see any CE's in IOCQ, dump entire CQ contents"); throw FrmwkEx(HERE, "Unable to see completion of cmd"); } else if (numCE != 1) { iocq->Dump( FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq", qualifier), "Unable to see any CE's in IOCQ, dump entire CQ contents"); throw FrmwkEx(HERE, "The IOCQ should only have 1 CE as a result of a cmd"); } iocq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq", qualifier), "Just B4 reaping IOCQ, dump entire CQ contents"); LOG_NRM("The CQ's metrics B4 reaping holds head_ptr needed"); struct nvme_gen_cq iocqMetrics = iocq->GetQMetrics(); KernelAPI::LogCQMetrics(iocqMetrics); LOG_NRM("Reaping CE from IOCQ, requires memory to hold reaped CE"); SharedMemBufferPtr ceMemIOCQ = SharedMemBufferPtr(new MemBuffer()); if ((numReaped = iocq->Reap(ceRemain, ceMemIOCQ, isrCount, numCE, true)) != 1) { throw FrmwkEx(HERE, "Verified there was 1 CE, but reaping produced %d", numReaped); } LOG_NRM("The reaped CE is..."); iocq->LogCE(iocqMetrics.head_ptr); union CE ce = iocq->PeekCE(iocqMetrics.head_ptr); ProcessCE::Validate(ce); // throws upon error }
void MaxIOQMSIXManyTo1_r10b::SendCmdAndReap(SharedIOSQPtr iosq, SharedIOCQPtr iocq, SharedCmdPtr cmd, uint32_t anticipatedIrqs) { uint16_t uniqueId; uint32_t numCE; string work; uint32_t isrCount; LOG_NRM("Send the cmd to hdw via IOSQ #%d", iosq->GetQId()); iosq->Send(cmd, uniqueId); work = str(boost::format("ioqId.%d.%s") % iosq->GetQId() % cmd->GetName().c_str()); iosq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iosq", work), "Just B4 ringing doorbell, dump IOSQ"); iosq->Ring(); LOG_NRM("Wait for the CE to arrive in CQ %d", iocq->GetQId()); if (iocq->ReapInquiryWaitSpecify(DEFAULT_CMD_WAIT_ms, 1, numCE, isrCount) == false) { iocq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq.fail", work), "Dump Entire IOCQ"); iosq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iosq.fail", work), "Dump Entire IOSQ"); throw FrmwkEx(HERE, "Unable to see CEs for issued cmd"); } work = str(boost::format("iocq.%d") % uniqueId); IO::ReapCE(iocq, 1, isrCount, mGrpName, mTestName, work); if (isrCount != anticipatedIrqs) { iocq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq.fail", work), "Dump Entire IOCQ"); iosq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iosq.fail", work), "Dump Entire IOSQ"); throw FrmwkEx(HERE, "Anticipated ISRs #%d but fired #%d", anticipatedIrqs, isrCount); } }
void IOQRollChkDiff_r10b::VerifyQPointers(SharedIOSQPtr iosq, SharedIOCQPtr iocq) { struct nvme_gen_cq iocqMetrics = iocq->GetQMetrics(); struct nvme_gen_sq iosqMetrics = iosq->GetQMetrics(); uint32_t expectedVal = (2 + MAX(iocq->GetNumEntries(), iosq->GetNumEntries())) % iocq->GetNumEntries(); if (iocqMetrics.head_ptr != expectedVal) { iocq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq", "head_ptr"), "CQ Metrics Head Pointer Inconsistent"); throw FrmwkEx(HERE, "Expected IO CQ.head_ptr = 0x%04X but actual " "IOCQ.head_ptr = 0x%04X", expectedVal, iocqMetrics.head_ptr); } expectedVal = (2 + MAX(iocq->GetNumEntries(), iosq->GetNumEntries())) % iosq->GetNumEntries(); if (iosqMetrics.tail_ptr != expectedVal) { iosq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iosq", "tail_ptr"), "SQ Metrics Tail Pointer Inconsistent"); throw FrmwkEx(HERE, "Expected IO SQ.tail_ptr = 0x%04X but actual " "IOSQ.tail_ptr = 0x%04X", expectedVal, iosqMetrics.tail_ptr); } }