Re: Linux Zero Copy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nagendra Singh Tomar wrote:
> Why do we not have a recvfile() also which copies data from the socket 
> directly to a file (page cache).

Mainly because it is much harder to do than sendfile().

Typically, each packet is DMAd from the network card to some place in
RAM before the kernel has an opportunity to look at the packet header.

To receive directly to the page cache, something would have to analyse
each packet header _before_ the data was transferred from the network
card, to decide where the data should go.

Among other things, this requires special hardware support, which is
more complex and rarer than the scatter-gather + checksum support used
by sendfile(), which many NICs have.

Eventually this might happen, for limited set of network cards
(possibly ones which don't exist yet), and it has been suggested that
async (aio) read or async recvfile is a good interface for this.

Another reason it is not done is that transmitting data is considered
more important on servers, which often transmit much more data than
they receive.

-- Jamie

-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux