r8169: link speed selection timer rework.
authorFrancois Romieu <romieu@fr.zoreil.com>
Fri, 11 Mar 2011 20:07:11 +0000 (21:07 +0100)
committerFrancois romieu <romieu@fr.zoreil.com>
Mon, 9 May 2011 19:03:03 +0000 (21:03 +0200)
commit4876cc1e49efac03827a51a2422cfbbb7f6335de
treec109b38ed92fa8c6bbd4620110bdccc4394f9181
parent826e6cbdadfa51495c7189641df2514cc48e23da
r8169: link speed selection timer rework.

The implementation was a bit krusty.

The 10s rtl8169_phy_timer timer has been (was ?) required with older
8169 for adequate phy operation when full gigabit is advertised in
autonegotiated mode. The timer does nothing if the link is up.
Otherwise it keeps resetting the phy until things improve.

- the device private data field phy_1000_ctrl_reg was used to
  schedule the timer. Avoid it and save a few bytes.

- rtl8169_set_settings
  pending timer is disabled before changing the link settings as
  rtl8169_phy_timer is not always needed (see the removed test in
  rtl8169_phy_timer).

- rtl8169_set_speed
  the requested link parameters may not match the chipset : bail out
  early on failure.

- rtl8169_open
  Calling rtl8169_request_timer is redundant with
  -> rtl8169_open
     -> rtl8169_init_phy
        -> rtl8169_set_speed
           -> mod_timer
  The latter always enables the phy timer whereas the former did not
  for RTL_GIGA_MAC_VER_01. It should not make things worse but only
  time will tell if reality agrees.

- rtl8169_request_timer : unused yet. Removed.

- rtl8169_delete_timer : useless. Bloat. Removed.

Side effect : the timer may kick in if the TBI is enabled. I do not
know if the TBI has ever been used in real life.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Realtek linux nic maintainers <nic_swsd@realtek.com>
drivers/net/r8169.c