blob: dd0fd2fe386878cdff730de25b6229fc466efee3 [file] [log] [blame]
Dave Hudsonaaf97ca2013-06-13 17:52:29 +01001Shortcut Forwarding Engine
2--------------------------
3
4Welcome to "Shortcut" :-)
5
6Here's a quick FAQ:
7
8
9Q) What is Shortcut?
10
11A) Shortcut is an in-Linux-kernel IP packet forwarding engine. It's designed
12to offer very high speed IP packet forwarding based on IP connection tracking.
13It's dramatically faster than the standard netfilter-based NAT forwarding path
14but is designed to synchronise state back to netfilter/conntrack so that it
15doesn't need to deal with all of the complexities of special cases.
16
17
18Q) What versions of IP does it support?
19
20A) The current version only supports IPv4 but will be extended to support IPv6 in
21the future.
22
23
24Q) What transport protocols does it support?
25
26A) TCP and UDP. It also knows enough about ICMP to spot ICMP error messages
27related to TCP and UDP and handle things accordingly.
28
29
30Q) Is there a design spec for this software?
31
32A) Not at the moment. I'll write one when I get more time. The code is
33intended to be a good tutorial though - it's very heavily commented. If you
34find yourself reading something and not understanding it then I take that to
35mean I've probably not done a sufficently good job of explaining what it's
36doing in the comments. Let me know - I will try to fix it :-)
37
38
39Q) Why was it written?
40
41A) It was written as a demonstration of what can be done to provide high
42performance forwarding inside the kernel. There were two initial motivations:
43
441) To provide a platform to enable research into how QoS analysis systems can
45offload work and avoid huge Linux overheads.
46
472) To provide a tool to investigate the behaviour of various processors, SoCs
48and software sets so that we can characterize and design new network processor
49SoCs.
50
51
52Q) How much faster is it than the Linux kernel forwarding path?
53
54A) At the time of pushing this to github it's been tested on a QCA AP135.
55This has a Scorpion (QCA Scopion, not the QMC one :-)) SoC, QCA9550. The
56SoC's processor is a MIPS74K running at 720 MHz and with a DDR2 memory
57subsystem that offers a peak of 600 MT/s (16-bit transfers).
58
59Running IPv4 NAT forwarding of UDP between the board's 2 GMAC ports and
60using a SmartBits 200 as a traffic generator Linux is able to forward 70k PPS.
61Once the SFE code is invoked this will increase to 350k PPS!
62
63There's also a slightly hacky mode which causes SFE to bypass the Linux
64bridge layer, but this isn't really ready for use because it doesn't have
65sufficient MAC address checks or integration of statistics back to the
66Ethernet bridge, but that runs at 436k PPS.
67
68
69Q) Are there any diagnostics?
70
71A) Yes, this is a research tool after all! There's a complex way to do this
72that's more general purpose and a simple one - here's the simple one:
73
74 mknod /dev/sfe c 253 0
75
76The file /dev/sfe is an XML-ish output and provides details of all the
77network connections currently being offloaded. It also reports the numbers
78of packets that took various "exception" paths within the code. In addition
79it provides a summary of the number of connections, attempts to accelerate
80connections, cancel accelerations, etc. It also reports the numbers of
81packets that were forwarded and not forwarded by the engine and has some
82stats on the effectiveness of the hashing algorithm it uses.
83
84
85Q) How does the code interact with Linux?
86
87A) There are two minor patches required to make this software run with
88Linux. These are currently against a 3.3.8 kernel. The first adds a
89hook to allow packets to be extracted out, while the second exposes a
90state variable inside netfilter that's necessary to enable TCP sequence
91and ACK checking within the offload path. Note that this specific
92patch is against the QCA QSDK patched version of 3.3.8 - there's a
93slightly braindead "performance" patch in that kernel, courtesy of the
94OpenWrt community that makes the Linux forwarding path slightly faster
95at the expense of losing functionality :-(
96
97Once these are applied and the module is loaded then everything else
98is automatic :-) The patches are in this git repo.
99
100
101Q) Isn't that patch to dev.c a gross hack?
102
103A) Yes it is and no, it's not thread safe. Fixing this is on my "to do"
104list.
105
106
107Q) Are any of the pieces reused from other projects?
108
109A) Yes! Some of the forwarding concepts are reused from the Ubicom Network
110Accelerator that morphed into part of the Akronite NSS. This code has all
111been substantially changed though to accomodate Linux's needs.
112
113There are also some pieces that I borrowed from the QCA "FastNAT" software
114written by Xiaoping Fan <xfan@qca.qualcomm.com>. Xiaoping's code was the
115first actual demonstration within QCA that this in-kernel concept could yield
116signficant performance gains.
117
118
119Enjoy!
120Dave Hudson <dhudson@qti.qualcomm.com>
121