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
a6d83b3a
Commit
a6d83b3a
authored
Sep 02, 2021
by
Antoine Kaufmann
Browse files
lib/nicif: factor out init and add dummy yield calls
Enables overriding for multi NIC runner in next step
parent
f0e0939e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
1 deletion
+20
-1
lib/simbricks/nicbm/nicbm.cc
lib/simbricks/nicbm/nicbm.cc
+17
-1
lib/simbricks/nicbm/nicbm.h
lib/simbricks/nicbm/nicbm.h
+3
-0
No files found.
lib/simbricks/nicbm/nicbm.cc
View file @
a6d83b3a
...
@@ -92,6 +92,7 @@ volatile union SimbricksProtoPcieD2H *Runner::D2HAlloc() {
...
@@ -92,6 +92,7 @@ volatile union SimbricksProtoPcieD2H *Runner::D2HAlloc() {
nicif_
.
d2h_pos
);
nicif_
.
d2h_pos
);
first
=
false
;
first
=
false
;
}
}
YieldPoll
();
}
}
if
(
!
first
)
if
(
!
first
)
...
@@ -109,6 +110,7 @@ volatile union SimbricksProtoNetD2N *Runner::D2NAlloc() {
...
@@ -109,6 +110,7 @@ volatile union SimbricksProtoNetD2N *Runner::D2NAlloc() {
nicif_
.
d2n_pos
);
nicif_
.
d2n_pos
);
first
=
false
;
first
=
false
;
}
}
YieldPoll
();
}
}
if
(
!
first
)
if
(
!
first
)
...
@@ -472,6 +474,13 @@ void Runner::EventTrigger() {
...
@@ -472,6 +474,13 @@ void Runner::EventTrigger() {
dev_
.
Timed
(
*
ev
);
dev_
.
Timed
(
*
ev
);
}
}
void
Runner
::
YieldPoll
()
{
}
int
Runner
::
NicIfInit
(
struct
SimbricksNicIfParams
&
nsparams
)
{
return
SimbricksNicIfInit
(
&
nicif_
,
&
nsparams
,
&
dintro_
);
}
Runner
::
Runner
(
Device
&
dev
)
:
dev_
(
dev
),
events_
(
EventCmp
())
{
Runner
::
Runner
(
Device
&
dev
)
:
dev_
(
dev
),
events_
(
EventCmp
())
{
// mac_addr = lrand48() & ~(3ULL << 46);
// mac_addr = lrand48() & ~(3ULL << 46);
dma_pending_
=
0
;
dma_pending_
=
0
;
...
@@ -539,7 +548,7 @@ int Runner::RunMain(int argc, char *argv[]) {
...
@@ -539,7 +548,7 @@ int Runner::RunMain(int argc, char *argv[]) {
sync_mode
==
SIMBRICKS_PROTO_SYNC_BARRIER
);
sync_mode
==
SIMBRICKS_PROTO_SYNC_BARRIER
);
nsparams
.
sync_mode
=
sync_mode
;
nsparams
.
sync_mode
=
sync_mode
;
if
(
Simbricks
NicIfInit
(
&
nicif_
,
&
nsparams
,
&
dintro_
))
{
if
(
NicIfInit
(
nsparams
))
{
return
EXIT_FAILURE
;
return
EXIT_FAILURE
;
}
}
fprintf
(
stderr
,
"sync_pci=%d sync_eth=%d
\n
"
,
nsparams
.
sync_pci
,
fprintf
(
stderr
,
"sync_pci=%d sync_eth=%d
\n
"
,
nsparams
.
sync_pci
,
...
@@ -553,7 +562,12 @@ int Runner::RunMain(int argc, char *argv[]) {
...
@@ -553,7 +562,12 @@ int Runner::RunMain(int argc, char *argv[]) {
}
}
SimbricksNicIfAdvanceEpoch
(
&
nicif_
,
main_time
);
SimbricksNicIfAdvanceEpoch
(
&
nicif_
,
main_time
);
bool
first
=
true
;
do
{
do
{
if
(
!
first
)
YieldPoll
();
first
=
false
;
PollH2D
();
PollH2D
();
PollN2D
();
PollN2D
();
EventTrigger
();
EventTrigger
();
...
@@ -571,6 +585,8 @@ int Runner::RunMain(int argc, char *argv[]) {
...
@@ -571,6 +585,8 @@ int Runner::RunMain(int argc, char *argv[]) {
next_ts
=
ev_ts
;
next_ts
=
ev_ts
;
}
while
(
next_ts
<=
main_time
&&
!
exiting
);
}
while
(
next_ts
<=
main_time
&&
!
exiting
);
main_time
=
SimbricksNicIfAdvanceTime
(
&
nicif_
,
next_ts
);
main_time
=
SimbricksNicIfAdvanceTime
(
&
nicif_
,
next_ts
);
YieldPoll
();
}
}
fprintf
(
stderr
,
"exit main_time: %lu
\n
"
,
main_time
);
fprintf
(
stderr
,
"exit main_time: %lu
\n
"
,
main_time
);
...
...
lib/simbricks/nicbm/nicbm.h
View file @
a6d83b3a
...
@@ -147,6 +147,9 @@ class Runner {
...
@@ -147,6 +147,9 @@ class Runner {
void
DmaDo
(
DMAOp
&
op
);
void
DmaDo
(
DMAOp
&
op
);
void
DmaTrigger
();
void
DmaTrigger
();
virtual
void
YieldPoll
();
virtual
int
NicIfInit
(
struct
SimbricksNicIfParams
&
nsparams
);
public:
public:
explicit
Runner
(
Device
&
dev_
);
explicit
Runner
(
Device
&
dev_
);
...
...
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