@@ -822,11 +822,13 @@ task_process_status BufferOrch::processQueue(KeyOpFieldsValuesTuple &tuple)
822822 {
823823 auto flexCounterOrch = gDirectory .get <FlexCounterOrch*>();
824824 auto queues = tokens[1 ];
825- if (op == SET_COMMAND && flexCounterOrch->getQueueCountersState ())
825+ if (op == SET_COMMAND &&
826+ (flexCounterOrch->getQueueCountersState () || flexCounterOrch->getQueueWatermarkCountersState ()))
826827 {
827828 gPortsOrch ->createPortBufferQueueCounters (port, queues);
828829 }
829- else if (op == DEL_COMMAND && flexCounterOrch->getQueueCountersState ())
830+ else if (op == DEL_COMMAND &&
831+ (flexCounterOrch->getQueueCountersState () || flexCounterOrch->getQueueWatermarkCountersState ()))
830832 {
831833 gPortsOrch ->removePortBufferQueueCounters (port, queues);
832834 }
@@ -841,23 +843,23 @@ task_process_status BufferOrch::processQueue(KeyOpFieldsValuesTuple &tuple)
841843 * so we added a map that will help us to know what was the last command for this port and priority -
842844 * if the last command was set command then it is a modify command and we dont need to increase the buffer counter
843845 * all other cases (no last command exist or del command was the last command) it means that we need to increase the ref counter */
844- if (op == SET_COMMAND)
846+ if (op == SET_COMMAND)
845847 {
846- if (queue_port_flags[port_name][ind] != SET_COMMAND)
848+ if (queue_port_flags[port_name][ind] != SET_COMMAND)
847849 {
848850 /* if the last operation was not "set" then it's create and not modify - need to increase ref counter */
849851 gPortsOrch ->increasePortRefCount (port_name);
850852 }
851- }
853+ }
852854 else if (op == DEL_COMMAND)
853855 {
854- if (queue_port_flags[port_name][ind] == SET_COMMAND)
856+ if (queue_port_flags[port_name][ind] == SET_COMMAND)
855857 {
856858 /* we need to decrease ref counter only if the last operation was "SET_COMMAND" */
857859 gPortsOrch ->decreasePortRefCount (port_name);
858860 }
859- }
860- else
861+ }
862+ else
861863 {
862864 SWSS_LOG_ERROR (" operation value is not SET or DEL (op = %s)" , op.c_str ());
863865 return task_process_status::task_invalid_entry;
@@ -1001,11 +1003,13 @@ task_process_status BufferOrch::processPriorityGroup(KeyOpFieldsValuesTuple &tup
10011003 {
10021004 auto flexCounterOrch = gDirectory .get <FlexCounterOrch*>();
10031005 auto pgs = tokens[1 ];
1004- if (op == SET_COMMAND && flexCounterOrch->getPgWatermarkCountersState ())
1006+ if (op == SET_COMMAND &&
1007+ (flexCounterOrch->getPgCountersState () || flexCounterOrch->getPgWatermarkCountersState ()))
10051008 {
10061009 gPortsOrch ->createPortBufferPgCounters (port, pgs);
10071010 }
1008- else if (op == DEL_COMMAND && flexCounterOrch->getPgWatermarkCountersState ())
1011+ else if (op == DEL_COMMAND &&
1012+ (flexCounterOrch->getPgCountersState () || flexCounterOrch->getPgWatermarkCountersState ()))
10091013 {
10101014 gPortsOrch ->removePortBufferPgCounters (port, pgs);
10111015 }
@@ -1021,23 +1025,23 @@ task_process_status BufferOrch::processPriorityGroup(KeyOpFieldsValuesTuple &tup
10211025 * so we added a map that will help us to know what was the last command for this port and priority -
10221026 * if the last command was set command then it is a modify command and we dont need to increase the buffer counter
10231027 * all other cases (no last command exist or del command was the last command) it means that we need to increase the ref counter */
1024- if (op == SET_COMMAND)
1028+ if (op == SET_COMMAND)
10251029 {
1026- if (pg_port_flags[port_name][ind] != SET_COMMAND)
1030+ if (pg_port_flags[port_name][ind] != SET_COMMAND)
10271031 {
10281032 /* if the last operation was not "set" then it's create and not modify - need to increase ref counter */
10291033 gPortsOrch ->increasePortRefCount (port_name);
10301034 }
1031- }
1035+ }
10321036 else if (op == DEL_COMMAND)
10331037 {
1034- if (pg_port_flags[port_name][ind] == SET_COMMAND)
1038+ if (pg_port_flags[port_name][ind] == SET_COMMAND)
10351039 {
10361040 /* we need to decrease ref counter only if the last operation was "SET_COMMAND" */
10371041 gPortsOrch ->decreasePortRefCount (port_name);
10381042 }
1039- }
1040- else
1043+ }
1044+ else
10411045 {
10421046 SWSS_LOG_ERROR (" operation value is not SET or DEL (op = %s)" , op.c_str ());
10431047 return task_process_status::task_invalid_entry;
0 commit comments