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
953b9aa7
Commit
953b9aa7
authored
Sep 24, 2024
by
Hejing Li
Browse files
pcidev.py: fix sockets
parent
a7ae28b4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
7 deletions
+16
-7
experiments/simbricks/orchestration/instantiation/base.py
experiments/simbricks/orchestration/instantiation/base.py
+1
-1
experiments/simbricks/orchestration/simulation/pcidev.py
experiments/simbricks/orchestration/simulation/pcidev.py
+15
-6
No files found.
experiments/simbricks/orchestration/instantiation/base.py
View file @
953b9aa7
...
...
@@ -217,7 +217,7 @@ class Instantiation(util_base.IdObj):
sockets
:
list
[
Socket
]
=
[],
)
->
None
:
wait_socks
=
list
(
map
(
lambda
sock
:
sock
.
_path
,
sockets
))
await
executor
.
await_files
(
wait_socks
,
verbose
=
self
.
verbos
e
)
await
executor
.
await_files
(
wait_socks
,
verbose
=
Tru
e
)
# TODO: add more methods constructing paths as required by methods in simulators or image handling classes
...
...
experiments/simbricks/orchestration/simulation/pcidev.py
View file @
953b9aa7
...
...
@@ -46,10 +46,11 @@ class PCIDevSim(base.Simulator):
return
False
def
sockets_cleanup
(
self
,
inst
:
inst_base
.
Instantiation
)
->
tp
.
List
[
str
]:
return
[
inst
.
dev
_
pci
_path
(
self
),
inst
.
dev_shm_path
(
self
)]
return
[
inst
_base
.
Socket
(
f
'
{
inst
.
_env
.
_workdir
}
/
dev
.
pci
.
{
self
.
name
}
'
),
inst
_base
.
Socket
(
f
'
{
inst
.
_env
.
_shm_base
}
/dev.shm.
{
self
.
name
}
'
)]
def
sockets_wait
(
self
,
inst
:
inst_base
.
Instantiation
)
->
tp
.
List
[
str
]:
return
[
inst
.
dev_pci_path
(
self
)]
return
[
inst_base
.
Socket
(
f
'
{
inst
.
_env
.
_workdir
}
/dev.pci.
{
self
.
name
}
'
)]
...
...
@@ -66,7 +67,8 @@ class NICSim(PCIDevSim):
def
basic_args
(
self
,
inst
:
inst_base
.
Instantiation
,
extra
:
tp
.
Optional
[
str
]
=
None
)
->
str
:
# TODO: need some fix. how to handle multiple nics in one simulator?
nic_comp
=
self
.
_components
.
pop
()
for
c
in
self
.
_components
:
nic_comp
=
c
nic_pci_chan_comp
=
nic_comp
.
_pci_if
.
channel
nic_eth_chan_comp
=
nic_comp
.
_eth_if
.
channel
nic_pci_chan_sim
=
self
.
_simulation
.
retrieve_or_create_channel
(
nic_pci_chan_comp
)
...
...
@@ -74,7 +76,7 @@ class NICSim(PCIDevSim):
cmd
=
(
f
'
{
inst
.
get_socket
(
nic_comp
.
_pci_if
,
set
([
inst_base
.
SockType
.
LISTEN
]))
}
{
inst
.
get_socket
(
nic_comp
.
_eth_if
,
set
([
inst_base
.
SockType
.
LISTEN
]))
}
'
f
'
{
inst
.
_env
.
_workdir
}
/dev.pci.
{
self
.
name
}
{
inst
.
_env
.
_workdir
}
/nic.eth.
{
self
.
name
}
'
f
'
{
inst
.
_env
.
_shm_base
}
/dev.shm.
{
self
.
name
}
{
nic_pci_chan_sim
.
_synchronized
}
{
self
.
start_tick
}
'
f
'
{
nic_pci_chan_sim
.
sync_period
}
{
nic_pci_chan_comp
.
latency
}
{
nic_eth_chan_comp
.
latency
}
'
)
...
...
@@ -98,10 +100,14 @@ class NICSim(PCIDevSim):
return
True
def
sockets_cleanup
(
self
,
inst
:
inst_base
.
Instantiation
)
->
tp
.
List
[
str
]:
return
super
().
sockets_cleanup
(
inst
)
+
[
inst
.
nic_eth_path
(
self
)]
for
c
in
self
.
_components
:
nic_comp
=
c
return
super
().
sockets_cleanup
(
inst
)
+
[
inst_base
.
Socket
(
f
'
{
inst
.
_env
.
_workdir
}
/nic.eth.
{
self
.
name
}
'
)]
def
sockets_wait
(
self
,
inst
:
inst_base
.
Instantiation
)
->
tp
.
List
[
str
]:
return
super
().
sockets_wait
(
inst
)
+
[
inst
.
nic_eth_path
(
self
)]
for
c
in
self
.
_components
:
nic_comp
=
c
return
super
().
sockets_wait
(
inst
)
+
[
inst_base
.
Socket
(
f
'
{
inst
.
_env
.
_workdir
}
/nic.eth.
{
self
.
name
}
'
)]
class
I40eNicSim
(
NICSim
):
...
...
@@ -134,6 +140,9 @@ class CorundumVerilatorNICSim(NICSim):
return
512
def
run_cmd
(
self
,
inst
:
inst_base
.
Instantiation
)
->
str
:
print
(
"run cmd"
)
print
(
self
.
basic_run_cmd
(
inst
,
'/corundum/corundum_verilator'
))
return
self
.
basic_run_cmd
(
inst
,
'/corundum/corundum_verilator'
,
str
(
self
.
clock_freq
)
)
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