-
Notifications
You must be signed in to change notification settings - Fork 296
Open
Description
Hello, I'm trying to understand how snabb works with real nic.
From what I've read I should use the intel_mp
application, here is a dump of sudo lshw -class network -businfo
:
Bus info Périphérique Classe Description
============================================================
pci@0000:01:00.0 enp1s0f0 network 82580 Gigabit Network Connection
pci@0000:01:00.1 enp1s0f1 network 82580 Gigabit Network Connection
pci@0000:01:00.2 enp1s0f2 network 82580 Gigabit Network Connection
pci@0000:01:00.3 enp1s0f3 network 82580 Gigabit Network Connection
pci@0000:02:00.0 eth5 network I210 Gigabit Network Connection
pci@0000:03:00.0 eno1 network I210 Gigabit Network Connection
pci@0000:04:00.0 enp4s0f0 network 82599ES 10-Gigabit SFI/SFP+ Network Connection
pci@0000:04:00.1 enp4s0f1 network 82599ES 10-Gigabit SFI/SFP+ Network Connection
docker0 network Ethernet interface
So by reading the documentation here http://snabbco.github.io/#intel-i210-i350-82599-ethernet-controller-apps-apps.intel_mp.intel_mp I guess I could run a program on either of theses interfaces : eth5, eno1, enp4s0f0, enp4s0f1
.
So I wrote a little program like that :
module(..., package.seeall)
local app = require("core.app")
local intel_mp = require("apps.intel_mp.intel_mp").Intel
local switch = require("program.learningswitch.switch")
function run (parameters)
local c = config.new()
config.app(c, "learning", switch.Switch, parameters)
config.app(c, "nic", intel_mp, {pciaddr="0000:04:00.0"})
config.link(c, "nic.tx -> learning.input")
engine.configure(c)
engine.main({duration=10, report = {showlinks=true}})
end
With the switch.lua
being that :
module(..., package.seeall)
Switch = {}
function Switch:new ()
print("init switch")
local o = { route = {} }
return setmetatable(o, {__index = Switch})
end
function Switch:push()
for _, i in ipairs(self.input) do
for _ = 1, link.nreadable(i) do
print("got a packet")
local p = receive(i)
packet.free(p)
end
end
end
So my program should just print a message when it receive a packet and drop it.
But the thing is, when running this program I got this error :
% sudo ./snabb learningswitch
init switch
core/main.lua:26: Invalid argument
Stack Traceback
===============
(1) Lua function 'handler' at file 'core/main.lua:172' (best guess)
Local variables:
(*temporary) = string: "core/main.lua:26: Invalid argument"
(*temporary) = C function: print
(*temporary) = number: 6.91374e-310
(2) global C function 'error'
(3) Lua global 'assert' at file 'core/main.lua:26'
Local variables:
(*temporary) = nil
(4) Lua field 'map_pci_memory_unlocked' at file 'lib/hardware/pci.lua:161'
Local variables:
(*temporary) = string: "0000:04:00.0"
(*temporary) = number: 0
(*temporary) = boolean: false
(*temporary) = string: "/sys/bus/pci/devices/0000:04:00.0/resource0"
(*temporary) = nil
(5) Lua method 'new' at file 'apps/intel_mp/intel_mp.lua:396'
Local variables:
(*temporary) = table: 0x7f4551b42668 {rss_tab:function: 0x7f4551b44558, transmit:function: 0x7f4551b44130, rss_tab_build:function: 0x7f4551b44588 (more...)}
(*temporary) = table: 0x7f4551b46bb8 {mtu:9014, linkup_wait_recheck:0.1, rate_limit:0, linkup_wait:120, master_stats:true (more...)}
(*temporary) = table: 0x7f4551b48258 {shm_root:/intel-mp/04:00.0/, pciaddress:0000:04:00.0, rate_limit:0, vmdq:false (more...)}
(*temporary) = string: "0x8086"
(*temporary) = string: "0x10fb"
(*temporary) = table: 0x7f4551b43730 {driver:table: 0x7f4551b43440, registers:82599ES, max_q:16}
(6) Lua function 'ops' at file 'core/app.lua:378' (best guess)
Local variables:
(*temporary) = string: "nic2"
(*temporary) = table: 0x7f4551b42668 {rss_tab:function: 0x7f4551b44558, transmit:function: 0x7f4551b44130, rss_tab_build:function: 0x7f4551b44588 (more...)}
(*temporary) = table: 0x7f4551b46bb8 {mtu:9014, linkup_wait_recheck:0.1, rate_limit:0, linkup_wait:120, master_stats:true (more...)}
(7) Lua global 'apply_config_actions' at file 'core/app.lua:405'
Local variables:
= table: 0x7f4551b47578 {1:table: 0x7f4551b47608, 2:table: 0x7f4551b47740, 3:table: 0x7f4551b47870 (more...)}
(*temporary) = table: 0x7f4551b47b68 {unlink_output:function: 0x7f4551b47bb0, stop_app:function: 0x7f4551b47d90 (more...)}
(*temporary) = Lua function 'remove' (defined at line 325 of chunk core/app.lua)
(*temporary) = C function: builtin#6
(*temporary) = table: 0x7f4551b47578 {1:table: 0x7f4551b47608, 2:table: 0x7f4551b47740, 3:table: 0x7f4551b47870 (more...)}
(*temporary) = number: 2
(*temporary) = number: 2
(*temporary) = table: 0x7f4551b47740 {1:start_app, 2:table: 0x7f4551b47798}
(*temporary) = string: "start_app"
(*temporary) = table: 0x7f4551b47798 {1:nic2, 2:table: 0x7f4551b42668, 3:table: 0x7f4551b46bb8}
(8) Lua field 'configure' at file 'core/app.lua:166'
Local variables:
(*temporary) = table: 0x7f4551b46970 {links:table: 0x7f4551b46a38, apps:table: 0x7f4551b469b8}
(*temporary) = table: 0x7f4551b47578 {1:table: 0x7f4551b47608, 2:table: 0x7f4551b47740, 3:table: 0x7f4551b47870 (more...)}
(9) Lua field 'run' at file 'program/learningswitch/learningswitch.lua:41'
Local variables:
(*temporary) = table: 0x7f4551bf7ca0 {1:eno1}
(*temporary) = table: 0x7f4551b46970 {links:table: 0x7f4551b46a38, apps:table: 0x7f4551b469b8}
(10) Lua function 'main' at file 'core/main.lua:70' (best guess)
Local variables:
(*temporary) = string: "learningswitch"
(*temporary) = table: 0x7f4551bf7ca0 {1:eno1}
(11) global C function 'xpcall'
(12) main chunk of file 'core/main.lua' at line 246
(13) C function 'require'
(14) global C function 'pcall'
(15) main chunk of file 'core/startup.lua' at line 3
(16) global C function 'require'
(17) main chunk of [string "require "core.startup""] at line 1
nil
I've tried to use a different pci_addr but it did not change anything.
Metadata
Metadata
Assignees
Labels
No labels