forked from sonoble/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[portsorch] fix PortsOrch::allPortsReady() returns true when it shoul…
…d not (sonic-net#1103) * [portsorch] fix PortsOrch::allPortsReady() returns true when it should not Warm start flow before the change: 1st iteration: - BufferOrch::doTask(): returns since PortInitDone hasn't arived yet - PortsOrch::doTask(): processes all PORT_TABLE untill PortInitDone flag m_pendingPortSet is empty yet and m_portInitDone is true so allPortsReady() will return true - AnyOrch::doTask(): check g_portsOrch->allPortsRead() 2nd iteration: - BufferOrch::doTask(): now buffers are applied This causes BufferOrch override PfcWdOrch's zero-buffer profile. The change swaps BufferOrch and PortsOrch in m_orchList, because 1st BufferOrch iteration will always skip processing and eliminates possibility of having m_pendingPortSet not filled with ports after m_initDone is set to true. * remove extra newline * [pfcwdorch] fix PfcWdSwOrch::doTask() starts WD action when WD wasn't started in warm boot It appeared that pfc watchdog relied on a buggy behaviour of PortsOrch::allPortsReady(). In fixed PortsOrch::allPortsReady() you'll see that watchdog action is trying to start before watchdog was started, because allPortsReady() in PfcWdOrch::doTask() returned false. Before the fix watchdog was started before, because allPortsReady() lied that ports are ready when they were not. * [portsorch] populate m_pendingPortSet in PortsOrch::bake() * [portsorch] optimize to 3 iterations instead of 4 * Revert "[portsorch] optimize to 3 iterations instead of 4" * revert change of order in m_orchList * [mock_tests] fix tests build * [mock_test] create unittest for PortsOrch::allPortsReady cold/warm flows * [orchdaemon] fix removed sfloworch * [mock_tests] make mock_tests run on "make check"
- Loading branch information
1 parent
5ab3f6b
commit bab7b93
Showing
14 changed files
with
689 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ CFLAGS_SAI = -I /usr/include/sai | |
|
||
TESTS = tests | ||
|
||
SUBDIRS = mock_tests | ||
|
||
noinst_PROGRAMS = tests | ||
|
||
if DEBUG | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,4 @@ namespace swss | |
TableName_KeySet(tableName) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,6 @@ namespace swss | |
|
||
int DBConnector::getDbId() const | ||
{ | ||
return 12345; | ||
return m_dbId; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#pragma once | ||
|
||
#include "orch.h" | ||
#include "switchorch.h" | ||
#include "crmorch.h" | ||
#include "portsorch.h" | ||
#include "routeorch.h" | ||
#include "intfsorch.h" | ||
#include "neighorch.h" | ||
#include "fdborch.h" | ||
#include "mirrororch.h" | ||
#include "bufferorch.h" | ||
#include "vrforch.h" | ||
#include "vnetorch.h" | ||
#include "vxlanorch.h" | ||
#include "policerorch.h" | ||
|
||
extern int gBatchSize; | ||
extern bool gSwssRecord; | ||
extern bool gSairedisRecord; | ||
extern bool gLogRotate; | ||
extern ofstream gRecordOfs; | ||
extern string gRecordFile; | ||
|
||
extern MacAddress gMacAddress; | ||
extern MacAddress gVxlanMacAddress; | ||
|
||
extern sai_object_id_t gSwitchId; | ||
extern sai_object_id_t gVirtualRouterId; | ||
extern sai_object_id_t gUnderlayIfId; | ||
|
||
extern SwitchOrch *gSwitchOrch; | ||
extern CrmOrch *gCrmOrch; | ||
extern PortsOrch *gPortsOrch; | ||
extern RouteOrch *gRouteOrch; | ||
extern IntfsOrch *gIntfsOrch; | ||
extern NeighOrch *gNeighOrch; | ||
extern FdbOrch *gFdbOrch; | ||
extern MirrorOrch *gMirrorOrch; | ||
extern BufferOrch *gBufferOrch; | ||
extern VRFOrch *gVrfOrch; | ||
|
||
extern sai_acl_api_t *sai_acl_api; | ||
extern sai_switch_api_t *sai_switch_api; | ||
extern sai_virtual_router_api_t *sai_virtual_router_api; | ||
extern sai_port_api_t *sai_port_api; | ||
extern sai_lag_api_t *sai_lag_api; | ||
extern sai_vlan_api_t *sai_vlan_api; | ||
extern sai_bridge_api_t *sai_bridge_api; | ||
extern sai_router_interface_api_t *sai_router_intfs_api; | ||
extern sai_route_api_t *sai_route_api; | ||
extern sai_neighbor_api_t *sai_neighbor_api; | ||
extern sai_tunnel_api_t *sai_tunnel_api; | ||
extern sai_next_hop_api_t *sai_next_hop_api; | ||
extern sai_hostif_api_t *sai_hostif_api; | ||
extern sai_buffer_api_t *sai_buffer_api; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#include "table.h" | ||
|
||
using TableDataT = std::map<std::string, std::vector<swss::FieldValueTuple>>; | ||
using TablesT = std::map<std::string, TableDataT>; | ||
|
||
namespace testing_db | ||
{ | ||
|
||
TableDataT gTableData; | ||
TablesT gTables; | ||
std::map<int, TablesT> gDB; | ||
|
||
void reset() | ||
{ | ||
gDB.clear(); | ||
} | ||
} | ||
|
||
namespace swss | ||
{ | ||
|
||
using namespace testing_db; | ||
|
||
bool Table::get(const std::string &key, std::vector<FieldValueTuple> &ovalues) | ||
{ | ||
auto table = gDB[getDbId()][getTableName()]; | ||
if (table.find(key) == table.end()) | ||
{ | ||
return false; | ||
} | ||
|
||
ovalues = table[key]; | ||
return true; | ||
} | ||
|
||
bool Table::hget(const std::string &key, const std::string &field, std::string &value) | ||
{ | ||
auto table = gDB[getDbId()][getTableName()]; | ||
if (table.find(key) == table.end()) | ||
{ | ||
return false; | ||
} | ||
|
||
for (const auto &it : table[key]) | ||
{ | ||
if (it.first == field) | ||
{ | ||
value = it.second; | ||
return true; | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
|
||
void Table::set(const std::string &key, | ||
const std::vector<FieldValueTuple> &values, | ||
const std::string &op, | ||
const std::string &prefix) | ||
{ | ||
auto &table = gDB[getDbId()][getTableName()]; | ||
table[key] = values; | ||
} | ||
|
||
void Table::getKeys(std::vector<std::string> &keys) | ||
{ | ||
keys.clear(); | ||
auto table = gDB[getDbId()][getTableName()]; | ||
for (const auto &it : table) | ||
{ | ||
keys.push_back(it.first); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include "table.h" | ||
|
||
namespace testing_db | ||
{ | ||
void reset(); | ||
} |
Oops, something went wrong.