void InvalidNamspc_r10b::SendCmdToHdw(SharedSQPtr sq, SharedCQPtr cq, SharedCmdPtr cmd, string qualify) { uint32_t isrCount; uint32_t numCE; uint32_t ceRemain; uint32_t numReaped; string work; uint16_t uniqueId; LOG_NRM("Send the cmd to hdw via SQ %d", sq->GetQId()); sq->Send(cmd, uniqueId); sq->Ring(); LOG_NRM("Wait for the CE to arrive in CQ %d", cq->GetQId()); if (cq->ReapInquiryWaitSpecify(DEFAULT_CMD_WAIT_ms, 1, numCE, isrCount) == false) { work = str(boost::format( "Unable to see any CE's in CQ %d, dump entire CQ") % cq->GetQId()); cq->Dump( FileSystem::PrepDumpFile(mGrpName, mTestName, "cq." + cmd->GetName(), qualify), work); throw FrmwkEx(HERE, "Unable to see CE for issued cmd"); } else if (numCE != 1) { work = str(boost::format( "Unable to see any CE's in CQ %d, dump entire CQ") % cq->GetQId()); cq->Dump( FileSystem::PrepDumpFile(mGrpName, mTestName, "cq." + cmd->GetName(), qualify), work); throw FrmwkEx(HERE, "1 cmd caused %d CE's to arrive in CQ %d", numCE, cq->GetQId()); } LOG_NRM("The CQ's metrics before reaping holds head_ptr"); struct nvme_gen_cq cqMetrics = cq->GetQMetrics(); KernelAPI::LogCQMetrics(cqMetrics); LOG_NRM("Reaping CE from CQ %d, requires memory to hold CE", cq->GetQId()); SharedMemBufferPtr ceMem = SharedMemBufferPtr(new MemBuffer()); if ((numReaped = cq->Reap(ceRemain, ceMem, isrCount, numCE, true)) != 1) { work = str(boost::format("Verified CE's exist, desired %d, reaped %d") % numCE % numReaped); cq->Dump( FileSystem::PrepDumpFile(mGrpName, mTestName, "cq.error", qualify), work); throw FrmwkEx(HERE, work); } union CE ce = cq->PeekCE(cqMetrics.head_ptr); ProcessCE::Validate(ce, CESTAT_INVAL_NAMSPC); // throws upon error }
union CE IO::RetrieveCE(SharedCQPtr cq, uint32_t numCE, uint32_t &isrCount, string grpName, string testName, string qualify, const bool failOnIoctl) { struct nvme_gen_cq cqMetrics = cq->GetQMetrics(); uint32_t numReaped = AttemptRetrieveCE(cq, numCE, isrCount, &cqMetrics, failOnIoctl); string work; if (numReaped != 1) { work = str( boost::format("Verified CE's exist, desired %d, reaped %d") % numCE % numReaped); cq->Dump(FileSystem::PrepDumpFile(grpName, testName, "cq.error", qualify), work); throw FrmwkEx(HERE, work); } return cq->PeekCE(cqMetrics.head_ptr); }