Wednesday, July 4, 2012

10. Selftest

1. For selftest, connect nf2c0 to nf2c1 and nf2c2 to nf2c3 using an RJ45.

2. Ensure the nf2cx interfaces are up. You can check this by using the command :
3. If you can see the 4 interfaces (nf2c0, nf2c1, nf2c2, nf2c3) in the list, that means that the interfaces are up.

 4. If the 4 interfaces can't be seen in the list, then they have to be pulled up by using the command :
ifconfig nf2c0 up
ifconfig nf2c1 up
ifconfig nf2c2 up
ifconfig nf2c3 up
or for i in `seq 0 3`; do ifconfig nf2c$i up; done
5. Load self-test bitfile
nf_download ~/netfpga/bitfiles/selftest.bit
6. Run Selftest
a - If you have the SATA cable connected, then use the command :
b - If you do not have the SATA cable connected, then use the command :
~/netfpga/projects/selftest/sw/selftest -n
c - To get the continuous output, add a -c to the above commands. The advantage of getting a continuous output is that you can correct the errors (described later on) in real time.

7. While running the selftests, I got 2 errors. PHY Test failed and DMA Test failed. I corrected the errors as follows :
A - PHY Test Failure : PHY Test failure occurs due to improper connection between the ports. Run the selftest in continuous mode by using the command : ~/netfpga/projects/selftest/sw/selftest -n -c. Now under PHY Test, check if the packets being are going to BAD or GOOD. If the packets are going to GOOD, then it is fine otherwise you would notice that there is a no link appearing for that port. The ports of the NetFPGA are very sensitive. So even though it appears that the ports are connected, they may actually not be connected. So readjust the connections till all the packets go into GOOD. This would result in passing of the PHY Test.

 B - DMA Test Failure : This may result due to multiple reasons, vis-a-vis, the following :
1. Memory hasn't been allocated for the NetFPGA (Article 2 of this blog)
2. The nf2cX interfaces haven't been turned up (Refer article 9 to turn up the interfaces)
3. The CPCI hasn't been reprogrammed. So try reprogramming the CPCI using the command : /usr/local/sbin/ --all

9. Compile and Load Driver

