aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cxgb3/cxgb3_main.c
diff options
context:
space:
mode:
authorDivy Le Ray <divy@chelsio.com>2008-10-08 20:39:31 -0400
committerDavid S. Miller <davem@davemloft.net>2008-10-08 20:39:31 -0400
commit9b1e36566c5fafbcc732c971acfcf8580332931a (patch)
tree2c779d712f07f0b097ad1a2041779597b7ca9bbc /drivers/net/cxgb3/cxgb3_main.c
parentf231e0a5a2d01da40515c24f1daa689fe8cfd8d7 (diff)
cxgb3: commnonize LASI phy code
Add generic code to manage interrupt driven PHYs. Do not reset the phy after link parameters update, the new values might get lost. Return early from link change notification when the link parameters remain unchanged. Signed-off-by: Divy Le Ray <divy@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/cxgb3/cxgb3_main.c')
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 5b8251decbdc..bddcf945d6bb 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -1516,11 +1516,22 @@ static int speed_duplex_to_caps(int speed, int duplex)
1516 1516
1517static int set_settings(struct net_device *dev, struct ethtool_cmd *cmd) 1517static int set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
1518{ 1518{
1519 int cap;
1519 struct port_info *p = netdev_priv(dev); 1520 struct port_info *p = netdev_priv(dev);
1520 struct link_config *lc = &p->link_config; 1521 struct link_config *lc = &p->link_config;
1521 1522
1522 if (!(lc->supported & SUPPORTED_Autoneg)) 1523 if (!(lc->supported & SUPPORTED_Autoneg)) {
1523 return -EOPNOTSUPP; /* can't change speed/duplex */ 1524 /*
1525 * PHY offers a single speed/duplex. See if that's what's
1526 * being requested.
1527 */
1528 if (cmd->autoneg == AUTONEG_DISABLE) {
1529 cap = speed_duplex_to_caps(cmd->speed, cmd->duplex);
1530 if (lc->supported & cap)
1531 return 0;
1532 }
1533 return -EINVAL;
1534 }
1524 1535
1525 if (cmd->autoneg == AUTONEG_DISABLE) { 1536 if (cmd->autoneg == AUTONEG_DISABLE) {
1526 int cap = speed_duplex_to_caps(cmd->speed, cmd->duplex); 1537 int cap = speed_duplex_to_caps(cmd->speed, cmd->duplex);
@@ -2195,7 +2206,7 @@ static int cxgb_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
2195 mmd = data->phy_id >> 8; 2206 mmd = data->phy_id >> 8;
2196 if (!mmd) 2207 if (!mmd)
2197 mmd = MDIO_DEV_PCS; 2208 mmd = MDIO_DEV_PCS;
2198 else if (mmd > MDIO_DEV_XGXS) 2209 else if (mmd > MDIO_DEV_VEND2)
2199 return -EINVAL; 2210 return -EINVAL;
2200 2211
2201 ret = 2212 ret =
@@ -2221,7 +2232,7 @@ static int cxgb_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
2221 mmd = data->phy_id >> 8; 2232 mmd = data->phy_id >> 8;
2222 if (!mmd) 2233 if (!mmd)
2223 mmd = MDIO_DEV_PCS; 2234 mmd = MDIO_DEV_PCS;
2224 else if (mmd > MDIO_DEV_XGXS) 2235 else if (mmd > MDIO_DEV_VEND2)
2225 return -EINVAL; 2236 return -EINVAL;
2226 2237
2227 ret = 2238 ret =