Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
PTP noposix stack
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
PTP noposix stack
Commits
bbe09a1b
Commit
bbe09a1b
authored
Jul 06, 2011
by
Maciej Lipinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
making Slave-only mode work after re-connecting link
parent
50067e31
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
13 deletions
+41
-13
TODO
PTPWRd/TODO
+14
-3
bmc.c
PTPWRd/bmc.c
+1
-0
datatypes.h
PTPWRd/datatypes.h
+2
-0
startup.c
PTPWRd/dep/startup.c
+2
-2
protocol.c
PTPWRd/protocol.c
+22
-8
No files found.
PTPWRd/TODO
View file @
bbe09a1b
...
...
@@ -12,11 +12,22 @@ TODO-ptpx:
6) switch-over and the possibility of locking on multiple ports is not implemented in HW yet, thus
I've introduced a very nasty hack, which is turned on with MACIEK_HACKs, as soon as HW
implementation is ready, I need to get rid of that. [this is mainly in ptpd_netif]
7) aging of ForeignMaster records needs to be implemented (feature of a standard PTP, not provided
by the original daemoan)
8) the transition from PTP_SLAVE to PTP_UNCALIBRATED:
(Recommended State == BMC_SLAVE && new_master != old_master)
is not implemented (feature of a standard PTP, not provided by the original daemoan), this will
be of any use, if (8) is implemented, to make slave-only work
9)
Known bugs:
1) When a port x is a primary slave, but then port y becomes primary slave, the port x, which
should become secondary slave, does not enter UNCALIBRATED state and does not
start WR Link Setup. (grep for 'TODO: bug 1')
2) the transition from PTP_SLAVE to PTP_UNCALIBRATED:
(Recommended State == BMC_SLAVE && new_master != old_master)
is not implemented (feature of the original ptpd).
\ No newline at end of file
HACKS:
1) in ptpd_netif_locking_enable () to make up for the lack of HW implementation of switch-over
it's ifdef with MACIEK_HACKs
2) not-exactly-standard implementation of Slave-only mode, we go to PTP_LISTENING ptp state
as soon as the linkDown is detected, this is to make up for the lacking
implementation of (7) & (8) from TODO-ptpx list
PTPWRd/bmc.c
View file @
bbe09a1b
...
...
@@ -89,6 +89,7 @@ void initDataPort(RunTimeOpts *rtOpts, PtpPortDS *ptpPortDS)
ptpPortDS
->
max_foreign_records
=
rtOpts
->
max_foreign_records
;
ptpPortDS
->
linkUP
=
FALSE
;
}
/* initialize ptpClockDS*/
...
...
PTPWRd/datatypes.h
View file @
bbe09a1b
...
...
@@ -450,6 +450,8 @@ typedef struct {
*/
Enumeration16
msgTmpManagementId
;
/*************************************White Rabbit ************************************************/
//////////////// White Rabbit staff specified in WR SPEC
...
...
PTPWRd/dep/startup.c
View file @
bbe09a1b
...
...
@@ -299,7 +299,7 @@ PtpPortDS * ptpdStartup(int argc, char **argv, Integer16 *ret, RunTimeOpts *rtOp
case
'S'
:
PTPD_TRACE
(
TRACE_STARTUP
,
NULL
,
"WR wrConfig=WR_S_ONLY
\n
"
);
rtOpts
->
autoPortDiscovery
=
FALSE
;
//
rtOpts->slaveOnly = TRUE;
rtOpts
->
slaveOnly
=
TRUE
;
rtOpts
->
portNumber
=
1
;
rtOpts
->
wrConfig
=
WR_S_ONLY
;
//only for ordinary clock
break
;
...
...
@@ -308,7 +308,7 @@ PtpPortDS * ptpdStartup(int argc, char **argv, Integer16 *ret, RunTimeOpts *rtOp
memset
(
rtOpts
->
ifaceName
[
0
],
0
,
IFACE_NAME_LENGTH
);
strncpy
(
rtOpts
->
ifaceName
[
0
],
optarg
,
IFACE_NAME_LENGTH
);
rtOpts
->
autoPortDiscovery
=
FALSE
;
//
rtOpts->slaveOnly = TRUE;
rtOpts
->
slaveOnly
=
TRUE
;
rtOpts
->
portNumber
=
1
;
rtOpts
->
wrConfig
=
WR_S_ONLY
;
//only for ordinary clock
...
...
PTPWRd/protocol.c
View file @
bbe09a1b
...
...
@@ -467,6 +467,16 @@ void doState(RunTimeOpts *rtOpts, PtpPortDS *ptpPortDS)
ptpPortDS
->
record_update
=
TRUE
;
// foreign masters removed -> update needed
ptpPortDS
->
wrMode
=
NON_WR
;
/*
* HACK: This is not standard compliant... but will work
*/
if
(
ptpPortDS
->
ptpClockDS
->
slaveOnly
)
{
PTPD_TRACE
(
TRACE_PROTO
,
ptpPortDS
,
"Slave-only: forcing PTP_LISTENING (a small non-standard hack)
\n
"
);
toState
(
PTP_LISTENING
,
rtOpts
,
ptpPortDS
);
ptpPortDS
->
record_update
=
FALSE
;
}
}
if
(
ptpPortDS
->
linkUP
!=
linkUP
&&
linkUP
==
TRUE
)
...
...
@@ -504,11 +514,12 @@ void doState(RunTimeOpts *rtOpts, PtpPortDS *ptpPortDS)
if
(
state
!=
ptpPortDS
->
portState
)
{
if
(
state
==
PTP_SLAVE
&&
(
ptpPortDS
->
portState
==
PTP_LISTENING
||
ptpPortDS
->
portState
==
PTP_PRE_MASTER
||
ptpPortDS
->
portState
==
PTP_MASTER
||
ptpPortDS
->
portState
==
PTP_PASSIVE
||
ptpPortDS
->
portState
==
PTP_UNCALIBRATED
))
ptpPortDS
->
portState
==
PTP_LISTENING
||
ptpPortDS
->
portState
==
PTP_PRE_MASTER
||
ptpPortDS
->
portState
==
PTP_MASTER
||
ptpPortDS
->
portState
==
PTP_PASSIVE
||
ptpPortDS
->
portState
==
PTP_UNCALIBRATED
)
)
{
/* implementation of PTP_UNCALIBRATED state
...
...
@@ -875,6 +886,7 @@ void handleAnnounce(MsgHeader *header, Octet *msgIbuf, ssize_t length, Boolean i
if
(
msgIsFromCurrentParent
(
header
,
ptpPortDS
))
{
PTPD_TRACE
(
TRACE_PROTO
,
ptpPortDS
,
"handle ..... WR_ANNOUNCE: msg is from current parent
\n
"
);
msgUnpackAnnounce
(
ptpPortDS
->
msgIbuf
,
&
ptpPortDS
->
msgTmp
.
announce
,
header
);
if
(
ptpPortDS
->
msgTmp
.
announce
.
wr_flags
!=
NON_WR
)
...
...
@@ -1886,13 +1898,14 @@ void addForeign(Octet *buf,MsgHeader *header,PtpPortDS *ptpPortDS)
Boolean
found
=
FALSE
;
j
=
ptpPortDS
->
foreign_record_best
;
PTPD_TRACE
(
TRACE_PROTO
,
ptpPortDS
,
"addForeign=>number_foreign_records = %d
\n
"
,
ptpPortDS
->
number_foreign_records
);
/*Check if Foreign master is already known*/
for
(
i
=
0
;
i
<
ptpPortDS
->
number_foreign_records
;
i
++
)
{
if
(
!
memcmp
(
header
->
sourcePortIdentity
.
clockIdentity
,
ptpPortDS
->
foreign
[
j
].
foreignMasterPortIdentity
.
clockIdentity
,
CLOCK_IDENTITY_LENGTH
)
&&
(
header
->
sourcePortIdentity
.
portNumber
==
ptpPortDS
->
foreign
[
j
].
foreignMasterPortIdentity
.
portNumber
))
{
PTPD_TRACE
(
TRACE_PROTO
,
ptpPortDS
,
"addForeign=>foreign master already in data set
\n
"
);
/*Foreign Master is already in Foreignmaster data set*/
ptpPortDS
->
foreign
[
j
].
foreignMasterAnnounceMessages
++
;
found
=
TRUE
;
...
...
@@ -1900,7 +1913,7 @@ void addForeign(Octet *buf,MsgHeader *header,PtpPortDS *ptpPortDS)
msgUnpackHeader
(
buf
,
&
ptpPortDS
->
foreign
[
j
].
header
);
msgUnpackAnnounce
(
buf
,
&
ptpPortDS
->
foreign
[
j
].
announce
,
&
ptpPortDS
->
foreign
[
j
].
header
);
if
(
ptpPortDS
->
foreign
[
j
].
announce
.
wr_flags
!=
NON_WR
)
PTPD_TRACE
(
TRACE_PROTO
,
ptpPortDS
,
"addForeign
:
message from another White Rabbit node [wr_flag != NON_WR]
\n
"
);
PTPD_TRACE
(
TRACE_PROTO
,
ptpPortDS
,
"addForeign
=>
message from another White Rabbit node [wr_flag != NON_WR]
\n
"
);
break
;
}
...
...
@@ -1916,6 +1929,7 @@ void addForeign(Octet *buf,MsgHeader *header,PtpPortDS *ptpPortDS)
}
j
=
ptpPortDS
->
foreign_record_i
;
PTPD_TRACE
(
TRACE_PROTO
,
ptpPortDS
,
"addForeign=>brand new foreign master
\n
"
);
/*Copy new foreign master data set from Announce message*/
memcpy
(
ptpPortDS
->
foreign
[
j
].
foreignMasterPortIdentity
.
clockIdentity
,
header
->
sourcePortIdentity
.
clockIdentity
,
CLOCK_IDENTITY_LENGTH
);
ptpPortDS
->
foreign
[
j
].
foreignMasterPortIdentity
.
portNumber
=
header
->
sourcePortIdentity
.
portNumber
;
...
...
@@ -2005,7 +2019,7 @@ Boolean globalSecondSlavesUpdate(PtpPortDS *ptpPortDS)
void
clearForeignMasters
(
PtpPortDS
*
ptpPortDS
)
{
Integer16
i
;
PTPD_TRACE
(
TRACE_PROTO
,
ptpPortDS
,
"addForeign=>clearing the number_foreign_records
\n
"
);
for
(
i
=
0
;
i
<
ptpPortDS
->
number_foreign_records
;
i
++
)
ptpPortDS
->
foreign
[
i
].
receptionPortNumber
=
0
;
// we recognize that ForeignMaster record is empty
// by the value of receptionPortNumber - port numbers
...
...
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