本文整理汇总了C++中ConstSharedIdentifyPtr::GetMaxDataXferSize方法的典型用法代码示例。如果您正苦于以下问题:C++ ConstSharedIdentifyPtr::GetMaxDataXferSize方法的具体用法?C++ ConstSharedIdentifyPtr::GetMaxDataXferSize怎么用?C++ ConstSharedIdentifyPtr::GetMaxDataXferSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConstSharedIdentifyPtr
的用法示例。
在下文中一共展示了ConstSharedIdentifyPtr::GetMaxDataXferSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SharedWritePtr
void
StartingLBABare_r10b::RunCoreTest()
{
/** \verbatim
* Assumptions:
* 1) Test CreateResources_r10b has run prior.
* \endverbatim
*/
string work;
bool enableLog;
ConstSharedIdentifyPtr namSpcPtr;
// Lookup objs which were created in a prior test within group
SharedIOSQPtr iosq = CAST_TO_IOSQ(gRsrcMngr->GetObj(IOSQ_GROUP_ID));
SharedIOCQPtr iocq = CAST_TO_IOCQ(gRsrcMngr->GetObj(IOCQ_GROUP_ID));
ConstSharedIdentifyPtr idCmdCtrlr = gInformative->GetIdentifyCmdCtrlr();
uint32_t maxDtXferSz = idCmdCtrlr->GetMaxDataXferSize();
if (maxDtXferSz == 0)
maxDtXferSz = MAX_DATA_TX_SIZE;
LOG_NRM("Prepare cmds to be send through Q's.");
SharedWritePtr writeCmd = SharedWritePtr(new Write());
SharedMemBufferPtr writeMem = SharedMemBufferPtr(new MemBuffer());
send_64b_bitmask prpBitmask = (send_64b_bitmask)
(MASK_PRP1_PAGE | MASK_PRP2_PAGE | MASK_PRP2_LIST);
SharedReadPtr readCmd = SharedReadPtr(new Read());
SharedMemBufferPtr readMem = SharedMemBufferPtr(new MemBuffer());
DataPattern dataPat[] = {
DATAPAT_INC_8BIT,
DATAPAT_CONST_8BIT,
DATAPAT_INC_16BIT,
DATAPAT_CONST_16BIT,
DATAPAT_INC_32BIT,
DATAPAT_CONST_32BIT
};
uint64_t dpArrSize = sizeof(dataPat) / sizeof(dataPat[0]);
LOG_NRM("Seeking all bare namspc's.");
vector<uint32_t> bare = gInformative->GetBareNamespaces();
for (size_t i = 0; i < bare.size(); i++) {
LOG_NRM("Processing for BARE name space id #%d", bare[i]);
namSpcPtr = gInformative->GetIdentifyCmdNamspc(bare[i]);
uint64_t ncap = namSpcPtr->GetValue(IDNAMESPC_NCAP);
uint64_t lbaDataSize = namSpcPtr->GetLBADataSize();
uint64_t maxWrBlks = maxDtXferSz / lbaDataSize;
writeMem->Init(maxWrBlks * lbaDataSize);
writeCmd->SetPrpBuffer(prpBitmask, writeMem);
writeCmd->SetNSID(bare[i]);
writeCmd->SetNLB(maxWrBlks - 1); // 0 based value.
readMem->Init(maxWrBlks * lbaDataSize);
readCmd->SetPrpBuffer(prpBitmask, readMem);
readCmd->SetNSID(bare[i]);
readCmd->SetNLB(maxWrBlks - 1); // 0 based value.
for (uint64_t nWrBlks = 0; nWrBlks < (ncap - 1); nWrBlks += maxWrBlks) {
LOG_NRM("Sending #%ld blks of #%ld", nWrBlks, (ncap -1));
for (uint64_t nLBA = 0; nLBA < maxWrBlks; nLBA++) {
writeMem->SetDataPattern(dataPat[nLBA % dpArrSize],
(nWrBlks + nLBA + 1), (nLBA * lbaDataSize), lbaDataSize);
}
writeCmd->SetSLBA(nWrBlks);
readCmd->SetSLBA(nWrBlks);
enableLog = false;
if ((nWrBlks <= maxWrBlks) || (nWrBlks >= (ncap - 2 * maxWrBlks)))
enableLog = true;
work = str(boost::format("NSID.%d.SLBA.%ld") % bare[i] % nWrBlks);
IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), iosq,
iocq, writeCmd, work, enableLog);
IO::SendAndReapCmd(mGrpName, mTestName, CALC_TIMEOUT_ms(1), iosq,
iocq, readCmd, work, enableLog);
VerifyDataPat(readCmd, writeMem);
}
}
}
示例2: FrmwkEx
void
PRPOffsetDualPgMultiBlk_r10b::RunCoreTest()
{
/** \verbatim
* Assumptions:
* None.
* \endverbatim
*/
string work;
int64_t X;
bool enableLog;
if (gCtrlrConfig->SetState(ST_DISABLE_COMPLETELY) == false)
throw FrmwkEx(HERE);
LOG_NRM("Create ACQ and ASQ objects which have test life time");
SharedACQPtr acq = CAST_TO_ACQ(SharedACQPtr(new ACQ(mFd)))
acq->Init(5);
SharedASQPtr asq = CAST_TO_ASQ(SharedASQPtr(new ASQ(mFd)))
asq->Init(5);
IRQ::SetAnySchemeSpecifyNum(2); // throws upon error
gCtrlrConfig->SetCSS(CtrlrConfig::CSS_NVM_CMDSET);
if (gCtrlrConfig->SetState(ST_ENABLE) == false)
throw FrmwkEx(HERE);
SharedIOCQPtr iocq;
SharedIOSQPtr iosq;
InitTstRsrcs(asq, acq, iosq, iocq);
LOG_NRM("Compute memory page size from CC.MPS.");
uint8_t mpsRegVal;
if (gCtrlrConfig->GetMPS(mpsRegVal) == false)
throw FrmwkEx(HERE, "Unable to get MPS value from CC.");
uint64_t ccMPS = (uint64_t)(1 << (mpsRegVal + 12));
LOG_NRM("Get namspc and determine LBA size");
Informative::Namspc namspcData = gInformative->Get1stBareMetaE2E();
send_64b_bitmask prpBitmask =
(send_64b_bitmask)(MASK_PRP1_PAGE | MASK_PRP2_PAGE);
LBAFormat lbaFormat = namspcData.idCmdNamspc->GetLBAFormat();
uint64_t lbaDataSize = (1 << lbaFormat.LBADS);
LOG_NRM("LBA data size is %ld.", lbaDataSize);
LOG_NRM("Seeking max data xfer size for chosen namspc");
ConstSharedIdentifyPtr idCmdCtrlr = gInformative->GetIdentifyCmdCtrlr();
uint32_t maxDtXferSz = idCmdCtrlr->GetMaxDataXferSize();
SharedWritePtr writeCmd = SharedWritePtr(new Write());
writeCmd->SetNSID(namspcData.id);
SharedReadPtr readCmd = SharedReadPtr(new Read());
readCmd->SetNSID(namspcData.id);
SharedMemBufferPtr writeMem = SharedMemBufferPtr(new MemBuffer());
SharedMemBufferPtr readMem = SharedMemBufferPtr(new MemBuffer());
switch (namspcData.type) {
case Informative::NS_BARE:
X = ccMPS - lbaDataSize;
break;
case Informative::NS_METAS:
X = ccMPS - lbaDataSize;
LOG_NRM("Allocating separate meta data buffer.");
if (gRsrcMngr->SetMetaAllocSize(
lbaFormat.MS * ((2 * ccMPS) / lbaDataSize)) == false) {
throw FrmwkEx(HERE, "Unable to allocate Meta buffers.");
}
writeCmd->AllocMetaBuffer();
readCmd->AllocMetaBuffer();
break;
case Informative::NS_METAI:
X = ccMPS - (lbaDataSize + lbaFormat.MS);
break;
case Informative::NS_E2ES:
case Informative::NS_E2EI:
throw FrmwkEx(HERE, "Deferring work to handle this case in future");
break;
}
if (X < 0) {
LOG_WARN("CC.MPS < lba data size(LBADS); Can't run test.");
return;
}
DataPattern dataPat;
uint64_t wrVal;
uint64_t Y;
for (int64_t pgOff = 0; pgOff <= X; pgOff += 4) {
switch (namspcData.type) {
case Informative::NS_BARE:
case Informative::NS_METAS:
Y = ((2 * ccMPS) - pgOff) / lbaDataSize;
break;
case Informative::NS_METAI:
Y = ((2 * ccMPS) - pgOff) / (lbaDataSize + lbaFormat.MS);
break;
case Informative::NS_E2ES:
case Informative::NS_E2EI:
//.........这里部分代码省略.........
示例3: FrmwkEx
void
FunctionalityMeta_r10b::RunCoreTest()
{
/** \verbatim
* Assumptions:
* None.
* \endverbatim
*/
string work;
bool enableLog;
ConstSharedIdentifyPtr namSpcPtr;
SharedIOSQPtr iosq;
SharedIOCQPtr iocq;
uint64_t maxWrBlks;
if (gCtrlrConfig->SetState(ST_DISABLE_COMPLETELY) == false)
throw FrmwkEx(HERE);
SharedACQPtr acq = SharedACQPtr(new ACQ(gDutFd));
acq->Init(5);
SharedASQPtr asq = SharedASQPtr(new ASQ(gDutFd));
asq->Init(5);
ConstSharedIdentifyPtr idCmdCtrlr = gInformative->GetIdentifyCmdCtrlr();
uint32_t maxDtXferSz = idCmdCtrlr->GetMaxDataXferSize();
if (maxDtXferSz == 0)
maxDtXferSz = MAX_DATA_TX_SIZE;
LOG_NRM("Prepare cmds to be send through Q's.");
SharedWritePtr writeCmd = SharedWritePtr(new Write());
SharedMemBufferPtr writeMem = SharedMemBufferPtr(new MemBuffer());
SharedReadPtr readCmd = SharedReadPtr(new Read());
SharedMemBufferPtr readMem = SharedMemBufferPtr(new MemBuffer());
SharedFlushPtr flushCmd = SharedFlushPtr(new Flush());
DataPattern dataPat[] = {
DATAPAT_INC_8BIT,
DATAPAT_CONST_8BIT,
DATAPAT_INC_16BIT,
DATAPAT_CONST_16BIT,
DATAPAT_INC_32BIT,
DATAPAT_CONST_32BIT
};
uint64_t dpArrSize = sizeof(dataPat) / sizeof(dataPat[0]);
send_64b_bitmask prpBitmask = (send_64b_bitmask)
(MASK_PRP1_PAGE | MASK_PRP2_PAGE | MASK_PRP2_LIST);
LOG_NRM("Seeking all meta namspc's.");
vector<uint32_t> meta = gInformative->GetMetaNamespaces();
for (size_t i = 0; i < meta.size(); i++) {
LOG_NRM("Processing meta namspc id #%d of %ld", meta[i], meta.size());
if (gCtrlrConfig->SetState(ST_DISABLE) == false)
throw FrmwkEx(HERE);
// 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 IOSQ and IOCQ with ID #%d", IOQ_ID);
CreateIOQs(asq, acq, IOQ_ID, iosq, iocq);
LOG_NRM("Get LBA format and lba data size for namespc #%d", meta[i]);
namSpcPtr = gInformative->GetIdentifyCmdNamspc(meta[i]);
LBAFormat lbaFormat = namSpcPtr->GetLBAFormat();
uint64_t lbaDataSize = (1 << lbaFormat.LBADS);
uint64_t ncap = namSpcPtr->GetValue(IDNAMESPC_NCAP);
uint64_t metaBuffSz = 0;
LOG_NRM("Set read and write buffers based on the namspc type");
switch (gInformative->IdentifyNamespace(namSpcPtr)) {
case Informative::NS_BARE:
throw FrmwkEx(HERE, "Namspc type cannot be BARE.");
case Informative::NS_METAS:
maxWrBlks = maxDtXferSz / lbaDataSize;
metaBuffSz = maxWrBlks * lbaFormat.MS;
if (gRsrcMngr->SetMetaAllocSize(metaBuffSz) == false)
throw FrmwkEx(HERE);
LOG_NRM("Max rd/wr blks %ld using separate meta buff of ncap %ld",
maxWrBlks, ncap);
writeMem->Init(maxWrBlks * lbaDataSize);
readMem->Init(maxWrBlks * lbaDataSize);
writeCmd->AllocMetaBuffer();
readCmd->AllocMetaBuffer();
break;
case Informative::NS_METAI:
maxWrBlks = maxDtXferSz / (lbaDataSize + lbaFormat.MS);
LOG_NRM("Max rd/wr blks %ld using integrated meta buff of ncap %ld",
maxWrBlks, ncap);
writeMem->Init(maxWrBlks * (lbaDataSize + lbaFormat.MS));
readMem->Init(maxWrBlks * (lbaDataSize + lbaFormat.MS));
break;
case Informative::NS_E2ES:
case Informative::NS_E2EI:
throw FrmwkEx(HERE, "Deferring work to handle this case in future");
//.........这里部分代码省略.........