Skip to content

Commit

Permalink
cgxb4: Stop using ethtool SPEED_* constants
Browse files Browse the repository at this point in the history
ethtool speed values are just numbers of megabits and there is no need
to add SPEED_40000.  To be consistent, use integer constants directly
for all speeds.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ben Hutchings authored and David S. Miller committed Feb 25, 2014
1 parent 7debf78 commit e8b3901
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
20 changes: 10 additions & 10 deletions drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,16 +427,16 @@ static void link_report(struct net_device *dev)
const struct port_info *p = netdev_priv(dev);

switch (p->link_cfg.speed) {
case SPEED_10000:
case 10000:
s = "10Gbps";
break;
case SPEED_1000:
case 1000:
s = "1000Mbps";
break;
case SPEED_100:
case 100:
s = "100Mbps";
break;
case 40000: /* Need a SPEED_40000 in ethtool.h */
case 40000:
s = "40Gbps";
break;
}
Expand Down Expand Up @@ -2274,13 +2274,13 @@ static int get_settings(struct net_device *dev, struct ethtool_cmd *cmd)

static unsigned int speed_to_caps(int speed)
{
if (speed == SPEED_100)
if (speed == 100)
return FW_PORT_CAP_SPEED_100M;
if (speed == SPEED_1000)
if (speed == 1000)
return FW_PORT_CAP_SPEED_1G;
if (speed == SPEED_10000)
if (speed == 10000)
return FW_PORT_CAP_SPEED_10G;
if (speed == 40000) /* Need SPEED_40000 in ethtool.h */
if (speed == 40000)
return FW_PORT_CAP_SPEED_40G;
return 0;
}
Expand Down Expand Up @@ -2310,8 +2310,8 @@ static int set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
cap = speed_to_caps(speed);

if (!(lc->supported & cap) ||
(speed == SPEED_1000) ||
(speed == SPEED_10000) ||
(speed == 1000) ||
(speed == 10000) ||
(speed == 40000))
return -EINVAL;
lc->requested_speed = cap;
Expand Down
8 changes: 4 additions & 4 deletions drivers/net/ethernet/chelsio/cxgb4/t4_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -3567,13 +3567,13 @@ int t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl)
if (stat & FW_PORT_CMD_TXPAUSE)
fc |= PAUSE_TX;
if (stat & FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_100M))
speed = SPEED_100;
speed = 100;
else if (stat & FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_1G))
speed = SPEED_1000;
speed = 1000;
else if (stat & FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_10G))
speed = SPEED_10000;
speed = 10000;
else if (stat & FW_PORT_CMD_LSPEED(FW_PORT_CAP_SPEED_40G))
speed = 40000; /* Need SPEED_40000 in ethtool.h */
speed = 40000;

if (link_ok != lc->link_ok || speed != lc->speed ||
fc != lc->fc) { /* something changed */
Expand Down

0 comments on commit e8b3901

Please sign in to comment.