| 2 | = NetFPGA !OpenFlow switch = |
| 3 | According to the guides, !OpenVswitch provides a kenel implementation of the OF switch, whereas Stanford's reference switch is purely userspace. The former is faster, the latter more customizable. |
| 4 | |
| 5 | This is the latest set of instructions for installing NetFPGA drivers on Ubuntu (10.10), and making it work as an !OpenFlow switch. It is assumed that your working directory is /opt/. |
| 6 | == I. NetFPGA setup == |
| 7 | === 1.1 Download sources/dependencies === |
| 8 | `cd` to /opt/ and fetch the following: |
| 9 | |
| 10 | * netfpga_full_2_2_0.tar.gz from: |
| 11 | http://www.netfpga.org/releases/netfpga_full_2_2_0.tar.gz [[BR]] |
| 12 | REF: http://netfpga.org/foswiki/NetFPGA/OneGig/Releases |
| 13 | |
| 14 | * netfpga_openflow_switch_1_0_0-4.tar.gz from: |
| 15 | http://netfpga.org/beta/distributions/netfpga_openflow_switch_1_0_0-4.tar.gz [[BR]] |
| 16 | REF: http://netfpga.org/foswiki/bin/view/NetFPGA/OneGig/OpenFlowNetFPGA100 |
| 17 | |
| 18 | * dependencies |
| 19 | {{{ |
| 20 | apt-get update |
| 21 | apt-get install build-essential linux-headers-`uname -r` ncurses-dev libnet1-dev libxml-simple-perl libio-interface-perl liblist-moreutils-perl liberror-perl git-core libpcap0.8 libpcap0.8-dev |
| 22 | }}} |
| 23 | === 1.2 Compatibility fixes === |
| 24 | The following changes have to be made in order to compile the drivers on Ubuntu. |
| 25 | * Add the following symlinks: |
| 26 | {{{ |
| 27 | ln /usr/bin/lspci /sbin/lspci |
| 28 | ln /usr/bin/setpci /sbin/setpci |
| 29 | }}} |
| 30 | |
| 31 | * /opt/netfpga/lib/C/kernel/nf2util.h : add in the main #ifdef block: |
| 32 | {{{ |
| 33 | // Replace SA_SHIRQ with IRQF_SHARED on newer kernels |
| 34 | #ifndef SA_SHIRQ |
| 35 | #define SA_SHIRQ IRQF_SHARED |
| 36 | #endif |
| 37 | }}} |
| 38 | |
| 39 | * /etc/default/grub: add "vmalloc=512m" to GRUB_CMDLINE_LINUX_DEFAULT and do `update-grub` |
| 40 | |
| 41 | For the kernel: |
| 42 | * If using kernel version 2.6.35-25, upgrade to 2.6.35 (`uname -ar` should show you which one you are running): |
| 43 | {{{ |
| 44 | apt-get install linux-headers-2.6.35-30-generic linux-image-2.6.35-30-generic |
| 45 | }}} |
| 46 | |
| 47 | * Reboot. After reboot, check that the kernel flags are correct: |
| 48 | {{{ |
| 49 | dmesg | grep vmalloc |
| 50 | [ 0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-2.6.35-30-generic root=UUID=c90285a2-48de-4ab0-950f-241817516ad8 ro vmalloc=512m console=tty0 console=ttyS0,115200n8 |
| 51 | [ 0.000000] vmalloc : 0xdf7fe000 - 0xff7fe000 ( 512 MB) |
| 52 | }}} |
| 53 | |
| 54 | === 1.3 Compile drivers === |
| 55 | * export environment variables: |
| 56 | {{{ |
| 57 | export NF_ROOT=/opt/netfpga #(wherever your netfpga base files are) |
| 58 | source ${NF_ROOT}/bin/nf_profile |
| 59 | }}} |
| 60 | |
| 61 | * from /opt/netfpga: `make`; `make install` |
| 62 | |
| 63 | After compilation, load kernel module with `modprobe nf2`. If all goes well, you should see the an entry if you check with `lsmod | grep nf2`. At this point, you can load bitfiles and such by first running `cpci_reprogram` and then using nf_download. You should see something like this: |
| 64 | {{{ |
| 65 | # cpci_reprogram.pl --all |
| 66 | Loading the CPCI Reprogrammer on NetFPGA 0 |
| 67 | Loading the CPCI on NetFPGA 0 |
| 68 | CPCI on NetFPGA 0 has been successfully reprogrammed |
| 69 | # nf_download /opt/netfpga/bitfiles/reference_switch.bit |
| 70 | Found net device: nf2c0 |
| 71 | Bit file built from: nf2_top_par.ncd;HW_TIMEOUT=FALSE |
| 72 | Part: 2vp50ff1152 |
| 73 | Date: 2011/ 1/20 |
| 74 | Time: 6: 8:48 |
| 75 | Error Registers: 0 |
| 76 | Good, after resetting programming interface the FIFO is empty |
| 77 | Download completed - 2377668 bytes. (expected 2377668). |
| 78 | DONE went high - chip has been successfully programmed. |
| 79 | CPCI Information |
| 80 | ---------------- |
| 81 | Version: 4 (rev 1) |
| 82 | |
| 83 | Device (Virtex) Information |
| 84 | --------------------------- |
| 85 | Project directory: reference_switch |
| 86 | Project name: Reference Switch |
| 87 | Project description: Reference Switch |
| 88 | |
| 89 | Device ID: 3 |
| 90 | Version: 1.0.0 |
| 91 | Built against CPCI version: 4 (rev 1) |
| 92 | |
| 93 | Virtex design compiled against active CPCI version |
| 94 | }}} |
| 95 | |
| 96 | == II. !OpenFlow setup == |
| 97 | === 2.1 dependencies === |
| 98 | * packages: |
| 99 | {{{ |
| 100 | apt-get install autoconf libtool |
| 101 | }}} |
| 102 | |
| 103 | * Use git to pull NetFPGA-specific !OpenFlow sources to /opt/: |
| 104 | {{{ |
| 105 | git clone git://openflowswitch.org/openflow.git |
| 106 | cd openflow |
| 107 | git checkout -b 1.0.0-netfpga origin/devel/tyabe/1.0.0-netfpga |
| 108 | }}} |
| 109 | === 2.2 build !OpenFlow === |
| 110 | {{{ |
| 111 | ./boot.sh |
| 112 | cd ./hw-lib/nf2 |
| 113 | wget http://openflowswitch.org/downloads/netfpga/openflow_switch.bit.100_3.tar.gz |
| 114 | tar zxvf openflow_switch.bit.100_3.tar.gz ==> we need newer one from NF site:http://www.netfpga.org/releases/netfpga_openflow_switch_1_0_0-3.tar.gz |
| 115 | cd ../../ |
| 116 | ./configure --enable-hw-tables=nf2 |
| 117 | make |
| 118 | make install |
| 119 | }}} |
| 120 | |
| 121 | After compilation, copy of_start.sh and of_stop.sh from /opt/netfpga/projects/openflow_switch/sw/. |
| 122 | |
| 123 | ---- |
| 124 | See below for old instructions. |
| 125 | ---- |