Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Mar 2010 17:53:37 +0000
From:      Bruce Simpson <bms@incunabulum.net>
To:        freebsd-net@freebsd.org
Subject:   Re: why zero-copy sockets(9) are not popular?
Message-ID:  <4BA50BA1.5060401@incunabulum.net>
In-Reply-To: <c3e287ff1003200306l162800bfgfc0eecec04401917@mail.gmail.com>
References:  <c3e287ff1003200306l162800bfgfc0eecec04401917@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 03/20/10 10:06, Alexander Bubnov wrote:
> Hello, all!
> Anybody knows why zero copy is not popular although this technique  allows
> to increase performance of servers? It is very hard to find any examples of
> zero-copy for FreeBSD.
>    

Transmit is easy. Receive is hard.

The whole concept of zero-copy revolves around being able to use 
page-flipping to map buffers in user and kernel space, to amortize the 
cost of copies across that system boundary.

The compromise usually taken is to use the sendfile() API, or rely on 
TCP Segmentation Offload (TSO), much like Microsoft's Chimney stack does 
in Windows 7. Unfortunately, sendfile() only covers transmit. TSO only 
offloads up to the point where sockets hit the card; TSO can offload TCP 
stream reassembly, but you still have to copy from the kernel buffers 
into userland.

True zero-copy sockets generally require scatter/gather DMA engine 
support, and TCP/IP header splitting, to do zero-copy recieve.

S/G PCI DMA cores are often custom designed, and you tend not to find 
them in off-the-shelf VHDL libraries. That IP (as in intellectual 
property) still has cost.

Historically the only cards in FreeBSD which supported this, were the 
Tigon-II, which got bought by Broadcom (bge is the Tigon-III). Modified 
firmware was required to do this.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4BA50BA1.5060401>