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

Vf/4018/env variables #130

Closed
wants to merge 18 commits into from

Conversation

vladfedin
Copy link
Contributor

See issue #120.

Several hardcoded paths and values now can be defined as environment variables:

  • SNABB_VFIO_DRIVER
    Default value "/sys/bus/pci/drivers/vfio-pci"
  • SNABB_VFIO_IOMMU_GROUPS
    Default value "/sys/kernel/iommu_groups"
  • SNABB_PCI_DEVICE
    Default value "/sys/bus/pci/devices"
  • SNABB_TEST_PCI_ID
    Default value "0000:01:00.0"
  • SNABB_HUGEPAGES
    Default value "/proc/sys/vm/nr_hugepages"
  • SNABB_MEMINFO
    Default value "/proc/meminfo"

'src/doc/hacking.md' file added with variables listing and examples.

@lukego
Copy link
Member

lukego commented Mar 31, 2014

Great hacking!! I'll give more specific feedback on the line comments.

@@ -12,6 +12,10 @@ local intel10g = require("apps.intel.intel10g")
local vfio = require("lib.hardware.vfio")
local config = require("core.config")

-- default id of pci device used in test
-- This ID is used if the "SNABB_TEST_PCI_ID" environment variable is not defined
DEFAULT_TEST_PCI_ID = "0000:01:00.0"
Copy link
Member

Choose a reason for hiding this comment

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

I don't think there should be a default value for the PCI address. This is too machine-dependent. Instead this test should 'skip' if the address is not set manually via the environment variable.

also: please match the existing style of the code for capitalisation. maybe not obvious, but in this code it's lower_case_with_underscores for all function/variable/constant names (but CamelCase for classes). I don't say it's the best :-))

Choose a reason for hiding this comment

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

I suggest explicitly documenting lower_case for constants guideline in the README. UPPER_CASE for constants vs. lower_case for variables and function names is at least just as frequent (thanks to constants-as-C-macros).

@lukego
Copy link
Member

lukego commented Mar 31, 2014

Thanks for diving in and attacking the problem. I would say that the most important things to conditionalize are the PCI address for the 10G NIC (because most machines have no such PCI card and others will have it in different slots) and the filename for the vhost_user socket file. Those parameters should be mandatory and the tests should be skipped if they are not supplied (with a message saying why).

I don't think we need to conditionalize the proc/sys files because (afaik) we can reasonably expect them to have stable paths between servers (?). It could be nice to fail with a good error message if we don't find one of those files though.

@vladfedin
Copy link
Contributor Author

Fixed BIG_LETTERS naming, removed situational defaults, added few additional checks, including filename for the vhost_user socket file and updated doc accordingly. Thanks for feedback!

* SNABB_VHOST_USER_SOCKET_FILE
No default value

* SNABB_TEST_PCI_ID
Copy link
Member

Choose a reason for hiding this comment

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

I suggest we can have just two variables (names slightly changed from the above):

  • SNABB_TEST_VHOST_USER_SOCKET filename of the vhost_user socket file.
  • SNABB_TEST_INTEL10G_PCI_ID PCI ID of an Intel 82599 network device.

... which contain information that needs to be supplied by the developer to make the tests meaningful (otherwise they are better skipped).

I don't think that we need to have configuration options for the /proc and /sys paths (?) that should be consistent for Linux hosts.

@vladfedin
Copy link
Contributor Author

Obsolete, see #134.

@vladfedin vladfedin closed this Apr 3, 2014
dpino added a commit to dpino/snabb that referenced this pull request Nov 20, 2015
VLAN tag configuration should not require 0x8100 prefix
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.

4 participants