1.2k likes | 1.41k Views
Presented by: Adam Covington (Stanford University) Indiana University, Bloomington June 18 - 19, 2012 http://NetFPGA.org. NetFPGA Hands-on Training Day 1. Tutorial Outline. Background Introduction The NetFPGA Platform The Stanford Base Reference Router Motivation: Basic IP review
E N D
Presented by: Adam Covington (Stanford University) Indiana University, Bloomington June 18 - 19, 2012 http://NetFPGA.org NetFPGA Hands-on TrainingDay 1
Tutorial Outline Background Introduction The NetFPGA Platform The Stanford Base Reference Router Motivation: Basic IP review Example: Reference Router running on the NetFPGA Infrastructure Tree Build System Scripts The Life of a Packet Through the NetFPGA Hardware Datapath Interface to software: Exceptions and Host I/O Implementation Module Template User Data Path Write Crypto NIC using a static key Simulation and Debug Write and Run Simulations for Crypto NIC Concluding Remarks
NetFPGA = Networked FPGA A line-rate, flexible, open networking platform for teaching and research
NetFPGA consists of… NetFPGA 1G Board Four elements: • NetFPGA board • Tools + reference designs • Contributed projects • Community NetFPGA 10G Board
NetFPGA board PC with NetFPGA 1GE FPGA 1GE 1GE Memory 1GE NetFPGA Board NetworkingSoftware running on a standard PC CPU Memory PCI A hardware accelerator built with a Field Programmable Gate Arraydriving Gigabit network links
Tools + Reference Designs Tools: • Compile designs • Verify designs • Interact with hardware Reference designs: • Router (HW) • Switch (HW) • Network Interface Card (HW) • Router Kit (SW) • SCONE (SW)
Contributed Projects More projects: http://netfpga.org/foswiki/NetFPGA/OneGig/ProjectTable
Community Wiki • Documentation • User’s Guide • Developer’s Guide • Encourage users to contribute Forums • Support by users for users • Active community - 10s-100s of posts/week
International Community Over 1,000 users, using 2,000 cards at 150 universities in 40 countries
NetFPGA’s Defining Characteristics • Line-Rate • Processes back-to-back packets • Without dropping packets • At full rate of Gigabit Ethernet Links • Operating on packet headers • For switching, routing, and firewall rules • And packet payloads • For content processing and intrusion prevention • Open-source Hardware • Similar to open-source software • Full source code available • BSD-Style License • But harder, because • Hardware modules must meeting timing • Verilog & VHDL Components have more complex interfaces • Hardware designers need high confidence in specification of modules
Test-Driven Design • Regression tests • Have repeatable results • Define the supported features • Provide clear expectation on functionality • Example: Internet Router • Drops packets with bad IP checksum • Performs Longest Prefix Matching on destination address • Forwards IPv4 packets of length 64-1500 bytes • Generates ICMP message for packets with TTL <= 1 • Defines how packets with IP options or non IPv4 … and dozens more … Every feature is defined by a regression test
Who, How, Why Who uses the NetFPGA? • Teachers • Students • Researchers How do they use the NetFPGA? • To run the Router Kit • To build modular reference designs • IPv4 router • 4-port NIC • Ethernet switch, … Why do they use the NetFPGA? • To measure performance of Internet systems • To prototype new networking systems
Summer Camp Objectives • Overall picture of NetFPGA • How reference designs work • How you can work on a project • NetFPGA Design Flow • Directory Structure, library modules and projects • How to utilize contributed projects • Interface/Registers • How to verify a design (Simulation and Regression Tests) • Things to do when you get stuck AND… You can build your own projects!
Internet Protocol (IP) Data to be transmitted: Data … IP packets: IP Hdr IP Hdr IP Hdr Data Data Data … Ethernet Frames: Eth Hdr Eth Hdr Eth Hdr IP Hdr IP Hdr IP Hdr Data Data Data
Internet Protocol (IP) Data … 1 4 16 32 Ver HLen T.Service Total Packet Length Fragment ID Flags Fragment Offset IP Hdr Data 20 bytes TTL Protocol Header Checksum Source Address Destination Address Options (if any)
Basic operation of an IP router D R3 R1 R4 D A B E R2 C R5 Destination Next Hop F D R3 E R3 F R5
Basic operation of an IP router R3 R1 R4 D A B E R2 C R5 F
Forwarding tables 32 bits wide → ~ 4 billion unique address IP address Naïve approach: One entry per address ~ 4 billion entries Improved approach: Group entries to reduce table size
IP addresses as a line Your computer My computer Stanford Berkeley Asia North America 0 232-1 All IP addresses
Longest Prefix Match (LPM) Universities Continents Planet To: Stanford Data • Matching entries: • Stanford • North America • Everywhere Most specific
Longest Prefix Match (LPM) Universities Continents Planet To: Canada Data • Matching entries: • North America • Everywhere Most specific
Implementing Longest Prefix Match Searching Most specific FOUND Least specific
Basic components of an IP router Management & CLI Routing Protocols Software Control Plane Routing Table Data Plane per-packet processing Forwarding Table Switching Queuing Hardware
IP router components in NetFPGA Linux SCONE Management & CLI Management & CLI Routing Protocols OR Software Routing Protocols Routing Table Routing Table Router Kit Output Port Lookup Input Arbiter Output Queues Hardware Forwarding Table Switching Queuing
Operational IPv4 router Java GUI SCONE Management & CLI Control Plane Software Routing Protocols Routing Table Reference router Forwarding Table Switching Queuing Data Plane per-packet processing Hardware
Streaming video NetFPGA running reference router PC & NetFPGA (NetFPGA in PC)
Streaming video Video streaming over shortest path Video client Video server
Streaming video Link breaks Video client Video server
Streaming video .1.1 .4.1 .7.1 .10.1 .13.1 .16.1 .1.2 .4.2 .7.2 .10.2 .13.2 .16.2 .3.1 .6.2 .9.2 .12.2 .15.2 .3.2 .6.1 .9.1 .12.1 .15.1 .30.2 .18.1 .30.1 .23.1 .18.2 .27.2 .24.2 .21.2 .24.1 .21.1 .27.1 .28.2 .25.2 .22.2 .19.2 .28.1 .25.1 .22.1 .19.1
Observing the routing tables • Columns: • Subnet address • Subnet mask • Next hop IP • Output ports
Review NetFPGA as IPv4 router: • Reference hardware + SCONE software • Routing protocol discovers topology Demo: • Ring topology • Traffic flows over shortest path • Broken link: automatically route around failure
Infrastructure • Tree structure • NetFPGA package contents • Reusable Verilog modules • Verification infrastructure • Build infrastructure • Utilities • Software libraries
Tree Structure (1) netfpga bin (scripts for running simulations and setting up the environment) bitfiles (contains the bitfiles for all projects that have been synthesized) lib (shared Verilog modules, libraries needed for simulation/synthesis/design) projects (user projects, including reference designs)
Tree Structure (2) lib C (common software and code for reference designs) java (contains software for the graphical user interface) Makefiles (makefiles for simulation and synthesis) (libraries to interact with reference designs, create test data, and manage simulations/regression tests) Perl5 python (common libraries to aid in regression tests) (utility scripts – less commonly used than those in the bin directory) scripts verilog (modules that can be reused in designs)
Tree Structure (3) projects/crypto_nic doc (project specific documentation) (XML files defining project and any local modules, auto-generated Verilog register defines) include lib (C/Perl defines for registers) (non-library Verilog code used for synthesis and simulation) src sw (software elements of the project) (project-specific .xco files to generate cores, Makefile to implement the design) synth test (simulation and hardware tests)
NetFPGA package contents • Projects: • HW: router, switch, NIC, buffer sizing router • SW: router kit, SCONE • Reusable Verilog modules • Verification infrastructure: • simulate full board with PCI + physical interfaces • run tests against hardware • test data generation libraries (eg. packets) • Build infrastructure • Utilities: • register I/O, packaging, … • Software libraries
Verification Infrastructure • Simulation: nf_test.py sim • allows testing before synthesis • catches many bugs • Hardware tests: nf_test.py hw • test synthesized hardware • Test data generation libraries: • easily create test data: • many standard packet formats supported out of the box • easily add support for custom formats
Build infrastructure • Register system: • allocates memory to modules • generates “include” files for various languages • Build/synthesis: • required shared modules documented XML (shared with register system) • shared modules pulled in during synthesis • resultant bitfile checked for timing errors
Utilities • Bitfile download: nf_download • Register I/O: regread, regwrite • Device querying: nf_info • SRAM dumping: lib/scripts/sram_dump
Software libraries • Libraries for interfacing with NetFPGA: • C, Perl, Java, Python support
Reference Router Pipeline Five stages Input Input arbitration Routing decision and packet modification Output queuing Output Packet-based module interface Pluggable design MAC RxQ CPU RxQ MAC RxQ CPU RxQ MAC RxQ CPU RxQ MAC RxQ CPU RxQ Input Arbiter Output Port Lookup Output Queues MAC TxQ CPU TxQ MAC TxQ CPU TxQ MAC TxQ CPU TxQ MAC TxQ CPU TxQ