Commit 84da17e3 authored by Antoine Kaufmann's avatar Antoine Kaufmann
Browse files

Format changes for google code style

parent e888d686
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * 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 <stdio.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -31,9 +31,10 @@ ...@@ -31,9 +31,10 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <unistd.h> #include <unistd.h>
#include "lib/simbricks/netif/internal.h"
#include <simbricks/proto/base.h> #include <simbricks/proto/base.h>
#include "lib/simbricks/netif/internal.h"
static uint64_t current_epoch = 0; static uint64_t current_epoch = 0;
int SimbricksNetIfInit(struct SimbricksNetIf *nsif, const char *eth_socket_path, int SimbricksNetIfInit(struct SimbricksNetIf *nsif, const char *eth_socket_path,
...@@ -136,7 +137,8 @@ volatile union SimbricksProtoNetN2D *SimbricksNetIfN2DAlloc( ...@@ -136,7 +137,8 @@ volatile union SimbricksProtoNetN2D *SimbricksNetIfN2DAlloc(
} }
int SimbricksNetIfN2DSync(struct SimbricksNetIf *nsif, uint64_t timestamp, 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 union SimbricksProtoNetN2D *msg;
volatile struct SimbricksProtoNetN2DSync *sync; volatile struct SimbricksProtoNetN2DSync *sync;
int do_sync; int do_sync;
...@@ -167,8 +169,8 @@ int SimbricksNetIfN2DSync(struct SimbricksNetIf *nsif, uint64_t timestamp, ...@@ -167,8 +169,8 @@ int SimbricksNetIfN2DSync(struct SimbricksNetIf *nsif, uint64_t timestamp,
sync = &msg->sync; sync = &msg->sync;
// WMB(); // WMB();
sync->own_type = SIMBRICKS_PROTO_NET_N2D_MSG_SYNC | sync->own_type =
SIMBRICKS_PROTO_NET_N2D_OWN_DEV; SIMBRICKS_PROTO_NET_N2D_MSG_SYNC | SIMBRICKS_PROTO_NET_N2D_OWN_DEV;
return 0; return 0;
} }
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * 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 <signal.h>
#include <stdio.h> #include <stdio.h>
...@@ -156,8 +156,7 @@ void Runner::MsiIssue(uint8_t vec) { ...@@ -156,8 +156,7 @@ void Runner::MsiIssue(uint8_t vec) {
intr->inttype = SIMBRICKS_PROTO_PCIE_INT_MSI; intr->inttype = SIMBRICKS_PROTO_PCIE_INT_MSI;
// WMB(); // WMB();
intr->own_type = intr->own_type = SIMBRICKS_PROTO_PCIE_D2H_MSG_INTERRUPT |
SIMBRICKS_PROTO_PCIE_D2H_MSG_INTERRUPT |
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST; SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST;
} }
...@@ -171,8 +170,7 @@ void Runner::MsiXIssue(uint8_t vec) { ...@@ -171,8 +170,7 @@ void Runner::MsiXIssue(uint8_t vec) {
intr->inttype = SIMBRICKS_PROTO_PCIE_INT_MSIX; intr->inttype = SIMBRICKS_PROTO_PCIE_INT_MSIX;
// WMB(); // WMB();
intr->own_type = intr->own_type = SIMBRICKS_PROTO_PCIE_D2H_MSG_INTERRUPT |
SIMBRICKS_PROTO_PCIE_D2H_MSG_INTERRUPT |
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST; SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST;
} }
...@@ -223,8 +221,7 @@ void Runner::H2DWrite(volatile struct SimbricksProtoPcieH2DWrite *write) { ...@@ -223,8 +221,7 @@ void Runner::H2DWrite(volatile struct SimbricksProtoPcieH2DWrite *write) {
wc->req_id = write->req_id; wc->req_id = write->req_id;
// WMB(); // WMB();
wc->own_type = wc->own_type = SIMBRICKS_PROTO_PCIE_D2H_MSG_WRITECOMP |
SIMBRICKS_PROTO_PCIE_D2H_MSG_WRITECOMP |
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST; SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST;
} }
...@@ -279,8 +276,8 @@ void Runner::EthSend(const void *data, size_t len) { ...@@ -279,8 +276,8 @@ void Runner::EthSend(const void *data, size_t len) {
send->port = 0; // single port send->port = 0; // single port
send->len = len; send->len = len;
memcpy((void *)send->data, data, len); memcpy((void *)send->data, data, len);
send->own_type = SIMBRICKS_PROTO_NET_D2N_MSG_SEND | send->own_type =
SIMBRICKS_PROTO_NET_D2N_OWN_NET; SIMBRICKS_PROTO_NET_D2N_MSG_SEND | SIMBRICKS_PROTO_NET_D2N_OWN_NET;
} }
void Runner::PollH2D() { void Runner::PollH2D() {
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * 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 <poll.h>
#include <stdio.h> #include <stdio.h>
...@@ -31,9 +31,10 @@ ...@@ -31,9 +31,10 @@
#include <sys/socket.h> #include <sys/socket.h>
#include <unistd.h> #include <unistd.h>
#include "lib/simbricks/nicif/internal.h"
#include <simbricks/proto/base.h> #include <simbricks/proto/base.h>
#include "lib/simbricks/nicif/internal.h"
#define D2H_ELEN (9024 + 64) #define D2H_ELEN (9024 + 64)
#define D2H_ENUM 1024 #define D2H_ENUM 1024
...@@ -279,8 +280,7 @@ int SimbricksNicIfSync(struct SimbricksNicIfParams *params, ...@@ -279,8 +280,7 @@ int SimbricksNicIfSync(struct SimbricksNicIfParams *params,
if (d2h == NULL) { if (d2h == NULL) {
ret = -1; ret = -1;
} else { } else {
d2h->sync.own_type = d2h->sync.own_type = SIMBRICKS_PROTO_PCIE_D2H_MSG_SYNC |
SIMBRICKS_PROTO_PCIE_D2H_MSG_SYNC |
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST; SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST;
} }
} }
......
...@@ -94,8 +94,8 @@ static void forward_pkt(volatile struct SimbricksProtoNetD2NSend *tx, ...@@ -94,8 +94,8 @@ static void forward_pkt(volatile struct SimbricksProtoNetD2NSend *tx,
memcpy((void *)rx->data, (void *)tx->data, tx->len); memcpy((void *)rx->data, (void *)tx->data, tx->len);
// WMB(); // WMB();
rx->own_type = SIMBRICKS_PROTO_NET_N2D_MSG_RECV | rx->own_type =
SIMBRICKS_PROTO_NET_N2D_OWN_DEV; SIMBRICKS_PROTO_NET_N2D_MSG_RECV | SIMBRICKS_PROTO_NET_N2D_OWN_DEV;
} else { } else {
fprintf(stderr, "forward_pkt: dropping packet\n"); fprintf(stderr, "forward_pkt: dropping packet\n");
} }
......
...@@ -117,8 +117,8 @@ static void *rx_handler(void *arg) { ...@@ -117,8 +117,8 @@ static void *rx_handler(void *arg) {
#endif #endif
// WMB(); // WMB();
rx->own_type = SIMBRICKS_PROTO_NET_N2D_MSG_RECV | rx->own_type =
SIMBRICKS_PROTO_NET_N2D_OWN_DEV; SIMBRICKS_PROTO_NET_N2D_MSG_RECV | SIMBRICKS_PROTO_NET_N2D_OWN_DEV;
} }
} }
......
...@@ -53,8 +53,7 @@ static void sigusr1_handler(int dummy) { ...@@ -53,8 +53,7 @@ static void sigusr1_handler(int dummy) {
fprintf(stderr, "main_time = %lu\n", cur_ts); fprintf(stderr, "main_time = %lu\n", cur_ts);
} }
static void move_pkt(struct SimbricksNetIf *from, static void move_pkt(struct SimbricksNetIf *from, struct SimbricksNetIf *to) {
struct SimbricksNetIf *to) {
volatile union SimbricksProtoNetD2N *msg_from = volatile union SimbricksProtoNetD2N *msg_from =
SimbricksNetIfD2NPoll(from, cur_ts); SimbricksNetIfD2NPoll(from, cur_ts);
volatile union SimbricksProtoNetN2D *msg_to; volatile union SimbricksProtoNetN2D *msg_to;
...@@ -88,8 +87,8 @@ static void move_pkt(struct SimbricksNetIf *from, ...@@ -88,8 +87,8 @@ static void move_pkt(struct SimbricksNetIf *from,
memcpy((void *)rx->data, (void *)tx->data, tx->len); memcpy((void *)rx->data, (void *)tx->data, tx->len);
// WMB(); // WMB();
rx->own_type = SIMBRICKS_PROTO_NET_N2D_MSG_RECV | rx->own_type =
SIMBRICKS_PROTO_NET_N2D_OWN_DEV; SIMBRICKS_PROTO_NET_N2D_MSG_RECV | SIMBRICKS_PROTO_NET_N2D_OWN_DEV;
} else { } else {
fprintf(stderr, "move_pkt: dropping packet\n"); fprintf(stderr, "move_pkt: dropping packet\n");
} }
......
...@@ -370,8 +370,7 @@ void pci_rwcomp_issue(MMIOOp *op) { ...@@ -370,8 +370,7 @@ void pci_rwcomp_issue(MMIOOp *op) {
wc->req_id = op->id; wc->req_id = op->id;
// WMB(); // WMB();
wc->own_type = wc->own_type = SIMBRICKS_PROTO_PCIE_D2H_MSG_WRITECOMP |
SIMBRICKS_PROTO_PCIE_D2H_MSG_WRITECOMP |
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST; SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST;
} else { } else {
rc = &msg->readcomp; rc = &msg->readcomp;
...@@ -379,8 +378,7 @@ void pci_rwcomp_issue(MMIOOp *op) { ...@@ -379,8 +378,7 @@ void pci_rwcomp_issue(MMIOOp *op) {
rc->req_id = op->id; rc->req_id = op->id;
// WMB(); // WMB();
rc->own_type = rc->own_type = SIMBRICKS_PROTO_PCIE_D2H_MSG_READCOMP |
SIMBRICKS_PROTO_PCIE_D2H_MSG_READCOMP |
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST; SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST;
} }
...@@ -499,8 +497,7 @@ static void h2d_read(MMIOInterface &mmio, ...@@ -499,8 +497,7 @@ static void h2d_read(MMIOInterface &mmio,
rc->req_id = read->req_id; rc->req_id = read->req_id;
// WMB(); // WMB();
rc->own_type = rc->own_type = SIMBRICKS_PROTO_PCIE_D2H_MSG_READCOMP |
SIMBRICKS_PROTO_PCIE_D2H_MSG_READCOMP |
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST; SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST;
} else { } else {
/*printf("read(bar=%u, off=%lu, len=%u) = %lu\n", read->bar, read->offset, /*printf("read(bar=%u, off=%lu, len=%u) = %lu\n", read->bar, read->offset,
...@@ -530,8 +527,7 @@ static void h2d_write(MMIOInterface &mmio, ...@@ -530,8 +527,7 @@ static void h2d_write(MMIOInterface &mmio,
wc->req_id = write->req_id; wc->req_id = write->req_id;
// WMB(); // WMB();
wc->own_type = wc->own_type = SIMBRICKS_PROTO_PCIE_D2H_MSG_WRITECOMP |
SIMBRICKS_PROTO_PCIE_D2H_MSG_WRITECOMP |
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST; SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST;
} else { } else {
mmio.issueWrite(write->req_id, write->offset, write->len, val); mmio.issueWrite(write->req_id, write->offset, write->len, val);
...@@ -608,8 +604,8 @@ class EthernetTx { ...@@ -608,8 +604,8 @@ class EthernetTx {
send->timestamp = main_time + eth_latency; send->timestamp = main_time + eth_latency;
// WMB(); // WMB();
send->own_type = SIMBRICKS_PROTO_NET_D2N_MSG_SEND | send->own_type =
SIMBRICKS_PROTO_NET_D2N_OWN_NET; SIMBRICKS_PROTO_NET_D2N_MSG_SEND | SIMBRICKS_PROTO_NET_D2N_OWN_NET;
#ifdef ETH_DEBUG #ifdef ETH_DEBUG
std::cerr << main_time << " EthernetTx: packet len=" << std::hex std::cerr << main_time << " EthernetTx: packet len=" << std::hex
...@@ -656,7 +652,8 @@ class EthernetRx { ...@@ -656,7 +652,8 @@ class EthernetRx {
public: public:
explicit EthernetRx(Vinterface &top_) explicit EthernetRx(Vinterface &top_)
: top(top_), fifo_pos_rd(0), fifo_pos_wr(0), packet_off(0) { : 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) { void packet_received(const void *data, size_t len) {
...@@ -771,8 +768,7 @@ void pci_msi_issue(uint8_t vec) { ...@@ -771,8 +768,7 @@ void pci_msi_issue(uint8_t vec) {
intr->inttype = SIMBRICKS_PROTO_PCIE_INT_MSI; intr->inttype = SIMBRICKS_PROTO_PCIE_INT_MSI;
// WMB(); // WMB();
intr->own_type = intr->own_type = SIMBRICKS_PROTO_PCIE_D2H_MSG_INTERRUPT |
SIMBRICKS_PROTO_PCIE_D2H_MSG_INTERRUPT |
SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST; SIMBRICKS_PROTO_PCIE_D2H_OWN_HOST;
} }
......
...@@ -73,7 +73,8 @@ void MemWriter::step() { ...@@ -73,7 +73,8 @@ void MemWriter::step() {
p.mem_addr[0] = p.mem_addr[1] = p.mem_addr[2] = 0; 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_be[0] = p.mem_be[1] = p.mem_be[2] = p.mem_be[3] = 0;
p.mem_valid = 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 */ /* put data bytes in the right places */
size_t off = data_offset; size_t off = data_offset;
......
...@@ -120,8 +120,8 @@ volatile union SimbricksProtoPcieH2D *h2d_alloc() { ...@@ -120,8 +120,8 @@ volatile union SimbricksProtoPcieH2D *h2d_alloc() {
volatile union SimbricksProtoPcieD2H *d2h_poll() { volatile union SimbricksProtoPcieD2H *d2h_poll() {
volatile union SimbricksProtoPcieD2H *msg; volatile union SimbricksProtoPcieD2H *msg;
msg = (volatile union SimbricksProtoPcieD2H *) msg =
(d2h_queue + d2h_pos * d2h_elen); (volatile union SimbricksProtoPcieD2H *)(d2h_queue + d2h_pos * d2h_elen);
if ((msg->dummy.own_type & SIMBRICKS_PROTO_PCIE_D2H_OWN_MASK) == if ((msg->dummy.own_type & SIMBRICKS_PROTO_PCIE_D2H_OWN_MASK) ==
SIMBRICKS_PROTO_PCIE_D2H_OWN_DEV) { SIMBRICKS_PROTO_PCIE_D2H_OWN_DEV) {
return NULL; return NULL;
...@@ -143,8 +143,8 @@ static void dev_read(uint64_t offset, uint16_t len) { ...@@ -143,8 +143,8 @@ static void dev_read(uint64_t offset, uint16_t len) {
read->offset = offset; read->offset = offset;
read->len = len; read->len = len;
read->bar = 0; read->bar = 0;
read->own_type = SIMBRICKS_PROTO_PCIE_H2D_MSG_READ | read->own_type =
SIMBRICKS_PROTO_PCIE_H2D_OWN_DEV; SIMBRICKS_PROTO_PCIE_H2D_MSG_READ | SIMBRICKS_PROTO_PCIE_H2D_OWN_DEV;
volatile union SimbricksProtoPcieD2H *d2h_msg = NULL; volatile union SimbricksProtoPcieD2H *d2h_msg = NULL;
while (d2h_msg == NULL) { while (d2h_msg == NULL) {
......
...@@ -391,7 +391,8 @@ void queue_admin_tx::admin_desc_ctx::process() { ...@@ -391,7 +391,8 @@ void queue_admin_tx::admin_desc_ctx::process() {
#endif #endif
struct i40e_aqc_query_vsi_bw_config_resp bwc; struct i40e_aqc_query_vsi_bw_config_resp bwc;
memset(&bwc, 0, sizeof(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)); desc_complete_indir(0, &bwc, sizeof(bwc));
} else if (d->opcode == i40e_aqc_opc_query_vsi_ets_sla_config) { } else if (d->opcode == i40e_aqc_opc_query_vsi_ets_sla_config) {
#ifdef DEBUG_ADMINQ #ifdef DEBUG_ADMINQ
...@@ -399,7 +400,8 @@ void queue_admin_tx::admin_desc_ctx::process() { ...@@ -399,7 +400,8 @@ void queue_admin_tx::admin_desc_ctx::process() {
#endif #endif
struct i40e_aqc_query_vsi_ets_sla_config_resp sla; struct i40e_aqc_query_vsi_ets_sla_config_resp sla;
memset(&sla, 0, sizeof(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)); desc_complete_indir(0, &sla, sizeof(sla));
} else if (d->opcode == i40e_aqc_opc_remove_macvlan) { } else if (d->opcode == i40e_aqc_opc_remove_macvlan) {
#ifdef DEBUG_ADMINQ #ifdef DEBUG_ADMINQ
......
...@@ -585,8 +585,8 @@ class i40e_bm : public nicbm::Runner::Device { ...@@ -585,8 +585,8 @@ class i40e_bm : public nicbm::Runner::Device {
void SetupIntro(struct SimbricksProtoPcieDevIntro &di) override; void SetupIntro(struct SimbricksProtoPcieDevIntro &di) override;
void RegRead(uint8_t bar, uint64_t addr, void *dest, size_t len) 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); virtual uint32_t RegRead32(uint8_t bar, uint64_t addr);
void RegWrite(uint8_t bar, uint64_t addr, const void *src, size_t len) void RegWrite(uint8_t bar, uint64_t addr, const void *src,
override; size_t len) override;
virtual void RegWrite32(uint8_t bar, uint64_t addr, uint32_t val); virtual void RegWrite32(uint8_t bar, uint64_t addr, uint32_t val);
void DmaComplete(nicbm::DMAOp &op) override; void DmaComplete(nicbm::DMAOp &op) override;
void EthRx(uint8_t port, const void *data, size_t len) override; void EthRx(uint8_t port, const void *data, size_t len) override;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment