void CIDAcceptedIOSQ_r10b::RunCoreTest() { /** \verbatim * Assumptions: * None. * \endverbatim */ if (gCtrlrConfig->SetState(ST_DISABLE_COMPLETELY) == false) throw FrmwkEx(HERE); LOG_NRM("Create ACQ and ASQ objects which have test life time"); SharedACQPtr acq = CAST_TO_ACQ(SharedACQPtr(new ACQ(gDutFd))) acq->Init(5); SharedASQPtr asq = CAST_TO_ASQ(SharedASQPtr(new ASQ(gDutFd))) asq->Init(5); IRQ::SetAnySchemeSpecifyNum(2); // throws upon error gCtrlrConfig->SetCSS(CtrlrConfig::CSS_NVM_CMDSET); if (gCtrlrConfig->SetState(ST_ENABLE) == false) throw FrmwkEx(HERE); vector<SharedIOSQPtr> iosqs; SharedIOCQPtr iocq; InitTstRsrcs(asq, acq, iosqs, iocq); SharedWritePtr writeCmd = CreateWriteCmd(); LOG_NRM("Learn initial unique command id assigned by dnvme"); uint16_t curCID; vector <SharedIOSQPtr>::iterator iosq; for (iosq = iosqs.begin(); iosq != iosqs.end(); iosq++) (*iosq)->Send(writeCmd, curCID); uint16_t prevCID = curCID; for (uint32_t nCmds = 0; nCmds < MAX_CMDS; nCmds++) { for (iosq = iosqs.begin(); iosq != iosqs.end(); iosq++) { LOG_NRM("(nCmds, curCID, prevCID, SQ ID) = (%d, %d, %d, %d)", nCmds, curCID, prevCID, (*iosq)->GetQId()); (*iosq)->Ring(); ReapVerifyCID(*iosq, iocq, prevCID); (*iosq)->Send(writeCmd, curCID); if (curCID != (uint16_t)(prevCID + 1)) { (*iosq)->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iosq.fail." + (*iosq)->GetQId()), "Dump Entire IOSQ"); iocq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq.fail." + iocq->GetQId()), "Dump Entire IOCQ"); throw FrmwkEx(HERE, "curCID(%d) != (prevCID + 1)(%d)", curCID, (prevCID + 1)); } } prevCID = curCID; } }
void PRPOffsetSinglePgSingleBlk_r10b::RunCoreTest() { /** \verbatim * Assumptions: * 1) Test CreateResources_r10b has run prior. * \endverbatim */ string work; int64_t X; bool enableLog; LOG_NRM("Initialize random seed"); srand (17); // Lookup objs which were created in a prior test within group SharedIOSQPtr iosq = CAST_TO_IOSQ(gRsrcMngr->GetObj(IOSQ_GROUP_ID)); SharedIOCQPtr iocq = CAST_TO_IOCQ(gRsrcMngr->GetObj(IOCQ_GROUP_ID)); LOG_NRM("Get namspc and determine LBA size"); Informative::Namspc namspcData = gInformative->Get1stBareMetaE2E(); send_64b_bitmask prpBitmask = (send_64b_bitmask)(MASK_PRP1_PAGE); LBAFormat lbaFormat = namspcData.idCmdNamspc->GetLBAFormat(); uint64_t lbaDataSize = namspcData.idCmdNamspc->GetLBADataSize(); uint8_t mpsRegVal; if (gCtrlrConfig->GetMPS(mpsRegVal) == false) throw FrmwkEx(HERE, "Unable to get MPS value from CC."); switch (namspcData.type) { case Informative::NS_BARE: X = (int64_t)(1 << (mpsRegVal + 12)) - lbaDataSize; break; case Informative::NS_METAS: if (gRsrcMngr->SetMetaAllocSize(lbaFormat.MS) == false) throw FrmwkEx(HERE); X = (int64_t)(1 << (mpsRegVal + 12)) - lbaDataSize; break; case Informative::NS_METAI: X = (int64_t)(1 << (mpsRegVal + 12)) - (lbaDataSize + lbaFormat.MS); break; case Informative::NS_E2ES: case Informative::NS_E2EI: throw FrmwkEx(HERE, "Deferring work to handle this case in future"); break; } if (X <= 0) { LOG_WARN("CC.MPS (0x%04X) < lba data size(LBADS) + MS " "(0x08%lX + 0x04%X) ; Can't run test.", (1 << (mpsRegVal + 12)), lbaDataSize, lbaFormat.MS); return; } LOG_NRM("Prepare cmds to send to the queues."); SharedWritePtr writeCmd = CreateWriteCmd(namspcData); SharedReadPtr readCmd = CreateReadCmd(namspcData); DataPattern dataPattern; uint64_t wrVal; uint32_t prp2RandVal[2]; for (int64_t pgOff = 0; pgOff <= X; pgOff += 4) { LOG_NRM("Processing at page offset #%ld", pgOff); if ((pgOff % 8) != 0) { dataPattern = DATAPAT_CONST_8BIT; wrVal = pgOff; prp2RandVal[0] = rand(); prp2RandVal[1] = rand(); work = str(boost::format("dataPat.constb.memOff.%d") % pgOff); } else { dataPattern = DATAPAT_INC_16BIT; wrVal = pgOff; prp2RandVal[0] = 0; prp2RandVal[1] = 0; work = str(boost::format("dataPat.incw.memOff.%d") % pgOff); } SharedMemBufferPtr writeMem = SharedMemBufferPtr(new MemBuffer()); switch (namspcData.type) { case Informative::NS_BARE: writeMem->InitOffset1stPage(lbaDataSize, pgOff, false); break; case Informative::NS_METAS: writeMem->InitOffset1stPage(lbaDataSize, pgOff, false); writeCmd->SetMetaDataPattern(dataPattern, wrVal); break; case Informative::NS_METAI: writeMem->InitOffset1stPage (lbaDataSize + lbaFormat.MS, pgOff, false); break; case Informative::NS_E2ES: case Informative::NS_E2EI: throw FrmwkEx(HERE, "Deferring work to handle this case in future"); break; } writeCmd->SetPrpBuffer(prpBitmask, writeMem); writeMem->SetDataPattern(dataPattern, wrVal); LOG_NRM("Set 64 bits of PRP2 CDW 8 & 9 with random or 0 for wr cmd."); writeCmd->SetDword(prp2RandVal[0], 8); writeCmd->SetDword(prp2RandVal[1], 9); enableLog = false; if ((pgOff <= 8) || (pgOff >= (X - 8))) enableLog = true; IO::SendAndReapCmd(mGrpName, mTestName, DEFAULT_CMD_WAIT_ms, iosq, iocq, writeCmd, work, enableLog); SharedMemBufferPtr readMem = SharedMemBufferPtr(new MemBuffer()); switch (namspcData.type) { case Informative::NS_BARE: readMem->InitOffset1stPage(lbaDataSize, pgOff, false); break; case Informative::NS_METAS: readMem->InitOffset1stPage(lbaDataSize, pgOff, false); break; case Informative::NS_METAI: readMem->InitOffset1stPage (lbaDataSize + lbaFormat.MS, pgOff, false); break; case Informative::NS_E2ES: case Informative::NS_E2EI: throw FrmwkEx(HERE, "Deferring work to handle this case in future"); break; } readCmd->SetPrpBuffer(prpBitmask, readMem); LOG_NRM("Set 64 bits of PRP2 CDW 8 & 9 with random or 0 for rd cmd."); readCmd->SetDword(prp2RandVal[0], 8); readCmd->SetDword(prp2RandVal[1], 9); IO::SendAndReapCmd(mGrpName, mTestName, DEFAULT_CMD_WAIT_ms, iosq, iocq, readCmd, work, enableLog); VerifyDataPattern(readCmd, dataPattern, wrVal); } }