Skip to content

Commit ea08010

Browse files
committed
[status] Report TTC PON quality
1 parent 5581ba4 commit ea08010

File tree

6 files changed

+48
-14
lines changed

6 files changed

+48
-14
lines changed

README.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -551,18 +551,19 @@ metric format for the CRORC and the CRU is different, as different parameters ar
551551
552552
###### Metric: `"onu"`
553553
554-
| Value name | Value | Type |
555-
| -------------------| --------------------------- | ------ |
556-
| `"onuStickyStatus"`| 0/1 (DOWN/UP) | int |
557-
| `"onuAddress"` | ONU Address | string |
558-
| `"rx40Locked"` | 0/1 (False/True) | int |
559-
| `"phaseGood"` | 0/1 (False/True) | int |
560-
| `"rxLocked"` | 0/1 (False/True) | int |
561-
| `"operational"` | 0/1 (False/True) | int |
562-
| `"mgtTxReady"` | 0/1 (False/True) | int |
563-
| `"mgtRxReady"` | 0/1 (False/True) | int |
564-
| `"mgtTxPllLocked"` | 0/1 (False/True) | int |
565-
| `"mgtRxPllLocked"` | 0/1 (False/True) | int |
554+
| Value name - | Value | Type |
555+
| ---------------------| --------------------------- | ------ |
556+
| `"onuStickyStatus"` | 0/1 (DOWN/UP) | int |
557+
| `"onuAddress"` | ONU Address | string |
558+
| `"rx40Locked"` | 0/1 (False/True) | int |
559+
| `"phaseGood"` | 0/1 (False/True) | int |
560+
| `"rxLocked"` | 0/1 (False/True) | int |
561+
| `"operational"` | 0/1 (False/True) | int |
562+
| `"mgtTxReady"` | 0/1 (False/True) | int |
563+
| `"mgtRxReady"` | 0/1 (False/True) | int |
564+
| `"mgtTxPllLocked"` | 0/1 (False/True) | int |
565+
| `"mgtRxPllLocked"` | 0/1 (False/True) | int |
566+
| `"ponQualityStatus"` | 0/1 (Bad/Good) | int |
566567
567568
| Tag key | Value |
568569
| --------------------- | --------------------- |

src/CommandLineUtilities/ProgramStatus.cxx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@ class ProgramStatus : public Program
248248
onuStickyStatusInt = 0;
249249
}
250250

251+
std::string ponQualityStatusStr;
252+
ponQualityStatusStr = onuStatus.ponQualityStatus ? "good" : "bad";
253+
251254
if (mOptions.monitoring) {
252255
monitoring->send(Metric{ "onu" }
253256
.addValue(onuStickyStatusInt, "onuStickyStatus")
@@ -260,6 +263,7 @@ class ProgramStatus : public Program
260263
.addValue(onuStatus.mgtRxReady, "mgtRxReady")
261264
.addValue(onuStatus.mgtTxPllLocked, "mgtTxPllLocked")
262265
.addValue(onuStatus.mgtRxPllLocked, "mgtRxPllLocked")
266+
.addValue(onuStatus.ponQualityStatus, "ponQualityStatus")
263267
.addTag(tags::Key::SerialId, card.serialId.getSerial())
264268
.addTag(tags::Key::Endpoint, card.serialId.getEndpoint())
265269
.addTag(tags::Key::ID, card.sequenceId)
@@ -275,6 +279,8 @@ class ProgramStatus : public Program
275279
root.put("ONU MGT RX ready", onuStatus.mgtRxReady);
276280
root.put("ONU MGT TX PLL locked", onuStatus.mgtTxPllLocked);
277281
root.put("ONU MGT RX PLL locked", onuStatus.mgtRxPllLocked);
282+
root.put("PON quality", Utilities::toHexString(onuStatus.ponQuality));
283+
root.put("PON quality Status", ponQualityStatusStr);
278284
} else {
279285
std::cout << "=============================" << std::endl;
280286
std::cout << "ONU status: \t\t" << onuStickyStatus << std::endl;
@@ -288,6 +294,8 @@ class ProgramStatus : public Program
288294
std::cout << "ONU MGT RX ready: \t" << std::boolalpha << onuStatus.mgtRxReady << std::endl;
289295
std::cout << "ONU MGT TX PLL locked: \t" << std::boolalpha << onuStatus.mgtTxPllLocked << std::endl;
290296
std::cout << "ONU MGT RX PLL locked: \t" << std::boolalpha << onuStatus.mgtRxPllLocked << std::endl;
297+
std::cout << "PON quality: \t\t0x" << std::hex << onuStatus.ponQuality << std::endl;
298+
std::cout << "PON quality status: \t" << ponQualityStatusStr << std::endl;
291299
}
292300
}
293301

