Commit 54328b9c authored by Maciej Lipinski's avatar Maciej Lipinski

SNMP: fixed handling of SPLL STATS register version

- update wrsSpllStatusGroup to recognize ver=3
- update wrsSpllStatusGroup and wrsSpllVersionGroup to
  properly complain to syslog when not recognizing version
parent 77abf8d8
......@@ -57,7 +57,7 @@
#define ALIGN_STATE_WAIT_CLKIN 9
#define ALIGN_STATE_WAIT_PLOCK 10
#define SPLL_STATS_VER 2
#define SPLL_STATS_VER 3
/* info reported through .stat section */
/* due to endiannes problem strings has to be 4 bytes alligned */
......
......@@ -49,7 +49,8 @@ time_t wrsSpllStatus_data_fill(void)
return time_update;
}
/* check version of SPLL's stat structure, versions 1 and 2 are ok */
if ((spll_stats_p->ver == 1) || (spll_stats_p->ver == 2)) {
if ((spll_stats_p->ver == 1) || (spll_stats_p->ver == 2) ||
(spll_stats_p->ver == 3)) {
wrsSpllStatus_s.wrsSpllMode = spll_stats_p->mode;
wrsSpllStatus_s.wrsSpllIrqCnt = spll_stats_p->irq_cnt;
wrsSpllStatus_s.wrsSpllSeqState = spll_stats_p->seq_state;
......@@ -60,6 +61,13 @@ time_t wrsSpllStatus_data_fill(void)
wrsSpllStatus_s.wrsSpllMY = spll_stats_p->M_y;
wrsSpllStatus_s.wrsSpllDelCnt = spll_stats_p->del_cnt;
}
else
{
snmp_log(LOG_ERR, "SNMP: " SL_ER
"wrsSpllStatusGroup unsupported version of spll_stats "
"registers (reading ver %d, supported 1, 2 and 3) \n",
spll_stats_p->ver);
}
/* there was an update, return current time */
return time_update;
}
......
......@@ -54,6 +54,13 @@ time_t wrsSpllVersion_data_fill(void)
/* add time after added space at the end of string */
strncpy_e(&wrsSpllVersion_s.wrsSpllBuildDate[len + 1], spll_stats_p->build_time, 16 - 1);
}
else
{
snmp_log(LOG_ERR, "SNMP: " SL_ER
"wrsSpllVersionGroup unsupported version of spll_stats "
"registers (reading ver %d, supported 2 and 3) \n",
spll_stats_p->ver);
}
/* buil_by was introduced in version 3 */
if (spll_stats_p->ver == 3) {
strncpy_e(wrsSpllVersion_s.wrsSpllBuildBy, spll_stats_p->build_by, 32);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment