[watermarkorch] add watermarkorch, extend queue and pg counters with wat…#629
[watermarkorch] add watermarkorch, extend queue and pg counters with wat…#629lguohan merged 5 commits intosonic-net:masterfrom
Conversation
489ab81 to
e2df6cf
Compare
|
retest this please |
adf20ae to
ef7a81f
Compare
…ermark stats Signed-off-by: Mykola Faryma <[email protected]>
Signed-off-by: Mykola Faryma <[email protected]>
b7a9a41 to
de001b4
Compare
Signed-off-by: Mykola Faryma <[email protected]>
|
Depends on sonic-utilities sonic-net/sonic-utilities#327 |
| m_telemetryInterval = to_uint<uint32_t>(i.second.c_str()); | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
else case of not supported key?
| { | ||
| counters_stream << delimiter << sai_serialize_ingress_priority_group_stat(it); | ||
| delimiter = comma; | ||
| } |
There was a problem hiding this comment.
If we add the pg watermark stats here, they will be enabled if the corresponding "FLEX_COUNTER_TABLE|FLEX_COUNTER_STATUS" is "enabled" in the CONFIG_DB. We may take the similar approach as in the PFCWD that we listen to the SET_COMMAND and DEL_COMMAND to be able to enable and disable polling watermark stats at run time. Similar case for the queue watermark stats above.
There was a problem hiding this comment.
The syncd has the logic for listening to FC STATUS in place:
https://github.com/Azure/sonic-sairedis/blob/master/syncd/syncd.cpp#L2767
There is also the ability to enable/disable WM polling via counterpoll utility:
https://github.com/Azure/sonic-utilities/blob/614dbeec6a0bb99c0020e276f95cfe60bc6a1a60/counterpoll/main.py#L99
orchagent/watermarkorch.h
Outdated
| #include "timer.h" | ||
|
|
||
| extern "C" { | ||
| #include "sai.h" |
There was a problem hiding this comment.
orch.h is already including sai.h
| void doTask(NotificationConsumer& consumer); | ||
| void doTask(SelectableTimer &timer); | ||
|
|
||
| void init_pg_ids(); |
There was a problem hiding this comment.
Can we follow same format for all member functions?
orchagent/pfcwdorch.cpp
Outdated
| if (!c_queueStatIds.empty()) | ||
| { | ||
| string str = counterIdsToStr(c_queueStatIds, sai_serialize_queue_stat); | ||
| queueFieldValues.emplace_back(STATS_MODE_FIELD, STATS_MODE_READ); |
There was a problem hiding this comment.
for PORT_STATS, QUEUE_STATS, PG_WATERMARK_STATS, and QUEUE_WATERMARK_STATS, STATS_MODE is set to the corresponding GROUP_TABLE. For PFCWD, it is set to FLEX_COUNTER_TABLE. Why the difference?
Signed-off-by: Mykola Faryma <[email protected]>
|
|
||
| vector<FieldValueTuple> fieldValues; | ||
| fieldValues.emplace_back(QUEUE_PLUGIN_FIELD, queueWmSha); | ||
| fieldValues.emplace_back(POLL_INTERVAL_FIELD, QUEUE_WATERMARK_FLEX_STAT_COUNTER_POLL_MSECS); |
There was a problem hiding this comment.
I will look into the flex counter thread in syncd. Before I get more acquainted, a general question in my mind is that each flex counter table has its own polling interval. How does the flex counter thread in syncd make sure each one gets polled and serviced just on time when the interval expires?
There was a problem hiding this comment.
I checked the code in sycnd. flex counter thread is per flex counter table. So it makes sense to me now.
|
|
||
| m_flex_db = shared_ptr<DBConnector>(new DBConnector(FLEX_COUNTER_DB, DBConnector::DEFAULT_UNIXSOCKET, 0)); | ||
| m_flexCounterTable = unique_ptr<ProducerTable>(new ProducerTable(m_flex_db.get(), FLEX_COUNTER_TABLE)); | ||
| m_flexCounterGroupTable = unique_ptr<ProducerTable>(new ProducerTable(m_flex_db.get(), FLEX_COUNTER_GROUP_TABLE)); |
There was a problem hiding this comment.
A general question: why the flex counter table and the flex counter group table need to be ProducerTable? Qi mentioned that ProducerTable is a FIFO queue. So it is used when we care about the sequences the redis request is queued.
There was a problem hiding this comment.
@mykolaf We should use ProducerTable for flex counter table and flex counter group table. This is what used in the pfcwd. Just curious about the reason behind it.
There was a problem hiding this comment.
@wenda Flex counter uses ConsumerTable, so we use the related producer. There is no specific reason for using it, it was just implemented that way.
cc3f266 to
3881120
Compare
|
retest this please |
|
retest this please |
|
VS test dependencies:
Probably sonic-utilities pointer also needs to be updated in order to support WM CLI in the docker-vs) |
|
retest this please |
|
@lguohan all 3 of the watermark tests passed, but some other recently introduced tests failed ( |
|
retest this please |
|
@mykolaf , can you sign the cla? |
Signed-off-by: Mykola Faryma <[email protected]>
|
@lguohan That was some bug, I already signed it 8 month ago. |
| vector<FieldValueTuple> pgPortVector; | ||
| vector<FieldValueTuple> pgIndexVector; | ||
|
|
||
| for (size_t pgIndex = 0; pgIndex < port.m_priority_group_ids.size(); ++pgIndex) |
There was a problem hiding this comment.
Lossy PG does not have SAI_INGRESS_PRIORITY_GROUP_STAT_XOFF_ROOM_WATERMARK_BYTES. So the query value will always return 0?
There was a problem hiding this comment.
I guess it depends on the SAI implementation of it. If the SAI returns some status other than success, the flex counter will mark the counter as unsupported and stop polling. For this cases we will show the value as 'N/A' in the output.
But having made a little test, I see that I get a 0 for lossy pg. Is this different on some other platform?
From my point of view, it seems logical that even lossy PG has a counter for headroom watermark, even if it has lossy profile applied. Looks like the structure of PG's counters doesn't care of pg being lossy/lossless.
|
retest this please |
2 similar comments
|
retest this please |
|
retest this please |
| m_appDb.get(), | ||
| "WATERMARK_CLEAR_REQUEST"); | ||
| auto clearNotifier = new Notifier(m_clearNotificationConsumer, this, "WM_CLEAR_NOTIFIER"); | ||
| Orch::addExecutor(clearNotifier); |
There was a problem hiding this comment.
For user issued clear, why not just directly clear through the CLI but signal through an APPL_DB event channel, and delegate to WatermarkOrch to do so? What is the benefit here?
There was a problem hiding this comment.
This is the design we agreed on.
https://github.com/Azure/SONiC/blob/gh-pages/doc/watermarks_HLD.md
There was a problem hiding this comment.
This was needed in the draft design of the feature, in current implementation it doesn't give any advantages.
| if (pg_shared_wm) then | ||
| redis.call('HSET', periodic_table_name .. ':' .. KEYS[i], 'SAI_INGRESS_PRIORITY_GROUP_STAT_SHARED_WATERMARK_BYTES', periodic_shared_wm and math.max(tonumber(pg_shared_wm), tonumber(periodic_shared_wm)) or pg_shared_wm) | ||
| redis.call('HSET', persistent_table_name .. ':' .. KEYS[i], 'SAI_INGRESS_PRIORITY_GROUP_STAT_SHARED_WATERMARK_BYTES', persistent_shared_wm and math.max(tonumber(pg_shared_wm), tonumber(persistent_shared_wm)) or pg_shared_wm) | ||
| redis.call('HSET', user_table_name .. ':' .. KEYS[i], 'SAI_INGRESS_PRIORITY_GROUP_STAT_SHARED_WATERMARK_BYTES', user_shared_wm and math.max(tonumber(pg_shared_wm), tonumber(user_shared_wm)) or pg_shared_wm) |
There was a problem hiding this comment.
The use of ternary operator is fancy, but we do not need to issue a redis hset command if the new value is no greater than the historic high, which is an expense operation in the context of a syncd flex counter thread.
Need to mirror the neighbor solicitation packets - type 135. Signed-off-by: Shu0T1an ChenG <[email protected]>
…onic-net#629) * add a README to tests directory to describe how to run 'make check' * small spelling and grammar fix Co-authored-by: Syd Logan <[email protected]>
…for-port-cntrs Temporarily disable bulk init requests for PORT counters Add temporary fix for https://github.com/aristanetworks/sonic-qual.msft/issues/655 This forces each port to be processed individually, avoiding capability mismatch between different ports in bulk requests What I did Temporarily disable bulk init requests for PORT counters. Why I did it When swss requests bulk initialization of PORT counters, corresponding component in sonic-sairedis assumes all the requested ports support same attributes, which is not the case for SFP/mgmt ports of Arista switches and was causing these ports to be completely skipped. This is supposed to be fixed by Azure/sonic-sairedis.msft#73 but it needs a re-work as its breaking non-Broadcom platform. So, we're temporarily disabling this flow. How I verified it Verified countersDB is now having all the supported counters for SFP ports. Details if related relevant threads: #558, #629, 655 signed-off-by: [email protected]
…wat… (sonic-net#629) * [watermarks] add watermarkorch, extend queue and pg counters with watermark stats Signed-off-by: Mykola Faryma <[email protected]> * [watermark] add VS tests Signed-off-by: Mykola Faryma <[email protected]> * [watermark] resolve conflict Signed-off-by: Mykola Faryma <[email protected]> * address review comments Signed-off-by: Mykola Faryma <[email protected]> * update VS test to use set counters and cover the flex counter flow Signed-off-by: Mykola Faryma <[email protected]>
…ermark stats
What I did
Why I did it
This is new code forthe watermarks feature
High Level Design Document
How I verified it
Manually verified on mlnx switch.
Details if related