lib_LTLIBRARIES = src/librdmacm.la
ACLOCAL_AMFLAGS = -I config
-AM_CFLAGS = -g -Wall -D_GNU_SOURCE
+AM_CFLAGS = -g -Wall -D_GNU_SOURCE -DSYSCONFDIR=\"$(sysconfdir)\" -DRDMADIR=\"@rdmadir@\"
src_librdmacm_la_CFLAGS = $(AM_CFLAGS)
AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$ac_cv_version_script" = "yes")
+AC_ARG_VAR(rdmadir, [Directory for configuration files])
+if test "x$rdmadir" = "x"; then
+ AC_SUBST(rdmadir, rdma)
+fi
+
AC_CONFIG_FILES([Makefile librdmacm.spec])
AC_OUTPUT
}
int ucma_init();
+void rs_configure();
extern int af_ib_support;
#define RAI_ROUTEONLY 0x01000000
};
#endif
+#ifndef SYSCONFDIR
+#define SYSCONFDIR "/etc"
+#endif
+#ifndef RDMADIR
+#define RDMADIR "rdma"
+#endif
+#define RDMA_CONF_DIR SYSCONFDIR "/" RDMADIR
+#define RS_CONF_DIR RDMA_CONF_DIR "/rsockets"
+
#endif /* CMA_H */
#include <sys/types.h>
#include <sys/socket.h>
+#include <sys/time.h>
#include <stdarg.h>
#include <netdb.h>
#include <unistd.h>
static struct index_map idm;
static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
+static long long polling_time;
+
/*
* Immediate data format is determined by the upper bits
* bit 31: message type, 0 - data, 1 - control
uint8_t *sbuf;
};
+void rs_configure(void)
+{
+ FILE *f;
+
+ if ((f = fopen(RS_CONF_DIR "/polling_time", "r"))) {
+ fscanf(f, "%L", &polling_time);
+ fclose(f);
+ }
+}
+
/*
* We currently generate a completion per send. sqe_count = 1
*/
*/
int rpoll(struct pollfd *fds, nfds_t nfds, int timeout)
{
+ struct timeval s, e;
struct pollfd *rfds;
+ long long poll_time = 0;
int ret;
- ret = rs_poll_check(fds, nfds);
- if (ret || !timeout)
- return ret;
+ do {
+ ret = rs_poll_check(fds, nfds);
+ if (ret || !timeout)
+ return ret;
+
+ if (!poll_time)
+ gettimeofday(&s, NULL);
+
+ gettimeofday(&e, NULL);
+ poll_time = (e.tv_sec - s.tv_sec) * 1000000 +
+ (e.tv_usec - s.tv_usec) + 1;
+ } while (poll_time < polling_time);
rfds = rs_fds_alloc(nfds);
if (!rfds)