]> rtime.felk.cvut.cz Git - lisovros/qemu_apohw.git/commit
e1000: link auto-negotiation emulation
authorJason Wang <jasowang@redhat.com>
Thu, 22 Mar 2012 10:02:24 +0000 (18:02 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 25 Apr 2012 07:53:48 +0000 (10:53 +0300)
commitb9d03e352cb6b31a66545763f6a1e20c9abf0c2c
treec5928aa240eab6232edf6eaab46b9088fa65cbcf
parentf9c1cdf4928e6c036a6373e683d1774129a10311
e1000: link auto-negotiation emulation

Indeed, there's nothing else except for the time spent on the
negotiation needs to be emulated. This is needed for resuming windows
guest from hibernation, as without a proper delay, qemu would send the
packet too early ( guest even does not have a proper intr handler),
which could lead windows guest hang.

This patch first introduces an array of function pointers to make it
possible to emulate per-register write behavior. Then traps the
PHY_CTRL register write and when guest want to restart the link auto
negotiation, we would down the link and mark the auto negotiation in
progress in PHY_STATUS register. After time, a timer with 500 ms (
which is the minimum timeout of auto-negotation specified in 802.3
spec). The link would be up when timer expired.

Test with resuming windows guest plus flood ping and linux ethtool
linkstatus test.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/e1000.c