zero_copy in RTEMS

Chris Johns chrisj at rtems.org
Tue Dec 23 05:13:18 UTC 2008


??? wrote:
> Thanks for your reply, both. 
>         I looked for some information about zerco copy from the 
> internet, and it said that the zero copy is trying to avoid the data 
> copy between the kernel space and the user space, but the memmory space 
> is flat in RTEMS, that is to say there is no difference between kernel 
> space and user space.

If the "zero-copy" is related to user/kernel interface present in Unix kernels
then we do not have this.

There has to be a copy at some point. The read call used to read data from a
socket and a kernel do not know the order of data being received so it cannot
have that user call's read buffer at the hardware interface when the user's
data arrives. I wonder if the zero copy implementations you are looking at
have modified the socket interface.

> So I wonder is that possible to realize zero copy 
> in a network interface card driver, and if there is, how to realize it 
> ,is there some source code which I can look up into?I didn't find 
> Coldfire FEC and the EMAC you amentioned in the RTEMS source code.

You can arrange the mbufs in a driver to support scatter/gather type DMA
hardware. Once such example is the 68360 driver Eric wrote:

http://www.rtems.org/cgi-bin/viewcvs.cgi/rtems/c/src/lib/libbsp/m68k/gen68360/network/network.c?rev=1.19

The data is loaded into mbufs when receiving and transmitted from a list of
mbufs when sending.

Regards
Chris

>         Thanks again.
> 
> 2008/12/22 Chris Johns <chrisj at rtems.org <mailto:chrisj at rtems.org>>
> 
>     Gene Smith wrote:
>      > ??? wrote, On 12/19/2008 07:14 AM:
>      >> Hi all:
>      >>        Does anyone know how to implement zero copy in RTEMS ?
>      >>        Thanks in advance.
>      >
>      > I assume you are referring to the tcp/ip stack? I think some DMA
>      > controllers can put their inputs and accept outputs directly from BSD
>      > mbufs (like EMAC on ppc405gpr controller).
> 
>     Same with the Coldfire FEC.
> 
>      > But I am not sure how many
>      > other places (or even if) the packets are memcpy'd in the stack.
> 
>     Only when placing the data into your buffer when receiving or taking
>     it out to
>     send. The mbufs are part of the implementation and not part of the
>     socket API
>     so a copy is needed at that interface.
> 
>     Regards
>     Chris
> 
> 
>     _______________________________________________
>     rtems-users mailing list
>     rtems-users at rtems.com <mailto:rtems-users at rtems.com>
>     http://rtems.rtems.org/mailman/listinfo/rtems-users
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.com
> http://rtems.rtems.org/mailman/listinfo/rtems-users




More information about the users mailing list