Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
32
Issues
32
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
Software for White Rabbit PTP Core
Commits
b8041f39
Commit
b8041f39
authored
Feb 22, 2017
by
Alessandro Rubini
Committed by
Adam Wujek
Feb 28, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
latency: add a way to force a fake late frame
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
7302c8f1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
1 deletion
+19
-1
latency.c
lib/latency.c
+19
-1
No files found.
lib/latency.c
View file @
b8041f39
...
...
@@ -26,6 +26,8 @@ static int lat_verbose = 1;
static
unsigned
long
prios
[]
=
{
7
,
6
,
0
};
/* the prio for the 3 frames */
static
int
ltest_fake_delay_ns
;
/* latency probe: we need to enqueue 3 short frames: 64*3+overhead = 256 */
static
uint8_t
__latency_queue
[
256
];
static
struct
wrpc_socket
*
latency_socket
,
__static_latency_socket
=
{
...
...
@@ -213,7 +215,10 @@ static int latency_poll_tx(void)
static
uint32_t
sequence
;
static
uint32_t
lasts
;
/* Send three frames -- lazily in native byte order */
/*
* Send three frames -- lazily in native byte order. Possibly
* subtract a fake delay, to trigger reporting.
*/
memset
(
&
frame
,
0
,
sizeof
(
frame
));
frame
.
sequence
=
sequence
++
;
...
...
@@ -221,16 +226,27 @@ static int latency_poll_tx(void)
latency_socket
->
prio
=
prios
[
0
];
ptpd_netif_sendto
(
latency_socket
,
&
latency_addr
,
&
frame
,
sizeof
(
frame
),
frame
.
ts
+
0
);
frame
.
ts
[
0
].
nsec
-=
ltest_fake_delay_ns
;
if
(
frame
.
ts
[
0
].
nsec
<
0
)
{
frame
.
ts
[
0
].
nsec
+=
1000
*
1000
*
1000
;
frame
.
ts
[
0
].
sec
--
;
}
frame
.
type
=
2
;
latency_socket
->
prio
=
prios
[
1
];
ptpd_netif_sendto
(
latency_socket
,
&
latency_addr
,
&
frame
,
sizeof
(
frame
),
frame
.
ts
+
1
);
frame
.
ts
[
1
].
nsec
-=
ltest_fake_delay_ns
;
if
(
frame
.
ts
[
1
].
nsec
<
0
)
{
frame
.
ts
[
1
].
nsec
+=
1000
*
1000
*
1000
;
frame
.
ts
[
1
].
sec
--
;
}
frame
.
type
=
3
;
latency_socket
->
prio
=
prios
[
2
];
ptpd_netif_sendto
(
latency_socket
,
&
latency_addr
,
&
frame
,
sizeof
(
frame
),
NULL
);
ltest_fake_delay_ns
=
0
;
/* Every 10s remind we are sending ltest */
if
(
!
lasts
)
{
...
...
@@ -277,6 +293,8 @@ static int cmd_ltest(const char *args[])
lat_verbose
=
1
;
else
if
(
HAS_SYSLOG
&&
!
strcmp
(
args
[
0
],
"quiet"
))
lat_verbose
=
0
;
else
if
(
!
strcmp
(
args
[
0
],
"fake"
))
fromdec
(
args
[
1
],
&
ltest_fake_delay_ns
);
else
{
fromdec
(
args
[
0
],
&
v
);
latency_period_ms
=
v
*
1000
+
v1
;
...
...
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