cxgb3: commnonize LASI phy code
[linux-3.10.git] / drivers / net / cxgb3 / cxgb3_main.c
index 5b8251d..bddcf94 100644 (file)
@@ -1516,11 +1516,22 @@ static int speed_duplex_to_caps(int speed, int duplex)
 
 static int set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
+       int cap;
        struct port_info *p = netdev_priv(dev);
        struct link_config *lc = &p->link_config;
 
-       if (!(lc->supported & SUPPORTED_Autoneg))
-               return -EOPNOTSUPP;     /* can't change speed/duplex */
+       if (!(lc->supported & SUPPORTED_Autoneg)) {
+               /*
+                * PHY offers a single speed/duplex.  See if that's what's
+                * being requested.
+                */
+               if (cmd->autoneg == AUTONEG_DISABLE) {
+                       cap = speed_duplex_to_caps(cmd->speed, cmd->duplex);
+                       if (lc->supported & cap)
+                               return 0;
+               }
+               return -EINVAL;
+       }
 
        if (cmd->autoneg == AUTONEG_DISABLE) {
                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)
                        mmd = data->phy_id >> 8;
                        if (!mmd)
                                mmd = MDIO_DEV_PCS;
-                       else if (mmd > MDIO_DEV_XGXS)
+                       else if (mmd > MDIO_DEV_VEND2)
                                return -EINVAL;
 
                        ret =
@@ -2221,7 +2232,7 @@ static int cxgb_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
                        mmd = data->phy_id >> 8;
                        if (!mmd)
                                mmd = MDIO_DEV_PCS;
-                       else if (mmd > MDIO_DEV_XGXS)
+                       else if (mmd > MDIO_DEV_VEND2)
                                return -EINVAL;
 
                        ret =