Ejemplo n.º 1
0
uint16_t
IO::SendCmd(string grpName, string testName, SharedSQPtr sq,
    SharedCQPtr cq, SharedCmdPtr cmd, uint32_t &numCE, uint32_t &isrCount,
    string qualify, bool verbose)
{
    string work;
    uint16_t uniqueId;

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

    LOG_NRM("Send the cmd to hdw via SQ %d", sq->GetQId());
    sq->Send(cmd, uniqueId);
    if (verbose) {
        work = str(boost::format(
            "Just B4 ringing SQ %d doorbell, dump entire SQ") % sq->GetQId());
        sq->Dump(FileSystem::PrepDumpFile(grpName, testName,
            "sq." + cmd->GetName(), qualify), work);
    }
    sq->Ring();
    return uniqueId;
}
Ejemplo n.º 2
0
void
LBAOutOfRangeBare_r10b::SendCmdToHdw(SharedSQPtr sq, SharedCQPtr cq,
    SharedCmdPtr cmd, string qualify)
{
    uint16_t numCE;
    uint32_t isrCount;
    uint32_t isrCountB4;
    string work;



    if ((numCE = cq->ReapInquiry(isrCountB4, true)) != 0) {
        LOG_ERR("Require 0 CE's within CQ %d, not upheld, found %d",
            cq->GetQId(), numCE);
        throw exception();
    }

    LOG_NRM("Send the cmd to hdw via SQ %d", sq->GetQId());
    sq->Send(cmd);
    work = str(boost::format(
        "Just B4 ringing SQ %d doorbell, dump entire SQ") % sq->GetQId());
    sq->Dump(FileSystem::PrepLogFile(mGrpName, mTestName,
        "sq." + cmd->GetName(), qualify), work);
    sq->Ring();


    LOG_NRM("Wait for the CE to arrive in CQ %d", cq->GetQId());
    if (cq->ReapInquiryWaitSpecify(DEFAULT_CMD_WAIT_ms, 1, numCE, isrCount)
        == false) {

        LOG_ERR("Unable to see CE for issued cmd");
        work = str(boost::format(
            "Unable to see any CE's in CQ %d, dump entire CQ") % cq->GetQId());
        cq->Dump(
            FileSystem::PrepLogFile(mGrpName, mTestName, "cq." + cmd->GetName(),
            qualify), work);
        throw exception();
    } else if (numCE != 1) {
        LOG_ERR("1 cmd caused %d CE's to arrive in CQ %d", numCE, cq->GetQId());
        throw exception();
    }
    work = str(boost::format("Just B4 reaping CQ %d, dump entire CQ") %
        cq->GetQId());
    cq->Dump(FileSystem::PrepLogFile(mGrpName, mTestName,
        "cq." + cmd->GetName(), qualify), work);

    // throws if an error occurs
    IO::ReapCE(cq, numCE, isrCount, mGrpName, mTestName, qualify,
        CESTAT_LBA_OUT_RANGE);

    // Single cmd submitted on empty ASQ should always yield 1 IRQ on ACQ
    if (gCtrlrConfig->IrqsEnabled() && cq->GetIrqEnabled() &&
        (isrCount != (isrCountB4 + 1))) {

        LOG_ERR("CQ using IRQ's, but IRQ count not expected (%d != %d)",
            isrCount, (isrCountB4 + 1));
        throw exception();
    }
}
Ejemplo n.º 3
0
void
IO::SendAndReapCmdFail(string grpName, string testName, uint32_t ms,
    SharedSQPtr sq, SharedCQPtr cq, SharedCmdPtr cmd, string qualify,
    bool verbose)
{
    uint32_t numCE;
    uint32_t isrCount;
    string work;
    uint16_t uniqueId;

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

    LOG_NRM("Send the cmd to hdw via SQ %d", sq->GetQId());
    sq->Send(cmd, uniqueId);
    if (verbose) {
        work = str(boost::format(
            "Just B4 ringing SQ %d doorbell, dump entire SQ") % sq->GetQId());
        sq->Dump(FileSystem::PrepDumpFile(grpName, testName,
            "sq." + cmd->GetName(), qualify), work);
    }
    sq->Ring();

    LOG_NRM("Wait for the CE to arrive in CQ %d", cq->GetQId());
    if (cq->ReapInquiryWaitSpecifyQ(ms, 1, numCE, isrCount) == true) {
        /* Found a CE...reap it then throw so that it gets cleared from CQ */
        if (verbose) {
            work = str(boost::format("Just B4 reaping CQ %d, dump entire CQ") %
                cq->GetQId());
            cq->Dump(FileSystem::PrepDumpFile(grpName, testName,
                "cq." + cmd->GetName(), qualify), work);
        }

        // throws if an error occurs
        ReapCEIgnore(cq, numCE, isrCount, grpName, testName, qualify);
        if (verbose) {
            cmd->Dump(FileSystem::PrepDumpFile(grpName, testName,
                cmd->GetName(), qualify), "A cmd's contents dumped");
        }

        throw FrmwkEx(HERE, "Command was successfully processed and its "
            "completion was reaped from the CQ");
    }
}