Skip to content

Commit 30b9d7f

Browse files
authored
Merge pull request #236 from sy-c/master
v2.15.2
2 parents 02ca3f4 + e6fa501 commit 30b9d7f

File tree

5 files changed

+52
-8
lines changed

5 files changed

+52
-8
lines changed

doc/releaseNotes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,3 +501,6 @@ This file describes the main feature changes for each readout.exe released versi
501501
- Updated configuration parameters:
502502
- added readout.fairmqConsoleSeverity, to set fair::Logger::SetConsoleSeverity
503503
- Explicit log message when reporting error state, in case not reported by state machine
504+
505+
## v2.15.2 - 08/12/2022
506+
- Added ROC link Id for some log messages, as provided from new superpage metadata link field from ROC library.

src/RdhUtils.cxx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,23 +70,27 @@ int RdhHandle::validateRdh(std::string& err)
7070
int retCode = 0;
7171
// expecting RDH v5 or v6
7272
if ((getHeaderVersion() != 5) && (getHeaderVersion() != 6)) {
73-
err += "Wrong header version\n";
73+
if (err.length()) err += ", ";
74+
err += "Wrong header version";
7475
retCode++;
7576
}
7677
// check header size
7778
if (getHeaderSize() != sizeof(o2::Header::RAWDataHeader)) {
78-
err += "Wrong header size\n";
79+
if (err.length()) err += ", ";
80+
err += "Wrong header size";
7981
retCode++;
8082
}
8183
// expecting linkId 0-31
8284
if (getLinkId() > RdhMaxLinkId) {
83-
err += "Wrong link ID\n";
85+
if (err.length()) err += ", ";
86+
err += "Wrong link ID";
8487
retCode++;
8588
}
8689

8790
// expecting offset next packet at least the size of the header
8891
if ((getOffsetNextPacket() > 0) && (getOffsetNextPacket() < sizeof(o2::Header::RAWDataHeader))) {
89-
err += "Wrong offsetNextPacket\n";
92+
if (err.length()) err += ", ";
93+
err += "Wrong offsetNextPacket";
9094
retCode++;
9195
}
9296

src/ReadoutEquipment.cxx

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -672,10 +672,12 @@ int ReadoutEquipment::tagDatablockFromRdh(RdhHandle& h, DataBlockHeader& bh)
672672
uint32_t hbOrbit = undefinedOrbit;
673673
bool isError = 0;
674674

675+
static InfoLogger::AutoMuteToken logRdhErrorsToken(LogWarningSupport_(3004), 30, 5);
676+
675677
// check that it is a correct RDH
676678
std::string errorDescription;
677679
if (h.validateRdh(errorDescription) != 0) {
678-
theLog.log(LogWarningSupport_(3004), "First RDH in page is wrong: %s", errorDescription.c_str());
680+
theLog.log(logRdhErrorsToken, "First RDH in page is wrong (link %s): %s", (bh.linkId == undefinedLinkId) ? "undefined" : std::to_string((int)bh.linkId).c_str(), errorDescription.c_str());
679681
isError = 1;
680682
} else {
681683
// timeframe ID
@@ -705,7 +707,13 @@ int ReadoutEquipment::tagDatablockFromRdh(RdhHandle& h, DataBlockHeader& bh)
705707
bh.systemId = systemId;
706708
bh.feeId = feeId;
707709
bh.equipmentId = equipmentId;
708-
bh.linkId = linkId;
710+
if (bh.linkId == undefinedLinkId) {
711+
bh.linkId = linkId;
712+
} else {
713+
if ((bh.linkId != linkId) && (linkId != undefinedLinkId)) {
714+
theLog.log(logRdhErrorsToken, "linkId mismatch: ROC reports %d != RDH reports %d", (int)bh.linkId, (int)linkId);
715+
}
716+
}
709717
getTimeframeOrbitRange(tfId, bh.timeframeOrbitFirst, bh.timeframeOrbitLast);
710718
bh.timeframeOrbitFirst -= bh.orbitOffset;
711719
bh.timeframeOrbitLast -= bh.orbitOffset;
@@ -872,7 +880,7 @@ int ReadoutEquipment::processRdh(DataBlockContainerReference& block)
872880
printf("%08X ", (int)(((uint32_t*)baseAddress)[i]));
873881
}
874882
printf("\n");
875-
printf("Page 0x%p + %ld\n%s", (void*)baseAddress, pageOffset, errorDescription.c_str());
883+
printf("Page 0x%p + %ld\n%s\n", (void*)baseAddress, pageOffset, errorDescription.c_str());
876884
h.dumpRdh(pageOffset, 1);
877885
errorDescription.clear();
878886
}
@@ -951,6 +959,30 @@ int ReadoutEquipment::processRdh(DataBlockContainerReference& block)
951959

