Commit d8d49c67 authored by Adam Wujek's avatar Adam Wujek 💬

userspace/snmpd: add wrsPTPFramesFlowing to wrsTimingStatusGroup

Add object to inform if TX and RX PTP packets are flowing.

Additionally:
--update MIB
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent ecec2f15
......@@ -179,7 +179,8 @@ wrsSlaveLinksStatus OBJECT-TYPE
SYNTAX INTEGER {
na(0),
ok(1),
error(2)
error(2),
warningNA(4)
}
MAX-ACCESS read-only
STATUS current
......@@ -187,9 +188,30 @@ wrsSlaveLinksStatus OBJECT-TYPE
"Grouped status of slave link statuses
ok - when every slave port is up when switch is in slave mode
and when every slave port is down when switch in master/grandmaster mode
don't care about non-wr and auto ports"
don't care about non-wr and auto ports
warningNA - there is N/A in wrsSpllMode, wrsPortStatusLink or
wrsPortStatusConfiguredMode"
::= { wrsTimingStatusGroup 3 }
wrsPTPFramesFlowing OBJECT-TYPE
SYNTAX INTEGER {
na(0),
ok(1),
error(2),
warningNA(4),
firstRead(6)
}
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Grouped status of TX and RX PTP packets flowing
ok - when there are PTP packets flowing in both directions on all
wr ports that are up
warningNA - there is N/A in wrsPortStatusLink or wrsPortStatusConfiguredMode
error - no PTP packets flowing at least on one wr up port
firstRead - unable to calculate deltas in first read"
::= { wrsTimingStatusGroup 4 }
-- wrsNetworkingStatusGroup (.6.1.3)
wrsNetworkingStatusGroup OBJECT IDENTIFIER ::= { wrsDetailedStatusesGroup 3 }
......
......@@ -12,9 +12,14 @@ static struct pickinfo wrsTimingStatus_pickinfo[] = {
struct wrsTimingStatus_s wrsTimingStatus_s;
/* store old values of TX and RX PTP counters to calculate delta */
static unsigned long ptp_tx_count_prev[WRS_N_PORTS];
static unsigned long ptp_rx_count_prev[WRS_N_PORTS];
time_t wrsTimingStatus_data_fill(void)
{
static time_t time_update; /* time of last update */
static int first_run = 1;
time_t time_spll; /* time when softPLL data was updated */
time_t time_port_status; /* time when port status table was updated */
unsigned int port_status_nrows; /* number of rows in PortStatusTable */
......@@ -122,7 +127,44 @@ time_t wrsTimingStatus_data_fill(void)
"failed for port %d\n", i);
}
}
/*********************************************************************\
|************************ wrsPTPFramesFlowing ************************|
\*********************************************************************/
/*
* Check if PTP frames are flowing. Check only on ports that are
* non-wr and up.
*/
p_a = wrsPortStatusTable_array;
wrsTimingStatus_s.wrsPTPFramesFlowing = WRS_PTP_FRAMES_FLOWING_OK;
for (i = 0; i < port_status_nrows; i++) {
if (first_run == 1) {
/* don't report errors during first run */
wrsTimingStatus_s.wrsPTPFramesFlowing =
WRS_PTP_FRAMES_FLOWING_FR;
/* Error when there is no increase in TX/RX PTP counters.
Check only when port is non-wr and port is down */
} else if ((p_a[i].port_mode != WRS_PORT_STATUS_CONFIGURED_MODE_NON_WR)
&& (p_a[i].link_up == WRS_PORT_STATUS_LINK_UP)
&& ((ptp_tx_count_prev[i] == p_a[i].ptp_tx_count)
|| (ptp_rx_count_prev[i] == p_a[i].ptp_rx_count))) {
wrsTimingStatus_s.wrsPTPFramesFlowing =
WRS_PTP_FRAMES_FLOWING_ERROR;
snmp_log(LOG_ERR, "SNMP: wrsPTPFramesFlowing "
"failed for port %d\n", i);
/* warning N/A */
} else if (p_a[i].port_mode == 0
|| p_a[i].link_up == 0){
wrsTimingStatus_s.wrsPTPFramesFlowing =
WRS_PTP_FRAMES_FLOWING_WARNING_NA;
}
/* save current values */
ptp_tx_count_prev[i] = p_a[i].ptp_tx_count;
ptp_rx_count_prev[i] = p_a[i].ptp_rx_count;
}
first_run = 0;
/* there was an update, return current time */
return time_update;
}
......
......@@ -17,6 +17,13 @@
* equal to 0 (NA),shouldn't happen in
* normal operation */
#define WRS_PTP_FRAMES_FLOWING_OK 1 /* ok */
#define WRS_PTP_FRAMES_FLOWING_ERROR 2 /* error */
#define WRS_PTP_FRAMES_FLOWING_WARNING_NA 4 /* warning, at least one field is
* equal to 0 (NA),shouldn't happen in
* normal operation */
#define WRS_PTP_FRAMES_FLOWING_FR 6 /* ok, first run */
struct wrsTimingStatus_s {
int wrsPTPStatus;
int wrsSoftPLLStatus;
......
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