]> git.baikalelectronics.ru Git - kernel.git/commit
sh_eth: fix invalid context bug while changing link options by ethtool
authorVladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Wed, 4 Jul 2018 08:12:40 +0000 (11:12 +0300)
committerDavid S. Miller <davem@davemloft.net>
Sat, 7 Jul 2018 01:44:09 +0000 (10:44 +0900)
commitecb3748a93def985aebe8982b73661730c91f26d
tree681336793f7f44a0b331b874e9e4bd31ee4a6016
parent633457906eb5380506fec49259bf5c85eb0a754a
sh_eth: fix invalid context bug while changing link options by ethtool

The change fixes sleep in atomic context bug, which is encountered
every time when link settings are changed by ethtool.

Since commit 4cb198f45dba ("PHYLIB: Locking fixes for PHY I/O
potentially sleeping") phy_start_aneg() function utilizes a mutex
to serialize changes to phy state, however that helper function is
called in atomic context under a grabbed spinlock, because
phy_start_aneg() is called by phy_ethtool_ksettings_set() and by
replaced phy_ethtool_sset() helpers from phylib.

Now duplex mode setting is enforced in sh_eth_adjust_link() only,
also now RX/TX is disabled when link is put down or modifications
to E-MAC registers ECMR and GECMR are expected for both cases of
checked and ignored link status pin state from E-MAC interrupt handler.

For reference the change is a partial rework of commit c47541367e8d
("sh_eth: fix handling of no LINK signal").

Fixes: 278047b57dd4 ("sh: sh_eth: Add support ethtool")
Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Reviewed-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/renesas/sh_eth.c