@@ -32,6 +32,8 @@ extern sai_switch_api_t* sai_switch_api;
32
32
extern sai_port_api_t *sai_port_api;
33
33
extern sai_queue_api_t *sai_queue_api;
34
34
35
+ extern event_handle_t g_events_handle;
36
+
35
37
extern SwitchOrch *gSwitchOrch ;
36
38
extern PortsOrch *gPortsOrch ;
37
39
@@ -933,6 +935,26 @@ void PfcWdSwOrch<DropHandler, ForwardHandler>::doTask(SelectableTimer &timer)
933
935
934
936
}
935
937
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
+
936
958
template <typename DropHandler, typename ForwardHandler>
937
959
bool PfcWdSwOrch<DropHandler, ForwardHandler>::startWdActionOnQueue(const string &event, sai_object_id_t queueId)
938
960
{
@@ -955,12 +977,7 @@ bool PfcWdSwOrch<DropHandler, ForwardHandler>::startWdActionOnQueue(const string
955
977
{
956
978
if (entry->second .handler == nullptr )
957
979
{
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 );
964
981
965
982
entry->second .handler = make_shared<PfcWdActionHandler>(
966
983
entry->second .portId ,
@@ -977,12 +994,7 @@ bool PfcWdSwOrch<DropHandler, ForwardHandler>::startWdActionOnQueue(const string
977
994
{
978
995
if (entry->second .handler == nullptr )
979
996
{
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 );
986
998
987
999
entry->second .handler = make_shared<DropHandler>(
988
1000
entry->second .portId ,
@@ -999,12 +1011,7 @@ bool PfcWdSwOrch<DropHandler, ForwardHandler>::startWdActionOnQueue(const string
999
1011
{
1000
1012
if (entry->second .handler == nullptr )
1001
1013
{
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 );
1008
1015
1009
1016
entry->second .handler = make_shared<ForwardHandler>(
1010
1017
entry->second .portId ,
0 commit comments