void FunctionalityBare_r10b::ResizeDataBuf(SharedReadPtr &readCmd, SharedWritePtr &writeCmd, ConstSharedIdentifyPtr namSpcPtr, uint64_t maxWrBlks, send_64b_bitmask prpBitmask) { LBAFormat lbaFormat = namSpcPtr->GetLBAFormat(); uint64_t lbaDataSize = (1 << lbaFormat.LBADS); SharedMemBufferPtr readMem = readCmd->GetRWPrpBuffer(); SharedMemBufferPtr writeMem = writeCmd->GetRWPrpBuffer(); switch (gInformative->IdentifyNamespace(namSpcPtr)) { case Informative::NS_BARE: case Informative::NS_METAS: LOG_NRM("Resized max rd/wr blks to %ld for separate meta or bare", maxWrBlks); writeMem->Init(maxWrBlks * lbaDataSize); readMem->Init(maxWrBlks * lbaDataSize); break; case Informative::NS_METAI: LOG_NRM("Resized max rd/wr blks to %ld for integrated meta", maxWrBlks); writeMem->Init(maxWrBlks * (lbaDataSize + lbaFormat.MS)); readMem->Init(maxWrBlks * (lbaDataSize + lbaFormat.MS)); 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); writeCmd->SetNLB(maxWrBlks - 1); // 0 based value. readCmd->SetPrpBuffer(prpBitmask, readMem); readCmd->SetNLB(maxWrBlks - 1); // 0 based value. }
void IgnoreMetaPtrMeta_r10b::RunCoreTest() { /** \verbatim * Assumptions: * 1) Test CreateResources_r10b has run prior. * \endverbatim */ string work; ConstSharedIdentifyPtr namSpcPtr; LOG_NRM("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("For all imeta namspc's issue read cmd with non-zero meta ptr"); vector<uint32_t> imeta = gInformative->GetMetaINamespaces(); for (size_t i = 0; i < imeta.size(); i++) { namSpcPtr = gInformative->GetIdentifyCmdNamspc(imeta[i]); LOG_NRM("Setup read cmd's values that won't change per namspc"); SharedMemBufferPtr readMem = SharedMemBufferPtr(new MemBuffer()); uint64_t lbaDataSize = namSpcPtr->GetLBADataSize(); LBAFormat lbaFormat = namSpcPtr->GetLBAFormat(); readMem->Init(lbaDataSize + lbaFormat.MS); SharedReadPtr readCmd = SharedReadPtr(new Read()); send_64b_bitmask prpBitmask = (send_64b_bitmask) (MASK_PRP1_PAGE | MASK_PRP2_PAGE | MASK_PRP2_LIST); readCmd->SetPrpBuffer(prpBitmask, readMem); readCmd->SetNLB(0); // convert to 0-based value LOG_NRM("Set MPTR in cmd to max value"); readCmd->SetDword(0xffffffff, 4); readCmd->SetDword(0xffffffff, 5); readCmd->SetNSID(imeta[i]); work = str(boost::format("namspc%d") % imeta[i]); IO::SendAndReapCmd(mGrpName, mTestName, DEFAULT_CMD_WAIT_ms, iosq, iocq, readCmd, work, true); } }
void ProtInfoIgnoreMeta_r10b::RunCoreTest() { /** \verbatim * Assumptions: * 1) None. * \endverbatim */ string context; ConstSharedIdentifyPtr namSpcPtr; SharedIOSQPtr iosq; SharedIOCQPtr iocq; send_64b_bitmask prpBitmask = (send_64b_bitmask) (MASK_PRP1_PAGE | MASK_PRP2_PAGE | MASK_PRP2_LIST); if (gCtrlrConfig->SetState(ST_DISABLE_COMPLETELY) == false) throw FrmwkEx(HERE); SharedACQPtr acq = SharedACQPtr(new ACQ(gDutFd)); acq->Init(5); SharedASQPtr asq = SharedASQPtr(new ASQ(gDutFd)); asq->Init(5); LOG_NRM("Get all the supported meta namespaces"); vector<uint32_t> meta = gInformative->GetMetaNamespaces(); for (size_t i = 0; i < meta.size(); i++) { if (gCtrlrConfig->SetState(ST_DISABLE) == false) throw FrmwkEx(HERE); // All queues will use identical IRQ vector IRQ::SetAnySchemeSpecifyNum(1); gCtrlrConfig->SetCSS(CtrlrConfig::CSS_NVM_CMDSET); if (gCtrlrConfig->SetState(ST_ENABLE) == false) throw FrmwkEx(HERE); LOG_NRM("Create IOSQ and IOCQ with ID #%d", IOQ_ID); CreateIOQs(asq, acq, IOQ_ID, iosq, iocq); LOG_NRM("Get LBA format and lba data size for namespc #%d", meta[i]); namSpcPtr = gInformative->GetIdentifyCmdNamspc(meta[i]); LBAFormat lbaFormat = namSpcPtr->GetLBAFormat(); uint64_t lbaDataSize = (1 << lbaFormat.LBADS); LOG_NRM("Create a read cmd to read data from namspc %d", meta[i]); SharedReadPtr readCmd = SharedReadPtr(new Read()); LOG_NRM("Create memory to contain read payload"); SharedMemBufferPtr readMem = SharedMemBufferPtr(new MemBuffer()); Informative::NamspcType nsType = gInformative->IdentifyNamespace(namSpcPtr); switch (nsType) { case Informative::NS_BARE: throw FrmwkEx(HERE, "Namspc type cannot be BARE."); case Informative::NS_METAS: readMem->Init(lbaDataSize); if (gRsrcMngr->SetMetaAllocSize(lbaFormat.MS) == false) throw FrmwkEx(HERE); readCmd->AllocMetaBuffer(); break; case Informative::NS_METAI: readMem->Init(lbaDataSize + lbaFormat.MS); 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); readCmd->SetNSID(meta[i]); readCmd->SetNLB(0); // convert to 0-based value for (uint16_t protInfo = 0; protInfo <= 0x0f; protInfo++) { uint8_t work = readCmd->GetByte(12, 3); work &= ~0x3c; // PRINFO specific bits work |= (protInfo << 2); readCmd->SetByte(work, 12, 3); context = str(boost::format("ns%d.protInfo0x%02X") % (uint32_t)i % protInfo); IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), iosq, iocq, readCmd, context, true); } } }
void FunctionalityMeta_r10b::RunCoreTest() { /** \verbatim * Assumptions: * None. * \endverbatim */ string work; bool enableLog; ConstSharedIdentifyPtr namSpcPtr; SharedIOSQPtr iosq; SharedIOCQPtr iocq; uint64_t maxWrBlks; if (gCtrlrConfig->SetState(ST_DISABLE_COMPLETELY) == false) throw FrmwkEx(HERE); SharedACQPtr acq = SharedACQPtr(new ACQ(gDutFd)); acq->Init(5); SharedASQPtr asq = SharedASQPtr(new ASQ(gDutFd)); asq->Init(5); ConstSharedIdentifyPtr idCmdCtrlr = gInformative->GetIdentifyCmdCtrlr(); uint32_t maxDtXferSz = idCmdCtrlr->GetMaxDataXferSize(); if (maxDtXferSz == 0) maxDtXferSz = MAX_DATA_TX_SIZE; LOG_NRM("Prepare cmds to be send through Q's."); SharedWritePtr writeCmd = SharedWritePtr(new Write()); SharedMemBufferPtr writeMem = SharedMemBufferPtr(new MemBuffer()); SharedReadPtr readCmd = SharedReadPtr(new Read()); SharedMemBufferPtr readMem = SharedMemBufferPtr(new MemBuffer()); SharedFlushPtr flushCmd = SharedFlushPtr(new Flush()); DataPattern dataPat[] = { DATAPAT_INC_8BIT, DATAPAT_CONST_8BIT, DATAPAT_INC_16BIT, DATAPAT_CONST_16BIT, DATAPAT_INC_32BIT, DATAPAT_CONST_32BIT }; uint64_t dpArrSize = sizeof(dataPat) / sizeof(dataPat[0]); send_64b_bitmask prpBitmask = (send_64b_bitmask) (MASK_PRP1_PAGE | MASK_PRP2_PAGE | MASK_PRP2_LIST); LOG_NRM("Seeking all meta namspc's."); vector<uint32_t> meta = gInformative->GetMetaNamespaces(); for (size_t i = 0; i < meta.size(); i++) { LOG_NRM("Processing meta namspc id #%d of %ld", meta[i], meta.size()); if (gCtrlrConfig->SetState(ST_DISABLE) == false) throw FrmwkEx(HERE); // All queues will use identical IRQ vector IRQ::SetAnySchemeSpecifyNum(1); gCtrlrConfig->SetCSS(CtrlrConfig::CSS_NVM_CMDSET); if (gCtrlrConfig->SetState(ST_ENABLE) == false) throw FrmwkEx(HERE); LOG_NRM("Create IOSQ and IOCQ with ID #%d", IOQ_ID); CreateIOQs(asq, acq, IOQ_ID, iosq, iocq); LOG_NRM("Get LBA format and lba data size for namespc #%d", meta[i]); namSpcPtr = gInformative->GetIdentifyCmdNamspc(meta[i]); LBAFormat lbaFormat = namSpcPtr->GetLBAFormat(); uint64_t lbaDataSize = (1 << lbaFormat.LBADS); uint64_t ncap = namSpcPtr->GetValue(IDNAMESPC_NCAP); uint64_t metaBuffSz = 0; LOG_NRM("Set read and write buffers based on the namspc type"); switch (gInformative->IdentifyNamespace(namSpcPtr)) { case Informative::NS_BARE: throw FrmwkEx(HERE, "Namspc type cannot be BARE."); case Informative::NS_METAS: maxWrBlks = maxDtXferSz / lbaDataSize; metaBuffSz = maxWrBlks * lbaFormat.MS; if (gRsrcMngr->SetMetaAllocSize(metaBuffSz) == false) throw FrmwkEx(HERE); LOG_NRM("Max rd/wr blks %ld using separate meta buff of ncap %ld", maxWrBlks, ncap); writeMem->Init(maxWrBlks * lbaDataSize); readMem->Init(maxWrBlks * lbaDataSize); writeCmd->AllocMetaBuffer(); readCmd->AllocMetaBuffer(); break; case Informative::NS_METAI: maxWrBlks = maxDtXferSz / (lbaDataSize + lbaFormat.MS); LOG_NRM("Max rd/wr blks %ld using integrated meta buff of ncap %ld", maxWrBlks, ncap); writeMem->Init(maxWrBlks * (lbaDataSize + lbaFormat.MS)); readMem->Init(maxWrBlks * (lbaDataSize + lbaFormat.MS)); 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); writeCmd->SetNSID(meta[i]); writeCmd->SetNLB(maxWrBlks - 1); // 0 based value. readCmd->SetPrpBuffer(prpBitmask, readMem); readCmd->SetNSID(meta[i]); readCmd->SetNLB(maxWrBlks - 1); // 0 based value. flushCmd->SetNSID(meta[i]); for (uint64_t sLBA = 0; sLBA < maxWrBlks/*(ncap - 1)*/; sLBA += maxWrBlks) { LOG_NRM("Processing at #%ld blk of %ld", sLBA, (ncap -1)); if ((sLBA + maxWrBlks) >= ncap) { maxWrBlks = ncap - sLBA; LOG_NRM("Resize max write blocks to #%ld", maxWrBlks); ResizeDataBuf(readCmd, writeCmd, namSpcPtr, maxWrBlks, prpBitmask); metaBuffSz = maxWrBlks * lbaFormat.MS; } LOG_NRM("Sending #%ld blks starting at #%ld", maxWrBlks, sLBA); for (uint64_t nLBA = 0; nLBA < maxWrBlks; nLBA++) { writeMem->SetDataPattern(dataPat[nLBA % dpArrSize], (sLBA + nLBA + 1), (nLBA * lbaDataSize), lbaDataSize); writeCmd->SetMetaDataPattern(dataPat[nLBA % dpArrSize], (sLBA + nLBA + 1), (nLBA * lbaFormat.MS), lbaFormat.MS); } writeCmd->SetSLBA(sLBA); readCmd->SetSLBA(sLBA); enableLog = false; if ((sLBA <= maxWrBlks) || (sLBA >= (ncap - 2 * maxWrBlks))) enableLog = true; work = str(boost::format("metaID.%d.SLBA.%ld") % meta[i] % sLBA); LOG_NRM("Sending write and read commands through ioq's"); IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), iosq, iocq, writeCmd, work, enableLog); IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), iosq, iocq, flushCmd, work, enableLog); IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), iosq, iocq, readCmd, work, enableLog); VerifyDataPat(readCmd, writeCmd, metaBuffSz); } } }