"...composable_kernel_rocm.git" did not exist on "00089cd6e579d159bf452334e54510a521327cf8"
Commit fd8ff102 authored by Antoine Kaufmann's avatar Antoine Kaufmann
Browse files

lib: format changes to make cpplint happier

parent 56775bc1
......@@ -22,9 +22,13 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef SIMBRICKS_NETIF_INTERNAL_H_
#define SIMBRICKS_NETIF_INTERNAL_H_
#include <stddef.h>
#include <stdio.h>
int uxsocket_connect(const char *path);
int uxsocket_recv(int fd, void *data, size_t len, int *pfd);
void *shm_map(int shm_fd);
#endif // SIMBRICKS_NETIF_INTERNAL_H_
......@@ -30,7 +30,7 @@
#include <unistd.h>
#include <simbricks/netif/netsim.h>
#include "internal.h"
#include "lib/simbricks/netif/internal.h"
static uint64_t current_epoch = 0;
......@@ -178,7 +178,8 @@ int netsim_n2d_sync(struct netsim_interface *nsif, uint64_t timestamp,
return 0;
}
void netsim_advance_epoch(uint64_t timestamp, uint64_t sync_delay, int sync_mode)
void netsim_advance_epoch(uint64_t timestamp, uint64_t sync_delay,
int sync_mode)
{
if (sync_mode == SYNC_BARRIER) {
if (timestamp - current_epoch >= sync_delay) {
......@@ -187,7 +188,8 @@ void netsim_advance_epoch(uint64_t timestamp, uint64_t sync_delay, int sync_mode
}
}
uint64_t netsim_advance_time(uint64_t timestamp, uint64_t sync_delay, int sync_mode)
uint64_t netsim_advance_time(uint64_t timestamp, uint64_t sync_delay,
int sync_mode)
{
switch (sync_mode) {
case SYNC_MODES:
......
......@@ -22,8 +22,8 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef COSIM_NETSIM_H_
#define COSIM_NETSIM_H_
#ifndef SIMBRICKS_NETIF_NETSIM_H_
#define SIMBRICKS_NETIF_NETSIM_H_
#include <stddef.h>
#include <stdint.h>
......@@ -66,7 +66,9 @@ volatile union cosim_eth_proto_n2d *netsim_n2d_alloc(
uint64_t latency);
int netsim_n2d_sync(struct netsim_interface *nsif, uint64_t timestamp,
uint64_t latency, uint64_t sync_delay, int sync_mode);
void netsim_advance_epoch(uint64_t timestamp, uint64_t sync_delay, int sync_mode);
uint64_t netsim_advance_time(uint64_t timestamp, uint64_t sync_delay, int sync_mode);
void netsim_advance_epoch(uint64_t timestamp, uint64_t sync_delay,
int sync_mode);
uint64_t netsim_advance_time(uint64_t timestamp, uint64_t sync_delay,
int sync_mode);
#endif /* ndef COSIM_NETSIM_H_ */
#endif // SIMBRICKS_NETIF_NETSIM_H_
......@@ -34,7 +34,7 @@
#include <sys/stat.h>
#include <unistd.h>
#include "internal.h"
#include "lib/simbricks/netif/internal.h"
int uxsocket_connect(const char *path)
{
......
......@@ -34,7 +34,7 @@
#include <simbricks/nicbm/nicbm.h>
//#define DEBUG_NICBM 1
// #define DEBUG_NICBM 1
#define DMA_MAX_PENDING 64
......@@ -204,7 +204,7 @@ void Runner::h2d_read(volatile struct cosim_pcie_proto_h2d_read *read)
read->len, dbg_val);
#endif
//WMB();
// WMB();
rc->own_type = COSIM_PCIE_PROTO_D2H_MSG_READCOMP |
COSIM_PCIE_PROTO_D2H_OWN_HOST;
}
......@@ -219,14 +219,15 @@ void Runner::h2d_write(volatile struct cosim_pcie_proto_h2d_write *write)
#ifdef DEBUG_NICBM
uint64_t dbg_val = 0;
memcpy(&dbg_val, (const void *) write->data, write->len <= 8 ? write->len : 8);
memcpy(&dbg_val, (const void *) write->data, write->len <= 8 ? write->len :
8);
printf("nicbm: write(off=0x%lx, len=%u, val=0x%lx)\n", write->offset,
write->len, dbg_val);
#endif
dev.reg_write(write->bar, write->offset, (void *) write->data, write->len);
wc->req_id = write->req_id;
//WMB();
// WMB();
wc->own_type = COSIM_PCIE_PROTO_D2H_MSG_WRITECOMP |
COSIM_PCIE_PROTO_D2H_OWN_HOST;
}
......@@ -284,7 +285,7 @@ void Runner::eth_send(const void *data, size_t len)
volatile union cosim_eth_proto_d2n *msg = d2n_alloc();
volatile struct cosim_eth_proto_d2n_send *send = &msg->send;
send->port = 0; // single port
send->port = 0; // single port
send->len = len;
memcpy((void *)send->data, data, len);
send->own_type = COSIM_ETH_PROTO_D2N_MSG_SEND |
......@@ -397,7 +398,7 @@ void Runner::event_trigger()
Runner::Runner(Device &dev_)
: dev(dev_), events(event_cmp())
{
//mac_addr = lrand48() & ~(3ULL << 46);
// mac_addr = lrand48() & ~(3ULL << 46);
dma_pending = 0;
srand48(time(NULL) ^ getpid());
mac_addr = lrand48();
......@@ -419,7 +420,8 @@ int Runner::runMain(int argc, char *argv[])
if (argc < 4 && argc > 9) {
fprintf(stderr, "Usage: corundum_bm PCI-SOCKET ETH-SOCKET "
"SHM [SYNC-MODE] [START-TICK] [SYNC-PERIOD] [PCI-LATENCY] [ETH-LATENCY]\n");
"SHM [SYNC-MODE] [START-TICK] [SYNC-PERIOD] [PCI-LATENCY] "
"[ETH-LATENCY]\n");
return EXIT_FAILURE;
}
if (argc >= 5)
......@@ -480,7 +482,6 @@ int Runner::runMain(int argc, char *argv[])
uint64_t ev_ts;
if (event_next(ev_ts) && ev_ts < next_ts)
next_ts = ev_ts;
} while (next_ts <= main_time && !exiting);
main_time = nicsim_advance_time(&nsparams, next_ts);
}
......
......@@ -22,6 +22,9 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef SIMBRICKS_NICBM_NICBM_H_
#define SIMBRICKS_NICBM_NICBM_H_
#include <set>
#include <deque>
extern "C" {
......@@ -145,6 +148,7 @@ class Runner {
void dma_do(DMAOp &op);
void dma_trigger();
public:
Runner(Device &dev_);
......@@ -190,4 +194,6 @@ class SimpleDevice : public Runner::Device {
reg_write(bar, addr, r);
}
};
}
} // namespace nicbm
#endif // SIMBRICKS_NICBM_NICBM_H_
......@@ -22,9 +22,14 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef SIMBRICKS_NICIF_INTERNAL_H_
#define SIMBRICKS_NICIF_INTERNAL_H_
#include <stddef.h>
#include <stdio.h>
int uxsocket_init(const char *path);
int uxsocket_send(int connfd, void *data, size_t len, int fd);
int shm_create(const char *path, size_t size, void **addr);
#endif // SIMBRICKS_NICIF_INTERNAL_H_
......@@ -31,7 +31,7 @@
#include <simbricks/nicif/nicsim.h>
#include "internal.h"
#include "lib/simbricks/nicif/internal.h"
#define D2H_ELEN (9024 + 64)
#define D2H_ENUM 1024
......@@ -195,7 +195,6 @@ int nicsim_init(struct nicsim_params *params,
if ((shm_fd = shm_create(params->shm_path, shm_size, &shmptr))
< 0)
{
return -1;
}
......
......@@ -22,14 +22,14 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef COSIM_NICSIM_H_
#define COSIM_NICSIM_H_
#ifndef SIMBRICKS_NICIF_NICSIM_H_
#define SIMBRICKS_NICIF_NICSIM_H_
#include <simbricks/proto/pcie.h>
#include <simbricks/proto/network.h>
#define SYNC_MODES 0 // ModES style synchronization
#define SYNC_BARRIER 1 // Global barrier style synchronization
#define SYNC_MODES 0 // ModES style synchronization
#define SYNC_BARRIER 1 // Global barrier style synchronization
struct nicsim_params {
const char *pci_socket_path;
......@@ -71,4 +71,4 @@ void nicif_n2d_next(void);
volatile union cosim_eth_proto_d2n *nicsim_d2n_alloc(
struct nicsim_params *params, uint64_t timestamp);
#endif /* ndef COSIM_NICSIM_H_ */
#endif // SIMBRICKS_NICIF_NICSIM_H_
......@@ -32,7 +32,7 @@
#include <sys/mman.h>
#include <unistd.h>
#include "internal.h"
#include "lib/simbricks/nicif/internal.h"
int uxsocket_init(const char *path)
{
......@@ -97,7 +97,7 @@ int uxsocket_send(int connfd, void *data, size_t len, int fd)
*(int *) CMSG_DATA(cmsg) = fd;
}
if((tx = sendmsg(connfd, &msg, 0)) != (ssize_t) len) {
if ((tx = sendmsg(connfd, &msg, 0)) != (ssize_t) len) {
fprintf(stderr, "tx == %zd\n", tx);
return -1;
}
......
......@@ -22,8 +22,8 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef COSIM_ETH_PROTO_H_
#define COSIM_ETH_PROTO_H_
#ifndef SIMBRICKS_PROTO_NETWORK_H_
#define SIMBRICKS_PROTO_NETWORK_H_
#include <stdint.h>
......@@ -155,4 +155,4 @@ union cosim_eth_proto_n2d {
struct cosim_eth_proto_n2d_recv recv;
};
#endif /* ndef COSIM_ETH_PROTO_H_ */
#endif // SIMBRICKS_PROTO_NETWORK_H_
......@@ -22,13 +22,13 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef COSIM_PCIE_PROTO_H_
#define COSIM_PCIE_PROTO_H_
#ifndef SIMBRICKS_PROTO_PCIE_H_
#define SIMBRICKS_PROTO_PCIE_H_
#include <stdint.h>
//#define COSIM_PCI_MSG_SZCHECK(s) static_assert(sizeof(s) == 64)
//#define COSIM_PCI_MSG_SZCHECK(s) _Static_assert(sizeof(s) == 64)
// #define COSIM_PCI_MSG_SZCHECK(s) static_assert(sizeof(s) == 64)
// #define COSIM_PCI_MSG_SZCHECK(s) _Static_assert(sizeof(s) == 64)
#define COSIM_PCI_MSG_SZCHECK(s)
/******************************************************************************/
......@@ -322,4 +322,4 @@ union cosim_pcie_proto_h2d {
} __attribute__((packed));
COSIM_PCI_MSG_SZCHECK(union cosim_pcie_proto_h2d);
#endif /* ndef COSIM_PCIE_PROTO_H_ */
#endif // SIMBRICKS_PROTO_PCIE_H_
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