File tree Expand file tree Collapse file tree 2 files changed +29
-33
lines changed Expand file tree Collapse file tree 2 files changed +29
-33
lines changed Original file line number Diff line number Diff line change @@ -2528,28 +2528,29 @@ void processFlexCounterEvent(
2528
2528
sai_object_id_t rid = translate_vid_to_rid (vid);
2529
2529
sai_object_type_t objectType = sai_object_type_query (rid);
2530
2530
2531
+ if (op == DEL_COMMAND)
2532
+ {
2533
+ if (objectType == SAI_OBJECT_TYPE_PORT)
2534
+ {
2535
+ FlexCounter::removePort (vid, pollInterval);
2536
+ }
2537
+ else if (objectType == SAI_OBJECT_TYPE_QUEUE)
2538
+ {
2539
+ FlexCounter::removeQueue (vid, pollInterval);
2540
+ }
2541
+ else
2542
+ {
2543
+ SWSS_LOG_ERROR (" Object type for removal not supported" );
2544
+ }
2545
+ }
2546
+
2531
2547
const auto values = kfvFieldsValues (kco);
2532
2548
for (const auto & valuePair : values)
2533
2549
{
2534
2550
const auto field = fvField (valuePair);
2535
2551
const auto value = fvValue (valuePair);
2536
2552
2537
- if (op == DEL_COMMAND)
2538
- {
2539
- if (objectType == SAI_OBJECT_TYPE_PORT)
2540
- {
2541
- FlexCounter::removePort (vid, pollInterval);
2542
- }
2543
- else if (objectType == SAI_OBJECT_TYPE_QUEUE)
2544
- {
2545
- FlexCounter::removeQueue (vid, pollInterval);
2546
- }
2547
- else
2548
- {
2549
- SWSS_LOG_ERROR (" Object type for removal not supported" );
2550
- }
2551
- }
2552
- else if (op == SET_COMMAND)
2553
+ if (op == SET_COMMAND)
2553
2554
{
2554
2555
auto idStrings = swss::tokenize (value, ' ,' );
2555
2556
Original file line number Diff line number Diff line change @@ -218,33 +218,28 @@ void FlexCounter::removeQueue(
218
218
{
219
219
SWSS_LOG_ENTER ();
220
220
221
+ bool found = false ;
221
222
FlexCounter &fc = getInstance (pollInterval);
222
223
223
224
auto counterIter = fc.m_queueCounterIdsMap .find (queueVid);
224
- if (counterIter = = fc.m_queueCounterIdsMap .end ())
225
+ if (counterIter ! = fc.m_queueCounterIdsMap .end ())
225
226
{
226
- SWSS_LOG_ERROR (" Trying to remove nonexisting queue counter Ids 0x%lx" , queueVid);
227
- if (fc.m_queueCounterIdsMap .empty () && fc.m_portCounterIdsMap .empty () && fc.m_queueAttrIdsMap .empty ())
228
- {
229
- removeInstance (pollInterval);
230
- }
231
- return ;
227
+ fc.m_queueCounterIdsMap .erase (counterIter);
228
+ found = true ;
232
229
}
233
230
234
- fc.m_queueCounterIdsMap .erase (counterIter);
235
-
236
231
auto attrIter = fc.m_queueAttrIdsMap .find (queueVid);
237
- if (attrIter = = fc.m_queueAttrIdsMap .end ())
232
+ if (attrIter ! = fc.m_queueAttrIdsMap .end ())
238
233
{
239
- SWSS_LOG_ERROR (" Trying to remove nonexisting queue attr Ids 0x%lx" , queueVid);
240
- if (fc.m_queueCounterIdsMap .empty () && fc.m_portCounterIdsMap .empty () && fc.m_queueAttrIdsMap .empty ())
241
- {
242
- removeInstance (pollInterval);
243
- }
244
- return ;
234
+ fc.m_queueAttrIdsMap .erase (attrIter);
235
+ found = true ;
245
236
}
246
237
247
- fc.m_queueAttrIdsMap .erase (attrIter);
238
+ if (!found)
239
+ {
240
+ SWSS_LOG_ERROR (" Trying to remove nonexisting queue from flex counter 0x%lx" , queueVid);
241
+ return ;
242
+ }
248
243
249
244
// Remove flex counter if counter IDs map is empty
250
245
if (fc.m_queueCounterIdsMap .empty () && fc.m_portCounterIdsMap .empty () && fc.m_queueAttrIdsMap .empty ())
You can’t perform that action at this time.
0 commit comments