Go rewrite of the ixy network driver
Branch: master
Clone or download
Latest commit 7627fdc Jan 22, 2019

README.md

ixy.go

ixy.go is a Go rewrite of the ixy userspace network driver. Check out my thesis Writing Network Drivers in Go or watch the recording of our talk at 35c3 to learn more and check out the other ixy implementations.

ixy.go is designed to be readable, idiomatic Go code with the goal of not only being fast, but also serve as learning material for those interested. We only support the Intel 82599 10GbE NICs (ixgbe family). This is only tested on Debian distributions.

Features

  • just over 1000 lines of Go code for the driver and two sample applications (of which the forwarder is currently not working)
  • simple API to use, see this README
  • almost matches the speed of the C implementation but with the added features of Go (~10% performance loss, depending on batch sizes and CPU speed)

Build instructions

You will need the go compiler. Install using the script provided (ixy.go-install.sh):

sudo ./ixy.go-install.sh

Go is added to PATH by the script but to use it before a restart execute

source ~/.profile

The script downloads the repository to ~/go/src/ixy.go:

cd ~/go/src/ixy.go

If you already have Go installed, just clone the repository instead and continue from here.

Ixy.go uses hugepages. To enable them run:

sudo ./setup-hugetlbfs.sh

To build the binaries, cd into the folders of the respective application and execute

go build

The built binaries are located the respective folders.

Usage

There are two sample applications included in the ixy.go. You can run the packet generator with

sudo ./fwd 0000:AA:BB.C 0000:DD:EE.F

The forwarder does not work yet.

The arguments have to the pci slots of the NIC. They can be looked up by using the lspci command

API

All capitalized variables and functions are exported. This includes the following:

device.go: IxyInterface, IxyDevice, IxyInit, IxyTxBatchBusy

ixgbe.go: ReadStats, RxBatch, TxBatch

memory.go: MemoryAllocateMempool, PktBufAllocBatch, PktBufAlloc, PktBufFree

stats.go: DeviceStats, PrintStats, PrintStatsDiff, StatsInit

Example

fwd and pktgen contain all sample applications included.

Internals

driver/ixgbe.go contains the core logic.

License

ixy.go is licensed under the MIT license.

Disclaimer

ixy.go is not production-ready. Do not use it in critical environments. DMA may corrupt memory.