本文整理汇总了C++中SharedGetFeaturesPtr类的典型用法代码示例。如果您正苦于以下问题:C++ SharedGetFeaturesPtr类的具体用法?C++ SharedGetFeaturesPtr怎么用?C++ SharedGetFeaturesPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SharedGetFeaturesPtr类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SharedGetFeaturesPtr
bool
GrpAdminSetGetFeatCombo::RestoreVolWrCache(SharedASQPtr asq, SharedACQPtr acq)
{
SharedGetFeaturesPtr getFeaturesCmd =
SharedGetFeaturesPtr(new GetFeatures());
SharedSetFeaturesPtr setFeaturesCmd =
SharedSetFeaturesPtr(new SetFeatures());
LOG_NRM("Restoring state with VWC = 0x%04X", mVolWrCache);
setFeaturesCmd->SetFID(FID[FID_VOL_WR_CACHE]);
getFeaturesCmd->SetFID(FID[FID_VOL_WR_CACHE]);
setFeaturesCmd->SetDword(mVolWrCache, 11);
IO::SendAndReapCmd(mGrpName, mGrpName, CALC_TIMEOUT_ms(1), asq, acq,
setFeaturesCmd, "RestoreVWC", true);
struct nvme_gen_cq acqMetrics = acq->GetQMetrics();
IO::SendAndReapCmd(mGrpName, mGrpName, CALC_TIMEOUT_ms(1), asq, acq,
getFeaturesCmd, "RestoreVWC", true);
union CE ce = acq->PeekCE(acqMetrics.head_ptr);
if (mVolWrCache != ce.t.dw0) {
LOG_ERR("VWC restore to original state failed. "
"(Actual: Expected) = (0x%04X:0x%04X)", ce.t.dw0, mVolWrCache);
return false;
}
return true;
}
示例2: 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;
}
示例3: LOG_NRM
void
GrpAdminSetGetFeatCombo::SaveTMPTH(SharedASQPtr asq, SharedACQPtr acq)
{
LOG_NRM("Create Get features cmd");
SharedGetFeaturesPtr getFeaturesCmd =
SharedGetFeaturesPtr(new GetFeatures());
getFeaturesCmd->SetFID(FID[FID_TEMP_THRESHOLD]);
struct nvme_gen_cq acqMetrics = acq->GetQMetrics();
IO::SendAndReapCmd(mGrpName, mGrpName, CALC_TIMEOUT_ms(1), asq, acq,
getFeaturesCmd, "SaveFeatTmpThr", true);
union CE ce = acq->PeekCE(acqMetrics.head_ptr);
mTmpThreshold = ce.t.dw0;
LOG_NRM("Default tmp threshold using Get Features = 0x%04X", mTmpThreshold);
}
示例4: CAST_TO_ASQ
void
InvalidFieldInCmd_r10b::RunCoreTest()
{
/** \verbatim
* Assumptions:
* 1) Test CreateResources_r10b has run prior.
* \endverbatim
*/
string work;
// 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 Get features cmd");
SharedGetFeaturesPtr getFeaturesCmd =
SharedGetFeaturesPtr(new GetFeatures());
LOG_NRM("Form a vector of invalid FID's");
vector<uint16_t> invalidFIDs;
uint8_t invalFID;
invalidFIDs.push_back(0x00);
for (uint8_t invalFID = 0x0D; invalFID <= 0x7F; invalFID++)
invalidFIDs.push_back(invalFID);
if ((gInformative->GetIdentifyCmdCtrlr()->GetValue(IDCTRLRCAP_ONCS))
& ONCS_SUP_RSRV)
invalFID = 0x84;
else
invalFID = 0x81;
for (; invalFID <= 0xBF; invalFID++)
invalidFIDs.push_back(invalFID);
for (uint16_t i = 0; i < invalidFIDs.size(); i++) {
if (invalidFIDs[i] == 0x81)
continue;
LOG_NRM("Issue get feat cmd using invalid FID = 0x%X", invalidFIDs[i]);
getFeaturesCmd->SetFID(invalidFIDs[i]);
work = str(boost::format("invalidFIDs.%xh") % invalidFIDs[i]);
IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq,
getFeaturesCmd, work, true, CESTAT_INVAL_FIELD);
}
}
示例5: 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.");
}
示例6: 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);
}
}
示例7: LOG_NRM
void
RegisterReservation::RunCoreTest()
{
/** \verbatim
* Assumptions:
* None.
* \endverbatim
*/
LOG_NRM("Start RegisterReservationHostB::RunCoreTest");
SharedIOSQPtr iosq = CAST_TO_IOSQ(gRsrcMngr->GetObj(IOSQ_GROUP_ID));
SharedIOCQPtr iocq = CAST_TO_IOCQ(gRsrcMngr->GetObj(IOCQ_GROUP_ID));
SharedASQPtr asq = CAST_TO_ASQ(gRsrcMngr->GetObj(ASQ_GROUP_ID));
SharedACQPtr acq = CAST_TO_ACQ(gRsrcMngr->GetObj(ACQ_GROUP_ID));
//uint8_t keyToRegister[16];
//uint32_t memAlignment = sysconf(_SC_PAGESIZE);
CEStat retStat;
LOG_NRM("Create Set features cmd to set HostID");
SharedSetFeaturesPtr setFeaturesCmd = SharedSetFeaturesPtr(new SetFeatures());
setFeaturesCmd->SetFID(0x81); // Host Identifier
LOG_NRM("Create memory to contain HostID payload");
SharedMemBufferPtr writeHostIDmem = SharedMemBufferPtr(new MemBuffer());
// Init(uint32_t bufSize, bool initMem = false, uint8_t initVal = 0)
writeHostIDmem->Init(8, true, 0xBB);
//writeHostIDmem->InitAlignment(8, true, true, 0xAA); // HostID = 0xAAAAAAAAAAAAAAAA
send_64b_bitmask prpBitmask = (send_64b_bitmask) MASK_PRP1_PAGE;
setFeaturesCmd->SetPrpBuffer(prpBitmask, writeHostIDmem);
IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq, setFeaturesCmd, "Set 0xBBs hostID", true, CESTAT_SUCCESS);
LOG_NRM("Create Get features cmd to read back HostID");
SharedGetFeaturesPtr getFeaturesCmd = SharedGetFeaturesPtr(new GetFeatures());
getFeaturesCmd->SetFID(0x81); // Host Identifier
SharedMemBufferPtr readHostIDmem = SharedMemBufferPtr(new MemBuffer());
readHostIDmem->Init(8, true, 0x00); // HostID = 0xAAAAAAAAAAAAAAAA
getFeaturesCmd->SetPrpBuffer(prpBitmask, readHostIDmem);
std::vector<CEStat> acceptableReturnStatuses = {CESTAT_SUCCESS, CESTAT_IGNORE};
retStat = IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), asq, acq, getFeaturesCmd, "Read back hostID", true, acceptableReturnStatuses);
if(retStat != CESTAT_SUCCESS) {
LOG_NRM("Was unable to get back HostId after setting...");
} else {
LOG_NRM("Compare returned HostID to what was just previously set...");
if (writeHostIDmem->Compare(readHostIDmem) == false) {
LOG_NRM("HostID MISMATCH!!!");
writeHostIDmem->Dump(
FileSystem::PrepDumpFile(mGrpName, mTestName, "WriteHostID"),
"setFeatures HostID");
readHostIDmem->Dump(
FileSystem::PrepDumpFile(mGrpName, mTestName, "ReadHostId"),
"getFeatures HostID");
throw FrmwkEx(HERE, "Data miscompare");
}
}
// HostID should be set... now we can register a key, first we will try to release
SharedMemBufferPtr writeRegKey = SharedMemBufferPtr(new MemBuffer());
SharedReservationRegisterPtr reservationRegisterCmd = SharedReservationRegisterPtr(new ReservationRegister());
LOG_NRM("Release any current key with IKEY=1. If pass we cleared a key, else was already clear.");
reservationRegisterCmd->SetNSID(1);
reservationRegisterCmd->SetCPTPL(0); // No PTPL change
reservationRegisterCmd->SetIEKEY(1);
reservationRegisterCmd->SetRREGA(1); // Unregister Key
writeRegKey->Init(16, true, 0); // 0's in buffer, IKEY will ignore CKEY/NKEY
reservationRegisterCmd->SetPrpBuffer(prpBitmask, writeRegKey);
std::vector<CEStat> possibleReturnStatuses = {CESTAT_SUCCESS, CESTAT_RSRV_CONFLICT, CESTAT_IGNORE};
retStat = IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), iosq, iocq, reservationRegisterCmd, "Release Any Key HostB", true, possibleReturnStatuses);
switch(retStat) {
case CESTAT_SUCCESS:
LOG_NRM("Success status returned, a key was assumed to have been present and is now cleared.");
break;
case CESTAT_RSRV_CONFLICT:
LOG_NRM("Rsrv Conflict status returned, a key was assumed have not been present to be able to be cleared.");
break;
default:
LOG_NRM("Unknown stat returned back while attempting to unregister a potential exhisting key... continuing.");
}
LOG_NRM("Register our key (0xBD's), expecting pass");
reservationRegisterCmd->SetNSID(1);
reservationRegisterCmd->SetCPTPL(0); // No PTPL change
reservationRegisterCmd->SetIEKEY(1);
reservationRegisterCmd->SetRREGA(0); // Register Key
writeRegKey->Init(16, true, 0xBD); // 0xAF's as arbitrary new key
reservationRegisterCmd->SetPrpBuffer(prpBitmask, writeRegKey);
retStat = IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), iosq, iocq, reservationRegisterCmd, "Register Key 0xBD HostB", true, CESTAT_SUCCESS);
//LOG_NRM("Try to register (not replace) a new key. Should always fail even with IEKEY=1 and same key as before... Expecting Rsvr Conflict.");
// Same command as before...
/*
reservationRegisterCmd->SetNSID(1);
reservationRegisterCmd->SetCPTPL(0); // No PTPL change
reservationRegisterCmd->SetIEKEY(1);
reservationRegisterCmd->SetRREGA(0); // Register Key
writeRegKey->InitAlignment(16, true, 0xAE); // 0xAF's as arbitrary new key
reservationRegisterCmd->SetPrpBuffer(prpBitmask, writeRegKey);
*/
//retStat = IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), iosq, iocq, reservationRegisterCmd, "Register Key 0xBD HostB", true, CESTAT_RSRV_CONFLICT);
//.........这里部分代码省略.........