DORMANTno replies

[PATCH 4/4] librdamcm/rsocket: Use configuration files to specify default settings

From: Hefty, Sean <hidden>
Date: 2012-06-06 18:42:02
Subsystem: the rest · Maintainer: Linus Torvalds

Give an administrator control over the default settings
used by rsockets.  Use files under %sysconfig%/rdma/rsocket as shown:

mem_default - default size of receive buffer(s)
wmem_default - default size of send buffer(s)
sqsize_default - default size of send queue
rqsize_default - default size of receive queue
inline_default - default size of inline data

If configuration files are not available, rsockets will continue to
use internal defaults.

Signed-off-by: Sean Hefty <redacted>
---
I have adding an rsocket man page that includes this information on my
to do list.

 src/rsocket.c |   51 ++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 44 insertions(+), 7 deletions(-)
diff --git a/src/rsocket.c b/src/rsocket.c
index d7344c7..5e0e413 100644
--- a/src/rsocket.c
+++ b/src/rsocket.c
@@ -53,19 +53,20 @@
 #include "cma.h"
 #include "indexer.h"
 
-#define RS_INLINE 64
 #define RS_OLAP_START_SIZE 2048
 #define RS_MAX_TRANSFER 65536
-#define RS_QP_SIZE 384
 #define RS_QP_MAX_SIZE 0xFFFE
-#define RS_QP_MIN_SIZE 8
 #define RS_QP_CTRL_SIZE 4
 #define RS_CONN_RETRIES 6
 #define RS_SGL_SIZE 2
-#define RS_BUF_SIZE (1 << 17)
 static struct index_map idm;
 static pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
 
+static uint16_t def_inline = 64;
+static uint16_t def_sqsize = 384;
+static uint16_t def_rqsize = 384;
+static uint32_t def_mem = (1 << 17);
+static uint32_t def_wmem = (1 << 17);
 static uint32_t polling_time = 10;
 
 /*
@@ -216,6 +217,40 @@ void rs_configure(void)
 		fscanf(f, "%u", &polling_time);
 		fclose(f);
 	}
+
+	if ((f = fopen(RS_CONF_DIR "/inline_default", "r"))) {
+		fscanf(f, "%hu", &def_inline);
+		fclose(f);
+
+		if (def_inline < RS_MIN_INLINE)
+			def_inline = RS_MIN_INLINE;
+	}
+
+	if ((f = fopen(RS_CONF_DIR "/sqsize_default", "r"))) {
+		fscanf(f, "%hu", &def_sqsize);
+		fclose(f);
+	}
+
+	if ((f = fopen(RS_CONF_DIR "/rqsize_default", "r"))) {
+		fscanf(f, "%hu", &def_rqsize);
+		fclose(f);
+	}
+
+	if ((f = fopen(RS_CONF_DIR "/mem_default", "r"))) {
+		fscanf(f, "%u", &def_mem);
+		fclose(f);
+
+		if (def_mem < 1)
+			def_mem = 1;
+	}
+
+	if ((f = fopen(RS_CONF_DIR "/wmem_default", "r"))) {
+		fscanf(f, "%u", &def_wmem);
+		fclose(f);
+
+		if (def_wmem < 1)
+			def_wmem = 1;
+	}
 	init = 1;
 out:
 	pthread_mutex_unlock(&mut);
@@ -264,9 +299,11 @@ static struct rsocket *rs_alloc(struct rsocket *inherited_rs)
 		rs->rq_size = inherited_rs->rq_size;
 		rs->ctrl_avail = inherited_rs->ctrl_avail;
 	} else {
-		rs->sbuf_size = rs->rbuf_size = RS_BUF_SIZE;
-		rs->sq_inline = RS_INLINE;
-		rs->sq_size = rs->rq_size = RS_QP_SIZE;
+		rs->sbuf_size = def_wmem;
+		rs->rbuf_size = def_mem;
+		rs->sq_inline = def_inline;
+		rs->sq_size = def_sqsize;
+		rs->rq_size = def_rqsize;
 		rs->ctrl_avail = RS_QP_CTRL_SIZE;
 	}
 	fastlock_init(&rs->slock);


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help