-
Notifications
You must be signed in to change notification settings - Fork 22
Hardware Test
Firstly, you need to compile hardware test cores.
# source NetFPGA-PLUS-dev/tools/settings.sh
# cd NetFPGA-PLUS-dev/
# make
You need to connect NF_PLUS card to a commercial NIC. Connection information is stored in ${NF_PLUS}/hw/projects/${proj_name}/test/connections/conn . You can see the file contents like below.
nf0:eth1
nf1:eth2
For instance, port "nf0" is connected to port "eth1" and port "nf1" is connected to port "eth1", as shown in the figure below.
Network information can be setup by ${NF_PLUS}/hw/projects/${proj_name}/test/global/setup You can specify the IPv4 address information to the network interface.
For example, you can see the file in ${NF_PLUS}/hw/projects/reference_switch/test/global/setup.
from subprocess import Popen, PIPE
proc = Popen(["ifconfig","eth1","192.168.100.1"], stdout=PIPE)
proc = Popen(["ifconfig","eth2","192.168.101.1"], stdout=PIPE)
proc = Popen(["ifconfig","nf0","192.168.200.1"], stdout=PIPE)
proc = Popen(["ifconfig","nf1","192.168.201.1"], stdout=PIPE)
Loopback test is assumed in reference_nic hardware test. So, you need external loopback module for hardware testing. If you don't have the equipment, you can also try it with CMAC loopback setting.
In reference_nic, loopback module is required. If you don't have external loopback module, you can test loopback test with enabled GT_LOOPBACK_REG (page 192 on cmac_usplus v3_1) on both CMACs with NF_PLUS card.
# ${NF_PLUS}/sw/app/rwaxi -a 0x8090 -w 1
# ${NF_PLUS}/sw/app/rwaxi -a 0xc090 -w 1
In hardware test, you can execute the test scripts in a following steps. "nf_test.py" is a script to manipulate hardware test inside NF_PLUS. If you want to run both_learning_sw, you can specify "learning" as --major and "sw" as --minor.
# cd tools/scripts/
# ./nf-test.py --major learning --minor sw hw
Project | major | minor |
---|---|---|
reference_switch | learning | sw |
simple | broadcast | |
reference_switch_lite | learning | sw |
simple | broadcast | |
reference_nic | inc | size |
loopback | maxsize | |
loopback | minsize | |
loopback | random | |
reference_router | arp | misses |
badipchksum | packet | |
invalidttl | packet | |
ipdestfilter | hit | |
lpm | generic | |
lpm | misses | |
lpm | nexthop | |
nonip | packet | |
nonipv4 | packet | |
packet | forwarding | |
router | table | |
wrong | destMAC |
If you failed in hardware test, as you get expected packet not seen, it might be packets loss on capturing tools. To avoid packets loss on host side, you can add delay interval to packet injecting.
You can add time.sleep(0.1) on each hw test script(run.py) ${NF_PLUS}/hw/projects/${project}/test/both_${major}_${minor}/run.py
import time
if isHW():
for port in range(num_ports):
DA = "00:0a:35:03:00:%02x"%port
pkt = make_IP_pkt(dst_MAC=DA, src_MAC=SA, dst_IP=DST_IP,
src_IP=SRC_IP, TTL=TTL,
pkt_len=60+i)
totalPktLengths[port] += len(pkt)
nftest_send_dma('nf' + str(port), pkt)
nftest_expect_dma('nf' + str(port), pkt)
time.sleep(0.1) ## PLEASE ADD THIS LINE!