当前位置: 首页>>代码示例>>C++>>正文


C++ SharedMemBufferPtr::Init方法代码示例

本文整理汇总了C++中SharedMemBufferPtr::Init方法的典型用法代码示例。如果您正苦于以下问题:C++ SharedMemBufferPtr::Init方法的具体用法?C++ SharedMemBufferPtr::Init怎么用?C++ SharedMemBufferPtr::Init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SharedMemBufferPtr的用法示例。


在下文中一共展示了SharedMemBufferPtr::Init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: FrmwkEx

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.
}
开发者ID:HavenYang,项目名称:tnvme,代码行数:35,代码来源:functionalityBare_r10b.cpp

示例2: SharedGetLogPagePtr

void
UnsupportRrvdFields_r10b::ReadLogPage(SharedACQPtr &acq, SharedASQPtr &asq,
    uint8_t logId)
{
    string work;

    LOG_NRM("Reading log page with LID = %d to clear the event mask", logId);
    ConstSharedIdentifyPtr idCtrlrStruct = gInformative->GetIdentifyCmdCtrlr();
    uint8_t X = idCtrlrStruct->GetValue(IDCTRLRCAP_ELPE) + 1;
    LOG_NRM("Identify controller ELPE = %d (1-based)", X);

    LOG_NRM("Create get log page cmd and assoc some buffer memory");
    SharedGetLogPagePtr getLogPgCmd = SharedGetLogPagePtr(new GetLogPage());

    LOG_NRM("Create memory buffer for log page to request error information");
    SharedMemBufferPtr getLogPageMem = SharedMemBufferPtr(new MemBuffer());
    send_64b_bitmask prpReq =
        (send_64b_bitmask)(MASK_PRP1_PAGE | MASK_PRP2_PAGE);

    LOG_NRM("Get log page to request error information logId = %d", logId);
    getLogPgCmd->SetLID(logId);
    getLogPageMem->Init(GetLogPage::ERRINFO_DATA_SIZE * X, true);
    getLogPgCmd->SetPrpBuffer(prpReq, getLogPageMem);
    getLogPgCmd->SetNUMD((GetLogPage::ERRINFO_DATA_SIZE * X / 4) - 1); //0-based

    work = str(boost::format("ErrorLog%d") % (uint32_t)logId);
    IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq,
        getLogPgCmd, work, true);
}
开发者ID:WOWers,项目名称:tnvme,代码行数:29,代码来源:unsupportRrvdFields_r10b.cpp

示例3: FrmwkEx

void
MandatorySMART_r10b::IssueGetLogPgCmdLessDwords(SharedASQPtr asq,
    SharedACQPtr acq, SharedGetLogPagePtr getLogPgCmd,
    SharedMemBufferPtr getLogPageMem)
{
    string work;

    send_64b_bitmask prpReq =
        (send_64b_bitmask)(MASK_PRP1_PAGE | MASK_PRP2_PAGE);

    for (uint32_t numd = 1; numd <= SMART_HEALTH_NUMD; numd++) {
        LOG_NRM("Issue get log page for smart info with NUMD = %d", numd);
        getLogPageMem->Init(GetLogPage::SMART_DATA_SIZE, true);
        getLogPgCmd->SetPrpBuffer(prpReq, getLogPageMem);
        getLogPgCmd->SetNUMD(numd - 1); // 0-based

        work = str(boost::format("Smart.NSID.%Xh.NUMD.%d") %
            getLogPgCmd->GetNSID() % numd);
        IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq,
            getLogPgCmd, work, true);

        LOG_NRM("Verify the buffer's non-retrieved = 0x00");
        SharedMemBufferPtr cmdPayload = getLogPgCmd->GetRWPrpBuffer();
        uint32_t offset = (numd * 4);
        uint8_t *cmdPayloadBuff = (uint8_t *)cmdPayload->GetBuffer() + offset;
        for (; offset < GetLogPage::SMART_DATA_SIZE; offset++) {
            LOG_NRM("Verify data at offset = 0x%X", offset);
            if (*cmdPayloadBuff != 0x0) {
                throw FrmwkEx(HERE, "Invalid data at buffer offset = 0x%08X, "
                    "value = 0x%08X", cmdPayloadBuff, *cmdPayloadBuff);
            }
            cmdPayloadBuff++;
        }
    }
}
开发者ID:IvanRoth,项目名称:tnvme,代码行数:35,代码来源:mandatorySMART_r10b.cpp

