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


C++ ConstSharedIdentifyPtr类代码示例

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


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

示例1: LOG_NRM

void
PRP1PRP2_r10b::RunCoreTest()
{
    /** \verbatim
     * Assumptions:
     * 1) Test CreateResources_r10b has run prior.
     * \endverbatim
     */

    LOG_NRM("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))

    LOG_NRM("Determine if DUT has atleast one namespace support");
    ConstSharedIdentifyPtr idCmdCtrlr = gInformative->GetIdentifyCmdCtrlr();
    if ((idCmdCtrlr->GetValue(IDCTRLRCAP_NN)) == 0)
        throw FrmwkEx(HERE, "Required to support >= 1 namespace");

    LOG_NRM("Form identify namespace cmd and associate some buffer");
    SharedIdentifyPtr idCmdNamSpc = SharedIdentifyPtr(new Identify());
    idCmdNamSpc->SetCNS(false);
    idCmdNamSpc->SetNSID(1);

    SharedMemBufferPtr idMemNamSpc = SharedMemBufferPtr(new MemBuffer());
    idMemNamSpc->InitOffset1stPage(Identify::IDEAL_DATA_SIZE,
        PRP_BUFFER_OFFSET, true);

    LOG_NRM("Allow PRP1 and PRP2");
    send_64b_bitmask idPrpNamSpc =
        (send_64b_bitmask)(MASK_PRP1_PAGE | MASK_PRP2_PAGE);
    idCmdNamSpc->SetPrpBuffer(idPrpNamSpc, idMemNamSpc);

    IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq,
        idCmdNamSpc, "prp1Prp2", true);
}
开发者ID:IvanRoth,项目名称:tnvme,代码行数:35,代码来源:prp1PRP2_r10b.cpp

示例2: supoorted

Test::RunType
UnsupportRsvdFields_r11b::RunnableCoreTest(bool preserve)
{
    ///////////////////////////////////////////////////////////////////////////
    // All code contained herein must never permanently modify the state or
    // configuration of the DUT. Permanence is defined as state or configuration
    // changes that will not be restored after a cold hard reset.
    ///////////////////////////////////////////////////////////////////////////

    ConstSharedIdentifyPtr idCtrlrCap = gInformative->GetIdentifyCmdCtrlr();
    uint64_t oncs = idCtrlrCap->GetValue(IDCTRLRCAP_ONCS);
    if ((oncs & ONCS_SUP_DSM_CMD) == 0) {
        LOG_NRM("Reporting not supoorted (oncs)%ld", oncs);
        return RUN_FALSE;
    }

    LOG_NRM("Reporting runnable (oncs)%ld", oncs);

    if (gCmdLine.rsvdfields == false)
        return RUN_FALSE;   // Optional rsvd fields test skipped.

    preserve = preserve;    // Suppress compiler error/warning
    return RUN_TRUE;        // This test is never destructive

}
开发者ID:HavenYang,项目名称:tnvme,代码行数:25,代码来源:unsupportRsvdFields_r11b.cpp

示例3: supported

Test::RunType
ReadWriteToUnacquiredReservation::RunnableCoreTest(bool preserve)
{
    ///////////////////////////////////////////////////////////////////////////
    // All code contained herein must never permanently modify the state or
    // configuration of the DUT. Permanence is defined as state or configuration
    // changes that will not be restored after a cold hard reset.
    ///////////////////////////////////////////////////////////////////////////

    ConstSharedIdentifyPtr idCtrlrCap = gInformative->GetIdentifyCmdCtrlr();
    uint64_t oncs = idCtrlrCap->GetValue(IDCTRLRCAP_ONCS);
    uint64_t mic = idCtrlrCap->GetValue(IDCTRLRCAP_MIC);
    if((mic & MIC_SUP_PCI_PORTS) == 0)
    {
        LOG_NRM("Reporting only one PCI port is supported (mic)%ld", mic);
        return RUN_FALSE;
    }
    else
    {
        if ((oncs & ONCS_SUP_RSRV) == 0)
        {
            LOG_NRM("Reporting Reservations not supported (oncs)%ld", oncs);
            return RUN_FALSE;
        }
    }
    preserve = preserve;    // Suppress compiler error/warning
    return RUN_TRUE;        // This test is never destructive
}
开发者ID:NirmalaArun,项目名称:tnvme,代码行数:28,代码来源:readWriteToUnacquiredReservation.cpp

示例4: LOG_NRM

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

示例5: LOG_NRM