1. Compile : 
cd ~/netfpga
Sample Output : Follow the link
If your output is not similar to the one described in the linked page, you should try checking whether the NetFPGA Environment variables were successfully added to the .bashrc file or not, because I found this was the most common error. The error could be like (just the last few lines) :
make[1]: /bin/ Command not found
make[1]: *** [registers] Error 127
make[1]: Leaving directory `/home/nchc/netfpga/projects/scone/sw'
make: *** [projects/scone/sw] Error 2
So for getting rid of this error, just use the command :
This command for some reason doesn't setup the Perl path correctly. For setting up the Perl path, use the command :
export PERL5LIB=$NF_ROOT/lib/Perl5:$PERL5LIB
This should get everything to compile.

2. Load Driver and Tools :

make install
Sample Output : Follow the link

Now reboot the machine. Reboot is required to load the newly compiled driver.
3. After the reboot, log in as root. Verify if the driver is loaded using the command :
lsmod | grep nf2
Sample Correct Output : nf2      23308      0
4. Verify NetFPGA Interfaces
1) Verify that the four nf2c* interfaces have been loaded successfully by using the command :
ifconfig -a | grep nf2
2) Sample Correct Output :
nf2c0 Link encap:Ethernet HWaddr 00:4E:46:32:43:00
nf2c1 Link encap:Ethernet HWaddr 00:4E:46:32:43:01
nf2c2 Link encap:Ethernet HWaddr 00:4E:46:32:43:02
nf2c3 Link encap:Ethernet HWaddr 00:4E:46:32:43:03
3) If you don't get the output as mentioned in the sample output, then you can turn the interfaces up by typing :
ifconfig  nf2c0  up
ifconfig  nf2c1  up
ifconfig  nf2c2  up
ifconfig  nf2c3  up
The other possibility is that you are not logged onto the OS which has the NetFPGA installed on it. So when booting, ensure that you log into the OS with the NetFPGA installed on it.
5. Reprogram the CPCI
1) Run the CPCI Reprogramming Script
/usr/local/sbin/ --all
2) Sample Output :
Loading the CPCI Reprogrammer on NetFPGA 0
Loading the CPCI on NetFPGA 0
CPCI on NetFPGA 0 has been successfully reprogrammed

3) To have the CPCI reprogrammed when the computer boots, follow the following steps :
a - gedit /etc/rc.local
b- Add the following line to the file :  /usr/local/netfpga/lib/scripts/cpci_reprogram/ --all and save it.

Wednesday, June 27, 2012

8. Running the Java GUI

1. Replace the GUI folder in the location root/netfpga/lib/java/gui by the GUI folder in the location from filesystem /usr/local/netfpga/lib/java/gui

2. To run the Java GUI, we use the command ./ from root/netfpga/lib/java/gui

3. If the GUI fails to run, use the commands :
make clean
and then repeat step 2.

4. If the GUI fails to run even after step 3, you can run the GUI from the folder /usr/local/netfpga/lib/java/gui using the command ./

7. Installing Packages and Kernel Updation

1. Find the kernel version you are currently running using :  uname -r
Sample Output : 2.6.9-42.el5

2. Install the packages for compiler, cursor movement and network library :
yum -y install gcc  
yum -y install ncurses-devel  
yum -y install libnet  
yum -y install compat-libstdc++-296.i386  
yum -y install libpcap-devel

3. Install packages for packet capture, raw IP packet sending and error reporting in Perl.
yum -y install perl-Net-Pcap  
yum -y install perl-Net-RawIP.i386   
yum -y install perl-Error.noarch  
yum -y install perl-XML-Simple

Make sure that kernel devels of the system are updated.

4. Check the list of kernel and kernel related packages installed on your system using the command :
rpm -qa | grep -i kernel

5. Install the latest kernel-devel packages using the commands :
yum -y install kernel-devel*
yum -y install kernel-PAE*

6. Uninstall the older version using the command :
rpm -e kernel-$(uname -r)

7. Reboot your machine in order to update the kernel-devels.

6. Install NetFPGA Base Package

1.  Install the NetFPGA yum repository and GPG key using the following command :
rpm -Uhv
2. Then run the following command to install the NetFPGA Base Package (if you are trying to implement any routers mentioned in step 3, do not run this command) :
yum install netfpga-base
(This command installs the latest version of the netfpga-base which is currently 3.0.1)

3. Different types of routers that I have tried implementing are as follows and mentioned in the brackets is the version of teh NetFPGA Base Package required for that router :
  a - IPv4 Reference Router (v2.1.1)
  b - DRAM Router (v2.1.1)
  c - Fast Reroute & Multipath Router (v2.0)
  d - PTP-Enabled Router (v2.0)
  e - Promiscuous Reference Router (v2.0)
  f - Flexible Router (v2.0)
  g - Deficit Round Robin Router Backplane (v2.2)
  h - RCP Router (v2.0)

For v2.0, use the command :
yum install netfpga-full-2.0.0-beta_full.i386

For v2.1.1, use the command :
yum install netfpga-base-2.1.1-full

For v2.2, use the command :
yum install netfpga-base-2.2.0-full

5. Installing the RPMForge YUM Repository

1. Use the following links to download the packages :

2. Install DAG's GPG key using the command :
rpm --import

3. Verify the package you have downloaded using the command :
rpm -K rpmforge-release-0.5.2-2.el5.rf.*.rpm

4. Install the package using the command : 
rpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm
This command will add a yum repository config file and import the appropriate GPG keys.

5. Then use the following command : yum install htop

4. Installing Java GUI

1. Use the link to download the Java 1.6 :
2. Download the package "Linux RPM in self-extracting file".
3. Change directories using the 'cd' command to reach the directory where the downloaded package is located.
4. Add execute permission to the JDK file (the downloaded package) using the command :
chmod +x jdk-6u6-linux-i586-rpm.bin

5. Install JDK using the command : ./jdk-6u6-linux-i586-rpm.bin. Scroll down and type 'y' when prompted.6. Install the key for the JPackage repository.
rpm --import

7. Install the JPackage repsoitory information for yum.
cd /etc/yum.repos.d

8. Install the Java RE using :
yum -y --enablerepo=jpackage-generic-nonfree install java-1.6.0-sun-compat.i586

9. Set default Java path to the new JRE, i.e., select number corresponding to jre-1.6.0-sun using the command : /usr/sbin/alternatives --config java

3. Software Installation

Follow the link to download the NetFPGA packet supported by the NetFPGA board :

Wednesday, June 20, 2012

2. After the installation of the OS

After the installation is done, you need to modify your grub.conf file so that the kernel will be able to allocate memory space for the NetFPGA. This is done as follows :

1. Log into the computer as root
2. Type : gedit /boot/grub/grub.conf
3. Add the line : uppermem 524288 before the kernel line
4. Add the following text at the end the kernel line : vmalloc=256M

5. Save the file and exit
6. Reboot the computer
7. Log in as root and type : lspci
8. You could get an output like this : ##:##.# Ethernet controller: Unknown device feed:0001

9. This string identifies that there's a NetFPGA device on the PCI slot.

Tuesday, June 19, 2012

1. Installation of OS

I used CentOS 5.5 for working on the NetFPGA. I haven't tried Fedora but the same commands should work for Fedora too (atleast for Fedora14). For installing the OS, you can follow the instructions here :
The different pages on this link give an idea to install the CentOS step-wise and following these instructions can make the installation simpler.
Note the following while the installation is in progress :
1. Do not install Virtualization as we require a full installation of OS on hard drive.
2. Set SELinux to : Not Enforcing (otherwise you will need to adjust the security settings manually)
3. Disable the firewall
4. Attach your eth0 (motherboard's primary interface) to the external network
5. It is easiesr to use DHCP to set the IP address, gateway, DNS
After the installation, the Package Updater will prompt for an update. Ignore it as installing the updates now will result in missing dependency issues later while installing the Java GUI.