@@ -56,6 +56,8 @@ namespace {
5656constexpr auto DATA_COUNTER_INITIAL_VALUE = std::numeric_limits<uint32_t >::max();
5757// / Initial value for link packet counters
5858constexpr auto PACKET_COUNTER_INITIAL_VALUE = std::numeric_limits<uint32_t >::max();
59+ // / Initial value for link event counters
60+ constexpr auto EVENT_COUNTER_INITIAL_VALUE = std::numeric_limits<uint32_t >::max();
5961// / Maximum supported links
6062constexpr auto MAX_LINKS = 32 ;
6163// / Interval for low priority thread (display updates, etc)
@@ -203,6 +205,11 @@ class ProgramDmaBench: public Program
203205 i = PACKET_COUNTER_INITIAL_VALUE;
204206 }
205207
208+ for (auto &i : mEventCounters ) {
209+ i = EVENT_COUNTER_INITIAL_VALUE;
210+ }
211+
212+
206213 getLogger () << " DMA channel: " << mOptions .dmaChannel << endm;
207214
208215 auto cardId = Options::getOptionCardId (map);
@@ -641,7 +648,8 @@ class ProgramDmaBench: public Program
641648 bool checkErrorsCru (uintptr_t pageAddress, size_t pageSize, int64_t eventNumber, int linkId, std::string loopbackMode)
642649 {
643650 if (loopbackMode == " DDG" ) {
644- if (eventNumber % mErrorCheckFrequency == 0 ) {
651+ mEventCounters [linkId] = (mEventCounters [linkId] + 1 ) % EVENT_COUNTER_INITIAL_VALUE;
652+ if (mEventCounters [linkId] % mErrorCheckFrequency == 0 ) {
645653 return checkErrorsCruDdg (pageAddress, pageSize, eventNumber, linkId);
646654 } else { // no check -> no error
647655 return false ;
@@ -722,15 +730,15 @@ class ProgramDmaBench: public Program
722730 const auto packetCounter = Cru::DataFormat::getPacketCounter (reinterpret_cast <const char *>(pageAddress));
723731
724732 if (mPacketCounters [linkId] == PACKET_COUNTER_INITIAL_VALUE) {
725- mErrorStream << b::format (" resync packet counter for e:%d l:%d packet_cnt:%x mpacket_cnt:%x\n " ) % eventNumber % linkId % packetCounter %
726- mPacketCounters [linkId];
733+ mErrorStream << b::format (" resync packet counter for e:%d l:%d packet_cnt:%x mpacket_cnt:%x le:%d \n " ) % eventNumber % linkId % packetCounter %
734+ mPacketCounters [linkId] % mEventCounters [linkId] ;
727735 mPacketCounters [linkId] = packetCounter;
728736 } else if (((mPacketCounters [linkId] + mErrorCheckFrequency ) % 0x100 ) != packetCounter) { // packetCounter is 8bits long
729737 // log packet counter error
730738 mErrorCount ++;
731739 if (mErrorCount < MAX_RECORDED_ERRORS) {
732- mErrorStream << b::format (" [RDHERR]\t event:%1% l:%2% payloadBytes:%3% size:%4% packet_cnt:%5% mpacket_cnt:%6% unexpected packet counter\n " )
733- % eventNumber % linkId % memBytes % pageSize % packetCounter % mPacketCounters [linkId];
740+ mErrorStream << b::format (" [RDHERR]\t event:%1% l:%2% payloadBytes:%3% size:%4% packet_cnt:%5% mpacket_cnt:%6% levent:%7% unexpected packet counter\n " )
741+ % eventNumber % linkId % memBytes % pageSize % packetCounter % mPacketCounters [linkId] % mEventCounters [linkId] ;
734742 }
735743 return true ;
736744 } else {
@@ -1089,6 +1097,9 @@ class ProgramDmaBench: public Program
10891097 // Packet counter per link
10901098 std::array<std::atomic<uint32_t >, MAX_LINKS> mPacketCounters ;
10911099
1100+ // Event counter per link
1101+ std::array<std::atomic<uint32_t >, MAX_LINKS> mEventCounters ;
1102+
10921103 // Keep these as DMA page counters for better granularity
10931104 // / Amount of DMA pages pushed
10941105 std::atomic<uint64_t > mPushCount { 0 };
0 commit comments