mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* network socket receive splice size
@ 2008-06-20 19:04 Ezra Kissel
  0 siblings, 0 replies; only message in thread
From: Ezra Kissel @ 2008-06-20 19:04 UTC (permalink / raw)
  To: linux-kernel

I am using the splice syscall in kernel 2.6.25.4 with network socket 
receive to splice incoming and outgoing TCP sockets. I perform something 
like the following:

#define SPLICE_SIZE (12*1024)

int fd[2];
ret = pipe(fd);

ret = splice(src, NULL, fd[1], NULL, SPLICE_SIZE, SPLICE_F_MORE | 
SPLICE_F_MOVE);

bytes_left = ret;

while (bytes_left > 0) {
   ret = splice(fd[0], NULL, sink, NULL, bytes_left, SPLICE_F_NONBLOCK);
   bytes_left -= ret;
}

This works well when SPLICE_SIZE is around 12K or lower, but anything 
much more than that will cause the src splice call to block either right 
away or after a few iterations. It almost seems as though the pipe 
buffer is becoming full although I have used poll to check for both 
sockets and pipe fds before calling splice, and the sink splice call 
always sends the current number of bytes. I have also tried virtually 
all combinations of the SPLICE_F_ options without success. Has anyone 
run into a similar issue with socket-to-socket splicing and larger 
splice sizes? I would really like to use the full 64K splice size to and 
from the pipe.

I should mention that the splice test applications do work correctly 
with 64K splice sizes when splicing to/from a network socket(s) to 
STDOUT or STDIN. Any thoughts?

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-06-20 19:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-20 19:04 network socket receive splice size Ezra Kissel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®