From ffe4a22be3f5877fd03cf4fb1db8faf1b95ed934 Mon Sep 17 00:00:00 2001 From: Luke Gorrie Date: Tue, 8 Nov 2016 09:30:23 +0000 Subject: [PATCH] connectx4: Add 'mtu' paramter (default 9500) Now also explicitly sets promiscuous mode on the ethernet port. --- src/apps/mellanox/connectx4.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/apps/mellanox/connectx4.lua b/src/apps/mellanox/connectx4.lua index 3f4584a2cc..a2493a6995 100644 --- a/src/apps/mellanox/connectx4.lua +++ b/src/apps/mellanox/connectx4.lua @@ -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. @@ -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() @@ -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 ---------------------------------------------------------------