示例4: FrmwkEx

void
MandatoryErrInfo_r10b::RunCoreTest()
{
    /** \verbatim
     * Assumptions:
     * 1) Test CreateResources_r10b has run prior.
     *  \endverbatim
     */
    string work;
    uint64_t i;
    // Lookup objs which were created in a prior test within group
    SharedASQPtr asq = CAST_TO_ASQ(gRsrcMngr->GetObj(ASQ_GROUP_ID))
    SharedACQPtr acq = CAST_TO_ACQ(gRsrcMngr->GetObj(ACQ_GROUP_ID))

    ConstSharedIdentifyPtr idCtrlrStruct = gInformative->GetIdentifyCmdCtrlr();
    uint8_t X = idCtrlrStruct->GetValue(IDCTRLRCAP_ELPE) + 1;
    LOG_NRM("Identify controller ELPE = %d (1-based)", X);

    LOG_NRM("Create get log page cmd and assoc some buffer memory");
    SharedGetLogPagePtr getLogPgCmd = SharedGetLogPagePtr(new GetLogPage());

    LOG_NRM("Create memory buffer for log page to request error information");
    SharedMemBufferPtr getLogPageMem = SharedMemBufferPtr(new MemBuffer());
    send_64b_bitmask prpReq =
        (send_64b_bitmask)(MASK_PRP1_PAGE | MASK_PRP2_PAGE);

    LOG_NRM("Get log page to request error information");
    getLogPgCmd->SetLID(ERRINFO_LID);

    // loop for all log entries supported by controller
    for (uint32_t numd = ERRINFO_NUMD; numd <= (X * ERRINFO_NUMD);
        numd += ERRINFO_NUMD) {
        LOG_NRM("Issue Get log page cmd with NUMD = %d and log entries = %d",
            numd, (numd/ERRINFO_NUMD));

        getLogPageMem->Init(GetLogPage::ERRINFO_DATA_SIZE * X, true);
        getLogPgCmd->SetPrpBuffer(prpReq, getLogPageMem);
        getLogPgCmd->SetNUMD(numd - 1); // 0-based
        getLogPgCmd->SetNSID(0xFFFFFFFF);
        
        work = str(boost::format("logEnties%d") % (numd / ERRINFO_NUMD));
        IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq,
            getLogPgCmd, work, true);

        // Verify the buffer's non-retrieved log entries = 0x00.
        SharedMemBufferPtr cmdPayload = getLogPgCmd->GetRWPrpBuffer();
        uint32_t offset = (numd * 4);
        uint8_t *cmdPayloadBuff = (uint8_t *)cmdPayload->GetBuffer() + offset;
        for (; offset < (X * GetLogPage::ERRINFO_DATA_SIZE); offset++) {
            LOG_NRM("Verify data at offset = 0x%X", offset);
            if (*cmdPayloadBuff != 0x0) {
                throw FrmwkEx(HERE, "Invalid data at buffer offset = 0x%08X, "
                    "value = 0x%08X", cmdPayloadBuff, *cmdPayloadBuff);
            }
            cmdPayloadBuff++;
        }
    }
}
开发者ID:bsvinay,项目名称:tnvme,代码行数:58,代码来源:mandatoryErrInfo_r10b.cpp

示例5: exception

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");
}
开发者ID:Kurusamy,项目名称:tnvme,代码行数:57,代码来源:writeDataPat_r10b.cpp

示例6: SharedMemBufferPtr

