Using Networking in barrelfish

In order to use networking in Barrelfish, you will need following modules in your menu.lst:

module /x86_64/sbin/e1000n
module /x86_64/sbin/NGD_mng cardname=e1000
module /x86_64/sbin/netd cardname=e1000

The device driver module

The first module is the network driver. In this example we are using e1000n as a driver. You can also use other drivers, and in that case you will have to change the cardname arguments to other modules. The reasoning behind it is that the NIC driver will export its services with this name which allows other modules to find the driver at runtime. As every NIC driver uses different name to export it's services, the modules need to know which service to lookup for.

You can pass other commandline parameters like bus, function, deviceid, device to exactly pinpoint which port and which device to use. Here is an example of module invocation with using many parameters:

module  /x86_64/sbin/e1000n core=3 bus=129 function=0x0 deviceid=0x107d device=0x0

Network management module `NGD_mng`

The next module NGD_mng provides services like port management. This is more relevant when NICs with large number of queues is being used.

netd module

and the last module netd handles the background network traffic and provides services like ARP lookup. The netd service is also responsible for getting an IP address with DHCP server. In case you want to give a static IP address to the NIC interface then you can pass commandline parameters providing ip address, netmask, getway and DNS address to netd. Here is an example:

module /x86_64/sbin/netd cardname=e1000 do_dhcp=0 ip=192.168.2.11 nm=255.255.255.0 gw=192.168.2.1 dns=192.168.2.2

Making sure networking works

Once the system is up and running (system will print the IP address it received over DHCP) you should be able to ping the IP-address. If pings are working, then you have correctly configured network setup!

Intel e10k NIC

Here is part of the menu.lst for starting 10k NIC.

module /x86_64/sbin/e10k function=1
module /x86_64/sbin/e10k_queue core=0 queue=0 interrupts=1 rsc=0
module /x86_64/sbin/NGD_mng cardname=e10k totalqueues=64 filtertype=1
module /x86_64/sbin/netd cardname=e10k do_dhcp=0 ip=10.110.4.49 nm=255.255.252.0 gw=10.110.4.49

This setup has an additional queue driver(e10k_queue) which handles single hardware queue-pair.

To enable debugging in the driver to see if it is starting, and where it is getting stuck, uncomment following line in barrelfish/usr/drivers/e10k/e10k_cdriver.c: 35

#define DEBUG(x...) printf("e10k: " x)
//#define DEBUG(x...) do {} while (0)