本文整理汇总了C++中SharedACQPtr::PeekCE方法的典型用法代码示例。如果您正苦于以下问题:C++ SharedACQPtr::PeekCE方法的具体用法?C++ SharedACQPtr::PeekCE怎么用?C++ SharedACQPtr::PeekCE使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SharedACQPtr
的用法示例。
在下文中一共展示了SharedACQPtr::PeekCE方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FrmwkEx
void
AdminQRollChkDiff_r10b::VerifyCESQValues(SharedACQPtr acq,
uint16_t expectedVal)
{
union CE ce;
struct nvme_gen_cq acqMetrics = acq->GetQMetrics();
// The CQ's metrics after reaping holds head_ptr plus 1 needed. Also Take
// Q roll over into account
if (acqMetrics.head_ptr == 0) {
ce = acq->PeekCE(acq->GetNumEntries() - 1);
} else {
ce = acq->PeekCE(acqMetrics.head_ptr - 1);
}
if (ce.n.SQID != 0) {
acq->Dump(
FileSystem::PrepDumpFile(mGrpName, mTestName, "acq", "CE.SQID"),
"CE SQ ID Inconsistent");
throw FrmwkEx(HERE, "Expected CE.SQID = 0 in ACQ completion entry but actual "
"CE.SQID = 0x%04X", ce.n.SQID);
}
if (ce.n.SQHD != expectedVal) {
acq->Dump(
FileSystem::PrepDumpFile(mGrpName, mTestName, "acq", "CE.SQHD"),
"CE SQ Head Pointer Inconsistent");
throw FrmwkEx(HERE,
"Expected CE.SQHD = 0x%04X in ACQ completion entry but actual "
"CE.SQHD = 0x%04X", expectedVal, ce.n.SQHD);
}
}
示例2: SharedGetFeaturesPtr
bool
GrpAdminSetGetFeatCombo::RestoreTLER(SharedASQPtr asq, SharedACQPtr acq)
{
SharedGetFeaturesPtr getFeaturesCmd =
SharedGetFeaturesPtr(new GetFeatures());
SharedSetFeaturesPtr setFeaturesCmd =
SharedSetFeaturesPtr(new SetFeatures());
LOG_NRM("Restoring state with TLER = 0x%04X", mTimeLimErrRec);
setFeaturesCmd->SetFID(FID[FID_ERR_RECOVERY]);
getFeaturesCmd->SetFID(FID[FID_ERR_RECOVERY]);
setFeaturesCmd->SetDword(mTimeLimErrRec, 11);
IO::SendAndReapCmd(mGrpName, mGrpName, CALC_TIMEOUT_ms(1), asq, acq,
setFeaturesCmd, "RestoreTLER", true);
struct nvme_gen_cq acqMetrics = acq->GetQMetrics();
IO::SendAndReapCmd(mGrpName, mGrpName, CALC_TIMEOUT_ms(1), asq, acq,
getFeaturesCmd, "RestoreTLER", true);
union CE ce = acq->PeekCE(acqMetrics.head_ptr);
if (mTimeLimErrRec != ce.t.dw0) {
LOG_ERR("TLER restore to original state failed. "
"(Actual: Expected) = (0x%04X:0x%04X)", ce.t.dw0, mTimeLimErrRec);
return false;
}
return true;
}
示例3: SharedGetFeaturesPtr
bool
GrpAdminSetGetFeatCombo::RestoreTMPTH(SharedASQPtr asq, SharedACQPtr acq)
{
SharedGetFeaturesPtr getFeaturesCmd =
SharedGetFeaturesPtr(new GetFeatures());
SharedSetFeaturesPtr setFeaturesCmd =
SharedSetFeaturesPtr(new SetFeatures());
LOG_NRM("Restoring state with TMPTH = 0x%04X", mTmpThreshold);
setFeaturesCmd->SetFID(BaseFeatures::FID_TEMP_THRESHOLD);
getFeaturesCmd->SetFID(BaseFeatures::FID_TEMP_THRESHOLD);
setFeaturesCmd->SetDword(mTmpThreshold, 11);
IO::SendAndReapCmd(mGrpName, mGrpName, CALC_TIMEOUT_ms(1), asq, acq,
setFeaturesCmd, "RestoreTMPTH", true);
struct nvme_gen_cq acqMetrics = acq->GetQMetrics();
IO::SendAndReapCmd(mGrpName, mGrpName, CALC_TIMEOUT_ms(1), asq, acq,
getFeaturesCmd, "RestoreTMPTH", true);
union CE ce = acq->PeekCE(acqMetrics.head_ptr);
if (mTmpThreshold != ce.t.dw0) {
LOG_ERR("TMPTH restore to original state failed. "
"(Actual: Expected) = (0x%04X:0x%04X)", ce.t.dw0, mTmpThreshold);
return false;
}
return true;
}
示例4: FrmwkEx
void
FIDPwrMgmt_r10b::RunCoreTest()
{
/** \verbatim
* Assumptions:
* None.
* \endverbatim
*/
string work;
union CE ce;
struct nvme_gen_cq acqMetrics;
if (gCtrlrConfig->SetState(ST_DISABLE_COMPLETELY) == false)
throw FrmwkEx(HERE);
LOG_NRM("Create admin queues ACQ and ASQ for test lifetime");
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);
gCtrlrConfig->SetCSS(CtrlrConfig::CSS_NVM_CMDSET);
if (gCtrlrConfig->SetState(ST_ENABLE) == false)
throw FrmwkEx(HERE);
LOG_NRM("Create Get features and set features cmds");
SharedGetFeaturesPtr getFeaturesCmd =
SharedGetFeaturesPtr(new GetFeatures());
SharedSetFeaturesPtr setFeaturesCmd =
SharedSetFeaturesPtr(new SetFeatures());
LOG_NRM("Set and Get features PSD (FID = 0x%x)", BaseFeatures::FID_PWR_MGMT);
getFeaturesCmd->SetFID(BaseFeatures::FID_PWR_MGMT);
setFeaturesCmd->SetFID(BaseFeatures::FID_PWR_MGMT);
uint8_t npss = gInformative->GetIdentifyCmdCtrlr()->
GetValue(IDCTRLRCAP_NPSS); // 0-based
LOG_NRM("Number of power states supported by the ctrlr (NPSS) = %d", npss);
uint8_t psMismatch = 0;
for (uint16_t ps = 0; ps <= npss; ps++) {
LOG_NRM("Set and Get features for PS # %d", ps);
setFeaturesCmd->SetPowerManagementPS(ps);
LOG_NRM("Issue set features cmd with PS = %d", ps);
work = str(boost::format("ps.%d") % ps);
IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq,
setFeaturesCmd, work, true);
acqMetrics = acq->GetQMetrics();
LOG_NRM("Issue get features cmd and check for ps = %d", ps);
IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq,
getFeaturesCmd, work, false);
ce = acq->PeekCE(acqMetrics.head_ptr);
LOG_NRM("Power state descriptor using Get Features = %d", ce.t.dw0);
if (ps != ce.t.dw0) {
LOG_ERR("PSD get feat does not match set feat"
"(expected, rcvd) = (%d, %d)", ps, ce.t.dw0);
psMismatch = 0xFF;
}
}
if (psMismatch)
throw FrmwkEx(HERE, "Power state mismatched.");
}
示例5: FrmwkEx
void
FIDVolatileCash_r10b::RunCoreTest()
{
/** \verbatim
* Assumptions:
* None.
* \endverbatim
*/
string work;
union CE ce;
struct nvme_gen_cq acqMetrics;
if (gCtrlrConfig->SetState(ST_DISABLE_COMPLETELY) == false)
throw FrmwkEx(HERE);
LOG_NRM("Create admin queues ACQ and ASQ for test lifetime");
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);
gCtrlrConfig->SetCSS(CtrlrConfig::CSS_NVM_CMDSET);
if (gCtrlrConfig->SetState(ST_ENABLE) == false)
throw FrmwkEx(HERE);
LOG_NRM("Create Get features and set features cmds");
SharedGetFeaturesPtr getFeaturesCmd =
SharedGetFeaturesPtr(new GetFeatures());
SharedSetFeaturesPtr setFeaturesCmd =
SharedSetFeaturesPtr(new SetFeatures());
LOG_NRM("Set and Get features for volatile write cache (FID = 0x%x)",
BaseFeatures::FID_VOL_WR_CACHE);
getFeaturesCmd->SetFID(BaseFeatures::FID_VOL_WR_CACHE);
setFeaturesCmd->SetFID(BaseFeatures::FID_VOL_WR_CACHE);
uint8_t wce = 0x0; // Disable volatile write cache
LOG_NRM("Disable volatile wr cache # %d ", wce);
setFeaturesCmd->SetVolatileWriteCacheWCE(wce);
LOG_NRM("Issue set features cmd with WCE = %d", wce);
work = str(boost::format("wce.%d") % wce);
IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1),
asq, acq, setFeaturesCmd, work, true);
acqMetrics = acq->GetQMetrics();
LOG_NRM("Issue get features cmd & check wce = %d", wce);
IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1),
asq, acq, getFeaturesCmd, work, false);
ce = acq->PeekCE(acqMetrics.head_ptr);
LOG_NRM("Get Features volatile wr cache = %d", ce.t.dw0);
if (wce != ce.t.dw0) {
throw FrmwkEx(HERE, "WCE get feat does not match set feat"
"(expected, rcvd) = (%d, %d)", wce, ce.t.dw0);
}
wce = 0x1; // Enable volatile write cache
LOG_NRM("Enable volatile wr cache # %d ", wce);
setFeaturesCmd->SetVolatileWriteCacheWCE(wce);
LOG_NRM("Issue set features cmd with WCE = %d", wce);
work = str(boost::format("wce.%d") % wce);
IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1),
asq, acq, setFeaturesCmd, work, true);
acqMetrics = acq->GetQMetrics();
LOG_NRM("Issue get features cmd & check wce = %d", wce);
IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1),
asq, acq, getFeaturesCmd, work, false);
ce = acq->PeekCE(acqMetrics.head_ptr);
LOG_NRM("Get Features volatile wr cache = %d", ce.t.dw0);
if (wce != ce.t.dw0) {
throw FrmwkEx(HERE, "WCE get feat does not match set feat"
"(expected, rcvd) = (%d, %d)", wce, ce.t.dw0);
}
}
示例6: SetFeaturesNumberOfQueues
bool SetFeaturesNumberOfQueues(Queues &queues, int fd)
{
uint16_t numCE;
uint16_t ceRemain;
uint16_t numReaped;
try { // The objects to perform this work throw exceptions
LOG_NRM("Setting number of Q's; ncqr=0x%04X, nsqr=0x%04X",
queues.ncqr, queues.nsqr);
if (gCtrlrConfig->SetState(ST_DISABLE_COMPLETELY) == false)
throw exception();
LOG_NRM("Prepare the admin Q's to setup this request");
SharedACQPtr acq = SharedACQPtr(new ACQ(fd));
acq->Init(2);
SharedASQPtr asq = SharedASQPtr(new ASQ(fd));
asq->Init(2);
if (gCtrlrConfig->SetState(ST_ENABLE) == false)
throw exception();
LOG_NRM("Create the cmd to carry this data to the DUT");
SharedSetFeaturesPtr sfNumOfQ =
SharedSetFeaturesPtr(new SetFeatures(fd));
sfNumOfQ->SetFID(BaseFeatures::FID_NUM_QUEUES);
sfNumOfQ->SetNumberOfQueues(queues.ncqr, queues.nsqr);
LOG_NRM("Send the cmd to the ASQ, wait for it to complete");
asq->Send(sfNumOfQ);
asq->Ring();
if (acq->ReapInquiryWaitSpecify(2000, 1, numCE) == false) {
LOG_ERR("Unable to see completion of Set Features cmd");
throw exception();
} else if (numCE != 1) {
LOG_ERR("The ACQ should only have 1 CE as a result of a cmd");
throw exception();
}
LOG_NRM("The CQ's metrics before reaping holds head_ptr needed");
struct nvme_gen_cq acqMetrics = acq->GetQMetrics();
KernelAPI::LogCQMetrics(acqMetrics);
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 get features CE is...");
acq->LogCE(acqMetrics.head_ptr);
union CE ce = acq->PeekCE(acqMetrics.head_ptr);
if (ce.n.status != 0) {
LOG_ERR("CE shows cmd failed: status = 0x%02X", ce.n.status);
throw exception();
}
printf("The operation succeeded to set number of queues\n");
} catch (...) {
printf("Operation failed to set number of queues\n");
return false;
}
return true;
}