Skip to content

Commit

Permalink
intel_mp: Poll more frequently for linkup
Browse files Browse the repository at this point in the history
This patch lowers the link-up poll period from 2 seconds to 0.1
second, for faster reactions on link state change.  It also makes the
82599 linkup wait loop just wait on link state change, like the old
Intel82599 driver, instead of also doing reset logic in the wait loop.
  • Loading branch information
wingo committed May 16, 2017
1 parent a54da2e commit f601fcf
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 18 deletions.
6 changes: 6 additions & 0 deletions src/apps/intel_mp/README.md
Expand Up @@ -49,6 +49,12 @@ light or not. The default is `false`.
*Optional* Number of seconds `new` waits for the device to come up. The default
is 120.

— Key **linkup_wait_recheck**

*Optional* If the `linkup_wait` option is true, the number of seconds
to sleep between checking the link state again. The default is 0.1
seconds.

— Key **mtu**

*Optional* The maximum packet length sent or received, excluding the trailing
Expand Down
39 changes: 21 additions & 18 deletions src/apps/intel_mp/intel_mp.lua
Expand Up @@ -257,6 +257,7 @@ Intel = {
mtu = {default=9014},
rssseed = {default=314159},
linkup_wait = {default=120},
linkup_wait_recheck = {default=0.1},
wait_for_link = {default=false},
master_stats = {default=true},
run_stats = {default=false}
Expand Down Expand Up @@ -291,6 +292,8 @@ function Intel:new (conf)
mtu = conf.mtu or self.config.mtu.default,
rssseed = conf.rssseed or self.config.mtu.default,
linkup_wait = conf.linkup_wait or self.config.linkup_wait.default,
linkup_wait_recheck =
conf.linkup_wait_recheck or self.config.linkup_wait_recheck.default,
wait_for_link = conf.wait_for_link
}

Expand Down Expand Up @@ -757,10 +760,10 @@ function Intel1g:init ()
self.r.CTRL_EXT:set( bits { AutoSpeedDetect = 12, DriverLoaded = 28 })
self.r.RLPML(self.mtu + 4) -- mtu + crc
self:unlock_sw_sem()
for i=1, math.floor(self.linkup_wait/2) do
for i=1, math.floor(self.linkup_wait/self.linkup_wait_recheck) do
if self:link_status() then break end
if not self.wait_for_link then break end
C.usleep(2000000)
C.usleep(math.floor(self.linkup_wait_recheck * 1e6))
end
end

Expand Down Expand Up @@ -866,24 +869,24 @@ function Intel82599:init ()
pci.unbind_device_from_linux(self.pciaddress)
pci.set_bus_master(self.pciaddress, true)

for i=1,math.floor(self.linkup_wait/2) do
self:disable_interrupts()
local reset = bits{ LinkReset=3, DeviceReset=26 }
self.r.CTRL(reset)
C.usleep(1000)
self.r.CTRL:wait(reset, 0)
self.r.EEC:wait(bits{AutoreadDone=9}) -- 3.
self.r.RDRXCTL:wait(bits{DMAInitDone=3}) -- 4.

-- 4.6.4.2
-- 3.7.4.2
self.r.AUTOC:set(bits { LMS0 = 13, LMS1 = 14 })
self.r.AUTOC2(0)
self.r.AUTOC2:set(bits { tenG_PMA_PMD_Serial = 17 })
self.r.AUTOC:set(bits{restart_AN=12})
C.usleep(2000000)
self:disable_interrupts()
local reset = bits{ LinkReset=3, DeviceReset=26 }
self.r.CTRL(reset)
C.usleep(1000)
self.r.CTRL:wait(reset, 0)
self.r.EEC:wait(bits{AutoreadDone=9}) -- 3.
self.r.RDRXCTL:wait(bits{DMAInitDone=3}) -- 4.

-- 4.6.4.2
-- 3.7.4.2
self.r.AUTOC:set(bits { LMS0 = 13, LMS1 = 14 })
self.r.AUTOC2(0)
self.r.AUTOC2:set(bits { tenG_PMA_PMD_Serial = 17 })
self.r.AUTOC:set(bits{restart_AN=12})
for i=1,math.floor(self.linkup_wait/self.linkup_wait_recheck) do
if self:link_status() then break end
if not self.wait_for_link then break end
C.usleep(math.floor(self.linkup_wait_recheck * 1e6))
end

-- 4.6.7
Expand Down

0 comments on commit f601fcf

Please sign in to comment.