@@ -32,6 +32,8 @@ extern sai_switch_api_t* sai_switch_api;
3232extern sai_port_api_t *sai_port_api;
3333extern sai_queue_api_t *sai_queue_api;
3434
35+ extern event_handle_t g_events_handle;
36+
3537extern SwitchOrch *gSwitchOrch ;
3638extern PortsOrch *gPortsOrch ;
3739
@@ -933,6 +935,26 @@ void PfcWdSwOrch<DropHandler, ForwardHandler>::doTask(SelectableTimer &timer)
933935
934936}
935937
938+ template <typename DropHandler, typename ForwardHandler>
939+ void PfcWdSwOrch<DropHandler, ForwardHandler>::report_pfc_storm(
940+ sai_object_id_t id, const PfcWdQueueEntry *entry)
941+ {
942+ event_params_t params = {
943+ { " ifname" , entry->portAlias },
944+ { " queue_index" , to_string (entry->index ) },
945+ { " queue_id" , to_string (id) },
946+ { " port_id" , to_string (entry->portId ) }};
947+
948+ SWSS_LOG_NOTICE (
949+ " PFC Watchdog detected PFC storm on port %s, queue index %d, queue id 0x%" PRIx64 " and port id 0x%" PRIx64 " ." ,
950+ entry->portAlias .c_str (),
951+ entry->index ,
952+ id,
953+ entry->portId );
954+
955+ event_publish (g_events_handle, " pfc-storm" , ¶ms);
956+ }
957+
936958template <typename DropHandler, typename ForwardHandler>
937959bool PfcWdSwOrch<DropHandler, ForwardHandler>::startWdActionOnQueue(const string &event, sai_object_id_t queueId)
938960{
@@ -955,12 +977,7 @@ bool PfcWdSwOrch<DropHandler, ForwardHandler>::startWdActionOnQueue(const string
955977 {
956978 if (entry->second .handler == nullptr )
957979 {
958- SWSS_LOG_NOTICE (
959- " PFC Watchdog detected PFC storm on port %s, queue index %d, queue id 0x%" PRIx64 " and port id 0x%" PRIx64 " ." ,
960- entry->second .portAlias .c_str (),
961- entry->second .index ,
962- entry->first ,
963- entry->second .portId );
980+ report_pfc_storm (entry->first , &entry->second );
964981
965982 entry->second .handler = make_shared<PfcWdActionHandler>(
966983 entry->second .portId ,
@@ -977,12 +994,7 @@ bool PfcWdSwOrch<DropHandler, ForwardHandler>::startWdActionOnQueue(const string
977994 {
978995 if (entry->second .handler == nullptr )
979996 {
980- SWSS_LOG_NOTICE (
981- " PFC Watchdog detected PFC storm on port %s, queue index %d, queue id 0x%" PRIx64 " and port id 0x%" PRIx64 " ." ,
982- entry->second .portAlias .c_str (),
983- entry->second .index ,
984- entry->first ,
985- entry->second .portId );
997+ report_pfc_storm (entry->first , &entry->second );
986998
987999 entry->second .handler = make_shared<DropHandler>(
9881000 entry->second .portId ,
@@ -999,12 +1011,7 @@ bool PfcWdSwOrch<DropHandler, ForwardHandler>::startWdActionOnQueue(const string
9991011 {
10001012 if (entry->second .handler == nullptr )
10011013 {
1002- SWSS_LOG_NOTICE (
1003- " PFC Watchdog detected PFC storm on port %s, queue index %d, queue id 0x%" PRIx64 " and port id 0x%" PRIx64 " ." ,
1004- entry->second .portAlias .c_str (),
1005- entry->second .index ,
1006- entry->first ,
1007- entry->second .portId );
1014+ report_pfc_storm (entry->first , &entry->second );
10081015
10091016 entry->second .handler = make_shared<ForwardHandler>(
10101017 entry->second .portId ,
0 commit comments