TAP - UofG-netlab/BPFabric GitHub Wiki

Overview

If you need to implement a function outside the capabilities of BPFabric and eBPF you can use a TAP interface as a normal port for the switch. From the switch perspective the logic is exactly the same and the packet will be processed as any other port in the pipeline.

Softswitch

Using the softswitch you can use the --tap argument to automatically create and bind TAP interfaces

sudo ./softswitch --tap="tap1" --tap="tap2" -d 1 -v -p eno3 eno4

adding tap interface tap1
adding tap interface tap2
Setting up 4 interfaces
tap1 failed to set SIOCETHTOOL ioctl: Operation not supported
Interface tap1, index 0, fd 5
tap2 failed to set SIOCETHTOOL ioctl: Operation not supported
Interface tap2, index 1, fd 6
Interface eno3, index 2, fd 7
Interface eno4, index 3, fd 8

You can see that 4 interfaces have been attached to the switch. You can then bind any application you want to this TAP interface.

DPDK

DPDK EAL has a built-in ability to create TAP interfaces, you can refer to the official DPDK documentation for more information. As an example you can use the following to create a switch with 1 tap interface.

Note that you must update the port mask to enable the tap interface as you would do with any other port on the switch.

./bpfabric -l 0-4 -n 4 --vdev=net_tap0 -- -q 1 -p 7 -d 1