Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snabbflow integration (timeline, group freelist and interlink sizes) #1497

Merged
merged 7 commits into from
Apr 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/interlink.lua
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ local function describe (r)
[DOWN] = "deallocating"
})[r.state[0]]
end
return ("%d/%d (%s)"):format(queue_fill(r), size - 1, status(r))
return ("%d/%d (%s)"):format(queue_fill(r), r.size, status(r))
end

ffi.metatype("struct interlink", {__tostring=describe})
5 changes: 5 additions & 0 deletions src/lib/scheduling.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ local scheduling_opts = {
cpu = {}, -- CPU index (integer).
real_time = {}, -- Boolean.
max_packets = {}, -- Positive integer.
group_freelist_size = {},
ingress_drop_monitor = {}, -- Action string: one of 'flush' or 'warn'.
profile = {default=true}, -- Boolean.
busywait = {default=true}, -- Boolean.
Expand Down Expand Up @@ -61,6 +62,10 @@ function sched_apply.max_packets (max_packets)
packet.initialize(max_packets)
end

function sched_apply.group_freelist_size (nchunks)
packet.enable_group_freelist(nchunks)
end

function sched_apply.busywait (busywait)
engine.busywait = busywait
end
Expand Down
21 changes: 21 additions & 0 deletions src/lib/yang/snabb-snabbflow-v1.yang
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ module snabb-snabbflow-v1 {
description
"Configuration for the Snabbflow IPFIX exporter.";

revision 2023-03-15 {
description
"Added interlink and group freelist configuration options.";
}

revision 2022-04-27 {
description
"Initial draft.";
Expand Down Expand Up @@ -161,6 +166,22 @@ module snabb-snabbflow-v1 {
}
}
}

leaf group-freelist-size {
type uint32 { range 1024|2048|4096|8192; }
default 2048;
description
"Number of chunks allocated for the group freelist.
Each chunk holds up to 2048 packets. Must be a power of two.";
}

leaf interlink-size {
type uint32 { range 1024|2048|4096|8192|16384|32768|65536|131072|262144; }
default 65536;
description
"Capacity of inter-process packet queues in number of packets.
Must be a power of two.";
}
}
}

Expand Down
18 changes: 10 additions & 8 deletions src/program/ipfix/lib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,26 +65,28 @@ end

local function configure_interlink_input (config, in_graph)
config = lib.parse(config, {
name={required=true}
name={required=true},
size={required=true}
})
local graph = in_graph or app_graph.new()

local in_name = config.name

app_graph.app(graph, in_name, Receiver)
app_graph.app(graph, in_name, Receiver, { size = config.size })

return graph, {name=in_name, output='output'}
end

local function configure_interlink_output (config, in_graph)
config = lib.parse(config, {
name={required=true}
name={required=true},
size={required=true}
})
local graph = in_graph or app_graph.new()

local out_name = config.name

app_graph.app(graph, out_name, Transmitter)
app_graph.app(graph, out_name, Transmitter, { size = config.size })

return graph, {name=out_name, input='input'}
end
Expand Down Expand Up @@ -175,9 +177,9 @@ local function configure_ipfix_tap_instance (config, in_graph)
return graph, ipfix
end

function configure_interlink_ipfix_tap_instance (in_name, config)
function configure_interlink_ipfix_tap_instance (in_name, link_size, config)
local graph = app_graph.new()
local _, receiver = configure_interlink_input({name=in_name}, graph)
local _, receiver = configure_interlink_input({name=in_name, size=link_size}, graph)
local _, ipfix = configure_ipfix_tap_instance(config, graph)
link(graph, receiver, ipfix)

Expand Down Expand Up @@ -230,7 +232,7 @@ local function configure_rss_tap_instances (config, outputs, rss_group, in_graph
-- Keys
-- link_name name of the link
local _, transmitter = configure_interlink_output(
{name=output.link_name}, graph
{name=output.link_name, size=output.link_size}, graph
)
link(graph, rss, transmitter)
else
Expand Down Expand Up @@ -303,4 +305,4 @@ function configure_mlx_controller (devices)
need_ctrl = true
end
return ctrl_graph, need_ctrl
end
end
24 changes: 22 additions & 2 deletions src/program/ipfix/probe/probe.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,17 @@ local function update_cpuset (cpu_pool)
end
end

local probe_group_freelist_size

local function update_group_freelist_size (nchunks)
if not probe_group_freelist_size then
probe_group_freelist_size = nchunks
elseif probe_group_freelist_size ~= nchunks then
error("Can not change group-freelist-size after probe has started.")
end
return probe_group_freelist_size
end

local function warn (msg, ...)
io.stderr:write("Warning: "..msg:format(...).."\n")
io.stderr:flush()
Expand All @@ -86,6 +97,9 @@ function start (name, confpath)
busywait = busywait,
real_time = real_time,
profile = profile,
group_freelist_size = update_group_freelist_size(
conf.snabbflow_config.rss.software_scaling.group_freelist_size
),
jit_opt = {
sizemcode=256,
maxmcode=8192,
Expand Down Expand Up @@ -122,6 +136,8 @@ function setup_workers (config)
local flow_director = config.snabbflow_config.flow_director
local ipfix = config.snabbflow_config.ipfix

update_group_freelist_size(rss.software_scaling.group_freelist_size)

local collector_pools = {}
for name, p in pairs(ipfix.collector_pool) do
local collectors = {}
Expand Down Expand Up @@ -298,10 +314,14 @@ function setup_workers (config)
args = iconfig
}
else
output = { type = "interlink", link_name = rss_link }
output = {
type = "interlink",
link_name = rss_link,
link_size = rss.software_scaling.interlink_size
}
workers[rss_link] =
probe.configure_interlink_ipfix_tap_instance(
rss_link, iconfig
rss_link, output.link_size, iconfig
)
-- Dedicated exporter processes are restartable
worker_opts[rss_link] = {
Expand Down