diff --git a/orchagent/pfcactionhandler.cpp b/orchagent/pfcactionhandler.cpp index 0b94b77475..3778ef1c5f 100644 --- a/orchagent/pfcactionhandler.cpp +++ b/orchagent/pfcactionhandler.cpp @@ -55,14 +55,23 @@ void PfcWdActionHandler::initCounters(void) } auto wdQueueStats = getQueueStats(m_countersTable, sai_serialize_object_id(m_queue)); - wdQueueStats.detectCount++; + // initCounters() is called when the event channel receives + // a storm signal. This can happen when there is a true new storm or + // when there is an existing storm ongoing before warm-reboot. In the latter case, + // we treat the storm as an old storm. In particular, + // we do not increment the detectCount so as to clamp the + // gap between detectCount and restoreCount by 1 at maximum + if (!(wdQueueStats.detectCount > wdQueueStats.restoreCount)) + { + wdQueueStats.detectCount++; + + wdQueueStats.txPktLast = 0; + wdQueueStats.txDropPktLast = 0; + wdQueueStats.rxPktLast = 0; + wdQueueStats.rxDropPktLast = 0; + } wdQueueStats.operational = false; - wdQueueStats.txPktLast = 0; - wdQueueStats.txDropPktLast = 0; - wdQueueStats.rxPktLast = 0; - wdQueueStats.rxDropPktLast = 0; - updateWdCounters(sai_serialize_object_id(m_queue), wdQueueStats); }