tg3: Update link_up flag for phylib devices
authorNithin Sujir <nsujir@broadcom.com>
Fri, 8 Mar 2013 08:01:24 +0000 (08:01 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 14 Mar 2013 18:26:25 +0000 (11:26 -0700)
commitc9fa7329af2e71971687a83ad1acaca31d73fd92
treed2f93293b519f6a8659ee088bb0cc7cc7a5eef9f
parent31eb1a20a9d717afa227464b782a3b78cb0f7d21
tg3: Update link_up flag for phylib devices

commit 84421b99cedc3443e76d2a594f3c815d5cb9a8e1 upstream.

Commit f4a46d1f46a8fece34edd2023e054072b02e110d introduced a bug where
the ifconfig stats would remain 0 for phylib devices. This is due to
tp->link_up flag never becoming true causing tg3_periodic_fetch_stats()
to return.

The link_up flag was being updated in tg3_test_and_report_link_chg()
after setting up the phy. This function however, is not called for
phylib devices since the driver does not do the phy setup.

This patch moves the link_up flag update into the common
tg3_link_report() function that gets called for phylib devices as well
for non phylib devices when the link state changes.

To avoid updating link_up twice, we replace tg3_carrier_...() calls that
are followed by tg3_link_report(), with netif_carrier_...(). We can then
remove the unused tg3_carrier_on() function.

Reported-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/broadcom/tg3.c