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
Commit
84da17e3
authored
Feb 16, 2021
by
Antoine Kaufmann
Browse files
Format changes for google code style
parent
e888d686
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
76 additions
and
79 deletions
+76
-79
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
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,9 +31,10 @@
#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
,
...
...
@@ -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,8 +169,8 @@ 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
;
}
...
...
lib/simbricks/netif/netif.h
View file @
84da17e3
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,8 +156,7 @@ void Runner::MsiIssue(uint8_t vec) {
intr
->
inttype
=
SIMBRICKS_PROTO_PCIE_INT_MSI
;
// WMB();
intr
->
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_INTERRUPT
|
intr
->
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_INTERRUPT
|
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST
;
}
...
...
@@ -171,8 +170,7 @@ void Runner::MsiXIssue(uint8_t vec) {
intr
->
inttype
=
SIMBRICKS_PROTO_PCIE_INT_MSIX
;
// WMB();
intr
->
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_INTERRUPT
|
intr
->
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_INTERRUPT
|
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST
;
}
...
...
@@ -223,8 +221,7 @@ void Runner::H2DWrite(volatile struct SimbricksProtoPcieH2DWrite *write) {
wc
->
req_id
=
write
->
req_id
;
// WMB();
wc
->
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_WRITECOMP
|
wc
->
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_WRITECOMP
|
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST
;
}
...
...
@@ -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
()
{
...
...
lib/simbricks/nicbm/nicbm.h
View file @
84da17e3
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
...
...
@@ -279,8 +280,7 @@ int SimbricksNicIfSync(struct SimbricksNicIfParams *params,
if
(
d2h
==
NULL
)
{
ret
=
-
1
;
}
else
{
d2h
->
sync
.
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_SYNC
|
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
"
);
}
...
...
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
"
);
}
...
...
sims/nic/corundum/corundum_verilator.cc
View file @
84da17e3
...
...
@@ -370,8 +370,7 @@ void pci_rwcomp_issue(MMIOOp *op) {
wc
->
req_id
=
op
->
id
;
// WMB();
wc
->
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_WRITECOMP
|
wc
->
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_WRITECOMP
|
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST
;
}
else
{
rc
=
&
msg
->
readcomp
;
...
...
@@ -379,8 +378,7 @@ void pci_rwcomp_issue(MMIOOp *op) {
rc
->
req_id
=
op
->
id
;
// WMB();
rc
->
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_READCOMP
|
rc
->
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_READCOMP
|
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST
;
}
...
...
@@ -499,8 +497,7 @@ static void h2d_read(MMIOInterface &mmio,
rc
->
req_id
=
read
->
req_id
;
// WMB();
rc
->
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_READCOMP
|
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,
...
...
@@ -530,8 +527,7 @@ static void h2d_write(MMIOInterface &mmio,
wc
->
req_id
=
write
->
req_id
;
// WMB();
wc
->
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_WRITECOMP
|
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,8 +768,7 @@ void pci_msi_issue(uint8_t vec) {
intr
->
inttype
=
SIMBRICKS_PROTO_PCIE_INT_MSI
;
// WMB();
intr
->
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_INTERRUPT
|
intr
->
own_type
=
SIMBRICKS_PROTO_PCIE_D2H_MSG_INTERRUPT
|
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST
;
}
...
...
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
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
;
...
...
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