Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Mar 2010 16:08:12 +0300
From:      Alexander Bubnov <alexander.bubnov@gmail.com>
To:        freebsd-net@freebsd.org
Subject:   zero copy feature
Message-ID:  <c3e287ff1003180608p5ac726a3w51e9078fc9e093a6@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hello all!
I am sorry if I send this to incorrect mailist, but from HandBook I read:
freebsd-net    Networking discussion and TCP/IP source code
My question related to this topic, so I have sent it to you.

I and my friends would like to study net programming in details using for
this purpose FreeBSD as this OS implements some unique features from other
ones. Moreover FreeBSD did net improvements not long ago.
One of a feature we are interested in is subj. But unfortunately there is no
much documentation about this, so we can only suggests usage of zero-copy by
man zero_copy or zero_copy sockets.
Can you please clarify one moment in zero_copy?

How I understand receiving.

Server side worked through TCP.
  char*p=valloc(...);//I allocate some buffer by page aligned
  ...
  int sd = accept(...);
  ...
  read(sd,p,...);//trying to read

Buffer which I passed to read is supposed to used by kernel to copy TCP
payload to me avoiding its own socket buffer, another words my buffer
(pointed by p variable) which is passed to read is socket buffer in case
zero copy.

Question: Before accept returns descriptor to me the server can receive some
data. Where will be this data stored? Inside NIC cache? Or inside kernel
buffer which will be replaced by my buffer from read() later?

-- 
/BR, Alexander



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?c3e287ff1003180608p5ac726a3w51e9078fc9e093a6>