Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ycai
simbricks
Commits
5aab07da
Commit
5aab07da
authored
Jun 17, 2020
by
Antoine Kaufmann
Browse files
netsim,wire: ethernet sync fixes
parent
272710ee
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
7 deletions
+8
-7
net_wire/net_wire.c
net_wire/net_wire.c
+3
-2
netsim_common/include/netsim.h
netsim_common/include/netsim.h
+4
-4
nicsim_common/nicsim.c
nicsim_common/nicsim.c
+1
-1
No files found.
net_wire/net_wire.c
View file @
5aab07da
...
...
@@ -66,6 +66,7 @@ static void move_pkt(uint64_t cur_ts, struct netsim_interface *from,
}
else
{
fprintf
(
stderr
,
"move_pkt: dropping packet
\n
"
);
}
}
else
if
(
type
==
COSIM_ETH_PROTO_D2N_MSG_SYNC
)
{
}
else
{
fprintf
(
stderr
,
"move_pkt: unsupported type=%u
\n
"
,
type
);
abort
();
...
...
@@ -107,8 +108,8 @@ int main(int argc, char *argv[])
do
{
move_pkt
(
cur_ts
,
&
nsif_a
,
&
nsif_b
);
move_pkt
(
cur_ts
,
&
nsif_b
,
&
nsif_a
);
ts_a
=
netsim_
n2d
_timestamp
(
&
nsif_a
);
ts_b
=
netsim_
n2d
_timestamp
(
&
nsif_b
);
ts_a
=
netsim_
d2n
_timestamp
(
&
nsif_a
);
ts_b
=
netsim_
d2n
_timestamp
(
&
nsif_b
);
}
while
((
sync_a
&&
ts_a
<=
cur_ts
)
||
(
sync_b
&&
ts_b
<=
cur_ts
));
...
...
netsim_common/include/netsim.h
View file @
5aab07da
...
...
@@ -52,15 +52,15 @@ volatile union cosim_eth_proto_d2n *netsim_d2n_poll(
struct
netsim_interface
*
nsif
,
uint64_t
timestamp
);
void
netsim_d2n_done
(
struct
netsim_interface
*
nsif
,
volatile
union
cosim_eth_proto_d2n
*
msg
);
static
inline
uint64_t
netsim_d2n_timestamp
(
struct
netsim_interface
*
nsif
)
{
return
nsif
->
d2n_timestamp
;
}
volatile
union
cosim_eth_proto_n2d
*
netsim_n2d_alloc
(
struct
netsim_interface
*
nsif
,
uint64_t
timestamp
,
uint64_t
latency
);
int
netsim_n2d_sync
(
struct
netsim_interface
*
nsif
,
uint64_t
timestamp
,
uint64_t
latency
,
uint64_t
sync_delay
);
static
inline
uint64_t
netsim_n2d_timestamp
(
struct
netsim_interface
*
nsif
)
{
return
nsif
->
n2d_timestamp
;
}
#endif
/* ndef COSIM_NETSIM_H_ */
nicsim_common/nicsim.c
View file @
5aab07da
...
...
@@ -350,7 +350,7 @@ volatile union cosim_pcie_proto_d2h *nicsim_d2h_alloc(
return
NULL
;
}
msg
->
dummy
.
timestamp
=
timestamp
+
params
->
pci_latency
;
;
msg
->
dummy
.
timestamp
=
timestamp
+
params
->
pci_latency
;
pci_last_tx_time
=
timestamp
;
d2h_pos
=
(
d2h_pos
+
1
)
%
D2H_ENUM
;
...
...
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