Skip to content

Instantly share code, notes, and snippets.

View lukego's full-sized avatar

Luke Gorrie lukego

View GitHub Profile
@lukego
lukego / gist:9450853
Last active November 21, 2015 22:45
Snabb Switch for Entrepreneurs

Interested in opportunities in computer networking? Check out Snabb Switch!

Snabb Switch is open source software for solving novel problems in networking. We are blending the latest techniques for high-performance x86 packet processing together with a high-level LuaJIT programming interface. Our goal is to offer the easiest way to create and deploy new network functions in large scale networks.

With Snabb Switch you can:

  1. Use 10G network interfaces at full speed right out of the box.
  2. Create your own new functionality with LuaJIT scripts.
  3. Join a community of creative networking professionals who all want your project to succeed.
  4. Use the Snabb Lab to test your code with 500+ Gbps of networking bandwidth in Xeon servers with 1G/10G/40G adapters from Intel, Mellanox, SolarFlare, and Chelsio.
@lukego
lukego / gist:aebdb14845e52ee8d3a4
Last active August 29, 2015 14:02
Page translation cache (TLB) in dynasm

Simple JIT compiler to create a fixed-size page translation cache. Generates simple linear search code without branches. On small tables it costs about 16 cycles including the overhead of looping and calling from Lua.

Cache table layout:

struct tlb_entry { int64_t page, offset; }

JIT compiler source:

@lukego
lukego / 0README
Last active August 29, 2015 14:02
Snabb `loadgen` benchmark analysis
Exerpt from `perf top`:
```
25.29% perf-26553.map [.] TRACE_7::lib/virtio/net_device.lua:161
22.10% perf-26553.map [.] TRACE_19::lib/virtio/net_device.lua:236
7.63% perf-26553.map [.] TRACE_15::apps/intel/intel_app.lua:77
6.37% snabb [.] lj_alloc_free
6.22% snabb [.] release_unused_segments
4.73% perf-26553.map [.] TRACE_14::apps/intel/intel_app.lua:92
3.93% snabb [.] packet_reset
link report
9,993,377 sent on vm.tx -> nic.rx (loss rate: 0%)
10,000,116 sent on nic.tx -> vm.rx (loss rate: 0%)
Processed 10.0 million packets in 3.93 seconds
Made 184,436 breaths: 54.22 packets per breath; 21.28us per breath
Rate(Mpps): 2.548
98% Compiled
-- 24% tlb.lua:lookup
-- 12% net_device.lua:vm_buffer
luke@grindelwald:~/hacking/snabbswitch/src$ for i in $(seq 1 10); do make && sudo SNABB=$(pwd)/snabb NFV_PACKETS=10e6 scripts/bench_env/loadgen-snabb-nic-guest.sh; done | grep Mpps
Rate(Mpps): 4.804
Rate(Mpps): 5.200
Rate(Mpps): 4.746
Rate(Mpps): 4.797
Rate(Mpps): 4.575
Rate(Mpps): 3.330
Rate(Mpps): 4.684
Rate(Mpps): 4.424
Rate(Mpps): 4.632
core/freelist.lua:14: freelist overflow
stack traceback:
core/main.lua:137: in function <core/main.lua:135>
[C]: in function 'assert'
core/freelist.lua:14: in function 'add'
lib/virtio/net_device.lua:182: in function 'get_transmit_buffers_from_vm'
lib/virtio/net_device.lua:79: in function 'poll_vring_transmit'
apps/vhost/vhost_user.lua:58: in function 'push'
core/app.lua:189: in function 'breathe'
core/app.lua:144: in function 'main'
diff --git a/src/apps/intel/intel10g.lua b/src/apps/intel/intel10g.lua
index 9882b96..ca2d0e0 100644
--- a/src/apps/intel/intel10g.lua
+++ b/src/apps/intel/intel10g.lua
@@ -277,7 +277,7 @@ end
function set_SFI (dev)
local autoc = dev.r.AUTOC()
autoc = bor(
- band(autoc, 0xFFFF0C7E), -- clears FLU, 10g_pma, 1g_pma, restart_AN, LMS
+ band(autoc, 0xFFFF0C7F), -- sets FLU; clears 10g_pma, 1g_pma, restart_AN, LMS
@lukego
lukego / gist:ad26cd463d8d0da03ccf
Created June 27, 2014 06:55
Early run with 8x10G on Grindelwald
On 0000:01:00.0 got 3.652
On 0000:03:00.0 got 3.509
On 0000:05:00.0 got 3.688
On 0000:08:00.0 got 3.713
On 0000:82:00.0 got 3.682
On 0000:84:00.0 got 3.596
On 0000:86:00.0 got 3.759
On 0000:89:00.0 got 3.753
Rate(Mpps): 29.352
@lukego
lukego / filter
Last active August 29, 2015 14:03
#!/usr/bin/env bash
# Mandatory Parameters:
# EVENTS_IN: Directory to read incoming events
# EVENTS_OUT: Directory to write accepted events
#
# Optional Parameters:
# PROJECT: Project name (regex fragment)
# EVENTS_SKIP: Directory to write skipped events
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "trusty"
config.vm.provision "shell", path: "ci.sh"
config.vm.provider "virtualbox" do |vb|