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
f301750d
Commit
f301750d
authored
Jun 05, 2022
by
Antoine Kaufmann
Browse files
sims/e1000_gem5: support enabling debug messages dynamically
parent
3f25a60d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
8 deletions
+31
-8
experiments/simbricks/simulators.py
experiments/simbricks/simulators.py
+5
-2
sims/nic/e1000_gem5/e1000_gem5.cc
sims/nic/e1000_gem5/e1000_gem5.cc
+25
-5
sims/nic/e1000_gem5/support.h
sims/nic/e1000_gem5/support.h
+1
-1
No files found.
experiments/simbricks/simulators.py
View file @
f301750d
...
...
@@ -387,12 +387,15 @@ class I40eNIC(NICSim):
return
self
.
basic_run_cmd
(
env
,
'/i40e_bm/i40e_bm'
)
class
E1000NIC
(
NICSim
):
debug
=
False
def
__init__
(
self
):
super
().
__init__
()
def
run_cmd
(
self
,
env
):
#return 'valgrind -v -v -v ' + self.basic_run_cmd(env, '/e1000_gem5/e1000_gem5')
return
self
.
basic_run_cmd
(
env
,
'/e1000_gem5/e1000_gem5'
)
cmd
=
self
.
basic_run_cmd
(
env
,
'/e1000_gem5/e1000_gem5'
)
if
self
.
debug
:
cmd
=
'env E1000_DEBUG=1 '
+
cmd
return
cmd
class
MultiSubNIC
(
NICSim
):
name
=
''
...
...
sims/nic/e1000_gem5/e1000_gem5.cc
View file @
f301750d
...
...
@@ -5,6 +5,7 @@
#include "sims/nic/e1000_gem5/i8254xGBe.h"
static
nicbm
::
Runner
*
runner
;
static
bool
debug_enable
=
false
;
class
Gem5DMAOp
:
public
nicbm
::
DMAOp
,
public
nicbm
::
TimedEvent
{
public:
...
...
@@ -195,19 +196,38 @@ void panic(const char *fmt, ...)
abort
();
}
static
void
debug_init
()
{
#ifdef DEBUG_E1000
char
*
debug_env
=
getenv
(
"E1000_DEBUG"
);
if
(
debug_env
&&
(
!
strcmp
(
debug_env
,
"1"
)
||
!
strcmp
(
debug_env
,
"y"
)
||
!
strcmp
(
debug_env
,
"Y"
)))
{
warn
(
"enabling debug messages because E1000_DEBUG envar set
\n
"
);
debug_enable
=
true
;
}
#endif
}
void
debug_printf
(
const
char
*
fmt
,
...)
{
if
(
debug_enable
)
{
va_list
val
;
va_start
(
val
,
fmt
);
fprintf
(
stderr
,
"%lu: "
,
runner
->
TimePs
());
vfprintf
(
stderr
,
fmt
,
val
);
va_end
(
val
);
}
}
/******************************************************************************/
int
main
(
int
argc
,
char
*
argv
[])
{
debug_init
();
IGbEParams
params
;
params
.
rx_fifo_size
=
384
*
1024
;
params
.
tx_fifo_size
=
384
*
1024
;
...
...
sims/nic/e1000_gem5/support.h
View file @
f301750d
...
...
@@ -12,7 +12,7 @@
void
debug_printf
(
const
char
*
fmt
,
...);
//
#define DEBUG_E1000
#define DEBUG_E1000
#ifdef DEBUG_E1000
# define DPRINTF(x,y...) debug_printf(#x ": " y)
#else
...
...
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