diff options
author | David Decotigny <decot@google.com> | 2011-04-14 12:11:34 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-18 02:28:57 -0400 |
commit | b3337e4cea15beb167e8d3a70ca1023e39abb4e5 (patch) | |
tree | fe657cf315e65df8a27771fc6c5359f2594b100d | |
parent | a01c1335a308ee660518e33db03fb5f5e1dfc166 (diff) |
bnx2x: cosmetics: Using ethtool_cmd_speed() API
This updates bnx2x to use the ethtool_cmd_speed() family of functions
(see b11f8d8c in 2.6.27-rc3 aka. "ethtool: Expand ethtool_cmd.speed to
32 bits") to get and set the link speed via ethtool. This allows to
avoid manually accessing ethtool_cmd's speed_hi field.
Signed-off-by: David Decotigny <decot@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/bnx2x/bnx2x_ethtool.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/net/bnx2x/bnx2x_ethtool.c b/drivers/net/bnx2x/bnx2x_ethtool.c index 0a5e88d6ba2c..e711a2292446 100644 --- a/drivers/net/bnx2x/bnx2x_ethtool.c +++ b/drivers/net/bnx2x/bnx2x_ethtool.c | |||
@@ -167,6 +167,7 @@ static int bnx2x_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
167 | { | 167 | { |
168 | struct bnx2x *bp = netdev_priv(dev); | 168 | struct bnx2x *bp = netdev_priv(dev); |
169 | int cfg_idx = bnx2x_get_link_cfg_idx(bp); | 169 | int cfg_idx = bnx2x_get_link_cfg_idx(bp); |
170 | |||
170 | /* Dual Media boards present all available port types */ | 171 | /* Dual Media boards present all available port types */ |
171 | cmd->supported = bp->port.supported[cfg_idx] | | 172 | cmd->supported = bp->port.supported[cfg_idx] | |
172 | (bp->port.supported[cfg_idx ^ 1] & | 173 | (bp->port.supported[cfg_idx ^ 1] & |
@@ -176,16 +177,16 @@ static int bnx2x_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
176 | if ((bp->state == BNX2X_STATE_OPEN) && | 177 | if ((bp->state == BNX2X_STATE_OPEN) && |
177 | !(bp->flags & MF_FUNC_DIS) && | 178 | !(bp->flags & MF_FUNC_DIS) && |
178 | (bp->link_vars.link_up)) { | 179 | (bp->link_vars.link_up)) { |
179 | cmd->speed = bp->link_vars.line_speed; | 180 | ethtool_cmd_speed_set(cmd, bp->link_vars.line_speed); |
180 | cmd->duplex = bp->link_vars.duplex; | 181 | cmd->duplex = bp->link_vars.duplex; |
181 | } else { | 182 | } else { |
182 | 183 | ethtool_cmd_speed_set( | |
183 | cmd->speed = bp->link_params.req_line_speed[cfg_idx]; | 184 | cmd, bp->link_params.req_line_speed[cfg_idx]); |
184 | cmd->duplex = bp->link_params.req_duplex[cfg_idx]; | 185 | cmd->duplex = bp->link_params.req_duplex[cfg_idx]; |
185 | } | 186 | } |
186 | 187 | ||
187 | if (IS_MF(bp)) | 188 | if (IS_MF(bp)) |
188 | cmd->speed = bnx2x_get_mf_speed(bp); | 189 | ethtool_cmd_speed_set(cmd, bnx2x_get_mf_speed(bp)); |
189 | 190 | ||
190 | if (bp->port.supported[cfg_idx] & SUPPORTED_TP) | 191 | if (bp->port.supported[cfg_idx] & SUPPORTED_TP) |
191 | cmd->port = PORT_TP; | 192 | cmd->port = PORT_TP; |
@@ -206,10 +207,11 @@ static int bnx2x_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
206 | cmd->maxrxpkt = 0; | 207 | cmd->maxrxpkt = 0; |
207 | 208 | ||
208 | DP(NETIF_MSG_LINK, "ethtool_cmd: cmd %d\n" | 209 | DP(NETIF_MSG_LINK, "ethtool_cmd: cmd %d\n" |
209 | DP_LEVEL " supported 0x%x advertising 0x%x speed %d\n" | 210 | DP_LEVEL " supported 0x%x advertising 0x%x speed %u\n" |
210 | DP_LEVEL " duplex %d port %d phy_address %d transceiver %d\n" | 211 | DP_LEVEL " duplex %d port %d phy_address %d transceiver %d\n" |
211 | DP_LEVEL " autoneg %d maxtxpkt %d maxrxpkt %d\n", | 212 | DP_LEVEL " autoneg %d maxtxpkt %d maxrxpkt %d\n", |
212 | cmd->cmd, cmd->supported, cmd->advertising, cmd->speed, | 213 | cmd->cmd, cmd->supported, cmd->advertising, |
214 | ethtool_cmd_speed(cmd), | ||
213 | cmd->duplex, cmd->port, cmd->phy_address, cmd->transceiver, | 215 | cmd->duplex, cmd->port, cmd->phy_address, cmd->transceiver, |
214 | cmd->autoneg, cmd->maxtxpkt, cmd->maxrxpkt); | 216 | cmd->autoneg, cmd->maxtxpkt, cmd->maxrxpkt); |
215 | 217 | ||
@@ -226,16 +228,15 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
226 | return 0; | 228 | return 0; |
227 | 229 | ||
228 | DP(NETIF_MSG_LINK, "ethtool_cmd: cmd %d\n" | 230 | DP(NETIF_MSG_LINK, "ethtool_cmd: cmd %d\n" |
229 | " supported 0x%x advertising 0x%x speed %d speed_hi %d\n" | 231 | " supported 0x%x advertising 0x%x speed %u\n" |
230 | " duplex %d port %d phy_address %d transceiver %d\n" | 232 | " duplex %d port %d phy_address %d transceiver %d\n" |
231 | " autoneg %d maxtxpkt %d maxrxpkt %d\n", | 233 | " autoneg %d maxtxpkt %d maxrxpkt %d\n", |
232 | cmd->cmd, cmd->supported, cmd->advertising, cmd->speed, | 234 | cmd->cmd, cmd->supported, cmd->advertising, |
233 | cmd->speed_hi, | 235 | ethtool_cmd_speed(cmd), |
234 | cmd->duplex, cmd->port, cmd->phy_address, cmd->transceiver, | 236 | cmd->duplex, cmd->port, cmd->phy_address, cmd->transceiver, |
235 | cmd->autoneg, cmd->maxtxpkt, cmd->maxrxpkt); | 237 | cmd->autoneg, cmd->maxtxpkt, cmd->maxrxpkt); |
236 | 238 | ||
237 | speed = cmd->speed; | 239 | speed = ethtool_cmd_speed(cmd); |
238 | speed |= (cmd->speed_hi << 16); | ||
239 | 240 | ||
240 | if (IS_MF_SI(bp)) { | 241 | if (IS_MF_SI(bp)) { |
241 | u32 part; | 242 | u32 part; |
@@ -439,7 +440,7 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
439 | break; | 440 | break; |
440 | 441 | ||
441 | default: | 442 | default: |
442 | DP(NETIF_MSG_LINK, "Unsupported speed %d\n", speed); | 443 | DP(NETIF_MSG_LINK, "Unsupported speed %u\n", speed); |
443 | return -EINVAL; | 444 | return -EINVAL; |
444 | } | 445 | } |
445 | 446 | ||