@@ -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;
0 commit comments