void
LBAOutOfRangeBare_r12::RunCoreTest()
{
    /** \verbatim
     * Assumptions:
     * 1) Test CreateResources_r10b has run prior.
     * \endverbatim
     */
    uint64_t nsze;
    char work[256];
    ConstSharedIdentifyPtr namSpcPtr;

    // 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));

    vector<uint32_t> bare = gInformative->GetBareNamespaces();
    for (size_t i = 0; i < bare.size(); i++) {
        namSpcPtr = gInformative->GetIdentifyCmdNamspc(bare[i]);
        if (namSpcPtr->isZeroFilled()) {
            LOG_NRM("Namespace %lu is inactive", i);
        } else {
            nsze = namSpcPtr->GetValue(IDNAMESPC_NSZE);

            LOG_NRM("Create memory to contain write payload");
            SharedMemBufferPtr writeMem = SharedMemBufferPtr(new MemBuffer());
            uint64_t lbaDataSize = namSpcPtr->GetLBADataSize();
            writeMem->Init(WR_NUM_BLKS * lbaDataSize);

            LOG_NRM("Create a write cmd to write data to namspc %d", bare[i]);
            SharedWritePtr writeCmd = SharedWritePtr(new Write());
            send_64b_bitmask prpBitmask = (send_64b_bitmask)(MASK_PRP1_PAGE
                | MASK_PRP2_PAGE | MASK_PRP2_LIST);
            writeCmd->SetPrpBuffer(prpBitmask, writeMem);
            writeCmd->SetNSID(bare[i]);
            writeCmd->SetNLB(WR_NUM_BLKS - 1);    // convert to 0-based value

            LOG_NRM(
                "Issue cmd where 1st block starts at LBA (Identify.NSZE-2)");
            snprintf(work, sizeof(work), "nsze-2.%01d", (uint32_t)i);
            writeCmd->SetSLBA(nsze - 2);
            IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), iosq,
                iocq, writeCmd, work, true);

            LOG_NRM(
                "Issue cmd where 1st block starts at LBA (Identify.NSZE-1)");
            snprintf(work, sizeof(work), "nsze-1.%d01d", (uint32_t)i);
            writeCmd->SetSLBA(nsze - 1);
            SendCmdToHdw(iosq, iocq, writeCmd, work);

            LOG_NRM("Issue cmd where 1st block starts at LBA (Identify.NSZE)");
            snprintf(work, sizeof(work), "nsze.%01d", (uint32_t)i);
            writeCmd->SetSLBA(nsze);
            SendCmdToHdw(iosq, iocq, writeCmd, work);
        }
    }
}
开发者ID:HavenYang,项目名称:tnvme,代码行数:57,代码来源:lbaOutOfRangeBare_r12.cpp

示例7: exception

bool
LBAOutOfRangeBare_r10b::RunCoreTest()
{
    /** \verbatim
     * Assumptions:
     * 1) Test CreateResources_r10b has run prior.
     * \endverbatim
     */
    uint64_t nsze;
    ConstSharedIdentifyPtr namSpcPtr;

    // 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))

    vector<uint32_t> bare = gInformative->GetBareNamespaces();
    for (size_t i = 1; i < bare.size(); i++) {
        namSpcPtr = gInformative->GetIdentifyCmdNamspc(i);
        if (namSpcPtr == Identify::NullIdentifyPtr) {
            LOG_ERR("Identify namspc struct #%d doesn't exist", bare[i]);
            throw exception();
        }
        nsze = namSpcPtr->GetValue(IDNAMESPC_NSZE);

        LOG_NRM("Create memory to contain read payload");
        SharedMemBufferPtr readMem = SharedMemBufferPtr(new MemBuffer());
        uint64_t lbaDataSize = namSpcPtr->GetLBADataSize();
        readMem->Init(RD_NUM_BLKS * lbaDataSize);

        LOG_NRM("Create a read cmd to read data from namspc %d", bare[i]);
        SharedReadPtr readCmd = SharedReadPtr(new Read(mFd));
        send_64b_bitmask prpBitmask = (send_64b_bitmask)
            (MASK_PRP1_PAGE | MASK_PRP2_PAGE | MASK_PRP2_LIST);
        readCmd->SetPrpBuffer(prpBitmask, readMem);
        readCmd->SetNSID(bare[i]);
        readCmd->SetNLB(RD_NUM_BLKS - 1);    // convert to 0-based value

        LOG_NRM("Issue cmd where 1st block starts at LBA (Identify.NSZE-2)");
        readCmd->SetSLBA(nsze - 2);
        IO::SendCmdToHdw(mGrpName, mTestName, DEFAULT_CMD_WAIT_ms, iosqContig,
            iocqContig, readCmd, "nsze-2", true);

        LOG_NRM("Issue cmd where 1st block starts at LBA (Identify.NSZE-1)");
        readCmd->SetSLBA(nsze - 1);
        SendCmdToHdw(iosqContig, iocqContig, readCmd, "nsze-1");

        LOG_NRM("Issue cmd where 1st block starts at LBA (Identify.NSZE)");
        readCmd->SetSLBA(nsze);
        SendCmdToHdw(iosqContig, iocqContig, readCmd, "nsze");
    }

    return true;
}
开发者ID:Kurusamy,项目名称:tnvme,代码行数:55,代码来源:lbaOutOfRangeBare_r10b.cpp

