aboutsummaryrefslogtreecommitdiffstats
path: root/sbin/ggate
diff options
context:
space:
mode:
authorPawel Jakub Dawidek <pjd@FreeBSD.org>2007-04-06 11:19:48 +0000
committerPawel Jakub Dawidek <pjd@FreeBSD.org>2007-04-06 11:19:48 +0000
commit2663c8855edbf00078d551c9c351ddde4c595bed (patch)
tree88e376ba5139e22eb2e8c716704023cefb9f8fba /sbin/ggate
parent4d00f78b4024fb84f407ebe13fd7a29a7936ab09 (diff)
downloadsrc-2663c8855edbf00078d551c9c351ddde4c595bed.tar.gz
src-2663c8855edbf00078d551c9c351ddde4c595bed.zip
Implement a work-around for poor ggate write performance.
Notes
Notes: svn path=/head/; revision=168422
Diffstat (limited to 'sbin/ggate')
-rw-r--r--sbin/ggate/ggatec/Makefile1
-rw-r--r--sbin/ggate/shared/ggate.c12
2 files changed, 12 insertions, 1 deletions
diff --git a/sbin/ggate/ggatec/Makefile b/sbin/ggate/ggatec/Makefile
index c49cfe819816..4d8917f3164c 100644
--- a/sbin/ggate/ggatec/Makefile
+++ b/sbin/ggate/ggatec/Makefile
@@ -6,6 +6,7 @@ PROG= ggatec
MAN= ggatec.8
SRCS= ggatec.c ggate.c
+CFLAGS+= -DMAX_SEND_SIZE=32768
CFLAGS+= -DLIBGEOM
CFLAGS+= -I${.CURDIR}/../shared
diff --git a/sbin/ggate/shared/ggate.c b/sbin/ggate/shared/ggate.c
index 09e35d36434a..dd40790120d1 100644
--- a/sbin/ggate/shared/ggate.c
+++ b/sbin/ggate/shared/ggate.c
@@ -222,6 +222,16 @@ g_gate_load_module(void)
}
}
+/*
+ * When we send from ggatec packets larger than 32kB, performance drops
+ * significantly (eg. to 256kB/s over 1Gbit/s link). This is not a problem
+ * when data is send from ggated. I don't know why, so for now I limit
+ * size of packets send from ggatec to 32kB by defining MAX_SEND_SIZE
+ * in ggatec Makefile.
+ */
+#ifndef MAX_SEND_SIZE
+#define MAX_SEND_SIZE MAXPHYS
+#endif
ssize_t
g_gate_send(int s, const void *buf, size_t len, int flags)
{
@@ -229,7 +239,7 @@ g_gate_send(int s, const void *buf, size_t len, int flags)
const unsigned char *p = buf;
while (len > 0) {
- done2 = send(s, p, len, flags);
+ done2 = send(s, p, MIN(len, MAX_SEND_SIZE), flags);
if (done2 == 0)
break;
else if (done2 == -1) {