diff --git a/Makefile b/Makefile index 23cc84d0f..ba1e6d237 100644 --- a/Makefile +++ b/Makefile @@ -69,7 +69,7 @@ endif # Common flags LDLIBS = CFLAGS += -std=c11 -MMD -mcx16 -I$(BUILDDIR)/include -I$(SRCDIR)/include -CFLAGS += -Wall -Werror -fdiagnostics-color=auto -D_POSIX_C_SOURCE=200809L -D_GNU_SOURCE=1 +CFLAGS += -Wall -fdiagnostics-color=auto -D_POSIX_C_SOURCE=200809L -D_GNU_SOURCE=1 ifeq ($(PLATFORM),Darwin) CFLAGS += -D_DARWIN_C_SOURCE diff --git a/Makefile.config b/Makefile.config index fbb80c5c9..5ce1fd01d 100644 --- a/Makefile.config +++ b/Makefile.config @@ -54,21 +54,22 @@ else IS_LINUX = 0 endif -WITH_NODE_FPGA ?= $(IS_LINUX) -WITH_NODE_CBUILDER ?= $(IS_LINUX) -WITH_NODE_LOOPBACK ?= $(IS_LINUX) -WITH_NODE_COMEDI ?= $(IS_LINUX) -WITH_NODE_TEST_RTT ?= 1 -WITH_NODE_FILE ?= 1 -WITH_NODE_SIGNAL ?= 1 -WITH_NODE_NGSI ?= 1 -WITH_NODE_WEBSOCKET ?= 1 -WITH_NODE_SOCKET ?= 1 -WITH_NODE_ZEROMQ ?= 1 -WITH_NODE_NANOMSG ?= 1 -WITH_NODE_SHMEM ?= 1 -WITH_NODE_STATS ?= 1 -WITH_NODE_INFLUXDB ?= 1 -WITH_NODE_AMQP ?= 1 -WITH_NODE_IEC61850 ?= 1 -WITH_NODE_MQTT ?= 1 +WITH_NODE_FPGA ?= $(IS_LINUX) +WITH_NODE_CBUILDER ?= $(IS_LINUX) +WITH_NODE_LOOPBACK ?= $(IS_LINUX) +WITH_NODE_COMEDI ?= $(IS_LINUX) +WITH_NODE_TEST_RTT ?= 1 +WITH_NODE_FILE ?= 1 +WITH_NODE_SIGNAL ?= 1 +WITH_NODE_NGSI ?= 1 +WITH_NODE_WEBSOCKET ?= 1 +WITH_NODE_SOCKET ?= 1 +WITH_NODE_ZEROMQ ?= 1 +WITH_NODE_NANOMSG ?= 1 +WITH_NODE_SHMEM ?= 1 +WITH_NODE_STATS ?= 1 +WITH_NODE_INFLUXDB ?= 1 +WITH_NODE_AMQP ?= 1 +WITH_NODE_IEC61850 ?= 1 +WITH_NODE_MQTT ?= 1 +WITH_NODE_INFINIBAND ?= 1 diff --git a/Makefile.help b/Makefile.help index 5b2a17d97..369704f67 100644 --- a/Makefile.help +++ b/Makefile.help @@ -92,7 +92,7 @@ help: $E " WITH_NODE_AMQP = $(WITH_NODE_AMQP)" $E " WITH_NODE_MQTT = $(WITH_NODE_MQTT)" $E " WITH_NODE_IEC61850 = $(WITH_NODE_IEC61850)" - $E " WITH_NODE_MQTT = $(WITH_NODE_MQTT)" + $E " WITH_NODE_INFINIBAND = $(WITH_NODE_INFINIBAND)" $E " WITH_NODE_COMEDI = $(WITH_NODE_COMEDI)" $E $E "Available dependencies: $(LIB_PKGS)" diff --git a/include/villas/nodes/infiniband.h b/include/villas/nodes/infiniband.h new file mode 100644 index 000000000..64eee7067 --- /dev/null +++ b/include/villas/nodes/infiniband.h @@ -0,0 +1,90 @@ +/** Node type: infiniband + * + * @file + * @author Dennis Potter + * @copyright 2018, Institute for Automation of Complex Power Systems, EONERC + * @license GNU General Public License (version 3) + * + * VILLASnode + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *********************************************************************************/ + +/** + * @addtogroup infiniband infiniband node type + * @ingroup node + * @{ + */ + +#pragma once + +#include +#include +#include +#include +#include + +/* Forward declarations */ +struct format_type; + +struct infiniband { + struct rdma_cm_id *id; + struct ibv_pd *pd; + struct ibv_cq *cq; + struct ibv_comp_channel *comp_channel; + + pthread_t cq_poller_thread; + + struct connection_s { + char *src_ip_addr; + char *dst_ip_addr; + + struct ibv_qp *qp; + struct ibv_mr *mr_payload; + struct r_addr_key_s *r_addr_key; + } conn; + +}; + +/** @see node_type::reverse */ +int infiniband_reverse(struct node *n); + +/** @see node_type::print */ +char * infiniband_print(struct node *n); + +/** @see node_type::parse */ +int infiniband_parse(struct node *n, json_t *cfg); + +/** @see node_type::open */ +int infiniband_start(struct node *n); + +/** @see node_type::destroy */ +int infiniband_destroy(struct node *n); + +/** @see node_type::close */ +int infiniband_stop(struct node *n); + +/** @see node_type::init */ +int infiniband_init(); + +/** @see node_type::deinit */ +int infiniband_deinit(); + +/** @see node_type::read */ +int infiniband_read(struct node *n, struct sample *smps[], unsigned cnt); + +/** @see node_type::write */ +int infiniband_write(struct node *n, struct sample *smps[], unsigned cnt); + +/** @} */ diff --git a/lib/nodes/Makefile.inc b/lib/nodes/Makefile.inc index 180a98669..a05c6c48c 100644 --- a/lib/nodes/Makefile.inc +++ b/lib/nodes/Makefile.inc @@ -156,6 +156,13 @@ ifneq ($(wildcard /usr/include/mosquitto.h),) endif endif +# Enable Infiniband support +ifeq ($(WITH_NODE_INFINIBAND),1) + LIB_SRCS += lib/nodes/infiniband.c + LIB_NODES += infiniband + WITH_IO = 1 +endif + # Enable Comedi support ifeq ($(WITH_NODE_COMEDI),1) ifeq ($(shell $(PKGCONFIG) comedilib; echo $$?),0) diff --git a/lib/nodes/infiniband.c b/lib/nodes/infiniband.c new file mode 100644 index 000000000..a56e8fd6e --- /dev/null +++ b/lib/nodes/infiniband.c @@ -0,0 +1,127 @@ +/** Node type: infiniband + * + * @author Dennis Potter + * @copyright 2018, Institute for Automation of Complex Power Systems, EONERC + * @license GNU General Public License (version 3) + * + * VILLASnode + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *********************************************************************************/ + +#include + +#include +#include +#include +#include + +static void infiniband_log_cb(struct infiniband *ib, void *userdata, int level, const char *str) +{ +} + +static void infiniband_connect_cb(struct infiniband *ib, void *userdata, int result) +{ +} + +static void infiniband_disconnect_cb(struct infiniband *ib, void *userdata, int result) +{ +} + +static void infiniband_message_cb(struct infiniband *ib, void *userdata) +{ +} + +static void infiniband_subscribe_cb(struct infiniband *ib, void *userdata, int mid, int qos_count, const int *granted_qos) +{ +} + +int infiniband_reverse(struct node *n) +{ + return 0; +} + +int infiniband_parse(struct node *n, json_t *cfg) +{ + return 0; +} + +char * infiniband_print(struct node *n) +{ + return 0; +} + +int infiniband_destroy(struct node *n) +{ + return 0; +} + +int infiniband_start(struct node *n) +{ + return 0; +} + +int infiniband_stop(struct node *n) +{ + return 0; +} + +int infiniband_init() +{ + return 0; +} + +int infiniband_deinit() +{ + return 0; +} + +int infiniband_read(struct node *n, struct sample *smps[], unsigned cnt) +{ + return 0; +} + +int infiniband_write(struct node *n, struct sample *smps[], unsigned cnt) +{ + return 0; +} + +int infiniband_fd(struct node *n) +{ + return 0; +} + +static struct plugin p = { + .name = "infiniband", + .description = "Infiniband)", + .type = PLUGIN_TYPE_NODE, + .node = { + .vectorize = 0, + .size = sizeof(struct infiniband), + .reverse = infiniband_reverse, + .parse = infiniband_parse, + .print = infiniband_print, + .start = infiniband_start, + .destroy = infiniband_destroy, + .stop = infiniband_stop, + .init = infiniband_init, + .deinit = infiniband_deinit, + .read = infiniband_read, + .write = infiniband_write, + .fd = infiniband_fd + } +}; + +REGISTER_PLUGIN(&p) +LIST_INIT_STATIC(&p.node.instances)