src/Cru/Common.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ struct OnuStatus {
112112
bool mgtTxPllLocked;
113113
bool mgtRxPllLocked;
114114
LinkStatus stickyBit;
115+
uint32_t ponQuality;
116+
int ponQualityStatus;
115117
};
116118

117119
struct LinkPacketInfo {

src/Cru/Constants.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,16 @@ static constexpr Register LOCK_CLOCK_TO_REF(0x00220000);
181181

182182
/// Register for modifying TTC parameters (CLOCK_/DATA_)
183183
static constexpr Register TTC_DATA(0x00200000);
184-
static constexpr Register TTC_ONU_STICKY(0x00200014);
185184
/*static constexpr uint32_t CLOCK_TTC(0x0);
186185
static constexpr uint32_t CLOCK_LOCAL(0x2);
187186
static constexpr uint32_t DATA_CTP(0x0);
188187
static constexpr uint32_t DATA_PATTERN(0x1);
189188
static constexpr uint32_t DATA_MIDTRG(0x2);*/
190189

190+
/// Registers for getting TTC info
191+
static constexpr Register TTC_ONU_STICKY(0x00200014);
192+
static constexpr Register TTC_PON_QUALITY(0x0010000C);
193+
191194
/// Registers used for TTC calibration
192195
static constexpr Register PON_WRAPPER_PLL(0x00224000);
193196
static constexpr Register PON_WRAPPER_TX(0x00226000);

src/Cru/Ttc.cxx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,9 @@ OnuStatus Ttc::onuStatus()
173173
calStatus >> 5 & 0x1,
174174
calStatus >> 6 & 0x1,
175175
calStatus >> 7 & 0x1,
176-
getOnuStickyBit()
176+
getOnuStickyBit(),
177+
getPonQuality(),
178+
getPonQualityStatus()
177179
};
178180

179181
return onuStatus;
@@ -388,6 +390,22 @@ void Ttc::setFixedBCTrigger(std::vector<uint32_t> FBCTVector)
388390
}
389391
}
390392

393+
uint32_t Ttc::getPonQuality()
394+
{
395+
return mBar->readRegister(Cru::Registers::TTC_PON_QUALITY.index);
396+
}
397+
398+
int Ttc::getPonQualityStatus()
399+
{
400+
uint32_t ponQuality = getPonQuality();
401+
std::this_thread::sleep_for(std::chrono::milliseconds(10));
402+
if (ponQuality == getPonQuality()) {
403+
return 1; // GOOD
404+
}
405+
406+
return 0; // BAD
407+
}
408+
391409
// Currently unused by RoC
392410
/*void Ttc::atxref(uint32_t refClock)
393411
{

src/Cru/Ttc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ class Ttc
5454
void configurePlls(uint32_t clock);
5555
void setRefGen(int frequency = 240);
5656
LinkStatus getOnuStickyBit();
57+
uint32_t getPonQuality();
58+
int getPonQualityStatus();
5759

5860
std::shared_ptr<BarInterface> mBar;
5961
std::unique_ptr<Interprocess::Lock> mI2cLock;

0 commit comments

Comments
 (0)