Re: Memory-mapping TCP/UDP send/recv buffer?

From: Stanley Feng \(MSFT\) (sfeng_at_microsoft_dot_com)
Date: 03/30/04


Date: Tue, 30 Mar 2004 12:32:15 -0800

Setting send buffer size to zero can give you zero copy on the send side.
Setting receive buffer size to zero can *not* give you zero copy on the
receive side. If data comes in and there is no pre-posted receive request,
TCP will have to buffer data in its receive window.

Article http://msdn.microsoft.com/msdnmag/issues/1000/Winsock/default.aspx,
section "Who managers the buffers" give you some brief ideas of what is
going on.

RE Memory mapping technique to achieve zero copy -

This has been widely deemed as a "software" solution to zero-copy along with
other techniques like "indicate-and-post", etc. They all have their
restrictions and limitations.

To obtain true zero copy, you will need hardware support. There are two
active tech. communities working on this -

www.rdmaconsortium.org

and the Rddp work group of IETF.

-- 
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples (if any) are subject to the terms specified
at http://www.microsoft.com/info/cpyright.htm"
"Olaf van der Spek" <OvdSpek@LIACS.NL> wrote in message
news:%23m8kdtZFEHA.3424@tk2msftngp13.phx.gbl...
>
> "Louis Solomon [SteelBytes]" <louis@steelbytes.spam-is-bad.com> schreef in
> bericht news:O1C9$abEEHA.3568@tk2msftngp13.phx.gbl...
> > from memory, setting the socket buffer size to 0 has this affect.
> >
> But that has other effects as well and you still have to manage the
buffers
> at the application level.
>
> One reason memory-mapping looked nice is that you could map the buffer
> twice, so that you can always do a full sequential read in a circular
buffer
> without dealing with the wrapping yourself.
>
> > -- 
> > Louis Solomon
> > www.steelbytes.com
> >
> >
> > "Olaf van der Spek" <OvdSpek@LIACS.NL> wrote in message
> > news:u8qjPXaEEHA.3672@TK2MSFTNGP09.phx.gbl...
> > > Hi,
> > >
> > > I'm wondering, is it possible to somehow memory-map the TCP/UDP
> send/recv
> > > buffers so the kernel does not have to copy data from kernel- to
> > > user-space
> > > and the other way around?
> > >
> > > -- 
> > >
> > > Olaf van der Spek
> > > Almere, Holland
> > > http://xccu.sourceforge.net/
> > >
> > >
> >
> >
>
>


Relevant Pages

  • Re: Checking link targets are NULL-terminated
    ... Here Just zero the very last byte in the buffer. ... is as space allocated at inode. ... The ext2 will cache this case and write the symlink directly ...
    (Linux-Kernel)
  • Re: which book to start with...?
    ... mov eax, 4 ... buffer resb 1000h ... Section .bss is nominally "uninitialized" data, but is in fact cleard to zero. ... i used nasm's one because intel's manuals are too big and detailed for me yet:) also i hate pdf files... ...
    (alt.lang.asm)
  • Re: Buffer Overflow
    ... while the OS memory allocation routines will clear (to ... I think the actual value hasn't been specified) the memory ... I think Alan's point was that since the allocated buffer will be written ... then there is no need to zero the buffer first. ...
    (comp.unix.programmer)
  • Re: Buffers in Assembly (NASM)
    ... can create a zero filled buffer in the bss section in NASM with this: ... I am unfamiliar with NASM and I think it also depends on the object ... mov ebx, esp;save the start point of the buffer ...
    (comp.lang.asm.x86)
  • Re: [patch 1/7] slab: introduce kzfree()
    ... allocators. ... All others overwrite some of the data region ... because it says please zero this buffer without modifying it. ...
    (Linux-Kernel)