示例8: FrmwkEx

void
InvalidNamspc_r10b::RunCoreTest()
{
    /** \verbatim
     * Assumptions:
     * 1) Test CreateResources_r10b has run prior.
     * \endverbatim
     */
    uint64_t inc, i;
    string work;
    uint32_t numCE;
    uint32_t isrCountB4;

    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));

    if ((numCE = iocq->ReapInquiry(isrCountB4, true)) != 0) {
        iocq->Dump(
            FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq",
                                     "notEmpty"), "Test assumption have not been met");
        throw FrmwkEx(HERE, "Require 0 CE's within CQ %d, not upheld, found %d",
                      iocq->GetQId(), numCE);
    }

    LOG_NRM("Setup write cmd's values that won't change per namspc");
    SharedMemBufferPtr writeMem = SharedMemBufferPtr(new MemBuffer());
    uint64_t lbaDataSize = 512;
    writeMem->Init(lbaDataSize);

    SharedWritePtr writeCmd = SharedWritePtr(new Write());
    send_64b_bitmask prpBitmask = (send_64b_bitmask)
                                  (MASK_PRP1_PAGE | MASK_PRP2_PAGE | MASK_PRP2_LIST);
    writeCmd->SetPrpBuffer(prpBitmask, writeMem);
    writeCmd->SetNLB(0);    // convert to 0-based value
    writeCmd->SetSLBA(0);

    LOG_NRM("For all namspc's issue cmd to an illegal namspc");
    ConstSharedIdentifyPtr idCtrlrStruct = gInformative->GetIdentifyCmdCtrlr();
    uint32_t nn = (uint32_t)idCtrlrStruct->GetValue(IDCTRLRCAP_NN);
    if (nn == 0 ) {
        throw FrmwkEx(HERE, "Required to support >= 1 namespace");
    }

    for (i = (nn + 1), inc = 1; i <= 0xffffffff; i += (2 * inc), inc += 1327) {

        LOG_NRM("Issue flush cmd with illegal namspc ID=%llu",
                (unsigned long long)i);
        writeCmd->SetNSID(i);
        work = str(boost::format("namspc%d") % i);
        SendCmdToHdw(iosq, iocq, writeCmd, work);
    }
}
开发者ID:neera,项目名称:tnvme,代码行数:53,代码来源:invalidNamspc_r10b.cpp

示例9: FrmwkEx

SharedWritePtr
SQCQSizeMismatch_r10b::SetWriteCmd()
{
    Informative::Namspc namspcData = gInformative->Get1stBareMetaE2E();
    LOG_NRM("Processing write cmd using namspc id %d", namspcData.id);
    LBAFormat lbaFormat = namspcData.idCmdNamspc->GetLBAFormat();

    LOG_NRM("Create data pattern to write to media");
    SharedMemBufferPtr dataPat = SharedMemBufferPtr(new MemBuffer());
    uint64_t lbaDataSize = namspcData.idCmdNamspc->GetLBADataSize();

    SharedWritePtr writeCmd = SharedWritePtr(new Write());
    send_64b_bitmask prpBitmask = (send_64b_bitmask)(MASK_PRP1_PAGE
        | MASK_PRP2_PAGE | MASK_PRP2_LIST);

    switch (namspcData.type) {
    case Informative::NS_BARE:
        dataPat->Init(lbaDataSize);
        break;
    case Informative::NS_METAS:
        dataPat->Init(lbaDataSize);
        if (gRsrcMngr->SetMetaAllocSize(lbaFormat.MS) == false)
            throw FrmwkEx(HERE);
        writeCmd->AllocMetaBuffer();
        break;
    case Informative::NS_METAI:
        dataPat->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;
    }

    writeCmd->SetPrpBuffer(prpBitmask, dataPat);
    writeCmd->SetNSID(namspcData.id);
    writeCmd->SetNLB(0);

    return writeCmd;
}
开发者ID:dsuratman,项目名称:tnvme,代码行数:40,代码来源:sqcqSizeMismatch_r10b.cpp

