Views
NetFPGA
From OpenFlow Wiki
Contents |
Note
This instruction is for OpenFlow 0.8.9 and before. The instruction for OpenFlow 1.0 with tunneling is under preparation.
Configuring the NetFPGA OpenFlow + Tunneling + ARP reply
- Get the bitfile and the .h files somehow (probably by emailing me). Download the bitfile using nf2_download. Use the .h files to obtain the addresses for registers if needed.
- Configure the #ARP Reply module with the IP and Ethernet addresses of each port and enabling it.
- Enable the #Decap module.
- Configure the #Encap module and enable it.
- Setup #NetFPGA OpenFlow.
ARP Reply
This module will respond to ARP requests automatically. ARP requests that are not for one of the IP addresses that are setup will be dropped. It will also be dropped if the IP address requested does not match the port the request came in on.
- Write low 4 bytes of the port's Ethernet addresses into
- ARP_REPLY_ETH_ADDR_PORT_0_LO_REG
- ARP_REPLY_ETH_ADDR_PORT_1_LO_REG
- ARP_REPLY_ETH_ADDR_PORT_2_LO_REG
- ARP_REPLY_ETH_ADDR_PORT_3_LO_REG
- example: "aa:bb:cc:dd:ee:ff" -> regwrite ARP_REPLY_ETH_ADDR_PORT_0_LO_REG 0xccddeeff
- Write the high 2 bytes into:
- ARP_REPLY_ETH_ADDR_PORT_0_HI_REG
- ARP_REPLY_ETH_ADDR_PORT_1_HI_REG
- ARP_REPLY_ETH_ADDR_PORT_2_HI_REG
- ARP_REPLY_ETH_ADDR_PORT_3_HI_REG
- Write the IP address into:
- ARP_REPLY_IP_ADDR_PORT_0_REG
- ARP_REPLY_IP_ADDR_PORT_1_REG
- ARP_REPLY_IP_ADDR_PORT_2_REG
- ARP_REPLY_IP_ADDR_PORT_3_REG
- Enable module by writing 1 into ARP_REPLY_ENABLE_REG
Decap
This module strips off the first 40 bytes of any IP packet that has IP protocol 0x52.
- Enable by writing 1 into DECAP_ENABLE_REG
Encap
There are four of these modules in the pipeline, one on each of the MAC output queues. Each module has it's own set of registers that enable, and specify the encapsulation header that is added to a packet. Below is a demonstration of how to enable encapsulation on the MAC port 1. To enable encapsulation on MAC port 2-4 change the 'PORT_1' part of the register name to the port number you need.
- Specify the SRC port that will not be encapsulated by writing 0x1N to ENCAP_PORTS_PORT_1_REG where n is the port (i.e. writing 0x1f would encapsulate everything that is not received on port 15)
- Specify the SRC IP address by writing to ENCAP_SRC_IP_PORT_1_REG
- Specify the DST IP address by writing to ENCAP_DST_IP_PORT_1_REG
- Specify the TTL and PROTO by writing to ENCAP_TTL_PROTO_PORT_1_REG ( 0x0552 means the TTL = 0x05 and the PROTO = 0x52)
- Specify the TOS by writing to ENCAP_TOS_PORT_1_REG
- Specify the high 16 bits of the SRC MAC by writing to ENCAP_SRC_MAC_HI_PORT_1_REG
- Specify the low 32 bits of the SRC MAC by writing to ENCAP_SRC_MAC_LO_PORT_1_REG
- Specify the high 16 bits of the DST MAC by writing to ENCAP_DST_MAC_HI_PORT_1_REG
- Specify the low 32 bits of the DST MAC by writing to ENCAP_DST_MAC_LO_PORT_1_REG
- Enable the module by writing 0x1 to ENCAP_ENABLE_PORT_1_REG
NetFPGA OpenFlow
To run with hardware acceleration using NetFPGA, you will need to be running the kernel OpenFlow switch implementation. Ensure that no datapaths currently exist using dpctl, then do the following:
1. Load the NetFPGA OpenFlow module
# modprobe hwtable_nf2_mod
2. Create a datapath (only 1 datapath is supported with the NetFPGA hardware acceleration)
# dpctl adddp nl:0
3. Add the interfaces using dpctl
# dpctl addif nl:0 nf2c0 # dpctl addif nl:0 nf2c1 # dpctl addif nl:0 nf2c2 # dpctl addif nl:0 nf2c3
