Skip to content

Commit

Permalink
Merge PR #1499 (Release 2023-14: Caspar) into master
Browse files Browse the repository at this point in the history
  • Loading branch information
eugeneia committed Apr 7, 2023
2 parents 885ac52 + 7cc72ae commit c7bbb51
Show file tree
Hide file tree
Showing 25 changed files with 1,086 additions and 301 deletions.
12 changes: 11 additions & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ RMSRC = $(shell find . -name '*.md' -not -regex './obj.*' -printf '%P ')
PROGRAM = $(shell find program -regex '^[^/]+/[^/]+' -type d -printf '%P ')
# sort to eliminate potential duplicate of programs.inc
INCSRC = $(sort $(shell find . -regex '[^\#]*\.inc' -printf '%P ') programs.inc)
EVTSRC = $(sort $(shell find . -regex '[^\#]*\.events' -printf '%P '))
YANGSRC= $(shell find . -regex '[^\#]*\.yang' -printf '%P ')

LUAOBJ := $(patsubst %.lua,obj/%_lua.o,$(LUASRC))
Expand All @@ -35,6 +36,7 @@ JITOBJS:= $(patsubst %,obj/jit_%.o,$(JITSRC))
EXTRAOBJS := obj/jit_tprof.o obj/jit_vmprof.o obj/strict.o
RMOBJS := $(patsubst %,obj/%,$(RMSRC))
INCOBJ := $(patsubst %.inc,obj/%_inc.o, $(INCSRC))
EVTOBJ := $(patsubst %.events,obj/%_events.o, $(EVTSRC))
YANGOBJ:= $(patsubst %.yang,obj/%_yang.o, $(YANGSRC))
EXE := bin/snabb $(patsubst %,bin/%,$(PROGRAM))

Expand All @@ -54,7 +56,7 @@ TESTSCRIPTS = $(shell find . -name "selftest.*" -executable | xargs)

PATH := ../lib/luajit/src:$(PATH)

snabb: $(LUAOBJ) $(PFLUAOBJ) $(HOBJ) $(COBJ) $(ASMOBJ) $(PFLUAASMOBJ) $(INCOBJ) $(YANGOBJ) $(LUAJIT_A)
snabb: $(LUAOBJ) $(PFLUAOBJ) $(HOBJ) $(COBJ) $(ASMOBJ) $(PFLUAASMOBJ) $(INCOBJ) $(EVTOBJ) $(YANGOBJ) $(LUAJIT_A)
$(E) "GEN obj/version.lua.gen"
$(Q) ../generate-version-lua.sh > obj/version.lua.gen
$(E) "LUA obj/version.lua"
Expand All @@ -77,6 +79,7 @@ $(EXE): snabb bin
$(Q) upx -f --brute -o$@ snabb
@echo -n "BINARY "
@ls -sh $@

markdown: $(RMOBJS)

test: $(TESTMODS) $(TESTSCRIPTS)
Expand Down Expand Up @@ -168,6 +171,13 @@ $(INCOBJ): obj/%_inc.o: %.inc Makefile | $(OBJDIR)
echo "]=============]") > $(basename $@).luainc
$(Q) raptorjit -bg -n $(subst /,.,$*)_inc $(basename $@).luainc $@

$(EVTOBJ): obj/%_events.o: %.events Makefile | $(OBJDIR)
$(E) "EVENTS $@"
@(echo -n "return [=============["; \
cat $<; \
echo "]=============]") > $(basename $@).luainc
$(Q) raptorjit -bg -n $(subst /,.,$*)_events $(basename $@).luainc $@

