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
84da17e3
"git@developer.sourcefind.cn:cnjsdfcy/simbricks.git" did not exist on "15205fbcc73cd35c14e7b6abea69a7c557b7d5af"
Commit
84da17e3
authored
Feb 16, 2021
by
Antoine Kaufmann
Browse files
Format changes for google code style
parent
e888d686
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
78 additions
and
81 deletions
+78
-81
lib/simbricks/netif/netif.c
lib/simbricks/netif/netif.c
+13
-11
lib/simbricks/netif/netif.h
lib/simbricks/netif/netif.h
+5
-5
lib/simbricks/nicbm/nicbm.cc
lib/simbricks/nicbm/nicbm.cc
+10
-13
lib/simbricks/nicbm/nicbm.h
lib/simbricks/nicbm/nicbm.h
+1
-1
lib/simbricks/nicif/nicif.c
lib/simbricks/nicif/nicif.c
+6
-6
sims/net/switch/net_switch.cc
sims/net/switch/net_switch.cc
+4
-4
sims/net/tap/net_tap.c
sims/net/tap/net_tap.c
+2
-2
sims/net/wire/net_wire.c
sims/net/wire/net_wire.c
+7
-8
sims/nic/corundum/corundum_verilator.cc
sims/nic/corundum/corundum_verilator.cc
+15
-19
sims/nic/corundum/mem.cc
sims/nic/corundum/mem.cc
+2
-1
sims/nic/corundum_bm/tester.c
sims/nic/corundum_bm/tester.c
+4
-4
sims/nic/i40e_bm/i40e_adminq.cc
sims/nic/i40e_bm/i40e_adminq.cc
+4
-2
sims/nic/i40e_bm/i40e_bm.cc
sims/nic/i40e_bm/i40e_bm.cc
+1
-1
sims/nic/i40e_bm/i40e_bm.h
sims/nic/i40e_bm/i40e_bm.h
+2
-2
sims/nic/i40e_bm/i40e_lan.cc
sims/nic/i40e_bm/i40e_lan.cc
+2
-2
No files found.
lib/simbricks/netif/netif.c
View file @
84da17e3
...
...
@@ -22,7 +22,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include
<
simbricks/netif/netif.h
>
#include
"lib/
simbricks/netif/netif.h
"
#include <stdio.h>
#include <stdlib.h>
...
...
@@ -31,13 +31,14 @@
#include <sys/socket.h>
#include <unistd.h>
#include "lib/simbricks/netif/internal.h"
#include <simbricks/proto/base.h>
#include "lib/simbricks/netif/internal.h"
static
uint64_t
current_epoch
=
0
;
int
SimbricksNetIfInit
(
struct
SimbricksNetIf
*
nsif
,
const
char
*
eth_socket_path
,
int
*
sync_eth
)
{
int
*
sync_eth
)
{
struct
SimbricksProtoNetDevIntro
di
;
struct
SimbricksProtoNetNetIntro
ni
;
int
cfd
,
shm_fd
;
...
...
@@ -94,7 +95,7 @@ volatile union SimbricksProtoNetD2N *SimbricksNetIfD2NPoll(
struct
SimbricksNetIf
*
nsif
,
uint64_t
timestamp
)
{
volatile
union
SimbricksProtoNetD2N
*
msg
=
(
volatile
union
SimbricksProtoNetD2N
*
)(
nsif
->
d2n_queue
+
nsif
->
d2n_pos
*
nsif
->
d2n_elen
);
nsif
->
d2n_pos
*
nsif
->
d2n_elen
);
/* message not ready */
if
((
msg
->
dummy
.
own_type
&
SIMBRICKS_PROTO_NET_D2N_OWN_MASK
)
!=
...
...
@@ -111,7 +112,7 @@ volatile union SimbricksProtoNetD2N *SimbricksNetIfD2NPoll(
}
void
SimbricksNetIfD2NDone
(
struct
SimbricksNetIf
*
nsif
,
volatile
union
SimbricksProtoNetD2N
*
msg
)
{
volatile
union
SimbricksProtoNetD2N
*
msg
)
{
msg
->
dummy
.
own_type
=
(
msg
->
dummy
.
own_type
&
SIMBRICKS_PROTO_NET_D2N_MSG_MASK
)
|
SIMBRICKS_PROTO_NET_D2N_OWN_DEV
;
...
...
@@ -121,7 +122,7 @@ volatile union SimbricksProtoNetN2D *SimbricksNetIfN2DAlloc(
struct
SimbricksNetIf
*
nsif
,
uint64_t
timestamp
,
uint64_t
latency
)
{
volatile
union
SimbricksProtoNetN2D
*
msg
=
(
volatile
union
SimbricksProtoNetN2D
*
)(
nsif
->
n2d_queue
+
nsif
->
n2d_pos
*
nsif
->
n2d_elen
);
nsif
->
n2d_pos
*
nsif
->
n2d_elen
);
if
((
msg
->
dummy
.
own_type
&
SIMBRICKS_PROTO_NET_N2D_OWN_MASK
)
!=
SIMBRICKS_PROTO_NET_N2D_OWN_NET
)
{
...
...
@@ -136,7 +137,8 @@ volatile union SimbricksProtoNetN2D *SimbricksNetIfN2DAlloc(
}
int
SimbricksNetIfN2DSync
(
struct
SimbricksNetIf
*
nsif
,
uint64_t
timestamp
,
uint64_t
latency
,
uint64_t
sync_delay
,
int
sync_mode
)
{
uint64_t
latency
,
uint64_t
sync_delay
,
int
sync_mode
)
{
volatile
union
SimbricksProtoNetN2D
*
msg
;
volatile
struct
SimbricksProtoNetN2DSync
*
sync
;
int
do_sync
;
...
...
@@ -167,14 +169,14 @@ int SimbricksNetIfN2DSync(struct SimbricksNetIf *nsif, uint64_t timestamp,
sync
=
&
msg
->
sync
;
// WMB();
sync
->
own_type
=
SIMBRICKS_PROTO_NET_N2D_MSG_SYNC
|
SIMBRICKS_PROTO_NET_N2D_OWN_DEV
;
sync
->
own_type
=
SIMBRICKS_PROTO_NET_N2D_MSG_SYNC
|
SIMBRICKS_PROTO_NET_N2D_OWN_DEV
;
return
0
;
}
void
SimbricksNetIfAdvanceEpoch
(
uint64_t
timestamp
,
uint64_t
sync_delay
,
int
sync_mode
)
{
int
sync_mode
)
{
if
(
sync_mode
==
SIMBRICKS_PROTO_SYNC_BARRIER
)
{
if
(
timestamp
-
current_epoch
>=
sync_delay
)
{
current_epoch
=
timestamp
;
...
...
@@ -183,7 +185,7 @@ void SimbricksNetIfAdvanceEpoch(uint64_t timestamp, uint64_t sync_delay,
}
uint64_t
SimbricksNetIfAdvanceTime
(
uint64_t
timestamp
,
uint64_t
sync_delay
,
int
sync_mode
)
{
int
sync_mode
)
{
switch
(
sync_mode
)
{
case
SIMBRICKS_PROTO_SYNC_SIMBRICKS
:
return
timestamp
;
...
...
lib/simbricks/netif/netif.h
View file @
84da17e3
...
...
@@ -47,13 +47,13 @@ struct SimbricksNetIf {
};
int
SimbricksNetIfInit
(
struct
SimbricksNetIf
*
nsif
,
const
char
*
eth_socket_path
,
int
*
sync_eth
);
int
*
sync_eth
);
void
SimbricksNetIfCleanup
(
struct
SimbricksNetIf
*
nsif
);
volatile
union
SimbricksProtoNetD2N
*
SimbricksNetIfD2NPoll
(
struct
SimbricksNetIf
*
nsif
,
uint64_t
timestamp
);
void
SimbricksNetIfD2NDone
(
struct
SimbricksNetIf
*
nsif
,
volatile
union
SimbricksProtoNetD2N
*
msg
);
volatile
union
SimbricksProtoNetD2N
*
msg
);
static
inline
uint64_t
SimbricksNetIfD2NTimestamp
(
struct
SimbricksNetIf
*
nsif
)
{
return
nsif
->
d2n_timestamp
;
}
...
...
@@ -61,10 +61,10 @@ static inline uint64_t SimbricksNetIfD2NTimestamp(struct SimbricksNetIf *nsif) {
volatile
union
SimbricksProtoNetN2D
*
SimbricksNetIfN2DAlloc
(
struct
SimbricksNetIf
*
nsif
,
uint64_t
timestamp
,
uint64_t
latency
);
int
SimbricksNetIfN2DSync
(
struct
SimbricksNetIf
*
nsif
,
uint64_t
timestamp
,
uint64_t
latency
,
uint64_t
sync_delay
,
int
sync_mode
);
uint64_t
latency
,
uint64_t
sync_delay
,
int
sync_mode
);
void
SimbricksNetIfAdvanceEpoch
(
uint64_t
timestamp
,
uint64_t
sync_delay
,
int
sync_mode
);
int
sync_mode
);
uint64_t
SimbricksNetIfAdvanceTime
(
uint64_t
timestamp
,
uint64_t
sync_delay
,
int
sync_mode
);
int
sync_mode
);
#endif // SIMBRICKS_NETIF_NETIF_H_
lib/simbricks/nicbm/nicbm.cc
View file @
84da17e3
...
...
@@ -22,7 +22,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include
<
simbricks/nicbm/nicbm.h
>
#include
"lib/
simbricks/nicbm/nicbm.h
"
#include <signal.h>
#include <stdio.h>
...
...
@@ -156,9 +156,8 @@ void Runner::MsiIssue(uint8_t vec) {
intr
->
inttype
=
SIMBRICKS_PROTO_PCIE_INT_MSI
;
// WMB();
intr
->
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_INTERRUPT
|
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST
;
intr
->
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_INTERRUPT
|
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST
;
}
void
Runner
::
MsiXIssue
(
uint8_t
vec
)
{
...
...
@@ -171,9 +170,8 @@ void Runner::MsiXIssue(uint8_t vec) {
intr
->
inttype
=
SIMBRICKS_PROTO_PCIE_INT_MSIX
;
// WMB();
intr
->
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_INTERRUPT
|
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST
;
intr
->
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_INTERRUPT
|
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST
;
}
void
Runner
::
EventSchedule
(
TimedEvent
&
evt
)
{
...
...
@@ -223,9 +221,8 @@ void Runner::H2DWrite(volatile struct SimbricksProtoPcieH2DWrite *write) {
wc
->
req_id
=
write
->
req_id
;
// WMB();
wc
->
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_WRITECOMP
|
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST
;
wc
->
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_WRITECOMP
|
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST
;
}
void
Runner
::
H2DReadcomp
(
volatile
struct
SimbricksProtoPcieH2DReadcomp
*
rc
)
{
...
...
@@ -279,8 +276,8 @@ void Runner::EthSend(const void *data, size_t len) {
send
->
port
=
0
;
// single port
send
->
len
=
len
;
memcpy
((
void
*
)
send
->
data
,
data
,
len
);
send
->
own_type
=
SIMBRICKS_PROTO_NET_D2N_MSG_SEND
|
SIMBRICKS_PROTO_NET_D2N_OWN_NET
;
send
->
own_type
=
SIMBRICKS_PROTO_NET_D2N_MSG_SEND
|
SIMBRICKS_PROTO_NET_D2N_OWN_NET
;
}
void
Runner
::
PollH2D
()
{
...
...
@@ -433,7 +430,7 @@ int Runner::RunMain(int argc, char *argv[]) {
nsparams_
.
eth_latency
=
eth_latency
;
nsparams_
.
sync_delay
=
sync_period
;
assert
(
sync_mode
==
SIMBRICKS_PROTO_SYNC_SIMBRICKS
||
sync_mode
==
SIMBRICKS_PROTO_SYNC_BARRIER
);
sync_mode
==
SIMBRICKS_PROTO_SYNC_BARRIER
);
nsparams_
.
sync_mode
=
sync_mode
;
if
(
SimbricksNicIfInit
(
&
nsparams_
,
&
dintro_
))
{
...
...
lib/simbricks/nicbm/nicbm.h
View file @
84da17e3
...
...
@@ -179,7 +179,7 @@ class SimpleDevice : public Runner::Device {
}
void
RegWrite
(
uint8_t
bar
,
uint64_t
addr
,
const
void
*
src
,
size_t
len
)
override
{
size_t
len
)
override
{
assert
(
len
==
sizeof
(
TReg
));
TReg
r
;
memcpy
(
&
r
,
src
,
sizeof
(
r
));
...
...
lib/simbricks/nicif/nicif.c
View file @
84da17e3
...
...
@@ -22,7 +22,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include
<
simbricks/nicif/nicif.h
>
#include
"lib/
simbricks/nicif/nicif.h
"
#include <poll.h>
#include <stdio.h>
...
...
@@ -31,9 +31,10 @@
#include <sys/socket.h>
#include <unistd.h>
#include "lib/simbricks/nicif/internal.h"
#include <simbricks/proto/base.h>
#include "lib/simbricks/nicif/internal.h"
#define D2H_ELEN (9024 + 64)
#define D2H_ENUM 1024
...
...
@@ -178,7 +179,7 @@ static int accept_conns(struct SimbricksProtoPcieDevIntro *di, int pci_lfd,
}
int
SimbricksNicIfInit
(
struct
SimbricksNicIfParams
*
params
,
struct
SimbricksProtoPcieDevIntro
*
di
)
{
struct
SimbricksProtoPcieDevIntro
*
di
)
{
int
pci_lfd
=
-
1
,
eth_lfd
=
-
1
;
void
*
shmptr
;
size_t
shm_size
;
...
...
@@ -279,9 +280,8 @@ int SimbricksNicIfSync(struct SimbricksNicIfParams *params,
if
(
d2h
==
NULL
)
{
ret
=
-
1
;
}
else
{
d2h
->
sync
.
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_SYNC
|
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST
;
d2h
->
sync
.
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_SYNC
|
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST
;
}
}
}
...
...
sims/net/switch/net_switch.cc
View file @
84da17e3
...
...
@@ -94,8 +94,8 @@ static void forward_pkt(volatile struct SimbricksProtoNetD2NSend *tx,
memcpy
((
void
*
)
rx
->
data
,
(
void
*
)
tx
->
data
,
tx
->
len
);
// WMB();
rx
->
own_type
=
SIMBRICKS_PROTO_NET_N2D_MSG_RECV
|
SIMBRICKS_PROTO_NET_N2D_OWN_DEV
;
rx
->
own_type
=
SIMBRICKS_PROTO_NET_N2D_MSG_RECV
|
SIMBRICKS_PROTO_NET_N2D_OWN_DEV
;
}
else
{
fprintf
(
stderr
,
"forward_pkt: dropping packet
\n
"
);
}
...
...
@@ -169,7 +169,7 @@ int main(int argc, char *argv[]) {
case
'm'
:
sync_mode
=
strtol
(
optarg
,
NULL
,
0
);
assert
(
sync_mode
==
SIMBRICKS_PROTO_SYNC_SIMBRICKS
||
sync_mode
==
SIMBRICKS_PROTO_SYNC_BARRIER
);
sync_mode
==
SIMBRICKS_PROTO_SYNC_BARRIER
);
break
;
default:
...
...
@@ -194,7 +194,7 @@ int main(int argc, char *argv[]) {
// Sync all interfaces
for
(
auto
&
nsif
:
nsifs
)
{
if
(
SimbricksNetIfN2DSync
(
&
nsif
,
cur_ts
,
eth_latency
,
sync_period
,
sync_mode
)
!=
0
)
{
sync_mode
)
!=
0
)
{
fprintf
(
stderr
,
"SimbricksNetIfN2DSync failed
\n
"
);
abort
();
}
...
...
sims/net/tap/net_tap.c
View file @
84da17e3
...
...
@@ -117,8 +117,8 @@ static void *rx_handler(void *arg) {
#endif
// WMB();
rx
->
own_type
=
SIMBRICKS_PROTO_NET_N2D_MSG_RECV
|
SIMBRICKS_PROTO_NET_N2D_OWN_DEV
;
rx
->
own_type
=
SIMBRICKS_PROTO_NET_N2D_MSG_RECV
|
SIMBRICKS_PROTO_NET_N2D_OWN_DEV
;
}
}
...
...
sims/net/wire/net_wire.c
View file @
84da17e3
...
...
@@ -53,8 +53,7 @@ static void sigusr1_handler(int dummy) {
fprintf
(
stderr
,
"main_time = %lu
\n
"
,
cur_ts
);
}
static
void
move_pkt
(
struct
SimbricksNetIf
*
from
,
struct
SimbricksNetIf
*
to
)
{
static
void
move_pkt
(
struct
SimbricksNetIf
*
from
,
struct
SimbricksNetIf
*
to
)
{
volatile
union
SimbricksProtoNetD2N
*
msg_from
=
SimbricksNetIfD2NPoll
(
from
,
cur_ts
);
volatile
union
SimbricksProtoNetN2D
*
msg_to
;
...
...
@@ -88,8 +87,8 @@ static void move_pkt(struct SimbricksNetIf *from,
memcpy
((
void
*
)
rx
->
data
,
(
void
*
)
tx
->
data
,
tx
->
len
);
// WMB();
rx
->
own_type
=
SIMBRICKS_PROTO_NET_N2D_MSG_RECV
|
SIMBRICKS_PROTO_NET_N2D_OWN_DEV
;
rx
->
own_type
=
SIMBRICKS_PROTO_NET_N2D_MSG_RECV
|
SIMBRICKS_PROTO_NET_N2D_OWN_DEV
;
}
else
{
fprintf
(
stderr
,
"move_pkt: dropping packet
\n
"
);
}
...
...
@@ -141,7 +140,7 @@ int main(int argc, char *argv[]) {
}
assert
(
sync_mode
==
SIMBRICKS_PROTO_SYNC_SIMBRICKS
||
sync_mode
==
SIMBRICKS_PROTO_SYNC_BARRIER
);
sync_mode
==
SIMBRICKS_PROTO_SYNC_BARRIER
);
sync_a
=
sync_b
=
1
;
if
(
SimbricksNetIfInit
(
&
nsif_a
,
argv
[
1
],
&
sync_a
)
!=
0
)
{
...
...
@@ -154,12 +153,12 @@ int main(int argc, char *argv[]) {
printf
(
"start polling
\n
"
);
while
(
!
exiting
)
{
if
(
SimbricksNetIfN2DSync
(
&
nsif_a
,
cur_ts
,
eth_latency
,
sync_period
,
sync_mode
)
!=
0
)
{
sync_mode
)
!=
0
)
{
fprintf
(
stderr
,
"SimbricksNetIfN2DSync(nsif_a) failed
\n
"
);
abort
();
}
if
(
SimbricksNetIfN2DSync
(
&
nsif_b
,
cur_ts
,
eth_latency
,
sync_period
,
sync_mode
)
!=
0
)
{
sync_mode
)
!=
0
)
{
fprintf
(
stderr
,
"SimbricksNetIfN2DSync(nsif_a) failed
\n
"
);
abort
();
}
...
...
@@ -175,7 +174,7 @@ int main(int argc, char *argv[]) {
if
(
sync_a
&&
sync_b
)
cur_ts
=
SimbricksNetIfAdvanceTime
(
ts_a
<=
ts_b
?
ts_a
:
ts_b
,
sync_period
,
sync_mode
);
sync_period
,
sync_mode
);
else
if
(
sync_a
)
cur_ts
=
SimbricksNetIfAdvanceTime
(
ts_a
,
sync_period
,
sync_mode
);
else
if
(
sync_b
)
...
...
sims/nic/corundum/corundum_verilator.cc
View file @
84da17e3
...
...
@@ -370,18 +370,16 @@ void pci_rwcomp_issue(MMIOOp *op) {
wc
->
req_id
=
op
->
id
;
// WMB();
wc
->
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_WRITECOMP
|
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST
;
wc
->
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_WRITECOMP
|
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST
;
}
else
{
rc
=
&
msg
->
readcomp
;
memcpy
((
void
*
)
rc
->
data
,
&
op
->
value
,
op
->
len
);
rc
->
req_id
=
op
->
id
;
// WMB();
rc
->
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_READCOMP
|
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST
;
rc
->
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_READCOMP
|
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST
;
}
delete
op
;
...
...
@@ -499,9 +497,8 @@ static void h2d_read(MMIOInterface &mmio,
rc
->
req_id
=
read
->
req_id
;
// WMB();
rc
->
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_READCOMP
|
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST
;
rc
->
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_READCOMP
|
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST
;
}
else
{
/*printf("read(bar=%u, off=%lu, len=%u) = %lu\n", read->bar, read->offset,
read->len, val);*/
...
...
@@ -530,9 +527,8 @@ static void h2d_write(MMIOInterface &mmio,
wc
->
req_id
=
write
->
req_id
;
// WMB();
wc
->
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_WRITECOMP
|
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST
;
wc
->
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_WRITECOMP
|
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST
;
}
else
{
mmio
.
issueWrite
(
write
->
req_id
,
write
->
offset
,
write
->
len
,
val
);
}
...
...
@@ -608,8 +604,8 @@ class EthernetTx {
send
->
timestamp
=
main_time
+
eth_latency
;
// WMB();
send
->
own_type
=
SIMBRICKS_PROTO_NET_D2N_MSG_SEND
|
SIMBRICKS_PROTO_NET_D2N_OWN_NET
;
send
->
own_type
=
SIMBRICKS_PROTO_NET_D2N_MSG_SEND
|
SIMBRICKS_PROTO_NET_D2N_OWN_NET
;
#ifdef ETH_DEBUG
std
::
cerr
<<
main_time
<<
" EthernetTx: packet len="
<<
std
::
hex
...
...
@@ -656,7 +652,8 @@ class EthernetRx {
public:
explicit
EthernetRx
(
Vinterface
&
top_
)
:
top
(
top_
),
fifo_pos_rd
(
0
),
fifo_pos_wr
(
0
),
packet_off
(
0
)
{
for
(
size_t
i
=
0
;
i
<
FIFO_SIZE
;
i
++
)
fifo_lens
[
i
]
=
0
;
for
(
size_t
i
=
0
;
i
<
FIFO_SIZE
;
i
++
)
fifo_lens
[
i
]
=
0
;
}
void
packet_received
(
const
void
*
data
,
size_t
len
)
{
...
...
@@ -771,9 +768,8 @@ void pci_msi_issue(uint8_t vec) {
intr
->
inttype
=
SIMBRICKS_PROTO_PCIE_INT_MSI
;
// WMB();
intr
->
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_INTERRUPT
|
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST
;
intr
->
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_INTERRUPT
|
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST
;
}
static
void
msi_step
(
Vinterface
&
top
,
PCICoordinator
&
coord
)
{
...
...
@@ -842,7 +838,7 @@ int main(int argc, char *argv[]) {
nsparams
.
eth_latency
=
eth_latency
;
nsparams
.
sync_delay
=
sync_period
;
assert
(
sync_mode
==
SIMBRICKS_PROTO_SYNC_SIMBRICKS
||
sync_mode
==
SIMBRICKS_PROTO_SYNC_BARRIER
);
sync_mode
==
SIMBRICKS_PROTO_SYNC_BARRIER
);
nsparams
.
sync_mode
=
sync_mode
;
if
(
SimbricksNicIfInit
(
&
nsparams
,
&
di
))
{
...
...
sims/nic/corundum/mem.cc
View file @
84da17e3
...
...
@@ -73,7 +73,8 @@ void MemWriter::step() {
p
.
mem_addr
[
0
]
=
p
.
mem_addr
[
1
]
=
p
.
mem_addr
[
2
]
=
0
;
p
.
mem_be
[
0
]
=
p
.
mem_be
[
1
]
=
p
.
mem_be
[
2
]
=
p
.
mem_be
[
3
]
=
0
;
p
.
mem_valid
=
0
;
for
(
size_t
i
=
0
;
i
<
data_byte_width
/
4
;
i
++
)
p
.
mem_data
[
i
]
=
0
;
for
(
size_t
i
=
0
;
i
<
data_byte_width
/
4
;
i
++
)
p
.
mem_data
[
i
]
=
0
;
/* put data bytes in the right places */
size_t
off
=
data_offset
;
...
...
sims/nic/corundum_bm/tester.c
View file @
84da17e3
...
...
@@ -120,8 +120,8 @@ volatile union SimbricksProtoPcieH2D *h2d_alloc() {
volatile
union
SimbricksProtoPcieD2H
*
d2h_poll
()
{
volatile
union
SimbricksProtoPcieD2H
*
msg
;
msg
=
(
volatile
union
SimbricksProtoPcieD2H
*
)
(
d2h_queue
+
d2h_pos
*
d2h_elen
);
msg
=
(
volatile
union
SimbricksProtoPcieD2H
*
)
(
d2h_queue
+
d2h_pos
*
d2h_elen
);
if
((
msg
->
dummy
.
own_type
&
SIMBRICKS_PROTO_PCIE_D2H_OWN_MASK
)
==
SIMBRICKS_PROTO_PCIE_D2H_OWN_DEV
)
{
return
NULL
;
...
...
@@ -143,8 +143,8 @@ static void dev_read(uint64_t offset, uint16_t len) {
read
->
offset
=
offset
;
read
->
len
=
len
;
read
->
bar
=
0
;
read
->
own_type
=
SIMBRICKS_PROTO_PCIE_H2D_MSG_READ
|
SIMBRICKS_PROTO_PCIE_H2D_OWN_DEV
;
read
->
own_type
=
SIMBRICKS_PROTO_PCIE_H2D_MSG_READ
|
SIMBRICKS_PROTO_PCIE_H2D_OWN_DEV
;
volatile
union
SimbricksProtoPcieD2H
*
d2h_msg
=
NULL
;
while
(
d2h_msg
==
NULL
)
{
...
...
sims/nic/i40e_bm/i40e_adminq.cc
View file @
84da17e3
...
...
@@ -391,7 +391,8 @@ void queue_admin_tx::admin_desc_ctx::process() {
#endif
struct
i40e_aqc_query_vsi_bw_config_resp
bwc
;
memset
(
&
bwc
,
0
,
sizeof
(
bwc
));
for
(
size_t
i
=
0
;
i
<
8
;
i
++
)
bwc
.
qs_handles
[
i
]
=
0xffff
;
for
(
size_t
i
=
0
;
i
<
8
;
i
++
)
bwc
.
qs_handles
[
i
]
=
0xffff
;
desc_complete_indir
(
0
,
&
bwc
,
sizeof
(
bwc
));
}
else
if
(
d
->
opcode
==
i40e_aqc_opc_query_vsi_ets_sla_config
)
{
#ifdef DEBUG_ADMINQ
...
...
@@ -399,7 +400,8 @@ void queue_admin_tx::admin_desc_ctx::process() {
#endif
struct
i40e_aqc_query_vsi_ets_sla_config_resp
sla
;
memset
(
&
sla
,
0
,
sizeof
(
sla
));
for
(
size_t
i
=
0
;
i
<
8
;
i
++
)
sla
.
share_credits
[
i
]
=
127
;
for
(
size_t
i
=
0
;
i
<
8
;
i
++
)
sla
.
share_credits
[
i
]
=
127
;
desc_complete_indir
(
0
,
&
sla
,
sizeof
(
sla
));
}
else
if
(
d
->
opcode
==
i40e_aqc_opc_remove_macvlan
)
{
#ifdef DEBUG_ADMINQ
...
...
sims/nic/i40e_bm/i40e_bm.cc
View file @
84da17e3
...
...
@@ -114,7 +114,7 @@ uint32_t i40e_bm::RegRead32(uint8_t bar, uint64_t addr) {
}
void
i40e_bm
::
RegWrite
(
uint8_t
bar
,
uint64_t
addr
,
const
void
*
src
,
size_t
len
)
{
size_t
len
)
{
const
uint32_t
*
src_p
=
reinterpret_cast
<
const
uint32_t
*>
(
src
);
if
(
len
==
4
)
{
...
...
sims/nic/i40e_bm/i40e_bm.h
View file @
84da17e3
...
...
@@ -585,8 +585,8 @@ class i40e_bm : public nicbm::Runner::Device {
void
SetupIntro
(
struct
SimbricksProtoPcieDevIntro
&
di
)
override
;
void
RegRead
(
uint8_t
bar
,
uint64_t
addr
,
void
*
dest
,
size_t
len
)
override
;
virtual
uint32_t
RegRead32
(
uint8_t
bar
,
uint64_t
addr
);
void
RegWrite
(
uint8_t
bar
,
uint64_t
addr
,
const
void
*
src
,
size_t
len
)
override
;
void
RegWrite
(
uint8_t
bar
,
uint64_t
addr
,
const
void
*
src
,
size_t
len
)
override
;
virtual
void
RegWrite32
(
uint8_t
bar
,
uint64_t
addr
,
uint32_t
val
);
void
DmaComplete
(
nicbm
::
DMAOp
&
op
)
override
;
void
EthRx
(
uint8_t
port
,
const
void
*
data
,
size_t
len
)
override
;
...
...
sims/nic/i40e_bm/i40e_lan.cc
View file @
84da17e3
...
...
@@ -169,8 +169,8 @@ void lan_queue_base::enable() {
qctx_fetch
*
qf
=
new
qctx_fetch
(
*
this
);
qf
->
write_
=
false
;
qf
->
dma_addr_
=
((
fpm_basereg
&
I40E_GLHMC_LANTXBASE_FPMLANTXBASE_MASK
)
>>
I40E_GLHMC_LANTXBASE_FPMLANTXBASE_SHIFT
)
*
512
;
I40E_GLHMC_LANTXBASE_FPMLANTXBASE_SHIFT
)
*
512
;
qf
->
dma_addr_
+=
ctx_size
*
idx
;
qf
->
len_
=
ctx_size
;
qf
->
data_
=
ctx
;
...
...
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