Skip to content

Commit 3ff1811

Browse files
committed
[config] Check for TX freqs when reconfiguring
1 parent 4c9fad4 commit 3ff1811

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/Cru/CruBar.cxx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,20 @@ bool CruBar::checkPonUpstreamStatusExpected(uint32_t ponUpstreamRegister, uint32
396396
return false;
397397
}
398398
}
399+
400+
bool CruBar::checkClockConsistent(std::map<int, Link> linkMap)
401+
{
402+
float prevTxFreq = -1;
403+
for (auto& el : linkMap) {
404+
auto& link = el.second;
405+
if (prevTxFreq != link.txFreq && prevTxFreq != -1) {
406+
return false;
407+
}
408+
prevTxFreq = link.txFreq;
409+
}
410+
return true;
411+
}
412+
399413
/// Get the enabled features for the card's firmware.
400414
FirmwareFeatures CruBar::parseFirmwareFeatures()
401415
{
@@ -537,6 +551,7 @@ void CruBar::configure(bool force)
537551
static_cast<uint32_t>(mDownstreamData) == reportInfo.downstreamData &&
538552
std::equal(mLinkMap.begin(), mLinkMap.end(), reportInfo.linkMap.begin()) &&
539553
checkPonUpstreamStatusExpected(reportInfo.ponStatusRegister, reportInfo.onuAddress) &&
554+
checkClockConsistent(reportInfo.linkMap) &&
540555
mCruId == reportInfo.cruId &&
541556
mDynamicOffset == reportInfo.dynamicOffset &&
542557
mTriggerWindowSize == reportInfo.triggerWindowSize &&
@@ -553,7 +568,7 @@ void CruBar::configure(bool force)
553568
DatapathWrapper datapathWrapper = DatapathWrapper(mPdaBar);
554569

555570
/* TTC */
556-
if (static_cast<uint32_t>(mClock) != reportInfo.ttcClock || force) {
571+
if (static_cast<uint32_t>(mClock) != reportInfo.ttcClock || !checkClockConsistent(reportInfo.linkMap) || force) {
557572
log("Setting the clock");
558573
ttc.setClock(mClock);
559574

@@ -569,7 +584,7 @@ void CruBar::configure(bool force)
569584
}
570585
}
571586

572-
if (mGbtEnabled) {
587+
if (mGbtEnabled || !checkClockConsistent(reportInfo.linkMap)) {
573588
log("Calibrating the fPLLs");
574589
Gbt gbt = Gbt(mPdaBar, mLinkMap, mWrapperCount, mEndpoint);
575590
gbt.calibrateGbt(mLinkMap);

src/Cru/CruBar.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ class CruBar final : public BarInterfaceBase
116116
uint32_t getPonStatusRegister();
117117
uint32_t getOnuAddress();
118118
bool checkPonUpstreamStatusExpected(uint32_t ponUpstreamRegister, uint32_t onuAddress);
119+
bool checkClockConsistent(std::map<int, Link> linkMap);
119120
void populateLinkMap(std::map<int, Link>& linkMap);
120121

121122
uint32_t getDdgBurstLength();

0 commit comments

Comments
 (0)