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

Fix selection of modes based on instance config #963

Merged
merged 3 commits into from
Sep 25, 2017
Merged

Conversation

tsyesika
Copy link

This fixes #957.

As #957 states there is a migration when --on-a-stick or --v4/--v6 is specified however it doesn't allow you to run in multiprocessing mode. The problem actually ended up being deeper than that. When you did provide one of these flags (or lack there of) it'd pick the appropriate mode based on the initial configuration and command line arguments and use that for everything. That means when a snabb config add command was issued, it will use whatever was appropriate when it initially started irregardless of what the configuration says.

The fix changes how the setup_fn we pass to setup.reconfiguration and thus the leader works. Instead of giving it for example setup.load_phy or setup.load_on_a_stick, etc. it provides a single setup_fn which takes in the graph and configuration (with a single instance) and decides based on that which mode to use.

I've tested on snabb1 that you can now provide an on-a-stick configuration and it'll configure itself in an on-a-stick fashion (I've also tested for bump-in-the-wire). I'd have liked to improve the unit tests around this to make them a bit more robust (especially with adding new instances) - to do that though I think i'd need something like #962.

Jessica Tallon added 2 commits September 22, 2017 16:16
When --on-a-stick command is used with a single instance defined it
should migrate the instance to work in a stick  (replace the device
with the one provided in the flag and remove the device in
`external-device`). It just checks that it works by not crashing and
says it's going to do it in the output.
Previously you could either configure the lwaftr with --v4/--v6 and
--on-a-stick and it'd then migrate the configuration provided and then
on every instance added subsequently it'd only use the mode selected
at the start despite what the configuration says. If no flag was
specified it'd only use --v4/--v6 for everything including new
configurations added without two devices.

It will now select the correct method based on the configuration
except in the case of --vertio which will cause it to always use the
virtual driver. Configurations can now contain a mix between
bump-in-the-wire and on-a-stick configurations and it'll choose it
appropriately. New configurations added by the `snabb config` tools
will also choose it based on the instance configuration for each
instance.
Copy link

@wingo wingo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff! I guess in some future followup we could move the logic as to whether it's on a stick or bump-in-the-wire to setup.lua, but for now this looks quite good enough.

local name, instance = next(lwconfig.softwire_config.instance)
local queue = instance.queue.values[1]
if queue.external_interface.device then
return setup.load_phy(graph, lwconfig, 'inetNick', 'b4sideNic',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inetNic

else
local use_splitter = requires_splitter(opts, lwconfig)
local options = {
v4_nic_name = 'inetNic', v6_nic_name = 'b4sideNick',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

b4sideNic

-- If instance has external-interface.device configure as bump-in-the-wire
-- otherwise configure it in on-a-stick mode.
local name, instance = next(lwconfig.softwire_config.instance)
local queue = instance.queue.values[1]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In some future we might want to configure this in a per-instance way, but then again maybe we shouldn't bother :)

@tsyesika tsyesika merged commit 6d058bb into lwaftr Sep 25, 2017
@wingo wingo deleted the 957-on-a-stick branch April 18, 2018 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support --on-a-stick with multiple instances
2 participants