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

Sundry improvements for July or August 2016 #959

Merged
merged 14 commits into from
Jul 1, 2016
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
13 changes: 8 additions & 5 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
# Run like this:
# nix-build /path/to/this/directory
# ... and the files are produced in ./result/
# ... and the files are produced in ./result/bin/snabb

{ pkgs ? (import <nixpkgs> {})
, source ? ./.
, version ? "dev"
}:

with pkgs;

stdenv.mkDerivation rec {
# TODO: get the version from somewhere?
name = "snabb";

src = ./.;
name = "snabb-${version}";
inherit version;
src = lib.cleanSource source;

buildInputs = [ makeWrapper ];

Expand All @@ -36,4 +37,6 @@ stdenv.mkDerivation rec {
mkdir -p $out/bin
cp src/snabb $out/bin
'';

enableParallelBuilding = true;
}
15 changes: 7 additions & 8 deletions release.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ let
url = "http://lab1.snabb.co:2008/~max/assets/vm-ubuntu-trusty-14.04-dpdk-snabb.tar.gz";
sha256 = "0323591i925jhd6wv8h268wc3ildjpa6j57n4p9yg9d6ikwkw06j";
};
optionalGetEnv = first: default: let
maybeEnv = builtins.getEnv first;
in if (maybeEnv != "") then maybeEnv else default;
requiredGetEnv = var: let
maybeEnv = builtins.getEnv var;
in if (maybeEnv != "") then maybeEnv else throw "Please export shell variable ${var}";
in rec {
manual = import ./src/doc {};
snabb = import ./default.nix {};
Expand All @@ -26,7 +26,7 @@ in rec {

# allow sudo
__noChroot = true;
requiredSystemFeatures = [ "performance" ];
requiredSystemFeatures = [ "lugano" ];

buildInputs = [ git telnet tmux numactl bc iproute which qemu ];

Expand All @@ -45,10 +45,9 @@ in rec {

doCheck = true;
checkPhase = ''
export SNABB_PCI0=${ optionalGetEnv "SNABB_PCI0" "0000:01:00.0"}
export SNABB_PCI_INTEL0=${ optionalGetEnv "SNABB_PCI_INTEL0" "0000:01:00.0"}
export SNABB_PCI_INTEL1=${ optionalGetEnv "SNABB_PCI_INTEL1" "0000:01:00.1"}
export FAIL_ON_FIRST=true
export SNABB_PCI0=${ requiredGetEnv "SNABB_PCI0" }
export SNABB_PCI_INTEL0=${ requiredGetEnv "SNABB_PCI_INTEL0" }
export SNABB_PCI_INTEL1=${ requiredGetEnv "SNABB_PCI_INTEL1" }

# run tests
sudo -E make test -C src/
Expand Down
8 changes: 4 additions & 4 deletions src/apps/intel/intel1g.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
-- Note: section and page numbers in the comments below refer to the i210 data sheet

-- run selftest() on APU2's second/middle NIC:
-- sudo SNABB_SELFTEST_INTEL1G_0="0000:02:00.0" ./snabb snsh -t apps.intel.intel1g
-- sudo SNABB_PCI_INTEL1G0="0000:02:00.0" ./snabb snsh -t apps.intel.intel1g

-- Note: rxqueue >0 not working yet!

Expand Down Expand Up @@ -107,7 +107,7 @@ function Intel1g:new(conf)
-- Setup device access
pci.unbind_device_from_linux(pciaddress)
pci.set_bus_master(pciaddress, true)
local regs, mmiofd = pci.map_pci_memory(pciaddress, 0)
local regs, mmiofd = pci.map_pci_memory_locked(pciaddress, 0)

-- Common utilities, see snabb/src/lib/hardware/register.lua
local function bitvalue (value)
Expand Down Expand Up @@ -632,9 +632,9 @@ end -- function Intel1g:new()

function selftest ()
print("selftest: Intel1g")
local pciaddr = os.getenv("SNABB_SELFTEST_INTEL1G_0")
local pciaddr = os.getenv("SNABB_PCI_INTEL1G0")
if not pciaddr then
print("SNABB_SELFTEST_INTEL1G_0 not set")
print("SNABB_PCI_INTEL1G0 not set")
os.exit(engine.test_skipped_code)
end

Expand Down
3 changes: 2 additions & 1 deletion src/core/timer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ local C = ffi.C

local lib = require("core.lib")

debug = _G.developer_debug
-- Enable only when debugging this module. Can be very verbose.
local debug = false

ticks = false -- current time, in ticks
ns_per_tick = 1e6 -- tick resolution (millisecond)
Expand Down
3 changes: 3 additions & 0 deletions src/doc/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ the tests:
`SNABB_PCI1` in Intel specific tests. Some Intel specific tests (namely
packetblaster based benchmarks) will be skipped if these are not set.

* `SNABB_PCI_INTEL1G0`, `SNABB_PCI_INTEL1G1`—Optional PCI addresses for use in
Intel1G selftest.

* `SNABB_PCI_SOLARFLARE0`, `SNABB_PCI_SOLARFLARE1`—Optional PCI addresses
of two wired Solarflare NICs. These are preferred over `SNABB_PCI0` and
`SNABB_PCI1` in Solarflare specific tests.
Expand Down
2 changes: 2 additions & 0 deletions src/scripts/dock.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ docker run --rm --privileged -i -v $(dirname $PWD):/snabb $DOCKERFLAGS \
-e SNABB_PCI1=$SNABB_PCI1 \
-e SNABB_PCI_INTEL0=$SNABB_PCI_INTEL0 \
-e SNABB_PCI_INTEL1=$SNABB_PCI_INTEL1 \
-e SNABB_PCI_INTEL1G0=$SNABB_PCI_INTEL1G0 \
-e SNABB_PCI_INTEL1G1=$SNABB_PCI_INTEL1G1 \
-e SNABB_PCI_SOLARFLARE0=$SNABB_PCI_SOLARFLARE0 \
-e SNABB_PCI_SOLARFLARE1=$SNABB_PCI_SOLARFLARE1 \
-e SNABB_TELNET0=$SNABB_TELNET0 \
Expand Down