Commit 1b9cb6f3 authored by Grzegorz Daniluk's avatar Grzegorz Daniluk

Merge branch 'ML-SNMP-improvments' into greg-proposed_master

parents eec4846d b066b6e7
......@@ -622,7 +622,7 @@
\snmpentrye{WR-SWITCH-MIB}{wrsPtpDataTable}{wrsPtpServoUpdateTime.<n>}{
TAI Nanosecond of the last servo's update.}
\snmpentrye{WR-SWITCH-MIB}{}{wrsPortStatusTable}{Table with a row per port.}
\snmpentrye{WR-SWITCH-MIB}{}{wrsPortStatusTable}{Table with a port per row.}
\snmpentrye{WR-SWITCH-MIB}{wrsPortStatusTable}{wrsPortStatusIndex.<n>}{}
\snmpentrye{WR-SWITCH-MIB}{wrsPortStatusTable}{wrsPortStatusPortName.<n>}{}
\snmpentrye{WR-SWITCH-MIB}{wrsPortStatusTable}{wrsPortStatusLink.<n>}{}
......@@ -645,6 +645,27 @@
\snmpentrye{WR-SWITCH-MIB}{wrsPortStatusTable}{wrsPortStatusSfpTxPower.<n>}{}
\snmpentrye{WR-SWITCH-MIB}{wrsPortStatusTable}{wrsPortStatusSfpRxPower.<n>}{}
\snmpentrye{WR-SWITCH-MIB}{}{wrsPtpInstanceTable}{Table with all PTP instances.
This table has two indexes. The first one \textit{n}, corresponds to port
number to which a particular instance is assigned, the second index \textit{m},
is a serial number of an instance on particular port.}
\snmpentrye{WR-SWITCH-MIB}{wrsPtpInstanceTable}{wrsPtpInstancePortIndex.<n>.<m>}{}
\snmpentrye{WR-SWITCH-MIB}{wrsPtpInstanceTable}{wrsPtpInstanceOnPortIndex.<n>.<m>}{}
\snmpentrye{WR-SWITCH-MIB}{wrsPtpInstanceTable}{wrsPtpInstanceName.<n>.<m>}{}
\snmpentrye{WR-SWITCH-MIB}{wrsPtpInstanceTable}{wrsPtpInstancePort.<n>.<m>}{}
\snmpentrye{WR-SWITCH-MIB}{wrsPtpInstanceTable}{wrsPtpInstancePortInstance.<n>.<m>}{}
\snmpentrye{WR-SWITCH-MIB}{wrsPtpInstanceTable}{wrsPtpInstancePortName.<n>.<m>}{}
\snmpentrye{WR-SWITCH-MIB}{wrsPtpInstanceTable}{wrsPtpInstanceState.<n>.<m>}{}
\snmpentrye{WR-SWITCH-MIB}{wrsPtpInstanceTable}{wrsPtpInstanceStateNext.<n>.<m>}{}
\snmpentrye{WR-SWITCH-MIB}{wrsPtpInstanceTable}{wrsPtpInstanceRole.<n>.<m>}{}
\snmpentrye{WR-SWITCH-MIB}{wrsPtpInstanceTable}{wrsPtpInstanceMechanism.<n>.<m>}{}
\snmpentrye{WR-SWITCH-MIB}{wrsPtpInstanceTable}{wrsPtpInstanceProto.<n>.<m>}{}
\snmpentrye{WR-SWITCH-MIB}{wrsPtpInstanceTable}{wrsPtpInstanceExt.<n>.<m>}{}
\snmpentrye{WR-SWITCH-MIB}{wrsPtpInstanceTable}{wrsPtpInstancePeerMac.<n>.<m>}{}
\snmpentrye{WR-SWITCH-MIB}{wrsPtpInstanceTable}{wrsPtpInstancePeerVid.<n>.<m>}{}
\snmpentrye{WR-SWITCH-MIB}{wrsPtpInstanceTable}{wrsPtpInstanceVlanNum.<n>.<m>}{}
\snmpentrye{WR-SWITCH-MIB}{wrsPtpInstanceTable}{wrsPtpInstanceVlanListStr.<n>.<m>}{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Add entries from other MIBs.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
......
......@@ -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 */
......
......@@ -51,6 +51,7 @@ SOURCES = \
wrsPstatsHCTable.c \
wrsPtpDataTable.c \
wrsPortStatusTable.c \
wrsPtpInstanceTable.c \
init.c \
MIBS = WR-SWITCH-MIB.txt
......
......@@ -10,7 +10,7 @@ WR-SWITCH-MIB DEFINITIONS ::= BEGIN
IMPORTS
OBJECT-TYPE, Integer32, Unsigned32, Counter32, Counter64,
MODULE-IDENTITY, enterprises FROM SNMPv2-SMI
DisplayString FROM SNMPv2-TC;
DisplayString, PhysAddress FROM SNMPv2-TC;
......@@ -37,6 +37,7 @@ wrSwitchMIB MODULE-IDENTITY
- wrsPortStatusSfpTxBias
- wrsPortStatusSfpTxPower
- wrsPortStatusSfpRxPower
Add wrsPtpInstanceTable
"
REVISION "201602171600Z"
......@@ -1174,7 +1175,7 @@ wrsStartCntLdap OBJECT-TYPE
STATUS current
DESCRIPTION
"Number of LDAP daemon starts"
::= { wrsStartCntGroup 9 }
::= { wrsStartCntGroup 10 }
-- wrsSpllState (.7.3)
wrsSpllState OBJECT IDENTIFIER ::= { wrsExpertStatus 3 }
......@@ -1752,7 +1753,8 @@ WrsPtpDataEntry ::=
wrsPtpServoStateErrCnt Counter32,
wrsPtpClockOffsetErrCnt Counter32,
wrsPtpRTTErrCnt Counter32,
wrsPtpServoUpdateTime Counter64
wrsPtpServoUpdateTime Counter64,
wrsPtpServoExt INTEGER
}
wrsPtpDataIndex OBJECT-TYPE
......@@ -1955,6 +1957,19 @@ wrsPtpServoUpdateTime OBJECT-TYPE
"TAI Nanosecond of the last servo's update"
::= { wrsPtpDataEntry 23 }
wrsPtpServoExt OBJECT-TYPE
SYNTAX INTEGER {
na(0),
none(1),
wr(2),
l1Sync(3)
}
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Extension with which the servo runs."
::= { wrsPtpDataEntry 24 }
-- wrsPortStatusTable (.7.6)
wrsPortStatusTable OBJECT-TYPE
SYNTAX SEQUENCE OF WrsPortStatusEntry
......@@ -2158,7 +2173,7 @@ wrsPortStatusSfpDom OBJECT-TYPE
::= { wrsPortStatusEntry 16 }
wrsPortStatusSfpTemp OBJECT-TYPE
SYNTAX INTEGER
SYNTAX Integer32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
......@@ -2167,7 +2182,7 @@ wrsPortStatusSfpTemp OBJECT-TYPE
::= { wrsPortStatusEntry 17 }
wrsPortStatusSfpVcc OBJECT-TYPE
SYNTAX INTEGER
SYNTAX Integer32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
......@@ -2176,7 +2191,7 @@ wrsPortStatusSfpVcc OBJECT-TYPE
::= { wrsPortStatusEntry 18 }
wrsPortStatusSfpTxBias OBJECT-TYPE
SYNTAX INTEGER
SYNTAX Integer32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
......@@ -2185,7 +2200,7 @@ wrsPortStatusSfpTxBias OBJECT-TYPE
::= { wrsPortStatusEntry 19 }
wrsPortStatusSfpTxPower OBJECT-TYPE
SYNTAX INTEGER
SYNTAX Integer32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
......@@ -2194,7 +2209,7 @@ wrsPortStatusSfpTxPower OBJECT-TYPE
::= { wrsPortStatusEntry 20 }
wrsPortStatusSfpRxPower OBJECT-TYPE
SYNTAX INTEGER
SYNTAX Integer32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
......@@ -2611,6 +2626,351 @@ wrsPstatsHCNICTXFrames OBJECT-TYPE
DESCRIPTION
"Number of TX frames coming from CPU"
::= { wrsPstatsHCEntry 42 }
-- wrsPtpInstanceTable (.7.8)
wrsPtpInstanceTable OBJECT-TYPE
SYNTAX SEQUENCE OF WrsPtpInstanceEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
"Pstats counters for each port"
::= { wrsExpertStatus 8 }
wrsPtpInstanceEntry OBJECT-TYPE
SYNTAX WrsPtpInstanceEntry
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
"An entry containing pstats counters"
INDEX { wrsPtpInstancePortIndex, wrsPtpInstanceOnPortIndex }
::= { wrsPtpInstanceTable 1 }
WrsPtpInstanceEntry ::=
SEQUENCE {
wrsPtpInstancePortIndex Unsigned32,
wrsPtpInstanceOnPortIndex Unsigned32,
wrsPtpInstanceName DisplayString,
wrsPtpInstancePort INTEGER,
wrsPtpInstancePortInstance INTEGER,
wrsPtpInstancePortName DisplayString,
wrsPtpInstanceState INTEGER,
wrsPtpInstanceMasterOnly INTEGER,
wrsPtpInstanceExtPortCfgDesSt INTEGER,
wrsPtpInstanceMechanism INTEGER,
wrsPtpInstanceProfile INTEGER,
wrsPtpInstanceExtension INTEGER,
wrsPtpInstanceAsymEnabled INTEGER,
wrsPtpInstanceAsymConstAsym Counter64,
wrsPtpInstanceAsymConstAsymPS Counter64,
wrsPtpInstanceAsymScDelayCoef Counter64,
wrsPtpInstanceAsymScDelayCoefHR DisplayString,
wrsPtpInstanceTSCorrEgressLat Counter64,
wrsPtpInstanceTSCorrEgressLatPS Counter64,
wrsPtpInstanceTSCorrIngLat Counter64,
wrsPtpInstanceTSCorrIngLatPS Counter64,
wrsPtpInstanceTSCorrSemistLat Counter64,
wrsPtpInstanceTSCorrSemistLatPS Counter64,
wrsPtpInstanceProtoDetectState INTEGER,
wrsPtpInstanceExtState INTEGER,
wrsPtpInstancePeerMac PhysAddress,
wrsPtpInstancePeerVid INTEGER,
wrsPtpInstanceVlanNum INTEGER,
wrsPtpInstanceVlanListStr DisplayString
}
wrsPtpInstancePortIndex OBJECT-TYPE
SYNTAX Unsigned32
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
"Index for wrsPtpInstanceTable"
::= { wrsPtpInstanceEntry 1 }
wrsPtpInstanceOnPortIndex OBJECT-TYPE
SYNTAX Unsigned32
MAX-ACCESS not-accessible
STATUS current
DESCRIPTION
"Index for wrsPtpInstanceTable"
::= { wrsPtpInstanceEntry 2 }
wrsPtpInstanceName OBJECT-TYPE
SYNTAX DisplayString (SIZE (0..12))
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Name of an instance"
::= { wrsPtpInstanceEntry 3 }
wrsPtpInstancePort OBJECT-TYPE
SYNTAX Integer32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Port number on which an instance is running"
::= { wrsPtpInstanceEntry 4 }
wrsPtpInstancePortInstance OBJECT-TYPE
SYNTAX Integer32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Index of an instance running on a port"
::= { wrsPtpInstanceEntry 5 }
wrsPtpInstancePortName OBJECT-TYPE
SYNTAX DisplayString (SIZE (0..12))
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Port name of port"
::= { wrsPtpInstanceEntry 6 }
wrsPtpInstanceState OBJECT-TYPE
SYNTAX INTEGER {
na(0),
initializing(1),
faulty(2),
disabled(3),
listening(4),
preMaster(5),
master(6),
passive(7),
uncalibrated(8),
slave(9)
}
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Name of instance"
::= { wrsPtpInstanceEntry 7 }
wrsPtpInstanceMasterOnly OBJECT-TYPE
SYNTAX INTEGER {
na(0),
disabled(1),
enabled(2)
}
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"MasterOnly feature enabled/disabled"
::= { wrsPtpInstanceEntry 8 }
wrsPtpInstanceExtPortCfgDesSt OBJECT-TYPE
SYNTAX INTEGER {
na(0),
initializing(1),
faulty(2),
disabled(3),
listening(4),
preMaster(5),
master(6),
passive(7),
uncalibrated(8),
slave(9)
}
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"DesiredState to be used if/when externalPortConfiguration feature is enabled"
::= { wrsPtpInstanceEntry 9 }
wrsPtpInstanceMechanism OBJECT-TYPE
SYNTAX INTEGER { --- see ppsi/include/ppsi/ieee1588_types.h
na(0),
e2e(1),
p2p(2),
commonP2P(3),
special(4),
noMechanism(254)
}
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Delay Mechanism type used by PTP Instance"
::= { wrsPtpInstanceEntry 10 }
wrsPtpInstanceProfile OBJECT-TYPE
SYNTAX INTEGER { -- ppsi/include/ppsi/ppsi.h
na(0),
defaultPTP(1), -- PPSI_PROFILE_PTP
whiteRabbit(2), -- PPSI_PROFILE_WR
highAccuracy(3), -- PPSI_PROFILE_HA
custom(4) -- PPSI_PROFILE_CUSTOM
}
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Profile/Extension configured on a PTP Instance"
::= { wrsPtpInstanceEntry 11 }
wrsPtpInstanceExtension OBJECT-TYPE
SYNTAX INTEGER { --ppsi/include/ppsi/ppsi.h
na(0),
none(1), -- PPSI_EXT_NONE
whiteRabbit(2), -- PPSI_EXT_WR
l1Sync(3) -- PPSI_EXT_L1S
}
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Extension used on the PTP Instance"
::= { wrsPtpInstanceEntry 12 }
wrsPtpInstanceAsymEnabled OBJECT-TYPE
SYNTAX INTEGER {
na(0),
disabled(1),
enabled(2)
}
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Asymmetry Corrections enabled/disabled on the PTP Instance"
::= { wrsPtpInstanceEntry 13 }
wrsPtpInstanceAsymConstAsym OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Constant Asymmetry in scaled nanoseconds"
::= { wrsPtpInstanceEntry 14 }
wrsPtpInstanceAsymConstAsymPS OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Constant Asymmetry in picoseconds"
::= { wrsPtpInstanceEntry 15 }
wrsPtpInstanceAsymScDelayCoef OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Scaled Relative Delay Coefficient"
::= { wrsPtpInstanceEntry 16 }
wrsPtpInstanceAsymScDelayCoefHR OBJECT-TYPE
SYNTAX DisplayString (SIZE (0..64))
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Relative Delay Coefficient in a floating form"
::= { wrsPtpInstanceEntry 17 }
wrsPtpInstanceTSCorrEgressLat OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Egress Latency (Tx Fixed Delay) in scaled nanoseconds"
::= { wrsPtpInstanceEntry 18 }
wrsPtpInstanceTSCorrEgressLatPS OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Egress Latency (Tx Fixed Delay) in picoseconds"
::= { wrsPtpInstanceEntry 19 }
wrsPtpInstanceTSCorrIngLat OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Ingress Latency (Rx Fixed Delay) in scaled nanoseconds"
::= { wrsPtpInstanceEntry 20 }
wrsPtpInstanceTSCorrIngLatPS OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Ingress Latency (Rx Fixed Delay) in picoseconds"
::= { wrsPtpInstanceEntry 21 }
wrsPtpInstanceTSCorrSemistLat OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Semi-static latency (bitslide) in scaled nanoseconds"
::= { wrsPtpInstanceEntry 22 }
wrsPtpInstanceTSCorrSemistLatPS OBJECT-TYPE
SYNTAX Counter64
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Semi-static latency (bitslide) in picoseconds"
::= { wrsPtpInstanceEntry 23 }
wrsPtpInstanceProtoDetectState OBJECT-TYPE
SYNTAX INTEGER { -- ppsi/include/ppsi/pp-instance.h
na(0),
none(1), -- PP_PDSTATE_NONE
pWaitMsg(2), -- PP_PDSTATE_WAIT_MSG
pDetection(3), -- PP_PDSTATE_PDETECTION
pDetected(4), -- PP_PDSTATE_PDETECTED
pFailure(5) -- PP_PDSTATE_FAILURE
}
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Protocol detection state"
::= { wrsPtpInstanceEntry 24 }
wrsPtpInstanceExtState OBJECT-TYPE
SYNTAX INTEGER { -- ppsi/include/ppsi/pp-instance.h
na(0),
disabled(1), -- PP_EXSTATE_DISABLE
active(2), -- PP_EXSTATE_ACTIVE
ptp(3) -- PP_EXSTATE_PTP
}
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"State of PTP extension (more than one are allowed per 1 physical port)"
::= { wrsPtpInstanceEntry 25 }
wrsPtpInstancePeerMac OBJECT-TYPE
SYNTAX PhysAddress
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"MAC used by an instance"
::= { wrsPtpInstanceEntry 26 }
wrsPtpInstancePeerVid OBJECT-TYPE
SYNTAX Integer32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"VID used by an instance"
::= { wrsPtpInstanceEntry 27 }
wrsPtpInstanceVlanNum OBJECT-TYPE
SYNTAX Integer32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Number of VLANs used by an instance"
::= { wrsPtpInstanceEntry 28 }
wrsPtpInstanceVlanListStr OBJECT-TYPE
SYNTAX DisplayString (SIZE (0..160)) --32*5-
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Coma separated list of VLANs used by an instance"
::= { wrsPtpInstanceEntry 29 }
--wrsNetworking
--Configuration
......
......@@ -26,6 +26,7 @@
#include "wrsPtpDataTable.h"
#include "wrsPortStatusTable.h"
#include "wrsPstatsHCTable.h"
#include "wrsPtpInstanceTable.h"
#define DOTCONFIG_FILE "/wr/etc/dot-config"
......@@ -59,6 +60,7 @@ void init_wrsSnmp(void)
init_wrsPtpDataTable();
init_wrsPortStatusTable();
init_wrsPstatsHCTable();
init_wrsPtpInstanceTable();
/* perform first reads, needed to calculate deltas later */
wrsTimingStatus_data_fill();
......
......@@ -10,8 +10,6 @@ int hal_nports_local;
/* PPSI */
struct wrs_shm_head *ppsi_head;
static struct pp_globals *ppg;
struct pp_servo *ppsi_servo;
struct wr_servo_state *ppsi_wr_servo;
struct pp_instance *ppsi_ppi;
int *ppsi_ppi_nlinks;
......@@ -122,15 +120,6 @@ static int init_shm_ppsi(void)
}
ppg = (void *)ppsi_head + ppsi_head->data_off;
/* TODO JCB Servo is part of an instance now */
ppsi_servo=NULL;
// ppsi_servo = wrs_shm_follow(ppsi_head, ppg->servo);
// if (!ppsi_servo) {
// snmp_log(LOG_ERR, "SNMP: " SL_ER
// "Cannot follow ppsi_servo in shmem.\n");
// return 4;
// }
ppsi_ppi = wrs_shm_follow(ppsi_head, ppg->pp_instances);
if (!ppsi_ppi) {
snmp_log(LOG_ERR, "SNMP: " SL_ER
......
......@@ -15,7 +15,6 @@ extern int hal_nports_local;
/* PPSI */
extern struct wrs_shm_head *ppsi_head;
extern struct pp_servo *ppsi_servo;
extern struct pp_instance *ppsi_ppi;
extern int *ppsi_ppi_nlinks;
......
......@@ -29,9 +29,18 @@ static struct pickinfo wrsPtpDataTable_pickinfo[] = {
FIELD(wrsPtpDataTable_s, ASN_COUNTER, wrsPtpClockOffsetErrCnt),
FIELD(wrsPtpDataTable_s, ASN_COUNTER, wrsPtpRTTErrCnt),
FIELD(wrsPtpDataTable_s, ASN_COUNTER64, wrsPtpServoUpdateTime),
FIELD(wrsPtpDataTable_s, ASN_INTEGER, wrsPtpServoExt),
};
//FIXME: make a library in ppsi with all such functions, use it all around
int64_t pp_time_to_picos(struct pp_time *ts)
{
return ts->secs * PP_NSEC_PER_SEC
+ ((ts->scaled_nsecs * 1000 + 0x8000) >> TIME_INTERVAL_FRACBITS);
}
static int32_t int_saturate(int64_t value)
{
if (value >= INT32_MAX)
......@@ -49,6 +58,15 @@ time_t wrsPtpDataTable_data_fill(unsigned int *n_rows)
static time_t time_update;
time_t time_cur;
static int n_rows_local = 0;
int si = 0;
int i;
struct wrsPtpDataTable_s *ptp_a;
struct pp_instance *ppsi_i;
struct pp_servo *ppsi_servo;
struct wr_data *wr_d;
struct wr_servo_ext *wr_servo;
struct wrh_servo_t *wrh_servo;
char *tmp_name;
/* number of rows does not change for wrsPortStatusTable */
if (n_rows)
......@@ -80,37 +98,154 @@ time_t wrsPtpDataTable_data_fill(unsigned int *n_rows)
if (n_rows)
*n_rows = n_rows_local;
ptp_a = wrsPtpDataTable_array;
/* servo/slave instance counter */
si = 0;
/* assume that there is only one servo, will change when switchover is
* implemented */
while (1) {
ii = wrs_shm_seqbegin(ppsi_head);
for (i = 0; i < *ppsi_ppi_nlinks; i++)
{
/* report not more than max number of servo instances */
if( si >= WRS_MAX_N_SERVO_INSTANCES)
break;
ppsi_i = ppsi_ppi + i;
if (ppsi_i->state == PPS_SLAVE)
{
/*********** from ppsi instance ***************/
/* wrsPtpPortName */
tmp_name = (char *) wrs_shm_follow(ppsi_head,
ppsi_i->iface_name);
strncpy(ptp_a[si].wrsPtpPortName, tmp_name, 12);
ptp_a[si].wrsPtpPortName[11] = '\0';
/*********** from standard servo ***************/
/* get servo for ptp instance in Slave state*/
ppsi_servo = wrs_shm_follow(ppsi_head,
ppsi_i->servo);
/* wrsPtpGrandmasterID */
//TODO
/* wrsPtpOwnID */
//TODO
/* wrsPtpMode */
//TODO
/* wrsPtpServoState */
strncpy(ptp_a[si].wrsPtpServoState,
ppsi_servo->servo_state_name,
sizeof(ppsi_servo->servo_state_name));
/* wrsPtpServoStateN */
ptp_a[si].wrsPtpServoStateN = ppsi_servo->state;
/* wrsPtpClockOffsetPs */
ptp_a[si].wrsPtpClockOffsetPs =
pp_time_to_picos(&ppsi_servo->offsetFromMaster);
/* wrsPtpClockOffsetPsHR */
ptp_a[si].wrsPtpClockOffsetPsHR =
int_saturate(ptp_a[si].wrsPtpClockOffsetPs);
/* wrsPtpRTT */
ptp_a[si].wrsPtpRTT = 2*
pp_time_to_picos(&ppsi_servo->meanDelay);
/* wrsPtpLinkLength */
ptp_a[si].wrsPtpLinkLength =
(uint32_t)(pp_time_to_picos(&ppsi_servo->delayMS)
/1e12 * 300e6 / 1.55);
/* wrsPtpServoUpdates */
ptp_a[si].wrsPtpServoUpdates =
ppsi_servo->update_count;
/* wrsPtpServoUpdateTime */
ptp_a[si].wrsPtpServoUpdateTime =
ppsi_servo->update_time.secs * 1000 * 1000 * 1000
+ (ppsi_servo->update_time.scaled_nsecs >> 16);
/* wrsPtpServoExt */
ptp_a[si].wrsPtpServoExt = 1+
ppsi_i->protocol_extension;
/******** from extensions-specific ************/
if (ppsi_i->protocol_extension == PPSI_EXT_WR)
{
wr_d = (struct wr_data *)
wrs_shm_follow(ppsi_head,
ppsi_i->ext_data);
wr_servo = &wr_d->servo_ext;
wrh_servo = &wr_d->servo;
/* wrsPtpPhaseTracking */
ptp_a[si].wrsPtpPhaseTracking =
1 + wrh_servo->tracking_enabled;
/* wrsPtpSyncSource */
// TODO
/* wrsPtpSkew */
ptp_a[si].wrsPtpSkew =
int_saturate(wrh_servo->skew_ps);
/* wrsPtpDeltaTxM */
ptp_a[si].wrsPtpDeltaTxM =
pp_time_to_picos(&wr_servo->delta_txm);
/* wrsPtpDeltaRxM */
ptp_a[si].wrsPtpDeltaRxM =
pp_time_to_picos(&wr_servo->delta_rxm);
/* wrsPtpDeltaTxS */
ptp_a[si].wrsPtpDeltaTxS =
pp_time_to_picos(&wr_servo->delta_txs);
/* wrsPtpDeltaRxS */
ptp_a[si].wrsPtpDeltaRxS =
pp_time_to_picos(&wr_servo->delta_rxs);
/* wrsPtpServoStateErrCnt */
ptp_a[si].wrsPtpServoStateErrCnt =
wrh_servo->n_err_state;
/* wrsPtpClockOffsetErrCnt */
ptp_a[si].wrsPtpClockOffsetErrCnt =
wrh_servo->n_err_offset;
/* wrsPtpRTTErrCnt */
ptp_a[si].wrsPtpRTTErrCnt =
wrh_servo->n_err_delta_rtt;
}
else
{
memset(ptp_a[si].wrsPtpSyncSource,
0, 32 * sizeof(char));
ptp_a[si].wrsPtpPhaseTracking = 0;
ptp_a[si].wrsPtpSkew = 0;
ptp_a[si].wrsPtpDeltaTxM = 0;
ptp_a[si].wrsPtpDeltaRxM = 0;
ptp_a[si].wrsPtpDeltaTxS = 0;
ptp_a[si].wrsPtpDeltaRxS = 0;
ptp_a[si].wrsPtpServoStateErrCnt = 0;
ptp_a[si].wrsPtpClockOffsetErrCnt = 0;
ptp_a[si].wrsPtpRTTErrCnt = 0;
}
/* look for next PTP Instance in Slave state*/
si++;
}
}
//TODO JCB : Search servo instance to display
// strncpy(wrsPtpDataTable_array[0].wrsPtpServoState,
// ppsi_servo->servo_state_name,
// sizeof(ppsi_servo->servo_state_name));
// wrsPtpDataTable_array[0].wrsPtpServoStateN = ppsi_servo->state;