Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
86
Issues
86
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
White Rabbit Switch - Software
Commits
cc9fb7ab
Commit
cc9fb7ab
authored
Feb 12, 2015
by
Adam Wujek
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
userspace/snmp: add saturated version of clock_offset
Signed-off-by:
Adam Wujek
<
adam.wujek@cern.ch
>
parent
d0dab56b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
6 deletions
+36
-6
WR-SWITCH-MIB.txt
userspace/snmpd/WR-SWITCH-MIB.txt
+12
-4
wrsPpsi.c
userspace/snmpd/wrsPpsi.c
+24
-2
No files found.
userspace/snmpd/WR-SWITCH-MIB.txt
View file @
cc9fb7ab
...
...
@@ -334,13 +334,21 @@ ppsiClockOffsetPs OBJECT-TYPE
"Current clock offset from master, in picoseconds"
::= { wrsPpsiGlobals 8 }
ppsiClockOffsetPsHR OBJECT-TYPE
SYNTAX INTEGER
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Human Readable current clock offset from master, in picoseconds with saturation to integer"
::= { wrsPpsiGlobals 9 }
ppsiSkew OBJECT-TYPE
SYNTAX INTEGER
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The estimated change of master-to-slave delay, in picoseconds"
::= { wrsPpsiGlobals
9
}
::= { wrsPpsiGlobals
10
}
ppsiRTT OBJECT-TYPE
SYNTAX Counter64 -- does unsigned64 exits?
...
...
@@ -348,7 +356,7 @@ ppsiRTT OBJECT-TYPE
STATUS current
DESCRIPTION
"The round-trip-time, from master, in picoseconds"
::= { wrsPpsiGlobals 1
0
}
::= { wrsPpsiGlobals 1
1
}
ppsiLinkLength OBJECT-TYPE
SYNTAX Unsigned32
...
...
@@ -356,7 +364,7 @@ ppsiLinkLength OBJECT-TYPE
STATUS current
DESCRIPTION
"Estimated fiber length, from master-to-slave delay, in meters"
::= { wrsPpsiGlobals 1
1
}
::= { wrsPpsiGlobals 1
2
}
ppsiServoUpdates OBJECT-TYPE
SYNTAX Unsigned32
...
...
@@ -364,7 +372,7 @@ ppsiServoUpdates OBJECT-TYPE
STATUS current
DESCRIPTION
"How many time did the servo run"
::= { wrsPpsiGlobals 1
2
}
::= { wrsPpsiGlobals 1
3
}
-- per-port (.3.2)
...
...
userspace/snmpd/wrsPpsi.c
View file @
cc9fb7ab
...
...
@@ -57,6 +57,8 @@ static struct wrs_p_globals {
int
tracking_enabled
;
char
sync_source
[
32
];
/* FIXME: not implemented */
int64_t
clock_offset
;
int32_t
clock_offsetHR
;
/* Human readable version of clock_offset,
* saturated to int limits */
int32_t
skew
;
int64_t
rtt
;
uint32_t
llength
;
...
...
@@ -73,6 +75,7 @@ static struct ppsi_pickinfo g_pickinfo[] = {
FIELD
(
wrs_p_globals
,
ASN_INTEGER
,
tracking_enabled
),
FIELD
(
wrs_p_globals
,
ASN_OCTET_STR
,
sync_source
),
FIELD
(
wrs_p_globals
,
ASN_COUNTER64
,
clock_offset
),
FIELD
(
wrs_p_globals
,
ASN_INTEGER
,
clock_offsetHR
),
FIELD
(
wrs_p_globals
,
ASN_INTEGER
,
skew
),
FIELD
(
wrs_p_globals
,
ASN_COUNTER64
,
rtt
),
FIELD
(
wrs_p_globals
,
ASN_UNSIGNED
,
llength
),
...
...
@@ -95,6 +98,16 @@ static struct ppsi_pickinfo p_pickinfo[] = {
FIELD
(
wrs_p_perport
,
ASN_OCTET_STR
,
peer_id
),
};
static
int32_t
int_saturate
(
int64_t
value
)
{
if
(
value
>=
INT32_MAX
)
return
INT32_MAX
;
else
if
(
value
<=
INT32_MIN
)
return
INT32_MIN
;
return
value
;
}
static
void
wrs_ppsi_get_globals
(
void
)
{
unsigned
ii
;
...
...
@@ -109,9 +122,18 @@ static void wrs_ppsi_get_globals(void)
sizeof
(
ppsi_servo
->
servo_state_name
));
wrs_p_globals
.
servo_state
=
ppsi_servo
->
state
;
wrs_p_globals
.
tracking_enabled
=
ppsi_servo
->
tracking_enabled
;
wrs_p_globals
.
clock_offset
=
ppsi_servo
->
offset
;
/*
* WARNING: the current snmpd is bugged: it has
* endianness problems with 64 bit, and the two
* halves are swapped. So pre-swap them here
*/
wrs_p_globals
.
rtt
=
(
ppsi_servo
->
picos_mu
<<
32
)
|
(
ppsi_servo
->
picos_mu
>>
32
);
wrs_p_globals
.
clock_offset
=
(
ppsi_servo
->
offset
<<
32
)
|
(
ppsi_servo
->
offset
>>
32
);
wrs_p_globals
.
clock_offsetHR
=
int_saturate
(
ppsi_servo
->
offset
);
wrs_p_globals
.
skew
=
ppsi_servo
->
skew
;
wrs_p_globals
.
rtt
=
ppsi_servo
->
picos_mu
;
wrs_p_globals
.
llength
=
(
uint32_t
)(
ppsi_servo
->
delta_ms
/
1e12
*
300e6
/
1
.
55
);
wrs_p_globals
.
servo_updates
=
ppsi_servo
->
update_count
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment