Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(intel10g): Restore adapter configuration state after selftest. #52

Merged
merged 1 commit into from
Apr 8, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/intel10g.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ end

function linkup () return bitset(r.LINKS(), 30) end

function get_configuration_state ()
return { AUTOC = r.AUTOC(), HLREG0 = r.HLREG0() }
end

function restore_configuration_state (saved_state)
r.AUTOC(saved_state.AUTOC)
r.HLREG0(saved_state.HLREG0)
end

function enable_mac_loopback ()
r.AUTOC:set(bits({ForceLinkUp=0, LMS10G=13}))
r.HLREG0:set(bits({Loop=15}))
Expand Down Expand Up @@ -209,6 +218,7 @@ end
function selftest ()
print("intel10g")
open()
local saved_state = get_configuration_state()
enable_mac_loopback()
test.waitfor("linkup", linkup, 20, 250000)
local finished = lib.timer(1e9)
Expand All @@ -220,6 +230,7 @@ function selftest ()
sync()
-- C.usleep(1)
until finished()
restore_configuration_state(saved_state)
assert(buffers[40960]==99)
C.usleep(1000)
print "stats"
Expand Down