* [PATCH 2.6.11 7/8] tg3: Fix ethtool set functions
@ 2005-03-21 8:13 Michael Chan
2005-03-22 20:59 ` Jeff Garzik
2005-03-23 19:14 ` David S. Miller
0 siblings, 2 replies; 3+ messages in thread
From: Michael Chan @ 2005-03-21 8:13 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev
[-- Attachment #1: Type: text/plain, Size: 401 bytes --]
Fix all relevant ethtool set functions to properly handle the
!netif_running() case. In most cases, the new settings are accepted without
setting the hardware if !netif_running(). The new settings will take effect
when the device is subsequently brought up. tg3_nway_reset() is the exception
where it will return -EAGAIN if !netif_running().
Signed-off-by: Michael Chan <mchan@broadcom.com>
[-- Attachment #2: tg3-7.patch --]
[-- Type: application/octet-stream, Size: 2659 bytes --]
diff -Nru 7/drivers/net/tg3.c 8/drivers/net/tg3.c
--- 7/drivers/net/tg3.c 2005-03-18 16:41:59.000000000 -0800
+++ 8/drivers/net/tg3.c 2005-03-20 21:51:53.000000000 -0800
@@ -6753,10 +6753,6 @@
{
struct tg3 *tp = netdev_priv(dev);
- if (!(tp->tg3_flags & TG3_FLAG_INIT_COMPLETE) ||
- tp->link_config.phy_is_low_power)
- return -EAGAIN;
-
cmd->supported = (SUPPORTED_Autoneg);
if (!(tp->tg3_flags & TG3_FLAG_10_100_ONLY))
@@ -6773,8 +6769,10 @@
cmd->supported |= SUPPORTED_FIBRE;
cmd->advertising = tp->link_config.advertising;
- cmd->speed = tp->link_config.active_speed;
- cmd->duplex = tp->link_config.active_duplex;
+ if (netif_running(dev)) {
+ cmd->speed = tp->link_config.active_speed;
+ cmd->duplex = tp->link_config.active_duplex;
+ }
cmd->port = 0;
cmd->phy_address = PHY_ADDR;
cmd->transceiver = 0;
@@ -6788,10 +6786,6 @@
{
struct tg3 *tp = netdev_priv(dev);
- if (!(tp->tg3_flags & TG3_FLAG_INIT_COMPLETE) ||
- tp->link_config.phy_is_low_power)
- return -EAGAIN;
-
if (tp->tg3_flags2 & TG3_FLG2_PHY_SERDES) {
/* These are the only valid advertisement bits allowed. */
if (cmd->autoneg == AUTONEG_ENABLE &&
@@ -6816,7 +6810,9 @@
tp->link_config.duplex = cmd->duplex;
}
- tg3_setup_phy(tp, 1);
+ if (netif_running(dev))
+ tg3_setup_phy(tp, 1);
+
spin_unlock(&tp->tx_lock);
spin_unlock_irq(&tp->lock);
@@ -6896,6 +6892,9 @@
u32 bmcr;
int r;
+ if (!netif_running(dev))
+ return -EAGAIN;
+
spin_lock_irq(&tp->lock);
r = -EINVAL;
tg3_readphy(tp, MII_BMCR, &bmcr);
@@ -6932,7 +6931,9 @@
(ering->tx_pending > TG3_TX_RING_SIZE - 1))
return -EINVAL;
- tg3_netif_stop(tp);
+ if (netif_running(dev))
+ tg3_netif_stop(tp);
+
spin_lock_irq(&tp->lock);
spin_lock(&tp->tx_lock);
@@ -6944,9 +6945,12 @@
tp->rx_jumbo_pending = ering->rx_jumbo_pending;
tp->tx_pending = ering->tx_pending;
- tg3_halt(tp);
- tg3_init_hw(tp);
- tg3_netif_start(tp);
+ if (netif_running(dev)) {
+ tg3_halt(tp);
+ tg3_init_hw(tp);
+ tg3_netif_start(tp);
+ }
+
spin_unlock(&tp->tx_lock);
spin_unlock_irq(&tp->lock);
@@ -6966,7 +6970,9 @@
{
struct tg3 *tp = netdev_priv(dev);
- tg3_netif_stop(tp);
+ if (netif_running(dev))
+ tg3_netif_stop(tp);
+
spin_lock_irq(&tp->lock);
spin_lock(&tp->tx_lock);
if (epause->autoneg)
@@ -6981,9 +6987,12 @@
tp->tg3_flags |= TG3_FLAG_TX_PAUSE;
else
tp->tg3_flags &= ~TG3_FLAG_TX_PAUSE;
- tg3_halt(tp);
- tg3_init_hw(tp);
- tg3_netif_start(tp);
+
+ if (netif_running(dev)) {
+ tg3_halt(tp);
+ tg3_init_hw(tp);
+ tg3_netif_start(tp);
+ }
spin_unlock(&tp->tx_lock);
spin_unlock_irq(&tp->lock);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2.6.11 7/8] tg3: Fix ethtool set functions
2005-03-21 8:13 [PATCH 2.6.11 7/8] tg3: Fix ethtool set functions Michael Chan
@ 2005-03-22 20:59 ` Jeff Garzik
2005-03-23 19:14 ` David S. Miller
1 sibling, 0 replies; 3+ messages in thread
From: Jeff Garzik @ 2005-03-22 20:59 UTC (permalink / raw)
To: Michael Chan; +Cc: David S. Miller, netdev
Michael Chan wrote:
> Fix all relevant ethtool set functions to properly handle the
> !netif_running() case. In most cases, the new settings are accepted without
> setting the hardware if !netif_running(). The new settings will take effect
> when the device is subsequently brought up. tg3_nway_reset() is the exception
> where it will return -EAGAIN if !netif_running().
>
>
> Signed-off-by: Michael Chan <mchan@broadcom.com
ACK
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2.6.11 7/8] tg3: Fix ethtool set functions
2005-03-21 8:13 [PATCH 2.6.11 7/8] tg3: Fix ethtool set functions Michael Chan
2005-03-22 20:59 ` Jeff Garzik
@ 2005-03-23 19:14 ` David S. Miller
1 sibling, 0 replies; 3+ messages in thread
From: David S. Miller @ 2005-03-23 19:14 UTC (permalink / raw)
To: Michael Chan; +Cc: netdev
On Mon, 21 Mar 2005 00:13:07 -0800
"Michael Chan" <mchan@broadcom.com> wrote:
> Fix all relevant ethtool set functions to properly handle the
> !netif_running() case. In most cases, the new settings are accepted without
> setting the hardware if !netif_running(). The new settings will take effect
> when the device is subsequently brought up. tg3_nway_reset() is the exception
> where it will return -EAGAIN if !netif_running().
>
> Signed-off-by: Michael Chan <mchan@broadcom.com>
Applied, thanks Michael.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-03-23 19:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-21 8:13 [PATCH 2.6.11 7/8] tg3: Fix ethtool set functions Michael Chan
2005-03-22 20:59 ` Jeff Garzik
2005-03-23 19:14 ` David S. Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).