Netmap, a high-performance packet send/receive framework for FreeBSD

Luigi Rizzo has recently released Netmap, a high performance packet processing framework for FreeBSD. Its generic approach make it easily portable to various NIC drivers and even other operating systems. A libpcap wrapper and a Linux port are planned. The complete paper describing netmap is available here.

Bookmark and Share

RSS (Receive-Side Scaling) with Myricom Sniffer 10G

Recently, while implementing PacketDam for a customer company on top of the excellent Myri-10G card, I encountered a minor nuisance: the default hashing algorithm that splits the incoming traffic among cores uses both the source and destination IP addresses. Therefore, packets heading towards the same destination from different source addresses end up in different queues. That isn’t a huge problem for most packet analysis software, but every PacketDam instance needs to see all traffic belonging to a given destination in order to work properly.

Luckily, Myricom has been kind enough to provide a packet sniffing API (which is also neatly wrapped in recent versions of libpcap) which enables the programmer to fine tune the packet hashing. To use this feature with any pcap-based application, one needs to patch libpcap’s pcap-snf.c as follows:

  • Declare a custom struct snf_rss_params:

  • Optionally overwrite the environment:

  • Pass the custom hashing function pointer to snf_open() by filling snf_rss_params appropriately:

  • Implement your custom hashing function:


The SNF library then applies a modulo (number of cores) to the return value to obtain the queue index for the current packet. The above function will yield an uneven packet distribution. A non-cryptographic hashing function (I prefer MurmurHash, and so does the Myricom firmware) can be used to spread the load equally across the cores, as well as for mapping IPv6 destination addresses.

Bookmark and Share