|
From: | Timmy Brolin |
Subject: | Re: [lwip-users] tcp_write with zero-copy |
Date: | Fri, 15 Feb 2008 00:16:06 +0100 |
User-agent: | Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) |
Ok, I am bringing up an really old discussion now, but has anything
happened since back then? A tcp_write capable of zero-copy (by using pbuf chains for example) would be a very useful feature. Where I work we mainly work with request-response protocols such as modbus and CIP "Ethernet/IP" (where IP stands for Industrial Protocol). Whenever we get a TCP request packet we are to immediately produce a response, and the response TCP packet is usually almost identical to the request packet. With a tcp_write function capable of accepting pbuf chains, all I would have to do when I get a request is change a few bytes in the packet to turn it into a response packet, perhaps append a few bytes at then end and then feed it back into lwip using tcp_write. This way I would not have to call any alloc function (which takes both time and memory, and always runs the risk of failing on a low mem embedded system), and I would save one or in some cases two memcopy. I am aware that the tcp_write function has some limited zero-copy functionality if the data to send is constant. While this is a very nice feature, the only application I can think of where it is useful is simple web servers with html and images stored in flash. And even then you cannot use it if your webserver supports writing to the flash memory. I think a pbuf capable tcp_write could a very useful for applications such as webservers with dynamic content as well. The webserver can build the dynamic html in a pbuf chain and then send the chain to tcp_write. Today lwip effectively use two separate memory pools for rx and tx. Using pbufs for both rx and tx would probably be more memory efficient in many cases. So, do you think it can be done? Has anyone tried? Regards, Timmy Brolin Sathya Thammanur wrote: Sorry Christian for the email. Has anyone tried true zero-copy for the RAW API mode? Are there changes needed in lwIP to get this working? |
[Prev in Thread] | Current Thread | [Next in Thread] |