Skip to content

Commit

Permalink
ipfix probe: add --rss-goups option to bench.snabb
Browse files Browse the repository at this point in the history
Also add template config to benchmark interlink setup.
  • Loading branch information
eugeneia committed Oct 5, 2022
1 parent b26e2ea commit d64e23c
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/program/ipfix/tests/bench.snabb
Expand Up @@ -19,18 +19,20 @@ local numa = require("lib.numa")
local worker = require("core.worker")
local lib = require("core.lib")

local function make_ipfix_config (template, pci0, cpus)
local function make_ipfix_config (pci0, opts)
local rss_groups = 0
local cpu_conf = ""
for cpu in pairs(cpus) do
for cpu in pairs(opts.cpu) do
rss_groups = rss_groups + 1
cpu_conf = cpu_conf..("cpu %d; "):format(cpu)
end
assert(rss_groups > 0, "Need at least one CPU core")
local config_template = lib.readfile(template, "*a")
local config_template = lib.readfile(opts.template, "*a")
local tmpfile = os.tmpname()
local f = assert(io.open(tmpfile, "w+"))
f:write(config_template:format(pci0, cpu_conf, rss_groups))
f:write(config_template:format(
pci0, cpu_conf, opts.rss_groups or rss_groups
))
assert(f:close())
return tmpfile
end
Expand Down Expand Up @@ -83,6 +85,7 @@ end
local long_opts = {
template = "t",
["exporter-name"] = "e",
["rss-groups"] = "r",
cpu = "c",
pcap = "p",
duration = "D",
Expand Down Expand Up @@ -112,6 +115,7 @@ local function parameters (args)
template = "program/ipfix/tests/bench_v4_v6.conf.template",
exporter_name = "e1",
cpu = nil,
rss_groups = nil,
pcap = "program/ipfix/tests/sanitized4k_truncated128.pcap",
duration = 10,
loadgen_cpu = nil,
Expand All @@ -124,6 +128,9 @@ local function parameters (args)
function handlers.e (arg)
opts.exporter_name = arg
end
function handlers.r (arg)
opts.rss_groups = assert(tonumber(arg), "rss-groups is not a number!")
end
function handlers.c (arg)
opts.cpu = numa.parse_cpuset(arg)
end
Expand All @@ -143,7 +150,7 @@ local function parameters (args)
opts.flow_Hz = assert(tonumber(arg), "freq is not a number!")
end

local args = lib.dogetopt(args, handlers, "t:e:c:p:D:l:q:f:", long_opts)
local args = lib.dogetopt(args, handlers, "t:e:r:c:p:D:l:q:f:", long_opts)
if #args < 2 or not (opts.cpu and opts.loadgen_cpu) then show_usage(1) end
local pci0 = table.remove(args, 1)
local pci1 = table.remove(args, 1)
Expand All @@ -152,7 +159,7 @@ end

local pci0, pci1, opts = parameters(main.parameters)

local ipfix_confpath = make_ipfix_config(opts.template, pci0, opts.cpu)
local ipfix_confpath = make_ipfix_config(pci0, opts)

local probe_pid = worker.start('ipfix_probe',
([[require("program.ipfix.probe.probe").run{
Expand Down
36 changes: 36 additions & 0 deletions src/program/ipfix/tests/bench_v4_v6_interlink.conf.template
@@ -0,0 +1,36 @@
snabbflow-config {
interface {
device %q;
}
rss {
cpu-pool { %s }
hardware-scaling { rss-groups %d; }
software-scaling {
exporter { name e1; embed false; instances 2;}
}
}
flow-director {
default-class { exporter e1; }
remove-ipv6-extension-headers true;
}
ipfix {
idle-timeout 30;
active-timeout 600;
scan-time 10;
cache-size 8000000;
exporter-ip 10.0.0.1;
collector-pool { name c1; collector { ip 10.0.0.2; port 1234; } }
maps {
pfx4-to-as { file "program/ipfix/tests/maps/pfx4_to_as.csv"; }
pfx6-to-as { file "program/ipfix/tests/maps/pfx6_to_as.csv"; }
vlan-to-ifindex { file "program/ipfix/tests/maps/vlan_to_ifindex"; }
mac-to-as { file "program/ipfix/tests/maps/mac_to_as"; }
}
exporter {
name e1;
template "v4_extended";
template "v6_extended";
collector-pool c1;
}
}
}

0 comments on commit d64e23c

Please sign in to comment.