Exemplo n.º 1
0
void
DeleteIOQDiscontigPoll_r10b::DeleteIOCQDiscontigPoll(SharedASQPtr asq,
    SharedACQPtr acq)
{
    uint16_t numCE;

    LOG_NRM("Lookup IOCQ which was created in a prior test within group");
    SharedIOCQPtr iocq = CAST_TO_IOCQ(
        gRsrcMngr->GetObj(IOCQ_DISCONTIG_POLL_GROUP_ID))

    LOG_NRM("Create a Delete IOCQ cmd to perform the IOCQ deletion");
    SharedDeleteIOCQPtr deleteIOCQCmd =
        SharedDeleteIOCQPtr(new DeleteIOCQ(mFd));
    deleteIOCQCmd->Init(iocq);


    LOG_NRM("Send the Delete IOCQ cmd to hdw");
    asq->Send(deleteIOCQCmd);
    asq->Dump(FileSystem::PrepLogFile(mGrpName, mTestName, "asq",
        "deleteIOCQCmd"),
        "Just B4 ringing SQ0 doorbell, dump entire SQ contents");
    asq->Ring();


    LOG_NRM("Wait for the CE to arrive in ACQ");
    if (acq->ReapInquiryWaitSpecify(DEFAULT_CMD_WAIT_ms, 1, numCE) == false) {
        LOG_ERR("Unable to see completion of Delete IOCQ cmd");
        acq->Dump(
            FileSystem::PrepLogFile(mGrpName, mTestName, "acq","deleteIOCQCmd"),
            "Unable to see any CE's in CQ0, dump entire CQ contents");
        throw exception();
    }
    acq->Dump(FileSystem::PrepLogFile(mGrpName, mTestName, "acq",
        "deleteIOCQCmd"), "Just B4 reaping CQ0, dump entire CQ contents");


    {
        uint16_t ceRemain;
        uint16_t numReaped;

        LOG_NRM("Reaping CE from ACQ, requires memory to hold reaped CE");
        SharedMemBufferPtr ceMemIOCQ = SharedMemBufferPtr(new MemBuffer());
        if ((numReaped = acq->Reap(ceRemain, ceMemIOCQ, numCE, true)) != 1) {
            LOG_ERR("Verified there was 1 CE, but reaping produced %d",
                numReaped);
            throw exception();
        }
        LOG_NRM("The reaped identify CE is...");
        ceMemIOCQ->Log();
    }

    // Not explicitly necessary, but is more clean to free what is not needed
    gRsrcMngr->FreeObj(IOCQ_DISCONTIG_POLL_GROUP_ID);
}
void
UnsupportRsvdFields_r12::RunCoreTest()
{
    /** \verbatim
     * Assumptions:
     * 1) Test CreateResources_r10b has run prior.
     * \endverbatim
     */
    uint64_t maxIOQEntries = 2;

    // 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("Setup element sizes for the IOQ's");
    uint8_t iocqes = (gInformative->GetIdentifyCmdCtrlr()->
        GetValue(IDCTRLRCAP_CQES) & 0xf);
    uint8_t iosqes = (gInformative->GetIdentifyCmdCtrlr()->
        GetValue(IDCTRLRCAP_SQES) & 0xf);
    gCtrlrConfig->SetIOCQES(iocqes);
    gCtrlrConfig->SetIOSQES(iosqes);

    LOG_NRM("Create IOCQ/IOSQ pairs");
    SharedIOCQPtr iocq = Queues::CreateIOCQContigToHdw(mGrpName, mTestName,
        CALC_TIMEOUT_ms(1), asq, acq, IOQ_ID, maxIOQEntries, false,
        IOCQ_GROUP_ID, true, 0);

    LOG_NRM("Delete the IOCQ");
    SharedDeleteIOCQPtr deleteIOCQCmd = SharedDeleteIOCQPtr(new DeleteIOCQ());
    deleteIOCQCmd->Init(iocq);
    IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq,
        deleteIOCQCmd, "", true);

    LOG_NRM("Recreate IOCQ");
    iocq = Queues::CreateIOCQContigToHdw(mGrpName, mTestName,
        CALC_TIMEOUT_ms(1), asq, acq, IOQ_ID, maxIOQEntries, false,
        IOCQ_GROUP_ID, true, 0);

    deleteIOCQCmd->Init(iocq);

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

    deleteIOCQCmd->SetDword(0xffffffff, 2);
    deleteIOCQCmd->SetDword(0xffffffff, 3);
    deleteIOCQCmd->SetDword(0xffffffff, 4);
    deleteIOCQCmd->SetDword(0xffffffff, 5);
    deleteIOCQCmd->SetDword(0xffffffff, 6);
    deleteIOCQCmd->SetDword(0xffffffff, 7);
    deleteIOCQCmd->SetDword(0xffffffff, 8);
    deleteIOCQCmd->SetDword(0xffffffff, 9);

    // DW10_b31:16
    work = deleteIOCQCmd->GetDword(10);
    work |= 0xffff0000;
    deleteIOCQCmd->SetDword(work, 10);

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

    IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq,
        deleteIOCQCmd, "", true);
}