示例10: SharedWritePtr

void
ReadWriteToUnacquiredReservation::RunCoreTest()
{
    /** \verbatim
     * Assumptions:
     * None.
     * \endverbatim
     */
	LOG_NRM("Start ReadWriteToUnacquiredReservation::RunCoreTest")

	SharedIOSQPtr iosq = CAST_TO_IOSQ(gRsrcMngr->GetObj(IOSQ_GROUP_ID));
	SharedIOCQPtr iocq = CAST_TO_IOCQ(gRsrcMngr->GetObj(IOCQ_GROUP_ID));
	SharedASQPtr   asq = CAST_TO_ASQ(gRsrcMngr->GetObj(ASQ_GROUP_ID));
	SharedACQPtr   acq = CAST_TO_ACQ(gRsrcMngr->GetObj(ACQ_GROUP_ID));

	SharedWritePtr writeCmd = SharedWritePtr(new Write());
	SharedReadPtr readCmd = SharedReadPtr(new Read());

	SharedMemBufferPtr lbaWriteBuffer = SharedMemBufferPtr(new MemBuffer());
	SharedMemBufferPtr lbaReadBuffer = SharedMemBufferPtr(new MemBuffer());

	LOG_NRM("Create nvmeWrite Cmd and write 1 block of data to LBA 5, expecting 0:0x83 for HostB");
	lbaWriteBuffer->Init(512, true, 0xDD);
	writeCmd->SetPrpBuffer( (send_64b_bitmask)( MASK_PRP1_PAGE | MASK_PRP2_PAGE), lbaWriteBuffer);
	writeCmd->SetNSID(1);
	writeCmd->SetSLBA(5);
	writeCmd->SetNLB(0); // 0's based!
    IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), iosq, iocq, writeCmd, "write 0xDD's to LBA5 using hostB", true, CESTAT_RSRV_CONFLICT);

	LOG_NRM("Create nvmeRead Cmd and read back 1 block of data to LBA 5, expecting 0:0x83 for HostA");
	lbaReadBuffer->Init(512, true, 0x00);
	readCmd->SetPrpBuffer( (send_64b_bitmask) (MASK_PRP1_PAGE | MASK_PRP2_PAGE), lbaReadBuffer);
	readCmd->SetNSID(1);
	readCmd->SetSLBA(5);
	readCmd->SetNLB(0); // 0's based!
    IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), iosq, iocq, readCmd, "read from LBA5 using hostB", true, CESTAT_RSRV_CONFLICT);

    LOG_NRM("Completed ReadWriteToUnacquiredReservation::RunCoreTest")
}
开发者ID:NirmalaArun,项目名称:tnvme,代码行数:39,代码来源:readWriteToUnacquiredReservation.cpp

示例11: FrmwkEx

