@@ -144,6 +144,9 @@ class ProgramDmaBench: public Program
144144 (" loopback" ,
145145 po::value<std::string>(&mOptions .loopbackModeString )->default_value (" INTERNAL" ),
146146 " Generator loopback mode [NONE, INTERNAL, DIU, SIU, DDG]" )
147+ (" max-rdh-packetcount" ,
148+ po::value<size_t >(&mOptions .maxRdhPacketCounter )->default_value (255 ),
149+ " Maximum packet counter expected in the RDH" )
147150 (" no-errorcheck" ,
148151 po::bool_switch (&mOptions .noErrorCheck ),
149152 " Skip error checking" )
@@ -309,6 +312,8 @@ class ProgramDmaBench: public Program
309312 mFastCheckEnabled = mOptions .fastCheckEnabled ;
310313 getLogger () << " Fast check enabled" << endm;
311314 }
315+ mMaxRdhPacketCounter = mOptions .maxRdhPacketCounter ;
316+ getLogger () << " Maximum RDH packet counter" << mMaxRdhPacketCounter << endm;
312317 }
313318
314319 if (mOptions .dataGeneratorSize != 0 ) {
@@ -733,7 +738,7 @@ class ProgramDmaBench: public Program
733738 mErrorStream << b::format (" resync packet counter for e:%d l:%d packet_cnt:%x mpacket_cnt:%x le:%d \n " ) % eventNumber % linkId % packetCounter %
734739 mPacketCounters [linkId] % mEventCounters [linkId];
735740 mPacketCounters [linkId] = packetCounter;
736- } else if (((mPacketCounters [linkId] + mErrorCheckFrequency ) % 0x100 ) != packetCounter) { // packetCounter is 8bits long
741+ } else if (((mPacketCounters [linkId] + mErrorCheckFrequency ) % ( mMaxRdhPacketCounter + 1 ) ) != packetCounter) { // packetCounter is 8bits long
737742 // log packet counter error
738743 mErrorCount ++;
739744 if (mErrorCount < MAX_RECORDED_ERRORS) {
@@ -743,7 +748,7 @@ class ProgramDmaBench: public Program
743748 return true ;
744749 } else {
745750 // mErrorStream << b::format("packet_cnt:%d mpacket_cnt:%d freq:%d en:%d\n") % packetCounter % mPacketCounters[linkId] % mErrorCheckFrequency % eventNumber;
746- mPacketCounters [linkId] = packetCounter; // same as = (mPacketCounters + mErrorCheckFrequency) % 0x100
751+ mPacketCounters [linkId] = packetCounter; // same as = (mPacketCounters + mErrorCheckFrequency) % mMaxRdhPacketCounter
747752 }
748753
749754 // Skip data check if fast check enabled
@@ -1083,6 +1088,7 @@ class ProgramDmaBench: public Program
10831088 std::string timeLimitString;
10841089 uint64_t pausePush;
10851090 uint64_t pauseRead;
1091+ size_t maxRdhPacketCounter;
10861092 } mOptions ;
10871093
10881094 // / The DMA channel
@@ -1169,6 +1175,9 @@ class ProgramDmaBench: public Program
11691175
11701176 // / Flag that marks that runtime has started
11711177 bool mRunTimeStarted = false ;
1178+
1179+ // / The maximum value of the RDH Packet Counter
1180+ size_t mMaxRdhPacketCounter ;
11721181};
11731182
11741183int main (int argc, char ** argv)
0 commit comments