Skip to content

Commit

Permalink
apps.io: add support for pci type and intel_app.
Browse files Browse the repository at this point in the history
  • Loading branch information
eugeneia committed Nov 11, 2016
1 parent f22b5f8 commit 10cdbeb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/apps/intel/intel_app.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,21 @@ 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
-- The `io' variable is used by lib.hardware.pci to forward queue configuration
-- to NIC drivers.
io = {}
function io:configure (c, _, conf)
local nqueues, vmdq = 0, false
for _ in pairs(conf.queues) do
nqueues = nqueues + 1
if nqueues > 1 then vmdq = true; break end
end
for name, qconf in pairs(conf.queues) do
qconf.pciaddr = conf.device
qconf.vmdq = vmdq
config.app(c, name, Intel82599, qconf)
end
end

-- table pciaddr => {pf, vflist}
local devices = {}
Expand Down
7 changes: 7 additions & 0 deletions src/lib/hardware/pci.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module(...,package.seeall)

local io = require("apps.io.io")
local ffi = require("ffi")
local C = ffi.C
local S = require("syscall")
Expand Down Expand Up @@ -218,3 +219,9 @@ function print_device_summary ()
print(fmt:format(unpack(values)))
end
end


PCIDriver = io.register('pci', {})
function PCIDriver:configure (c, name, conf)
require(device_info(conf.device).driver).io:configure(c, name, conf)
end

0 comments on commit 10cdbeb

Please sign in to comment.