SharedReadPtr
FUA_r10b::CreateCmd()
{
    Informative::Namspc namspcData = gInformative->Get1stBareMetaE2E();
    LBAFormat lbaFormat = namspcData.idCmdNamspc->GetLBAFormat();
    LOG_NRM("Processing read cmd using namspc id %d", namspcData.id);

    ConstSharedIdentifyPtr namSpcPtr = namspcData.idCmdNamspc;
    uint64_t lbaDataSize = namSpcPtr->GetLBADataSize();;
    SharedMemBufferPtr dataPat = SharedMemBufferPtr(new MemBuffer());

    SharedReadPtr readCmd = SharedReadPtr(new Read());
    send_64b_bitmask prpBitmask = (send_64b_bitmask)(MASK_PRP1_PAGE
                                  | MASK_PRP2_PAGE | MASK_PRP2_LIST);

    switch (namspcData.type) {
    case Informative::NS_BARE:
        dataPat->Init(lbaDataSize);
        break;
    case Informative::NS_METAS:
        dataPat->Init(lbaDataSize);
        if (gRsrcMngr->SetMetaAllocSize(lbaFormat.MS) == false)
            throw FrmwkEx(HERE);
        readCmd->AllocMetaBuffer();
        break;
    case Informative::NS_METAI:
        dataPat->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, dataPat);
    readCmd->SetNSID(namspcData.id);
    readCmd->SetNLB(0);
    return readCmd;
}
开发者ID:dtseng,项目名称:tnvme,代码行数:39,代码来源:FUA_r10b.cpp

示例12: FrmwkEx

void
ProtInfoIgnoreBare_r10b::RunCoreTest()
{
    /** \verbatim
     * Assumptions:
     * None.
     * \endverbatim
     */
    char context[256];
    ConstSharedIdentifyPtr namSpcPtr;

    // 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));

    vector<uint32_t> bare = gInformative->GetBareNamespaces();
    for (size_t i = 0; i < bare.size(); i++) {

        namSpcPtr = gInformative->GetIdentifyCmdNamspc(bare[i]);
        if (namSpcPtr == Identify::NullIdentifyPtr) {
            throw FrmwkEx(HERE, "Identify namspc struct #%d doesn't exist",
                          bare[i]);
        }

        LOG_NRM("Create memory to contain write payload");
        SharedMemBufferPtr writeMem = SharedMemBufferPtr(new MemBuffer());
        uint64_t lbaDataSize = namSpcPtr->GetLBADataSize();
        writeMem->Init(lbaDataSize);

        LOG_NRM("Create a write cmd to read data from namspc %d", bare[i]);
        SharedWritePtr writeCmd = SharedWritePtr(new Write());
        send_64b_bitmask prpBitmask = (send_64b_bitmask)
                                      (MASK_PRP1_PAGE | MASK_PRP2_PAGE | MASK_PRP2_LIST);
        writeCmd->SetPrpBuffer(prpBitmask, writeMem);
        writeCmd->SetNSID(bare[i]);
        writeCmd->SetNLB(0);    // convert to 0-based value

        for (uint16_t protInfo = 0; protInfo <= 0x0f; protInfo++) {
            uint8_t work = writeCmd->GetByte(12, 3);
            work &= ~0x3c;  // PRINFO specific bits
            work |= (protInfo << 2);
            writeCmd->SetByte(work, 12, 3);

            snprintf(context, sizeof(context), "ns%d.protInfo0x%02X",
                     (uint32_t)i, protInfo);
            IO::SendAndReapCmd(mGrpName, mTestName, DEFAULT_CMD_WAIT_ms, iosq,
                               iocq, writeCmd, context, true);
        }
    }
}
开发者ID:dtseng,项目名称:tnvme,代码行数:50,代码来源:protInfoIgnoreBare_r10b.cpp

示例13: FrmwkEx

SharedWritePtr
CIDAcceptedIOSQ_r10b::CreateWriteCmd()
{
    Informative::Namspc namspcData = gInformative->Get1stBareMetaE2E();
    LBAFormat lbaFormat = namspcData.idCmdNamspc->GetLBAFormat();

    SharedMemBufferPtr wrMemBuf = SharedMemBufferPtr(new MemBuffer());
    uint64_t lbaDataSize = namspcData.idCmdNamspc->GetLBADataSize();

    SharedWritePtr writeCmd = SharedWritePtr(new Write());
    send_64b_bitmask prpBitmask = (send_64b_bitmask)(MASK_PRP1_PAGE
        | MASK_PRP2_PAGE | MASK_PRP2_LIST);

    switch (namspcData.type) {
    case Informative::NS_BARE:
        wrMemBuf->Init(lbaDataSize);
        break;
    case Informative::NS_METAS:
        wrMemBuf->Init(lbaDataSize);
        if (gRsrcMngr->SetMetaAllocSize(lbaFormat.MS) == false)
            throw FrmwkEx(HERE);
        writeCmd->AllocMetaBuffer();
        break;
    case Informative::NS_METAI:
        wrMemBuf->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;
    }

    writeCmd->SetPrpBuffer(prpBitmask, wrMemBuf);
    writeCmd->SetNSID(namspcData.id);

    return writeCmd;
}
开发者ID:HavenYang,项目名称:tnvme,代码行数:37,代码来源:cidAcceptedIOSQ_r10b.cpp

