Implement a work-around for poor ggate write performance.
This commit is contained in:
parent
4d00f78b40
commit
2663c8855e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=168422
@ -6,6 +6,7 @@ PROG= ggatec
|
|||||||
MAN= ggatec.8
|
MAN= ggatec.8
|
||||||
SRCS= ggatec.c ggate.c
|
SRCS= ggatec.c ggate.c
|
||||||
|
|
||||||
|
CFLAGS+= -DMAX_SEND_SIZE=32768
|
||||||
CFLAGS+= -DLIBGEOM
|
CFLAGS+= -DLIBGEOM
|
||||||
CFLAGS+= -I${.CURDIR}/../shared
|
CFLAGS+= -I${.CURDIR}/../shared
|
||||||
|
|
||||||
|
@ -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
|
ssize_t
|
||||||
g_gate_send(int s, const void *buf, size_t len, int flags)
|
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;
|
const unsigned char *p = buf;
|
||||||
|
|
||||||
while (len > 0) {
|
while (len > 0) {
|
||||||
done2 = send(s, p, len, flags);
|
done2 = send(s, p, MIN(len, MAX_SEND_SIZE), flags);
|
||||||
if (done2 == 0)
|
if (done2 == 0)
|
||||||
break;
|
break;
|
||||||
else if (done2 == -1) {
|
else if (done2 == -1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user