-
Notifications
You must be signed in to change notification settings - Fork 693
[FC] process FC after apply view #3326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
87501b2
47fb40f
017a569
ada9e59
956f1f6
12eea05
c8e8b41
18b3606
71e05f5
e2a68ae
a1e320d
829d529
3eeb06e
bd84f92
03e31eb
9da6b4d
0d4fd74
7255d8d
c412aae
5600064
00455a5
71b6513
bacf16b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,7 @@ | |
| #include "macsecorch.h" | ||
| #include "dash/dashorch.h" | ||
| #include "flowcounterrouteorch.h" | ||
| #include "warm_restart.h" | ||
|
|
||
| extern sai_port_api_t *sai_port_api; | ||
| extern sai_switch_api_t *sai_switch_api; | ||
|
|
@@ -28,6 +29,8 @@ extern CoppOrch *gCoppOrch; | |
| extern FlowCounterRouteOrch *gFlowCounterRouteOrch; | ||
| extern sai_object_id_t gSwitchId; | ||
|
|
||
| #define FLEX_COUNTER_DELAY_SEC 60 | ||
|
|
||
| #define BUFFER_POOL_WATERMARK_KEY "BUFFER_POOL_WATERMARK" | ||
| #define PORT_KEY "PORT" | ||
| #define PORT_BUFFER_DROP_KEY "PORT_BUFFER_DROP" | ||
|
|
@@ -69,12 +72,22 @@ unordered_map<string, string> flexCounterGroupMap = | |
|
|
||
| FlexCounterOrch::FlexCounterOrch(DBConnector *db, vector<string> &tableNames): | ||
| Orch(db, tableNames), | ||
| m_flexCounterConfigTable(db, CFG_FLEX_COUNTER_TABLE_NAME), | ||
| m_bufferQueueConfigTable(db, CFG_BUFFER_QUEUE_TABLE_NAME), | ||
| m_bufferPgConfigTable(db, CFG_BUFFER_PG_TABLE_NAME), | ||
| m_deviceMetadataConfigTable(db, CFG_DEVICE_METADATA_TABLE_NAME) | ||
| { | ||
| SWSS_LOG_ENTER(); | ||
| m_delayTimer = std::make_unique<SelectableTimer>(timespec{.tv_sec = FLEX_COUNTER_DELAY_SEC, .tv_nsec = 0}); | ||
| if (WarmStart::isWarmStart()) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to confirm this will also handle fast-reboot.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes |
||
| { | ||
| m_delayExecutor = std::make_unique<ExecutableTimer>(m_delayTimer.get(), this, "FLEX_COUNTER_DELAY"); | ||
| Orch::addExecutor(m_delayExecutor.get()); | ||
| m_delayTimer->start(); | ||
| } | ||
| else | ||
| { | ||
| m_delayTimerExpired = true; | ||
bingwang-ms marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
|
|
||
| FlexCounterOrch::~FlexCounterOrch(void) | ||
|
|
@@ -86,6 +99,11 @@ void FlexCounterOrch::doTask(Consumer &consumer) | |
| { | ||
| SWSS_LOG_ENTER(); | ||
|
|
||
| if (!m_delayTimerExpired) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| VxlanTunnelOrch* vxlan_tunnel_orch = gDirectory.get<VxlanTunnelOrch*>(); | ||
| DashOrch* dash_orch = gDirectory.get<DashOrch*>(); | ||
| if (gPortsOrch && !gPortsOrch->allPortsReady()) | ||
|
|
@@ -116,16 +134,9 @@ void FlexCounterOrch::doTask(Consumer &consumer) | |
|
|
||
| if (op == SET_COMMAND) | ||
| { | ||
| auto itDelay = std::find(std::begin(data), std::end(data), FieldValueTuple(FLEX_COUNTER_DELAY_STATUS_FIELD, "true")); | ||
| string poll_interval; | ||
| string bulk_chunk_size; | ||
| string bulk_chunk_size_per_counter; | ||
|
|
||
| if (itDelay != data.end()) | ||
| { | ||
| consumer.m_toSync.erase(it++); | ||
| continue; | ||
| } | ||
| for (auto valuePair:data) | ||
| { | ||
| const auto &field = fvField(valuePair); | ||
|
|
@@ -255,12 +266,6 @@ void FlexCounterOrch::doTask(Consumer &consumer) | |
| } | ||
| } | ||
| } | ||
| else if(field == FLEX_COUNTER_DELAY_STATUS_FIELD) | ||
| { | ||
| // This field is ignored since it is being used before getting into this loop. | ||
| // If it is exist and the value is 'true' we need to skip the iteration in order to delay the counter creation. | ||
| // The field will clear out and counter will be created when enable_counters script is called. | ||
| } | ||
| else | ||
| { | ||
| SWSS_LOG_NOTICE("Unsupported field %s", field.c_str()); | ||
|
|
@@ -285,6 +290,20 @@ void FlexCounterOrch::doTask(Consumer &consumer) | |
| } | ||
| } | ||
|
|
||
| void FlexCounterOrch::doTask(SelectableTimer&) | ||
| { | ||
| SWSS_LOG_ENTER(); | ||
|
|
||
| if (m_delayTimerExpired) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| SWSS_LOG_NOTICE("Processing counters"); | ||
| m_delayTimer->stop(); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about following?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
| m_delayTimerExpired = true; | ||
| } | ||
|
|
||
| bool FlexCounterOrch::getPortCountersState() const | ||
| { | ||
| return m_port_counter_enabled; | ||
|
|
@@ -322,39 +341,10 @@ bool FlexCounterOrch::bake() | |
| * By default, it should fetch items from the tables the sub agents listen to, | ||
| * and then push them into m_toSync of each sub agent. | ||
| * The motivation is to make sub agents handle the saved entries first and then handle the upcoming entries. | ||
| * The FCs are not data plane configuration required during reconciling process, hence don't do anything in bake. | ||
| */ | ||
|
|
||
| std::deque<KeyOpFieldsValuesTuple> entries; | ||
| vector<string> keys; | ||
| m_flexCounterConfigTable.getKeys(keys); | ||
| for (const auto &key: keys) | ||
| { | ||
| if (!flexCounterGroupMap.count(key)) | ||
| { | ||
| SWSS_LOG_NOTICE("FlexCounterOrch: Invalid flex counter group intput %s is skipped during reconciling", key.c_str()); | ||
| continue; | ||
| } | ||
|
|
||
| if (key == BUFFER_POOL_WATERMARK_KEY) | ||
| { | ||
| SWSS_LOG_NOTICE("FlexCounterOrch: Do not handle any FLEX_COUNTER table for %s update during reconciling", | ||
| BUFFER_POOL_WATERMARK_KEY); | ||
| continue; | ||
| } | ||
|
|
||
| KeyOpFieldsValuesTuple kco; | ||
|
|
||
| kfvKey(kco) = key; | ||
| kfvOp(kco) = SET_COMMAND; | ||
|
|
||
| if (!m_flexCounterConfigTable.get(key, kfvFieldsValues(kco))) | ||
| { | ||
| continue; | ||
| } | ||
| entries.push_back(kco); | ||
| } | ||
| Consumer* consumer = dynamic_cast<Consumer *>(getExecutor(CFG_FLEX_COUNTER_TABLE_NAME)); | ||
| return consumer->addToSync(entries); | ||
| return true; | ||
| } | ||
|
|
||
| static bool isCreateOnlyConfigDbBuffers(Table& deviceMetadataConfigTable) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vaibhavhd , could you review the warm boot part?