void
UnsupportRsvdFields_r10b::RunCoreTest()
{
    /** \verbatim
     * Assumptions:
     * 1) Test CreateResources_r10b has run prior.
     * \endverbatim
     */

    LOG_NRM("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))

    LOG_NRM("Determine if DUT has atleast one namespace support");
    ConstSharedIdentifyPtr idCmdCtrlr = gInformative->GetIdentifyCmdCtrlr();
    if ((idCmdCtrlr->GetValue(IDCTRLRCAP_NN)) == 0)
        throw FrmwkEx(HERE, "Required to support >= 1 namespace");

    LOG_NRM("Form identify namespace cmd and associate some buffer");
    SharedIdentifyPtr idCmdNamSpc = SharedIdentifyPtr(new Identify());
    idCmdNamSpc->SetCNS(0);
    idCmdNamSpc->SetNSID(1);

    SharedMemBufferPtr idMemNamSpc = SharedMemBufferPtr(new MemBuffer());
    idMemNamSpc->InitOffset1stPage(Identify::IDEAL_DATA_SIZE,
        PRP_BUFFER_OFFSET, true);

    LOG_NRM("Allow PRP1 and PRP2");
    send_64b_bitmask idPrpNamSpc =
        (send_64b_bitmask)(MASK_PRP1_PAGE | MASK_PRP2_PAGE);
    idCmdNamSpc->SetPrpBuffer(idPrpNamSpc, idMemNamSpc);

    IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq,
        idCmdNamSpc, "rsvdnone.set", true);

    LOG_NRM("Set all cmd's rsvd bits");
    uint32_t work = idCmdNamSpc->GetDword(0);
    work |= 0x0000fc00;      // Set DW0_b15:10 bits
    idCmdNamSpc->SetDword(work, 0);

    idCmdNamSpc->SetDword(0xffffffff, 2);
    idCmdNamSpc->SetDword(0xffffffff, 3);
    idCmdNamSpc->SetDword(0xffffffff, 4);
    idCmdNamSpc->SetDword(0xffffffff, 5);

    work = idCmdNamSpc->GetDword(10);
    work |= 0xfffffffe;      // Set DW10_b31:1 bits
    idCmdNamSpc->SetDword(work, 10);

    idCmdNamSpc->SetDword(0xffffffff, 11);
    idCmdNamSpc->SetDword(0xffffffff, 12);
    idCmdNamSpc->SetDword(0xffffffff, 13);
    idCmdNamSpc->SetDword(0xffffffff, 14);
    idCmdNamSpc->SetDword(0xffffffff, 15);

    IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq,
        idCmdNamSpc, "rsvdall.set", true);
}
开发者ID:gaganasindhu,项目名称:tnvme,代码行数:58,代码来源:unsupportRsvdFields_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: LOG_NRM

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

示例8: 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

示例9: LOG_NRM

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

示例10: 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

示例11: LOG_NRM

void
IOSQ::Init(uint16_t qId, uint32_t numEntries, uint16_t cqId,
    uint8_t priority)
{
    uint8_t entrySize;
    uint64_t work;


    LOG_NRM("IOSQ::Init (qId,numEntry,cqId,prior) = (%d,%d,%d,%d)",
        qId, numEntries, cqId, priority);

    switch (priority) {
	case 0:
	case 1:
	case 2:
	case 3:
		mPriority = priority;
		break;
	default:
		throw FrmwkEx(HERE, "Illegal priority value, can't fit within 2 bits");
	}

    if (gCtrlrConfig->GetIOSQES(entrySize) == false)
        throw FrmwkEx(HERE, "Unable to learn IOSQ entry size");

    // Nothing to gain by specifying an element size which the DUT doesn't
    // support, the outcome is undefined, might succeed in crashing the kernel
    ConstSharedIdentifyPtr idCtrlrCap = gInformative->GetIdentifyCmdCtrlr();
    uint64_t value = idCtrlrCap->GetValue(IDCTRLRCAP_SQES);
    uint8_t maxElemSize = (uint8_t)((value >> 4) & 0x0f);
    uint8_t minElemSize = (uint8_t)((value >> 0) & 0x0f);
    if ((entrySize < minElemSize) || (entrySize > maxElemSize)) {
        throw FrmwkEx(HERE, "Reg CC.IOSQES yields a bad element size: 0x%04X",
            (1 << entrySize));
    }

    // Detect if doing something that looks suspicious/incorrect/illegal
    if (gRegisters->Read(CTLSPC_CAP, work) == false)
        throw FrmwkEx(HERE, "Unable to determine MQES");

    work &= CAP_MQES;
    work += 1;      // convert to 1-based
    if ((work + 1) < (uint64_t)numEntries) {
        LOG_WARN("Creating Q with %d entries, but DUT only allows %d",
            numEntries, (uint32_t)(work + 1));
    }

    SQ::Init(qId, (1 << entrySize), numEntries, cqId);
}
开发者ID:10jul,项目名称:tnvme,代码行数:49,代码来源:iosq.cpp

示例12: 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

示例13: 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

示例14: return

Test::RunType
VerifyNUSE_r10b::RunnableCoreTest(bool preserve)
{
    ///////////////////////////////////////////////////////////////////////////
    // All code contained herein must never permanently modify the state or
    // configuration of the DUT. Permanence is defined as state or configuration
    // changes that will not be restored after a cold hard reset.
    ///////////////////////////////////////////////////////////////////////////

    ConstSharedIdentifyPtr idCtrlrCap = gInformative->GetIdentifyCmdCtrlr();
    uint64_t oncs = idCtrlrCap->GetValue(IDCTRLRCAP_ONCS);
    if ((oncs & ONCS_SUP_DSM_CMD) == 0)
        return RUN_FALSE;

    return ((preserve == true) ? RUN_FALSE : RUN_TRUE);   // Test is destructive
}
开发者ID:HavenYang,项目名称:tnvme,代码行数:16,代码来源:verifyNUSE_r10b.cpp

示例15: FrmwkEx

void
IgnoreMetaPtrBare_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 bare namspc's issue cmd with non-zero meta ptr");
    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("Setup write cmd's values that won't change per namspc");
        SharedMemBufferPtr writeMem = SharedMemBufferPtr(new MemBuffer());
        uint64_t lbaDataSize = namSpcPtr->GetLBADataSize();
        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("Set MPTR in cmd to max value");
        writeCmd->SetDword(0xffffffff, 4);
        writeCmd->SetDword(0xffffffff, 5);

        writeCmd->SetNSID(bare[i]);
        work = str(boost::format("namspc%d") % bare[i]);
        IO::SendAndReapCmd(mGrpName, mTestName, DEFAULT_CMD_WAIT_ms, iosq, iocq,
            writeCmd, work, true);
    }
}
开发者ID:dtseng,项目名称:tnvme,代码行数:47,代码来源:ignoreMetaPtrBare_r10b.cpp


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