Skip to content

Commit

Permalink
lwaftr: keep full config in worker setup
Browse files Browse the repository at this point in the history
Instead of stripping other instances/queues from per-worker configurations,
add the instance and queue id to to worker configurations.
  • Loading branch information
eugeneia committed Sep 2, 2021
1 parent 4a80091 commit d4a1083
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 24 deletions.
15 changes: 3 additions & 12 deletions src/apps/lwaftr/lwutil.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,9 @@ local ntohs = lib.ntohs

-- Return device PCI address, queue ID, and queue configuration.
function parse_instance(conf)
local device, instance
for k, v in pairs(conf.softwire_config.instance) do
assert(device == nil, "configuration has more than one instance")
device, instance = k, v
end
assert(device ~= nil, "configuration has no instance")
local id, queue
for k, v in pairs(instance.queue) do
assert(id == nil, "configuration has more than one RSS queue")
id, queue = k, v
end
assert(id ~= nil, "configuration has no RSS queues")
local device = conf.worker_config.device
local id = conf.worker_config.queue_id
local queue = conf.softwire_config.instance[device].queue[id]
return device, id, queue
end

Expand Down
13 changes: 13 additions & 0 deletions src/lib/yang/snabb-softwire-v2.yang
Original file line number Diff line number Diff line change
Expand Up @@ -886,5 +886,18 @@ module snabb-softwire-v2 {
}
}

container worker-config {
description
"Worker process configuration state. The contained leaves are used only
internally. Setting them has no effect.";

leaf device {
type string;
}
leaf queue-id {
type uint8;
}
}

uses state-counters;
}
13 changes: 1 addition & 12 deletions src/program/lwaftr/setup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -701,18 +701,7 @@ local function compute_worker_configs(conf)
for id, _ in pairs(queues.queue) do
local worker_id = string.format('%s/%s', device, id)
local worker_config = make_copy()
local instance = worker_config.softwire_config.instance
for other_device, queues in pairs(conf.softwire_config.instance) do
if other_device ~= device then
instance[other_device] = nil
else
for other_id, _ in pairs(queues.queue) do
if other_id ~= id then
instance[device].queue[other_id] = nil
end
end
end
end
worker_config.worker_config = {device=device, queue_id=id}
ret[worker_id] = worker_config
end
end
Expand Down

0 comments on commit d4a1083

Please sign in to comment.