Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
PPSi
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
47
Issues
47
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
PPSi
Commits
dfaa73ac
Commit
dfaa73ac
authored
Mar 03, 2016
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
state-listening: send pdelay request if P2P_MECH
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
71e9342c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
1 deletion
+59
-1
state-listening.c
proto-standard/state-listening.c
+59
-1
No files found.
proto-standard/state-listening.c
View file @
dfaa73ac
...
...
@@ -12,14 +12,31 @@
int
pp_listening
(
struct
pp_instance
*
ppi
,
unsigned
char
*
pkt
,
int
plen
)
{
int
e
=
0
;
/* error var, to check errors in msg handling */
MsgHeader
*
hdr
=
&
ppi
->
received_ptp_header
;
MsgPDelayRespFollowUp
respFllw
;
if
(
pp_hooks
.
listening
)
e
=
pp_hooks
.
listening
(
ppi
,
pkt
,
plen
);
if
(
e
)
goto
out
;
if
(
ppi
->
is_new_state
)
if
(
ppi
->
is_new_state
)
{
pp_timeout_restart_annrec
(
ppi
);
pp_timeout_rand
(
ppi
,
PP_TO_REQUEST
,
DSPOR
(
ppi
)
->
logMinDelayReqInterval
);
}
/* when the clock is using peer-delay, listening must send it too */
if
(
ppi
->
glbs
->
delay_mech
==
PP_P2P_MECH
&&
pp_timeout_z
(
ppi
,
PP_TO_REQUEST
))
{
e
=
msg_issue_request
(
ppi
);
ppi
->
t3
=
ppi
->
last_snt_time
;
/* Restart the timeout for next time */
pp_timeout_rand
(
ppi
,
PP_TO_REQUEST
,
DSPOR
(
ppi
)
->
logMinDelayReqInterval
);
}
if
(
plen
==
0
)
goto
out
;
...
...
@@ -34,6 +51,47 @@ int pp_listening(struct pp_instance *ppi, unsigned char *pkt, int plen)
e
=
st_com_master_handle_sync
(
ppi
,
pkt
,
plen
);
break
;
case
PPM_PDELAY_REQ
:
st_com_peer_handle_preq
(
ppi
,
pkt
,
plen
);
break
;
case
PPM_PDELAY_RESP
:
e
=
st_com_peer_handle_pres
(
ppi
,
pkt
,
plen
);
break
;
case
PPM_PDELAY_RESP_FOLLOW_UP
:
if
(
plen
<
PP_PDELAY_RESP_FOLLOW_UP_LENGTH
)
break
;
msg_unpack_pdelay_resp_follow_up
(
pkt
,
&
respFllw
);
if
((
memcmp
(
&
DSPOR
(
ppi
)
->
portIdentity
.
clockIdentity
,
&
respFllw
.
requestingPortIdentity
.
clockIdentity
,
PP_CLOCK_IDENTITY_LENGTH
)
==
0
)
&&
((
ppi
->
sent_seq
[
PPM_PDELAY_REQ
])
==
hdr
->
sequenceId
)
&&
(
DSPOR
(
ppi
)
->
portIdentity
.
portNumber
==
respFllw
.
requestingPortIdentity
.
portNumber
)
&&
(
ppi
->
flags
&
PPI_FLAG_FROM_CURRENT_PARENT
))
{
to_TimeInternal
(
&
ppi
->
t5
,
&
respFllw
.
responseOriginTimestamp
);
ppi
->
flags
|=
PPI_FLAG_WAITING_FOR_RF_UP
;
if
(
pp_hooks
.
handle_presp
)
e
=
pp_hooks
.
handle_presp
(
ppi
);
else
pp_servo_got_presp
(
ppi
);
if
(
e
)
goto
out
;
}
else
{
pp_diag
(
ppi
,
frames
,
2
,
"%s: "
"PDelay Resp F-up doesn't match PDelay Req
\n
"
,
__func__
);
}
break
;
default:
/* disregard, nothing to do */
break
;
...
...
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