Skip to content

Commit

Permalink
Merged PR #593 (v2015.09 release) onto master
Browse files Browse the repository at this point in the history
  • Loading branch information
eugeneia committed Sep 4, 2015
2 parents 23292ed + 50e7852 commit 6c0545d
Show file tree
Hide file tree
Showing 14 changed files with 11,467 additions and 19 deletions.
2 changes: 1 addition & 1 deletion deps/luajit
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ E= @echo

# Required submodule versions.
# Defined here to detect version mismatches at build time.
LUAJIT_VSN := "v2.0.4-306-gfe56522"
LUAJIT_VSN := "v2.0.4-330-g5feb63a"
LJSYSCALL_VSN := "v0.10-65-g7081d97"
PFLUA_VSN := "5e2c56baa0cf1ec471719bac83e2a99c4e2d5495"

Expand Down
18 changes: 18 additions & 0 deletions src/apps/intel/intel_app.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module(...,package.seeall)

local zone = require("jit.zone")
local basic_apps = require("apps.basic.basic_apps")
local ffi = require("ffi")
local lib = require("core.lib")
local pci = require("lib.hardware.pci")
local register = require("lib.hardware.register")
Expand All @@ -11,6 +12,8 @@ local receive, transmit, full, empty = link.receive, link.transmit, link.full, l
Intel82599 = {}
Intel82599.__index = Intel82599

local C = ffi.C

-- The `driver' variable is used as a reference to the driver class in
-- order to interchangably use NIC drivers.
driver = Intel82599
Expand Down Expand Up @@ -165,7 +168,18 @@ function selftest ()
end
end

local device_info_a = pci.device_info(pcideva)
local device_info_b = pci.device_info(pcidevb)

sq_sq(pcideva, pcidevb)
if device_info_a.model == pci.model["82599_T3"] or
device_info_b.model == pci.model["82599_T3"] then
-- Test experience in the lab suggests that the 82599 T3 NIC
-- requires at least two seconds before it will reliably pass
-- traffic. The test case sleeps for this reason.
-- See https://github.com/SnabbCo/snabbswitch/pull/569
C.usleep(2e6)
end
engine.main({duration = 1, report={showlinks=true, showapps=false}})

do
Expand All @@ -185,6 +199,10 @@ function selftest ()
end

mq_sq(pcideva, pcidevb)
if device_info_a.model == pci.model["82599_T3"] or
device_info_b.model == pci.model["82599_T3"] then
C.usleep(2e6)
end
engine.main({duration = 1, report={showlinks=true, showapps=false}})

do
Expand Down
1 change: 1 addition & 0 deletions src/dasm_x86.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1151,6 +1151,7 @@ local map_op = {
bts_2 = "mrqdw:0FABRm|miqdw:0FBA5mU",

rdtsc_0 = "0F31", -- P1+
rdpmc_0 = "0F33",
cpuid_0 = "0FA2", -- P1+

-- floating point ops
Expand Down
7 changes: 0 additions & 7 deletions src/doc/branches.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@ The current state of each branch with respect to master is visible here:

Maintainer: Max Rottenkolber <[email protected]>

#### nfv

BRANCH: nfv git://github.com/lukego/snabbswitch
snabbnfv application development branch.

Maintainer: Luke Gorrie <[email protected]>

#### vpn

BRANCH: vpn git://github.com/alexandergall/snabbswitch
Expand Down
38 changes: 30 additions & 8 deletions src/lib/hardware/pci.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ function device_info (pciaddress)
info.pciaddress = pciaddress
info.vendor = lib.firstline(p.."/vendor")
info.device = lib.firstline(p.."/device")
info.model = which_model(info.vendor, info.device)
info.driver = which_driver(info.vendor, info.device)
if info.driver then
info.interface = lib.firstfile(p.."/net")
Expand All @@ -51,16 +52,37 @@ end
--- Return the path to the sysfs directory for `pcidev`.
function path(pcidev) return "/sys/bus/pci/devices/"..pcidev end

model = {
["82599_SFP"] = 'Intel 82599 SFP',
["82574L"] = 'Intel 82574L',
["82571"] = 'Intel 82571',
["82599_T3"] = 'Intel 82599 T3',
["X540"] = 'Intel X540',
}

-- Supported cards indexed by vendor and device id.
local cards = {
["0x8086"] = {
["0x10fb"] = {model = model["82599_SFP"], driver = 'apps.intel.intel_app'},
["0x10d3"] = {model = model["82574L"], driver = 'apps.intel.intel_app'},
["0x105e"] = {model = model["82571"], driver = 'apps.intel.intel_app'},
["0x151c"] = {model = model["82599_T3"], driver = 'apps.intel.intel_app'},
["0x1528"] = {model = model["X540"], driver = 'apps.intel.intel_app'},
},
["0x1924"] = {
["0x0903"] = {model = 'SFN7122F', driver = 'apps.solarflare.solarflare'}
},
}

-- Return the name of the Lua module that implements support for this device.
function which_driver (vendor, device)
if vendor == '0x8086' then
if device == '0x10fb' then return 'apps.intel.intel_app' end -- Intel 82599
if device == '0x10d3' then return 'apps.intel.intel_app' end -- Intel 82574L
if device == '0x105e' then return 'apps.intel.intel_app' end -- Intel 82571
elseif vendor == '0x1924' then
if device == '0x0903' then return 'apps.solarflare.solarflare' end
-- if device == '0x0803' then return 'apps.solarflare.solarflare' end
end
local card = cards[vendor] and cards[vendor][device]
return card and card.driver
end

function which_model (vendor, device)
local card = cards[vendor] and cards[vendor][device]
return card and card.model
end

--- ### Device manipulation.
Expand Down
Loading

0 comments on commit 6c0545d

Please sign in to comment.