From 080fba59c1bd52fc5aca706317343ae0ca4cce8e Mon Sep 17 00:00:00 2001 From: Kacper Wysocki Date: Sun, 10 Jan 2016 16:55:46 +0100 Subject: [PATCH 01/28] page pointers portable to 32bit platforms --- src/core/memory.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/memory.c b/src/core/memory.c index e6d95350ba..64fa36a08d 100644 --- a/src/core/memory.c +++ b/src/core/memory.c @@ -29,18 +29,18 @@ // Convert from virtual addresses in our own process address space to // physical addresses in the RAM chips. -uint64_t virtual_to_physical(void *ptr) +uint64_t virtual_to_physical(uintptr_t *ptr) { - uint64_t virt_page; + uintptr_t virt_page; static int pagemap_fd; - virt_page = ((uint64_t)ptr) / 4096; + virt_page = ((uintptr_t)ptr) / 4096; if (pagemap_fd == 0) { if ((pagemap_fd = open("/proc/self/pagemap", O_RDONLY)) <= 0) { perror("open pagemap"); return 0; } } - uint64_t data; + uintptr_t data; int len; len = pread(pagemap_fd, &data, sizeof(data), virt_page * sizeof(uint64_t)); if (len != sizeof(data)) { @@ -80,7 +80,7 @@ uint64_t virtual_to_physical(void *ptr) void *allocate_huge_page(int size) { int shmid = -1; - uint64_t physical_address, virtual_address; + uintptr_t physical_address, virtual_address; void *tmpptr = MAP_FAILED; // initial kernel assigned virtual address void *realptr = MAP_FAILED; // remapped virtual address shmid = shmget(IPC_PRIVATE, size, SHM_HUGETLB | IPC_CREAT | SHM_R | SHM_W); From 9a1294c977de8c5f35451ed290a67585e47fbcab Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Wed, 13 Jan 2016 11:51:37 +0100 Subject: [PATCH 02/28] Don't count tail calls towards loop unroll limit. * lib/luajit/src/lj_record.c (lj_record_tailcall): Tail calls don't contribute to loop unroll limit. --- lib/luajit/src/lj_record.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/luajit/src/lj_record.c b/lib/luajit/src/lj_record.c index dc5f2d547a..2a2fbe4fdf 100644 --- a/lib/luajit/src/lj_record.c +++ b/lib/luajit/src/lj_record.c @@ -719,9 +719,14 @@ void lj_record_tailcall(jit_State *J, BCReg func, ptrdiff_t nargs) /* Move func + args down. */ memmove(&J->base[-1], &J->base[func], sizeof(TRef)*(J->maxslot+1)); /* Note: the new TREF_FRAME is now at J->base[-1] (even for slot #0). */ - /* Tailcalls can form a loop, so count towards the loop unroll limit. */ - if (++J->tailcalled > J->loopunroll) - lj_trace_err(J, LJ_TRERR_LUNROLL); + + J->tailcalled++; + + /* Although it's true that tail calls can form a loop, the Lua programming + ** idiom does not encourage this. Instead of counting tail calls towards the + ** unroll limit and potentially causing important traces without loops to + ** abort, eventually blacklist, and fall back to the interpreter, just rely on + ** JIT_P_maxrecord to catch runaway tail-call loops. */ } /* Check unroll limits for down-recursion. */ From bf2d58ab8049fd24591aa20914738a4b1f1b3798 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Wed, 20 Jan 2016 10:39:40 +0100 Subject: [PATCH 03/28] Add lib.ctable module. --- src/lib/ctable.lua | 444 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 444 insertions(+) create mode 100644 src/lib/ctable.lua diff --git a/src/lib/ctable.lua b/src/lib/ctable.lua new file mode 100644 index 0000000000..b59ba4c62e --- /dev/null +++ b/src/lib/ctable.lua @@ -0,0 +1,444 @@ +module(..., package.seeall) + +local ffi = require("ffi") +local C = ffi.C +local S = require("syscall") +local bit = require("bit") +local bxor, bnot = bit.bxor, bit.bnot +local tobit, lshift, rshift = bit.tobit, bit.lshift, bit.rshift +local max, floor, ceil = math.max, math.floor, math.ceil + +CTable = {} + +local HASH_MAX = 0xFFFFFFFF + +local function make_entry_type(key_type, value_type) + return ffi.typeof([[struct { + uint32_t hash; + $ key; + $ value; + } __attribute__((packed))]], + key_type, + value_type) +end + +local function make_entries_type(entry_type) + return ffi.typeof('$[?]', entry_type) +end + +-- hash := [0,HASH_MAX); scale := size/HASH_MAX +local function hash_to_index(hash, scale) + return floor(hash*scale + 0.5) +end + +local function make_equal_fn(key_type) + local size = ffi.sizeof(key_type) + local cast = ffi.cast + if tonumber(ffi.new(key_type)) then + return function (a, b) + return a == b + end + elseif size == 4 then + local uint32_ptr_t = ffi.typeof('uint32_t*') + return function (a, b) + return cast(uint32_ptr_t, a)[0] == cast(uint32_ptr_t, b)[0] + end + elseif size == 8 then + local uint64_ptr_t = ffi.typeof('uint64_t*') + return function (a, b) + return cast(uint64_ptr_t, a)[0] == cast(uint64_ptr_t, b)[0] + end + else + return function (a, b) + return C.memcmp(a, b, size) == 0 + end + end +end + +local function set(...) + local ret = {} + for k, v in pairs({...}) do ret[v] = true end + return ret +end + +local function parse_params(params, required, optional) + local ret = {} + for k, _ in pairs(required) do + if params[k] == nil then error('missing required option ' .. k) end + end + for k, v in pairs(params) do + if not required[k] and optional[k] == nil then + error('unrecognized option ' .. k) + end + ret[k] = v + end + for k, v in pairs(optional) do + if ret[k] == nil then ret[k] = v end + end + return ret +end + +-- FIXME: For now the value_type option is required, but in the future +-- we should allow for a nil value type to create a set instead of a +-- map. +local required_params = set('key_type', 'value_type', 'hash_fn') +local optional_params = { + initial_size = 8, + max_occupancy_rate = 0.9, + min_occupancy_rate = 0.0 +} + +function new(params) + local ctab = {} + local params = parse_params(params, required_params, optional_params) + ctab.entry_type = make_entry_type(params.key_type, params.value_type) + ctab.type = make_entries_type(ctab.entry_type) + ctab.hash_fn = params.hash_fn + ctab.equal_fn = make_equal_fn(params.key_type) + ctab.size = 0 + ctab.occupancy = 0 + ctab.max_occupancy_rate = params.max_occupancy_rate + ctab.min_occupancy_rate = params.min_occupancy_rate + ctab = setmetatable(ctab, { __index = CTable }) + ctab:resize(params.initial_size) + return ctab +end + +-- FIXME: There should be a library to help allocate anonymous +-- hugepages, not this code. +local try_huge_pages = true +local huge_page_threshold = 1e6 +local function calloc(t, count) + local byte_size = ffi.sizeof(t) * count + local mem, err + if try_huge_pages and byte_size > huge_page_threshold then + mem, err = S.mmap(nil, byte_size, 'read, write', + 'private, anonymous, hugetlb') + if not mem then + print("hugetlb mmap failed ("..tostring(err)..'), falling back.') + -- FIXME: Increase vm.nr_hugepages. See + -- core.memory.reserve_new_page(). + end + end + if not mem then + mem, err = S.mmap(nil, byte_size, 'read, write', + 'private, anonymous') + if not mem then error("mmap failed: " .. tostring(err)) end + end + local ret = ffi.cast(ffi.typeof('$*', t), mem) + ffi.gc(ret, function (ptr) S.munmap(ptr, byte_size) end) + return ret +end + +function CTable:resize(size) + assert(size >= (self.occupancy / self.max_occupancy_rate)) + local old_entries = self.entries + local old_size = self.size + + -- Allocate double the requested number of entries to make sure there + -- is sufficient displacement if all hashes map to the last bucket. + self.entries = calloc(self.entry_type, size * 2) + self.size = size + self.scale = self.size / HASH_MAX + self.occupancy = 0 + self.max_displacement = 0 + self.occupancy_hi = ceil(self.size * self.max_occupancy_rate) + self.occupancy_lo = floor(self.size * self.min_occupancy_rate) + for i=0,self.size*2-1 do self.entries[i].hash = HASH_MAX end + + for i=0,old_size*2-1 do + if old_entries[i].hash ~= HASH_MAX then + self:insert(old_entries[i].hash, old_entries[i].key, old_entries[i].value) + end + end +end + +function CTable:insert(hash, key, value, updates_allowed) + if self.occupancy + 1 > self.occupancy_hi then + self:resize(self.size * 2) + end + + local entries = self.entries + local scale = self.scale + local start_index = hash_to_index(hash, self.scale) + local index = start_index + + while entries[index].hash < hash do + index = index + 1 + end + + while entries[index].hash == hash do + if self.equal_fn(key, entries[index].key) then + assert(updates_allowed, "key is already present in ctable") + entries[index].key = key + entries[index].value = value + return index + end + index = index + 1 + end + + assert(updates_allowed ~= 'required', "key not found in ctable") + + self.max_displacement = max(self.max_displacement, index - start_index) + + if entries[index].hash ~= HASH_MAX then + -- In a robin hood hash, we seek to spread the wealth around among + -- the members of the table. An entry that can be stored exactly + -- where hash_to_index() maps it is a most wealthy entry. The + -- farther from that initial position, the less wealthy. Here we + -- have found an entry whose hash is greater than our hash, + -- meaning it has travelled less far, so we steal its position, + -- displacing it by one. We might have to displace other entries + -- as well. + local empty = index; + while entries[empty].hash ~= HASH_MAX do empty = empty + 1 end + while empty > index do + entries[empty] = entries[empty - 1] + local displacement = empty - hash_to_index(entries[empty].hash, scale) + self.max_displacement = max(self.max_displacement, displacement) + empty = empty - 1; + end + end + + self.occupancy = self.occupancy + 1 + entries[index].hash = hash + entries[index].key = key + entries[index].value = value + return index +end + +function CTable:add(key, value, updates_allowed) + local hash = self.hash_fn(key) + assert(hash >= 0) + assert(hash < HASH_MAX) + return self:insert(hash, key, value, updates_allowed) +end + +function CTable:update(key, value) + return self:add(key, value, 'required') +end + +function CTable:lookup_ptr(key) + local hash = self.hash_fn(key) + local entry = self.entries + hash_to_index(hash, self.scale) + + -- Fast path in case we find it directly. + if hash == entry.hash and self.equal_fn(key, entry.key) then + return entry + end + + while entry.hash < hash do entry = entry + 1 end + + while entry.hash == hash do + if self.equal_fn(key, entry.key) then return entry end + -- Otherwise possibly a collision. + entry = entry + 1 + end + + -- Not found. + return nil +end + +function CTable:lookup_and_copy(key, entry) + local entry_ptr = self:lookup_ptr(key) + if not ptr then return false end + entry = entry_ptr + return true +end + +function CTable:remove_ptr(entry) + local scale = self.scale + local index = entry - self.entries + assert(index >= 0) + assert(index <= self.size + self.max_displacement) + assert(entry.hash ~= HASH_MAX) + + self.occupancy = self.occupancy - 1 + entry.hash = HASH_MAX + + while true do + entry = entry + 1 + index = index + 1 + if entry.hash == HASH_MAX then break end + if hash_to_index(entry.hash, scale) == index then break end + -- Give to the poor. + entry[-1] = entry[0] + entry.hash = HASH_MAX + end + + if self.occupancy < self.occupancy_lo then + self:resize(self.size / 2) + end +end + +-- FIXME: Does NOT shrink max_displacement +function CTable:remove(key, missing_allowed) + local ptr = self:lookup_ptr(key) + if not ptr then + assert(missing_allowed, "key not found in ctable") + return false + end + self:remove_ptr(ptr) + return true +end + +function CTable:selfcheck() + local occupancy = 0 + local max_displacement = 0 + + local function fail(expected, op, found, what, where) + if where then where = 'at '..where..': ' else where = '' end + error(where..what..' check: expected '..expected..op..'found '..found) + end + local function expect_eq(expected, found, what, where) + if expected ~= found then fail(expected, '==', found, what, where) end + end + local function expect_le(expected, found, what, where) + if expected > found then fail(expected, '<=', found, what, where) end + end + + local prev = 0 + for i = 0,self.size*2-1 do + local entry = self.entries[i] + local hash = entry.hash + if hash ~= 0xffffffff then + expect_eq(self.hash_fn(entry.key), hash, 'hash', i) + local index = hash_to_index(hash, self.scale) + if prev == 0xffffffff then + expect_eq(index, i, 'undisplaced index', i) + else + expect_le(prev, hash, 'displaced hash', i) + end + occupancy = occupancy + 1 + max_displacement = max(max_displacement, i - index) + end + prev = hash + end + + expect_eq(occupancy, self.occupancy, 'occupancy') + -- Compare using <= because remove_at doesn't update max_displacement. + expect_le(max_displacement, self.max_displacement, 'max_displacement') +end + +function CTable:dump() + local function dump_one(index) + io.write(index..':') + local entry = self.entries[index] + if (entry.hash == HASH_MAX) then + io.write('\n') + else + local distance = index - hash_to_index(entry.hash, self.scale) + io.write(' hash: '..entry.hash..' (distance: '..distance..')\n') + io.write(' key: '..tostring(entry.key)..'\n') + io.write(' value: '..tostring(entry.value)..'\n') + end + end + for index=0,self.size-1 do dump_one(index) end + for index=self.size,self.size*2-1 do + if self.entries[index].hash == HASH_MAX then break end + dump_one(index) + end +end + +function CTable:iterate() + local max_entry = self.entries + self.size + self.max_displacement + local function next_entry(max_entry, entry) + while entry <= max_entry do + entry = entry + 1 + if entry.hash ~= HASH_MAX then return entry end + end + end + return next_entry, max_entry, self.entries - 1 +end + +-- One of Bob Jenkins' hashes from +-- http://burtleburtle.net/bob/hash/integer.html. It's about twice as +-- fast as MurmurHash3_x86_32 and seems to do just as good a job -- +-- tables using this hash function seem to have the same max +-- displacement as tables using the murmur hash. +-- +-- TODO: Switch to a hash function with good security properties, +-- perhaps by using the DynASM support for AES. +local uint32_cast = ffi.new('uint32_t[1]') +function hash_i32(i32) + i32 = tobit(i32) + i32 = i32 + bnot(lshift(i32, 15)) + i32 = bxor(i32, (rshift(i32, 10))) + i32 = i32 + lshift(i32, 3) + i32 = bxor(i32, rshift(i32, 6)) + i32 = i32 + bnot(lshift(i32, 11)) + i32 = bxor(i32, rshift(i32, 16)) + + -- Unset the low bit, to distinguish valid hashes from HASH_MAX. + i32 = lshift(i32, 1) + + -- Project result to u32 range. + uint32_cast[0] = i32 + return uint32_cast[0] +end + +function selftest() + print("selftest: ctable") + + -- 32-byte entries + local occupancy = 2e6 + local params = { + key_type = ffi.typeof('uint32_t'), + value_type = ffi.typeof('int32_t[6]'), + hash_fn = hash_i32, + max_occupancy_rate = 0.4, + initial_size = ceil(occupancy / 0.4) + } + local ctab = new(params) + ctab:resize(occupancy / 0.4 + 1) + + -- Fill with i -> { bnot(i), ... }. + local v = ffi.new('int32_t[6]'); + for i = 1,occupancy do + for j=0,5 do v[j] = bnot(i) end + ctab:add(i, v) + end + + -- In this case we know max_displacement is 8. Assert here so that + -- we can detect any future deviation or regression. + assert(ctab.max_displacement == 8) + + ctab:selfcheck() + + for i = 1, occupancy do + local value = ctab:lookup_ptr(i).value[0] + assert(value == bnot(i)) + end + ctab:selfcheck() + + local iterated = 0 + for entry in ctab:iterate() do iterated = iterated + 1 end + assert(iterated == occupancy) + + -- OK, all looking good with our ctab. + + -- A check that our equality functions work as intended. + local numbers_equal = make_equal_fn(ffi.typeof('int')) + local four_byte = ffi.typeof('uint32_t[1]') + local eight_byte = ffi.typeof('uint32_t[2]') + local twelve_byte = ffi.typeof('uint32_t[3]') + local four_byte_equal = make_equal_fn(four_byte) + local eight_byte_equal = make_equal_fn(eight_byte) + local twelve_byte_equal = make_equal_fn(twelve_byte) + assert(numbers_equal(1,1)) + assert(not numbers_equal(1,2)) + assert(four_byte_equal(ffi.new(four_byte, {1}), + ffi.new(four_byte, {1}))) + assert(not four_byte_equal(ffi.new(four_byte, {1}), + ffi.new(four_byte, {2}))) + assert(eight_byte_equal(ffi.new(eight_byte, {1,1}), + ffi.new(eight_byte, {1,1}))) + assert(not eight_byte_equal(ffi.new(eight_byte, {1,1}), + ffi.new(eight_byte, {1,2}))) + assert(twelve_byte_equal(ffi.new(twelve_byte, {1,1,1}), + ffi.new(twelve_byte, {1,1,1}))) + assert(not twelve_byte_equal(ffi.new(twelve_byte, {1,1,1}), + ffi.new(twelve_byte, {1,1,2}))) + + print("selftest: ok") +end From 61fa43f310beec6d00814b8a2af1c3832b2a78b3 Mon Sep 17 00:00:00 2001 From: Marcel Wiget Date: Mon, 1 Feb 2016 10:55:33 +0200 Subject: [PATCH 04/28] Adding detection of Intel X520 2-port 10GE card --- src/lib/hardware/pci.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/hardware/pci.lua b/src/lib/hardware/pci.lua index ba22b790fd..72a08f981c 100644 --- a/src/lib/hardware/pci.lua +++ b/src/lib/hardware/pci.lua @@ -60,6 +60,7 @@ model = { ["82571"] = 'Intel 82571', ["82599_T3"] = 'Intel 82599 T3', ["X540"] = 'Intel X540', + ["X520"] = 'Intel X520', ["i350"] = 'Intel 350', ["i210"] = 'Intel 210', } @@ -72,6 +73,7 @@ local cards = { ["0x105e"] = {model = model["82571"], driver = 'apps.intel.intel_app'}, ["0x151c"] = {model = model["82599_T3"], driver = 'apps.intel.intel_app'}, ["0x1528"] = {model = model["X540"], driver = 'apps.intel.intel_app'}, + ["0x154d"] = {model = model["X520"], driver = 'apps.intel.intel_app'}, ["0x1521"] = {model = model["i350"], driver = 'apps.intel.intel1g'}, ["0x157b"] = {model = model["i210"], driver = 'apps.intel.intel1g'}, }, From 9666348f1a09ae8d8edf58c65382ac6b21b4a14a Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Tue, 2 Feb 2016 14:47:00 +0100 Subject: [PATCH 05/28] Makefile can process any .md.src to an .md, not just README.md * src/Makefile (MDSRC): Rename from RMSRC, and search for any .md.src file. Update users. (MDOBJS): Rename from RMOBJS. --- src/Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Makefile b/src/Makefile index 938ab86543..bfec34ee3a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -16,7 +16,7 @@ CSRC = $(shell find . -regex '[^\#]*\.c' -not -regex './arch/.*' -printf '%P ' CHDR = $(shell find . -regex '[^\#]*\.h' -printf '%P ') ASM = $(shell find . -regex '[^\#]*\.dasl' -printf '%P ') ARCHSRC= $(shell find . -regex '^./arch/[^\#]*\.c' -printf '%P ') -RMSRC = $(shell find . -name README.md.src -printf '%P ') +MDSRC = $(shell find . -regex '[^\#]*\.md.src' -printf '%P ') # regexp is to include program/foo but not program/foo/bar PROGRAM = $(shell find program -regex '^[^/]+/[^/]+' -type d -printf '%P ') # sort to eliminate potential duplicate of programs.inc @@ -30,7 +30,7 @@ ARCHOBJ:= $(patsubst %.c,obj/%_c.o, $(ARCHSRC)) ASMOBJ := $(patsubst %.dasl,obj/%_dasl.o, $(ASM)) JITOBJS:= $(patsubst %,obj/jit_%.o,$(JITSRC)) EXTRAOBJS := obj/jit_tprof.o obj/jit_vmprof.o obj/strict.o -RMOBJS := $(patsubst %.src,%,$(RMSRC)) +MDOBJS := $(patsubst %.src,%,$(MDSRC)) INCOBJ := $(patsubst %.inc,obj/%_inc.o, $(INCSRC)) EXE := bin/snabb $(patsubst %,bin/%,$(PROGRAM)) @@ -69,7 +69,7 @@ $(EXE): snabb bin @echo -n "BINARY " @ls -sh $@ -markdown: $(RMOBJS) +markdown: $(MDOBJS) test: $(TESTMODS) $(TESTSCRIPTS) @@ -152,7 +152,7 @@ $(JITOBJS): obj/jit_%.o: ../lib/luajit/src/jit/%.lua $(OBJDIR) $(Q) luajit -bg -n $(patsubst obj/jit_%.o, jit.%, $@) $< $@ -$(RMOBJS): %: %.src +$(MDOBJS): %: %.src $(E) "MARKDOWN $@" $(Q) scripts/process-markdown $< > $@ @@ -206,8 +206,8 @@ clean: $(Q)-rm -rf $(CLEAN) mrproper: clean - $(E) "RM $(RMOBJS)" - $(Q)-rm -rf $(RMOBJS) + $(E) "RM $(MDOBJS)" + $(Q)-rm -rf $(MDOBJS) benchmarks: $(Q) (scripts/bench.sh) From bea68b18641dde89477b85ff9e770b016046342d Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Tue, 2 Feb 2016 14:48:55 +0100 Subject: [PATCH 06/28] Better equality procedures for 2-byte/6-byte keys; more standard hash functions * src/lib/ctable.lua (make_equal_fn): Add specialized implementations for 2-byte and 6-byte keys as well. (hash_32): Rename from hash_i32, as it works on any 32-bit number. (hashv_32, hashv_48, hashv_64): New functions. (selftest): Update to test the new equal functions. --- src/lib/ctable.lua | 66 ++++++++++++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 22 deletions(-) diff --git a/src/lib/ctable.lua b/src/lib/ctable.lua index b59ba4c62e..53e71c32db 100644 --- a/src/lib/ctable.lua +++ b/src/lib/ctable.lua @@ -11,6 +11,9 @@ local max, floor, ceil = math.max, math.floor, math.ceil CTable = {} local HASH_MAX = 0xFFFFFFFF +local uint16_ptr_t = ffi.typeof('uint16_t*') +local uint32_ptr_t = ffi.typeof('uint32_t*') +local uint64_ptr_t = ffi.typeof('uint64_t*') local function make_entry_type(key_type, value_type) return ffi.typeof([[struct { @@ -38,13 +41,20 @@ local function make_equal_fn(key_type) return function (a, b) return a == b end + elseif size == 2 then + return function (a, b) + return cast(uint16_ptr_t, a)[0] == cast(uint16_ptr_t, b)[0] + end elseif size == 4 then - local uint32_ptr_t = ffi.typeof('uint32_t*') return function (a, b) return cast(uint32_ptr_t, a)[0] == cast(uint32_ptr_t, b)[0] end + elseif size == 6 then + return function (a, b) + return (cast(uint32_ptr_t, a)[0] == cast(uint32_ptr_t, b)[0] and + cast(uint16_ptr_t, a)[2] == cast(uint16_ptr_t, b)[2]) + end elseif size == 8 then - local uint64_ptr_t = ffi.typeof('uint64_t*') return function (a, b) return cast(uint64_ptr_t, a)[0] == cast(uint64_ptr_t, b)[0] end @@ -360,7 +370,7 @@ end -- TODO: Switch to a hash function with good security properties, -- perhaps by using the DynASM support for AES. local uint32_cast = ffi.new('uint32_t[1]') -function hash_i32(i32) +function hash_32(i32) i32 = tobit(i32) i32 = i32 + bnot(lshift(i32, 15)) i32 = bxor(i32, (rshift(i32, 10))) @@ -377,6 +387,25 @@ function hash_i32(i32) return uint32_cast[0] end +function hashv_32(key) + return hash_32(cast(uint32_ptr_t, key)[0]) +end + +function hashv_48(key) + local hi = cast(uint32_ptr_t, key)[0] + local lo = cast(uint16_ptr_t, key)[2] + -- Extend lo to the upper half too so that the hash function isn't + -- spreading around needless zeroes. + lo = bor(lo, lshift(lo, 16)) + return hash_32(bxor(hi, hash_32(lo))) +end + +function hashv_64(key) + local hi = cast(uint32_ptr_t, key)[0] + local lo = cast(uint32_ptr_t, key)[1] + return hash_32(bxor(hi, hash_32(lo))) +end + function selftest() print("selftest: ctable") @@ -385,7 +414,7 @@ function selftest() local params = { key_type = ffi.typeof('uint32_t'), value_type = ffi.typeof('int32_t[6]'), - hash_fn = hash_i32, + hash_fn = hash_32, max_occupancy_rate = 0.4, initial_size = ceil(occupancy / 0.4) } @@ -419,26 +448,19 @@ function selftest() -- A check that our equality functions work as intended. local numbers_equal = make_equal_fn(ffi.typeof('int')) - local four_byte = ffi.typeof('uint32_t[1]') - local eight_byte = ffi.typeof('uint32_t[2]') - local twelve_byte = ffi.typeof('uint32_t[3]') - local four_byte_equal = make_equal_fn(four_byte) - local eight_byte_equal = make_equal_fn(eight_byte) - local twelve_byte_equal = make_equal_fn(twelve_byte) assert(numbers_equal(1,1)) assert(not numbers_equal(1,2)) - assert(four_byte_equal(ffi.new(four_byte, {1}), - ffi.new(four_byte, {1}))) - assert(not four_byte_equal(ffi.new(four_byte, {1}), - ffi.new(four_byte, {2}))) - assert(eight_byte_equal(ffi.new(eight_byte, {1,1}), - ffi.new(eight_byte, {1,1}))) - assert(not eight_byte_equal(ffi.new(eight_byte, {1,1}), - ffi.new(eight_byte, {1,2}))) - assert(twelve_byte_equal(ffi.new(twelve_byte, {1,1,1}), - ffi.new(twelve_byte, {1,1,1}))) - assert(not twelve_byte_equal(ffi.new(twelve_byte, {1,1,1}), - ffi.new(twelve_byte, {1,1,2}))) + + local function check_bytes_equal(type, a, b) + local equal_fn = make_equal_fn(type) + assert(equal_fn(ffi.new(type, a), ffi.new(type, a))) + assert(not equal_fn(ffi.new(type, a), ffi.new(type, b))) + end + check_bytes_equal(ffi.typeof('uint16_t[1]'), {1}, {2}) -- 2 byte + check_bytes_equal(ffi.typeof('uint32_t[1]'), {1}, {2}) -- 4 byte + check_bytes_equal(ffi.typeof('uint16_t[3]'), {1,1,1}, {1,1,2}) -- 6 byte + check_bytes_equal(ffi.typeof('uint32_t[2]'), {1,1}, {1,2}) -- 8 byte + check_bytes_equal(ffi.typeof('uint32_t[3]'), {1,1,1}, {1,1,2}) -- 12 byte print("selftest: ok") end From fe70ccf327739d4b79e9e9c8a8b288efd7932ded Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Tue, 2 Feb 2016 14:50:40 +0100 Subject: [PATCH 07/28] Add documentation for lib.ctable. * src/doc/genbook.sh: Add section for specialized data structures. * src/lib/README.ctable.md: New file. --- src/doc/genbook.sh | 4 + src/lib/README.ctable.md | 198 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 202 insertions(+) create mode 100644 src/lib/README.ctable.md diff --git a/src/doc/genbook.sh b/src/doc/genbook.sh index 0746e96657..7b13d6081f 100755 --- a/src/doc/genbook.sh +++ b/src/doc/genbook.sh @@ -61,6 +61,10 @@ $(cat ../lib/hardware/README.md) $(cat ../lib/protocol/README.md) +## Specialized data structures + +$(cat ../lib/README.ctable.md) + ## Snabb NFV $(cat ../program/snabbnfv/README.md) diff --git a/src/lib/README.ctable.md b/src/lib/README.ctable.md new file mode 100644 index 0000000000..62759840b9 --- /dev/null +++ b/src/lib/README.ctable.md @@ -0,0 +1,198 @@ +### `ctable` (lib.ctable) + +A ctable is a hash table whose keys and values are instances of FFI +data types. In Lua parlance, an FFI value is a "cdata" value, hence the +name "ctable". + +A ctable is parameterized the specific types for its keys and values. +This allows for the table to be stored in an efficient manner. Adding +an entry to a ctable will copy the value into the table. Logically, the +table "owns" the value. Lookup can either return a pointer to the value +in the table, or copy the value into a user-supplied buffer, depending +on what is most convenient for the user. + +As an implementation detail, the table is stored as an open-addressed +robin-hood hash table with linear probing. This means that to look up a +key in the table, we take its hash value (using a user-supplied hash +function), map that hash value to an index into the table by scaling the +hash to the table size, and then scan forward in the table until we find +an entry whose hash value that is greater than or equal to the hash in +question. Each entry stores its hash value, and empty entries have a +hash of `0xFFFFFFFF`. If the entry's hash matches and the entry's key +is equal to the one we are looking for, then we have our match. If the +entry's hash is greater than our hash, then we have a failure. Hash +collisions are possible as well of course; in that case we continue +scanning forward. + +The distance travelled while scanning for the matching hash is known as +the /displacement/. The table measures its maximum displacement, for a +number of purposes, but you might be interested to know that a maximum +displacement for a table with 2 million entries and a 40% load factor is +around 8 or 9. Smaller tables will have smaller maximum displacements. + +The ctable has two lookup interfaces. One will perform the lookup as +described above, scanning through the hash table in place. The other +will fetch all entries within the maximum displacement into a buffer, +then do a branchless binary search over that buffer. This second +streaming lookup can also fetch entries for multiple keys in one go. +This can amortize the cost of a round-trip to RAM, in the case where you +expect to miss cache for every lookup. + +To create a ctable, first create a parameters table specifying the key +and value types, along with any other options. Then call `ctable.new` +on those parameters. For example: + +```lua +local ctable = require('lib.ctable') +local ffi = require('ffi') +local params = { + key_type = ffi.typeof('uint32_t'), + value_type = ffi.typeof('int32_t[6]'), + hash_fn = ctable.hash_i32, + max_occupancy_rate = 0.4, + initial_size = math.ceil(occupancy / 0.4) +} +local ctab = ctable.new(params) +``` + +— Function **ctable.new** *params* + +Create a new ctable. *params* is a table of key/value pairs. The +following keys are required: + + * `key_type`: An FFI type for keys in this table. + * `value_type`: An FFI type for values in this table. (In the future, + `value_type` will be optional; a nil `value_type` will create a + set). + * `hash_fn`: A function that takes a key and returns a hash value. + +Hash values are unsigned 32-bit integers in the range `[0, +0xFFFFFFFF)`. That is to say, `0xFFFFFFFF` is the only unsigned 32-bit +integer that is not a valid hash value. The `hash_fn` must return a +hash value in the correct range. + +Optional entries that may be present in the *params* table include: + + * `initial_size`: The initial size of the hash table, including free + space. Defaults to 8 slots. + * `max_occupancy_rate`: The maximum ratio of `occupancy/size`, where + `occupancy` denotes the number of entries in the table, and `size` is + the total table size including free entries. Trying to add an entry + to a "full" table will cause the table to grow in size by a factor of + 2. Defaults to 0.9, for a 90% maximum occupancy ratio. + * `min_occupancy_rate`: Minimum ratio of `occupancy/size`. Removing an + entry from an "empty" table will shrink the table. + +#### Methods + +Users interact with a ctable through methods. In these method +descriptions, the object on the left-hand-side of the method invocation +should be a ctable. + +— Method **:resize** *size* + +Resize the ctable to have *size* total entries, including empty space. + +— Method **:insert** *hash* *key* *value* *updates_allowed* + +An internal helper method that does the bulk of updates to hash table. +*hash* is the hash of *key*. This method takes the hash as an explicit +parameter because it is used when resizing the table, and that way we +avoid calling the hash function in that case. *key* and *value* are FFI +values for the key and the value, of course. + +*updates_allowed* is an optional parameter. If not present or false, +then the `:insert` method will raise an error if the *key* is already +present in the table. If *updates_allowed* is the string `"required"`, +then an error will be raised if *key* is /not/ already in the table. +Any other true value allows updates but does not require them. An +update will replace the existing entry in the table. + +Returns the index of the inserted entry. + +— Method **:add** *key* *value* *updates_allowed* + +Add an entry to the ctable, returning the index of the added entry. See +the documentation for `:insert` for a description of the parameters. + +— Method **:update** *key* *value* + +Update the entry in a ctable with the key *key* to have the new value +*value*. Throw an error if *key* is not present in the table. + +— Method **:lookup_ptr** *key* + +Look up *key* in the table, and if found return a pointer to the entry. +Return nil if the value is not found. + +An entry pointer has three fields: the `hash` value, which must not be +modified; the `key' itself; and the `value`. Access them as usual in +Lua: + +```lua +local ptr = ctab:lookup(key) +if ptr then print(ptr.value) end +``` + +Note that pointers are only valid until the next modification of a +table. + +— Method **:lookup_and_copy** *key* *entry* + +Look up *key* in the table, and if found, copy that entry into *entry* +and return true. Otherwise return false. + +— Method **:remove_ptr** *entry* + +Remove an entry from a ctable. *entry* should be a pointer that points +into the table. Note that pointers are only valid until the next +modification of a table. + +— Method **:remove** *key* *missing_allowed* + +Remove an entry from a ctable, keyed by *key*. + +Return true if we actually do find a value and remove it. Otherwise if +no entry is found in the table and *missing_allowed* is true, then +return false. Otherwise raise an error. + +— Method **:selfcheck** + +Run an expensive internal diagnostic to verify that the table's internal +invariants are fulfilled. + +— Method **:dump** + +Print out the entries in a table. Can be expensive if the table is +large. + +— Method **:iterate** + +Return an iterator for use by `for in`. For example: + +```lua +for entry in ctab:iterate() do + print(entry.key, entry.value) +end +``` + +#### Hash functions + +Any hash function will do, as long as it produces values in the right +range. In practice we include some functions for hashing byte sequences +of some common small lengths. + +— Function **ctable.hash_32** *number* +Hash a 32-bit integer. As a `hash_fn` parameter, this will only work if +your key type's Lua representation is a Lua number. For example, use +`hash_32` on `ffi.typeof('uint32_t')`, but use `hashv_32` on +`ffi.typeof('uint8_t[4]')`. + +— Function **ctable.hashv_32** *ptr* +Hash the first 32 bits of a byte sequence. + +— Function **ctable.hashv_48** *ptr* +Hash the first 48 bits of a byte sequence. + +— Function **ctable.hashv_64** *ptr* +Hash the first 64 bits of a byte sequence. From 586f0b7a90dc58e290a15cc70ea8910e63728246 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Tue, 2 Feb 2016 15:39:15 +0100 Subject: [PATCH 08/28] Add wingo-next to branches.md. --- src/doc/branches.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/doc/branches.md b/src/doc/branches.md index d87ac896c2..2b183819f0 100644 --- a/src/doc/branches.md +++ b/src/doc/branches.md @@ -52,6 +52,17 @@ The current state of each branch with respect to master is visible here: Maintainer: Max Rottenkolber +#### wingo-next + + BRANCH: wingo-next git://github.com/wingo/snabbswitch + Test and integration branch for maintenance & development. + + - Contains changes proposed to be merged into next. + - Merges Pull Requests that pass code review on GitHub. + - Integration branch for code vetted by Andy + + Maintainer: Andy Wingo + #### documenation-fixups BRANCH: documentation-fixups git://github.com/eugeneia/snabbswitch From 27b82d5be1dcf9612b79e013b6324e40342709b5 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Tue, 2 Feb 2016 15:49:12 +0100 Subject: [PATCH 09/28] Fix typo. --- src/lib/README.ctable.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib/README.ctable.md b/src/lib/README.ctable.md index 62759840b9..c9c3da476b 100644 --- a/src/lib/README.ctable.md +++ b/src/lib/README.ctable.md @@ -4,12 +4,12 @@ A ctable is a hash table whose keys and values are instances of FFI data types. In Lua parlance, an FFI value is a "cdata" value, hence the name "ctable". -A ctable is parameterized the specific types for its keys and values. -This allows for the table to be stored in an efficient manner. Adding -an entry to a ctable will copy the value into the table. Logically, the -table "owns" the value. Lookup can either return a pointer to the value -in the table, or copy the value into a user-supplied buffer, depending -on what is most convenient for the user. +A ctable is parameterized for the specific types for its keys and +values. This allows for the table to be stored in an efficient manner. +Adding an entry to a ctable will copy the value into the table. +Logically, the table "owns" the value. Lookup can either return a +pointer to the value in the table, or copy the value into a +user-supplied buffer, depending on what is most convenient for the user. As an implementation detail, the table is stored as an open-addressed robin-hood hash table with linear probing. This means that to look up a From c5877283c86072beef9330ffd9947dbb82a39a23 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Tue, 2 Feb 2016 15:58:40 +0100 Subject: [PATCH 10/28] Fix another typo. Thanks to Kristian Larsson for catching it. --- src/lib/README.ctable.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/README.ctable.md b/src/lib/README.ctable.md index c9c3da476b..0392d3c1ae 100644 --- a/src/lib/README.ctable.md +++ b/src/lib/README.ctable.md @@ -16,7 +16,7 @@ robin-hood hash table with linear probing. This means that to look up a key in the table, we take its hash value (using a user-supplied hash function), map that hash value to an index into the table by scaling the hash to the table size, and then scan forward in the table until we find -an entry whose hash value that is greater than or equal to the hash in +an entry whose hash value is greater than or equal to the hash in question. Each entry stores its hash value, and empty entries have a hash of `0xFFFFFFFF`. If the entry's hash matches and the entry's key is equal to the one we are looking for, then we have our match. If the From 1f83b5cb143a41ea8d6bfa71e9315cd9859a59a8 Mon Sep 17 00:00:00 2001 From: Luke Gorrie Date: Thu, 4 Feb 2016 04:46:31 +0000 Subject: [PATCH 11/28] Globally use '#!/usr/bin/env ' hashbang line Convert all shell scripts from having path dependencies like: #!/bin/bash to #!/usr/bin/env bash The immediate utility of this change is to fix annoying breakage on NixOS. For example, now "make doc/snabbswitch.html" works. Exception is that I did not descend into subdirectories of dependencies e.g. ljsyscall and pflua. I made the changes with an Emacs macro in the hope of avoiding an unfortunate typo that will break something. --- src/apps/solarflare/selftest.sh | 2 +- src/apps/tap/selftest.sh | 2 +- src/bench/basic1-100e6 | 2 +- src/bench/packetblaster-64 | 2 +- src/bench/packetblaster-synth-64 | 2 +- src/bench/snabbnfv-iperf-1500 | 2 +- src/bench/snabbnfv-iperf-jumbo | 2 +- src/bench/snabbnfv-loadgen-dpdk | 2 +- src/doc/genbook.sh | 2 +- src/lib/watchdog/selftest.sh | 2 +- src/program/packetblaster/selftest.sh | 2 +- src/program/snabbnfv/neutron2snabb/selftest.sh | 2 +- src/program/snabbnfv/neutron_sync_agent/neutron_sync_agent.sh | 2 +- src/program/snabbnfv/neutron_sync_master/neutron_sync_master.sh | 2 +- src/program/snabbnfv/packetblaster_bench.sh | 2 +- src/program/snabbnfv/selftest.sh | 2 +- src/scripts/bench.sh | 2 +- src/scripts/process-markdown | 2 +- src/scripts/sysv/init.d/snabb-nfv-sync-agent | 2 +- src/scripts/sysv/init.d/snabb-nfv-sync-master | 2 +- src/scripts/sysv/init.d/snabb-nfv-traffic | 2 +- src/selftest.sh | 2 +- 22 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/apps/solarflare/selftest.sh b/src/apps/solarflare/selftest.sh index 6b54c3f616..ed7625699b 100755 --- a/src/apps/solarflare/selftest.sh +++ b/src/apps/solarflare/selftest.sh @@ -1,3 +1,3 @@ -#!/bin/bash +#!/usr/bin/env bash ./snabb snabbmark solarflare 10e6 128 10 diff --git a/src/apps/tap/selftest.sh b/src/apps/tap/selftest.sh index b742848945..0d807d489a 100755 --- a/src/apps/tap/selftest.sh +++ b/src/apps/tap/selftest.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash sudo ip netns add snabbtest || exit $TEST_SKIPPED sudo ip netns exec snabbtest ip link add name snabbtest type bridge sudo ip netns exec snabbtest ip link set up dev snabbtest diff --git a/src/bench/basic1-100e6 b/src/bench/basic1-100e6 index a63b24a6f8..cad6637357 100755 --- a/src/bench/basic1-100e6 +++ b/src/bench/basic1-100e6 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e out=$(./snabb snabbmark basic1 100e6) # Extract floating point Mpps number from output. diff --git a/src/bench/packetblaster-64 b/src/bench/packetblaster-64 index 112a3b3852..2b78bfb7df 100755 --- a/src/bench/packetblaster-64 +++ b/src/bench/packetblaster-64 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e [ ! -z "$SNABB_PCI_INTEL0" ] || exit 1 diff --git a/src/bench/packetblaster-synth-64 b/src/bench/packetblaster-synth-64 index 301e588720..9db4051dd5 100755 --- a/src/bench/packetblaster-synth-64 +++ b/src/bench/packetblaster-synth-64 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e [ ! -z "$SNABB_PCI_INTEL0" ] || exit 1 diff --git a/src/bench/snabbnfv-iperf-1500 b/src/bench/snabbnfv-iperf-1500 index f061bc8e90..cfe3e40f93 100755 --- a/src/bench/snabbnfv-iperf-1500 +++ b/src/bench/snabbnfv-iperf-1500 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e out=$(program/snabbnfv/selftest.sh bench) # Extract floating point Gbits number from output. diff --git a/src/bench/snabbnfv-iperf-jumbo b/src/bench/snabbnfv-iperf-jumbo index caff461807..8049a70744 100755 --- a/src/bench/snabbnfv-iperf-jumbo +++ b/src/bench/snabbnfv-iperf-jumbo @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e out=$(program/snabbnfv/selftest.sh bench jumbo) # Extract floating point Gbits number from output. diff --git a/src/bench/snabbnfv-loadgen-dpdk b/src/bench/snabbnfv-loadgen-dpdk index cfd53070b2..3ce491d208 100755 --- a/src/bench/snabbnfv-loadgen-dpdk +++ b/src/bench/snabbnfv-loadgen-dpdk @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e out=$(timeout 120 program/snabbnfv/packetblaster_bench.sh) # Extract floating point Mpps number from output. diff --git a/src/doc/genbook.sh b/src/doc/genbook.sh index 0746e96657..72661945ce 100755 --- a/src/doc/genbook.sh +++ b/src/doc/genbook.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # This shell scripts generates the top-level Markdown structure of the # Snabb Switch book. diff --git a/src/lib/watchdog/selftest.sh b/src/lib/watchdog/selftest.sh index 716c8ea6a1..4e35ed2f0c 100755 --- a/src/lib/watchdog/selftest.sh +++ b/src/lib/watchdog/selftest.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env sh ./snabb snsh ./lib/watchdog/selftest_design alert if [ $? != 0 ]; then exit 1; fi diff --git a/src/program/packetblaster/selftest.sh b/src/program/packetblaster/selftest.sh index 881f9fa0d8..3c726af70e 100755 --- a/src/program/packetblaster/selftest.sh +++ b/src/program/packetblaster/selftest.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash echo "selftest: packetblaster" export PCIADDR=$SNABB_PCI_INTEL0 diff --git a/src/program/snabbnfv/neutron2snabb/selftest.sh b/src/program/snabbnfv/neutron2snabb/selftest.sh index bfd2ae1110..b799140281 100755 --- a/src/program/snabbnfv/neutron2snabb/selftest.sh +++ b/src/program/snabbnfv/neutron2snabb/selftest.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash echo "selftest: neutron2snabb/selftest.sh" diff --git a/src/program/snabbnfv/neutron_sync_agent/neutron_sync_agent.sh b/src/program/snabbnfv/neutron_sync_agent/neutron_sync_agent.sh index 11dbf24cd4..7218a43759 100644 --- a/src/program/snabbnfv/neutron_sync_agent/neutron_sync_agent.sh +++ b/src/program/snabbnfv/neutron_sync_agent/neutron_sync_agent.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Neutron synchronization slave process to run on the Compute Nodes. diff --git a/src/program/snabbnfv/neutron_sync_master/neutron_sync_master.sh b/src/program/snabbnfv/neutron_sync_master/neutron_sync_master.sh index 3071c26f78..7f1be47168 100644 --- a/src/program/snabbnfv/neutron_sync_master/neutron_sync_master.sh +++ b/src/program/snabbnfv/neutron_sync_master/neutron_sync_master.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Neutron synchronization master process to run on the Network Node. diff --git a/src/program/snabbnfv/packetblaster_bench.sh b/src/program/snabbnfv/packetblaster_bench.sh index a2b11a04d3..5d264463b7 100755 --- a/src/program/snabbnfv/packetblaster_bench.sh +++ b/src/program/snabbnfv/packetblaster_bench.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash export SKIPPED_CODE=43 diff --git a/src/program/snabbnfv/selftest.sh b/src/program/snabbnfv/selftest.sh index 7ae1efb718..b836baf293 100755 --- a/src/program/snabbnfv/selftest.sh +++ b/src/program/snabbnfv/selftest.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash SKIPPED_CODE=43 diff --git a/src/scripts/bench.sh b/src/scripts/bench.sh index 4a081343ce..53056485ec 100755 --- a/src/scripts/bench.sh +++ b/src/scripts/bench.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash function n_times { for i in $(seq $1); do diff --git a/src/scripts/process-markdown b/src/scripts/process-markdown index f036254727..9a43e21ad9 100755 --- a/src/scripts/process-markdown +++ b/src/scripts/process-markdown @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # Markdown preprocessor. # diff --git a/src/scripts/sysv/init.d/snabb-nfv-sync-agent b/src/scripts/sysv/init.d/snabb-nfv-sync-agent index af3cf237ae..7e99281b38 100644 --- a/src/scripts/sysv/init.d/snabb-nfv-sync-agent +++ b/src/scripts/sysv/init.d/snabb-nfv-sync-agent @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env sh # ### BEGIN INIT INFO diff --git a/src/scripts/sysv/init.d/snabb-nfv-sync-master b/src/scripts/sysv/init.d/snabb-nfv-sync-master index f52c4b93c8..d505857d78 100644 --- a/src/scripts/sysv/init.d/snabb-nfv-sync-master +++ b/src/scripts/sysv/init.d/snabb-nfv-sync-master @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env sh # ### BEGIN INIT INFO diff --git a/src/scripts/sysv/init.d/snabb-nfv-traffic b/src/scripts/sysv/init.d/snabb-nfv-traffic index 20f5a957b4..7842a6656d 100644 --- a/src/scripts/sysv/init.d/snabb-nfv-traffic +++ b/src/scripts/sysv/init.d/snabb-nfv-traffic @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env sh # ### BEGIN INIT INFO diff --git a/src/selftest.sh b/src/selftest.sh index 764ab1e63f..efbe1ba043 100755 --- a/src/selftest.sh +++ b/src/selftest.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash echo "selftest: ./snabb binary portability" echo "Scanning for symbols requiring GLIBC > 2.7" if objdump -T snabb | \ From 071aaf7ec55c7c741e2c13d38bc7e66716fa4e74 Mon Sep 17 00:00:00 2001 From: Luke Gorrie Date: Thu, 4 Feb 2016 07:15:39 +0000 Subject: [PATCH 12/28] src/README.md: Simplify core.memory API Streamline the core.memory API: - Rewrite the blurb. - Keep dma_alloc() and virtual_to_physical(). - Remove dma_min_addr and dma_max_addr (unsed). - Deprecate huge_page_size (used but should it be?) Backstory here is that the core.memory module has exported low-level information to other modules: the VFIO module (since removed) that needed to whitelist all DMA memory with the kernel, a /dev/vhost-net accelerator for tap devices (since removed) that also needed to whitelist all packet memory, and to a lesser extent the vhost-user implementation (that is still alive and well but may be overusing the memory API e.g. in dead code that should be removed). Adding the deprecation note on "huge_page_size" may or may not be a good idea. Have to look more closely at the usage and clarify with a later commit. --- src/README.md.src | 52 +++++++++-------------------------------------- 1 file changed, 10 insertions(+), 42 deletions(-) diff --git a/src/README.md.src b/src/README.md.src index 2f334b39d5..773d6eba42 100644 --- a/src/README.md.src +++ b/src/README.md.src @@ -359,56 +359,24 @@ Allocate packet and fill it with the contents of *string*. ## Memory (core.memory) -Snabb Switch does two things specially when it comes to memory: It -runs with a fixed physical memory map and it allocates *huge pages* -from the operating system. +Snabb Switch allocates special +[DMA](https://en.wikipedia.org/wiki/Direct_memory_access) memory that +can be accessed directly by network cards. The important +characteristic of DMA memory is being located in contiguous physical +memory at a stable address. -Running with a fixed memory map means that every virtual address in the -Snabb Switch process has a fixed *physical address* in the RAM -chips. This means that we are always able to convert from a virtual -address in our process to a physical address that other hardware (for -example, a network card) can use for DMA. - -Huge pages (also known as *HugeTLB pages*) are how we allocate large -amounts of contiguous memory, typically 2MB at a time. Hardware devices -sometimes require this, for example a network card's *descriptor ring* -may require a list of pointers to available buffers in physical memory. - -— Variable **memory.chunks** - -List of all allocated huge pages. Read-only. Each huge page is -represented by a table with the following keys: - -* `pointer` - Virtual address -* `physical` - Physical address -* `size` - Size in bytes -* `used` - Bytes used +— Function **memory.dma_alloc** *bytes* -— Variable **memory.dma_min_addr** +Returns a pointer to *bytes* of new DMA memory. -— Variable **memory.dma_max_addr** +— Function **memory.virtual_to_physical** *pointer* -Lowest and highest addresses of valid DMA memory. Useful information for -creating memory maps. Read-only. +Returns the physical address (`uint64_t`) the DMA memory at *pointer*. -— Variable **memory.huge_page_size** +— Variable **memory.huge_page_size** [**DEPRECATED**] Size of a single huge page in bytes. Read-only. -— Variable **huge_page_bits** - -Number of address bits per huge page. Read-only. - -— Function **memory.dma_alloc** *bytes* - -Allocate *bytes* of DMA-friendly memory. Returns virtual memory pointer, -physical address, and actual size. - -— Function **memory.virtual_to_physical** *virtual_address* - -Returns the physical address of memory at *virtual_address*. - - ## Lib (core.lib) From 7bf8b3efbbbf5aedc3a340d73823a1d1f88db58a Mon Sep 17 00:00:00 2001 From: Luke Gorrie Date: Thu, 4 Feb 2016 07:14:01 +0000 Subject: [PATCH 13/28] virtio/net_device.lua: Remove unused code Remove the variable 'pagebits' and the function 'VirtioNetDevice:translate_physical_addr()'. These are not used and they depend on parts of the core.memory API that I want to remove. --- src/lib/virtio/net_device.lua | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/lib/virtio/net_device.lua b/src/lib/virtio/net_device.lua index bf8e451f8c..c4e063e0f8 100644 --- a/src/lib/virtio/net_device.lua +++ b/src/lib/virtio/net_device.lua @@ -328,20 +328,6 @@ function VirtioNetDevice:tx_signal_used() end end -local pagebits = memory.huge_page_bits - --- Cache of the latest referenced physical page. -function VirtioNetDevice:translate_physical_addr (addr) - local page = bit.rshift(addr, pagebits) - if page == self.last_virt_page then - return addr + self.last_virt_offset - end - local phys = memory.virtual_to_physical(addr) - self.last_virt_page = page - self.last_virt_offset = phys - addr - return phys -end - function VirtioNetDevice:map_from_guest (addr) local result local m = self.mem_table[0] From bc2fda2cd6c2a1c383331a79b282853d1cc3b7d3 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Thu, 4 Feb 2016 09:52:57 +0100 Subject: [PATCH 14/28] Revert "Makefile can process any .md.src to an .md, not just README.md" This reverts commit 9666348f1a09ae8d8edf58c65382ac6b21b4a14a. --- src/Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Makefile b/src/Makefile index bfec34ee3a..938ab86543 100644 --- a/src/Makefile +++ b/src/Makefile @@ -16,7 +16,7 @@ CSRC = $(shell find . -regex '[^\#]*\.c' -not -regex './arch/.*' -printf '%P ' CHDR = $(shell find . -regex '[^\#]*\.h' -printf '%P ') ASM = $(shell find . -regex '[^\#]*\.dasl' -printf '%P ') ARCHSRC= $(shell find . -regex '^./arch/[^\#]*\.c' -printf '%P ') -MDSRC = $(shell find . -regex '[^\#]*\.md.src' -printf '%P ') +RMSRC = $(shell find . -name README.md.src -printf '%P ') # regexp is to include program/foo but not program/foo/bar PROGRAM = $(shell find program -regex '^[^/]+/[^/]+' -type d -printf '%P ') # sort to eliminate potential duplicate of programs.inc @@ -30,7 +30,7 @@ ARCHOBJ:= $(patsubst %.c,obj/%_c.o, $(ARCHSRC)) ASMOBJ := $(patsubst %.dasl,obj/%_dasl.o, $(ASM)) JITOBJS:= $(patsubst %,obj/jit_%.o,$(JITSRC)) EXTRAOBJS := obj/jit_tprof.o obj/jit_vmprof.o obj/strict.o -MDOBJS := $(patsubst %.src,%,$(MDSRC)) +RMOBJS := $(patsubst %.src,%,$(RMSRC)) INCOBJ := $(patsubst %.inc,obj/%_inc.o, $(INCSRC)) EXE := bin/snabb $(patsubst %,bin/%,$(PROGRAM)) @@ -69,7 +69,7 @@ $(EXE): snabb bin @echo -n "BINARY " @ls -sh $@ -markdown: $(MDOBJS) +markdown: $(RMOBJS) test: $(TESTMODS) $(TESTSCRIPTS) @@ -152,7 +152,7 @@ $(JITOBJS): obj/jit_%.o: ../lib/luajit/src/jit/%.lua $(OBJDIR) $(Q) luajit -bg -n $(patsubst obj/jit_%.o, jit.%, $@) $< $@ -$(MDOBJS): %: %.src +$(RMOBJS): %: %.src $(E) "MARKDOWN $@" $(Q) scripts/process-markdown $< > $@ @@ -206,8 +206,8 @@ clean: $(Q)-rm -rf $(CLEAN) mrproper: clean - $(E) "RM $(MDOBJS)" - $(Q)-rm -rf $(MDOBJS) + $(E) "RM $(RMOBJS)" + $(Q)-rm -rf $(RMOBJS) benchmarks: $(Q) (scripts/bench.sh) From 5b9400a739f3f800a2bbe52c5dcd461c9ee15fe7 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Thu, 4 Feb 2016 10:33:07 +0100 Subject: [PATCH 15/28] Move ctable documentation to src/lib/README.md, fix nits Thanks to Max Rottenkolber for review. --- src/doc/genbook.sh | 6 ++-- src/lib/{README.ctable.md => README.md} | 44 ++++++++++++++----------- 2 files changed, 26 insertions(+), 24 deletions(-) rename src/lib/{README.ctable.md => README.md} (86%) diff --git a/src/doc/genbook.sh b/src/doc/genbook.sh index 7b13d6081f..0a0e76ac96 100755 --- a/src/doc/genbook.sh +++ b/src/doc/genbook.sh @@ -53,6 +53,8 @@ $(cat ../apps/socket/README.md) # Libraries +$(cat ../lib/README.md) + ## Hardware $(cat ../lib/hardware/README.md) @@ -61,10 +63,6 @@ $(cat ../lib/hardware/README.md) $(cat ../lib/protocol/README.md) -## Specialized data structures - -$(cat ../lib/README.ctable.md) - ## Snabb NFV $(cat ../program/snabbnfv/README.md) diff --git a/src/lib/README.ctable.md b/src/lib/README.md similarity index 86% rename from src/lib/README.ctable.md rename to src/lib/README.md index 0392d3c1ae..c6b218ab35 100644 --- a/src/lib/README.ctable.md +++ b/src/lib/README.md @@ -1,6 +1,8 @@ -### `ctable` (lib.ctable) +## Specialized data structures -A ctable is a hash table whose keys and values are instances of FFI +### Ctable (lib.ctable) + +A *ctable* is a hash table whose keys and values are instances of FFI data types. In Lua parlance, an FFI value is a "cdata" value, hence the name "ctable". @@ -25,7 +27,7 @@ collisions are possible as well of course; in that case we continue scanning forward. The distance travelled while scanning for the matching hash is known as -the /displacement/. The table measures its maximum displacement, for a +the *displacement*. The table measures its maximum displacement, for a number of purposes, but you might be interested to know that a maximum displacement for a table with 2 million entries and a 40% load factor is around 8 or 9. Smaller tables will have smaller maximum displacements. @@ -55,15 +57,13 @@ local params = { local ctab = ctable.new(params) ``` -— Function **ctable.new** *params* +— Function **ctable.new** *parameters* -Create a new ctable. *params* is a table of key/value pairs. The +Create a new ctable. *parameters* is a table of key/value pairs. The following keys are required: - * `key_type`: An FFI type for keys in this table. - * `value_type`: An FFI type for values in this table. (In the future, - `value_type` will be optional; a nil `value_type` will create a - set). + * `key_type`: An FFI type (LuaJIT "ctype") for keys in this table. + * `value_type`: An FFI type (LuaJT "ctype") for values in this table. * `hash_fn`: A function that takes a key and returns a hash value. Hash values are unsigned 32-bit integers in the range `[0, @@ -71,7 +71,7 @@ Hash values are unsigned 32-bit integers in the range `[0, integer that is not a valid hash value. The `hash_fn` must return a hash value in the correct range. -Optional entries that may be present in the *params* table include: +Optional entries that may be present in the *parameters* table include: * `initial_size`: The initial size of the hash table, including free space. Defaults to 8 slots. @@ -93,7 +93,7 @@ should be a ctable. Resize the ctable to have *size* total entries, including empty space. -— Method **:insert** *hash* *key* *value* *updates_allowed* +— Method **:insert** *hash*, *key*, *value*, *updates_allowed* An internal helper method that does the bulk of updates to hash table. *hash* is the hash of *key*. This method takes the hash as an explicit @@ -104,18 +104,18 @@ values for the key and the value, of course. *updates_allowed* is an optional parameter. If not present or false, then the `:insert` method will raise an error if the *key* is already present in the table. If *updates_allowed* is the string `"required"`, -then an error will be raised if *key* is /not/ already in the table. +then an error will be raised if *key* is *not* already in the table. Any other true value allows updates but does not require them. An update will replace the existing entry in the table. Returns the index of the inserted entry. -— Method **:add** *key* *value* *updates_allowed* +— Method **:add** *key*, *value*, *updates_allowed* Add an entry to the ctable, returning the index of the added entry. See the documentation for `:insert` for a description of the parameters. -— Method **:update** *key* *value* +— Method **:update** *key*, *value* Update the entry in a ctable with the key *key* to have the new value *value*. Throw an error if *key* is not present in the table. @@ -126,7 +126,7 @@ Look up *key* in the table, and if found return a pointer to the entry. Return nil if the value is not found. An entry pointer has three fields: the `hash` value, which must not be -modified; the `key' itself; and the `value`. Access them as usual in +modified; the `key` itself; and the `value`. Access them as usual in Lua: ```lua @@ -137,7 +137,7 @@ if ptr then print(ptr.value) end Note that pointers are only valid until the next modification of a table. -— Method **:lookup_and_copy** *key* *entry* +— Method **:lookup_and_copy** *key*, *entry* Look up *key* in the table, and if found, copy that entry into *entry* and return true. Otherwise return false. @@ -148,7 +148,7 @@ Remove an entry from a ctable. *entry* should be a pointer that points into the table. Note that pointers are only valid until the next modification of a table. -— Method **:remove** *key* *missing_allowed* +— Method **:remove** *key*, *missing_allowed* Remove an entry from a ctable, keyed by *key*. @@ -178,21 +178,25 @@ end #### Hash functions -Any hash function will do, as long as it produces values in the right -range. In practice we include some functions for hashing byte sequences -of some common small lengths. +Any hash function will do, as long as it produces values in the `[0, +0xFFFFFFFF)` range. In practice we include some functions for hashing +byte sequences of some common small lengths. — Function **ctable.hash_32** *number* + Hash a 32-bit integer. As a `hash_fn` parameter, this will only work if your key type's Lua representation is a Lua number. For example, use `hash_32` on `ffi.typeof('uint32_t')`, but use `hashv_32` on `ffi.typeof('uint8_t[4]')`. — Function **ctable.hashv_32** *ptr* + Hash the first 32 bits of a byte sequence. — Function **ctable.hashv_48** *ptr* + Hash the first 48 bits of a byte sequence. — Function **ctable.hashv_64** *ptr* + Hash the first 64 bits of a byte sequence. From 8f535bebca29bcf7c6c36ca717e49fff8f270a45 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Thu, 4 Feb 2016 14:17:43 +0100 Subject: [PATCH 16/28] Map `snabb-lwaftr' argv[0] to programs.lwaftr Rework the parsing of the Snabb command line to allow us to ship a nicely named snabb-lwaftr binary, but have it map internally to the also nicely-named 'programs.lwaftr' module tree. Gets rid of the nasty "snabb" name duplication in the module tree. --- src/core/main.lua | 56 ++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 30 deletions(-) diff --git a/src/core/main.lua b/src/core/main.lua index 12d80686ab..7a858c9286 100644 --- a/src/core/main.lua +++ b/src/core/main.lua @@ -33,39 +33,34 @@ function main () zone("startup") require "lib.lua.strict" initialize() - local args = parse_command_line() - local program = programname(args[1]) - if program == 'snabb' then - -- Print usage with exit status 0 if help requested - if args[2] == '-h' or args[2] == '--help' then - usage(0) - end - -- Print usage with exit status 1 if no arguments supplied - if #args == 1 then - usage(1) - end - -- Strip 'snabb' and use next argument as program name - table.remove(args, 1) - end - program = select_program(program, args) + local program, args = select_program(parse_command_line()) if not lib.have_module(modulename(program)) then print("unsupported program: "..program:gsub("_", "-")) - print() - print("Rename this executable (cp, mv, ln) to choose a supported program:") - print(" snabb "..(require("programs_inc"):gsub("\n", " "))) - os.exit(1) + usage(1) else require(modulename(program)).run(args) end end --- If program stars with prefix 'snabb_' removes the prefix --- If not, use the next argument as program name -function select_program (program, args) - if program:match("^snabb_") then - return program:gsub("^snabb_", "") +-- Take the program name from the first argument, unless the first +-- argument is "snabb", in which case pop it off, handle any options +-- passed to snabb itself, and use the next argument. +function select_program (args) + local program = programname(table.remove(args, 1)) + if program == 'snabb' then + while #args > 0 and args[1]:match('^-') do + local opt = table.remove(args, 1) + if opt == '-h' or opt == '--help' then + usage(0) + else + print("unrecognized option: "..opt) + usage(1) + end + end + if #args == 0 then usage(1) end + program = programname(table.remove(args, 1)) end - return programname(table.remove(args, 1)):gsub("^snabb_", "") + return program, args end function usage (status) @@ -86,6 +81,7 @@ function programname (name) return name:gsub("^.*/", "") :gsub("-[0-9.]+[-%w]+$", "") :gsub("-", "_") + :gsub("^snabb_", "") end function modulename (program) @@ -134,21 +130,21 @@ function selftest () "Incorrect program name parsing") assert(programname("/bin/snabb-1.0-alpha2") == "snabb", "Incorrect program name parsing") - assert(programname("/bin/snabb-nfv") == "snabb_nfv", + assert(programname("/bin/snabb-nfv") == "nfv", "Incorrect program name parsing") - assert(programname("/bin/snabb-nfv-1.0") == "snabb_nfv", + assert(programname("/bin/nfv-1.0") == "nfv", "Incorrect program name parsing") assert(modulename("nfv-sync-master-2.0") == "program.nfv_sync_master.nfv_sync_master", "Incorrect module name parsing") local pn = programname -- snabb foo => foo - assert(select_program(pn'snabb', { pn'foo' }) == "foo", + assert(select_program({ 'foo' }) == "foo", "Incorrect program name selected") -- snabb-foo => foo - assert(select_program(pn'snabb-foo', { }) == "foo", + assert(select_program({ 'snabb-foo' }) == "foo", "Incorrect program name selected") -- snabb snabb-foo => foo - assert(select_program(pn'snabb', { pn'snabb-foo' }) == "foo", + assert(select_program({ 'snabb', 'snabb-foo' }) == "foo", "Incorrect program name selected") end From 9afeb74c9207d947d7361e23ffd698b1e00ad370 Mon Sep 17 00:00:00 2001 From: Luke Gorrie Date: Thu, 4 Feb 2016 15:47:02 +0000 Subject: [PATCH 17/28] Rename all README.md.src files to README.src.md This is intended to make Github match the ".md" suffix and treat the files as markdown format. This should enable better support in the web interface e.g. showing diffs with the rendered markdown. Link to relevant Github feature: https://help.github.com/articles/rendering-differences-in-prose-documents/ --- src/Makefile | 6 +++--- src/{README.md.src => README.src.md} | 0 src/apps/basic/{README.md.src => README.src.md} | 0 .../bridge/{README.md.src => README.src.md} | 0 src/apps/intel/{README.md.src => README.src.md} | 0 src/apps/ipv6/{README.md.src => README.src.md} | 0 .../{README.md.src => README.src.md} | 0 src/apps/pcap/{README.md.src => README.src.md} | 0 .../{README.md.src => README.src.md} | 0 .../socket/{README.md.src => README.src.md} | 0 .../solarflare/{README.md.src => README.src.md} | 0 src/apps/test/synth.pcap.output | Bin 0 -> 23144 bytes src/apps/vhost/{README.md.src => README.src.md} | 0 .../virtio_net/{README.md.src => README.src.md} | 0 src/apps/vpn/{README.md.src => README.src.md} | 0 .../hardware/{README.md.src => README.src.md} | 0 .../protocol/{README.md.src => README.src.md} | 0 src/lib/virtio/{README.md.src => README.src.md} | 0 .../snabbnfv/{README.md.src => README.src.md} | 0 19 files changed, 3 insertions(+), 3 deletions(-) rename src/{README.md.src => README.src.md} (100%) rename src/apps/basic/{README.md.src => README.src.md} (100%) rename src/apps/bridge/{README.md.src => README.src.md} (100%) rename src/apps/intel/{README.md.src => README.src.md} (100%) rename src/apps/ipv6/{README.md.src => README.src.md} (100%) rename src/apps/packet_filter/{README.md.src => README.src.md} (100%) rename src/apps/pcap/{README.md.src => README.src.md} (100%) rename src/apps/rate_limiter/{README.md.src => README.src.md} (100%) rename src/apps/socket/{README.md.src => README.src.md} (100%) rename src/apps/solarflare/{README.md.src => README.src.md} (100%) create mode 100644 src/apps/test/synth.pcap.output rename src/apps/vhost/{README.md.src => README.src.md} (100%) rename src/apps/virtio_net/{README.md.src => README.src.md} (100%) rename src/apps/vpn/{README.md.src => README.src.md} (100%) rename src/lib/hardware/{README.md.src => README.src.md} (100%) rename src/lib/protocol/{README.md.src => README.src.md} (100%) rename src/lib/virtio/{README.md.src => README.src.md} (100%) rename src/program/snabbnfv/{README.md.src => README.src.md} (100%) diff --git a/src/Makefile b/src/Makefile index 938ab86543..9fb0370e6d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -16,7 +16,7 @@ CSRC = $(shell find . -regex '[^\#]*\.c' -not -regex './arch/.*' -printf '%P ' CHDR = $(shell find . -regex '[^\#]*\.h' -printf '%P ') ASM = $(shell find . -regex '[^\#]*\.dasl' -printf '%P ') ARCHSRC= $(shell find . -regex '^./arch/[^\#]*\.c' -printf '%P ') -RMSRC = $(shell find . -name README.md.src -printf '%P ') +RMSRC = $(shell find . -name README.src.md -printf '%P ') # regexp is to include program/foo but not program/foo/bar PROGRAM = $(shell find program -regex '^[^/]+/[^/]+' -type d -printf '%P ') # sort to eliminate potential duplicate of programs.inc @@ -30,7 +30,7 @@ ARCHOBJ:= $(patsubst %.c,obj/%_c.o, $(ARCHSRC)) ASMOBJ := $(patsubst %.dasl,obj/%_dasl.o, $(ASM)) JITOBJS:= $(patsubst %,obj/jit_%.o,$(JITSRC)) EXTRAOBJS := obj/jit_tprof.o obj/jit_vmprof.o obj/strict.o -RMOBJS := $(patsubst %.src,%,$(RMSRC)) +RMOBJS := $(patsubst %.src.md,%.md,$(RMSRC)) INCOBJ := $(patsubst %.inc,obj/%_inc.o, $(INCSRC)) EXE := bin/snabb $(patsubst %,bin/%,$(PROGRAM)) @@ -152,7 +152,7 @@ $(JITOBJS): obj/jit_%.o: ../lib/luajit/src/jit/%.lua $(OBJDIR) $(Q) luajit -bg -n $(patsubst obj/jit_%.o, jit.%, $@) $< $@ -$(RMOBJS): %: %.src +$(RMOBJS): %.md: %.src.md $(E) "MARKDOWN $@" $(Q) scripts/process-markdown $< > $@ diff --git a/src/README.md.src b/src/README.src.md similarity index 100% rename from src/README.md.src rename to src/README.src.md diff --git a/src/apps/basic/README.md.src b/src/apps/basic/README.src.md similarity index 100% rename from src/apps/basic/README.md.src rename to src/apps/basic/README.src.md diff --git a/src/apps/bridge/README.md.src b/src/apps/bridge/README.src.md similarity index 100% rename from src/apps/bridge/README.md.src rename to src/apps/bridge/README.src.md diff --git a/src/apps/intel/README.md.src b/src/apps/intel/README.src.md similarity index 100% rename from src/apps/intel/README.md.src rename to src/apps/intel/README.src.md diff --git a/src/apps/ipv6/README.md.src b/src/apps/ipv6/README.src.md similarity index 100% rename from src/apps/ipv6/README.md.src rename to src/apps/ipv6/README.src.md diff --git a/src/apps/packet_filter/README.md.src b/src/apps/packet_filter/README.src.md similarity index 100% rename from src/apps/packet_filter/README.md.src rename to src/apps/packet_filter/README.src.md diff --git a/src/apps/pcap/README.md.src b/src/apps/pcap/README.src.md similarity index 100% rename from src/apps/pcap/README.md.src rename to src/apps/pcap/README.src.md diff --git a/src/apps/rate_limiter/README.md.src b/src/apps/rate_limiter/README.src.md similarity index 100% rename from src/apps/rate_limiter/README.md.src rename to src/apps/rate_limiter/README.src.md diff --git a/src/apps/socket/README.md.src b/src/apps/socket/README.src.md similarity index 100% rename from src/apps/socket/README.md.src rename to src/apps/socket/README.src.md diff --git a/src/apps/solarflare/README.md.src b/src/apps/solarflare/README.src.md similarity index 100% rename from src/apps/solarflare/README.md.src rename to src/apps/solarflare/README.src.md diff --git a/src/apps/test/synth.pcap.output b/src/apps/test/synth.pcap.output new file mode 100644 index 0000000000000000000000000000000000000000..4dd3dad5edaa500f99d25c0f64400b5c682b9a41 GIT binary patch literal 23144 zcmb`Bi>X*w3Y8CHSAA4HrP!AAp2n5bM_n^a<*JXWrxe?g z-qW~}`lxG$sa*9@^^{^;(t8?LQXh5AFqNx5s-9A8OL|Y^O6sGo8K!d8N7Yk`ZAtHG zTuFV@HN#Y{`lxzJu`TI6jVq~-x@MTlRUcJPDYhlOr*S3qQP&Jpx$2|pDaE#=_cX4g zKI)obDp!3}J*C)|^q$6*)JI)2Oy#PNs;3m&lHSv}lKQA?hN)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*C)|^q$6*)JI)2Oy#PNs;3m& zlHSv}lKQA?hN)cjQT3E!TheM6yxr1vzg zq(17JVJcUBR6V8Gmh_&+mDERFGfd^GkE*8>+mhbXxRUy)Ylf*@^-=YdVq4OC8dp*u eb Date: Tue, 9 Feb 2016 21:46:22 +0200 Subject: [PATCH 18/28] Pass only interface name to syscall.util.if_nametoindex() The syscall.util.if_nametoindex() only needs to be passed the name of the interface. The version of the function which accepts an open socket as second argument is internal to ljsyscall, and not even exported to client code. Also, this moves the call to syscall.util.if_nametoindex() to the top of RawSocket:new() to simplify error handling: this way one less explicit call to syscall.close() is needed in case of errors. --- src/apps/socket/raw.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/apps/socket/raw.lua b/src/apps/socket/raw.lua index 0f280f668d..27b3aa39b7 100644 --- a/src/apps/socket/raw.lua +++ b/src/apps/socket/raw.lua @@ -14,14 +14,13 @@ RawSocket = {} function RawSocket:new (ifname) assert(ifname) + local index, err = S.util.if_nametoindex(ifname) + if not index then error(err) end + local tp = h.htons(c.ETH_P["ALL"]) local sock, err = S.socket(c.AF.PACKET, bit.bor(c.SOCK.RAW, c.SOCK.NONBLOCK), tp) if not sock then error(err) end - local index, err = S.util.if_nametoindex(ifname, sock) - if err then - S.close(sock) - error(err) - end + local addr = t.sockaddr_ll{sll_family = c.AF.PACKET, sll_ifindex = index, sll_protocol = tp} local ok, err = S.bind(sock, addr) if not ok then From 70f207f65e04d1acfa9c279e9fa05385f627ba4a Mon Sep 17 00:00:00 2001 From: Luke Gorrie Date: Fri, 19 Feb 2016 10:06:40 +0100 Subject: [PATCH 19/28] Clearly mark all Apache 2.0 licensed code as such This change adds one-line explicit license references for source files that are Apache 2.0 licensed i.e. the vast majority of code in Snabb Switch. This change attempts to preserve all existing license and copyright messages, with the exception of avoiding redundantly referencing Apache 2.0 license more than once in the same file. The motivation for this change is twofold: - To make the source code license more obvious to users and contributors. - To put into practice the agreement made in issue #729. The change was initially made automatically with a 'sed' script and then I reviewed each file individually. Notes: - avx2.c and sse2.c state that they are derived from MIT-licensed code. - dynasm lua-mode is already clearly marked as public domain. - checksum.c states that it is derived from BSD licensed code. - utilities imported into the project are left as-is e.g. StackTracePlus.lua. --- src/apps/basic/basic_apps.lua | 2 ++ src/apps/bridge/base.lua | 2 ++ src/apps/bridge/flooding.lua | 2 ++ src/apps/bridge/learning.h | 2 ++ src/apps/bridge/learning.lua | 2 ++ src/apps/bridge/mac_table.c | 2 ++ src/apps/bridge/mac_table.lua | 1 + src/apps/csv.lua | 2 ++ src/apps/intel/intel.h | 2 ++ src/apps/intel/intel10g.lua | 2 ++ src/apps/intel/intel1g.lua | 2 ++ src/apps/intel/intel_app.lua | 2 ++ src/apps/intel/loadgen.lua | 2 ++ src/apps/ipv6/nd_light.lua | 2 ++ src/apps/ipv6/ns_responder.lua | 2 ++ src/apps/keyed_ipv6_tunnel/tunnel.lua | 2 ++ src/apps/packet_filter/conntrack.lua | 2 ++ src/apps/packet_filter/pcap_filter.lua | 2 ++ src/apps/pcap/pcap.lua | 2 ++ src/apps/rate_limiter/rate_limiter.lua | 2 ++ src/apps/socket/raw.lua | 2 ++ src/apps/solarflare/ef_vi.h | 2 ++ src/apps/solarflare/poll.c | 2 ++ src/apps/solarflare/solarflare.lua | 2 ++ src/apps/tap/tap.lua | 2 ++ src/apps/test/synth.lua | 2 ++ src/apps/vhost/vhost.h | 2 ++ src/apps/vhost/vhost_user.c | 2 ++ src/apps/vhost/vhost_user.h | 2 ++ src/apps/vhost/vhost_user.lua | 2 ++ src/apps/virtio_net/virtio_net.lua | 2 ++ src/apps/vpn/vpws.lua | 2 ++ src/arch/avx2.c | 8 ++++---- src/arch/sse2.c | 8 ++++---- src/core/app.lua | 2 ++ src/core/clib.h | 2 ++ src/core/config.lua | 2 ++ src/core/counter.h | 2 ++ src/core/counter.lua | 2 ++ src/core/freelist.lua | 2 ++ src/core/lib.c | 2 ++ src/core/lib.h | 2 ++ src/core/lib.lua | 2 ++ src/core/link.h | 2 ++ src/core/link.lua | 2 ++ src/core/main.lua | 2 ++ src/core/memory.c | 2 ++ src/core/memory.h | 2 ++ src/core/memory.lua | 2 ++ src/core/packet.h | 2 ++ src/core/packet.lua | 2 ++ src/core/selftest.lua | 2 ++ src/core/shm.lua | 2 ++ src/core/snabbswitch.c | 2 ++ src/core/startup.lua | 2 ++ src/core/timer.lua | 2 ++ src/lib/bloom_filter.lua | 2 ++ src/lib/checksum.c | 10 +++++----- src/lib/checksum.h | 2 ++ src/lib/checksum.lua | 2 ++ src/lib/checksum_lib.h | 2 ++ src/lib/hardware/pci.c | 2 ++ src/lib/hardware/pci.h | 2 ++ src/lib/hardware/pci.lua | 2 ++ src/lib/hardware/register.lua | 2 ++ src/lib/hash/base.lua | 2 ++ src/lib/hash/murmur.lua | 2 ++ src/lib/index_set.lua | 2 ++ src/lib/ipc/shmem/mib.lua | 2 ++ src/lib/ipc/shmem/shmem.c | 2 ++ src/lib/ipc/shmem/shmem.h | 2 ++ src/lib/ipc/shmem/shmem.lua | 2 ++ src/lib/lua/class.lua | 2 ++ src/lib/pcap/filter.h | 2 ++ src/lib/pcap/filter.lua | 2 ++ src/lib/pcap/pcap.lua | 2 ++ src/lib/pmu.lua | 2 ++ src/lib/pmu_cpu.lua | 2 ++ src/lib/protocol/datagram.lua | 2 ++ src/lib/protocol/ethernet.lua | 2 ++ src/lib/protocol/gre.lua | 2 ++ src/lib/protocol/header.lua | 2 ++ src/lib/protocol/icmp/header.lua | 2 ++ src/lib/protocol/icmp/nd/header.lua | 2 ++ src/lib/protocol/icmp/nd/na.lua | 2 ++ src/lib/protocol/icmp/nd/ns.lua | 2 ++ src/lib/protocol/icmp/nd/options/lladdr.lua | 2 ++ src/lib/protocol/icmp/nd/options/tlv.lua | 2 ++ src/lib/protocol/ipv4.lua | 2 ++ src/lib/protocol/ipv6.lua | 2 ++ src/lib/protocol/keyed_ipv6_tunnel.lua | 2 ++ src/lib/protocol/tcp.lua | 2 ++ src/lib/protocol/udp.lua | 2 ++ src/lib/traceprof/traceprof.c | 2 ++ src/lib/traceprof/traceprof.h | 2 ++ src/lib/traceprof/traceprof.lua | 2 ++ src/lib/virtio/net_device.lua | 2 ++ src/lib/virtio/net_driver.lua | 2 ++ src/lib/virtio/virtio.h | 7 +++---- src/lib/virtio/virtio_pci.lua | 5 ++--- src/lib/virtio/virtio_vring.h | 2 ++ src/lib/virtio/virtq_device.lua | 2 ++ src/lib/virtio/virtq_driver.lua | 5 ++--- src/lib/watchdog/watchdog.lua | 2 ++ src/program/example_replay/example_replay.lua | 2 ++ src/program/example_spray/example_spray.lua | 2 ++ src/program/example_spray/sprayer.lua | 2 ++ src/program/firehose/firehose.h | 2 ++ src/program/firehose/firehose.lua | 2 ++ src/program/gc/gc.lua | 2 ++ src/program/packetblaster/packetblaster.lua | 2 ++ src/program/snabbmark/snabbmark.lua | 2 ++ src/program/snabbnfv/fuzz/fuzz.lua | 2 ++ src/program/snabbnfv/neutron2snabb/neutron2snabb.lua | 2 ++ .../snabbnfv/neutron2snabb/neutron2snabb_schema.lua | 2 ++ .../snabbnfv/neutron_sync_agent/neutron_sync_agent.lua | 2 ++ .../neutron_sync_master/neutron_sync_master.lua | 2 ++ src/program/snabbnfv/nfvconfig.lua | 2 ++ src/program/snabbnfv/snabbnfv.lua | 2 ++ src/program/snabbnfv/traffic/traffic.lua | 2 ++ src/program/snsh/snsh.lua | 2 ++ src/program/top/top.lua | 2 ++ 122 files changed, 251 insertions(+), 23 deletions(-) diff --git a/src/apps/basic/basic_apps.lua b/src/apps/basic/basic_apps.lua index 65ec85c695..ca2cb35093 100644 --- a/src/apps/basic/basic_apps.lua +++ b/src/apps/basic/basic_apps.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(...,package.seeall) local app = require("core.app") diff --git a/src/apps/bridge/base.lua b/src/apps/bridge/base.lua index 6cd97d141e..be320c8a2d 100644 --- a/src/apps/bridge/base.lua +++ b/src/apps/bridge/base.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + -- Base class for an Ethernet bridge with split-horizon semantics. -- -- A bridge conists of any number of ports, each of which is a member diff --git a/src/apps/bridge/flooding.lua b/src/apps/bridge/flooding.lua index bc06fe181c..6bac5f9196 100644 --- a/src/apps/bridge/flooding.lua +++ b/src/apps/bridge/flooding.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + -- This class derives from lib.bridge.base and implements the simplest -- possible bridge, which floods a packet arriving on a port to all -- destination ports within its scope according to the split-horizon diff --git a/src/apps/bridge/learning.h b/src/apps/bridge/learning.h index 025bc8c1fd..bac449a342 100644 --- a/src/apps/bridge/learning.h +++ b/src/apps/bridge/learning.h @@ -1,3 +1,5 @@ +/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */ + /* Type for port and split-horizon group handles */ typedef uint16_t handle_t; diff --git a/src/apps/bridge/learning.lua b/src/apps/bridge/learning.lua index 33b6efeb2b..a372b78137 100644 --- a/src/apps/bridge/learning.lua +++ b/src/apps/bridge/learning.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + -- This class derives from lib.bridge.base and implements a "learning -- bridge" using a MAC address table provided by apps.bridge.mac_table -- to store the set of source addresses of packets arriving on all diff --git a/src/apps/bridge/mac_table.c b/src/apps/bridge/mac_table.c index c7b460f4b7..e60801cdcf 100644 --- a/src/apps/bridge/mac_table.c +++ b/src/apps/bridge/mac_table.c @@ -1,3 +1,5 @@ +/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */ + #include #include "learning.h" diff --git a/src/apps/bridge/mac_table.lua b/src/apps/bridge/mac_table.lua index 514d59e6bc..247f7f27cb 100644 --- a/src/apps/bridge/mac_table.lua +++ b/src/apps/bridge/mac_table.lua @@ -1,3 +1,4 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. -- -- This module implements a MAC address table as part of the learning -- bridge app (apps.bridge.learning). It associates a MAC address diff --git a/src/apps/csv.lua b/src/apps/csv.lua index a5dd799cd7..4ec534311a 100644 --- a/src/apps/csv.lua +++ b/src/apps/csv.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(...,package.seeall) local app = require("core.app") diff --git a/src/apps/intel/intel.h b/src/apps/intel/intel.h index 8d44cebaf4..35c251acf3 100644 --- a/src/apps/intel/intel.h +++ b/src/apps/intel/intel.h @@ -1,3 +1,5 @@ +/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */ + // RX descriptor written by software. struct rx_desc { uint64_t address; // 64-bit address of receive buffer diff --git a/src/apps/intel/intel10g.lua b/src/apps/intel/intel10g.lua index bf6502281f..05852ed441 100644 --- a/src/apps/intel/intel10g.lua +++ b/src/apps/intel/intel10g.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + --- Device driver for the Intel 82599 10-Gigabit Ethernet controller. --- This is one of the most popular production 10G Ethernet --- controllers on the market and it is readily available in diff --git a/src/apps/intel/intel1g.lua b/src/apps/intel/intel1g.lua index 5fbadd202b..758bda8ab8 100644 --- a/src/apps/intel/intel1g.lua +++ b/src/apps/intel/intel1g.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + -- intel1g: Device driver app for Intel 1G network cards -- -- This is a device driver for Intel i210, i350 families of 1G network cards. diff --git a/src/apps/intel/intel_app.lua b/src/apps/intel/intel_app.lua index a82e71faa2..3af2ad5b9a 100644 --- a/src/apps/intel/intel_app.lua +++ b/src/apps/intel/intel_app.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(...,package.seeall) local zone = require("jit.zone") diff --git a/src/apps/intel/loadgen.lua b/src/apps/intel/loadgen.lua index 969cafc352..c7c4f494d0 100644 --- a/src/apps/intel/loadgen.lua +++ b/src/apps/intel/loadgen.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(...,package.seeall) local ffi = require("ffi") diff --git a/src/apps/ipv6/nd_light.lua b/src/apps/ipv6/nd_light.lua index 153bd206b4..ce557e62a7 100644 --- a/src/apps/ipv6/nd_light.lua +++ b/src/apps/ipv6/nd_light.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + -- This app implements a small subset of IPv6 neighbor discovery -- (RFC4861). It has two ports, north and south. The south port -- attaches to a port on which ND must be performed. The north port diff --git a/src/apps/ipv6/ns_responder.lua b/src/apps/ipv6/ns_responder.lua index 584def687e..a23a5151d6 100644 --- a/src/apps/ipv6/ns_responder.lua +++ b/src/apps/ipv6/ns_responder.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + -- This app acts as a responder for neighbor solicitaions for a -- specific target address and as a relay for all other packets. It -- has two ports, north and south. The south port attaches to a port diff --git a/src/apps/keyed_ipv6_tunnel/tunnel.lua b/src/apps/keyed_ipv6_tunnel/tunnel.lua index 9bf92eafa5..afd2aa0612 100644 --- a/src/apps/keyed_ipv6_tunnel/tunnel.lua +++ b/src/apps/keyed_ipv6_tunnel/tunnel.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(...,package.seeall) -- http://tools.ietf.org/html/draft-mkonstan-keyed-ipv6-tunnel-01 diff --git a/src/apps/packet_filter/conntrack.lua b/src/apps/packet_filter/conntrack.lua index bd8085283c..387983887c 100644 --- a/src/apps/packet_filter/conntrack.lua +++ b/src/apps/packet_filter/conntrack.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + -- conntrack.lua -- Connection tracking for IPv4/IPv6 TCP/UDP sessions -- -- This module exposes the following API: diff --git a/src/apps/packet_filter/pcap_filter.lua b/src/apps/packet_filter/pcap_filter.lua index 3e52d35ca9..6ee4eabb52 100644 --- a/src/apps/packet_filter/pcap_filter.lua +++ b/src/apps/packet_filter/pcap_filter.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(...,package.seeall) local app = require("core.app") diff --git a/src/apps/pcap/pcap.lua b/src/apps/pcap/pcap.lua index 579bdeb260..e78ba01d2e 100644 --- a/src/apps/pcap/pcap.lua +++ b/src/apps/pcap/pcap.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(...,package.seeall) local ffi = require("ffi") diff --git a/src/apps/rate_limiter/rate_limiter.lua b/src/apps/rate_limiter/rate_limiter.lua index 71ed045879..98c1cd9347 100644 --- a/src/apps/rate_limiter/rate_limiter.lua +++ b/src/apps/rate_limiter/rate_limiter.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(..., package.seeall) local app = require("core.app") diff --git a/src/apps/socket/raw.lua b/src/apps/socket/raw.lua index 0f280f668d..a938b7d35f 100644 --- a/src/apps/socket/raw.lua +++ b/src/apps/socket/raw.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(..., package.seeall) local S = require("syscall") diff --git a/src/apps/solarflare/ef_vi.h b/src/apps/solarflare/ef_vi.h index 55faaaf663..dd8f707bfe 100644 --- a/src/apps/solarflare/ef_vi.h +++ b/src/apps/solarflare/ef_vi.h @@ -1,3 +1,5 @@ +/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */ + #include /* etherfabric/base.h */ diff --git a/src/apps/solarflare/poll.c b/src/apps/solarflare/poll.c index 3b4931ca61..be8fc308aa 100644 --- a/src/apps/solarflare/poll.c +++ b/src/apps/solarflare/poll.c @@ -1,3 +1,5 @@ +/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */ + /* poll.c - Poll multiple ef_vi interfaces in one FFI call to save on FFI overhead */ #include diff --git a/src/apps/solarflare/solarflare.lua b/src/apps/solarflare/solarflare.lua index 3e9160089f..e1e54a56c2 100644 --- a/src/apps/solarflare/solarflare.lua +++ b/src/apps/solarflare/solarflare.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(...,package.seeall) local lib = require("core.lib") diff --git a/src/apps/tap/tap.lua b/src/apps/tap/tap.lua index 87b4291e5a..98c561a25d 100644 --- a/src/apps/tap/tap.lua +++ b/src/apps/tap/tap.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(..., package.seeall) local S = require("syscall") diff --git a/src/apps/test/synth.lua b/src/apps/test/synth.lua index 36fe231902..9da8590dd2 100644 --- a/src/apps/test/synth.lua +++ b/src/apps/test/synth.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(...,package.seeall) local ffi = require("ffi") diff --git a/src/apps/vhost/vhost.h b/src/apps/vhost/vhost.h index fb37178fdf..66f5ab5a24 100644 --- a/src/apps/vhost/vhost.h +++ b/src/apps/vhost/vhost.h @@ -1,3 +1,5 @@ +/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */ + // vhost_memory structure is used to declare which memory address // ranges we want to use for DMA. The kernel uses this to create a // shared memory mapping. diff --git a/src/apps/vhost/vhost_user.c b/src/apps/vhost/vhost_user.c index f9fbe44fc0..77752f93a5 100644 --- a/src/apps/vhost/vhost_user.c +++ b/src/apps/vhost/vhost_user.c @@ -1,3 +1,5 @@ +/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */ + #include #include #include diff --git a/src/apps/vhost/vhost_user.h b/src/apps/vhost/vhost_user.h index 08e9d7c86d..899dc85e15 100644 --- a/src/apps/vhost/vhost_user.h +++ b/src/apps/vhost/vhost_user.h @@ -1,3 +1,5 @@ +/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */ + enum { VHOST_USER_MEMORY_MAX_NREGIONS = 8 }; diff --git a/src/apps/vhost/vhost_user.lua b/src/apps/vhost/vhost_user.lua index c265be616a..7890b495f5 100644 --- a/src/apps/vhost/vhost_user.lua +++ b/src/apps/vhost/vhost_user.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + -- -- See http://www.virtualopensystems.com/en/solutions/guides/snabbswitch-qemu/ diff --git a/src/apps/virtio_net/virtio_net.lua b/src/apps/virtio_net/virtio_net.lua index 94034f0e7c..a347f78d6d 100644 --- a/src/apps/virtio_net/virtio_net.lua +++ b/src/apps/virtio_net/virtio_net.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + -- Application to connect to a virtio-net driver implementation -- -- Licensed under the Apache 2.0 license diff --git a/src/apps/vpn/vpws.lua b/src/apps/vpn/vpws.lua index a703b0add9..f7c5369526 100644 --- a/src/apps/vpn/vpws.lua +++ b/src/apps/vpn/vpws.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + -- Virtual Private Wire Service (VPWS) -- Provides a L2 VPN on top of IP (v4/v6) and GRE -- diff --git a/src/arch/avx2.c b/src/arch/avx2.c index 69197bc1ed..fce7e78a0e 100644 --- a/src/arch/avx2.c +++ b/src/arch/avx2.c @@ -1,8 +1,8 @@ -/* IP checksum routine for AVX2. - * +/* Use of this source code is governed by the Apache 2.0 license; see COPYING. * Based on original SSE2 code by Tony Rogvall that is - * copyright 2011 Teclo Networks AG. MIT licensed by Juho Snellman. - */ + * copyright 2011 Teclo Networks AG. MIT licensed by Juho Snellman. */ + +/* IP checksum routine for AVX2. */ #include #include diff --git a/src/arch/sse2.c b/src/arch/sse2.c index 2198ed99ce..f98878e871 100644 --- a/src/arch/sse2.c +++ b/src/arch/sse2.c @@ -1,8 +1,8 @@ -/* IP checksum routine for AVX2. - * +/* Use of this source code is governed by the Apache 2.0 license; see COPYING. * Original code by Tony Rogvall that is - * copyright 2011 Teclo Networks AG. MIT licensed by Juho Snellman. - */ + * copyright 2011 Teclo Networks AG. MIT licensed by Juho Snellman. */ + +/* IP checksum routine for SSE2. */ #include #include diff --git a/src/core/app.lua b/src/core/app.lua index 35a5305631..77e225e572 100644 --- a/src/core/app.lua +++ b/src/core/app.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(...,package.seeall) local packet = require("core.packet") diff --git a/src/core/clib.h b/src/core/clib.h index 68f29b1e20..33906c3b49 100644 --- a/src/core/clib.h +++ b/src/core/clib.h @@ -1,3 +1,5 @@ +/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */ + // sleep(3) - suspend execution for second intervals unsigned int sleep(unsigned int seconds); diff --git a/src/core/config.lua b/src/core/config.lua index aabb858b6e..a5455c7247 100644 --- a/src/core/config.lua +++ b/src/core/config.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + -- 'config' is a data structure that describes an app network. module(..., package.seeall) diff --git a/src/core/counter.h b/src/core/counter.h index 8209e1ac82..281118cec1 100644 --- a/src/core/counter.h +++ b/src/core/counter.h @@ -1 +1,3 @@ +/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */ + struct counter { uint64_t c; }; diff --git a/src/core/counter.lua b/src/core/counter.lua index e0d495c239..64d5b75b3d 100644 --- a/src/core/counter.lua +++ b/src/core/counter.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + -- counter.lua - Count discrete events for diagnostic purposes -- -- This module provides a thin layer for representing 64-bit counters diff --git a/src/core/freelist.lua b/src/core/freelist.lua index 5ba18ced8b..34d7f51f90 100644 --- a/src/core/freelist.lua +++ b/src/core/freelist.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(...,package.seeall) local ffi = require("ffi") diff --git a/src/core/lib.c b/src/core/lib.c index e1703f71ee..145b17c6d6 100644 --- a/src/core/lib.c +++ b/src/core/lib.c @@ -1,3 +1,5 @@ +/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */ + #include #include #include diff --git a/src/core/lib.h b/src/core/lib.h index 013bdcfecc..37a4a04749 100644 --- a/src/core/lib.h +++ b/src/core/lib.h @@ -1,3 +1,5 @@ +/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */ + uint64_t get_time_ns(); double get_monotonic_time(); double get_unix_time(); diff --git a/src/core/lib.lua b/src/core/lib.lua index bb95afe3e0..224caa2811 100644 --- a/src/core/lib.lua +++ b/src/core/lib.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(...,package.seeall) local ffi = require("ffi") diff --git a/src/core/link.h b/src/core/link.h index b6f7549f9f..c4ca2b45a5 100644 --- a/src/core/link.h +++ b/src/core/link.h @@ -1,3 +1,5 @@ +/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */ + enum { LINK_RING_SIZE = 256, LINK_MAX_PACKETS = LINK_RING_SIZE - 1 }; diff --git a/src/core/link.lua b/src/core/link.lua index a9237ac719..8337626a9e 100644 --- a/src/core/link.lua +++ b/src/core/link.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(...,package.seeall) local debug = _G.developer_debug diff --git a/src/core/main.lua b/src/core/main.lua index 12d80686ab..2b81a575ea 100644 --- a/src/core/main.lua +++ b/src/core/main.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(...,package.seeall) -- Default to not using any Lua code on the filesystem. diff --git a/src/core/memory.c b/src/core/memory.c index e6d95350ba..0a8a48c73c 100644 --- a/src/core/memory.c +++ b/src/core/memory.c @@ -1,3 +1,5 @@ +/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */ + // memory.c -- allocate dma-friendly memory // // Allocate HugeTLB memory pages for DMA. HugeTLB memory is always diff --git a/src/core/memory.h b/src/core/memory.h index 635a973c4b..57ccad133e 100644 --- a/src/core/memory.h +++ b/src/core/memory.h @@ -1,3 +1,5 @@ +/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */ + int lock_memory(); void *allocate_huge_page(int size); uint64_t phys_page(uint64_t virt_page); diff --git a/src/core/memory.lua b/src/core/memory.lua index cf080974c3..ec25748211 100644 --- a/src/core/memory.lua +++ b/src/core/memory.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(...,package.seeall) -- For more information about huge pages checkout: diff --git a/src/core/packet.h b/src/core/packet.h index 0978a6ba0f..de57e390c0 100644 --- a/src/core/packet.h +++ b/src/core/packet.h @@ -1,3 +1,5 @@ +/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */ + // The maximum amount of payload in any given packet. enum { PACKET_PAYLOAD_SIZE = 10*1024 }; diff --git a/src/core/packet.lua b/src/core/packet.lua index 39e6cf8a96..8ba9d0eefd 100644 --- a/src/core/packet.lua +++ b/src/core/packet.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(...,package.seeall) local debug = _G.developer_debug diff --git a/src/core/selftest.lua b/src/core/selftest.lua index 7b6b78402e..3caaaf9406 100644 --- a/src/core/selftest.lua +++ b/src/core/selftest.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(...,package.seeall) require("core.memory").selftest() diff --git a/src/core/shm.lua b/src/core/shm.lua index 429f204a5e..631cbd96f7 100644 --- a/src/core/shm.lua +++ b/src/core/shm.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + -- shm.lua -- shared memory alternative to ffi.new() -- API: diff --git a/src/core/snabbswitch.c b/src/core/snabbswitch.c index 4e0abd93ba..8bfad505e7 100644 --- a/src/core/snabbswitch.c +++ b/src/core/snabbswitch.c @@ -1,3 +1,5 @@ +/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */ + #include #include "lua.h" diff --git a/src/core/startup.lua b/src/core/startup.lua index 6ce0c8186f..9b1fc0d1ff 100644 --- a/src/core/startup.lua +++ b/src/core/startup.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + local ok, err = pcall(require, "core.main") if not ok then print("startup: unhandled exception") diff --git a/src/core/timer.lua b/src/core/timer.lua index d5ac34e15e..71a3afd2e3 100644 --- a/src/core/timer.lua +++ b/src/core/timer.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(...,package.seeall) local ffi = require("ffi") diff --git a/src/lib/bloom_filter.lua b/src/lib/bloom_filter.lua index 260c117918..c254f49b0d 100644 --- a/src/lib/bloom_filter.lua +++ b/src/lib/bloom_filter.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + -- This module implements a basic Bloom filter as described in -- . -- diff --git a/src/lib/checksum.c b/src/lib/checksum.c index 89eaca8494..b75d1b40e0 100644 --- a/src/lib/checksum.c +++ b/src/lib/checksum.c @@ -1,10 +1,10 @@ +/* Use of this source code is governed by the Apache 2.0 license; see COPYING. + * Generic checksm routine originally taken from DPDK: + * BSD license; (C) Intel 2010-2015, 6WIND 2014. */ + /* IP checksum routines. * - * See src/arch/ for architecture specific SIMD versions. - * - * Generic checksm routine taken from DPDK: - * BSD license; (C) Intel 2010-2015, 6WIND 2014. - */ + * See src/arch/ for architecture specific SIMD versions. */ #include #include diff --git a/src/lib/checksum.h b/src/lib/checksum.h index 72a91326ef..008bfa190e 100644 --- a/src/lib/checksum.h +++ b/src/lib/checksum.h @@ -1,3 +1,5 @@ +/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */ + // Calculate IP checksum using SSE2 instructions. // (This will crash if you call it on a CPU that does not support SSE.) uint16_t cksum_sse2(unsigned char *p, size_t n, uint16_t initial); diff --git a/src/lib/checksum.lua b/src/lib/checksum.lua index 543521b2b6..ea90238738 100644 --- a/src/lib/checksum.lua +++ b/src/lib/checksum.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(...,package.seeall) -- This module exposes the interface: diff --git a/src/lib/checksum_lib.h b/src/lib/checksum_lib.h index 403183d14d..0a00bdbf0e 100644 --- a/src/lib/checksum_lib.h +++ b/src/lib/checksum_lib.h @@ -1,3 +1,5 @@ +/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */ + /* * Checksum library routines that are inline functions. * For inclusion by checksum implementations. diff --git a/src/lib/hardware/pci.c b/src/lib/hardware/pci.c index 0d3304efca..f838bf6eaa 100644 --- a/src/lib/hardware/pci.c +++ b/src/lib/hardware/pci.c @@ -1,3 +1,5 @@ +/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */ + #include #include #include diff --git a/src/lib/hardware/pci.h b/src/lib/hardware/pci.h index 346801d834..dc18ecdfd0 100644 --- a/src/lib/hardware/pci.h +++ b/src/lib/hardware/pci.h @@ -1,3 +1,5 @@ +/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */ + int open_pci_resource(const char *path); void close_pci_resource(int fd, uint32_t *addr); uint32_t *map_pci_resource(int fd); diff --git a/src/lib/hardware/pci.lua b/src/lib/hardware/pci.lua index 5d0dda6d66..e113d1e41c 100644 --- a/src/lib/hardware/pci.lua +++ b/src/lib/hardware/pci.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(...,package.seeall) local ffi = require("ffi") diff --git a/src/lib/hardware/register.lua b/src/lib/hardware/register.lua index cd25c3a464..426f61f98b 100644 --- a/src/lib/hardware/register.lua +++ b/src/lib/hardware/register.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + -- register.lua -- Hardware device register abstraction module(...,package.seeall) diff --git a/src/lib/hash/base.lua b/src/lib/hash/base.lua index e758c47ebe..6afb471a6c 100644 --- a/src/lib/hash/base.lua +++ b/src/lib/hash/base.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + -- Abstract base class for hash functions. -- -- A subclass must define the instance variable "_size" as the number diff --git a/src/lib/hash/murmur.lua b/src/lib/hash/murmur.lua index e37cbe04d2..be5278047b 100644 --- a/src/lib/hash/murmur.lua +++ b/src/lib/hash/murmur.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + -- Implementation of the MurmurHash3 hash function according to the -- reference implementation -- https://code.google.com/p/smhasher/source/browse/trunk/MurmurHash3.cpp diff --git a/src/lib/index_set.lua b/src/lib/index_set.lua index 845354d230..8a94379113 100644 --- a/src/lib/index_set.lua +++ b/src/lib/index_set.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + --- index set object: keeps a set of indexed values local NDX_mt = {} NDX_mt.__index = NDX_mt diff --git a/src/lib/ipc/shmem/mib.lua b/src/lib/ipc/shmem/mib.lua index 6abaa01e16..1b908fb56d 100644 --- a/src/lib/ipc/shmem/mib.lua +++ b/src/lib/ipc/shmem/mib.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + -- Subclass of ipc.shmem.shmem that handles data types from the SMIv2 -- specification. -- diff --git a/src/lib/ipc/shmem/shmem.c b/src/lib/ipc/shmem/shmem.c index 3dc3a593c4..fdc1a86ef1 100644 --- a/src/lib/ipc/shmem/shmem.c +++ b/src/lib/ipc/shmem/shmem.c @@ -1,3 +1,5 @@ +/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */ + #include #include #include diff --git a/src/lib/ipc/shmem/shmem.h b/src/lib/ipc/shmem/shmem.h index e82e7472c8..e35916d0bc 100644 --- a/src/lib/ipc/shmem/shmem.h +++ b/src/lib/ipc/shmem/shmem.h @@ -1,3 +1,5 @@ +/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */ + char *shmem_grow(void *, void *, size_t, size_t); char *shmem_attach(void *, size_t); bool shmem_unmap(void *, size_t); diff --git a/src/lib/ipc/shmem/shmem.lua b/src/lib/ipc/shmem/shmem.lua index fd94d262d9..7da717c577 100644 --- a/src/lib/ipc/shmem/shmem.lua +++ b/src/lib/ipc/shmem/shmem.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + -- The shmem base class provides a simple IPC mechanism to exchange -- arbitrary cdata objects with other processes through a file-backed -- shared memeory region, referred to as the "data file". The memory diff --git a/src/lib/lua/class.lua b/src/lib/lua/class.lua index 988b7877a8..ae65510f62 100644 --- a/src/lib/lua/class.lua +++ b/src/lib/lua/class.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + -- Support for basic OO programming. Apart from the usual -- incantations of setmetatable(), it implements a simple mechanism to -- avoid table allocations by recycling objects that have been diff --git a/src/lib/pcap/filter.h b/src/lib/pcap/filter.h index 8f3c337722..c5475aee66 100644 --- a/src/lib/pcap/filter.h +++ b/src/lib/pcap/filter.h @@ -1,3 +1,5 @@ +/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */ + struct bpf_program { uint32_t bf_len; void *bf_insns; diff --git a/src/lib/pcap/filter.lua b/src/lib/pcap/filter.lua index 9aaf5f2bd4..ec6c8b8f58 100644 --- a/src/lib/pcap/filter.lua +++ b/src/lib/pcap/filter.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(..., package.seeall) local pf = require("pf") diff --git a/src/lib/pcap/pcap.lua b/src/lib/pcap/pcap.lua index 2dac9a3d4a..f0bcb5c37c 100644 --- a/src/lib/pcap/pcap.lua +++ b/src/lib/pcap/pcap.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(...,package.seeall) local ffi = require("ffi") diff --git a/src/lib/pmu.lua b/src/lib/pmu.lua index d0a4e09c6d..51acfa49fc 100644 --- a/src/lib/pmu.lua +++ b/src/lib/pmu.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + -- pmu.lua: Lua interface to the CPU Performance Monitoring Unit module(..., package.seeall) diff --git a/src/lib/pmu_cpu.lua b/src/lib/pmu_cpu.lua index e3f9098dab..d9a6898d1a 100644 --- a/src/lib/pmu_cpu.lua +++ b/src/lib/pmu_cpu.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + -- AUTOMATICALLY GENERATED FILE -- Date: Fri Aug 14 14:34:23 CEST 2015 -- Cmd: scripts/generate-pmu.sh diff --git a/src/lib/protocol/datagram.lua b/src/lib/protocol/datagram.lua index b0110cc1ce..91d778fb71 100644 --- a/src/lib/protocol/datagram.lua +++ b/src/lib/protocol/datagram.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + -- This class provides basic mechanisms for parsing, building and -- manipulating a hierarchy of protocol headers and associated payload -- contained in a data packet. In particular, it supports diff --git a/src/lib/protocol/ethernet.lua b/src/lib/protocol/ethernet.lua index 179a02393c..0a55c20f1b 100644 --- a/src/lib/protocol/ethernet.lua +++ b/src/lib/protocol/ethernet.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(..., package.seeall) local ffi = require("ffi") local C = ffi.C diff --git a/src/lib/protocol/gre.lua b/src/lib/protocol/gre.lua index 2913f2d2e0..271524c37a 100644 --- a/src/lib/protocol/gre.lua +++ b/src/lib/protocol/gre.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(..., package.seeall) local ffi = require("ffi") local C = ffi.C diff --git a/src/lib/protocol/header.lua b/src/lib/protocol/header.lua index 28c6f2b8bb..b442fe44c1 100644 --- a/src/lib/protocol/header.lua +++ b/src/lib/protocol/header.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + -- Protocol header base class -- -- This is an abstract class (should not be instantiated) diff --git a/src/lib/protocol/icmp/header.lua b/src/lib/protocol/icmp/header.lua index d707a72130..2853e636df 100644 --- a/src/lib/protocol/icmp/header.lua +++ b/src/lib/protocol/icmp/header.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(..., package.seeall) local ffi = require("ffi") local C = ffi.C diff --git a/src/lib/protocol/icmp/nd/header.lua b/src/lib/protocol/icmp/nd/header.lua index 64bcb0c5f8..0049005f88 100644 --- a/src/lib/protocol/icmp/nd/header.lua +++ b/src/lib/protocol/icmp/nd/header.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(..., package.seeall) local ffi = require("ffi") local proto_header = require("lib.protocol.header") diff --git a/src/lib/protocol/icmp/nd/na.lua b/src/lib/protocol/icmp/nd/na.lua index 4a1bc453a9..aca90ba7b1 100644 --- a/src/lib/protocol/icmp/nd/na.lua +++ b/src/lib/protocol/icmp/nd/na.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(..., package.seeall) local ffi = require("ffi") local C = ffi.C diff --git a/src/lib/protocol/icmp/nd/ns.lua b/src/lib/protocol/icmp/nd/ns.lua index 5022325009..6df399eba9 100644 --- a/src/lib/protocol/icmp/nd/ns.lua +++ b/src/lib/protocol/icmp/nd/ns.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(..., package.seeall) local ffi = require("ffi") local C = ffi.C diff --git a/src/lib/protocol/icmp/nd/options/lladdr.lua b/src/lib/protocol/icmp/nd/options/lladdr.lua index 163dacc893..775777ce2b 100644 --- a/src/lib/protocol/icmp/nd/options/lladdr.lua +++ b/src/lib/protocol/icmp/nd/options/lladdr.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(..., package.seeall) local ffi = require("ffi") diff --git a/src/lib/protocol/icmp/nd/options/tlv.lua b/src/lib/protocol/icmp/nd/options/tlv.lua index 92c07246e7..87f56e51ac 100644 --- a/src/lib/protocol/icmp/nd/options/tlv.lua +++ b/src/lib/protocol/icmp/nd/options/tlv.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(..., package.seeall) local ffi = require("ffi") diff --git a/src/lib/protocol/ipv4.lua b/src/lib/protocol/ipv4.lua index 9b0d58fca0..a627b5546b 100644 --- a/src/lib/protocol/ipv4.lua +++ b/src/lib/protocol/ipv4.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(..., package.seeall) local ffi = require("ffi") local C = ffi.C diff --git a/src/lib/protocol/ipv6.lua b/src/lib/protocol/ipv6.lua index 2175af4180..7db73c8288 100644 --- a/src/lib/protocol/ipv6.lua +++ b/src/lib/protocol/ipv6.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(..., package.seeall) local ffi = require("ffi") local C = ffi.C diff --git a/src/lib/protocol/keyed_ipv6_tunnel.lua b/src/lib/protocol/keyed_ipv6_tunnel.lua index 57b5ac74a6..e1bcc773f8 100644 --- a/src/lib/protocol/keyed_ipv6_tunnel.lua +++ b/src/lib/protocol/keyed_ipv6_tunnel.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + -- This is an implementation of the "Keyed IPv6 Tunnel" specification -- conforming to -- http://tools.ietf.org/html/draft-mkonstan-keyed-ipv6-tunnel-01. It diff --git a/src/lib/protocol/tcp.lua b/src/lib/protocol/tcp.lua index 542ccfcba4..41fbd52e5c 100644 --- a/src/lib/protocol/tcp.lua +++ b/src/lib/protocol/tcp.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(..., package.seeall) local ffi = require("ffi") local C = ffi.C diff --git a/src/lib/protocol/udp.lua b/src/lib/protocol/udp.lua index 00ed951621..27ed9ecb98 100644 --- a/src/lib/protocol/udp.lua +++ b/src/lib/protocol/udp.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(..., package.seeall) local ffi = require("ffi") local C = ffi.C diff --git a/src/lib/traceprof/traceprof.c b/src/lib/traceprof/traceprof.c index 553e527977..0e1b6875d7 100644 --- a/src/lib/traceprof/traceprof.c +++ b/src/lib/traceprof/traceprof.c @@ -1,3 +1,5 @@ +/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */ + // Location where the next instruction pointer value will be stored. #define _GNU_SOURCE 1 diff --git a/src/lib/traceprof/traceprof.h b/src/lib/traceprof/traceprof.h index 99cd00b7e7..a93c569b32 100644 --- a/src/lib/traceprof/traceprof.h +++ b/src/lib/traceprof/traceprof.h @@ -1,2 +1,4 @@ +/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */ + void traceprof_start(uint64_t *logptr, int maxsamples, int usecs); int traceprof_stop(); diff --git a/src/lib/traceprof/traceprof.lua b/src/lib/traceprof/traceprof.lua index d6e5d84bac..cab59aad5d 100644 --- a/src/lib/traceprof/traceprof.lua +++ b/src/lib/traceprof/traceprof.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + -- traceprof.lua: Low-level trace profiler -- -- Traceprof analyzes the time spent in JIT-compiled traces. It is an diff --git a/src/lib/virtio/net_device.lua b/src/lib/virtio/net_device.lua index bf8e451f8c..2e6bc0bb35 100644 --- a/src/lib/virtio/net_device.lua +++ b/src/lib/virtio/net_device.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + -- Implements virtio-net device diff --git a/src/lib/virtio/net_driver.lua b/src/lib/virtio/net_driver.lua index 89c90e9953..0ab83ea2b1 100644 --- a/src/lib/virtio/net_driver.lua +++ b/src/lib/virtio/net_driver.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + -- Application to connect to a virtio-net driver implementation -- -- Licensed under the Apache 2.0 license diff --git a/src/lib/virtio/virtio.h b/src/lib/virtio/virtio.h index 16d7502d84..dbf502e51f 100644 --- a/src/lib/virtio/virtio.h +++ b/src/lib/virtio/virtio.h @@ -1,7 +1,6 @@ -/* virtio.h - Virtual I/O device support in Linux/KVM style - * - * http://www.apache.org/licenses/LICENSE-2.0 - */ +/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */ + +/* virtio.h - Virtual I/O device support in Linux/KVM style */ enum { VIO_VRING_SIZE = 512 }; diff --git a/src/lib/virtio/virtio_pci.lua b/src/lib/virtio/virtio_pci.lua index d3d3a23221..b121a834d2 100644 --- a/src/lib/virtio/virtio_pci.lua +++ b/src/lib/virtio/virtio_pci.lua @@ -1,8 +1,7 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + -- Application to connect to a virtio-net driver implementation -- --- Licensed under the Apache 2.0 license --- http://www.apache.org/licenses/LICENSE-2.0 --- -- Copyright (c) 2015 Virtual Open Systems -- diff --git a/src/lib/virtio/virtio_vring.h b/src/lib/virtio/virtio_vring.h index 0b7ea1ce90..5660344176 100644 --- a/src/lib/virtio/virtio_vring.h +++ b/src/lib/virtio/virtio_vring.h @@ -1,3 +1,5 @@ +/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */ + // Size of vring structures used in Linux vhost. Max 32768. enum { VHOST_VRING_SIZE = 32*1024 }; diff --git a/src/lib/virtio/virtq_device.lua b/src/lib/virtio/virtq_device.lua index 20aeee9c87..0c698b2ee1 100644 --- a/src/lib/virtio/virtq_device.lua +++ b/src/lib/virtio/virtq_device.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + -- Implements virtio virtq diff --git a/src/lib/virtio/virtq_driver.lua b/src/lib/virtio/virtq_driver.lua index 5ce3c5689a..d5cc27b105 100644 --- a/src/lib/virtio/virtq_driver.lua +++ b/src/lib/virtio/virtq_driver.lua @@ -1,8 +1,7 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + -- Application to connect to a virtio-net driver implementation -- --- Licensed under the Apache 2.0 license --- http://www.apache.org/licenses/LICENSE-2.0 --- -- Copyright (c) 2015 Virtual Open Systems -- diff --git a/src/lib/watchdog/watchdog.lua b/src/lib/watchdog/watchdog.lua index 13954fd964..4447666970 100644 --- a/src/lib/watchdog/watchdog.lua +++ b/src/lib/watchdog/watchdog.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(...,package.seeall) ffi = require("ffi") diff --git a/src/program/example_replay/example_replay.lua b/src/program/example_replay/example_replay.lua index f6b3069166..1375611109 100755 --- a/src/program/example_replay/example_replay.lua +++ b/src/program/example_replay/example_replay.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(..., package.seeall) local pcap = require("apps.pcap.pcap") diff --git a/src/program/example_spray/example_spray.lua b/src/program/example_spray/example_spray.lua index 4211840945..ab39767193 100755 --- a/src/program/example_spray/example_spray.lua +++ b/src/program/example_spray/example_spray.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(..., package.seeall) local pcap = require("apps.pcap.pcap") diff --git a/src/program/example_spray/sprayer.lua b/src/program/example_spray/sprayer.lua index 58583fe806..51140eba84 100755 --- a/src/program/example_spray/sprayer.lua +++ b/src/program/example_spray/sprayer.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(..., package.seeall) Sprayer = {} diff --git a/src/program/firehose/firehose.h b/src/program/firehose/firehose.h index c514636c16..684cdb201d 100644 --- a/src/program/firehose/firehose.h +++ b/src/program/firehose/firehose.h @@ -1,3 +1,5 @@ +/* Use of this source code is governed by the Apache 2.0 license; see COPYING. */ + #include /* Called once before processing packets. */ diff --git a/src/program/firehose/firehose.lua b/src/program/firehose/firehose.lua index ad922dfb44..0354f1a0ec 100644 --- a/src/program/firehose/firehose.lua +++ b/src/program/firehose/firehose.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(..., package.seeall) local lib = require("core.lib") diff --git a/src/program/gc/gc.lua b/src/program/gc/gc.lua index 9187e534fc..d3de0a12e1 100644 --- a/src/program/gc/gc.lua +++ b/src/program/gc/gc.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(..., package.seeall) local lib = require("core.lib") diff --git a/src/program/packetblaster/packetblaster.lua b/src/program/packetblaster/packetblaster.lua index e1e4124b37..ce0e7e327d 100644 --- a/src/program/packetblaster/packetblaster.lua +++ b/src/program/packetblaster/packetblaster.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(..., package.seeall) local engine = require("core.app") diff --git a/src/program/snabbmark/snabbmark.lua b/src/program/snabbmark/snabbmark.lua index 45c394a5e9..8a554ffa8b 100644 --- a/src/program/snabbmark/snabbmark.lua +++ b/src/program/snabbmark/snabbmark.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(..., package.seeall) local usage = require("program.snabbmark.README_inc") diff --git a/src/program/snabbnfv/fuzz/fuzz.lua b/src/program/snabbnfv/fuzz/fuzz.lua index 868a934070..3e49928deb 100644 --- a/src/program/snabbnfv/fuzz/fuzz.lua +++ b/src/program/snabbnfv/fuzz/fuzz.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(...,package.seeall) local lib = require("core.lib") diff --git a/src/program/snabbnfv/neutron2snabb/neutron2snabb.lua b/src/program/snabbnfv/neutron2snabb/neutron2snabb.lua index 1cc4ed331d..7191494d4a 100644 --- a/src/program/snabbnfv/neutron2snabb/neutron2snabb.lua +++ b/src/program/snabbnfv/neutron2snabb/neutron2snabb.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(..., package.seeall) local lib = require("core.lib") diff --git a/src/program/snabbnfv/neutron2snabb/neutron2snabb_schema.lua b/src/program/snabbnfv/neutron2snabb/neutron2snabb_schema.lua index 479af2f4cf..ad4ee50b47 100644 --- a/src/program/snabbnfv/neutron2snabb/neutron2snabb_schema.lua +++ b/src/program/snabbnfv/neutron2snabb/neutron2snabb_schema.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + -- neutron2snabb_schema: Scan mysqldump SQL files for schema informaion module(..., package.seeall) diff --git a/src/program/snabbnfv/neutron_sync_agent/neutron_sync_agent.lua b/src/program/snabbnfv/neutron_sync_agent/neutron_sync_agent.lua index de456aee9a..b3dd60f735 100644 --- a/src/program/snabbnfv/neutron_sync_agent/neutron_sync_agent.lua +++ b/src/program/snabbnfv/neutron_sync_agent/neutron_sync_agent.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(..., package.seeall) local lib = require("core.lib") diff --git a/src/program/snabbnfv/neutron_sync_master/neutron_sync_master.lua b/src/program/snabbnfv/neutron_sync_master/neutron_sync_master.lua index 207c0a9a0c..a66611e6ca 100644 --- a/src/program/snabbnfv/neutron_sync_master/neutron_sync_master.lua +++ b/src/program/snabbnfv/neutron_sync_master/neutron_sync_master.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(..., package.seeall) local lib = require("core.lib") diff --git a/src/program/snabbnfv/nfvconfig.lua b/src/program/snabbnfv/nfvconfig.lua index 31040fbcca..c8948b1071 100644 --- a/src/program/snabbnfv/nfvconfig.lua +++ b/src/program/snabbnfv/nfvconfig.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(...,package.seeall) local VhostUser = require("apps.vhost.vhost_user").VhostUser diff --git a/src/program/snabbnfv/snabbnfv.lua b/src/program/snabbnfv/snabbnfv.lua index 5f31eec060..a989d7464f 100644 --- a/src/program/snabbnfv/snabbnfv.lua +++ b/src/program/snabbnfv/snabbnfv.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(..., package.seeall) local ffi = require("ffi") diff --git a/src/program/snabbnfv/traffic/traffic.lua b/src/program/snabbnfv/traffic/traffic.lua index ceab105260..b944673150 100644 --- a/src/program/snabbnfv/traffic/traffic.lua +++ b/src/program/snabbnfv/traffic/traffic.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(..., package.seeall) local lib = require("core.lib") diff --git a/src/program/snsh/snsh.lua b/src/program/snsh/snsh.lua index aaaee7c98e..4b2176e812 100644 --- a/src/program/snsh/snsh.lua +++ b/src/program/snsh/snsh.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(..., package.seeall) local lib = require("core.lib") diff --git a/src/program/top/top.lua b/src/program/top/top.lua index 36f31d57c5..fcbdd9aea3 100644 --- a/src/program/top/top.lua +++ b/src/program/top/top.lua @@ -1,3 +1,5 @@ +-- Use of this source code is governed by the Apache 2.0 license; see COPYING. + module(..., package.seeall) local ffi = require("ffi") From adddf0beea5811e32a7d5ca96304d25acb22f563 Mon Sep 17 00:00:00 2001 From: Luke Gorrie Date: Sun, 21 Feb 2016 09:35:12 +0100 Subject: [PATCH 20/28] snabbnfv: Shrink pcap files to reduce repo size Shrinks the disk size of src/ from 12.5MB to 3.7MB by removing redundancy from some test vector files. (Compare with 6.7MB for our "lib/" dependencies including LuaJIT, etc.) The specific change is that the Snabb NFV test vectors for various packet sizes now each contain a single packet. Previously the files were larger e.g. '9000.pcap' weighed in at 2.2MB for 255 x 9000 byte packets. I assume that these are inputs to packetblaster and that the packet will be automatically looped and so this will not change system behavior. If this is wrong or confusing then we should perhaps update packetblaster code or documentation. These files could perhaps be eliminated entirely by using the "synth" option of packetblaster instead but I leave that as future work. --- .../snabbnfv/test_fixtures/pcap/1000.pcap | Bin 101624 -> 1040 bytes .../snabbnfv/test_fixtures/pcap/1024xff.pcap | Bin 1040024 -> 1064 bytes .../snabbnfv/test_fixtures/pcap/128.pcap | Bin 36744 -> 168 bytes .../snabbnfv/test_fixtures/pcap/1280xff.pcap | Bin 1296024 -> 1320 bytes .../snabbnfv/test_fixtures/pcap/1500.pcap | Bin 386604 -> 1540 bytes .../snabbnfv/test_fixtures/pcap/1514.pcap | Bin 153024 -> 1554 bytes .../snabbnfv/test_fixtures/pcap/1514xff.pcap | Bin 1530024 -> 1554 bytes .../snabbnfv/test_fixtures/pcap/256.pcap | Bin 27224 -> 296 bytes .../snabbnfv/test_fixtures/pcap/256xff.pcap | Bin 272024 -> 296 bytes .../snabbnfv/test_fixtures/pcap/384xff.pcap | Bin 400024 -> 424 bytes .../snabbnfv/test_fixtures/pcap/512.pcap | Bin 134664 -> 552 bytes .../snabbnfv/test_fixtures/pcap/512xff.pcap | Bin 528024 -> 552 bytes .../snabbnfv/test_fixtures/pcap/64.pcap | Bin 8024 -> 104 bytes .../snabbnfv/test_fixtures/pcap/64xff.pcap | Bin 80024 -> 104 bytes .../snabbnfv/test_fixtures/pcap/768xff.pcap | Bin 784024 -> 808 bytes .../snabbnfv/test_fixtures/pcap/9000.pcap | Bin 2299104 -> 9040 bytes 16 files changed, 0 insertions(+), 0 deletions(-) diff --git a/src/program/snabbnfv/test_fixtures/pcap/1000.pcap b/src/program/snabbnfv/test_fixtures/pcap/1000.pcap index 612796a88a66d392f56221ac2617ec376a2d3745..f88b0101de6930393d85193b51b15af33f01287c 100644 GIT binary patch delta 8 Pcmew{lWhXW1_2fT5kCU- delta 1060 zcmb8rze<7u6o&D^v_J(V3{fhFF2TK}rMbDKOXxa66hSI+3HNj;Crc=zKSYo=g^EMy zU_{?XDpDjGyidb{X#4T-4u_Lo7#;XZp*io+Q{37sFT0+ZQc_yVNLeW-?MsJJUMfgO z(y??ZRSZ?t&ZKjxX6Q-{-KgD457MJlH}tI5l-g29>KW>*y-IIW`KBL_G|DT^50_vR z#$X(-!6aNaxk258+i(Z&!jhxQPGALIn7pK3!#j8n8}JFX;0x@+K75A`bfH~87z|7f oslPa)j!k}2zu-5VclA_148R}^!SFx0$TkXNF#Z=;86;+$01Y_kegFUf diff --git a/src/program/snabbnfv/test_fixtures/pcap/1024xff.pcap b/src/program/snabbnfv/test_fixtures/pcap/1024xff.pcap index a76cff336059f56f572eae8ae1adc733a297978f..34a671da7887177fa4efc4704879f7afa14383c7 100644 GIT binary patch delta 8 PcmbQS*M0@Z1`QSf5jg`P delta 10954 zcmZwJWt7lm7QkUe-~cXNlF~zW_s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Lsuqj3z5#c?@xyJw^^bwEFgC`;co-iOU?NP6NiZoU!{nF(Q{pF> z3R7bmOpEC-J${NAFe7Hd%$NnUVm1uH?3e>{VlK>$c`z^L!~9qP3t?d_f<>`dv@EWc zz>-)BOJf-f)^NPR1!X z6{q2JoPo1&HqMEbbJcmc02ksST#QR_DSn6HxD1!$3S5b+a5b*MwYUx=a6Lxi2Hc37 za5HYfDBOzMa69h6UAPp2c%`9xvcU zyo8tW3SPx)cpY!xExe6C;yt{NkMJ=*#b@{uU*Q{ki@)PL{BXN}3C62!fIFpYhyiZfQ_*!HpiCu1-8L< z*a16XSL}v8uqXDyKG+xg;Q$4$j5- zxBwU75?qSmxC~d|N?eU=a2-ZqByPk_xCNtd8*ay)xC{5-Ufhod@DLuxqj>E9{1e-i B^sxW{ diff --git a/src/program/snabbnfv/test_fixtures/pcap/128.pcap b/src/program/snabbnfv/test_fixtures/pcap/128.pcap index ab4cd98cd21d3964bb551cde937f6128696a10e6..3a974b32b0afcce4920aa64abf38973000a6cf1f 100644 GIT binary patch delta 7 OcmeB}&$NPZ!U_Nj?gI+| literal 36744 zcmeH@!D+-m0K}Y-3PTD~E7w9=xE8J-M+0Z@WB&P!K-fEetkLWF`}jP*j*Ig=j*si$ zlegbLzT7`}{15Qbxc@Oi0k^n5MkwGG*T)D2+~WEep@3UlA0rfSi|b>A0&a1Aj8MQW zu8$E4xW)A`LIJn9K1L|u7T3oJ1>EBL7@>e$TpuG8aEt3>gaU4HeT-1REv}Cd3b@7f zF+u^ixIRWG;1<`%2nF2Y`WT^rTU;L_6mW~{V}t^3aea(Xz%8zi5em4)^)W&Lx41q= zDBu>?#|Q=7;`$h&fLmN2BNT9p>tlohZgG8#P{1v&j}Z#E#q}{l0k^n5MkwGG*T)D2 z+~WEep@3UlA0rfSi|b>A0&a1Aj8MQWu8$E4xW)A`LIJn9K1L|u7T3oJ1>EBL7@>e$ zTpuG8aEt3>gaU4HeT-1REv}Cd3b@7fF+u^ixIRWG;1<`%2nF2Y`WT^rTU;L_6mW~{ zV}t^3aea(Xz%8zi5em4)^)W&Lx41q=DBu>?#|Q=7;`$h&fLmN2BNT9p>tlohZgG8# zP{1v&j}Z#E#q}{l0k^n5MkwGG*T)D2+~WEep@3UlA0rfSi|b>A0&a1Aj8MQWu8$E4 zxW)A`LIJn9K1L|u7T3oJ1>EBL7@>e$TpuG8aEt3>gaU4HeT-1REv}Cd3b@7fF+u^i zxIRWG;1<`%2nF2Y`WT^rTU;L_6mW~{V}t^3aea(Xz%8zi5em4)^)W&Lx41q=DBu>? z#|Q=7;`$h&fLmN2BNT9p>tlohZgG8#P{1v&j}Z#E#q}{l0k^n5MkwGG*T)D2+~WEe zp@3UlA0rfSi|b>A0&a1Aj8MQWu8$E4xW)A`LIJn9K1L|u7T3oJ1>EBL7@>e$TpuG8 zaEt3>gaU4HeT-1REv}Cd3b@7fF+u^ixIRWG;1<`%2nF2Y`WT^rTU;L_6mW~{V}t^3 zaea(Xz%8zi5em4)^)W&Lx41q=DBu>?#|Q=7;`$h&fLmN2BNT9p>tlohZgG8#aN`g7 CWvW;J diff --git a/src/program/snabbnfv/test_fixtures/pcap/1280xff.pcap b/src/program/snabbnfv/test_fixtures/pcap/1280xff.pcap index f7105f6e58406e32ae7db246d7c8d1827de0a1e0..e753a759600d08e2a69332de6ce09d3daba6794c 100644 GIT binary patch delta 8 PcmbQy>%W3)g9a-A5K;pK delta 10971 zcmYM!cYMfq9>?*V6|43hQ53N*LGs??~OHL7;&9=$#uzvq9?zrWx2>yw;y(e#$7;TbblT)Vr?ybZ;({i%h45(6y_ z^huzkK&t{J2TBRFIncI1djstcbU4t_K&Jwo33MUQ#Xvs>x*q6GpnHKH1$q+b_dk^B zk2eUZxgjj;pUi|=FbC$w0$3PJU`Z^8q844&$){cERr02m9e* z9D*Zo6pq6Qn1EAp7S6#%n25_U36n7eQ*k41!yUK>_u(Ntg2(YBp2PF_1761KcoXm8 z1AKzdFr-#6+H{y1vtmxng9WiLmcUY24l7^;M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5#10Lh_fX8?};4wiDcudp-9+UKd$7DU= z5w8b4{;dZ*rsx5Wsd~WUQ$64@T@QGCrUyJe*8?6i^nk}qJ>W504|vSc10HkrfX6&N z;E|vQJQnBykA-@`W04;4SfU3!mg)hIFZ6)NGCkn2Tn~7x&;uST^?=7JJ>aog4|uHA a10L)2fX8}0;ITmucx==I9-H(?^Y{ZLIx5lt diff --git a/src/program/snabbnfv/test_fixtures/pcap/384xff.pcap b/src/program/snabbnfv/test_fixtures/pcap/384xff.pcap index 964cb1d4f2005617c7d639239297d72b075564a4..827f567a0458dde1a1af8d610d4cb9aaa3606e63 100644 GIT binary patch delta 8 PcmbQSRbmD6h82te5dZ^f literal 400024 zcmeIw?YGWl9)|JTQ`uxBp)D$@6e6M!B`Io0sVz!`Qbp!@TwH)_a*IMWA)%jiL=iazt{_}-1MKk~Z70nd-`y(g6 zAU9J!E0g#4M|g+)C0!tR6xSoEL0ld@O6Up4{=HO9TkE8~1dGI({ zk9d-#Ie1jjBdI}L9z3e*5l@md2ahxKNNNz52ajrc#FHe=!K1n!Ne$xi;88=5c#@Jd+pGzX6yJ(3#4<-y}hJ>p4{=HPLa9!U-2^5Ai`9`PhebMUxUkE8~1dGKhfM?6W= z96Z|Tk<=hA4<6U+5l@md2agVVBsGZ3gGWa_;z^R`;Bk{4Ne$xi;L$~oc#@ygwTE)O1$=n+qnGzX7idL%W7%Y(;1^@t})nuEtkJ(3#4<-y}oJ>p4{=HT&| z9!U-2^5F5f9`PhebMP3iM^b~hJa{~zM?6W=96ToKk<=hA4<1kH5l@md2am~mBsGZ3 zgU7Ra#FHe=!DEUZNe$xi;4xK?c#@XFnS zE)O2>>Jd+pGzX7WdL%W7%Y(;iJ>p4{=HT(69!U-2^5C&nk9d-#Ie7d_kE8~1dGJ`T zM?6W=96UDak<=hA4<4WD5l@md2anJ6NNNz52ahlGh$l&!gU4n)k{ZP2!DEXa@gzxe z@Yt$HQiHfWczmNrJW0|VJigTo+N1w9^3UuY7mzPk014jCr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eI zfp}P;hp7Thp79fGe2d$HUX~Fckuy z;$a;OohOwc-T@8a0OHRczCWJrb6ITJZz%}xPmEu zJZ!6nsSx-S4=>aMT)`AS9=6xRR0w>EhaL0)S1`qohn@5=6#}2)VP`$S6-@EtVK+TY zg}|qH*h3F+1ylTZc!eIOLf}(8?5PL1f+>DH?5&5X5cm`i`{)6#V2U3Puhzp<2z-i% z{qz7=FvX9D*Xdy@1U|*X8}tBIFvX9DH|b$21U|*XTl4@|FvX9Dx9MRj1U|*XJM;io zFvX9D1NAT!0-xgHU3!2knBvF7!Freqflu-9UOm7SO!4F4a6L?gz^8aPQV(ziQ~Y>1 zS`Skp@F^ZXpa-~uDSkYBP!Cff@F^ZXtOvM)DSkX0r-!K!_!JMv>jAD{iXRUj*TYl@ ze2Rw?^#E5e#gB)R^)M9zpW@*ZJ-`)A@#EoCJxqnbr+7GB4{!xj{CN1B9;QOzQ#^c8 z4{!xj{CGG^4^tuVDIU(z16;urKOWB0!&C@-iih*{09P=@kB1BOFckuy;^87az!gmK zT)`AS9EhpY4eS1`qohoyR$ z3V~1Y@I5`i6-@Et;c7ihg}|qHxK6h9t*uZO7+_!JL+)B{|>6h9vRq=%^x_!JNK>H)4`iXRVu z*27c?e2Rw$^Z-{d#gB&v^)M9zpW%f2GVQoF& z9n2RH59{h-z7G619@f_b-obnU@vuY>^L60A@$d{i;2q2t5Dy#bVZILhHy$?D1Kz=W z0r9Yj9_H)7f8*iVdcZrFFCZQ^)5Cln_-{P?s~+$U<_n02t@JQo2mTum&(j0m!F&Pn M@O(YY*Ma~3KVl;8$^ZZW diff --git a/src/program/snabbnfv/test_fixtures/pcap/64.pcap b/src/program/snabbnfv/test_fixtures/pcap/64.pcap index a817ce950453b683b65d63897694aefa99a3073a..3c2b11064a8a4ed254aa2dd0009f7e4023e4ffcd 100644 GIT binary patch delta 5 Mcmca%moXs&00;E~cK`qY literal 8024 zcmeI$ze@sP9LMqJL{xNgD-}T}w;a+z2n}Z)R1gu-ei&vT*wp0e;*w3J2!f*!IJ!Eu ziqK$UNSk{ILgzX72Z-XPIG+>tTsreSa9`OyFWmPG_WZCH(3uy6`_f(r&PRI}aK5PIUJT9`hrJZ+rC~3l zGcODGrM(=SkM{C#z5?uB9leA8Z_xL51JC33=p8g)`u>XWJY@Io;Jzi;yNA89&b$Y> zFYQ&}d{x+cl-zrQ^VMLl4tvkA*Mz+n*n5S&H`r^zUR!dn1Lu2(y${$M!`=k;K4EVP Rdo$RZ!`?USEnx2l^fo17Ri6L= diff --git a/src/program/snabbnfv/test_fixtures/pcap/64xff.pcap b/src/program/snabbnfv/test_fixtures/pcap/64xff.pcap index 8fda740d4c43aa79f13baed7b85d31e773531d84..a70140e9b5d477fde7b0c3558cd09498ae7760f1 100644 GIT binary patch delta 6 NcmbR7ktJh71^^2i0`33+ literal 80024 zcmb{2_j?F-9tZG5?ZyeQic)*Dv1h3ewHp;;&vMkNL+xFwNX?ohtu0l@+2hbyO|5cL z`{Yp6iXis9_NV&;?)7<|@AG`Vzr23`Jn#3f`!*~|6_7gMf0H^O@Q+W#${(Zp-Aofu z^N;<{_xk^wKfMvy8-=|w*c*$zaoC%Py-C=chP@fsn~lAB*jtFb80;;@-U{r+VsAC} z)?#lx_BLT}EB1C^Zx{CVU~eDx;<0xKdq=T%40{RKJA=J**h|FTMeJR{-Zkvq#NKV} zC1dYC_8wyIG4`Hg?43&CD??B&8<9_;1AUIFYC#$HkE zmBd~s_R3(d9QG<yEwN*z1G6{@5FUy&>2ehP{#48-u-Z*qea8$=Le}do!^2HTLFVZxQys#okivEyrFg z_EuwWE%yF_y-nELg1zn7+ljp&v9}j{2e229y~Ef$ioJhfF9Ca}v3Cx8iP*b{y(`$e zhP|8EOTyk=?4@Au5%!*7?*;Z=VK3Efn@6R_UV7|h#9k)s1!FG+d)cvxR9a z*z1kGzS#R5dxNnz40|K7HyV56ur~pFld<;|_NHTR7WU>~Zyxp*VlM`JOR%>Ld#kYb zJ@(dMZ!PvVU~d!lwqb7v_I6`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S zFK^_n0`c%(9=6i>R#+e&-p51X%Nu#CKs>ykhpjZe6&8qx5Aaa<@ZVJnSq zg$3f_Lp&6|ypgvG#KVVq*h=GDVS#w~2oHrXZ{)24@$gX|w$k`kSRfug#zW!D8+ofh zJbavotu($B7Kn#W@KE^jM&2qA51-^=D~)f31>)gTJQTjXk+%xO!>4)JO5@a2uXRUjU|#=}+`-wF%F!+-Kn`0_^HDi9A}=V2?2Z-oWo z;Tt>@zPypQ3dF-VdDu$hTVa8C_!bX^FK^_n0`c%|9=6i>R#+e&zQaS|%Nu#CKs)gnJQTjXk+%xO!_RrxO5 Date: Tue, 23 Feb 2016 20:56:10 +0000 Subject: [PATCH 21/28] README: Remove deprecation of memory.huge_page_size I have no strong rationale for deprecating this, nor do we have tradition of deprecating things or a process for removing them, so I back out that change and leave this be. --- src/README.md.src | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/README.md.src b/src/README.md.src index 773d6eba42..bfceaeb669 100644 --- a/src/README.md.src +++ b/src/README.md.src @@ -373,7 +373,7 @@ Returns a pointer to *bytes* of new DMA memory. Returns the physical address (`uint64_t`) the DMA memory at *pointer*. -— Variable **memory.huge_page_size** [**DEPRECATED**] +— Variable **memory.huge_page_size** Size of a single huge page in bytes. Read-only. From a0bc118f60bcb86be609c6070121bd4b9fa6051c Mon Sep 17 00:00:00 2001 From: Luke Gorrie Date: Wed, 24 Feb 2016 07:50:46 +0000 Subject: [PATCH 22/28] src/README.md: Fixed to match README.src.md --- src/README.md | 43 +++++++++---------------------------------- 1 file changed, 9 insertions(+), 34 deletions(-) diff --git a/src/README.md b/src/README.md index 304d2b882e..f4dcfc4181 100644 --- a/src/README.md +++ b/src/README.md @@ -333,49 +333,24 @@ Allocate packet and fill it with the contents of *string*. ## Memory (core.memory) -Snabb Switch does two things specially when it comes to memory: It -runs with a fixed physical memory map and it allocates *huge pages* -from the operating system. +Snabb Switch allocates special +[DMA](https://en.wikipedia.org/wiki/Direct_memory_access) memory that +can be accessed directly by network cards. The important +characteristic of DMA memory is being located in contiguous physical +memory at a stable address. -Running with a fixed memory map means that every virtual address in the -Snabb Switch process has a fixed *physical address* in the RAM -chips. This means that we are always able to convert from a virtual -address in our process to a physical address that other hardware (for -example, a network card) can use for DMA. - -Huge pages (also known as *HugeTLB pages*) are how we allocate large -amounts of contiguous memory, typically 2MB at a time. Hardware devices -sometimes require this, for example a network card's *descriptor ring* -may require a list of pointers to available buffers in physical memory. +— Function **memory.dma_alloc** *bytes* -— Variable **memory.chunks** +Returns a pointer to *bytes* of new DMA memory. -List of all allocated huge pages. Read-only. Each huge page is -represented by a table with the following keys: +— Function **memory.virtual_to_physical** *pointer* -* `pointer` - Virtual address -* `physical` - Physical address -* `size` - Size in bytes -* `used` - Bytes used +Returns the physical address (`uint64_t`) the DMA memory at *pointer*. — Variable **memory.huge_page_size** Size of a single huge page in bytes. Read-only. -— Variable **huge_page_bits** - -Number of address bits per huge page. Read-only. - -— Function **memory.dma_alloc** *bytes* - -Allocate *bytes* of DMA-friendly memory. Returns virtual memory pointer, -physical address, and actual size. - -— Function **memory.virtual_to_physical** *virtual_address* - -Returns the physical address of memory at *virtual_address*. - - ## Lib (core.lib) From 08c31ef6a8578e108e7e6318b10f00384bbdedfb Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Thu, 25 Feb 2016 14:46:29 +0100 Subject: [PATCH 23/28] lib.equal can compare cdata Cdata values are equal if they have the same size and their bytes are the same. --- src/core/lib.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/lib.lua b/src/core/lib.lua index bb95afe3e0..c1f9feb918 100644 --- a/src/core/lib.lua +++ b/src/core/lib.lua @@ -20,6 +20,10 @@ function equal (x, y) if x[k] == nil then return false end end return true + elseif type(x) == 'cdata' then + local size = ffi.sizeof(x) + if ffi.sizeof(y) ~= size then return false end + return C.memcmp(x, y, size) == 0 else return x == y end From 08e3a0cc2996563979e47ba05328be779b0e7067 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Thu, 25 Feb 2016 14:49:22 +0100 Subject: [PATCH 24/28] Add "dist" target to makefile Run as "make dist" to generate snabbswitch-`git describe`.tar.xz, which will contain source code and a built binary. Set DIST_BINARY to rename the binary. Set PACKAGE to rename the package. --- Makefile | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Makefile b/Makefile index f3b08468f4..31c20f9c98 100644 --- a/Makefile +++ b/Makefile @@ -29,4 +29,17 @@ clean: (cd lib/luajit && $(MAKE) clean) (cd src; $(MAKE) clean; rm -rf syscall.lua syscall) +PACKAGE:=snabbswitch +DIST_BINARY:=snabb +BUILDDIR:=$(shell pwd) + +dist: DISTDIR:=$(BUILDDIR)/$(PACKAGE)-$(shell git describe --tags) +dist: all + mkdir "$(DISTDIR)" + git clone "$(BUILDDIR)" "$(DISTDIR)/snabbswitch" + rm -rf "$(DISTDIR)/snabbswitch/.git" + cp "$(BUILDDIR)/src/snabb" "$(DISTDIR)/$(DIST_BINARY)" + cd "$(DISTDIR)/.." && tar cJvf "`basename '$(DISTDIR)'`.tar.xz" "`basename '$(DISTDIR)'`" + rm -rf "$(DISTDIR)" + .SERIAL: all From 23347b39b116a4fc12286bbd819bac760f2b2e73 Mon Sep 17 00:00:00 2001 From: Luke Gorrie Date: Mon, 29 Feb 2016 04:54:22 +0000 Subject: [PATCH 25/28] lib/README.md: Renamed to lib/README.ctable.md This file contains only the documentation for the ctable module and not the whole lib/ API so README.md was a misnomer. --- src/lib/{README.md => README.ctable.md} | 2 -- 1 file changed, 2 deletions(-) rename src/lib/{README.md => README.ctable.md} (99%) diff --git a/src/lib/README.md b/src/lib/README.ctable.md similarity index 99% rename from src/lib/README.md rename to src/lib/README.ctable.md index c6b218ab35..d0178212a5 100644 --- a/src/lib/README.md +++ b/src/lib/README.ctable.md @@ -1,5 +1,3 @@ -## Specialized data structures - ### Ctable (lib.ctable) A *ctable* is a hash table whose keys and values are instances of FFI From 41d24e8c41688499c39a79030b6fa887e066e246 Mon Sep 17 00:00:00 2001 From: Luke Gorrie Date: Mon, 29 Feb 2016 04:55:30 +0000 Subject: [PATCH 26/28] lib/README.pmu.md: New README file Extracted the documentation from the pmu.lua source file into a markdown-formatted README. --- src/lib/README.pmu.md | 115 ++++++++++++++++++++++++++++++++++++++++++ src/lib/pmu.lua | 88 +------------------------------- 2 files changed, 116 insertions(+), 87 deletions(-) create mode 100644 src/lib/README.pmu.md diff --git a/src/lib/README.pmu.md b/src/lib/README.pmu.md new file mode 100644 index 0000000000..67ae8bf1d0 --- /dev/null +++ b/src/lib/README.pmu.md @@ -0,0 +1,115 @@ +### PMU (lib.pmu) + +The CPU's PMU (Performance Monitoring Unit) collects information about +specific *performance events* such as cache misses, branch +mispredictions, and utilization of internal CPU resources like +execution units. This module provides an API for counting events with +the PMU. + +Hundreds of low-level counters are available. The exact list +depends on CPU model. See pmu_cpu.lua for our definitions. + +#### High-level interface + +— Function **is_available** + +If the PMU hardware is available then return true. Otherwise return +two values: false and a string briefly explaining why. (Cooperation +from the Linux kernel is required to acess the PMU.) + +— Function **profile** *function* *[event_list]* *[aux]* + +Call *function*, return the result, and print a human-readable report of the performance events that were counted during execution. + +— Function **measure** *function* *[event_list]* + +Call *function* and return two values: the result and a table of performance event counter tallies. + +#### Low-level interface + +— Function **setup** *event_list* + +Setup the hardware performance counters to track a given list of +events (in addition to the built-in fixed-function counters). + + Each event is a Lua string pattern. This could be a full event name: + +``` +mem_load_uops_retired.l1_hit +``` + +or a more general pattern that matches several counters: +``` +mem_load.*l._hit +``` + +Return the number of overflowed counters that could not be tracked due +to hardware constraints. These will be the last counters in the list. + +Example: + +``` +setup({"uops_issued.any", + "uops_retired.all", + "br_inst_retired.conditional", + "br_misp_retired.all_branches"}) => 0 +``` + +— Function **new_counter_set** + +Return a `counter_set` object that can be used for accumulating +events. The counter_set will be valid only until the next call to +setup(). + +— Function **switch_to** *counter_set* + +Switch to a new set of counters to accumulate events in. Has the +side-effect of committing the current accumulators to the +previous record. + +If *counter_set* is nil then do not accumulate events. + +— Function **to_table** *counter_set* + +Return a table containing the values accumulated in *counter_set*. + +Example: + +``` +to_table(cs) => + { + -- Fixed-function counters + instructions = 133973703, + cycles = 663011188, + ref-cycles = 664029720, + -- General purpose counters selected with setup() + uops_issued.any = 106860997, + uops_retired.all = 106844204, + br_inst_retired.conditional = 26702830, + br_misp_retired.all_branches = 419 + } +``` + +— Function **report** *counter_set* *[aux]* + +Print a textual report on the values accumulated in a counter set. +Optionally include auxiliary application-level counters. The ratio of +each event to each auxiliary counter is also reported. + +Example: +``` +report(my_counter_set, {packet = 26700000, breath = 208593}) +``` +prints output approximately like: +``` +EVENT TOTAL /packet /breath +instructions 133,973,703 5.000 642.000 +cycles 663,011,188 24.000 3178.000 +ref-cycles 664,029,720 24.000 3183.000 +uops_issued.any 106,860,997 4.000 512.000 +uops_retired.all 106,844,204 4.000 512.000 +br_inst_retired.conditional 26,702,830 1.000 128.000 +br_misp_retired.all_branches 419 0.000 0.000 +packet 26,700,000 1.000 128.000 +breath 208,593 0.008 1.000 +``` diff --git a/src/lib/pmu.lua b/src/lib/pmu.lua index 51acfa49fc..a97bf2124b 100644 --- a/src/lib/pmu.lua +++ b/src/lib/pmu.lua @@ -3,93 +3,7 @@ -- pmu.lua: Lua interface to the CPU Performance Monitoring Unit module(..., package.seeall) --- This module counts and reports on CPU events such as cache misses, --- branch mispredictions, utilization of internal CPU resources such --- as execution units, and so on. --- --- Hundreds of low-level counters are available. The exact list --- depends on CPU model. See pmu_cpu.lua for our definitions. --- --- API: --- --- profile(fn[, event_list, aux]) => value [and print report] --- Execute 'fn' and print a measurement report for event_list. --- This is a simple convenience function over the API below. --- --- measure(fn[, event_list]) => result, table {counter->value} --- Execute 'fn' and return the event counters as a second value. --- This is a convenience similar to profile(). --- --- is_available() => true | false, why --- Return true if hardware performance counters are available. --- Otherwise return false with a string briefly explaining why. --- --- setup(event_list) --- Setup the hardware performance counters to track a given list of --- events (in addition to the built-in fixed-function counters). --- --- Each event is a Lua string pattern. This could be a full event name: --- 'mem_load_uops_retired.l1_hit' --- or a more general pattern that matches several counters: --- 'mem_load.*l._hit' --- --- Return the number of overflowed counters that could not be --- tracked due to hardware constraints. These will be the last --- counters in the list. --- --- Example: --- setup({"uops_issued.any", --- "uops_retired.all", --- "br_inst_retired.conditional", --- "br_misp_retired.all_branches"}) => 0 --- --- new_counter_set() --- Return a "counter_set" object that can be used for accumulating events. --- --- The counter_set will be valid only until the next call to setup(). --- --- switch_to(counter_set) --- Switch_To to a new set of counters to accumulate events in. Has the --- side-effect of committing the current accumulators to the --- previous record. --- --- If counter_set is nil then do not accumulate events. --- --- to_table(counter_set) => table {eventname = count} --- Return a table containing the values accumulated in the counter set. --- --- Example: --- to_table(cs) => --- { --- -- Fixed-function counters --- instructions = 133973703, --- cycles = 663011188, --- ref-cycles = 664029720, --- -- General purpose counters selected with setup() --- uops_issued.any = 106860997, --- uops_retired.all = 106844204, --- br_inst_retired.conditional = 26702830, --- br_misp_retired.all_branches = 419 --- } --- --- report(counter_set, aux) --- Print a textual report on the values accumulated in a counter set. --- Optionally include auxiliary application-level counters. The --- ratio of each event to each auxiliary counter is also reported. --- --- Example: --- report(my_counter_set, {packet = 26700000, breath = 208593}) --- prints output approximately like: --- EVENT TOTAL /packet /breath --- instructions 133,973,703 5.000 642.000 --- cycles 663,011,188 24.000 3178.000 --- ref-cycles 664,029,720 24.000 3183.000 --- uops_issued.any 106,860,997 4.000 512.000 --- uops_retired.all 106,844,204 4.000 512.000 --- br_inst_retired.conditional 26,702,830 1.000 128.000 --- br_misp_retired.all_branches 419 0.000 0.000 --- packet 26,700,000 1.000 128.000 --- breath 208,593 0.008 1.000 +-- See README.pmu.md for API and examples. local pmu_cpu = require("lib.pmu_cpu") local pmu_x86 = require("lib.pmu_x86") From 7e63b78f9f1361576e2235b34a90f3c6bd3ed3ef Mon Sep 17 00:00:00 2001 From: Luke Gorrie Date: Mon, 29 Feb 2016 05:02:43 +0000 Subject: [PATCH 27/28] lib/README.checksum.md: New file Extracted the documentation for the checksum module from the source code and into a separate markdown-formatted README file. --- src/lib/README.checksum.md | 38 ++++++++++++++++++++++++++++++++++++++ src/lib/checksum.lua | 29 +---------------------------- 2 files changed, 39 insertions(+), 28 deletions(-) create mode 100644 src/lib/README.checksum.md diff --git a/src/lib/README.checksum.md b/src/lib/README.checksum.md new file mode 100644 index 0000000000..b598145d95 --- /dev/null +++ b/src/lib/README.checksum.md @@ -0,0 +1,38 @@ +### IP checksum (lib.checksum) + +The checksum module provides an optimized ones-complement checksum +routine. + +— Function **ipsum** *pointer* *length* *initial* + +Return the ones-complement checksum for the given region of memory. + +*pointer* is a pointer to an array of data to be checksummed. *initial* +is an unsigned 16-bit number in host byte order which is used as +the starting value of the accumulator. The result is the IP +checksum over the data in host byte order. + +The *initial* argument can be used to verify a checksum or to +calculate the checksum in an incremental manner over chunks of +memory. The synopsis to check whether the checksum over a block of +data is equal to a given value is the following + +``` +if ipsum(pointer, length, value) == 0 then + -- checksum correct +else + -- checksum incorrect +end +``` + +To chain the calculation of checksums over multiple blocks of data +together to obtain the overall checksum, one needs to pass the +one's complement of the checksum of one block as initial value to +the call of ipsum() for the following block, e.g. + +``` +local sum1 = ipsum(data1, length1, 0) +local total_sum = ipsum(data2, length2, bit.bnot(sum1)) +``` + +This function takes advantage of SIMD hardware when available. diff --git a/src/lib/checksum.lua b/src/lib/checksum.lua index ea90238738..05ebc07849 100644 --- a/src/lib/checksum.lua +++ b/src/lib/checksum.lua @@ -2,34 +2,7 @@ module(...,package.seeall) --- This module exposes the interface: --- checksum.ipsum(pointer, length, initial) => checksum --- --- pointer is a pointer to an array of data to be checksummed. initial --- is an unsigned 16-bit number in host byte order which is used as --- the starting value of the accumulator. The result is the IP --- checksum over the data in host byte order. --- --- The initial argument can be used to verify a checksum or to --- calculate the checksum in an incremental manner over chunks of --- memory. The synopsis to check whether the checksum over a block of --- data is equal to a given value is the following --- --- if ipsum(pointer, length, value) == 0 then --- -- checksum correct --- else --- -- checksum incorrect --- end --- --- To chain the calculation of checksums over multiple blocks of data --- together to obtain the overall checksum, one needs to pass the --- one's complement of the checksum of one block as initial value to --- the call of ipsum() for the following block, e.g. --- --- local sum1 = ipsum(data1, length1, 0) --- local total_sum = ipsum(data2, length2, bit.bnot(sum1)) --- --- The actual implementation is chosen based on running CPU. +-- See README.checksum.md for API. require("lib.checksum_h") local lib = require("core.lib") From a490d6821ad0880a33d636910218d75cd81d337c Mon Sep 17 00:00:00 2001 From: Luke Gorrie Date: Mon, 29 Feb 2016 05:05:58 +0000 Subject: [PATCH 28/28] doc/genbook.sh: Updated paths to lib/ README files --- src/doc/genbook.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/doc/genbook.sh b/src/doc/genbook.sh index d1a2c84e93..e6ddef654f 100755 --- a/src/doc/genbook.sh +++ b/src/doc/genbook.sh @@ -53,7 +53,11 @@ $(cat ../apps/socket/README.md) # Libraries -$(cat ../lib/README.md) +$(cat ../lib/README.checksum.md) + +$(cat ../lib/README.ctable.md) + +$(cat ../lib/README.pmu.md) ## Hardware