@@ -39,9 +39,6 @@ std::shared_ptr<swss::RedisClient> g_redisClient;
39
39
std::shared_ptr<swss::ProducerTable> getResponse;
40
40
std::shared_ptr<swss::NotificationProducer> notifications;
41
41
42
- std::shared_ptr<std::thread> g_processFlexCounterEventThread;
43
- volatile bool g_processFlexCounterEventThreadRun = true ;
44
-
45
42
/*
46
43
* TODO: Those are hard coded values for mlnx integration for v1.0.1 they need
47
44
* to be updated.
@@ -3002,62 +2999,6 @@ void processFlexCounterGroupEvent(
3002
2999
}
3003
3000
}
3004
3001
3005
- std::queue<swss::KeyOpFieldsValuesTuple> g_flexCounterEventQueue;
3006
-
3007
- bool tryPopFlexCounterEvent (
3008
- _Out_ swss::KeyOpFieldsValuesTuple& kco)
3009
- {
3010
- SWSS_LOG_ENTER ();
3011
-
3012
- std::lock_guard<std::mutex> lock (g_mutex);
3013
-
3014
- if (g_flexCounterEventQueue.empty ())
3015
- {
3016
- return false ;
3017
- }
3018
-
3019
- kco = g_flexCounterEventQueue.front ();
3020
-
3021
- g_flexCounterEventQueue.pop ();
3022
-
3023
- return true ;
3024
- }
3025
-
3026
- void pushFlexCounterEvent (
3027
- _In_ const swss::KeyOpFieldsValuesTuple& kco)
3028
- {
3029
- SWSS_LOG_ENTER ();
3030
-
3031
- std::lock_guard<std::mutex> lock (g_mutex);
3032
-
3033
- g_flexCounterEventQueue.push (kco);
3034
- }
3035
-
3036
- bool processFlexCounterEvent (
3037
- _In_ const swss::KeyOpFieldsValuesTuple kco);
3038
-
3039
- void processFlexCounterEventThread ()
3040
- {
3041
- SWSS_LOG_ENTER ();
3042
-
3043
- while (g_processFlexCounterEventThreadRun)
3044
- {
3045
- swss::KeyOpFieldsValuesTuple kco;
3046
-
3047
- if (tryPopFlexCounterEvent (kco))
3048
- {
3049
- if (!processFlexCounterEvent (kco))
3050
- {
3051
- // event was not successfully processed, put it again to the queue
3052
-
3053
- pushFlexCounterEvent (kco);
3054
- }
3055
- }
3056
-
3057
- sleep (1 );
3058
- }
3059
- }
3060
-
3061
3002
void processFlexCounterEvent (
3062
3003
_In_ swss::ConsumerTable &consumer)
3063
3004
{
@@ -3070,30 +3011,15 @@ void processFlexCounterEvent(
3070
3011
consumer.pop (kco);
3071
3012
}
3072
3013
3073
- // because flex counter event can arrive independently (on RIF interface)
3074
- // it may happen that it will be picked up from the select api before
3075
- // actual interface will be created, and subscription for counters will
3076
- // fail, so let's process each request in the thread and use queue for
3077
- // arriving events, and failed events will be put back to the queue until
3078
- // they will be processed
3079
-
3080
- pushFlexCounterEvent (kco);
3081
- }
3082
-
3083
- bool processFlexCounterEvent (
3084
- _In_ const swss::KeyOpFieldsValuesTuple kco)
3085
- {
3086
- SWSS_LOG_ENTER ();
3087
-
3088
3014
const auto &key = kfvKey (kco);
3089
- const std::string & op = kfvOp (kco);
3015
+ std::string op = kfvOp (kco);
3090
3016
3091
3017
std::size_t delimiter = key.find_first_of (" :" );
3092
3018
if (delimiter == std::string::npos)
3093
3019
{
3094
3020
SWSS_LOG_ERROR (" Failed to parse the key %s" , key.c_str ());
3095
3021
3096
- return true ; // if key is invalid there is no need to process this event again
3022
+ return ; // if key is invalid there is no need to process this event again
3097
3023
}
3098
3024
3099
3025
const auto groupName = key.substr (0 , delimiter);
@@ -3105,10 +3031,11 @@ bool processFlexCounterEvent(
3105
3031
{
3106
3032
std::lock_guard<std::mutex> lock (g_mutex);
3107
3033
if (!try_translate_vid_to_rid (vid, rid))
3108
- {
3034
+ {
3109
3035
SWSS_LOG_WARN (" port VID %s, was not found (probably port was removed/splitted) and will remove from counters now" ,
3110
3036
sai_serialize_object_id (vid).c_str ());
3111
- return false ;
3037
+
3038
+ op = DEL_COMMAND;
3112
3039
}
3113
3040
}
3114
3041
@@ -3255,7 +3182,7 @@ bool processFlexCounterEvent(
3255
3182
FlexCounter::setBufferPoolCounterList (vid, rid, groupName, bufferPoolCounterIds, statsMode);
3256
3183
}
3257
3184
3258
- return true ;
3185
+ return ;
3259
3186
}
3260
3187
3261
3188
void printUsage ()
@@ -3979,11 +3906,6 @@ int syncd_main(int argc, char **argv)
3979
3906
3980
3907
twd.setCallback (timerWatchdogCallback);
3981
3908
3982
- g_processFlexCounterEventThreadRun = true ;
3983
-
3984
- g_processFlexCounterEventThread = std::make_shared<std::thread>(processFlexCounterEventThread);
3985
-
3986
-
3987
3909
while (runMainLoop)
3988
3910
{
3989
3911
try
@@ -4167,10 +4089,6 @@ int syncd_main(int argc, char **argv)
4167
4089
4168
4090
#endif
4169
4091
4170
- g_processFlexCounterEventThreadRun = false ;
4171
-
4172
- g_processFlexCounterEventThread->join ();
4173
-
4174
4092
FlexCounter::removeAllCounters ();
4175
4093
4176
4094
{
0 commit comments