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
9a1d10b6
Commit
9a1d10b6
authored
May 25, 2023
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename arch_data fields to reduce ambiguity
parent
60f708fd
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
45 additions
and
47 deletions
+45
-47
ppsi-sim.h
arch-sim/ppsi-sim.h
+4
-4
sim-startup.c
arch-sim/sim-startup.c
+6
-6
ppsi-unix.h
arch-unix/ppsi-unix.h
+1
-1
unix-startup.c
arch-unix/unix-startup.c
+2
-2
wrc_ptp_ppsi.c
arch-wrpc/wrc_ptp_ppsi.c
+1
-1
wrpc.h
arch-wrpc/wrpc.h
+2
-2
ppsi-wrs.h
arch-wrs/include/ppsi-wrs.h
+3
-5
wrs-startup.c
arch-wrs/wrs-startup.c
+2
-2
pp-instance.h
include/ppsi/pp-instance.h
+3
-3
wrs-socket.c
time-wrs/wrs-socket.c
+10
-10
dump_mem_ppsi_wrpc.c
tools/dump_mem_ppsi_wrpc.c
+6
-6
wrs_dump_shmem_ppsi.c
tools/wrs_dump_shmem_ppsi.c
+5
-5
No files found.
arch-sim/ppsi-sim.h
View file @
9a1d10b6
...
...
@@ -36,8 +36,8 @@ struct pp_sim_net_delay {
* chtype is the channel and delay_ns is the time that should pass from when the
* packet is sent until it will be received from the destination.
* Every time a packet is sent a structure like this is filled and stored in the
* ppg->arch_
data so that we always know which is the first packet that has to
* be received and when.
* ppg->arch_
glbl_data so that we always know which is the first packet that
*
has to
be received and when.
*/
struct
sim_pending_pkt
{
int64_t
delay_ns
;
...
...
@@ -64,7 +64,7 @@ struct sim_ppg_arch_data {
static
inline
struct
sim_ppg_arch_data
*
SIM_PPG_ARCH
(
struct
pp_globals
*
ppg
)
{
return
(
struct
sim_ppg_arch_data
*
)(
ppg
->
arch_data
);
return
(
struct
sim_ppg_arch_data
*
)(
ppg
->
arch_
glbl_
data
);
}
/*
...
...
@@ -101,7 +101,7 @@ struct sim_ppi_arch_data {
static
inline
struct
sim_ppi_arch_data
*
SIM_PPI_ARCH
(
struct
pp_instance
*
ppi
)
{
return
(
struct
sim_ppi_arch_data
*
)(
ppi
->
arch_data
);
return
(
struct
sim_ppi_arch_data
*
)(
ppi
->
arch_
inst_
data
);
}
static
inline
struct
pp_instance
*
pp_sim_get_master
(
struct
pp_globals
*
ppg
)
...
...
arch-sim/sim-startup.c
View file @
9a1d10b6
...
...
@@ -105,8 +105,8 @@ const struct wrh_operations wrh_oper = {
/*
* In arch-sim we use two pp_instances in the same pp_globals to represent
* two different machines. This means *completely differnt* machines, with
* their own Data Sets. Given we can't put more all the different Data Sets
*
in the same ppg, we stored them in the ppi->arch
_data of every instance.
* their own Data Sets. Given we can't put more all the different Data Sets
in
*
the same ppg, we stored them in the ppi->arch_inst
_data of every instance.
* This function is used to set the inner Data Sets pointer of the ppg to
* point to the Data Sets related to the pp_instange passed as argument
*/
...
...
@@ -148,9 +148,9 @@ static int sim_ppi_init(struct pp_instance *ppi, int which_ppi)
ppi
->
proto
=
PP_DEFAULT_PROTO
;
ppi
->
__tx_buffer
=
malloc
(
PP_MAX_FRAME_LENGTH
);
ppi
->
__rx_buffer
=
malloc
(
PP_MAX_FRAME_LENGTH
);
ppi
->
arch_data
=
calloc
(
1
,
sizeof
(
struct
sim_ppi_arch_data
));
ppi
->
arch_
inst_
data
=
calloc
(
1
,
sizeof
(
struct
sim_ppi_arch_data
));
ppi
->
portDS
=
calloc
(
1
,
sizeof
(
*
ppi
->
portDS
));
if
((
!
ppi
->
arch_data
)
||
(
!
ppi
->
portDS
))
if
((
!
ppi
->
arch_
inst_
data
)
||
(
!
ppi
->
portDS
))
return
-
1
;
ppi
->
ext_hooks
=&
pp_hooks
;
...
...
@@ -220,10 +220,10 @@ int main(int argc, char **argv)
ppg
=
calloc
(
1
,
sizeof
(
struct
pp_globals
));
ppg
->
max_links
=
2
;
// master and slave, nothing else
ppg
->
arch_data
=
calloc
(
1
,
sizeof
(
struct
sim_ppg_arch_data
));
ppg
->
arch_
glbl_
data
=
calloc
(
1
,
sizeof
(
struct
sim_ppg_arch_data
));
ppg
->
pp_instances
=
calloc
(
ppg
->
max_links
,
sizeof
(
struct
pp_instance
));
if
((
!
ppg
->
arch_data
)
||
(
!
ppg
->
pp_instances
))
if
((
!
ppg
->
arch_
glbl_
data
)
||
(
!
ppg
->
pp_instances
))
return
-
1
;
/* Alloc data stuctures inside the pp_instances */
...
...
arch-unix/ppsi-unix.h
View file @
9a1d10b6
...
...
@@ -9,7 +9,7 @@
* These are the functions provided by the various unix files
*/
#define POSIX_ARCH(ppg) ((struct unix_arch_data *)(ppg->arch_data))
#define POSIX_ARCH(ppg) ((struct unix_arch_data *)(ppg->arch_
glbl_
data))
struct
unix_arch_data
{
struct
timeval
tv
;
};
...
...
arch-unix/unix-startup.c
View file @
9a1d10b6
...
...
@@ -54,10 +54,10 @@ int main(int argc, char **argv)
/* We are hosted, so we can allocate */
ppg
->
max_links
=
PP_MAX_LINKS
;
ppg
->
arch_data
=
calloc
(
1
,
sizeof
(
struct
unix_arch_data
));
ppg
->
arch_
glbl_
data
=
calloc
(
1
,
sizeof
(
struct
unix_arch_data
));
ppg
->
pp_instances
=
calloc
(
ppg
->
max_links
,
sizeof
(
struct
pp_instance
));
if
((
!
ppg
->
arch_data
)
||
(
!
ppg
->
pp_instances
))
{
if
((
!
ppg
->
arch_
glbl_
data
)
||
(
!
ppg
->
pp_instances
))
{
fprintf
(
stderr
,
"ppsi: out of memory
\n
"
);
exit
(
1
);
}
...
...
arch-wrpc/wrc_ptp_ppsi.c
View file @
9a1d10b6
...
...
@@ -101,7 +101,7 @@ struct pp_globals ppg_static = {
.
max_links
=
PP_MAX_LINKS
,
.
nlinks
=
1
,
/* rt_opts set by pp_init_globals */
.
arch_data
=
&
wrpc_arch_data
,
.
arch_
glbl_
data
=
&
wrpc_arch_data
,
};
...
...
arch-wrpc/wrpc.h
View file @
9a1d10b6
...
...
@@ -95,12 +95,12 @@ int32_t wrpc_get_clock_period(void);
static
inline
wrpc_arch_data_t
*
WRPC_ARCH_I
(
struct
pp_instance
*
ppi
)
{
return
(
wrpc_arch_data_t
*
)
GLBS
(
ppi
)
->
arch_data
;
return
(
wrpc_arch_data_t
*
)
GLBS
(
ppi
)
->
arch_
glbl_
data
;
}
static
inline
wrpc_arch_data_t
*
WRPC_ARCH_G
(
struct
pp_globals
*
ppg
)
{
return
(
wrpc_arch_data_t
*
)
ppg
->
arch_data
;
return
(
wrpc_arch_data_t
*
)
ppg
->
arch_
glbl_
data
;
}
static
inline
void
wrc_ptp_get_leapsec
(
int
*
ptp
,
int
*
system
)
...
...
arch-wrs/include/ppsi-wrs.h
View file @
9a1d10b6
...
...
@@ -37,13 +37,11 @@ static inline struct hal_port_state *pp_wrs_lookup_port(char *name)
#define DEFAULT_TO 200000
/* ms */
#define POSIX_ARCH(ppg) ((struct unix_arch_data *)(ppg->arch_data))
#define POSIX_ARCH(ppg) ((struct unix_arch_data *)(ppg->arch_
glbl_
data))
struct
unix_arch_data
{
struct
timeval
tv
;
};
#define WRH_GLOBAL_ARCH(ppg) ((wrs_arch_data *)(ppg->arch_data))
typedef
struct
wrs_arch_data_t
{
struct
unix_arch_data
unix_data
;
// Must be kept at first position
wrh_timing_mode_locking_state_t
timingModeLockingState
;
/* Locking state for PLL */
...
...
@@ -53,12 +51,12 @@ typedef struct wrs_arch_data_t {
static
inline
wrs_arch_data_t
*
WRS_ARCH_I
(
struct
pp_instance
*
ppi
)
{
return
(
wrs_arch_data_t
*
)
GLBS
(
ppi
)
->
arch_data
;
return
(
wrs_arch_data_t
*
)
GLBS
(
ppi
)
->
arch_
glbl_
data
;
}
static
inline
wrs_arch_data_t
*
WRS_ARCH_G
(
struct
pp_globals
*
ppg
)
{
return
(
wrs_arch_data_t
*
)
ppg
->
arch_data
;
return
(
wrs_arch_data_t
*
)
ppg
->
arch_
glbl_
data
;
}
extern
void
wrs_main_loop
(
struct
pp_globals
*
ppg
);
...
...
arch-wrs/wrs-startup.c
View file @
9a1d10b6
...
...
@@ -229,11 +229,11 @@ int main(int argc, char **argv)
ppg
->
max_links
=
PP_MAX_LINKS
;
ppg
->
arch_data
=
wrs_shm_alloc
(
ppsi_head
,
sizeof
(
wrs_arch_data_t
));
ppg
->
arch_
glbl_
data
=
wrs_shm_alloc
(
ppsi_head
,
sizeof
(
wrs_arch_data_t
));
ppg
->
pp_instances
=
wrs_shm_alloc
(
ppsi_head
,
ppg
->
max_links
*
sizeof
(
struct
pp_instance
));
if
((
!
ppg
->
arch_data
)
||
(
!
ppg
->
pp_instances
))
{
if
((
!
ppg
->
arch_
glbl_
data
)
||
(
!
ppg
->
pp_instances
))
{
fprintf
(
stderr
,
"ppsi: out of memory
\n
"
);
exit
(
1
);
}
...
...
include/ppsi/pp-instance.h
View file @
9a1d10b6
...
...
@@ -66,7 +66,7 @@ struct pp_channel {
int
fd
;
/* Posix wants fid descriptor */
void
*
custom
;
/* Other archs want other stuff */
};
void
*
arch_data
;
/* Other arch-private info, if any */
void
*
arch_
chan_
data
;
/* Other arch-private info, if any */
unsigned
char
addr
[
PP_MAC_ADRESS_SIZE
];
/* Our own MAC address */
int
pkt_present
;
};
...
...
@@ -217,7 +217,7 @@ struct pp_instance {
int
state
;
int
next_state
,
next_delay
,
is_new_state
;
/* set by state processing */
const
struct
pp_state_table_item
*
current_state_item
;
void
*
arch_data
;
/* if arch needs it */
void
*
arch_
inst_
data
;
/* if arch needs it */
void
*
ext_data
;
/* if protocol ext needs it */
int
protocol_extension
;
/* PPSI_EXT_NONE, PPSI_EXT_WR, PPSI_EXT_L1S */
const
struct
pp_ext_hooks
*
ext_hooks
;
/* if protocol ext needs it */
...
...
@@ -331,7 +331,7 @@ struct pp_globals {
int
rxdrop
,
txdrop
;
/* fault injection, per thousand */
void
*
arch_data
;
/* if arch needs it */
void
*
arch_
glbl_
data
;
/* if arch needs it */
void
*
global_ext_data
;
/* if protocol ext needs it */
/* FIXME Here include all is common to many interfaces */
...
...
time-wrs/wrs-socket.c
View file @
9a1d10b6
...
...
@@ -228,7 +228,7 @@ static int wrs_recv_msg(struct pp_instance *ppi, int fd, void *pkt, int len,
struct
scm_timestamping
*
sts
=
NULL
;
struct
tpacket_auxdata
*
aux
=
NULL
;
s
=
(
struct
wrs_socket
*
)
ppi
->
ch
[
PP_NP_GEN
].
arch_data
;
s
=
(
struct
wrs_socket
*
)
ppi
->
ch
[
PP_NP_GEN
].
arch_
chan_
data
;
memset
(
&
msg
,
0
,
sizeof
(
msg
));
msg
.
msg_iov
=
&
entry
;
...
...
@@ -505,7 +505,7 @@ static int wrs_net_send(struct pp_instance *ppi, void *pkt, int len,enum pp_msg_
int
ret
,
fd
,
drop
;
char
prefix
[
32
];
s
=
(
struct
wrs_socket
*
)
ppi
->
ch
[
PP_NP_GEN
].
arch_data
;
s
=
(
struct
wrs_socket
*
)
ppi
->
ch
[
PP_NP_GEN
].
arch_
chan_
data
;
/*
* To fake a packet loss, we must corrupt the frame; we need
...
...
@@ -661,7 +661,7 @@ static int wrs_net_init(struct pp_instance *ppi)
int
r
,
i
;
struct
hal_port_state
*
p
;
if
(
ppi
->
ch
[
PP_NP_GEN
].
arch_data
)
if
(
ppi
->
ch
[
PP_NP_GEN
].
arch_
chan_
data
)
wrs_net_exit
(
ppi
);
/* Generic OS work is done by standard Unix stuff */
...
...
@@ -695,15 +695,15 @@ static int wrs_net_init(struct pp_instance *ppi)
s
->
dmtd_phase_valid
=
0
;
ppi
->
ch
[
PP_NP_GEN
].
arch_data
=
s
;
ppi
->
ch
[
PP_NP_EVT
].
arch_data
=
s
;
ppi
->
ch
[
PP_NP_GEN
].
arch_
chan_
data
=
s
;
ppi
->
ch
[
PP_NP_EVT
].
arch_
chan_
data
=
s
;
tmo_init
(
&
s
->
dmtd_update_tmo
,
DMTD_UPDATE_INTERVAL
);
for
(
i
=
PP_NP_GEN
,
r
=
0
;
i
<=
PP_NP_EVT
&&
r
==
0
;
i
++
)
r
=
wrs_enable_timestamps
(
ppi
,
ppi
->
ch
[
i
].
fd
);
if
(
r
)
{
ppi
->
ch
[
PP_NP_GEN
].
arch_data
=
NULL
;
ppi
->
ch
[
PP_NP_EVT
].
arch_data
=
NULL
;
ppi
->
ch
[
PP_NP_GEN
].
arch_
chan_
data
=
NULL
;
ppi
->
ch
[
PP_NP_EVT
].
arch_
chan_
data
=
NULL
;
free
(
s
);
}
return
r
;
...
...
@@ -712,9 +712,9 @@ static int wrs_net_init(struct pp_instance *ppi)
static
int
wrs_net_exit
(
struct
pp_instance
*
ppi
)
{
unix_net_ops
.
exit
(
ppi
);
free
(
ppi
->
ch
[
PP_NP_GEN
].
arch_data
);
ppi
->
ch
[
PP_NP_GEN
].
arch_data
=
NULL
;
ppi
->
ch
[
PP_NP_EVT
].
arch_data
=
NULL
;
free
(
ppi
->
ch
[
PP_NP_GEN
].
arch_
chan_
data
);
ppi
->
ch
[
PP_NP_GEN
].
arch_
chan_
data
=
NULL
;
ppi
->
ch
[
PP_NP_EVT
].
arch_
chan_
data
=
NULL
;
return
0
;
}
...
...
tools/dump_mem_ppsi_wrpc.c
View file @
9a1d10b6
...
...
@@ -30,7 +30,7 @@ struct dump_info dump_ppsi_info[] = {
DUMP_FIELD
(
int
,
rxdrop
),
DUMP_FIELD
(
int
,
txdrop
),
DUMP_FIELD
(
pointer
,
arch_data
),
DUMP_FIELD
(
pointer
,
arch_
glbl_
data
),
DUMP_FIELD
(
pointer
,
global_ext_data
),
...
...
@@ -214,7 +214,7 @@ struct dump_info dump_ppsi_info[] = {
DUMP_FIELD
(
int
,
next_delay
),
DUMP_FIELD
(
yes_no
,
is_new_state
),
DUMP_FIELD
(
pointer
,
current_state_item
),
DUMP_FIELD
(
pointer
,
arch_data
),
DUMP_FIELD
(
pointer
,
arch_
inst_
data
),
DUMP_FIELD
(
pointer
,
ext_data
),
DUMP_FIELD
(
protocol_extension
,
protocol_extension
),
DUMP_FIELD
(
pointer
,
ext_hooks
),
...
...
@@ -235,12 +235,12 @@ struct dump_info dump_ppsi_info[] = {
/* This is a sub-structure */
DUMP_FIELD
(
int
,
ch
[
0
].
fd
),
DUMP_FIELD
(
pointer
,
ch
[
0
].
custom
),
DUMP_FIELD
(
pointer
,
ch
[
0
].
arch_data
),
DUMP_FIELD
(
pointer
,
ch
[
0
].
arch_
chan_
data
),
DUMP_FIELD_SIZE
(
bina
,
ch
[
0
].
addr
,
6
),
DUMP_FIELD
(
yes_no
,
ch
[
0
].
pkt_present
),
DUMP_FIELD
(
int
,
ch
[
1
].
fd
),
DUMP_FIELD
(
pointer
,
ch
[
1
].
custom
),
DUMP_FIELD
(
pointer
,
ch
[
1
].
arch_data
),
DUMP_FIELD
(
pointer
,
ch
[
1
].
arch_
chan_
data
),
DUMP_FIELD_SIZE
(
bina
,
ch
[
1
].
addr
,
6
),
DUMP_FIELD
(
yes_no
,
ch
[
1
].
pkt_present
),
...
...
@@ -392,9 +392,9 @@ void dump_mem_ppsi_wrpc(void *mapaddr, unsigned long ppg_off)
dump_many_fields
(
mapaddr
+
ppg_off
,
"pp_globals"
,
prefix
);
arch_data_offset
=
wrpc_get_pointer
(
mapaddr
+
ppg_off
,
"pp_globals"
,
"arch_data"
);
"pp_globals"
,
"arch_
glbl_
data"
);
if
(
arch_data_offset
)
{
prefix
=
"ppsi.arch_data"
;
prefix
=
"ppsi.arch_
glbl_
data"
;
printf
(
"%s at 0x%lx
\n
"
,
prefix
,
arch_data_offset
);
dump_many_fields
(
mapaddr
+
arch_data_offset
,
"wrpc_arch_data_t"
,
prefix
);
...
...
tools/wrs_dump_shmem_ppsi.c
View file @
9a1d10b6
...
...
@@ -25,7 +25,7 @@ struct dump_info ppg_info [] = {
DUMP_FIELD
(
int
,
rxdrop
),
DUMP_FIELD
(
int
,
txdrop
),
DUMP_FIELD
(
pointer
,
arch_data
),
DUMP_FIELD
(
pointer
,
arch_
glbl_
data
),
DUMP_FIELD
(
pointer
,
global_ext_data
),
};
...
...
@@ -238,7 +238,7 @@ struct dump_info ppi_info [] = {
DUMP_FIELD
(
yes_no
,
is_new_state
),
DUMP_FIELD
(
exstate
,
extState
),
DUMP_FIELD
(
pp_pdstate
,
pdstate
),
DUMP_FIELD
(
pointer
,
arch_data
),
DUMP_FIELD
(
pointer
,
arch_
inst_
data
),
DUMP_FIELD
(
pointer
,
ext_data
),
DUMP_FIELD
(
protocol_extension
,
protocol_extension
),
DUMP_FIELD
(
pointer
,
ext_hooks
),
...
...
@@ -260,12 +260,12 @@ struct dump_info ppi_info [] = {
/* This is a sub-structure */
DUMP_FIELD
(
int
,
ch
[
0
].
fd
),
DUMP_FIELD
(
pointer
,
ch
[
0
].
custom
),
DUMP_FIELD
(
pointer
,
ch
[
0
].
arch_data
),
DUMP_FIELD
(
pointer
,
ch
[
0
].
arch_
chan_
data
),
DUMP_FIELD_SIZE
(
bina
,
ch
[
0
].
addr
,
6
),
DUMP_FIELD
(
yes_no
,
ch
[
0
].
pkt_present
),
DUMP_FIELD
(
int
,
ch
[
1
].
fd
),
DUMP_FIELD
(
pointer
,
ch
[
1
].
custom
),
DUMP_FIELD
(
pointer
,
ch
[
1
].
arch_data
),
DUMP_FIELD
(
pointer
,
ch
[
1
].
arch_
chan_
data
),
DUMP_FIELD_SIZE
(
bina
,
ch
[
1
].
addr
,
6
),
DUMP_FIELD
(
yes_no
,
ch
[
1
].
pkt_present
),
...
...
@@ -783,7 +783,7 @@ int dump_ppsi_mem(struct wrs_shm_head *head)
#if CONFIG_ARCH_IS_WRS
{
wrs_arch_data_t
*
arch_data
=
wrs_shm_follow
(
head
,
WRS_ARCH_G
(
ppg
));
dump_many_fields
(
arch_data
,
wrs_arch_data_info
,
ARRAY_SIZE
(
wrs_arch_data_info
),
"ppsi.arch_data"
);
dump_many_fields
(
arch_data
,
wrs_arch_data_info
,
ARRAY_SIZE
(
wrs_arch_data_info
),
"ppsi.arch_
inst_
data"
);
}
#endif
...
...
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