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
39
Issues
39
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
8699f7d5
Commit
8699f7d5
authored
Sep 20, 2016
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
general: move delay mechanism from global to per-port
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
c07764dd
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
19 additions
and
31 deletions
+19
-31
sim-startup.c
arch-sim/sim-startup.c
+1
-1
unix-startup.c
arch-unix/unix-startup.c
+1
-5
wrc_ptp_ppsi.c
arch-wrpc/wrc_ptp_ppsi.c
+3
-5
wrs-startup.c
arch-wrs/wrs-startup.c
+1
-5
pp-instance.h
include/ppsi/pp-instance.h
+2
-4
bare-startup.c
lib-bare/bare-startup.c
+1
-1
hooks.c
proto-ext-whiterabbit/hooks.c
+1
-1
wr-servo.c
proto-ext-whiterabbit/wr-servo.c
+2
-2
common-fun.c
proto-standard/common-fun.c
+2
-2
msg.c
proto-standard/msg.c
+1
-1
state-listening.c
proto-standard/state-listening.c
+1
-1
state-master.c
proto-standard/state-master.c
+1
-1
state-passive.c
proto-standard/state-passive.c
+1
-1
wrpc-socket.c
time-wrpc/wrpc-socket.c
+1
-1
No files found.
arch-sim/sim-startup.c
View file @
8699f7d5
...
...
@@ -98,7 +98,6 @@ int main(int argc, char **argv)
ppg
->
max_links
=
2
;
// master and slave, nothing else
ppg
->
arch_data
=
calloc
(
1
,
sizeof
(
struct
sim_ppg_arch_data
));
ppg
->
pp_instances
=
calloc
(
ppg
->
max_links
,
sizeof
(
struct
pp_instance
));
ppg
->
delay_mech
=
CONFIG_HAS_P2P
?
PP_P2P_MECH
:
PP_E2E_MECH
;
if
((
!
ppg
->
arch_data
)
||
(
!
ppg
->
pp_instances
))
return
-
1
;
...
...
@@ -144,6 +143,7 @@ int main(int argc, char **argv)
sim_set_global_DS
(
ppi
);
ppi
->
iface_name
=
ppi
->
cfg
.
iface_name
;
ppi
->
port_name
=
ppi
->
cfg
.
port_name
;
ppi
->
mech
=
CONFIG_HAS_P2P
?
PP_P2P_MECH
:
PP_E2E_MECH
;
if
(
ppi
->
proto
==
PPSI_PROTO_RAW
)
pp_printf
(
"Warning: simulator doesn't support raw "
"ethernet. Using UDP
\n
"
);
...
...
arch-unix/unix-startup.c
View file @
8699f7d5
...
...
@@ -51,11 +51,6 @@ int main(int argc, char **argv)
ppg
->
servo
=
&
servo
;
ppg
->
rt_opts
=
&
__pp_default_rt_opts
;
if
(
CONFIG_HAS_P2P
)
/* FIXME: should be a run-time configuration */
ppg
->
delay_mech
=
PP_P2P_MECH
;
else
ppg
->
delay_mech
=
PP_E2E_MECH
;
/* We are hosted, so we can allocate */
ppg
->
max_links
=
PP_MAX_LINKS
;
ppg
->
arch_data
=
calloc
(
1
,
sizeof
(
struct
unix_arch_data
));
...
...
@@ -71,6 +66,7 @@ int main(int argc, char **argv)
ppi
=
INST
(
ppg
,
i
);
ppi
->
proto
=
PP_DEFAULT_PROTO
;
ppi
->
role
=
PP_DEFAULT_ROLE
;
ppi
->
mech
=
CONFIG_HAS_P2P
?
PP_P2P_MECH
:
PP_E2E_MECH
;
}
/* Set offset here, so config parsing can override it */
...
...
arch-wrpc/wrc_ptp_ppsi.c
View file @
8699f7d5
...
...
@@ -79,6 +79,7 @@ struct pp_instance ppi_static = {
.
t_ops
=
&
wrpc_time_ops
,
.
vlans_array_len
=
CONFIG_VLAN_ARRAY_SIZE
,
.
proto
=
PP_DEFAULT_PROTO
,
.
mech
=
CONFIG_HAS_P2P
?
PP_P2P_MECH
:
PP_E2E_MECH
,
.
iface_name
=
"wr1"
,
.
port_name
=
"wr1"
,
.
__tx_buffer
=
__tx_buffer
,
...
...
@@ -94,7 +95,6 @@ static struct pp_globals ppg_static = {
.
parentDS
=
&
parentDS
,
.
timePropertiesDS
=
&
timePropertiesDS
,
.
global_ext_data
=
&
servo_state
,
.
delay_mech
=
CONFIG_HAS_P2P
?
PP_P2P_MECH
:
PP_E2E_MECH
,
};
int
wrc_ptp_init
()
...
...
@@ -192,17 +192,15 @@ int wrc_ptp_get_mode()
void
wrc_ptp_set_sync_mech
(
int
mech
)
{
struct
pp_instance
*
ppi
=
&
ppi_static
;
struct
pp_globals
*
ppg
=
ppi
->
glbs
;
wrc_ptp_stop
();
pp
g
->
delay_
mech
=
mech
;
pp
i
->
mech
=
mech
;
}
int
wrc_ptp_get_sync_mech
()
{
struct
pp_instance
*
ppi
=
&
ppi_static
;
struct
pp_globals
*
ppg
=
ppi
->
glbs
;
return
ppg
->
delay_mech
;
return
ppi
->
mech
;
}
int
wrc_ptp_start
()
...
...
arch-wrs/wrs-startup.c
View file @
8699f7d5
...
...
@@ -154,11 +154,6 @@ int main(int argc, char **argv)
ppg
->
servo
=
alloc_fn
(
ppsi_head
,
sizeof
(
*
ppg
->
servo
));
ppg
->
rt_opts
=
&
__pp_default_rt_opts
;
if
(
CONFIG_HAS_P2P
)
/* FIXME: should be a run-time configuration */
ppg
->
delay_mech
=
PP_P2P_MECH
;
else
ppg
->
delay_mech
=
PP_E2E_MECH
;
ppg
->
max_links
=
PP_MAX_LINKS
;
ppg
->
global_ext_data
=
alloc_fn
(
ppsi_head
,
sizeof
(
struct
wr_servo_state
));
...
...
@@ -212,6 +207,7 @@ int main(int argc, char **argv)
ppi
->
vlans_array_len
=
CONFIG_VLAN_ARRAY_SIZE
;
ppi
->
iface_name
=
ppi
->
cfg
.
iface_name
;
ppi
->
port_name
=
ppi
->
cfg
.
port_name
;
ppi
->
mech
=
CONFIG_HAS_P2P
?
PP_P2P_MECH
:
PP_E2E_MECH
;
ppi
->
portDS
=
calloc
(
1
,
sizeof
(
*
ppi
->
portDS
));
if
(
ppi
->
portDS
)
ppi
->
portDS
->
ext_dsport
=
...
...
include/ppsi/pp-instance.h
View file @
8699f7d5
...
...
@@ -127,7 +127,8 @@ struct pp_instance {
unsigned
long
d_flags
;
/* diagnostics, ppi-specific flags */
unsigned
char
flags
;
/* protocol flags (see below) */
int
role
,
/* same as in config file */
proto
;
/* same as in config file */
proto
,
/* same as in config file */
mech
;
/* same as in config file */
/* Pointer to global instance owning this pp_instance*/
struct
pp_globals
*
glbs
;
...
...
@@ -211,9 +212,6 @@ struct pp_globals {
DSParent
*
parentDS
;
/* page 68 */
DSTimeProperties
*
timePropertiesDS
;
/* page 70 */
/* Sync Mechanism */
int
delay_mech
;
/* PP_E2E_MECH, PP_P2P_MECH */
/* Index of the pp_instance receiving the "Ebest" clock */
int
ebest_idx
;
int
ebest_updated
;
/* set to 1 when ebest_idx changes */
...
...
lib-bare/bare-startup.c
View file @
8699f7d5
...
...
@@ -43,6 +43,7 @@ static struct pp_instance ppi_static = {
.
port_name
=
"eth0"
,
.
vlans_array_len
=
CONFIG_VLAN_ARRAY_SIZE
,
.
proto
=
PP_DEFAULT_PROTO
,
.
mech
=
CONFIG_HAS_P2P
?
PP_P2P_MECH
:
PP_E2E_MECH
,
.
__tx_buffer
=
__tx_buffer
,
.
__rx_buffer
=
__rx_buffer
,
};
...
...
@@ -50,7 +51,6 @@ static struct pp_instance ppi_static = {
/* We now have a structure with all globals, and multiple ppi inside */
static
struct
pp_globals
ppg_static
=
{
.
pp_instances
=
&
ppi_static
,
.
delay_mech
=
CONFIG_HAS_P2P
?
PP_P2P_MECH
:
PP_E2E_MECH
,
.
nlinks
=
1
,
.
servo
=
&
servo
,
.
defaultDS
=
&
defaultDS
,
...
...
proto-ext-whiterabbit/hooks.c
View file @
8699f7d5
...
...
@@ -215,7 +215,7 @@ static int wr_handle_followup(struct pp_instance *ppi,
wr_servo_got_sync
(
ppi
,
precise_orig_timestamp
,
&
ppi
->
t2
);
if
(
CONFIG_HAS_P2P
&&
ppi
->
glbs
->
delay_
mech
==
PP_P2P_MECH
)
if
(
CONFIG_HAS_P2P
&&
ppi
->
mech
==
PP_P2P_MECH
)
wr_servo_update
(
ppi
);
return
1
;
/* the caller returns too */
...
...
proto-ext-whiterabbit/wr-servo.c
View file @
8699f7d5
...
...
@@ -247,7 +247,7 @@ int wr_servo_got_delay(struct pp_instance *ppi, Integer32 cf)
s
->
t4
.
correct
=
1
;
/* clock->delay_req_receive_time.correct; */
s
->
t4
.
phase
=
(
int64_t
)
cf
*
1000LL
/
65536LL
;
if
(
CONFIG_HAS_P2P
&&
ppi
->
glbs
->
delay_
mech
==
PP_P2P_MECH
)
{
if
(
CONFIG_HAS_P2P
&&
ppi
->
mech
==
PP_P2P_MECH
)
{
s
->
t5
=
ppi
->
t5
;
s
->
t5
.
correct
=
1
;
s
->
t5
.
phase
=
0
;
...
...
@@ -416,7 +416,7 @@ int wr_servo_update(struct pp_instance *ppi)
wrs_shm_write
(
ppsi_head
,
WRS_SHM_WRITE_BEGIN
);
picos_mu_prev
=
s
->
picos_mu
;
if
(
CONFIG_HAS_P2P
&&
ppi
->
glbs
->
delay_
mech
==
PP_P2P_MECH
)
{
if
(
CONFIG_HAS_P2P
&&
ppi
->
mech
==
PP_P2P_MECH
)
{
if
(
!
wr_p2p_offset
(
ppi
,
s
,
&
ts_offset_hw
))
goto
out
;
}
else
{
...
...
proto-standard/common-fun.c
View file @
8699f7d5
...
...
@@ -186,7 +186,7 @@ int st_com_slave_handle_sync(struct pp_instance *ppi, unsigned char *buf,
ppi
->
flags
&=
~
PPI_FLAG_WAITING_FOR_F_UP
;
to_TimeInternal
(
&
ppi
->
t1
,
&
sync
.
originTimestamp
);
if
(
CONFIG_HAS_P2P
&&
ppi
->
glbs
->
delay_
mech
==
PP_P2P_MECH
)
if
(
CONFIG_HAS_P2P
&&
ppi
->
mech
==
PP_P2P_MECH
)
pp_servo_got_psync
(
ppi
);
else
pp_servo_got_sync
(
ppi
);
...
...
@@ -355,7 +355,7 @@ int st_com_slave_handle_followup(struct pp_instance *ppi, unsigned char *buf,
if
(
ret
<
0
)
return
ret
;
if
(
CONFIG_HAS_P2P
&&
ppi
->
glbs
->
delay_
mech
==
PP_P2P_MECH
)
if
(
CONFIG_HAS_P2P
&&
ppi
->
mech
==
PP_P2P_MECH
)
pp_servo_got_psync
(
ppi
);
else
pp_servo_got_sync
(
ppi
);
...
...
proto-standard/msg.c
View file @
8699f7d5
...
...
@@ -602,7 +602,7 @@ static int msg_issue_pdelay_req(struct pp_instance *ppi)
int
msg_issue_request
(
struct
pp_instance
*
ppi
)
{
if
(
CONFIG_HAS_P2P
&&
ppi
->
glbs
->
delay_
mech
==
PP_P2P_MECH
)
if
(
CONFIG_HAS_P2P
&&
ppi
->
mech
==
PP_P2P_MECH
)
return
msg_issue_pdelay_req
(
ppi
);
return
msg_issue_delay_req
(
ppi
);
}
...
...
proto-standard/state-listening.c
View file @
8699f7d5
...
...
@@ -19,7 +19,7 @@ int pp_listening(struct pp_instance *ppi, unsigned char *pkt, int plen)
goto
out
;
/* when the clock is using peer-delay, listening must send it too */
if
(
CONFIG_HAS_P2P
&&
ppi
->
glbs
->
delay_
mech
==
PP_P2P_MECH
)
if
(
CONFIG_HAS_P2P
&&
ppi
->
mech
==
PP_P2P_MECH
)
e
=
pp_lib_may_issue_request
(
ppi
);
if
(
plen
==
0
)
...
...
proto-standard/state-master.c
View file @
8699f7d5
...
...
@@ -60,7 +60,7 @@ int pp_master(struct pp_instance *ppi, uint8_t *pkt, int plen)
}
/* when the clock is using peer-delay, the master must send it too */
if
(
CONFIG_HAS_P2P
&&
ppi
->
glbs
->
delay_
mech
==
PP_P2P_MECH
)
if
(
CONFIG_HAS_P2P
&&
ppi
->
mech
==
PP_P2P_MECH
)
pp_lib_may_issue_request
(
ppi
);
else
/* please check commit '6d7bf7e3' about below, I'm not sure */
pp_timeout_set
(
ppi
,
PP_TO_REQUEST
);
...
...
proto-standard/state-passive.c
View file @
8699f7d5
...
...
@@ -14,7 +14,7 @@ int pp_passive(struct pp_instance *ppi, unsigned char *pkt, int plen)
int
e
=
0
;
/* error var, to check errors in msg handling */
/* when the clock is using peer-delay, listening must send it too */
if
(
CONFIG_HAS_P2P
&&
ppi
->
glbs
->
delay_
mech
==
PP_P2P_MECH
)
if
(
CONFIG_HAS_P2P
&&
ppi
->
mech
==
PP_P2P_MECH
)
e
=
pp_lib_may_issue_request
(
ppi
);
if
(
plen
==
0
)
...
...
time-wrpc/wrpc-socket.c
View file @
8699f7d5
...
...
@@ -29,7 +29,7 @@ static int wrpc_open_ch(struct pp_instance *ppi)
struct
wr_sockaddr
addr
;
char
*
macaddr
=
PP_MCAST_MACADDRESS
;
if
(
ppi
->
glbs
->
delay_
mech
==
PP_P2P_MECH
)
if
(
ppi
->
mech
==
PP_P2P_MECH
)
macaddr
=
PP_PDELAY_MACADDRESS
;
addr
.
ethertype
=
ETH_P_1588
;
memcpy
(
addr
.
mac
,
macaddr
,
sizeof
(
mac_addr_t
));
...
...
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