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 :
ifconfig
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 :
~/netfpga/projects/selftest/sw/selftest
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/cpci_reprogram.pl --all

9. Compile and Load Driver

1. Compile : 
cd ~/netfpga
make
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/nf_register_gen.pl: 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 :
/usr/local/netfpga/lib/scripts/user_account_setup/user_account_setup.pl
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/cpci_reprogram.pl --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/cpci_reprogram.pl --all and save it.