Skip to content

Commit

Permalink
connectx4: Add 'mtu' paramter (default 9500)
Browse files Browse the repository at this point in the history
Now also explicitly sets promiscuous mode on the ethernet port.
  • Loading branch information
lukego committed Nov 8, 2016
1 parent f08da3c commit ffe4a22
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/apps/mellanox/connectx4.lua
Expand Up @@ -71,6 +71,8 @@ function ConnectX4:new (conf)
local sendq_size = conf.sendq_size or 1024
local recvq_size = conf.recvq_size or 1024

local mtu = conf.mtu or 9500

-- Perform a hard reset of the device to bring it into a blank state.
--
-- Reset is performed at PCI level instead of via firmware command.
Expand Down Expand Up @@ -106,6 +108,8 @@ function ConnectX4:new (conf)

if debug_trace then self:check_vport() end

hca:modify_nic_vport_context(mtu, true, true, true)

-- Create basic objects that we need
--
local uar = hca:alloc_uar()
Expand Down Expand Up @@ -552,6 +556,17 @@ function HCA:query_nic_vport_context ()
permanent_address = mac_hex }
end

function HCA:modify_nic_vport_context (mtu, promisc_uc, promisc_mc, promisc_all)
self:command("MODIFY_NIC_VPORT_CONTEXT", 0x1FC, 0x0C)
:input("opcode", 0x00, 31, 16, 0x755)
:input("field_select", 0x0C, 31, 0, 0x50) -- MTU + promisc
:input("mtu", 0x100 + 0x24, 15, 0, mtu)
:input("promisc_uc", 0x100 + 0xF0, 31, 31, promisc_uc and 1 or 0)
:input("promisc_mc", 0x100 + 0xF0, 30, 30, promisc_mc and 1 or 0)
:input("promisc_all", 0x100 + 0xF0, 29, 29, promisc_all and 1 or 0)
:execute()
end

---------------------------------------------------------------
-- TIR and TIS
---------------------------------------------------------------
Expand Down

0 comments on commit ffe4a22

Please sign in to comment.