OSDN Git Service

bnxt_en: Improve link up detection.
authorMichael Chan <michael.chan@broadcom.com>
Mon, 27 Jan 2020 09:56:13 +0000 (04:56 -0500)
committerDavid S. Miller <davem@davemloft.net>
Mon, 27 Jan 2020 10:33:28 +0000 (11:33 +0100)
commit83d8f5e92d034a4c4a04d780107e73af31a38504
treec7c4929c6abec8d5fdd877d77e862eea41783ef5
parentdb038b1b277886e3a082175a6ef6c1d4da17715d
bnxt_en: Improve link up detection.

In bnxt_update_phy_setting(), ethtool_get_link_ksettings() and
bnxt_disable_an_for_lpbk(), we inconsistently use netif_carrier_ok()
to determine link.  Instead, we should use bp->link_info.link_up
which has the true link state.  The netif_carrier state may be off
during self-test and while the device is being reset and may not always
reflect the true link state.

By always using bp->link_info.link_up, the code is now more
consistent and more correct.  Some unnecessary link toggles are
now prevented with this patch.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c