netdev
[Top] [All Lists]

Re: zero copy transport API

To: <ak@xxxxxx>
Subject: Re: zero copy transport API
From: "Ky Srinivasan" <KSRINIVASAN@xxxxxxxxxx>
Date: Fri, 04 May 2001 09:13:08 -0600
Cc: <netdev@xxxxxxxxxxx>
Sender: owner-netdev@xxxxxxxxxxx
Thank you for the prompt response.

K. Y. Srinivasan

>>> Andi Kleen <ak@xxxxxx> 05/02/01 12:25PM >>>
On Tue, May 01, 2001 at 07:25:20PM +0200, Ky Srinivasan wrote:
> I am looking at using the page based API for sending data over TCP/IP. How is 
> the client notified that the data has been sent and acknowledged and it is ok 
> for the client to potentially reuse the memory. My application is an 
> in-kernel application. I had asked this question to Alan and he suggested 
> that I should send this question to you.

Please use line breaks when sending mail.

tcp_sendpage blocks like normal sendmsg(). You can set O_NONBLOCK
if you want non blocking operation, and wait using poll() for new space in 
the write buffer; but there is no callback per page on free. When it's done 
with the page its reference count is decreased and when it reached zero it is 
freed. What you can do is to pass the pages with a reference count > 0, then 
they won't get freed. This mode supports both sending from a persistent 
cache and from dynamically generated pages with fresh onetime memory, but you 
should play nice with the system and use the page allocator instead of using 
a private pool.


-Andi
-- 
Life would be so much easier if we could just look at the source code.


<Prev in Thread] Current Thread [Next in Thread>