ROUTER CON NETFPGA
Jhon Jairo Padilla A. , PhD.
Un Router con NetFPGA
Características de un Router NetFPGA
• 4 puertos Gigabit Ethernet• Completamente “Programable” (Hardware con FPGAs)
• Bajo costo• Hardware FPGA open source:
– Diseño basado en Verilog
• Software Open‐source:– Drivers en C y C++
Características de la tarjeta NetFPGA
• Conector PCI: bus estándar de 32 bits, 33Mhz. Esto permite conectar la tarjeta a un PC.
• 4 Interfaces GbitEthernet (1Gbps)
• Un chip FPGA Virtex‐2• 4 bancos de memoria SRAM y DRAM
Características detalladas de la tarjeta NetFPGA‐Virtex2‐Pro 50 FPGA, con reloj de 125Mhz.‐Xilinx Spartan II FPGA que controla la interfaz PCI hacia el Host.‐Dos SRAM externas de 18Mbits, organizadas en una configuración de 512Kx36 bits (capacidad total 4.5 Mbytes). Operan de forma síncrona con la FPGA a 125Mhz.‐Un banco externo de SDRAM DDR2 organizado en una configuración de 26Mx32 bits (Capacidad total: 64MBytes). Usando ambos flancos de un reloj separado de 200Mhz, la memoria tiene un ancho de banda de 400MWords/s (1600 Mbytes/s ó 12800 Mbps)‐Transceptores Broadcom BCM5464SR a Gbps, usando cables UTP categorías 5, 5E o 6. Hay un soft core en la FPGA que es un controlador MAC Ethernet para las 4 interfaces físicas.‐‐2 interfaces con conectores Serial ATA (SATA) que permiten múltiples tarjetas NetFPGA en un sisstema para intercambiar datos directamente sin utilizar el bus PCI.
Ventajas de NetFPGA• Descarga un procesador principal de ciertas tareas.• El procesador principal (ubicado en el PC) puede utilizar DMA
(Direct Memory Access) para leer/escribir registros y memorias de la tarjeta NetFPGA
• NetFPGA provee un camino de datos acelerado por Hardware– Conectividad mediante los 4 puertos a 1Gbps.– Acceso a bancos de memoria ubicados en la tarjeta
Librerías re‐utilizables (NFPs)
• NetFPGA permite descargar de la página principal (www.netfpga.org) diferentes bloques ya construidos (Hardware y Software) con funciones de Networking (NFP‐ NetFPGAPackages)
Contenido de las NFPs• Se divide en tres partes:
– Gateware (Verilog)– Software del Sistema– Software para pruebas de
regresión
• Las NFPs incluyen:– 1 IPv4 Router,– 1 four‐port NIC,– 1 IPv4 Router with Output
Queues Monitoring System,
– the PW‐OSPF software that interacts with the IPv4 Router (SCONE),
– and the Router Kit which is a daemon that reflects the routing table and ARP cache from the Linux host to the IPv4 router on NetFPGA.
Opciones de uso de NetFPGA
1. Se pueden descargar las librerías del Routerbásico e instalarlas directamente en la tarjeta NetFPGA. Las modificaciones se hacen en el software del PC para construir protocolos.
2. Se puede descargar el Router básico en la tarjeta NetFPGA y agregar módulos de extensión a la misma (módulos Hardware).
3. Construir un nuevo router con librerías construidas por el usuario‐diseñador.
Uso de NetFPGA: Primera opción
• Se descarga e instala un Router IPv4 en la tarjeta NetFPGA.
• El Host Linux utiliza el Software “Router Kit” distribuido con la NFP.
• Router Kit:– Es un daemon de Linux– Hace un espejo de las tablas de enrutamiento y tablas de ARP del Host en la tarjeta NetFPGA. Esto permite hacer procesamiento a velocidad de línea en la NetFPGA
• El usuario puede modificar los programas en Linux para hacer nuevos protocolos y probarlos.
FPGA
Memory
1GE
1GE
1GE
1GE
Running the Router Kit
User‐space development, 4x1GE line‐rate forwarding
PCI
CPU MemoryOSPF BGP
My Protocoluser
kernelRoutingTable
IPv4Router
1GE
1GE
1GE
1GE
FwdingTable
PacketBuffer
“Mirror”
Uso de NetFPGA: Segunda Opción• Descargar y utilizar el hardware original provisto por la NFP• Modificar el hardware agregando módulos extraídos de otras NFPs
o agregando nuevos módulos propios.• Compilar el código fuente en Verilog con las herramientas
estándares• Descargar el bitfile a la FPGA• El nuevo hardware puede complementarse agregando nuevo
software al Host o modificando el existente.• Ejemplos:
– En el Router IPv4, implementar Trie Longest Prefix Match (LPM) Lookup en lugar del existente CAM LPM Lookup, para la tabla de enrutamiento del hardware.
– Modific ar el Router IPv4 para implementar NAT (Network AddressTranslation) o un Firewall.
FPGA
Memory
1GE
1GE
1GE
1GE
Enhancing Modular Reference Designs
PCI
CPU Memory
NetFPGA Driver
Java GUIFront Panel(Extensible)
PW-OSPF
In QMgmt
IPLookup
L2Parse
L3Parse
Out QMgmt
1GE
1GE
1GE
1GEVerilog modules interconnected by FIFO interfaces
MyBlock
VerilogEDA Tools
(Xilinx, Mentor, etc.)
1. Design2. Simulate3. Synthesize4. Download
Uso de NetFPGA: Tercera opción
• Construir un nuevo router con librerías construidas por el usuario‐diseñador
FPGA
Memory
1GE
1GE
1GE
1GE
Creating new systems
PCI
CPU Memory
NetFPGA Driver
1GE
1GE
1GE
1GE
My Design
(1GE MAC is soft/replaceable)
VerilogEDA Tools
(Xilinx, Mentor, etc.)
1. Design2. Simulate3. Synthesize4. Download
Ejemplo: Router Básico
• 5 fases:– Entrada– Arbitraje de entrada– Decisión de enrutamiento y modificación de paquetes
– Encolamiento de salida– Salida
Ejemplo: Router Ampliado
• Nuevos módulos:– Limitación de tasas de bits
– Retardos– Captura de eventos
NetFPGA en la práctica
NetFPGA en la práctica
• Viene en dos presentaciones:– Torre con DVD ‐ Tipo Rack
PC with NetFPGA
Podría tenerse un laboratorio más complejo….
Equipo requerido para el desarrollo
El equipo viene con Linux CENTOS 5.2
Software de Desarrollo
• ISE de Xilinx para linux: Desarrollar la circuitería en las FPGAs (Síntesis de circuitos)
• Modelsim (simulador para las FPGAs)• LINUX CENTOS 5.2
EJECUCION DEL ROUTER BÁSICO
Step 2 ‐ Run Homemade Routercd to “NF2/projects/tutorial_router/sw”
To use the just‐built router hardware, type: ./tut_router_gui.pl ‐‐use_bin ../../../bitfiles/tutorial_router.bit
To stream video, run:./mp 192.168.X.Y where X.Y = 25.1 or 19.1 or 7.1(or other server as listed on Demo 1 handout)
Step 4 ‐ Connectivity and StatisticsPing any addresses 192.168.x.y where x is from 1‐20 and y is 1 or 2
Open the statistics tab in the Quickstart window to see some statistics
Explore more statistics in modules under the details tab
Step 5 ‐ Explore Router Architecture
Click the Details tab of the Quickstart window
This is the reference router pipeline –a canonical, simple‐to‐understand, modular router pipeline
Step 6 ‐ Explore Output QueuesClick on the Output Queues module in the Details tab
The page gives configuration details
…and statistics
EJECUCIÓN DEL ROUTER AMPLIADO
Router Ampliado
Objectives – Observar el router con sus nuevos módulos– Nuevos módulos: rate limiting, event capture
Ejecución– Ejecute el router capturador de eventos– Revise las tablas de enrutamiento– Explore los detalles– Inicie una transferencia tcp, revise la ocupación de la cola– Cambie la tasa de bits, revise la ocupación de la cola
Step 1 ‐ Run Pre‐made Enhanced Router
Start terminal and cd to “NF2/projects/tutorial_router/sw/”
Type “./tut_adv_router_gui.pl”
A familiar GUI should start
Step 2 ‐ Explore Enhanced Router
Click on the Details tab
A similar pipeline to the one seen previously shown with some additions
Enhanced Router PipelineTwo modules added
1. Event Capture to capture output queue events (writes, reads, drops)
2. Rate Limiter to create a bottleneck
MACRxQ
CPURxQ
MACRxQ
CPURxQ
MACRxQ
CPURxQ
MACRxQ
CPURxQ
Input Arbiter
Output Port Lookup
MACTxQ
CPUTxQ
MACTxQ
CPUTxQ
MACTxQ
CPUTxQ
MACTxQ
CPUTxQ
pOutput Queues
RateLimiter
Event Capture
Step 3 ‐ Decrease the Link RateTo create bottleneck and show the TCP “sawtooth,” link‐rate is decreased.
In the Details tab, click the “Rate Limit” module
Check Enabled
Set link rate to 1.953Mbps
Step 4 – Decrease Queue Size
Go back to the Details panel and click on “Output Queues”
Select the “Output Queue 2” tab
Change the output queue size in packets slider to 16
Step 5 ‐ Start Event Capture
Click on the Event Capture module under the Details tab
This should start the configuration page
Step 6 ‐ Configure Event Capture
Check Send to local host to receive events on the local host
Check Monitor Queue 2 to monitor output queue of MAC port1
Check Enable Captureto start event capture
Step 7 ‐ Start TCP Transfer
We will use iperf to run a large TCP transfer and look at queue evolution
Start a terminal and cd to“NF2/projects/tutorial_router/sw”
Type “./iperf.sh”
Step 8 ‐ Look at Event Capture Results
Click on the Event Capture module under the Details tab.
The sawtooth pattern should now be visible.
Queue Occupancy Charts
Leave the control windows open
Observe the TCP/IP sawtooth
AMPLIACIÓN DEL ROUTER BÁSICO
Amplíe su Router
Objetivos– Agregar nuevos módulos al camino de los datos– Sintetizar y probar el router
Ejecución– Abra los módulos: user_datapath.v, uncomment delay/rate/event capture
– Sintetícelos– Después de sintetizarlos, pruebe el nuevo sistema
An aside: xemacs TipsWe will modify Verilog source code with xemacs
– To undo a command, type• ctrl+shift+'‐'
– To cancel a multi‐keystroke command, type • ctrl+g
– To select lines, • hold shift and press the arrow keys
– To comment (remove from compilation) selected lines, type • ctrl+c+c
– To uncomment a commented block, • move the cursor inside the commented block • type ctrl+c+u
– To save, type • ctrl+x+s
– To search for a term, type • ctrl+s search_pattern
Step 1 ‐ Open the SourceWe will modify the Verilog source code to add event capture and rate limiter modules
We will simply comment and uncomment existing code
Open terminal
Type xemacs NF2/projects/tutorial_router/src/user_data_path.v
Step 2 ‐ Add Wires
Now we need to add wires to connect the new modules
Search for “new wires” (ctrl+s new wires), then press Enter
Uncomment the wires (ctrl+c+u)
Step 3a ‐ Connect Event Capture
Search for opl_output (ctrl+s opl_output), then press Enter
Comment the four lines above (up, shift + up + up + up + up, ctrl+c+c)
Uncomment the block below to connect the outputs (ctrl+s opl_out, ctrl+c+u)
Step 3b ‐ Connect the Output Queue Registers
Search for opl_output (ctrl+s opl_output, Enter)
Comment the 6 lines (select the six lines by using shift+arrow keys, then type ctrl+c+c)
Uncomment the commented block by scrolling down into the block and typing ctrl+c+u
Step 4 ‐ Add the Event Capture Module
Search for evt_capture_top (ctrl+s evt_capture_top), then press Enter
Uncomment the block (ctrl+c+u)
Step 5 ‐ Add the Drop Nth Module
Search for drop_nth_packet (ctrl+s drop_nth_packet), then press Enter
Uncomment the block (ctrl+c+u)
Step 6 ‐ Connect the Output Queue to the Rate Limiter
Search for port_outputs (ctrl+s port_outputs), then press (Enter)
Comment the 4 lines above (select the four lines by using shift+arrow keys), then type (ctrl+c+c)
Uncomment the commented block by scrolling down into the block and typing ctrl+c+u
Step 7 ‐ Connect the RegistersSearch for port_outputs (ctrl+s port_outputs), then press (Enter)
Comment the 6 lines (select the six lines by using shift+arrow keys), then type (ctrl+c+c)
Uncomment the commented block by scrolling down into the block and typing (ctrl+c+u)
six
Step 8 ‐ Add Rate Limiter
Scroll down until you reach the next “excluded” block
Uncomment the block containing the rate limiter instantiations.
Scroll into the block,type (ctrl+c+u)
Save (ctrl+x+s)
Step 9 ‐ Build the Hardware
Start terminal, cd to “NF2/projects/tutorial_router/synth”
Run “make clean”
Start synthesis with “make”