本文整理汇总了C++中SharedIOSQPtr类的典型用法代码示例。如果您正苦于以下问题:C++ SharedIOSQPtr类的具体用法?C++ SharedIOSQPtr怎么用?C++ SharedIOSQPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SharedIOSQPtr类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CAST_TO_ACQ
void
IllegalCreateQs_r10b::RunCoreTest()
{
/** \verbatim
* Assumptions:
* 1) Test CreateResources_r10b has run prior.
* \endverbatim
*/
// Lookup objs which were created in a prior test within group
SharedACQPtr acq = CAST_TO_ACQ(gRsrcMngr->GetObj(ACQ_GROUP_ID))
SharedASQPtr asq = CAST_TO_ASQ(gRsrcMngr->GetObj(ASQ_GROUP_ID))
uint32_t numEntries = 2;
uint8_t dword;
uint32_t mask;
uint32_t value;
{
LOG_NRM("Create IOCQ ID #%d but toxify its QID to 0", IOQ_ID);
SharedIOCQPtr iocq = SharedIOCQPtr(new IOCQ(mFd));
iocq->Init(IOQ_ID, numEntries, true, 0);
LOG_NRM("Form a Create IOCQ cmd");
SharedCreateIOCQPtr iocqCmd = SharedCreateIOCQPtr(new CreateIOCQ());
iocqCmd->Init(iocq);
dword = 10;
mask = 0xFFFF;
value = 0;
SendToxicCmd(asq, acq, iocqCmd, dword, mask, value, CESTAT_INVALID_QID);
}
{
LOG_NRM("Create IOSQ ID #%d but toxify its QID to 0", IOQ_ID);
SharedIOSQPtr iosq = SharedIOSQPtr(new IOSQ(mFd));
iosq->Init(IOQ_ID, numEntries, IOQ_ID, 0);
LOG_NRM("Form a Create IOSQ cmd");
SharedCreateIOSQPtr iosqCmd = SharedCreateIOSQPtr(new CreateIOSQ());
iosqCmd->Init(iosq);
dword = 10;
mask = 0xFFFF;
value = 0;
SendToxicCmd(asq, acq, iosqCmd, dword, mask, value, CESTAT_INVALID_QID);
}
{
LOG_NRM("Create IOSQ ID #%d but wrongly associate to ACQ", IOQ_ID);
SharedIOSQPtr iosq = SharedIOSQPtr(new IOSQ(mFd));
iosq->Init(IOQ_ID, numEntries, IOQ_ID, 0);
LOG_NRM("Form a Create IOSQ cmd");
SharedCreateIOSQPtr iosqCmd = SharedCreateIOSQPtr(new CreateIOSQ());
iosqCmd->Init(iosq);
dword = 11;
mask = 0xFFFF0000;
value = 0;
SendToxicCmd(asq, acq, iosqCmd, dword, mask, value, CESTAT_CQ_INVALID);
}
}
示例2: FrmwkEx
void
WriteDataPat_r10b::SendToIOSQ(SharedIOSQPtr iosq, SharedIOCQPtr iocq,
SharedWritePtr writeCmd, string qualifier)
{
uint32_t numCE;
uint32_t ceRemain;
uint32_t numReaped;
uint32_t isrCount;
uint16_t uniqueId;
LOG_NRM("Send the cmd to hdw via %s IOSQ", qualifier.c_str());
iosq->Send(writeCmd, uniqueId);
iosq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iosq", qualifier),
"Just B4 ringing SQ doorbell, dump entire IOSQ contents");
iosq->Ring();
LOG_NRM("Wait for the CE to arrive in IOCQ");
if (iocq->ReapInquiryWaitSpecify(CALC_TIMEOUT_ms(1), 1, numCE, isrCount)
== false) {
iocq->Dump(
FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq", qualifier),
"Unable to see any CE's in IOCQ, dump entire CQ contents");
throw FrmwkEx(HERE, "Unable to see completion of cmd");
} else if (numCE != 1) {
iocq->Dump(
FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq", qualifier),
"Unable to see any CE's in IOCQ, dump entire CQ contents");
throw FrmwkEx(HERE,
"The IOCQ should only have 1 CE as a result of a cmd");
}
iocq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq", qualifier),
"Just B4 reaping IOCQ, dump entire CQ contents");
LOG_NRM("The CQ's metrics B4 reaping holds head_ptr needed");
struct nvme_gen_cq iocqMetrics = iocq->GetQMetrics();
KernelAPI::LogCQMetrics(iocqMetrics);
LOG_NRM("Reaping CE from IOCQ, requires memory to hold reaped CE");
SharedMemBufferPtr ceMemIOCQ = SharedMemBufferPtr(new MemBuffer());
if ((numReaped = iocq->Reap(ceRemain, ceMemIOCQ, isrCount, numCE, true))
!= 1) {
throw FrmwkEx(HERE, "Verified there was 1 CE, but reaping produced %d",
numReaped);
}
LOG_NRM("The reaped CE is...");
iocq->LogCE(iocqMetrics.head_ptr);
union CE ce = iocq->PeekCE(iocqMetrics.head_ptr);
ProcessCE::Validate(ce); // throws upon error
}
示例3: FrmwkEx
void
QIDVariations_r10b::ReapVerifyOnCQ(SharedIOCQPtr iocq, SharedIOSQPtr iosq)
{
uint32_t numCE;
uint32_t ceRemain;
uint32_t numReaped;
uint32_t isrCount;
LOG_NRM("Reap and verify CE.");
SharedMemBufferPtr ceMemIOCQ = SharedMemBufferPtr(new MemBuffer());
for (uint32_t nCmds = 1; nCmds < iosq->GetNumEntries(); nCmds++) {
LOG_NRM("Wait for the CE to arrive in IOCQ");
if (iocq->ReapInquiryWaitSpecify(CALC_TIMEOUT_ms(1), 1, numCE,
isrCount) == false) {
iocq->Dump(
FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq", "reapInq"),
"Unable to see any CE's in IOCQ, dump entire CQ contents");
throw FrmwkEx(HERE, "Unable to see completion of cmd");
}
LOG_NRM("The CQ's metrics B4 reaping holds head_ptr needed");
struct nvme_gen_cq iocqMetrics = iocq->GetQMetrics();
KernelAPI::LogCQMetrics(iocqMetrics);
if ((numReaped = iocq->Reap(ceRemain, ceMemIOCQ, isrCount, 1, true))
!= 1) {
iocq->Dump(
FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq", "reap"),
"Unable to see any CE's in IOCQ, dump entire CQ contents");
throw FrmwkEx(HERE, "Verified there was 1 CE, but reaping failed");
}
LOG_NRM("The reaped CE is...");
iocq->LogCE(iocqMetrics.head_ptr);
union CE ce = iocq->PeekCE(iocqMetrics.head_ptr);
ProcessCE::Validate(ce); // throws upon error
if (ce.n.SQID != iosq->GetQId()) {
iocq->Dump(
FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq", "sqId"),
"Wrong SQID in the CE of IOCQ, dump entire CQ contents");
throw FrmwkEx(HERE, "Invalid SQID %d in CE, expected SQID", ce.n.SQID,
iosq->GetQId());
}
}
}
示例4: FrmwkEx
void
IOQRollChkDiff_r10b::VerifyQPointers(SharedIOSQPtr iosq, SharedIOCQPtr iocq)
{
struct nvme_gen_cq iocqMetrics = iocq->GetQMetrics();
struct nvme_gen_sq iosqMetrics = iosq->GetQMetrics();
uint32_t expectedVal = (2 + MAX(iocq->GetNumEntries(),
iosq->GetNumEntries())) % iocq->GetNumEntries();
if (iocqMetrics.head_ptr != expectedVal) {
iocq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq",
"head_ptr"), "CQ Metrics Head Pointer Inconsistent");
throw FrmwkEx(HERE, "Expected IO CQ.head_ptr = 0x%04X but actual "
"IOCQ.head_ptr = 0x%04X", expectedVal, iocqMetrics.head_ptr);
}
expectedVal = (2 + MAX(iocq->GetNumEntries(), iosq->GetNumEntries())) %
iosq->GetNumEntries();
if (iosqMetrics.tail_ptr != expectedVal) {
iosq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iosq",
"tail_ptr"), "SQ Metrics Tail Pointer Inconsistent");
throw FrmwkEx(HERE, "Expected IO SQ.tail_ptr = 0x%04X but actual "
"IOSQ.tail_ptr = 0x%04X", expectedVal, iosqMetrics.tail_ptr);
}
}
示例5: SetPrpBuffer
void
CreateIOSQ::Init(const SharedIOSQPtr iosq)
{
// Setup the PRP buffer based upon contig or non-contig memory
int prpField = MASK_PRP1_PAGE;
if (iosq->GetIsContig() == false)
prpField |= MASK_PRP1_LIST;
SetPrpBuffer((send_64b_bitmask)prpField, iosq->GetQBuffer(),
iosq->GetQSize());
{ // Handle DWORD 10
uint32_t dword10 = GetDword(10);
// Handle q size
dword10 &= ~0xffff0000;
dword10 |= (((uint32_t)iosq->GetNumEntries()) << 16);
// Handle Q ID
dword10 &= ~0x0000ffff;
dword10 |= (uint32_t)iosq->GetQId();
SetDword(dword10, 10);
} // Handle DWORD 10
{ // Handle DWORD 11
uint32_t dword11 = GetDword(11);
// Handle the PC bit
if (iosq->GetIsContig())
dword11 |= 0x00000001;
else
dword11 &= ~0x00000001;
// Handle Q priority
dword11 &= ~0x00000006;
dword11 |= (((uint32_t)iosq->GetPriority()) << 1);
// Handle CQ ID
dword11 &= ~0xffff0000;
dword11 |= (((uint32_t)iosq->GetCqId()) << 16);
SetDword(dword11, 11);
} // Handle DWORD 11
}
示例6: CAST_TO_ASQ
void
IOQRollChkDiff_r10b::IOQRollChkDiff(uint32_t numEntriesIOSQ,
uint32_t numEntriesIOCQ)
{
uint16_t uniqueId;
// 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))
SharedIOCQPtr iocq = Queues::CreateIOCQContigToHdw(mGrpName,
mTestName, DEFAULT_CMD_WAIT_ms, asq, acq, IOQ_ID, numEntriesIOCQ,
false, IOCQ_CONTIG_GROUP_ID, false, 1);
SharedIOSQPtr iosq = Queues::CreateIOSQContigToHdw(mGrpName,
mTestName, DEFAULT_CMD_WAIT_ms, asq, acq, IOQ_ID, numEntriesIOSQ,
false, IOSQ_CONTIG_GROUP_ID, IOQ_ID, 0);
LOG_NRM("(IOCQ Size, IOSQ Size)=(%d,%d)", iocq->GetNumEntries(),
iosq->GetNumEntries());
SharedWritePtr writeCmd = SetWriteCmd();
LOG_NRM("Send #%d cmds to hdw via the contiguous IOSQ #%d",
MAX(iosq->GetNumEntries(), iocq->GetNumEntries()) + 2,
iosq->GetQId());
for (uint32_t numEntries = 0; numEntries < (uint32_t)(MAX
(iosq->GetNumEntries(), iocq->GetNumEntries()) + 2);
numEntries++) {
LOG_NRM("Processing #%d entries", numEntries);
iosq->Send(writeCmd, uniqueId);
iosq->Ring();
ReapAndVerifyCE(iocq, (numEntries + 1) % iosq->GetNumEntries());
}
VerifyQPointers(iosq, iocq);
LOG_NRM("Delete IOSQ before the IOCQ to comply with spec.");
Queues::DeleteIOSQToHdw(mGrpName, mTestName, DEFAULT_CMD_WAIT_ms,
iosq, asq, acq);
Queues::DeleteIOCQToHdw(mGrpName, mTestName, DEFAULT_CMD_WAIT_ms,
iocq, asq, acq);
}
示例7: FrmwkEx
void
CIDAcceptedIOSQ_r10b::ReapVerifyCID(SharedIOSQPtr iosq, SharedIOCQPtr iocq,
uint16_t expCID)
{
uint32_t isrCount;
uint32_t ceRemain;
uint32_t numReaped;
uint32_t numCE;
if (iocq->ReapInquiryWaitSpecify(CALC_TIMEOUT_ms(1), 1, numCE,
isrCount) == false) {
iocq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq.fail"),
"Dump Entire IOCQ");
iosq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iosq.fail"),
"Dump Entire IOSQ");
throw FrmwkEx(HERE, "Unable to see CEs for issued cmd");
}
SharedMemBufferPtr ceMem = SharedMemBufferPtr(new MemBuffer());
if ((numReaped = iocq->Reap(ceRemain, ceMem, isrCount, numCE, true)) != 1) {
iocq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq.fail"),
"Dump Entire IOCQ");
iosq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iosq.fail"),
"Dump Entire IOSQ");
throw FrmwkEx(HERE, "Unable to reap on IOCQ");
}
union CE *ce = (union CE *)ceMem->GetBuffer();
ProcessCE::Validate(*ce); // throws upon error
if (ce->n.CID != expCID) {
iocq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq.fail"),
"Dump Entire IOCQ");
iosq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iosq.fail"),
"Dump Entire IOSQ");
throw FrmwkEx(HERE, "Received CID %d but expected %d", ce->n.CID,
expCID);
}
if (ce->n.SQID != iosq->GetQId()) {
iocq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq.fail"),
"Dump Entire IOCQ");
iosq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iosq.fail"),
"Dump Entire IOSQ");
throw FrmwkEx(HERE, "Rx'd SDID %d but expt'd %d", ce->n.SQID,
iosq->GetQId());
}
}
示例8: FrmwkEx
void
MaxIOQMSIXManyTo1_r10b::SendCmdAndReap(SharedIOSQPtr iosq, SharedIOCQPtr iocq,
SharedCmdPtr cmd, uint32_t anticipatedIrqs)
{
uint16_t uniqueId;
uint32_t numCE;
string work;
uint32_t isrCount;
LOG_NRM("Send the cmd to hdw via IOSQ #%d", iosq->GetQId());
iosq->Send(cmd, uniqueId);
work = str(boost::format("ioqId.%d.%s") % iosq->GetQId() %
cmd->GetName().c_str());
iosq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iosq", work),
"Just B4 ringing doorbell, dump IOSQ");
iosq->Ring();
LOG_NRM("Wait for the CE to arrive in CQ %d", iocq->GetQId());
if (iocq->ReapInquiryWaitSpecify(DEFAULT_CMD_WAIT_ms, 1, numCE, isrCount)
== false) {
iocq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq.fail",
work), "Dump Entire IOCQ");
iosq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iosq.fail",
work), "Dump Entire IOSQ");
throw FrmwkEx(HERE, "Unable to see CEs for issued cmd");
}
work = str(boost::format("iocq.%d") % uniqueId);
IO::ReapCE(iocq, 1, isrCount, mGrpName, mTestName, work);
if (isrCount != anticipatedIrqs) {
iocq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iocq.fail",
work), "Dump Entire IOCQ");
iosq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName, "iosq.fail",
work), "Dump Entire IOSQ");
throw FrmwkEx(HERE, "Anticipated ISRs #%d but fired #%d",
anticipatedIrqs, isrCount);
}
}
示例9: CAST_TO_ASQ
void
UnsupportRsvdFields_r10b::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");
SharedIOCQPtr iocq = Queues::CreateIOCQContigToHdw(mGrpName, mTestName,
CALC_TIMEOUT_ms(1), asq, acq, IOQ_ID, maxIOQEntries, false,
IOCQ_GROUP_ID, true, 0);
LOG_NRM("Create IOSQ");
SharedIOSQPtr iosq = SharedIOSQPtr(new IOSQ(gDutFd));
LOG_NRM("Allocate contiguous memory; IOSQ has ID=%d", IOQ_ID);
iosq->Init(IOQ_ID, maxIOQEntries, IOQ_ID, 0);
LOG_NRM("Form a Create IOSQ cmd to perform queue creation");
SharedCreateIOSQPtr createIOSQCmd = SharedCreateIOSQPtr(new CreateIOSQ());
createIOSQCmd->Init(iosq);
LOG_NRM("Set all cmd's rsvd bits");
uint32_t work = createIOSQCmd->GetDword(0);
work |= 0x0000fc00; // Set DW0_b15:10 bits
createIOSQCmd->SetDword(work, 0);
createIOSQCmd->SetDword(0xffffffff, 2);
createIOSQCmd->SetDword(0xffffffff, 3);
createIOSQCmd->SetDword(0xffffffff, 4);
createIOSQCmd->SetDword(0xffffffff, 5);
createIOSQCmd->SetDword(0xffffffff, 6);
createIOSQCmd->SetDword(0xffffffff, 7);
// DW11_b15:3
work = createIOSQCmd->GetDword(11);
work |= 0x0000fff8;
createIOSQCmd->SetDword(work, 11);
createIOSQCmd->SetDword(0xffffffff, 12);
createIOSQCmd->SetDword(0xffffffff, 13);
createIOSQCmd->SetDword(0xffffffff, 14);
createIOSQCmd->SetDword(0xffffffff, 15);
IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq,
createIOSQCmd, "", true);
WriteReadVerify(iosq, iocq);
Queues::DeleteIOSQToHdw(mGrpName, mTestName, CALC_TIMEOUT_ms(1), iosq,
asq, acq, "", false);
Queues::DeleteIOCQToHdw(mGrpName, mTestName, CALC_TIMEOUT_ms(1), iocq,
asq, acq, "", false);
}
示例10: CAST_TO_ASQ
void
ManyCmdSubmit_r10b::RunCoreTest()
{
/** \verbatim
* Assumptions:
* 1) Test CreateResources_r10b has run prior.
* \endverbatim
*/
uint32_t nCmds;
uint32_t isrCount;
uint32_t ceRemain;
uint32_t numReaped;
uint32_t numCE;
uint16_t uniqueId;
// 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 the max IOQ entries supported");
uint64_t ctrlCapReg;
if (gRegisters->Read(CTLSPC_CAP, ctrlCapReg) == false)
throw FrmwkEx(HERE, "Unable to determine MQES");
uint32_t maxIOQEntries = (uint32_t)(ctrlCapReg & CAP_MQES);
maxIOQEntries += 1; // convert to 1-based.
LOG_NRM("Create contig IOQ's");
SharedIOCQPtr iocq = Queues::CreateIOCQContigToHdw(mGrpName,
mTestName, CALC_TIMEOUT_ms(1), asq, acq, IOQ_ID, maxIOQEntries,
false, IOCQ_CONTIG_GROUP_ID, true, 0);
SharedIOSQPtr iosq = Queues::CreateIOSQContigToHdw(mGrpName,
mTestName, CALC_TIMEOUT_ms(1), asq, acq, IOQ_ID, maxIOQEntries,
false, IOSQ_CONTIG_GROUP_ID, IOQ_ID, 0);
SharedWritePtr writeCmd = SetWriteCmd();
uint32_t increment = 1;
for (uint32_t x = 1; x < maxIOQEntries; x += increment) {
LOG_NRM("Sending #%d simultaneous NVM write cmds to IOSQ", x);
// Issue x simultaneous NVM write cmds.
for (nCmds = 1; nCmds <= x; nCmds++)
iosq->Send(writeCmd, uniqueId);
iosq->Ring();
// Variable wait time w.r.t "x" and expect all CE's to arrive in CQ.
if (iocq->ReapInquiryWaitSpecify(CALC_TIMEOUT_ms(x),
x, numCE, isrCount) == false) {
iocq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName,
"iocq.reqpinq." + writeCmd->GetName()), "Dump Entire IOCQ");
LogCEAndCQMetrics(iocq);
throw FrmwkEx(HERE, "Unable to see CEs for issued cmds #%d", x);
} else if (numCE != x) {
iocq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName,
"iocq.reqpinq." + writeCmd->GetName()), "Dump Entire IOCQ");
LogCEAndCQMetrics(iocq);
throw FrmwkEx(HERE, "The IOCQ should only have #%d CE's as a result "
"of #%d simultaneous cmds but found #%d", x, x, numCE);
}
SharedMemBufferPtr ceMem = SharedMemBufferPtr(new MemBuffer());
if ((numReaped = iocq->Reap(ceRemain, ceMem, isrCount, x, true)) != x) {
iocq->Dump(FileSystem::PrepDumpFile(mGrpName, mTestName,
"iocq.reap." + writeCmd->GetName()), "Dump Entire IOCQ");
LogCEAndCQMetrics(iocq);
throw FrmwkEx(HERE, "Unable to reap on IOCQ #%d. Reaped #%d of #%d",
IOQ_ID, numReaped, x);
}
// Testing every cmd takes numerous hrs, so compromise.
if ((maxIOQEntries - 1000) % x == 0)
increment = 100;
else if ((x % 1000) == 0)
increment = 1000;
else if ((maxIOQEntries - 100) % x == 0)
increment = 10;
else if ((x % 100) == 0)
increment = 100;
else if ((maxIOQEntries - 10) % x == 0)
increment = 1;
else if ((x % 10) == 0)
increment = 10;
}
// Delete IOSQ before the IOCQ to comply with spec.
Queues::DeleteIOSQToHdw(mGrpName, mTestName, CALC_TIMEOUT_ms(1),
iosq, asq, acq);
Queues::DeleteIOCQToHdw(mGrpName, mTestName, CALC_TIMEOUT_ms(1),
iocq, asq, acq);
}
示例11: CAST_TO_ASQ
void
MaxQSizeExceed_r10b::RunCoreTest()
{
/** \verbatim
* Assumptions:
* 1) Test CreateResources_r10b has run prior.
* \endverbatim
*/
uint64_t mqes;
string qualify;
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);
SharedIOCQPtr iocq = Queues::CreateIOCQContigToHdw(mGrpName, mTestName,
DEFAULT_CMD_WAIT_ms, asq, acq, IOQ_ID, maxIOQEntries, false,
IOCQ_GROUP_ID, false, 0);
if (gRegisters->Read(CTLSPC_CAP, mqes) == false)
throw FrmwkEx(HERE, "Unable to determine CAP.MQES");
mqes &= CAP_MQES;
mqes = mqes + 1; // convert to 1 - based
LOG_NRM("DUT's largest supported IOSQ size = 0x%05lX", mqes);
list<uint32_t> illegalQSizes = GetIllegalQSizes(mqes);
for (list<uint32_t>::iterator qSize = illegalQSizes.begin();
qSize != illegalQSizes.end(); qSize++) {
LOG_NRM("Create an IOSQ object with test lifetime");
SharedIOSQPtr iosq = SharedIOSQPtr(new IOSQ(gDutFd));
LOG_NRM("Issue CreateIOSQ with illegal Q size = 0x%08X", *qSize);
iosq->Init(IOQ_ID, *qSize, IOQ_ID, 0);
LOG_NRM("Form a Create IOSQ cmd to perform queue creation");
SharedCreateIOSQPtr createIOSQCmd =
SharedCreateIOSQPtr(new CreateIOSQ());
createIOSQCmd->Init(iosq);
qualify = str(boost::format("qsize.0x%04X") % *qSize);
IO::SendAndReapCmd(mGrpName, mTestName, DEFAULT_CMD_WAIT_ms, asq, acq,
createIOSQCmd, qualify, false, CESTAT_MAX_Q_SIZE_EXCEED);
}
LOG_NRM("Issue largest legal sized IOSQ 0x%05lX, should succeed", mqes);
LOG_NRM("Create an IOSQ object with test lifetime");
SharedIOSQPtr iosq = SharedIOSQPtr(new IOSQ(gDutFd));
LOG_NRM("Issue CreateIOSQ with legal Q size = 0x%08lX", mqes);
iosq->Init(IOQ_ID, mqes, IOQ_ID, 0);
LOG_NRM("Form a Create IOSQ cmd to perform queue creation");
SharedCreateIOSQPtr createIOSQCmd =
SharedCreateIOSQPtr(new CreateIOSQ());
createIOSQCmd->Init(iosq);
qualify = str(boost::format("qsize.0x%04lX") % mqes);
IO::SendAndReapCmd(mGrpName, mTestName, DEFAULT_CMD_WAIT_ms, asq, acq,
createIOSQCmd, qualify, false);
Queues::DeleteIOSQToHdw(mGrpName, mTestName, DEFAULT_CMD_WAIT_ms, iosq,
asq, acq, "", false);
Queues::DeleteIOCQToHdw(mGrpName, mTestName, DEFAULT_CMD_WAIT_ms, iocq,
asq, acq, "", false);
}
示例12: FrmwkEx
void
InvalidQID_r10b::RunCoreTest()
{
/** \verbatim
* Assumptions:
* None.
* \endverbatim
*/
string work;
bool enableLog;
uint64_t maxIOQEntries = 2;
if (gCtrlrConfig->SetState(ST_DISABLE_COMPLETELY) == false)
throw FrmwkEx(HERE);
LOG_NRM("Create admin queues ACQ and ASQ");
SharedACQPtr acq = SharedACQPtr(new ACQ(mFd));
acq->Init(5);
SharedASQPtr asq = SharedASQPtr(new ASQ(mFd));
asq->Init(5);
// All queues will use identical IRQ vector
IRQ::SetAnySchemeSpecifyNum(1);
gCtrlrConfig->SetCSS(CtrlrConfig::CSS_NVM_CMDSET);
if (gCtrlrConfig->SetState(ST_ENABLE) == false)
throw FrmwkEx(HERE);
// Calc X, max no. of IOSQ's DUT supports.
uint32_t X = gInformative->GetFeaturesNumOfIOSQs();
LOG_NRM("Maximum num of IOSQ's DUT will support = %d", X);
LOG_NRM("Setup element sizes for the IOQ's");
gCtrlrConfig->SetIOCQES(gInformative->GetIdentifyCmdCtrlr()->
GetValue(IDCTRLRCAP_CQES) & 0xf);
gCtrlrConfig->SetIOSQES(gInformative->GetIdentifyCmdCtrlr()->
GetValue(IDCTRLRCAP_SQES) & 0xf);
LOG_NRM("Create IOCQ with QID = %d", IOQ_ID);
SharedIOCQPtr iocq = Queues::CreateIOCQContigToHdw(mGrpName, mTestName,
DEFAULT_CMD_WAIT_ms, asq, acq, IOQ_ID, maxIOQEntries, false,
IOCQ_GROUP_ID, true, 0);
LOG_NRM("Issue CreateIOSQ cmds with QID's ranging from %d to %d",
(X + 1), MAX_IOQ_ID);
list<uint32_t> illegalQIDs = GetIllegalQIDs(X + 1);
for (list<uint32_t>::iterator qId = illegalQIDs.begin();
qId != illegalQIDs.end(); qId++) {
LOG_NRM("Process CreateIOSQCmd with iosq id #%d and assoc iocq id #%d",
*qId, IOQ_ID);
SharedIOSQPtr iosq = SharedIOSQPtr(new IOSQ(mFd));
iosq->Init(*qId, maxIOQEntries, IOQ_ID, 0);
SharedCreateIOSQPtr createIOSQCmd =
SharedCreateIOSQPtr(new CreateIOSQ());
createIOSQCmd->Init(iosq);
work = str(boost::format("iosqId.%d") % *qId);
enableLog = false;
if ((*qId <= (X + 8)) || (*qId >= (MAX_IOQ_ID - 8)))
enableLog = true;
LOG_NRM("Send and reap cmd with SQ ID #%d", *qId);
IO::SendAndReapCmd(mGrpName, mTestName, DEFAULT_CMD_WAIT_ms, asq, acq,
createIOSQCmd, work, enableLog, CESTAT_INVALID_QID);
}
}
示例13: FrmwkEx
void
PartialReapMSIX_r10b::RunCoreTest()
{
/** \verbatim
* Assumptions:
* 1) Requires test createResources_r10b to execute 1st
* \endverbatim
*/
bool capable;
char work[25];
uint64_t reg;
uint16_t numIrqSupport;
uint16_t numIrqs = 1;
uint16_t uniqueId;
uint32_t isrCount;
uint32_t numCE;
// Only allowed to execute if DUT supports MSI-X IRQ's
if (gCtrlrConfig->IsMSIXCapable(capable, numIrqSupport) == false)
throw FrmwkEx(HERE);
else if (capable == false) {
LOG_WARN("DUT does not support MSI-X IRQ's; unable to execute test");
return;
}
// This requirement must be met, if not then DUT is most likely at fault
if (gRegisters->Read(CTLSPC_CAP, reg) == false)
throw FrmwkEx(HERE, "Unable to determine CAP.MQES");
reg &= CAP_MQES;
reg += 1; // convert to 1-based
if (reg < (uint64_t)NUM_IOQ_ENTRY) {
LOG_WARN("Desired to support >= %d elements in IOQ's for test",
NUM_IOQ_ENTRY);
return;
}
LOG_NRM("Setup the necessary IRQ's");
if (gCtrlrConfig->SetState(ST_DISABLE) == false)
throw FrmwkEx(HERE);
if (gCtrlrConfig->SetIrqScheme(INT_MSIX, numIrqs) == false) {
throw FrmwkEx(HERE,
"Unable to use %d IRQ's, but DUT reports it supports", numIrqs);
}
gCtrlrConfig->SetCSS(CtrlrConfig::CSS_NVM_CMDSET);
if (gCtrlrConfig->SetState(ST_ENABLE) == false)
throw FrmwkEx(HERE);
// 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("Create the IOQ pair which is needed");
gCtrlrConfig->SetIOCQES(gInformative->GetIdentifyCmdCtrlr()->
GetValue(IDCTRLRCAP_CQES) & 0xf);
SharedIOCQPtr iocq = Queues::CreateIOCQContigToHdw(mGrpName, mTestName,
DEFAULT_CMD_WAIT_ms, asq, acq, IOQ_ID, NUM_IOQ_ENTRY, false, "",
true, 0);
gCtrlrConfig->SetIOSQES(gInformative->GetIdentifyCmdCtrlr()->
GetValue(IDCTRLRCAP_SQES) & 0xf);
SharedIOSQPtr iosq = Queues::CreateIOSQContigToHdw(mGrpName, mTestName,
DEFAULT_CMD_WAIT_ms, asq, acq, IOQ_ID, NUM_IOQ_ENTRY, false, "",
IOQ_ID, 0);
// NOTE: We are overloading IRQ 0, it is being used by ACQ and we have
// created 1 IOQ's, thus to start out the ACQ will already have 2
// IRQs. The following algo must add this usage.
uint32_t anticipatedIrqs = (2 + 1);
SharedWritePtr writeCmd = CreateCmd();
for (unsigned i = 1; i <= NUM_CMDS_ISSUE; i++) {
LOG_NRM("Sending write cmd %d", i);
iosq->Send(writeCmd, uniqueId);
iosq->Ring();
LOG_NRM("Wait for cmd to be processed");
if (iocq->ReapInquiryWaitSpecify(DEFAULT_CMD_WAIT_ms, i, numCE,
isrCount) == false) {
iocq->Dump(
FileSystem::PrepDumpFile(mGrpName, mTestName, "acq",
"error"), "Unable to determine if CE's arrived");
throw FrmwkEx(HERE, "Only detected %d CE's arriving", numCE);
} else if (numCE != i) {
iocq->Dump(
FileSystem::PrepDumpFile(mGrpName, mTestName, "acq",
"notEnough"), "Test requires seeing all CE's");
throw FrmwkEx(HERE,
"The anticipated %d CE's have not arrived", i);
} else if (isrCount != anticipatedIrqs) {
// 1 IRQ per cmd did not occur
iocq->Dump(
FileSystem::PrepDumpFile(mGrpName, mTestName, "acq",
"irqBad"), "Test requires seeing all correct num of IRQ's");
throw FrmwkEx(HERE,
"The anticipated %d IRQ', but detected %d", anticipatedIrqs,
isrCount);
}
}
//.........这里部分代码省略.........
示例14: LOG_WARN
void
PRPLessPageDiscontig_r10b::RunCoreTest()
{
/** \verbatim
* Assumptions:
* None
* \endverbatim
*/
string work;
bool enableLog;
if (Queues::SupportDiscontigIOQ() == false) {
LOG_WARN("DUT must support discontig Q's for this test.");
return;
}
uint64_t ctrlCapReg;
LOG_NRM("Determine the max IOQ entries supported");
if (gRegisters->Read(CTLSPC_CAP, ctrlCapReg) == false)
throw FrmwkEx(HERE, "Unable to determine MQES");
uint32_t maxIOQEntries = (ctrlCapReg & CAP_MQES);
maxIOQEntries += 1; // convert to 1-based
LOG_NRM("Compute memory page size from CC.MPS.");
uint8_t mps;
if (gCtrlrConfig->GetMPS(mps) == false)
throw FrmwkEx(HERE, "Unable to get MPS value from CC.");
uint64_t capMPS = (uint64_t)(1 << (mps + 12));
LOG_NRM("Determine element sizes for the IOCQ's");
uint8_t iocqes = (gInformative->GetIdentifyCmdCtrlr()->
GetValue(IDCTRLRCAP_CQES) & 0xf);
uint32_t Y = ((capMPS / (1 << iocqes)) - 1);
if (maxIOQEntries < Y) {
LOG_WARN("Desired to support >= %d elements in IOCQ for this test", Y);
return;
}
LOG_NRM("Determine element sizes for the IOSQ's");
uint8_t iosqes = (gInformative->GetIdentifyCmdCtrlr()->
GetValue(IDCTRLRCAP_SQES) & 0xf);
uint32_t Z = ((capMPS / (1 << iosqes)) - 1);
LOG_NRM("Computed memory page size from CC.MPS = %ld", capMPS);
LOG_NRM("Max IOQ entries supported CAP.MQES = %d", maxIOQEntries);
LOG_NRM("Number of IOCQ elements = %d", Y);
LOG_NRM("Number of IOSQ elements = %d", Z);
if (gCtrlrConfig->SetState(ST_DISABLE_COMPLETELY) == false)
throw FrmwkEx(HERE);
LOG_NRM("Create admin queues ACQ and ASQ");
SharedACQPtr acq = SharedACQPtr(new ACQ(gDutFd));
acq->Init(5);
SharedASQPtr asq = SharedASQPtr(new ASQ(gDutFd));
asq->Init(5);
// All queues will use identical IRQ vector
IRQ::SetAnySchemeSpecifyNum(1); // throws upon error
gCtrlrConfig->SetCSS(CtrlrConfig::CSS_NVM_CMDSET);
if (gCtrlrConfig->SetState(ST_ENABLE) == false)
throw FrmwkEx(HERE);
Informative::Namspc namspcData = gInformative->Get1stBareMetaE2E();
LBAFormat lbaFormat = namspcData.idCmdNamspc->GetLBAFormat();
uint64_t lbaDataSize = namspcData.idCmdNamspc->GetLBADataSize();
LOG_NRM("Setup element sizes for the IOQ's");
gCtrlrConfig->SetIOCQES(iocqes);
gCtrlrConfig->SetIOSQES(iosqes);
LOG_NRM("Create discontig IOSQ and IOCQ with IDs 1");
SharedMemBufferPtr iocqBackedMem = SharedMemBufferPtr(new MemBuffer());
iocqBackedMem->InitOffset1stPage((Y * (1 << iocqes)), 0, true);
SharedIOCQPtr iocq = Queues::CreateIOCQDiscontigToHdw(mGrpName, mTestName,
DEFAULT_CMD_WAIT_ms, asq, acq, IOQ_ID, Y, false, IOCQ_GROUP_ID,
true, 0, iocqBackedMem);
SharedMemBufferPtr iosqBackedMem = SharedMemBufferPtr(new MemBuffer());
iosqBackedMem->InitOffset1stPage((Z * (1 << iosqes)), 0,true);
SharedIOSQPtr iosq = Queues::CreateIOSQDiscontigToHdw(mGrpName, mTestName,
DEFAULT_CMD_WAIT_ms, asq, acq, IOQ_ID, Z, false, IOSQ_GROUP_ID,
IOQ_ID, 0, iosqBackedMem);
SharedWritePtr writeCmd = SharedWritePtr(new Write());
SharedMemBufferPtr writeMem = SharedMemBufferPtr(new MemBuffer());
SharedReadPtr readCmd = SharedReadPtr(new Read());
SharedMemBufferPtr readMem = SharedMemBufferPtr(new MemBuffer());
send_64b_bitmask prpBitmask = (send_64b_bitmask)(MASK_PRP1_PAGE |
MASK_PRP2_PAGE | MASK_PRP2_LIST);
switch (namspcData.type) {
case Informative::NS_BARE:
writeMem->Init(lbaDataSize);
readMem->Init(lbaDataSize);
break;
//.........这里部分代码省略.........