#include <stdio.h>
#include <stdarg.h>
#include <string.h>
-#include <osd.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <getopt.h>
#include <fcntl.h>
-#include <udat.h>
#include <scif.h>
#include "dat2/udat.h"
-
/*
* Service options - set through mpxy_opts file.
*/
-static char *opts_file = MPXY_CONF_DIR "/" MPXY_OPTS_FILE;
-static char log_file[128] = "/var/log/mpxy.log";
+static char *opts_file = MPXYD_CONF_DIR "/" MPXYD_OPTS_FILE;
+static char log_file[128] = "/var/log/mpxyd.log";
static int log_level = 0;
-static char lock_file[128] = "/var/run/mpxy.pid";
+static char lock_file[128] = "/var/run/mpxyd.pid";
static short service_id = SCIF_OFED_PORT_7;
+static int buffer_pool_mb = 64;
+static int tx_depth = 100;
+static int tx_signal = 10;
static FILE *lfile;
static lock_t llock;
return f;
}
+static void mpxy_set_options(void)
+{
+ FILE *f;
+ char s[120];
+ char opt[32], value[32];
+
+ if (!(f = fopen(opts_file, "r")))
+ return;
+
+ while (fgets(s, sizeof s, f)) {
+ if (s[0] == '#')
+ continue;
+
+ if (sscanf(s, "%32s%32s", opt, value) != 2)
+ continue;
+
+ if (!stricmp("log_file", opt))
+ strcpy(log_file, value);
+ else if (!stricmp("log_level", opt))
+ log_level = atoi(value);
+ else if (!stricmp("lock_file", opt))
+ strcpy(lock_file, value);
+ else if (!stricmp("buffer_pool_mb", opt))
+ buffer_pool_mb = atoi(value);
+ else if (!stricmp("service_id", opt))
+ service_id = (short) atoi(value);
+ else if (!stricmp("tx_depth", opt))
+ tx_depth = atoi(value);
+ else if (!stricmp("tx_signal", opt))
+ tx_signal = atoi(value);
+ }
+
+ fclose(f);
+}
+
+static void mpxy_log_options(void)
+{
+ mpxy_log(0, "log level %d\n", log_level);
+ mpxy_log(0, "lock file %s\n", lock_file);
+ mpxy_log(0, "server_port %d\n", service_id);
+ mpxy_log(0, "rdma buffer pool size %d\n", buffer_size);
+ mpxy_log(0, "transmit queue depth %d\n", tx_depth);
+ mpxy_log(0, "transmit completion rate %d\n", tx_signal);
+}
+
static int mpxy_open_lock(void)
{
int lock_fd;
printf("usage: %s\n", program);
printf(" [-P] - run as a standard process, (default daemon)\n");
printf(" [-O option_file] - option configuration file\n");
- printf(" (default %s/%s\n", MPXY_CONF_DIR, MPXY_OPTS_FILE);
+ printf(" (default %s/%s\n", MPXYD_CONF_DIR, MPXYD_OPTS_FILE);
}
-
int main(int argc, char **argv)
{
int i, op, daemon = 1;
lock_init(&log_lock);
logfile = pxd_open_log();
- mpxy_log(0, "MIC Indirect - STD (scif to dapl) Proxy Service\n");
+ mpxy_log(0, "MIC Indirect - SCIF to DAPL RDMA Proxy Service\n");
mpxy_log_options();
if (mpxy_open_devices()) {