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


C++ SharedReadPtr::SetDword方法代码示例

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


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

示例1: CreateCmd

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

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

    SharedReadPtr readCmd = CreateCmd();
    IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), iosq, iocq,
        readCmd, "none.set", true);

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

    readCmd->SetDword(0xffffffff, 2);
    readCmd->SetDword(0xffffffff, 3);

    work = readCmd->GetDword(12);
    work |= 0x03ff0000;      // Set DW12_b25:16 bits
    readCmd->SetDword(work, 12);

    work = readCmd->GetDword(13);
    work |= 0xffffff00;     // Set DW13_b31:8 bits
    readCmd->SetDword(work, 13);

    IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), iosq, iocq,
        readCmd, "all.set", true);

    LOG_NRM("Set DSM field reserved coded values");
    uint32_t cdw13 = readCmd->GetDword(13) & ~0xf;
    for (int accFreq = BOOST_BINARY(111); accFreq <= BOOST_BINARY(1111);
        ++accFreq) {
        work = cdw13 | accFreq;
        readCmd->SetDword(work, 13);

        /* Controller may ignore context attributes */
        IO::SendAndReapCmdIgnore(mGrpName, mTestName, CALC_TIMEOUT_ms(1), iosq,
            iocq, readCmd, "all.set", true);
    }
}
开发者ID:HavenYang,项目名称:tnvme,代码行数:48,代码来源:unsupportRsvdFields_r11b.cpp

示例2: SharedMemBufferPtr

void
IgnoreMetaPtrBare_r12::RunCoreTest()
{
    /** \verbatim
     * Assumptions:
     * 1) Test CreateResources_r10b has run prior.
     * \endverbatim
     */
    string work;
    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));

    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->isZeroFilled()) {
            LOG_NRM("Namespace %lu is inactive", i);
        } else {
            LOG_NRM("Setup read cmd's values that won't change per namspc");
            SharedMemBufferPtr readMem = SharedMemBufferPtr(new MemBuffer());
            uint64_t lbaDataSize = namSpcPtr->GetLBADataSize();
            readMem->Init(lbaDataSize);

            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
            readCmd->SetSLBA(0);

            LOG_NRM("Set MPTR in cmd to max value");
            readCmd->SetDword(0xffffffff, 4);
            readCmd->SetDword(0xffffffff, 5);

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

示例3: SharedMemBufferPtr

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);
    }
}
开发者ID:cadence-nvme,项目名称:tnvme,代码行数:42,代码来源:ignoreMetaPtrMeta_r10b.cpp

示例4: FrmwkEx

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);
//.........这里部分代码省略.........
开发者ID:cadence-nvme,项目名称:tnvme,代码行数:101,代码来源:prpOffsetSinglePgSingleBlk_r10b.cpp

示例5: FrmwkEx


//.........这里部分代码省略.........
        break;
    }
    if (X < 0) {
        LOG_WARN("CC.MPS < lba data size(LBADS); Can't run test.");
        return;
    }

    DataPattern dataPat;
    uint64_t wrVal;
    uint32_t prp2RandVal[2];
    uint64_t Y;
    for (int64_t pgOff = 0; pgOff <= X; pgOff += 4) {
        LOG_NRM("Processing at page offset #%ld", pgOff);
        switch (namspcData.type) {
        case Informative::NS_BARE:
        case Informative::NS_METAS:
            Y = (ccMPS - pgOff) / lbaDataSize;
            break;
        case Informative::NS_METAI:
            Y = (ccMPS - pgOff) / (lbaDataSize + lbaFormat.MS);
            break;
        case Informative::NS_E2ES:
        case Informative::NS_E2EI:
            throw FrmwkEx(HERE, "Deferring work to handle this case in future");
            break;
        }
        for (uint64_t nLBAs = 1; nLBAs <= Y; nLBAs++) {
            LOG_NRM("Processing LBA #%ld of %ld", nLBAs, Y);
            if ((maxDtXferSz != 0) && (maxDtXferSz < (lbaDataSize * nLBAs))) {
                // If the total data xfer exceeds the maximum data xfer
                // allowed then we break from the inner loop and continue
                // test with next offset (outer loop).
                LOG_WARN("Data xfer size exceeds max allowed, continuing..");
                break;
            }
            if ((nLBAs % 2) != 0) {
                dataPat = DATAPAT_INC_8BIT;
                wrVal = pgOff + nLBAs;
                prp2RandVal[0] = rand();
                prp2RandVal[1] = rand();
            } else {
                dataPat = DATAPAT_CONST_16BIT;
                wrVal = pgOff + nLBAs;
                prp2RandVal[0] = 0;
                prp2RandVal[1] = 0;
            }

            uint64_t metabufSz = nLBAs * lbaFormat.MS;
            switch (namspcData.type) {
            case Informative::NS_BARE:
                writeMem->InitOffset1stPage((lbaDataSize * nLBAs), pgOff,
                    false);
                readMem->InitOffset1stPage((lbaDataSize * nLBAs), pgOff, false);
                break;
            case Informative::NS_METAS:
                writeMem->InitOffset1stPage((lbaDataSize * nLBAs), pgOff,
                    false);
                readMem->InitOffset1stPage((lbaDataSize * nLBAs), pgOff, false);
                writeCmd->SetMetaDataPattern(dataPat, wrVal, 0, metabufSz);
                break;
            case Informative::NS_METAI:
                writeMem->InitOffset1stPage(
                    ((lbaDataSize + lbaFormat.MS ) * nLBAs), pgOff, false);
                readMem->InitOffset1stPage(
                    ((lbaDataSize + lbaFormat.MS ) * nLBAs), pgOff, false);
                break;
            case Informative::NS_E2ES:
            case Informative::NS_E2EI:
                throw FrmwkEx(HERE,
                    "Deferring work to handle this case in future");
                break;
            }
            work = str(boost::format("pgOff.%d.nlba.%d") % pgOff % nLBAs);
            writeCmd->SetPrpBuffer(prpBitmask, writeMem);
            writeMem->SetDataPattern(dataPat, wrVal);
            writeCmd->SetNLB(nLBAs - 1); // convert to 0 based.

            readCmd->SetPrpBuffer(prpBitmask, readMem);
            readCmd->SetNLB(nLBAs - 1); // convert to 0 based.

            enableLog = false;
            if ((pgOff <= 8) || (pgOff >= (X - 8)))
                enableLog = true;

            // Set 64 bits of PRP2 in CDW 8 & 9 with random or zero.
            writeCmd->SetDword(prp2RandVal[0], 8);
            writeCmd->SetDword(prp2RandVal[1], 9);
            IO::SendAndReapCmd(mGrpName, mTestName, DEFAULT_CMD_WAIT_ms, iosq,
                iocq, writeCmd, work, enableLog);

            // Set 64 bits of PRP2 in CDW 8 & 9 with random or zero.
            readCmd->SetDword(prp2RandVal[0], 8);
            readCmd->SetDword(prp2RandVal[1], 9);
            IO::SendAndReapCmd(mGrpName, mTestName, DEFAULT_CMD_WAIT_ms, iosq,
                iocq, readCmd, work, enableLog);

            VerifyDataPat(readCmd, dataPat, wrVal, metabufSz);
        }
    }
}
开发者ID:dtseng,项目名称:tnvme,代码行数:101,代码来源:prpOffsetSinglePgMultiBlk_r10b.cpp


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