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
794a721c
Commit
794a721c
authored
Jun 05, 2022
by
Antoine Kaufmann
Browse files
experiments: add support for ethernet ports in gem5
parent
5eb97158
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
1 deletion
+27
-1
experiments/simbricks/experiment/experiment_environment.py
experiments/simbricks/experiment/experiment_environment.py
+6
-0
experiments/simbricks/simulators.py
experiments/simbricks/simulators.py
+21
-1
No files found.
experiments/simbricks/experiment/experiment_environment.py
View file @
794a721c
...
...
@@ -64,6 +64,12 @@ class ExpEnv(object):
def
n2n_eth_path
(
self
,
sim_l
,
sim_c
):
return
'%s/n2n.eth.%s.%s'
%
(
self
.
workdir
,
sim_l
.
name
,
sim_c
.
name
)
def
net2host_eth_path
(
self
,
sim_n
,
sim_h
):
return
'%s/n2h.eth.%s.%s'
%
(
self
.
workdir
,
sim_n
.
name
,
sim_h
.
name
)
def
net2host_shm_path
(
self
,
sim_n
,
sim_h
):
return
'%s/n2h.shm.%s.%s'
%
(
self
.
workdir
,
sim_n
.
name
,
sim_h
.
name
)
def
proxy_shm_path
(
self
,
sim
):
return
'%s/proxy.shm.%s'
%
(
self
.
shm_base
,
sim
.
name
)
...
...
experiments/simbricks/simulators.py
View file @
794a721c
...
...
@@ -137,6 +137,7 @@ class NetSim(Simulator):
def
__init__
(
self
):
self
.
nics
=
[]
self
.
hosts_direct
=
[]
self
.
net_listen
=
[]
self
.
net_connect
=
[]
super
().
__init__
()
...
...
@@ -155,6 +156,8 @@ class NetSim(Simulator):
sockets
.
append
((
n
,
env
.
nic_eth_path
(
n
)))
for
n
in
self
.
net_connect
:
sockets
.
append
((
n
,
env
.
n2n_eth_path
(
n
,
self
)))
for
h
in
self
.
hosts_direct
:
sockets
.
append
((
h
,
env
.
net2host_eth_path
(
self
,
h
)))
return
sockets
def
listen_sockets
(
self
,
env
):
...
...
@@ -164,7 +167,7 @@ class NetSim(Simulator):
return
listens
def
dependencies
(
self
):
return
self
.
nics
+
self
.
net_connect
return
self
.
nics
+
self
.
net_connect
+
self
.
hosts_direct
def
sockets_cleanup
(
self
,
env
):
return
[
s
for
(
_
,
s
)
in
self
.
listen_sockets
(
env
)]
...
...
@@ -191,6 +194,7 @@ class HostSim(Simulator):
def
__init__
(
self
):
self
.
pcidevs
:
tp
.
List
[
PCIDevSim
]
=
[]
self
.
net_directs
:
tp
.
List
[
NetSim
]
=
[]
super
().
__init__
()
def
full_name
(
self
):
...
...
@@ -203,6 +207,10 @@ class HostSim(Simulator):
dev
.
name
=
self
.
name
+
'.'
+
dev
.
name
self
.
pcidevs
.
append
(
dev
)
def
add_netdirect
(
self
,
net
:
NetSim
):
net
.
hosts_direct
.
append
(
self
)
self
.
net_directs
.
append
(
net
)
def
set_config
(
self
,
nc
:
NodeConfig
):
self
.
node_config
=
nc
...
...
@@ -275,6 +283,8 @@ class QemuHost(HostSim):
cmd
+=
',sync=off'
cmd
+=
' '
# qemu does not currently support net direct ports
assert
(
len
(
self
.
net_directs
)
==
0
)
return
cmd
class
Gem5Host
(
HostSim
):
...
...
@@ -329,6 +339,16 @@ class Gem5Host(HostSim):
if
cpu_type
==
'TimingSimpleCPU'
:
cmd
+=
':sync'
cmd
+=
' '
for
net
in
self
.
net_directs
:
cmd
+=
(
'--simbricks-eth-e1000=listen'
f
':
{
env
.
net2host_eth_path
(
net
,
self
)
}
'
f
':
{
env
.
net2host_shm_path
(
net
,
self
)
}
'
f
':latency=
{
net
.
eth_latency
}
ns'
f
':sync_interval=
{
net
.
sync_period
}
ns'
)
if
cpu_type
==
'TimingSimpleCPU'
:
cmd
+=
':sync'
cmd
+=
' '
return
cmd
...
...
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