Skip to content

Commit 8efaee6

Browse files
committed
[cru] Only pop RDH-sized Superpages from active links
1 parent da87736 commit 8efaee6

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/Cru/CruDmaChannel.cxx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,17 @@ void CruDmaChannel::deviceStopDma()
164164
int moved = 0;
165165
for (auto& link : mLinks) {
166166
int32_t superpageCount = getBar()->getSuperpageCount(link.id);
167+
if (superpageCount == 0) { // Do not pop superpages if the link has been inactive
168+
continue;
169+
}
167170
uint32_t amountAvailable = superpageCount - link.superpageCounter;
168171
//log((format("superpageCount %1% amountAvailable %2%") % superpageCount % amountAvailable).str());
169172
for (uint32_t i = 0; i < (amountAvailable + 1); ++i) { // get an extra, possibly partly filled superpage
170173
if (mReadyQueue.size() >= READY_QUEUE_CAPACITY) {
171174
break;
172175
}
173176
if (!link.queue.empty()) { // care for the extra filled superpage
174-
transferSuperpageFromLinkToReady(link);
177+
transferSuperpageFromLinkToReady(link, true);
175178
moved++;
176179
}
177180
}
@@ -268,15 +271,17 @@ void CruDmaChannel::pushSuperpageToLink(Link& link, const Superpage& superpage)
268271
link.queue.push_back(superpage);
269272
}
270273

271-
void CruDmaChannel::transferSuperpageFromLinkToReady(Link& link)
274+
void CruDmaChannel::transferSuperpageFromLinkToReady(Link& link, bool isPopped)
272275
{
273276
if (link.queue.empty()) {
274277
BOOST_THROW_EXCEPTION(Exception() << ErrorInfo::Message("Could not transfer Superpage from link to ready queue, link queue is empty"));
275278
}
276279

277280
link.queue.front().setReady(true);
278281
uint32_t superpageSize = getBar()->getSuperpageSize(link.id);
279-
if (superpageSize == 0) { //backwards compatible in case the superpage size register is empty
282+
if (isPopped) { // Only RDH in case it is popped
283+
link.queue.front().setReceived(0x40);
284+
} else if (superpageSize == 0) { //backwards compatible in case the superpage size register is empty
280285
link.queue.front().setReceived(link.queue.front().getSize()); // force the full superpage size
281286
} else {
282287
link.queue.front().setReceived(superpageSize);

src/Cru/CruDmaChannel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class CruDmaChannel final : public DmaChannelPdaBase
115115
void pushSuperpageToLink(Link& link, const Superpage& superpage);
116116

117117
/// Mark the front superpage of a link ready and transfer it to the ready queue
118-
void transferSuperpageFromLinkToReady(Link& link);
118+
void transferSuperpageFromLinkToReady(Link& link, bool isPopped = false);
119119

120120
/// Enable debug mode by writing to the appropriate CRU register
121121
void enableDebugMode();

0 commit comments

Comments
 (0)