|
|
About ::
TODO ::
Blog ::
RSS ::
Old blog ::
Projects ::
GIT ::
Gallery ::
Notes
Mon, 21 Aug 2006
Zero-copy sniffer.
I've completed entirely zero-copy sniffer based
on network (formerly tree) allocator.
I've sent the whole patchset to netdev@ for review. One
can find it and userspace utility in archive.
Design notes.
Network allocator steals pages from main system allocator and use them
for all network allocations (it's benefits are behind the scope of
zero-copy sniffer description, one can find network allocator features
on project's homepage),
thus it is possible to mmap all stolen pages
from userspace and provide special structure for each allocated chunk
into userspace which include offset from the begining of the node (each
node contains contiguous page-aligned memory region), node number and
other info. Since network allocator tracks number of users for for each
memory region, when the last one completes with data procesing (for
example userspace sniffer), it must commit that area back to allocator,
so NTA relies on correct values returned from userspace (if returned
from userspace chunk is not valid, it will not be freed, but if
userspace will not "free" chunks (by sending info about them back to
kernel) eventually maximum allowed number of shared free regions is
achieved and no more data will be sent to userspace (and be allowed to
be shared).
Since by default network tree allocator is used for all network
allocations (including unix sockets and netlink), sniffer will get all
those data and must somehow differentiate between them. That task is
out of the scope for this mail though, simple solution is just to
attach network allocator to network device (i.e. call NTA allocation
functions from netdev_alloc_skb() only).
I never run any special performance tests, but simple "top" command shows
much smaller CPU usage for zero-copy sniffer (although it gets all data
from every skbs in the machine) compared to tcpdump - 17% vs. 33%
maximum on my test machine.
Both sniffers dump received data into /dev/null.
Server side (where sniffers run) runs epoll() based trivial web server,
client side runs httperf.
Machines are connected over 100mbit LAN (e100 server NIC, 8169 client
NIC).
For zero-copy userspace netchannels I plan to only send to userspace
information about allocations which really belong to created netchannel
instead of info for each chunk.
Sending zero-copy support is in TODO.
/devel/networking/zcs :: Link / Comments ()
|