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