$(YANGOBJ): obj/%_yang.o: %.yang Makefile | $(OBJDIR)
$(E) "YANG $@"
@(echo -n "return [=============["; \
Expand Down
40 changes: 0 additions & 40 deletions src/apps/interlink/freelist_instrument.lua

This file was deleted.

20 changes: 2 additions & 18 deletions src/apps/interlink/test_sink.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,10 @@ function configure (c, name)
config.link(c, name..".output -> sink.input")
end

function start (name, duration)
function start (name, duration, core)
numa.bind_to_cpu(core, 'skip')
local c = config.new()
configure(c, name)
engine.configure(c)
engine.main{duration=duration}
end

local instr = require("apps.interlink.freelist_instrument")

function start_instrument (name, duration, core)
numa.bind_to_cpu(core, 'skip')
local rebalance_latency = instr.instrument_freelist()
start(name, duration)
instr.histogram_csv(rebalance_latency, "rebalance")
local min, avg, max = rebalance_latency:summarize()
io.stderr:write(("(%d) rebalance latency (ns) min:%16s avg:%16s max:%16s\n")
:format(core,
lib.comma_value(math.floor(min)),
lib.comma_value(math.floor(avg)),
lib.comma_value(math.floor(max))))
io.stderr:flush()
end

29 changes: 7 additions & 22 deletions src/apps/interlink/test_source.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,19 @@ function start (name, duration)
engine.main{duration=duration}
end

function startn (name, duration, n)
function startn (name, duration, n, core)
numa.bind_to_cpu(core, 'skip')
local c = config.new()
for i=1,n do
configure(c, name..i)
end
engine.configure(c)
engine.main{duration=duration}
local txpackets = txpackets()
engine.main{duration=1, no_report=true}
io.stderr:write(("%.3f Mpps\n"):format(txpackets / 1e6 / duration))
io.stderr:flush()
--engine.report_links()
end

function txpackets ()
Expand All @@ -36,24 +42,3 @@ function txpackets ()
end
return txpackets
end

local instr = require("apps.interlink.freelist_instrument")

function startn_instrument (name, duration, n, core)
numa.bind_to_cpu(core, 'skip')
local _, reclaim_latency = instr.instrument_freelist()
startn(name, duration, n)
local txpackets = txpackets()
instr.histogram_csv(reclaim_latency, "reclaim")
local min, avg, max = reclaim_latency:summarize()
engine.main{duration=1, no_report=true}
io.stderr:write(("(%d) reclaim latency (ns) min:%16s avg:%16s max:%16s\n")
:format(core,
lib.comma_value(math.floor(min)),
lib.comma_value(math.floor(avg)),
lib.comma_value(math.floor(max))))
io.stderr:write(("%.3f Mpps\n"):format(txpackets / 1e6 / duration))
io.stderr:flush()

--engine.report_links()
end
7 changes: 2 additions & 5 deletions src/apps/interlink/wait_test.snabb
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,12 @@ for core in pairs(CPUS) do
table.sort(cores)
end

require("apps.interlink.freelist_instrument").histogram_csv_header()
io.stdout:flush()

for i=1,NCONSUMERS do
worker.start("sink"..i, ([[require("apps.interlink.test_sink").start_instrument(%q, %d, %s)]])
worker.start("sink"..i, ([[require("apps.interlink.test_sink").start(%q, %d, %s)]])
:format("test"..i, DURATION, cores[1+i]))
end

worker.start("source", ([[require("apps.interlink.test_source").startn_instrument(%q, %d, %d, %s)]])
worker.start("source", ([[require("apps.interlink.test_source").startn(%q, %d, %d, %s)]])
:format("test", DURATION, NCONSUMERS, assert(cores[1])))

engine.main{done = function ()
Expand Down
5 changes: 0 additions & 5 deletions src/apps/rss/metadata.lua
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,6 @@ local ipv6_ext_hdr_fns = {
local payload_len = ext_hdr.length
return payload_len * 4 - 2, next_header
end,
[59] =
-- No next header
function(ptr)
return 0, 255
end,
[60] =
-- Destination
ipv6_generic_ext_hdr,
Expand Down
35 changes: 35 additions & 0 deletions src/core/app.events
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
1,9|started:
The app has been started. (Returned from new() callback.)

1,9|linked:
The app has been linked. (Returned from link() callback.)

1,9|unlinked:
The app has been unlinked. (Returned from unlink() callback.)

1,9|reconfigured:
The app has been reconfigured. (Returned from reconfig() callback.)

1,9|stopped:
The app has been stopped. (Returned from stop() callback.)


3,3|pull:
Entering app pull() callback.

3,3|pulled:
Returned from app pull() callback.


3,3|push:
Entering app push() callback.

3,3|pushed:
Returned from app push() callback.


3,5|tick:
Entering app tick() callback.

3,5|ticked:
Returned from app tick() callback.
Loading

0 comments on commit c7bbb51

Please sign in to comment.