From fb4b2246b4761acee75d8ac8753dc545da51782f Mon Sep 17 00:00:00 2001 From: tshalvi Date: Tue, 10 Sep 2024 17:52:31 +0300 Subject: [PATCH 1/4] Remove RIF from m_rifsToAdd before deleting RIF --- orchagent/intfsorch.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/orchagent/intfsorch.cpp b/orchagent/intfsorch.cpp index 87c2206e90..ecd4d10b19 100644 --- a/orchagent/intfsorch.cpp +++ b/orchagent/intfsorch.cpp @@ -1319,6 +1319,15 @@ bool IntfsOrch::removeRouterIntfs(Port &port) const auto id = sai_serialize_object_id(port.m_rif_id); removeRifFromFlexCounter(id, port.m_alias); + for (auto it = m_rifsToAdd.begin(); it != m_rifsToAdd.end(); ++it) + { + if (it->m_rif_id == port.m_rif_id) + { + m_rifsToAdd.erase(it); + break; + } + } + sai_status_t status = sai_router_intfs_api->remove_router_interface(port.m_rif_id); if (status != SAI_STATUS_SUCCESS) { @@ -1746,4 +1755,4 @@ void IntfsOrch::voqSyncIntfState(string &alias, bool isUp) m_tableVoqSystemInterfaceTable->hset(port_alias, "oper_status", isUp ? "up" : "down"); } -} \ No newline at end of file +} From be6f91525b2013b672c956910b214e60ad6f1f78 Mon Sep 17 00:00:00 2001 From: tshalvi Date: Tue, 10 Sep 2024 17:56:17 +0300 Subject: [PATCH 2/4] Add newline at end of file --- orchagent/intfsorch.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/orchagent/intfsorch.cpp b/orchagent/intfsorch.cpp index ecd4d10b19..f7ef047aa9 100644 --- a/orchagent/intfsorch.cpp +++ b/orchagent/intfsorch.cpp @@ -1756,3 +1756,4 @@ void IntfsOrch::voqSyncIntfState(string &alias, bool isUp) } } + From 4a339b8bf78c152facde852c718113efc10bddf6 Mon Sep 17 00:00:00 2001 From: tshalvi Date: Wed, 11 Sep 2024 14:14:55 +0300 Subject: [PATCH 3/4] Invoke removeRifFromFlexCounter only if router interface is not found in m_rifsToAdd --- orchagent/intfsorch.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/orchagent/intfsorch.cpp b/orchagent/intfsorch.cpp index f7ef047aa9..83a2cfc39f 100644 --- a/orchagent/intfsorch.cpp +++ b/orchagent/intfsorch.cpp @@ -1316,17 +1316,21 @@ bool IntfsOrch::removeRouterIntfs(Port &port) return false; } - const auto id = sai_serialize_object_id(port.m_rif_id); - removeRifFromFlexCounter(id, port.m_alias); - + bool port_found = false; for (auto it = m_rifsToAdd.begin(); it != m_rifsToAdd.end(); ++it) { if (it->m_rif_id == port.m_rif_id) { m_rifsToAdd.erase(it); + port_found = true break; } } + if (!port_found) + { + const auto id = sai_serialize_object_id(port.m_rif_id); + removeRifFromFlexCounter(id, port.m_alias); + } sai_status_t status = sai_router_intfs_api->remove_router_interface(port.m_rif_id); if (status != SAI_STATUS_SUCCESS) From 1ddaeb41102a09243b2f45c66d31420f050db098 Mon Sep 17 00:00:00 2001 From: tshalvi Date: Tue, 24 Sep 2024 19:07:00 +0300 Subject: [PATCH 4/4] missing semicolon --- orchagent/intfsorch.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orchagent/intfsorch.cpp b/orchagent/intfsorch.cpp index 83a2cfc39f..2de378a448 100644 --- a/orchagent/intfsorch.cpp +++ b/orchagent/intfsorch.cpp @@ -1322,7 +1322,7 @@ bool IntfsOrch::removeRouterIntfs(Port &port) if (it->m_rif_id == port.m_rif_id) { m_rifsToAdd.erase(it); - port_found = true + port_found = true; break; } }