diff options
author | stephen hemminger <shemminger@vyatta.com> | 2011-04-04 07:06:37 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-06 17:35:21 -0400 |
commit | 32d3613475d8c7d2170313b9105499dece6a3735 (patch) | |
tree | d2a91c4f976a09e44a77a9c947e83876abf2f8a7 /drivers/net/bnx2x/bnx2x_ethtool.c | |
parent | 2e17e1aa80e914acd8a31a41b9bf1173186a976a (diff) |
bnx2x: convert to set_phys_id
Also cleanup error codes to no lie about things that driver doesn't
support. If device is down report -EAGAIN (same as Broadcom), and
if port doesn't blink then error as well.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2x/bnx2x_ethtool.c')
-rw-r--r-- | drivers/net/bnx2x/bnx2x_ethtool.c | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/drivers/net/bnx2x/bnx2x_ethtool.c b/drivers/net/bnx2x/bnx2x_ethtool.c index f5050155c6b5..147999459df5 100644 --- a/drivers/net/bnx2x/bnx2x_ethtool.c +++ b/drivers/net/bnx2x/bnx2x_ethtool.c | |||
@@ -2097,36 +2097,38 @@ static void bnx2x_get_ethtool_stats(struct net_device *dev, | |||
2097 | } | 2097 | } |
2098 | } | 2098 | } |
2099 | 2099 | ||
2100 | static int bnx2x_phys_id(struct net_device *dev, u32 data) | 2100 | static int bnx2x_set_phys_id(struct net_device *dev, |
2101 | enum ethtool_phys_id_state state) | ||
2101 | { | 2102 | { |
2102 | struct bnx2x *bp = netdev_priv(dev); | 2103 | struct bnx2x *bp = netdev_priv(dev); |
2103 | int i; | ||
2104 | 2104 | ||
2105 | if (!netif_running(dev)) | 2105 | if (!netif_running(dev)) |
2106 | return 0; | 2106 | return -EAGAIN; |
2107 | 2107 | ||
2108 | if (!bp->port.pmf) | 2108 | if (!bp->port.pmf) |
2109 | return 0; | 2109 | return -EOPNOTSUPP; |
2110 | 2110 | ||
2111 | if (data == 0) | 2111 | switch (state) { |
2112 | data = 2; | 2112 | case ETHTOOL_ID_ACTIVE: |
2113 | return -EINVAL; | ||
2113 | 2114 | ||
2114 | for (i = 0; i < (data * 2); i++) { | 2115 | case ETHTOOL_ID_ON: |
2115 | if ((i % 2) == 0) | 2116 | bnx2x_set_led(&bp->link_params, &bp->link_vars, |
2116 | bnx2x_set_led(&bp->link_params, &bp->link_vars, | 2117 | LED_MODE_OPER, SPEED_1000); |
2117 | LED_MODE_OPER, SPEED_1000); | 2118 | break; |
2118 | else | ||
2119 | bnx2x_set_led(&bp->link_params, &bp->link_vars, | ||
2120 | LED_MODE_OFF, 0); | ||
2121 | 2119 | ||
2122 | msleep_interruptible(500); | 2120 | case ETHTOOL_ID_OFF: |
2123 | if (signal_pending(current)) | 2121 | bnx2x_set_led(&bp->link_params, &bp->link_vars, |
2124 | break; | 2122 | LED_MODE_OFF, 0); |
2125 | } | ||
2126 | 2123 | ||
2127 | if (bp->link_vars.link_up) | 2124 | break; |
2128 | bnx2x_set_led(&bp->link_params, &bp->link_vars, LED_MODE_OPER, | 2125 | |
2129 | bp->link_vars.line_speed); | 2126 | case ETHTOOL_ID_INACTIVE: |
2127 | if (bp->link_vars.link_up) | ||
2128 | bnx2x_set_led(&bp->link_params, &bp->link_vars, | ||
2129 | LED_MODE_OPER, | ||
2130 | bp->link_vars.line_speed); | ||
2131 | } | ||
2130 | 2132 | ||
2131 | return 0; | 2133 | return 0; |
2132 | } | 2134 | } |
@@ -2218,7 +2220,7 @@ static const struct ethtool_ops bnx2x_ethtool_ops = { | |||
2218 | .self_test = bnx2x_self_test, | 2220 | .self_test = bnx2x_self_test, |
2219 | .get_sset_count = bnx2x_get_sset_count, | 2221 | .get_sset_count = bnx2x_get_sset_count, |
2220 | .get_strings = bnx2x_get_strings, | 2222 | .get_strings = bnx2x_get_strings, |
2221 | .phys_id = bnx2x_phys_id, | 2223 | .set_phys_id = bnx2x_set_phys_id, |
2222 | .get_ethtool_stats = bnx2x_get_ethtool_stats, | 2224 | .get_ethtool_stats = bnx2x_get_ethtool_stats, |
2223 | .get_rxnfc = bnx2x_get_rxnfc, | 2225 | .get_rxnfc = bnx2x_get_rxnfc, |
2224 | .get_rxfh_indir = bnx2x_get_rxfh_indir, | 2226 | .get_rxfh_indir = bnx2x_get_rxfh_indir, |