Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
ptp-noposix
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
white-rabbit
ppsi
ptp-noposix
Commits
ca690526
Commit
ca690526
authored
May 03, 2012
by
Tomasz Wlostowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PTPWRd: clear foreign mastes when slave port goes down (bugfix)
parent
0d0d7459
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
4 deletions
+36
-4
bmc.c
PTPWRd/bmc.c
+13
-0
protocol.c
PTPWRd/protocol.c
+23
-4
No files found.
PTPWRd/bmc.c
View file @
ca690526
...
...
@@ -219,6 +219,19 @@ void s1(MsgHeader *header,MsgAnnounce *announce,PtpPortDS *ptpPortDS)
PTPD_TRACE
(
TRACE_BMC
,
ptpPortDS
,
" S1: parentWrConfig....... 0x%x
\n
"
,
ptpPortDS
->
parentWrConfig
);
ptpPortDS
->
ptpClockDS
->
primarySlavePortNumber
=
ptpPortDS
->
portIdentity
.
portNumber
;
PTPD_TRACE
(
TRACE_BMC
,
ptpPortDS
,
" S1 : announceID = %02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx
\n
"
,
header
->
sourcePortIdentity
.
clockIdentity
[
0
],
header
->
sourcePortIdentity
.
clockIdentity
[
1
],
header
->
sourcePortIdentity
.
clockIdentity
[
2
],
header
->
sourcePortIdentity
.
clockIdentity
[
3
],
header
->
sourcePortIdentity
.
clockIdentity
[
4
],
header
->
sourcePortIdentity
.
clockIdentity
[
5
],
header
->
sourcePortIdentity
.
clockIdentity
[
6
],
header
->
sourcePortIdentity
.
clockIdentity
[
7
]);
PTPD_TRACE
(
TRACE_BMC
,
ptpPortDS
,
" S1 : parent = %02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx
\n
"
,
ptpPortDS
->
ptpClockDS
->
parentPortIdentity
.
clockIdentity
[
0
],
ptpPortDS
->
ptpClockDS
->
parentPortIdentity
.
clockIdentity
[
1
],
ptpPortDS
->
ptpClockDS
->
parentPortIdentity
.
clockIdentity
[
2
],
ptpPortDS
->
ptpClockDS
->
parentPortIdentity
.
clockIdentity
[
3
],
ptpPortDS
->
ptpClockDS
->
parentPortIdentity
.
clockIdentity
[
4
],
ptpPortDS
->
ptpClockDS
->
parentPortIdentity
.
clockIdentity
[
5
],
ptpPortDS
->
ptpClockDS
->
parentPortIdentity
.
clockIdentity
[
6
],
ptpPortDS
->
ptpClockDS
->
parentPortIdentity
.
clockIdentity
[
7
]);
PTPD_TRACE
(
TRACE_BMC
,
ptpPortDS
,
" S1: g-masterIdentity[announce]. %02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx
\n
"
,
...
...
PTPWRd/protocol.c
View file @
ca690526
...
...
@@ -52,37 +52,44 @@ void singlePortLoop(RunTimeOpts *rtOpts, PtpPortDS *ptpPortDS, int portIndex)
link_up
=
isPortUp
(
&
ptpPortDS
->
netPath
);
// PTPD_TRACE(TRACE_STARTUP, ptpPortDS, "8888: lnkstat %d %d\n", link_up, ptpPortDS->linkUP);
if
(
link_up
&&
!
ptpPortDS
->
linkUP
)
went_up
=
TRUE
;
else
if
(
!
link_up
&&
ptpPortDS
->
linkUP
)
went_down
=
TRUE
;
ptpPortDS
->
linkUP
=
link_up
;
if
(
went_up
||
ptpPortDS
->
doRestart
)
{
toState
(
PTP_INITIALIZING
,
rtOpts
,
ptpPortDS
);
if
(
!
doInit
(
rtOpts
,
ptpPortDS
))
PTPD_TRACE
(
TRACE_ERROR
,
ptpPortDS
,
"Port %d failed to doInit()
\n
"
,(
portIndex
+
1
));
if
(
ptpPortDS
->
wr
Mode
==
WR_S_ONLY
)
if
(
ptpPortDS
->
wr
Config
==
WR_S_ONLY
)
clearForeignMasters
(
ptpPortDS
);
ptpPortDS
->
doRestart
=
FALSE
;
PTPD_TRACE
(
TRACE_STARTUP
,
ptpPortDS
,
"Port '%s' went up.
\n
"
,
ptpPortDS
->
netPath
.
ifaceName
);
}
else
if
(
went_down
)
{
if
(
ptpPortDS
->
wrConfig
==
WR_S_ONLY
)
clearForeignMasters
(
ptpPortDS
);
PTPD_TRACE
(
TRACE_STARTUP
,
ptpPortDS
,
"Port '%s' went down.
\n
"
,
ptpPortDS
->
netPath
.
ifaceName
);
}
if
(
link_up
)
{
if
(
ptpPortDS
->
portState
!=
PTP_INITIALIZING
)
doState
(
rtOpts
,
ptpPortDS
);
else
if
(
!
doInit
(
rtOpts
,
ptpPortDS
))
return
;
PTPD_TRACE
(
TRACE_ERROR
,
ptpPortDS
,
"Port %d failed to doInit()
\n
"
,(
portIndex
+
1
));
// return;
}
ptpPortDS
->
linkUP
=
link_up
;
}
...
...
@@ -826,6 +833,18 @@ void handle(RunTimeOpts *rtOpts, PtpPortDS *ptpPortDS)
Boolean
msgIsFromCurrentParent
(
MsgHeader
*
header
,
PtpPortDS
*
ptpPortDS
)
{
/* PTPD_TRACE(TRACE_BMC, ptpPortDS," msgIsFromCurrentParent: parent = %02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx\n",
ptpPortDS->ptpClockDS->parentPortIdentity.clockIdentity[0], ptpPortDS->ptpClockDS->parentPortIdentity.clockIdentity[1],
ptpPortDS->ptpClockDS->parentPortIdentity.clockIdentity[2], ptpPortDS->ptpClockDS->parentPortIdentity.clockIdentity[3],
ptpPortDS->ptpClockDS->parentPortIdentity.clockIdentity[4], ptpPortDS->ptpClockDS->parentPortIdentity.clockIdentity[5],
ptpPortDS->ptpClockDS->parentPortIdentity.clockIdentity[6], ptpPortDS->ptpClockDS->parentPortIdentity.clockIdentity[7]);
PTPD_TRACE(TRACE_BMC, ptpPortDS," msgIsFromCurrentParent: header = %02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx\n",
header->sourcePortIdentity.clockIdentity[0], header->sourcePortIdentity.clockIdentity[1],
header->sourcePortIdentity.clockIdentity[2], header->sourcePortIdentity.clockIdentity[3],
header->sourcePortIdentity.clockIdentity[4], header->sourcePortIdentity.clockIdentity[5],
header->sourcePortIdentity.clockIdentity[6], header->sourcePortIdentity.clockIdentity[7]);
*/
if
(
!
memcmp
(
ptpPortDS
->
ptpClockDS
->
parentPortIdentity
.
clockIdentity
,
header
->
sourcePortIdentity
.
clockIdentity
,
CLOCK_IDENTITY_LENGTH
)
&&
(
ptpPortDS
->
ptpClockDS
->
parentPortIdentity
.
portNumber
==
header
->
sourcePortIdentity
.
portNumber
))
return
TRUE
;
...
...
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