Skip to content

Commit

Permalink
Add extra check for warm boot discovered RIDs (#502)
Browse files Browse the repository at this point in the history
* Add extra check for warm boot discovered RIDs

* dump asic operations when rid2vid map missmatch
  • Loading branch information
kcudnik authored Sep 6, 2019
1 parent b4893ef commit 58845ce
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
2 changes: 2 additions & 0 deletions syncd/syncd_applyview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7632,6 +7632,8 @@ sai_status_t syncdApplyView()
checkMap(current.ridToVid, "current R2V", current.vidToRid, "current V2R", temp.ridToVid, "temp R2V", temp.vidToRid, "temp V2R");
checkMap(temp.ridToVid, "temp R2V", temp.vidToRid, "temp V2R", current.ridToVid, "current R2V", current.vidToRid, "current V2R");

current.dumpVidToAsicOperatioId();

SWSS_LOG_THROW("wrong number of vid/rid items in map, forgot to translate? R2V: %zu:%zu, V2R: %zu:%zu, FIXME",
current.ridToVid.size(),
temp.ridToVid.size(),
Expand Down
36 changes: 36 additions & 0 deletions syncd/syncd_hard_reinit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1223,6 +1223,40 @@ void hardReinit()
checkAllIds();
}

void checkWarmBootDiscoveredRids(
_In_ std::shared_ptr<SaiSwitch> sw)
{
SWSS_LOG_ENTER();

/*
* After switch was created, rid discovery method was called, and all
* discovered RIDs should be present in current RID2VID map in redis
* database. If any RID is missing, then ether there is bug in vendor code,
* and after warm boot some RID values changed or we have a bug and forgot
* to put rid/vid pair to redis.
*
* Assumption here is that during warm boot ASIC state will not change.
*/

auto rid2vid = redisGetRidToVidMap();
bool success = true;

for (auto rid: sw->getDiscoveredRids())
{
if (rid2vid.find(rid) != rid2vid.end())
continue;

SWSS_LOG_ERROR("RID 0x%lx is missing from current RID2VID map after WARM boot!", rid);

success = false;
}

if (!success)
SWSS_LOG_THROW("FATAL, some discovered RIDs are not present in current RID2VID map, bug");

SWSS_LOG_NOTICE("all discovered RIDs are present in current RID2VID map");
}

void performWarmRestart()
{
SWSS_LOG_ENTER();
Expand Down Expand Up @@ -1329,5 +1363,7 @@ void performWarmRestart()

gSwitchId = g_switch_rid;

checkWarmBootDiscoveredRids(sw);

startDiagShell();
}

0 comments on commit 58845ce

Please sign in to comment.