Download presentation
Presentation is loading. Please wait.
Published byΝομική Καλογιάννης Modified over 6 years ago
1
ONL NP Router Plugins Shakir James, Charlie Wiseman, Ken Wong, John DeHart {scj1, cgw1, kenw,
2
ONL NP Router xScale xScale SRAM TCAM SRAM Rx (2 ME) Mux (1 ME) Parse,
Assoc. Data ZBT-SRAM xScale Small SRAM Ring Large SRAM Ring Scratch Ring SRAM TCAM LD Except Errors SRAM NN NN Ring 64KW Rx (2 ME) Mux (1 ME) Parse, Lookup, Copy (3 MEs) QM (1 ME) HdrFmt (1 ME) Tx (1 ME) NN 64KW xScale 64KW 64KW 64KW 64KW 64KW Plugin to XScale Ctrl,Update & RLI Msgs (1 Ring Per Plugin) 512W 512W 512W 512W 512W NN NN NN NN Plugin0 Plugin1 Plugin2 Plugin3 Plugin4 SRAM 512W 512W 512W 512W 512W Stats (1 ME) FreeList Mgr (1 ME) SRAM
3
Design Review: Plugins
SRAM Ring XScale p0 p1 p2 p3 p4 Scratch Control path XScale Plugins Data path Plugins {Mux, QM} PLC Mux p0 p1 p2 p3 p4 QM Annother possiblity is plugins writing to the NN rings to each other. Possible to share data? This is generic pic / (std path) -> in reality on plugin can read/write to any SRAM ring
4
Outline Overview My first plugin My second plugin Framework internals
Core plugins Conclusion
5
Overview Plugin Framework Base Plugin API handle_init_user()
handle_pkt_user() handle_msg_user() handle_callback_user() constants macros functions API - Application Program Interface. A set of function for building plugins - the interface (calling conventions) define how a plugin accesses services provides by the framework + services such as: system initialization, packet handling, sending ctr messages to xscale, handling periodic events - user provides a level of abstraction for the plugin and the framework. The Standard Plugin Library is a collection of functions, constants, and macors that extends the uC language providing basic functionality to perform several tasks [wikipedia]: - packet operations: + forward, copy, drop, etc - common task: + get IP header, read/write stats, update stat counters Goal: Provide a simple API that “lowers the barrier” to entry for new IXP programmer.
6
My First Plugin Counter Increment a pkt counter and forward packet
Plugin API include “plugin_api.h” plugin_init_user() {} // plugin initialization handle_pkt_user() {} // process packet handle_msg_user() {} // control msgs handle_callback_user() {} // periodic events Base Plugin
7
My First Plugin Counter Increment a pkt counter and forward packet
include “plugin_api.h” … handle_pkt_user() // process packet { pcount_inc(0); // increment local counter }
8
My Second Plugin Stats Increment ICMP, UDP, and TCP counters }
handle_pkt_user() // process packet { buf_handle = onl_api_get_buf_handle(); //get buf handle ipv4_hdr = onl_api_get_ipv4_hdr(buf_handle); // read IP Hdr from DRAM switch(ipv4_hdr.protocol) { case PROTO_ICMP: pcount_inc(0); break; }
9
Framework Internals Framework components Base Plugin Base Plugin
Plugin API Base Plugin Dispatch loop: main() Plugin initialization: plugin_init() Packet processing: handle_pkt() Control messages: handle_msg() Callbacks: callback() Basic plugin structures 1 thread: only handling data 8 threads: all handling data 8 threads: 7 handling data, 1 handling control 8 threads: 6 handling data, 1 handling control, 1 handling time-outs
10
Framework Base Plugin: main()
Dispatch loop: main() plugin_init() while (1) switch(_ctx()) case 0, 1, 2, 3, 4, 5: handle_packet(); case 6: callback(); case 7: handle_msg(); Preprocessor directives: FIRST_PACKET_THREAD=0 LAST_PACKET_THREAD=5 MESSAGE_THREAD=6 CALLBACK_THREAD=7 DL_ORDERED DL_ORDER ensures packet ordering (for writes… esp) - by defualt DL_ORDER should be defined else user will be confused if he sees out of order packets
11
Framework Base Plugin: plugin_init()
Plugin initialization: plugin_init() … ONL plugin initialization … plugin_init_user(); // user hook ONL plugin initialization Local ME state (data/ctrl ring) PACKET_IN_RING_0, MESSAGE_IN_RING_0 User hook: plugin_init_user() default is stub E.g.: init vars, set timer, change (default) nextBlock
12
Framework Base Plugin: handle_pkt
Packet processing: handle_packet() dl_source_packet(); default_format_out_data(); handle_pkt_user(); // user hook dl_sink_packet(); SRAM Ring Scratch PLC Mux p0 p1 p2 p3 p4 QM dl_source_packet(), dl_sink_packet() uses ME state (plugin_init) User hook: handle_pkt_user()
13
Framework Base Plugin: handle_msg()
Control messages: handle_msg() SRAM Ring XScale p0 p1 p2 p3 p4 dl_source_message(); hande_msg_user(); //user hook dl_sink_message(); dl_source_message(), dl_sink_message() uses ME state (plugin_init) mutex_lock: multiple SRAM reads per msg possible Msg from Xscale or RLI -> configuration , control, and debug msgs User hook: handle_msg_user() Handle control msg from RLI Send configuration updates to XScale
14
Framework Base Plugin: callback()
Callbacks: callback() sleep(timeout); handle_callback(); // user hook sleep() timeout in cycles (ME’s operate at 1.4 GHz) Override default timeout (1000) in plugin_init_user() User hook: handle_callback_user() Non-packet arrival driven processing: delay plugin
15
Framework Plugin API Framework components Plugin API: Base Plugin
Constants Macros Functions Explain…
16
Plugin API functions -Current
Stats - read/write stats counters ONL_API_PCOUNT_INC(int), plugin_cntr_inc(int, int) , … ONL_API_PCOUNT_ADD(int, int), plugin_cntr_add(int, int, int) Packet forwarding and dropping, onl_api_set_out_to_MUX() // set dlNextBlock onl_api_set_out_to_QM() // set dlNextBlock onl_api_drop() // drop packet Packet access/modification onl_api_get_buf_handle() // get next buffer handle onl_api_get_ipv4_hdr() // read pkt data from DRAM
17
Plugin API functions –Coming Soon
Packet access/modification onl_api_get_udp_hdr() // read udp hdr from DRAM onl_api_get_tcp_hdr() // read tcp hdr from DRAM onl_api_get_icmp_hdr() // read icmp hdr from DRAM Allocate a new pkt Copy pkts Read Queue Length
18
Plugin API functions –Coming Later
These will be added eventually (possibly as needed): Configuration reads get_queue_threshold get_queue_quantum Configuration updates add_filter add_route update_queue_threshold update_queue_quantum Queues of packets with-in the plugin Wrap intrinsic functions (Clock, CRC, local CAM access)
19
Core Plugins null count nstats Forward packets
Increment pkt counter and forward pkt nstats Increment ICMP, UPD and TCP pkt counter Drop pkt
20
Conclusion Did we achieve our goal? What’s next?
Provide a simple API that “lowers the barrier” to entry for new IXP programmer What’s next? Add Core Plugins dumphdr, multicast, stringSub, pdelay, dropdelay Expand Plugin API More functions based on course assignments Hardware Testing Inter-plugin communication?
21
TODO for cgw1,kenw,scj1 Control path Core Plugins multicast stringSub
forward pkt copies to ports indicated by destination vector stringSub Replace all occurrence of the string “HELLO” with “adieu” pdelay delay pkt dropdelay delay pkt with probability m/n, and drop with probability (n-m)/n dumphdr Save IP header fields and transport header fields Return header fields through control msg
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.