diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2013-11-08 08:17:54 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2013-11-08 08:17:54 +0000 |
commit | 7bd3a7bc7b21a98a6ba3198a3ecb94a6a16716f6 (patch) | |
tree | 6d71ae3959319d29533d9602b4f1061babbef2a3 /package/base-files/files/lib/functions.sh | |
parent | f02c8802e363317211ce72b62c29a89911019769 (diff) | |
download | mtk-20170518-7bd3a7bc7b21a98a6ba3198a3ecb94a6a16716f6.zip mtk-20170518-7bd3a7bc7b21a98a6ba3198a3ecb94a6a16716f6.tar.gz mtk-20170518-7bd3a7bc7b21a98a6ba3198a3ecb94a6a16716f6.tar.bz2 |
ar71xx: ag71xx: fix a race involving netdev registration
In particular, phy_connect before register_netdev. This is because
register_netdev runs the netdev notifiers, which can race with the rest of
the initialization in ag71xx_probe. In my case this manifested in two ways:
1) If ag71xx is compiled as a module and inserted after netifd has started,
netifd is notified by register_netdev before the call to
ag71xx_phy_connect. netifd tries to bring the interface up, which calls
ag71xx_open, which in turn enters ag71xx_phy_start. This keys off
ag->phy_dev (which is still NULL) and thinks this is a fixed-link board,
and enters ag71xx_link_adjust. This looks at ag->speed which is not yet
initialized and hits the BUG() in the switch (ag->speed) in
ag71xx_link_adjust.
This is the wrong code path for ag71xx_phy_start - my board has PHYs that
need to be brought up with phy_start. Doing ag71xx_phy_connect before
register_netdev ensures that ag->phy_dev is non-NULL before
ag71xx_phy_start is ever called.
2) When ag71xx is built into the kernel, and netconsole is enabled, there
is a gap in the initial burst of replayed printks right after the netdev
comes up. My assumption is that netconsole is also triggered by a netdev
notifier, and part of this printk burst happens before the call into
ag71xx_phy_connect, so part of the burst is lost while the PHY comes up.
This patch fixes the gap - all the printks before eth0 comes up are bursted
in full when netconsole initializes.
ag71xx_phy_connect_xxx no longer runs with a registered netdev, so the
logging has been adjusted accordingly to avoid "unregistered net_device" or
"eth%d" messages in dmesg.
Signed-off-by: Catalin Patulea <cat@vv.carleton.ca>
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
SVN-Revision: 38689
Diffstat (limited to 'package/base-files/files/lib/functions.sh')
0 files changed, 0 insertions, 0 deletions