Skip to content

Commit

Permalink
[watermark] fix watermark clear not working for PG (sonic-net#729)
Browse files Browse the repository at this point in the history
  • Loading branch information
mykolaf authored and qiluo-msft committed Dec 23, 2018
1 parent 25d16b3 commit a45c7b5
Showing 1 changed file with 44 additions and 39 deletions.
83 changes: 44 additions & 39 deletions orchagent/watermarkorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,41 +107,50 @@ void WatermarkOrch::doTask(NotificationConsumer &consumer)

consumer.pop(op, data, values);

if(&consumer == m_clearNotificationConsumer){
string wm_name = "";
vector<sai_object_id_t> &obj_ids = m_pg_ids;
if(data == CLEAR_PG_HEADROOM_REQUEST)
{
wm_name = "SAI_INGRESS_PRIORITY_GROUP_STAT_XOFF_ROOM_WATERMARK_BYTES";
obj_ids = m_pg_ids;
}
else if(data == CLEAR_PG_SHARED_REQUEST)
{
wm_name = "SAI_INGRESS_PRIORITY_GROUP_STAT_SHARED_WATERMARK_BYTES";
obj_ids = m_pg_ids;
}
else if(data == CLEAR_QUEUE_SHARED_UNI_REQUEST)
{
wm_name = "SAI_QUEUE_STAT_SHARED_WATERMARK_BYTES";
obj_ids = m_unicast_queue_ids;
}
else if(data == CLEAR_QUEUE_SHARED_MULTI_REQUEST)
{
wm_name = "SAI_QUEUE_STAT_SHARED_WATERMARK_BYTES";
obj_ids = m_multicast_queue_ids;
}
if(op == "USER")
{
clearSingleWm(m_userWatermarkTable.get(), wm_name, obj_ids);
}
else if (op == "PERSISTENT")
{
clearSingleWm(m_persistentWatermarkTable.get(), wm_name, obj_ids);
}
else
{
SWSS_LOG_WARN("Unknown watermark clear request op: %s", op.c_str());
}
Table * table = NULL;

if (op == "PERSISTENT")
{
table = m_persistentWatermarkTable.get();
}
else if (op == "USER")
{
table = m_userWatermarkTable.get();
}
else
{
SWSS_LOG_WARN("Unknown watermark clear request op: %s", op.c_str());
return;
}

if(data == CLEAR_PG_HEADROOM_REQUEST)
{
clearSingleWm(table,
"SAI_INGRESS_PRIORITY_GROUP_STAT_XOFF_ROOM_WATERMARK_BYTES",
m_pg_ids);
}
else if(data == CLEAR_PG_SHARED_REQUEST)
{
clearSingleWm(table,
"SAI_INGRESS_PRIORITY_GROUP_STAT_SHARED_WATERMARK_BYTES",
m_pg_ids);
}
else if(data == CLEAR_QUEUE_SHARED_UNI_REQUEST)
{
clearSingleWm(table,
"SAI_QUEUE_STAT_SHARED_WATERMARK_BYTES",
m_unicast_queue_ids);
}
else if(data == CLEAR_QUEUE_SHARED_MULTI_REQUEST)
{
clearSingleWm(table,
"SAI_QUEUE_STAT_SHARED_WATERMARK_BYTES",
m_multicast_queue_ids);
}
else
{
SWSS_LOG_WARN("Unknown watermark clear request data: %s", data.c_str());
return;
}
}

Expand All @@ -162,14 +171,12 @@ void WatermarkOrch::doTask(SelectableTimer &timer)
m_telemetryTimer->setInterval(intervT);
m_telemetryTimer->reset();

/* TODO: replace with removing all PG and queue entries? */
clearSingleWm(m_periodicWatermarkTable.get(), "SAI_INGRESS_PRIORITY_GROUP_STAT_XOFF_ROOM_WATERMARK_BYTES", m_pg_ids);
clearSingleWm(m_periodicWatermarkTable.get(), "SAI_INGRESS_PRIORITY_GROUP_STAT_SHARED_WATERMARK_BYTES", m_pg_ids);
clearSingleWm(m_periodicWatermarkTable.get(), "SAI_QUEUE_STAT_SHARED_WATERMARK_BYTES", m_unicast_queue_ids);
clearSingleWm(m_periodicWatermarkTable.get(), "SAI_QUEUE_STAT_SHARED_WATERMARK_BYTES", m_multicast_queue_ids);
SWSS_LOG_INFO("Periodic watermark cleared by timer!");
}

}

void WatermarkOrch::init_pg_ids()
Expand Down Expand Up @@ -220,5 +227,3 @@ void WatermarkOrch::clearSingleWm(Table *table, string wm_name, vector<sai_objec
table->set(sai_serialize_object_id(id), vfvt);
}
}


0 comments on commit a45c7b5

Please sign in to comment.