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>
This commit is contained in:
committed by
David S. Miller
parent
f231e0a5a2
commit
9b1e36566c
@@ -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 =
|
||||
|
Reference in New Issue
Block a user