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 | |
| 87 | A) There are two minor patches required to make this software run with |
| 88 | Linux. These are currently against a 3.3.8 kernel. The first adds a |
| 89 | hook to allow packets to be extracted out, while the second exposes a |
| 90 | state variable inside netfilter that's necessary to enable TCP sequence |
| 91 | and ACK checking within the offload path. Note that this specific |
| 92 | patch is against the QCA QSDK patched version of 3.3.8 - there's a |
| 93 | slightly braindead "performance" patch in that kernel, courtesy of the |
| 94 | OpenWrt community that makes the Linux forwarding path slightly faster |
| 95 | at the expense of losing functionality :-( |
| 96 | |
| 97 | Once these are applied and the module is loaded then everything else |
| 98 | is automatic :-) The patches are in this git repo. |
| 99 | |
| 100 | |
| 101 | Q) Isn't that patch to dev.c a gross hack? |
| 102 | |
| 103 | A) Yes it is and no, it's not thread safe. Fixing this is on my "to do" |
| 104 | list. |
| 105 | |
| 106 | |
| 107 | Q) Are any of the pieces reused from other projects? |
| 108 | |
| 109 | A) Yes! Some of the forwarding concepts are reused from the Ubicom Network |
| 110 | Accelerator that morphed into part of the Akronite NSS. This code has all |
| 111 | been substantially changed though to accomodate Linux's needs. |
| 112 | |
| 113 | There are also some pieces that I borrowed from the QCA "FastNAT" software |
| 114 | written by Xiaoping Fan <xfan@qca.qualcomm.com>. Xiaoping's code was the |
| 115 | first actual demonstration within QCA that this in-kernel concept could yield |
| 116 | signficant performance gains. |
| 117 | |
| 118 | |
| 119 | Enjoy! |
| 120 | Dave Hudson <dhudson@qti.qualcomm.com> |
| 121 | |