Александр Черников: Использование netmap
DESCRIPTION
Про netmap наверняка слышал каждый, кто отслеживает новости, связанные с FreeBSD. В докладе рассмотрим, чем хорош netmap, что уже сделано на его основе, а что только планируется сделать.TRANSCRIPT
Alexander ChernikovNetwork Engineer
Using netmap
What is netmap?
4
What is Netmap?
• All-in-one solution? No.– Part of framework to build solutions? Yes.
• Efficient Instrument for I/O
• Other instruments needed– Memory allocator (like UMA in userspace)– Packet chaining libraries (handling fragments)– Lockless queues– Flow inspection primitives
5
Similar tools
• Intel DPDK– WindRiver INP
• PacketShader I/O engine
• PF_RING
6
Key Features
• User-space
• Zero-copy
• Batching
• Simplicity
• Hardware independent
7
Programming simplicity
• Get NIC info– ioctl(fd, NIOCGINFO, &nmr)
• Open HW queue (or entire NIC)– ioctl(fd, NIOCREGIF, &tifreq)
• Mmap ring memory– mmap(0, mmap_size, .., fd, 0);
• Go!– select() / poll() on fd
8
Using NIC rings for balancing
• Thread-per-ring model
• Process-per-ring model
9
Framework simplicity
• Targets to different NICs
• ~400 lines per driver– Not many places for bugs to hide– Complicated drivers code (not related to nemap)
• Currently supported– if_em(4)– igb(4)– ixgbe(4)– re(4)
10
Existing open-source users
• Pkt-gen
• libpcap consumers
• Ipfw
• Click router
• Sandstorm web server
11
Users: pkt-gen
• /usr/src/tools/tools/netmap/
• Linerate sending/receiving data
• Src/Dst address wildcards
• Features– MAC rewriting
– IP src/dst wildcards
– PCAP replay
• Note– Check flow control ( dev.ix.*.fc )
– Check older NICs ( Intel 82598 )
12
Users: libpcap consumers
• /usr/src/tools/tools/netmap/
• Transparent
• s/lpcap/lnetmap/
• Improvements in 'easy' packet processing
13
Users: ipfw
• 20120813 version
• On-going work to ease kernel/userland sync
• Pros– Batching
• Cons– Not all features work (iface matching, fwd, etc..)
14
Users: Sandstorm
• All-in-one app– ethernet library
– libtcpip as light-weight TCP stack
– libmnio as netmap i/o abstraction
• Arch– optimizied for specific task
– small number of components
– ability to do easy cross-layering
– (mostly) lockless scheme
• Features– Very high throughput for small files
15
Future: routing
• /usr/ports/net/netmap_router
• Near to zero configuration
• Existing utilities to control interfaces/routing
• Kernel for control plane
• Netmap appliance for data plane
• Modified routing daemon for route export