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
50
Issues
50
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
71e9342c
Commit
71e9342c
authored
Mar 03, 2016
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
state-master: send pdelay request if P2P_MECH
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
33d63f5a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
state-master.c
proto-standard/state-master.c
+53
-0
No files found.
proto-standard/state-master.c
View file @
71e9342c
...
...
@@ -64,9 +64,13 @@ int pp_master(struct pp_instance *ppi, unsigned char *pkt, int plen)
{
int
msgtype
,
d1
,
d2
;
int
e
=
0
;
/* error var, to check errors in msg handling */
MsgHeader
*
hdr
=
&
ppi
->
received_ptp_header
;
MsgPDelayRespFollowUp
respFllw
;
if
(
ppi
->
is_new_state
)
{
pp_timeout_rand
(
ppi
,
PP_TO_SYNC
,
DSPOR
(
ppi
)
->
logSyncInterval
);
pp_timeout_rand
(
ppi
,
PP_TO_REQUEST
,
DSPOR
(
ppi
)
->
logMinDelayReqInterval
);
pp_timeout_rand
(
ppi
,
PP_TO_ANN_INTERVAL
,
DSPOR
(
ppi
)
->
logAnnounceInterval
);
...
...
@@ -93,6 +97,18 @@ int pp_master(struct pp_instance *ppi, unsigned char *pkt, int plen)
DSPOR
(
ppi
)
->
logAnnounceInterval
);
}
/* when the clock is using peer-delay, the muster mast 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
;
...
...
@@ -130,6 +146,43 @@ int pp_master(struct pp_instance *ppi, unsigned char *pkt, int plen)
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