void WriteDataPat_r10b::WriteDataPattern() { uint64_t regVal; LOG_NRM("Calc buffer size to write %d logical blks to media", WRITE_DATA_PAT_NUM_BLKS); ConstSharedIdentifyPtr namSpcPtr = gInformative->GetIdentifyCmdNamspc(1); if (namSpcPtr == Identify::NullIdentifyPtr) { LOG_ERR("Namespace #1 must exist"); throw exception(); } uint64_t lbaDataSize = namSpcPtr->GetLBADataSize(); LOG_NRM("Create data pattern to write to media"); SharedMemBufferPtr dataPat = SharedMemBufferPtr(new MemBuffer()); dataPat->Init(WRITE_DATA_PAT_NUM_BLKS * lbaDataSize); dataPat->SetDataPattern(MemBuffer::DATAPAT_INC_16BIT); dataPat->Dump(FileSystem::PrepLogFile(mGrpName, mTestName, "DataPat"), "Write buffer's data pattern"); LOG_NRM("Create a generic write cmd to send data pattern to namspc 1"); SharedWritePtr writeCmd = SharedWritePtr(new Write(mFd)); send_64b_bitmask prpBitmask = (send_64b_bitmask) (MASK_PRP1_PAGE | MASK_PRP2_PAGE | MASK_PRP2_LIST); writeCmd->SetPrpBuffer(prpBitmask, dataPat); writeCmd->SetNSID(1); writeCmd->SetNLB(WRITE_DATA_PAT_NUM_BLKS-1); // convert to 0-based value // Lookup objs which were created in a prior test within group SharedIOSQPtr iosqContig = CAST_TO_IOSQ( gRsrcMngr->GetObj(IOSQ_CONTIG_GROUP_ID)) SharedIOCQPtr iocqContig = CAST_TO_IOCQ( gRsrcMngr->GetObj(IOCQ_CONTIG_GROUP_ID)) SharedIOSQPtr iosqDiscontig = CAST_TO_IOSQ( gRsrcMngr->GetObj(IOSQ_DISCONTIG_GROUP_ID)) SharedIOCQPtr iocqDiscontig = CAST_TO_IOCQ( gRsrcMngr->GetObj(IOCQ_DISCONTIG_GROUP_ID)) LOG_NRM("Send the cmd to hdw via the contiguous IOQ's"); SendToIOSQ(iosqContig, iocqContig, writeCmd, "contig"); // To run the discontig part of this test, the hdw must support that feature if (gRegisters->Read(CTLSPC_CAP, regVal) == false) { LOG_ERR("Unable to determine Q memory requirements"); throw exception(); } else if (regVal & CAP_CQR) { LOG_NRM("Unable to utilize discontig Q's, DUT requires contig"); return; } LOG_NRM("Send the cmd to hdw via the discontiguous IOQ's"); SendToIOSQ(iosqDiscontig, iocqDiscontig, writeCmd, "discontig"); }
void WriteDataPat_r10b::WriteDataPattern() { uint64_t regVal; LOG_NRM("Calc buffer size to write %d logical blks to media", WRITE_DATA_PAT_NUM_BLKS); Informative::Namspc namspcData = gInformative->Get1stBareMetaE2E(); ConstSharedIdentifyPtr namSpcPtr = namspcData.idCmdNamspc; if (namSpcPtr == Identify::NullIdentifyPtr) throw FrmwkEx(HERE, "Namespace #%d must exist", namspcData.id); LBAFormat lbaFormat = namspcData.idCmdNamspc->GetLBAFormat(); if (namspcData.type == Informative::NS_METAS) { if (gRsrcMngr->SetMetaAllocSize(lbaFormat.MS * WRITE_DATA_PAT_NUM_BLKS) == false) { throw FrmwkEx(HERE); } } uint64_t lbaDataSize = namSpcPtr->GetLBADataSize(); LOG_NRM("Create a generic write cmd to send data pattern to namspc #%d", namspcData.id); SharedWritePtr writeCmd = SharedWritePtr(new Write()); send_64b_bitmask prpBitmask = (send_64b_bitmask) (MASK_PRP1_PAGE | MASK_PRP2_PAGE | MASK_PRP2_LIST); LOG_NRM("Create data pattern to write to media"); SharedMemBufferPtr dataPat = SharedMemBufferPtr(new MemBuffer()); switch (namspcData.type) { case Informative::NS_BARE: dataPat->Init(WRITE_DATA_PAT_NUM_BLKS * lbaDataSize); break; case Informative::NS_METAS: dataPat->Init(WRITE_DATA_PAT_NUM_BLKS * lbaDataSize); writeCmd->AllocMetaBuffer(); writeCmd->SetMetaDataPattern(DATAPAT_INC_16BIT); break; case Informative::NS_METAI: dataPat->Init(WRITE_DATA_PAT_NUM_BLKS * (lbaDataSize + lbaFormat.MS)); break; case Informative::NS_E2ES: case Informative::NS_E2EI: throw FrmwkEx(HERE, "Deferring work to handle this case in future"); break; } dataPat->SetDataPattern(DATAPAT_INC_16BIT); dataPat->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "DataPat"), "Write buffer's data pattern"); writeCmd->SetPrpBuffer(prpBitmask, dataPat); writeCmd->SetNSID(namspcData.id); writeCmd->SetNLB(WRITE_DATA_PAT_NUM_BLKS - 1); // convert to 0-based value // Lookup objs which were created in a prior test within group SharedIOSQPtr iosqContig = CAST_TO_IOSQ( gRsrcMngr->GetObj(IOSQ_CONTIG_GROUP_ID)) SharedIOCQPtr iocqContig = CAST_TO_IOCQ( gRsrcMngr->GetObj(IOCQ_CONTIG_GROUP_ID)) SharedIOSQPtr iosqDiscontig = CAST_TO_IOSQ( gRsrcMngr->GetObj(IOSQ_DISCONTIG_GROUP_ID)) SharedIOCQPtr iocqDiscontig = CAST_TO_IOCQ( gRsrcMngr->GetObj(IOCQ_DISCONTIG_GROUP_ID)) LOG_NRM("Send the cmd to hdw via the contiguous IOQ's"); SendToIOSQ(iosqContig, iocqContig, writeCmd, "contig"); // To run the discontig part of this test, the hdw must support that feature if (gRegisters->Read(CTLSPC_CAP, regVal) == false) { throw FrmwkEx(HERE, "Unable to determine Q memory requirements"); } else if (regVal & CAP_CQR) { LOG_NRM("Unable to utilize discontig Q's, DUT requires contig"); return; } LOG_NRM("Send the cmd to hdw via the discontiguous IOQ's"); SendToIOSQ(iosqDiscontig, iocqDiscontig, writeCmd, "discontig"); }