blob: 1bf1cc2555818eae6fc4d2aaa17bca11247e955e [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
Dave Hudson8544b5c2013-10-22 16:03:14 +010087A) There are four minor patches required to make this software run with
88Linux. These are currently against a 3.3.8 or 3.4.0 kernel:
89
90* (net/core/dev.c) adds a hook to allow packets to be extracted out.
91
92* (net/netfilter/nf_conntrack_proto_tcp.c) exposes a state variable inside
93 netfilter that's necessary to enable TCP sequence and ACK checking within
94 the offload path. Note that this specific patch is against the QCA QSDK
95 patched version of 3.3.8 - there's a slightly braindead "performance"
96 patch in that kernel, courtesy of the OpenWrt community that makes the
97 Linux forwarding path slightly faster at the expense of losing
98 functionality :-(
99
100* (net/Kconfig) adds the shortcut-fe option.
101
102* (net/Makefile) adds the shortcut-fe build support.
Dave Hudsonaaf97ca2013-06-13 17:52:29 +0100103
104Once these are applied and the module is loaded then everything else
105is automatic :-) The patches are in this git repo.
106
107
Dave Hudsonaaf97ca2013-06-13 17:52:29 +0100108Q) Are any of the pieces reused from other projects?
109
110A) Yes! Some of the forwarding concepts are reused from the Ubicom Network
111Accelerator that morphed into part of the Akronite NSS. This code has all
112been substantially changed though to accomodate Linux's needs.
113
114There are also some pieces that I borrowed from the QCA "FastNAT" software
115written by Xiaoping Fan <xfan@qca.qualcomm.com>. Xiaoping's code was the
116first actual demonstration within QCA that this in-kernel concept could yield
117signficant performance gains.
118
119
120Enjoy!
121Dave Hudson <dhudson@qti.qualcomm.com>
122