示例14: FrmwkEx

void
PRPOffsetDualPgMultiBlk_r10b::VerifyDataPat(SharedReadPtr readCmd,
    DataPattern dataPat, uint64_t wrVal, uint64_t metabufSz)
{
    LOG_NRM("Compare read vs written data to verify");
    SharedMemBufferPtr wrPayload = SharedMemBufferPtr(new MemBuffer());
    wrPayload->Init(readCmd->GetPrpBufferSize());
    wrPayload->SetDataPattern(dataPat, wrVal);

    SharedMemBufferPtr rdPayload = readCmd->GetRWPrpBuffer();
    if (rdPayload->Compare(wrPayload) == false) {
        rdPayload->Dump(
            FileSystem::PrepDumpFile(mGrpName, mTestName, "ReadPayload"),
            "Data read from media miscompared from written");
        wrPayload->Dump(
            FileSystem::PrepDumpFile(mGrpName, mTestName, "WrittenPayload"),
            "Data read from media miscompared from written");
        throw FrmwkEx(HERE, "Data miscompare");
    }

    if (readCmd->GetMetaBuffer() != NULL) {
        SharedMemBufferPtr metaWrPayload = SharedMemBufferPtr(new MemBuffer());
        metaWrPayload->Init(metabufSz);
        metaWrPayload->SetDataPattern(dataPat, wrVal);

        if (readCmd->CompareMetaBuffer(metaWrPayload) == false) {
            readCmd->Dump(
                FileSystem::PrepDumpFile(mGrpName, mTestName, "MetaRdPayload"),
                "Meta Data read from media miscompared from written");
            metaWrPayload->Dump(
                FileSystem::PrepDumpFile(mGrpName, mTestName, "MetaWrPayload"),
                "Meta Data read from media miscompared from written");
            throw FrmwkEx(HERE, "Meta Data miscompare");
        }
    }
}
开发者ID:cadence-nvme,项目名称:tnvme,代码行数:36,代码来源:prpOffsetDualPgMultiBlk_r10b.cpp

示例15: SharedMemBufferPtr

void
ProtInfoIgnoreBare_r12::RunCoreTest()
{
    /** \verbatim
     * Assumptions:
     * 1) Test CreateResources_r10b has run prior.
     * \endverbatim
     */
    char context[256];
    ConstSharedIdentifyPtr namSpcPtr;

    // 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));

    vector<uint32_t> bare = gInformative->GetBareNamespaces();
    for (size_t i = 0; i < bare.size(); i++) {
        namSpcPtr = gInformative->GetIdentifyCmdNamspc(bare[i]);
        if (namSpcPtr->isZeroFilled()) {
            LOG_NRM("Namespace %lu is inactive", i);
        } else {
            LOG_NRM("Create memory to contain read payload");
            SharedMemBufferPtr readMem = SharedMemBufferPtr(new MemBuffer());
            uint64_t lbaDataSize = namSpcPtr->GetLBADataSize();
            readMem->Init(lbaDataSize);

            LOG_NRM("Create a read cmd to read data from namspc %d", bare[i]);
            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->SetNSID(bare[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);

                snprintf(context, sizeof(context), "ns%d.protInfo0x%02X",
                    (uint32_t)i, protInfo);
                IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1),
                    iosq, iocq, readCmd, context, true);
            }
        }
    }
}
开发者ID:HavenYang,项目名称:tnvme,代码行数:48,代码来源:protInfoIgnoreBare_r12.cpp


注:本文中的SharedMemBufferPtr::Init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。