952960
uint16_t offsetNextPacket = h.getOffsetNextPacket();
953961
if (offsetNextPacket == 0) {
962+
963+
// provision for further checks on superpage size
964+
/*
965+
theLog.log(logRdhErrorsToken, "Equipment %d RDH #%d @ 0x%X : offsetNextPacket is null", id, rdhIndexInPage, (unsigned int)pageOffset);
966+
statsRdhCheckErr++;
967+
isPageError = 1;
968+
break;
969+
}
970+
if ((pageOffset + h.getMemorySize() == blockSize)&&(pageOffset + offsetNextPacket == blockSize)) {
971+
// this is normal end of page: the last packet fills the end of the page
972+
theLog.log(logRdhErrorsToken, "Equipment %d RDH #%d @ 0x%X : end packet size ok: offsetNextpacket = %d bytes, memorySize = %d bytes, page = %d bytes", id, rdhIndexInPage, (unsigned int)pageOffset, (int)offsetNextPacket, (int)h.getMemorySize(), (int)blockSize);
973+
break;
974+
}
975+
if ((pageOffset + offsetNextPacket == blockSize)||(pageOffset + h.getMemorySize() == blockSize)) {
976+
theLog.log(logRdhErrorsToken, "Equipment %d RDH #%d @ 0x%X : end packet size mismatch: offsetNextpacket = %d bytes, memorySize = %d bytes, page = %d bytes", id, rdhIndexInPage, (unsigned int)pageOffset, (int)offsetNextPacket, (int)h.getMemorySize(), (int)blockSize);
977+
// this is normal end of page: the last packet fills the end of the page
978+
break;
979+
}
980+
if (pageOffset + offsetNextPacket > blockSize) {
981+
theLog.log(logRdhErrorsToken, "Equipment %d RDH #%d @ 0x%X : next packet (+ %d bytes) is outside of page (%d bytes)", id, rdhIndexInPage, (unsigned int)pageOffset, (int)offsetNextPacket, (int)blockSize);
982+
statsRdhCheckErr++;
983+
isPageError = 1;
984+
*/
985+
954986
break;
955987
}
956988
pageOffset += offsetNextPacket;

src/ReadoutEquipmentRORC.cxx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,11 @@ DataBlockContainerReference ReadoutEquipmentRORC::getNextBlock()
357357
nextBlock = d;
358358
d->getData()->header.dataSize = superpage.getReceived();
359359

360+
// check if link ID set by ROC lib, and propagate it to header
361+
int deviceLinkId = superpage.getLink();
362+
if ((deviceLinkId >= 0) && (deviceLinkId <= (int)RdhMaxLinkId)) {
363+
d->getData()->header.linkId = (uint8_t)(deviceLinkId);
364+
}
360365
// printf("\nPage %llu\n",statsNumberOfPages);
361366
} else {
362367
// there is a ready superpage, but we are not able to keep it

src/ReadoutVersion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
1111

12-
#define READOUT_VERSION "2.15.1"
12+
#define READOUT_VERSION "2.15.2"
1313

0 commit comments

Comments
 (0)