Commit 59861a1f authored by Antoine Kaufmann's avatar Antoine Kaufmann Committed by Antoine Kaufmann
Browse files

fix all cpplint warnings

make lint should pass again now
parent 34e5a23f
filter=-readability/casting,-runtime/references,-build/include_order,-runtime/printf,-runtime/arrays
filter=-readability/casting,-runtime/references,-build/include_order
filter=-runtime/printf,-runtime/arrays,-build/c++11,-readability/todo
......@@ -481,4 +481,4 @@ void BaseEntryReceived(struct Peer *peer, uint32_t pos, void *data) {
(volatile union SimbricksProtoBaseMsg *)data;
asm volatile("sfence" ::: "memory");
msg->header.own_type = src_msg->header.own_type;
}
\ No newline at end of file
}
......@@ -22,8 +22,8 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef DIST_UTILS_H_
#define DIST_UTILS_H_
#ifndef DIST_COMMON_UTILS_H_
#define DIST_COMMON_UTILS_H_
#include <stddef.h>
#include <sys/types.h>
......@@ -36,4 +36,4 @@ int UxsocketSendFd(int connfd, void *data, size_t len, int fd);
int ShmCreate(const char *path, size_t size, void **addr);
void *ShmMap(int shm_fd, size_t *size);
#endif // DIST_UTILS_H_
#endif // DIST_COMMON_UTILS_H_
......@@ -22,8 +22,8 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef DIST_NET_RDMA_H_
#define DIST_NET_RDMA_H_
#ifndef DIST_RDMA_NET_RDMA_H_
#define DIST_RDMA_NET_RDMA_H_
#include <arpa/inet.h>
#include <stdbool.h>
......@@ -43,4 +43,4 @@ int RdmaListen(struct sockaddr_in *addr);
int RdmaConnect(struct sockaddr_in *addr);
int RdmaEvent();
#endif // DIST_NET_RDMA_H_
#endif // DIST_RDMA_NET_RDMA_H_
......@@ -22,8 +22,8 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef DIST_RDMA_H_
#define DIST_RDMA_H_
#ifndef DIST_RDMA_RDMA_H_
#define DIST_RDMA_RDMA_H_
#include <infiniband/verbs.h>
......@@ -39,4 +39,4 @@ int RdmaIBListen(struct sockaddr_in *addr);
int RdmaIBConnect(struct sockaddr_in *addr);
struct ibv_qp *RdmaIBCreateQP(struct ibv_pd *pd, struct ibv_qp_init_attr *attr);
#endif // DIST_RDMA_H_
#endif // DIST_RDMA_RDMA_H_
......@@ -41,7 +41,7 @@
#include "dist/common/base.h"
#include "dist/common/utils.h"
//#define SOCK_DEBUG
// #define SOCK_DEBUG
#define MAX_PEERS 32
#define RXBUF_SIZE (1024 * 1024)
......
......@@ -22,8 +22,8 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef SIMBRICKS_BASEIF_GENERIC_H_
#define SIMBRICKS_BASEIF_GENERIC_H_
#ifndef SIMBRICKS_BASE_GENERIC_H_
#define SIMBRICKS_BASE_GENERIC_H_
#include <simbricks/base/if.h>
......@@ -103,4 +103,4 @@
return SimbricksBaseIfOutMsgLen(&base_if->base); \
}
#endif // SIMBRICKS_BASEIF_BASEIF_H_
#endif // SIMBRICKS_BASE_GENERIC_H_
......@@ -807,8 +807,8 @@ void SimbricksBaseIfClose(struct SimbricksBaseIf *base_if) {
if (base_if->conn_state == kConnOpen) {
// send out termination message
volatile union SimbricksProtoBaseMsg *msg;
while ((msg = SimbricksBaseIfOutAlloc(base_if, UINT64_MAX)) == NULL)
;
while ((msg = SimbricksBaseIfOutAlloc(base_if, UINT64_MAX)) == NULL) {
}
SimbricksBaseIfOutSend(base_if, msg, SIMBRICKS_PROTO_MSG_TYPE_TERMINATE);
}
......@@ -821,4 +821,4 @@ void SimbricksBaseIfClose(struct SimbricksBaseIf *base_if) {
void SimbricksBaseIfUnlink(struct SimbricksBaseIf *base_if) {
// TODO
}
\ No newline at end of file
}
......@@ -389,4 +389,4 @@ static inline bool SimbricksBaseIfSyncEnabled(struct SimbricksBaseIf *base_if) {
return base_if->sync;
}
#endif // SIMBRICKS_BASEIF_BASEIF_H_
#endif // SIMBRICKS_BASE_IF_H_
......@@ -89,4 +89,4 @@ int SimbricksNetIfInit(struct SimbricksNetIf *nsif,
*sync_eth = SimbricksBaseIfSyncEnabled(bif);
return 0;
}
\ No newline at end of file
}
......@@ -65,8 +65,8 @@ int MultiNicRunner::RunMain(int argc, char *argv[]) {
std::vector<boost::fibers::fiber *> fibers;
do {
int end;
for (end = start + 1; end < argc && strcmp(argv[end], "--"); end++)
;
for (end = start + 1; end < argc && strcmp(argv[end], "--"); end++) {
}
argv[start] = argv[0];
CompRunner *r = new CompRunner(factory_.create());
......
......@@ -39,8 +39,8 @@ class MultiNicRunner {
protected:
class CompRunner : public Runner {
protected:
virtual void YieldPoll() override;
virtual int NicIfInit() override;
void YieldPoll() override;
int NicIfInit() override;
public:
explicit CompRunner(Device &dev_);
......
......@@ -41,7 +41,7 @@ extern "C" {
#include <simbricks/base/proto.h>
}
//#define DEBUG_NICBM 1
// #define DEBUG_NICBM 1
#define STAT_NICBM 1
#define DMA_MAX_PENDING 64
......
......@@ -93,7 +93,7 @@ int SimbricksNicIfInit(struct SimbricksNicIf *nicif, const char *shm_path,
}
return SimBricksBaseIfEstablish(ests, n_bifs);
}
} // NOLINT(whitespace/indent)
int SimbricksNicIfCleanup(struct SimbricksNicIf *nicif) {
SimbricksBaseIfClose(&nicif->pcie.base);
......
......@@ -28,4 +28,4 @@ void SimbricksPcieIfDefaultParams(struct SimbricksBaseIfParams *params) {
SimbricksBaseIfDefaultParams(params);
params->upper_layer_proto = SIMBRICKS_PROTO_ID_PCIE;
params->in_entries_size = params->out_entries_size = 9024 + 64;
}
\ No newline at end of file
}
/*
* Copyright 2022 Max Planck Institute for Software Systems, and
* National University of Singapore
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <signal.h>
#include <verilated.h>
#include <verilated_fst_c.h>
......@@ -10,8 +34,8 @@
#define MAX_PKT_SIZE 2048
//#define ETH_DEBUG
//#define TRACE_ENABLED
// #define ETH_DEBUG
// #define TRACE_ENABLED
class EthernetTx;
class EthernetRx;
......
#ifndef NET_MENSHEN_PORTS_H_
#define NET_MENSHEN_PORTS_H_
/*
* Copyright 2022 Max Planck Institute for Software Systems, and
* National University of Singapore
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef PORTS_H_
#define PORTS_H_
#include <stdint.h>
......@@ -44,7 +68,7 @@ class NetPort : public Port {
int sync_;
public:
NetPort(struct SimbricksBaseIfParams *params) : params_(params),
explicit NetPort(struct SimbricksBaseIfParams *params) : params_(params),
netif_(&netifObj_), rx_(nullptr), sync_(0) {
memset(&netifObj_, 0, sizeof(netifObj_));
}
......@@ -52,24 +76,24 @@ class NetPort : public Port {
NetPort(const NetPort &other) : netifObj_(other.netifObj_),
netif_(&netifObj_), rx_(other.rx_), sync_(other.sync_) {}
virtual bool Connect(const char *path, int sync) override {
bool Connect(const char *path, int sync) override {
sync_ = sync;
return SimbricksNetIfInit(netif_, params_, path, &sync_) == 0;
}
virtual bool IsSync() override {
bool IsSync() override {
return sync_;
}
virtual void Sync(uint64_t cur_ts) override {
while (SimbricksNetIfOutSync(netif_, cur_ts));
void Sync(uint64_t cur_ts) override {
while (SimbricksNetIfOutSync(netif_, cur_ts)) {}
}
virtual uint64_t NextTimestamp() override {
uint64_t NextTimestamp() override {
return SimbricksNetIfInTimestamp(netif_);
}
virtual enum RxPollState RxPacket(
enum RxPollState RxPacket(
const void *& data, size_t &len, uint64_t cur_ts) override {
assert(rx_ == nullptr);
......@@ -90,14 +114,14 @@ class NetPort : public Port {
}
}
virtual void RxDone() override {
void RxDone() override {
assert(rx_ != nullptr);
SimbricksNetIfInDone(netif_, rx_);
rx_ = nullptr;
}
virtual bool TxPacket(
bool TxPacket(
const void *data, size_t len, uint64_t cur_ts) override {
volatile union SimbricksProtoNetMsg *msg_to =
SimbricksNetIfOutAlloc(netif_, cur_ts);
......@@ -118,4 +142,4 @@ class NetPort : public Port {
}
};
#endif // NET_MENSHEN_PORTS_H_
\ No newline at end of file
#endif // PORTS_H_
......@@ -44,7 +44,7 @@ extern "C" {
#include <simbricks/nicif/nicif.h>
};
//#define NETSWITCH_DEBUG
// #define NETSWITCH_DEBUG
#define NETSWITCH_STAT
struct SimbricksBaseIfParams netParams;
......@@ -155,26 +155,26 @@ class NetPort : public Port {
sync_(other.sync_) {
}
virtual bool Connect(const char *path, int sync) override {
bool Connect(const char *path, int sync) override {
sync_ = sync;
return SimbricksNetIfInit(netif_, &netParams, path, &sync_) == 0;
}
virtual bool IsSync() override {
bool IsSync() override {
return sync_;
}
virtual void Sync(uint64_t cur_ts) override {
while (SimbricksNetIfOutSync(netif_, cur_ts))
;
void Sync(uint64_t cur_ts) override {
while (SimbricksNetIfOutSync(netif_, cur_ts)) {
}
}
virtual uint64_t NextTimestamp() override {
uint64_t NextTimestamp() override {
return SimbricksNetIfInTimestamp(netif_);
}
virtual enum RxPollState RxPacket(const void *&data, size_t &len,
uint64_t cur_ts) override {
enum RxPollState RxPacket(const void *&data, size_t &len,
uint64_t cur_ts) override {
assert(rx_ == nullptr);
rx_ = SimbricksNetIfInPoll(netif_, cur_ts);
......@@ -194,15 +194,14 @@ class NetPort : public Port {
}
}
virtual void RxDone() override {
void RxDone() override {
assert(rx_ != nullptr);
SimbricksNetIfInDone(netif_, rx_);
rx_ = nullptr;
}
virtual bool TxPacket(const void *data, size_t len,
uint64_t cur_ts) override {
bool TxPacket(const void *data, size_t len, uint64_t cur_ts) override {
volatile union SimbricksProtoNetMsg *msg_to =
SimbricksNetIfOutAlloc(netif_, cur_ts);
if (!msg_to && !sync_) {
......@@ -237,7 +236,7 @@ class NetHostPort : public NetPort {
netif_ = &nicif_.net;
}
virtual bool Connect(const char *path, int sync) override {
bool Connect(const char *path, int sync) override {
sync_ = sync;
std::string shm_path = path;
shm_path += "-shm";
......@@ -251,7 +250,7 @@ class NetHostPort : public NetPort {
return ret == 0;
}
virtual bool IsSync() override {
bool IsSync() override {
return sync_;
}
};
......
......@@ -44,7 +44,7 @@ extern "C" {
#include <simbricks/nicif/nicif.h>
};
//#define NETSWITCH_DEBUG
// #define NETSWITCH_DEBUG
#define NETSWITCH_STAT
struct SimbricksBaseIfParams netParams;
......@@ -157,8 +157,8 @@ class NetPort {
}
void Sync(uint64_t cur_ts) {
while (SimbricksNetIfOutSync(&netif_, cur_ts))
;
while (SimbricksNetIfOutSync(&netif_, cur_ts)) {
}
}
uint64_t NextTimestamp() {
......@@ -226,7 +226,7 @@ class NetListenPort : public NetPort {
: NetPort(other), pool_(other.pool_) {
}
virtual bool Prepare() override {
bool Prepare() override {
if (!Init())
return false;
......
......@@ -51,11 +51,11 @@ extern "C" {
};
#include <utils/json.hpp>
//#define DEBUG
// #define DEBUG
using json = nlohmann::json;
typedef long long int ts_t;
typedef int64_t ts_t;
static const int log_wait_limit_ms = 10; // 10ms
static ts_t cur_ts = 0;
......@@ -63,7 +63,7 @@ static int exiting = 0;
static std::vector<struct SimbricksNetIf> nsifs;
static std::vector<int> tofino_fds;
static std::ifstream log_ifs;
static std::string log_line;
static std::string log_line; // NOLINT(runtime/string)
static const int flush_msg_sz = 14;
static char flush_msg[flush_msg_sz] = {0x0};
......@@ -174,7 +174,6 @@ static void switch_to_dev(int port) {
while ((n = recvfrom(tofino_fds.at(port), buf, BUFFER_SIZE, 0,
(struct sockaddr *)&addr, &addr_len)) <= 0 ||
addr.sll_pkttype == PACKET_OUTGOING) {
;
}
msg_to = SimbricksNetIfOutAlloc(&nsifs[port], cur_ts);
......@@ -198,7 +197,7 @@ static void process_event(const struct event &e) {
e.time);
#endif
if (send(tofino_fds.at(e.port), e.msg.data(), e.msg.length(), 0) <
(long int)e.msg.length()) {
(ssize_t)e.msg.length()) {
fprintf(stderr, "tofino: failed to forward packet to switch\n");
abort();
}
......
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