mirror of https://gitee.com/openkylin/linux.git
net: Revert ksettings conversions.
Those were supposed to go into the net-next tree not the net tree. Oops... Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
b793f08167
commit
aac1561ad9
|
@ -1446,40 +1446,40 @@ static int smc911x_close(struct net_device *dev)
|
|||
* Ethtool support
|
||||
*/
|
||||
static int
|
||||
smc911x_ethtool_get_link_ksettings(struct net_device *dev,
|
||||
struct ethtool_link_ksettings *cmd)
|
||||
smc911x_ethtool_getsettings(struct net_device *dev, struct ethtool_cmd *cmd)
|
||||
{
|
||||
struct smc911x_local *lp = netdev_priv(dev);
|
||||
int ret, status;
|
||||
unsigned long flags;
|
||||
u32 supported;
|
||||
|
||||
DBG(SMC_DEBUG_FUNC, dev, "--> %s\n", __func__);
|
||||
cmd->maxtxpkt = 1;
|
||||
cmd->maxrxpkt = 1;
|
||||
|
||||
if (lp->phy_type != 0) {
|
||||
spin_lock_irqsave(&lp->lock, flags);
|
||||
ret = mii_ethtool_get_link_ksettings(&lp->mii, cmd);
|
||||
ret = mii_ethtool_gset(&lp->mii, cmd);
|
||||
spin_unlock_irqrestore(&lp->lock, flags);
|
||||
} else {
|
||||
supported = SUPPORTED_10baseT_Half |
|
||||
cmd->supported = SUPPORTED_10baseT_Half |
|
||||
SUPPORTED_10baseT_Full |
|
||||
SUPPORTED_TP | SUPPORTED_AUI;
|
||||
|
||||
if (lp->ctl_rspeed == 10)
|
||||
cmd->base.speed = SPEED_10;
|
||||
ethtool_cmd_speed_set(cmd, SPEED_10);
|
||||
else if (lp->ctl_rspeed == 100)
|
||||
cmd->base.speed = SPEED_100;
|
||||
ethtool_cmd_speed_set(cmd, SPEED_100);
|
||||
|
||||
cmd->base.autoneg = AUTONEG_DISABLE;
|
||||
cmd->base.port = 0;
|
||||
cmd->autoneg = AUTONEG_DISABLE;
|
||||
if (lp->mii.phy_id==1)
|
||||
cmd->transceiver = XCVR_INTERNAL;
|
||||
else
|
||||
cmd->transceiver = XCVR_EXTERNAL;
|
||||
cmd->port = 0;
|
||||
SMC_GET_PHY_SPECIAL(lp, lp->mii.phy_id, status);
|
||||
cmd->base.duplex =
|
||||
cmd->duplex =
|
||||
(status & (PHY_SPECIAL_SPD_10FULL_ | PHY_SPECIAL_SPD_100FULL_)) ?
|
||||
DUPLEX_FULL : DUPLEX_HALF;
|
||||
|
||||
ethtool_convert_legacy_u32_to_link_mode(
|
||||
cmd->link_modes.supported, supported);
|
||||
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
|
@ -1487,8 +1487,7 @@ smc911x_ethtool_get_link_ksettings(struct net_device *dev,
|
|||
}
|
||||
|
||||
static int
|
||||
smc911x_ethtool_set_link_ksettings(struct net_device *dev,
|
||||
const struct ethtool_link_ksettings *cmd)
|
||||
smc911x_ethtool_setsettings(struct net_device *dev, struct ethtool_cmd *cmd)
|
||||
{
|
||||
struct smc911x_local *lp = netdev_priv(dev);
|
||||
int ret;
|
||||
|
@ -1496,18 +1495,16 @@ smc911x_ethtool_set_link_ksettings(struct net_device *dev,
|
|||
|
||||
if (lp->phy_type != 0) {
|
||||
spin_lock_irqsave(&lp->lock, flags);
|
||||
ret = mii_ethtool_set_link_ksettings(&lp->mii, cmd);
|
||||
ret = mii_ethtool_sset(&lp->mii, cmd);
|
||||
spin_unlock_irqrestore(&lp->lock, flags);
|
||||
} else {
|
||||
if (cmd->base.autoneg != AUTONEG_DISABLE ||
|
||||
cmd->base.speed != SPEED_10 ||
|
||||
(cmd->base.duplex != DUPLEX_HALF &&
|
||||
cmd->base.duplex != DUPLEX_FULL) ||
|
||||
(cmd->base.port != PORT_TP &&
|
||||
cmd->base.port != PORT_AUI))
|
||||
if (cmd->autoneg != AUTONEG_DISABLE ||
|
||||
cmd->speed != SPEED_10 ||
|
||||
(cmd->duplex != DUPLEX_HALF && cmd->duplex != DUPLEX_FULL) ||
|
||||
(cmd->port != PORT_TP && cmd->port != PORT_AUI))
|
||||
return -EINVAL;
|
||||
|
||||
lp->ctl_rfduplx = cmd->base.duplex == DUPLEX_FULL;
|
||||
lp->ctl_rfduplx = cmd->duplex == DUPLEX_FULL;
|
||||
|
||||
ret = 0;
|
||||
}
|
||||
|
@ -1689,6 +1686,8 @@ static int smc911x_ethtool_geteeprom_len(struct net_device *dev)
|
|||
}
|
||||
|
||||
static const struct ethtool_ops smc911x_ethtool_ops = {
|
||||
.get_settings = smc911x_ethtool_getsettings,
|
||||
.set_settings = smc911x_ethtool_setsettings,
|
||||
.get_drvinfo = smc911x_ethtool_getdrvinfo,
|
||||
.get_msglevel = smc911x_ethtool_getmsglevel,
|
||||
.set_msglevel = smc911x_ethtool_setmsglevel,
|
||||
|
@ -1699,8 +1698,6 @@ static const struct ethtool_ops smc911x_ethtool_ops = {
|
|||
.get_eeprom_len = smc911x_ethtool_geteeprom_len,
|
||||
.get_eeprom = smc911x_ethtool_geteeprom,
|
||||
.set_eeprom = smc911x_ethtool_seteeprom,
|
||||
.get_link_ksettings = smc911x_ethtool_get_link_ksettings,
|
||||
.set_link_ksettings = smc911x_ethtool_set_link_ksettings,
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -691,8 +691,7 @@ static void cas_mif_poll(struct cas *cp, const int enable)
|
|||
}
|
||||
|
||||
/* Must be invoked under cp->lock */
|
||||
static void cas_begin_auto_negotiation(struct cas *cp,
|
||||
const struct ethtool_link_ksettings *ep)
|
||||
static void cas_begin_auto_negotiation(struct cas *cp, struct ethtool_cmd *ep)
|
||||
{
|
||||
u16 ctl;
|
||||
#if 1
|
||||
|
@ -705,16 +704,16 @@ static void cas_begin_auto_negotiation(struct cas *cp,
|
|||
if (!ep)
|
||||
goto start_aneg;
|
||||
lcntl = cp->link_cntl;
|
||||
if (ep->base.autoneg == AUTONEG_ENABLE) {
|
||||
if (ep->autoneg == AUTONEG_ENABLE)
|
||||
cp->link_cntl = BMCR_ANENABLE;
|
||||
} else {
|
||||
u32 speed = ep->base.speed;
|
||||
else {
|
||||
u32 speed = ethtool_cmd_speed(ep);
|
||||
cp->link_cntl = 0;
|
||||
if (speed == SPEED_100)
|
||||
cp->link_cntl |= BMCR_SPEED100;
|
||||
else if (speed == SPEED_1000)
|
||||
cp->link_cntl |= CAS_BMCR_SPEED1000;
|
||||
if (ep->base.duplex == DUPLEX_FULL)
|
||||
if (ep->duplex == DUPLEX_FULL)
|
||||
cp->link_cntl |= BMCR_FULLDPLX;
|
||||
}
|
||||
#if 1
|
||||
|
@ -4529,21 +4528,19 @@ static void cas_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info
|
|||
strlcpy(info->bus_info, pci_name(cp->pdev), sizeof(info->bus_info));
|
||||
}
|
||||
|
||||
static int cas_get_link_ksettings(struct net_device *dev,
|
||||
struct ethtool_link_ksettings *cmd)
|
||||
static int cas_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
|
||||
{
|
||||
struct cas *cp = netdev_priv(dev);
|
||||
u16 bmcr;
|
||||
int full_duplex, speed, pause;
|
||||
unsigned long flags;
|
||||
enum link_state linkstate = link_up;
|
||||
u32 supported, advertising;
|
||||
|
||||
advertising = 0;
|
||||
supported = SUPPORTED_Autoneg;
|
||||
cmd->advertising = 0;
|
||||
cmd->supported = SUPPORTED_Autoneg;
|
||||
if (cp->cas_flags & CAS_FLAG_1000MB_CAP) {
|
||||
supported |= SUPPORTED_1000baseT_Full;
|
||||
advertising |= ADVERTISED_1000baseT_Full;
|
||||
cmd->supported |= SUPPORTED_1000baseT_Full;
|
||||
cmd->advertising |= ADVERTISED_1000baseT_Full;
|
||||
}
|
||||
|
||||
/* Record PHY settings if HW is on. */
|
||||
|
@ -4551,15 +4548,17 @@ static int cas_get_link_ksettings(struct net_device *dev,
|
|||
bmcr = 0;
|
||||
linkstate = cp->lstate;
|
||||
if (CAS_PHY_MII(cp->phy_type)) {
|
||||
cmd->base.port = PORT_MII;
|
||||
cmd->base.phy_address = cp->phy_addr;
|
||||
advertising |= ADVERTISED_TP | ADVERTISED_MII |
|
||||
cmd->port = PORT_MII;
|
||||
cmd->transceiver = (cp->cas_flags & CAS_FLAG_SATURN) ?
|
||||
XCVR_INTERNAL : XCVR_EXTERNAL;
|
||||
cmd->phy_address = cp->phy_addr;
|
||||
cmd->advertising |= ADVERTISED_TP | ADVERTISED_MII |
|
||||
ADVERTISED_10baseT_Half |
|
||||
ADVERTISED_10baseT_Full |
|
||||
ADVERTISED_100baseT_Half |
|
||||
ADVERTISED_100baseT_Full;
|
||||
|
||||
supported |=
|
||||
cmd->supported |=
|
||||
(SUPPORTED_10baseT_Half |
|
||||
SUPPORTED_10baseT_Full |
|
||||
SUPPORTED_100baseT_Half |
|
||||
|
@ -4575,10 +4574,11 @@ static int cas_get_link_ksettings(struct net_device *dev,
|
|||
}
|
||||
|
||||
} else {
|
||||
cmd->base.port = PORT_FIBRE;
|
||||
cmd->base.phy_address = 0;
|
||||
supported |= SUPPORTED_FIBRE;
|
||||
advertising |= ADVERTISED_FIBRE;
|
||||
cmd->port = PORT_FIBRE;
|
||||
cmd->transceiver = XCVR_INTERNAL;
|
||||
cmd->phy_address = 0;
|
||||
cmd->supported |= SUPPORTED_FIBRE;
|
||||
cmd->advertising |= ADVERTISED_FIBRE;
|
||||
|
||||
if (cp->hw_running) {
|
||||
/* pcs uses the same bits as mii */
|
||||
|
@ -4590,20 +4590,21 @@ static int cas_get_link_ksettings(struct net_device *dev,
|
|||
spin_unlock_irqrestore(&cp->lock, flags);
|
||||
|
||||
if (bmcr & BMCR_ANENABLE) {
|
||||
advertising |= ADVERTISED_Autoneg;
|
||||
cmd->base.autoneg = AUTONEG_ENABLE;
|
||||
cmd->base.speed = ((speed == 10) ?
|
||||
cmd->advertising |= ADVERTISED_Autoneg;
|
||||
cmd->autoneg = AUTONEG_ENABLE;
|
||||
ethtool_cmd_speed_set(cmd, ((speed == 10) ?
|
||||
SPEED_10 :
|
||||
((speed == 1000) ?
|
||||
SPEED_1000 : SPEED_100));
|
||||
cmd->base.duplex = full_duplex ? DUPLEX_FULL : DUPLEX_HALF;
|
||||
SPEED_1000 : SPEED_100)));
|
||||
cmd->duplex = full_duplex ? DUPLEX_FULL : DUPLEX_HALF;
|
||||
} else {
|
||||
cmd->base.autoneg = AUTONEG_DISABLE;
|
||||
cmd->base.speed = ((bmcr & CAS_BMCR_SPEED1000) ?
|
||||
cmd->autoneg = AUTONEG_DISABLE;
|
||||
ethtool_cmd_speed_set(cmd, ((bmcr & CAS_BMCR_SPEED1000) ?
|
||||
SPEED_1000 :
|
||||
((bmcr & BMCR_SPEED100) ?
|
||||
SPEED_100 : SPEED_10));
|
||||
cmd->base.duplex = (bmcr & BMCR_FULLDPLX) ?
|
||||
SPEED_100 : SPEED_10)));
|
||||
cmd->duplex =
|
||||
(bmcr & BMCR_FULLDPLX) ?
|
||||
DUPLEX_FULL : DUPLEX_HALF;
|
||||
}
|
||||
if (linkstate != link_up) {
|
||||
|
@ -4618,46 +4619,39 @@ static int cas_get_link_ksettings(struct net_device *dev,
|
|||
* settings that we configured.
|
||||
*/
|
||||
if (cp->link_cntl & BMCR_ANENABLE) {
|
||||
cmd->base.speed = 0;
|
||||
cmd->base.duplex = 0xff;
|
||||
ethtool_cmd_speed_set(cmd, 0);
|
||||
cmd->duplex = 0xff;
|
||||
} else {
|
||||
cmd->base.speed = SPEED_10;
|
||||
ethtool_cmd_speed_set(cmd, SPEED_10);
|
||||
if (cp->link_cntl & BMCR_SPEED100) {
|
||||
cmd->base.speed = SPEED_100;
|
||||
ethtool_cmd_speed_set(cmd, SPEED_100);
|
||||
} else if (cp->link_cntl & CAS_BMCR_SPEED1000) {
|
||||
cmd->base.speed = SPEED_1000;
|
||||
ethtool_cmd_speed_set(cmd, SPEED_1000);
|
||||
}
|
||||
cmd->base.duplex = (cp->link_cntl & BMCR_FULLDPLX) ?
|
||||
cmd->duplex = (cp->link_cntl & BMCR_FULLDPLX)?
|
||||
DUPLEX_FULL : DUPLEX_HALF;
|
||||
}
|
||||
}
|
||||
|
||||
ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported,
|
||||
supported);
|
||||
ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising,
|
||||
advertising);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cas_set_link_ksettings(struct net_device *dev,
|
||||
const struct ethtool_link_ksettings *cmd)
|
||||
static int cas_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
|
||||
{
|
||||
struct cas *cp = netdev_priv(dev);
|
||||
unsigned long flags;
|
||||
u32 speed = cmd->base.speed;
|
||||
u32 speed = ethtool_cmd_speed(cmd);
|
||||
|
||||
/* Verify the settings we care about. */
|
||||
if (cmd->base.autoneg != AUTONEG_ENABLE &&
|
||||
cmd->base.autoneg != AUTONEG_DISABLE)
|
||||
if (cmd->autoneg != AUTONEG_ENABLE &&
|
||||
cmd->autoneg != AUTONEG_DISABLE)
|
||||
return -EINVAL;
|
||||
|
||||
if (cmd->base.autoneg == AUTONEG_DISABLE &&
|
||||
if (cmd->autoneg == AUTONEG_DISABLE &&
|
||||
((speed != SPEED_1000 &&
|
||||
speed != SPEED_100 &&
|
||||
speed != SPEED_10) ||
|
||||
(cmd->base.duplex != DUPLEX_HALF &&
|
||||
cmd->base.duplex != DUPLEX_FULL)))
|
||||
(cmd->duplex != DUPLEX_HALF &&
|
||||
cmd->duplex != DUPLEX_FULL)))
|
||||
return -EINVAL;
|
||||
|
||||
/* Apply settings and restart link process. */
|
||||
|
@ -4759,6 +4753,8 @@ static void cas_get_ethtool_stats(struct net_device *dev,
|
|||
|
||||
static const struct ethtool_ops cas_ethtool_ops = {
|
||||
.get_drvinfo = cas_get_drvinfo,
|
||||
.get_settings = cas_get_settings,
|
||||
.set_settings = cas_set_settings,
|
||||
.nway_reset = cas_nway_reset,
|
||||
.get_link = cas_get_link,
|
||||
.get_msglevel = cas_get_msglevel,
|
||||
|
@ -4768,8 +4764,6 @@ static const struct ethtool_ops cas_ethtool_ops = {
|
|||
.get_sset_count = cas_get_sset_count,
|
||||
.get_strings = cas_get_strings,
|
||||
.get_ethtool_stats = cas_get_ethtool_stats,
|
||||
.get_link_ksettings = cas_get_link_ksettings,
|
||||
.set_link_ksettings = cas_set_link_ksettings,
|
||||
};
|
||||
|
||||
static int cas_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
||||
|
|
|
@ -6813,8 +6813,7 @@ static void niu_get_drvinfo(struct net_device *dev,
|
|||
sizeof(info->bus_info));
|
||||
}
|
||||
|
||||
static int niu_get_link_ksettings(struct net_device *dev,
|
||||
struct ethtool_link_ksettings *cmd)
|
||||
static int niu_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
|
||||
{
|
||||
struct niu *np = netdev_priv(dev);
|
||||
struct niu_link_config *lp;
|
||||
|
@ -6822,30 +6821,28 @@ static int niu_get_link_ksettings(struct net_device *dev,
|
|||
lp = &np->link_config;
|
||||
|
||||
memset(cmd, 0, sizeof(*cmd));
|
||||
cmd->base.phy_address = np->phy_addr;
|
||||
ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported,
|
||||
lp->supported);
|
||||
ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising,
|
||||
lp->active_advertising);
|
||||
cmd->base.autoneg = lp->active_autoneg;
|
||||
cmd->base.speed = lp->active_speed;
|
||||
cmd->base.duplex = lp->active_duplex;
|
||||
cmd->base.port = (np->flags & NIU_FLAGS_FIBER) ? PORT_FIBRE : PORT_TP;
|
||||
cmd->phy_address = np->phy_addr;
|
||||
cmd->supported = lp->supported;
|
||||
cmd->advertising = lp->active_advertising;
|
||||
cmd->autoneg = lp->active_autoneg;
|
||||
ethtool_cmd_speed_set(cmd, lp->active_speed);
|
||||
cmd->duplex = lp->active_duplex;
|
||||
cmd->port = (np->flags & NIU_FLAGS_FIBER) ? PORT_FIBRE : PORT_TP;
|
||||
cmd->transceiver = (np->flags & NIU_FLAGS_XCVR_SERDES) ?
|
||||
XCVR_EXTERNAL : XCVR_INTERNAL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int niu_set_link_ksettings(struct net_device *dev,
|
||||
const struct ethtool_link_ksettings *cmd)
|
||||
static int niu_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
|
||||
{
|
||||
struct niu *np = netdev_priv(dev);
|
||||
struct niu_link_config *lp = &np->link_config;
|
||||
|
||||
ethtool_convert_link_mode_to_legacy_u32(&lp->advertising,
|
||||
cmd->link_modes.advertising);
|
||||
lp->speed = cmd->base.speed;
|
||||
lp->duplex = cmd->base.duplex;
|
||||
lp->autoneg = cmd->base.autoneg;
|
||||
lp->advertising = cmd->advertising;
|
||||
lp->speed = ethtool_cmd_speed(cmd);
|
||||
lp->duplex = cmd->duplex;
|
||||
lp->autoneg = cmd->autoneg;
|
||||
return niu_init_link(np);
|
||||
}
|
||||
|
||||
|
@ -7905,14 +7902,14 @@ static const struct ethtool_ops niu_ethtool_ops = {
|
|||
.nway_reset = niu_nway_reset,
|
||||
.get_eeprom_len = niu_get_eeprom_len,
|
||||
.get_eeprom = niu_get_eeprom,
|
||||
.get_settings = niu_get_settings,
|
||||
.set_settings = niu_set_settings,
|
||||
.get_strings = niu_get_strings,
|
||||
.get_sset_count = niu_get_sset_count,
|
||||
.get_ethtool_stats = niu_get_ethtool_stats,
|
||||
.set_phys_id = niu_set_phys_id,
|
||||
.get_rxnfc = niu_get_nfc,
|
||||
.set_rxnfc = niu_set_nfc,
|
||||
.get_link_ksettings = niu_get_link_ksettings,
|
||||
.set_link_ksettings = niu_set_link_ksettings,
|
||||
};
|
||||
|
||||
static int niu_ldg_assign_ldn(struct niu *np, struct niu_parent *parent,
|
||||
|
|
|
@ -1250,17 +1250,12 @@ static void gem_stop_dma(struct gem *gp)
|
|||
|
||||
|
||||
// XXX dbl check what that function should do when called on PCS PHY
|
||||
static void gem_begin_auto_negotiation(struct gem *gp,
|
||||
const struct ethtool_link_ksettings *ep)
|
||||
static void gem_begin_auto_negotiation(struct gem *gp, struct ethtool_cmd *ep)
|
||||
{
|
||||
u32 advertise, features;
|
||||
int autoneg;
|
||||
int speed;
|
||||
int duplex;
|
||||
u32 advertising;
|
||||
|
||||
ethtool_convert_link_mode_to_legacy_u32(&advertising,
|
||||
ep->link_modes.advertising);
|
||||
|
||||
if (gp->phy_type != phy_mii_mdio0 &&
|
||||
gp->phy_type != phy_mii_mdio1)
|
||||
|
@ -1283,13 +1278,13 @@ static void gem_begin_auto_negotiation(struct gem *gp,
|
|||
/* Setup link parameters */
|
||||
if (!ep)
|
||||
goto start_aneg;
|
||||
if (ep->base.autoneg == AUTONEG_ENABLE) {
|
||||
advertise = advertising;
|
||||
if (ep->autoneg == AUTONEG_ENABLE) {
|
||||
advertise = ep->advertising;
|
||||
autoneg = 1;
|
||||
} else {
|
||||
autoneg = 0;
|
||||
speed = ep->base.speed;
|
||||
duplex = ep->base.duplex;
|
||||
speed = ethtool_cmd_speed(ep);
|
||||
duplex = ep->duplex;
|
||||
}
|
||||
|
||||
start_aneg:
|
||||
|
@ -2520,96 +2515,85 @@ static void gem_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info
|
|||
strlcpy(info->bus_info, pci_name(gp->pdev), sizeof(info->bus_info));
|
||||
}
|
||||
|
||||
static int gem_get_link_ksettings(struct net_device *dev,
|
||||
struct ethtool_link_ksettings *cmd)
|
||||
static int gem_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
|
||||
{
|
||||
struct gem *gp = netdev_priv(dev);
|
||||
u32 supported, advertising;
|
||||
|
||||
if (gp->phy_type == phy_mii_mdio0 ||
|
||||
gp->phy_type == phy_mii_mdio1) {
|
||||
if (gp->phy_mii.def)
|
||||
supported = gp->phy_mii.def->features;
|
||||
cmd->supported = gp->phy_mii.def->features;
|
||||
else
|
||||
supported = (SUPPORTED_10baseT_Half |
|
||||
cmd->supported = (SUPPORTED_10baseT_Half |
|
||||
SUPPORTED_10baseT_Full);
|
||||
|
||||
/* XXX hardcoded stuff for now */
|
||||
cmd->base.port = PORT_MII;
|
||||
cmd->base.phy_address = 0; /* XXX fixed PHYAD */
|
||||
cmd->port = PORT_MII;
|
||||
cmd->transceiver = XCVR_EXTERNAL;
|
||||
cmd->phy_address = 0; /* XXX fixed PHYAD */
|
||||
|
||||
/* Return current PHY settings */
|
||||
cmd->base.autoneg = gp->want_autoneg;
|
||||
cmd->base.speed = gp->phy_mii.speed;
|
||||
cmd->base.duplex = gp->phy_mii.duplex;
|
||||
advertising = gp->phy_mii.advertising;
|
||||
cmd->autoneg = gp->want_autoneg;
|
||||
ethtool_cmd_speed_set(cmd, gp->phy_mii.speed);
|
||||
cmd->duplex = gp->phy_mii.duplex;
|
||||
cmd->advertising = gp->phy_mii.advertising;
|
||||
|
||||
/* If we started with a forced mode, we don't have a default
|
||||
* advertise set, we need to return something sensible so
|
||||
* userland can re-enable autoneg properly.
|
||||
*/
|
||||
if (advertising == 0)
|
||||
advertising = supported;
|
||||
if (cmd->advertising == 0)
|
||||
cmd->advertising = cmd->supported;
|
||||
} else { // XXX PCS ?
|
||||
supported =
|
||||
cmd->supported =
|
||||
(SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full |
|
||||
SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full |
|
||||
SUPPORTED_Autoneg);
|
||||
advertising = supported;
|
||||
cmd->base.speed = 0;
|
||||
cmd->base.duplex = 0;
|
||||
cmd->base.port = 0;
|
||||
cmd->base.phy_address = 0;
|
||||
cmd->base.autoneg = 0;
|
||||
cmd->advertising = cmd->supported;
|
||||
ethtool_cmd_speed_set(cmd, 0);
|
||||
cmd->duplex = cmd->port = cmd->phy_address =
|
||||
cmd->transceiver = cmd->autoneg = 0;
|
||||
|
||||
/* serdes means usually a Fibre connector, with most fixed */
|
||||
if (gp->phy_type == phy_serdes) {
|
||||
cmd->base.port = PORT_FIBRE;
|
||||
supported = (SUPPORTED_1000baseT_Half |
|
||||
cmd->port = PORT_FIBRE;
|
||||
cmd->supported = (SUPPORTED_1000baseT_Half |
|
||||
SUPPORTED_1000baseT_Full |
|
||||
SUPPORTED_FIBRE | SUPPORTED_Autoneg |
|
||||
SUPPORTED_Pause | SUPPORTED_Asym_Pause);
|
||||
advertising = supported;
|
||||
cmd->advertising = cmd->supported;
|
||||
cmd->transceiver = XCVR_INTERNAL;
|
||||
if (gp->lstate == link_up)
|
||||
cmd->base.speed = SPEED_1000;
|
||||
cmd->base.duplex = DUPLEX_FULL;
|
||||
cmd->base.autoneg = 1;
|
||||
ethtool_cmd_speed_set(cmd, SPEED_1000);
|
||||
cmd->duplex = DUPLEX_FULL;
|
||||
cmd->autoneg = 1;
|
||||
}
|
||||
}
|
||||
|
||||
ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported,
|
||||
supported);
|
||||
ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising,
|
||||
advertising);
|
||||
cmd->maxtxpkt = cmd->maxrxpkt = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gem_set_link_ksettings(struct net_device *dev,
|
||||
const struct ethtool_link_ksettings *cmd)
|
||||
static int gem_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
|
||||
{
|
||||
struct gem *gp = netdev_priv(dev);
|
||||
u32 speed = cmd->base.speed;
|
||||
u32 advertising;
|
||||
|
||||
ethtool_convert_link_mode_to_legacy_u32(&advertising,
|
||||
cmd->link_modes.advertising);
|
||||
u32 speed = ethtool_cmd_speed(cmd);
|
||||
|
||||
/* Verify the settings we care about. */
|
||||
if (cmd->base.autoneg != AUTONEG_ENABLE &&
|
||||
cmd->base.autoneg != AUTONEG_DISABLE)
|
||||
if (cmd->autoneg != AUTONEG_ENABLE &&
|
||||
cmd->autoneg != AUTONEG_DISABLE)
|
||||
return -EINVAL;
|
||||
|
||||
if (cmd->base.autoneg == AUTONEG_ENABLE &&
|
||||
advertising == 0)
|
||||
if (cmd->autoneg == AUTONEG_ENABLE &&
|
||||
cmd->advertising == 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (cmd->base.autoneg == AUTONEG_DISABLE &&
|
||||
if (cmd->autoneg == AUTONEG_DISABLE &&
|
||||
((speed != SPEED_1000 &&
|
||||
speed != SPEED_100 &&
|
||||
speed != SPEED_10) ||
|
||||
(cmd->base.duplex != DUPLEX_HALF &&
|
||||
cmd->base.duplex != DUPLEX_FULL)))
|
||||
(cmd->duplex != DUPLEX_HALF &&
|
||||
cmd->duplex != DUPLEX_FULL)))
|
||||
return -EINVAL;
|
||||
|
||||
/* Apply settings and restart link process. */
|
||||
|
@ -2682,13 +2666,13 @@ static int gem_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
|
|||
static const struct ethtool_ops gem_ethtool_ops = {
|
||||
.get_drvinfo = gem_get_drvinfo,
|
||||
.get_link = ethtool_op_get_link,
|
||||
.get_settings = gem_get_settings,
|
||||
.set_settings = gem_set_settings,
|
||||
.nway_reset = gem_nway_reset,
|
||||
.get_msglevel = gem_get_msglevel,
|
||||
.set_msglevel = gem_set_msglevel,
|
||||
.get_wol = gem_get_wol,
|
||||
.set_wol = gem_set_wol,
|
||||
.get_link_ksettings = gem_get_link_ksettings,
|
||||
.set_link_ksettings = gem_set_link_ksettings,
|
||||
};
|
||||
|
||||
static int gem_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
||||
|
|
|
@ -1294,10 +1294,9 @@ static void happy_meal_init_rings(struct happy_meal *hp)
|
|||
}
|
||||
|
||||
/* hp->happy_lock must be held */
|
||||
static void
|
||||
happy_meal_begin_auto_negotiation(struct happy_meal *hp,
|
||||
void __iomem *tregs,
|
||||
const struct ethtool_link_ksettings *ep)
|
||||
static void happy_meal_begin_auto_negotiation(struct happy_meal *hp,
|
||||
void __iomem *tregs,
|
||||
struct ethtool_cmd *ep)
|
||||
{
|
||||
int timeout;
|
||||
|
||||
|
@ -1310,7 +1309,7 @@ happy_meal_begin_auto_negotiation(struct happy_meal *hp,
|
|||
/* XXX Check BMSR_ANEGCAPABLE, should not be necessary though. */
|
||||
|
||||
hp->sw_advertise = happy_meal_tcvr_read(hp, tregs, MII_ADVERTISE);
|
||||
if (!ep || ep->base.autoneg == AUTONEG_ENABLE) {
|
||||
if (ep == NULL || ep->autoneg == AUTONEG_ENABLE) {
|
||||
/* Advertise everything we can support. */
|
||||
if (hp->sw_bmsr & BMSR_10HALF)
|
||||
hp->sw_advertise |= (ADVERTISE_10HALF);
|
||||
|
@ -1385,14 +1384,14 @@ happy_meal_begin_auto_negotiation(struct happy_meal *hp,
|
|||
/* Disable auto-negotiation in BMCR, enable the duplex and
|
||||
* speed setting, init the timer state machine, and fire it off.
|
||||
*/
|
||||
if (!ep || ep->base.autoneg == AUTONEG_ENABLE) {
|
||||
if (ep == NULL || ep->autoneg == AUTONEG_ENABLE) {
|
||||
hp->sw_bmcr = BMCR_SPEED100;
|
||||
} else {
|
||||
if (ep->base.speed == SPEED_100)
|
||||
if (ethtool_cmd_speed(ep) == SPEED_100)
|
||||
hp->sw_bmcr = BMCR_SPEED100;
|
||||
else
|
||||
hp->sw_bmcr = 0;
|
||||
if (ep->base.duplex == DUPLEX_FULL)
|
||||
if (ep->duplex == DUPLEX_FULL)
|
||||
hp->sw_bmcr |= BMCR_FULLDPLX;
|
||||
}
|
||||
happy_meal_tcvr_write(hp, tregs, MII_BMCR, hp->sw_bmcr);
|
||||
|
@ -2435,21 +2434,20 @@ static void happy_meal_set_multicast(struct net_device *dev)
|
|||
}
|
||||
|
||||
/* Ethtool support... */
|
||||
static int hme_get_link_ksettings(struct net_device *dev,
|
||||
struct ethtool_link_ksettings *cmd)
|
||||
static int hme_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
|
||||
{
|
||||
struct happy_meal *hp = netdev_priv(dev);
|
||||
u32 speed;
|
||||
u32 supported;
|
||||
|
||||
supported =
|
||||
cmd->supported =
|
||||
(SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full |
|
||||
SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full |
|
||||
SUPPORTED_Autoneg | SUPPORTED_TP | SUPPORTED_MII);
|
||||
|
||||
/* XXX hardcoded stuff for now */
|
||||
cmd->base.port = PORT_TP; /* XXX no MII support */
|
||||
cmd->base.phy_address = 0; /* XXX fixed PHYAD */
|
||||
cmd->port = PORT_TP; /* XXX no MII support */
|
||||
cmd->transceiver = XCVR_INTERNAL; /* XXX no external xcvr support */
|
||||
cmd->phy_address = 0; /* XXX fixed PHYAD */
|
||||
|
||||
/* Record PHY settings. */
|
||||
spin_lock_irq(&hp->happy_lock);
|
||||
|
@ -2458,45 +2456,41 @@ static int hme_get_link_ksettings(struct net_device *dev,
|
|||
spin_unlock_irq(&hp->happy_lock);
|
||||
|
||||
if (hp->sw_bmcr & BMCR_ANENABLE) {
|
||||
cmd->base.autoneg = AUTONEG_ENABLE;
|
||||
cmd->autoneg = AUTONEG_ENABLE;
|
||||
speed = ((hp->sw_lpa & (LPA_100HALF | LPA_100FULL)) ?
|
||||
SPEED_100 : SPEED_10);
|
||||
if (speed == SPEED_100)
|
||||
cmd->base.duplex =
|
||||
cmd->duplex =
|
||||
(hp->sw_lpa & (LPA_100FULL)) ?
|
||||
DUPLEX_FULL : DUPLEX_HALF;
|
||||
else
|
||||
cmd->base.duplex =
|
||||
cmd->duplex =
|
||||
(hp->sw_lpa & (LPA_10FULL)) ?
|
||||
DUPLEX_FULL : DUPLEX_HALF;
|
||||
} else {
|
||||
cmd->base.autoneg = AUTONEG_DISABLE;
|
||||
cmd->autoneg = AUTONEG_DISABLE;
|
||||
speed = (hp->sw_bmcr & BMCR_SPEED100) ? SPEED_100 : SPEED_10;
|
||||
cmd->base.duplex =
|
||||
cmd->duplex =
|
||||
(hp->sw_bmcr & BMCR_FULLDPLX) ?
|
||||
DUPLEX_FULL : DUPLEX_HALF;
|
||||
}
|
||||
cmd->base.speed = speed;
|
||||
ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported,
|
||||
supported);
|
||||
|
||||
ethtool_cmd_speed_set(cmd, speed);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hme_set_link_ksettings(struct net_device *dev,
|
||||
const struct ethtool_link_ksettings *cmd)
|
||||
static int hme_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
|
||||
{
|
||||
struct happy_meal *hp = netdev_priv(dev);
|
||||
|
||||
/* Verify the settings we care about. */
|
||||
if (cmd->base.autoneg != AUTONEG_ENABLE &&
|
||||
cmd->base.autoneg != AUTONEG_DISABLE)
|
||||
if (cmd->autoneg != AUTONEG_ENABLE &&
|
||||
cmd->autoneg != AUTONEG_DISABLE)
|
||||
return -EINVAL;
|
||||
if (cmd->base.autoneg == AUTONEG_DISABLE &&
|
||||
((cmd->base.speed != SPEED_100 &&
|
||||
cmd->base.speed != SPEED_10) ||
|
||||
(cmd->base.duplex != DUPLEX_HALF &&
|
||||
cmd->base.duplex != DUPLEX_FULL)))
|
||||
if (cmd->autoneg == AUTONEG_DISABLE &&
|
||||
((ethtool_cmd_speed(cmd) != SPEED_100 &&
|
||||
ethtool_cmd_speed(cmd) != SPEED_10) ||
|
||||
(cmd->duplex != DUPLEX_HALF &&
|
||||
cmd->duplex != DUPLEX_FULL)))
|
||||
return -EINVAL;
|
||||
|
||||
/* Ok, do it to it. */
|
||||
|
@ -2543,10 +2537,10 @@ static u32 hme_get_link(struct net_device *dev)
|
|||
}
|
||||
|
||||
static const struct ethtool_ops hme_ethtool_ops = {
|
||||
.get_settings = hme_get_settings,
|
||||
.set_settings = hme_set_settings,
|
||||
.get_drvinfo = hme_get_drvinfo,
|
||||
.get_link = hme_get_link,
|
||||
.get_link_ksettings = hme_get_link_ksettings,
|
||||
.set_link_ksettings = hme_set_link_ksettings,
|
||||
};
|
||||
|
||||
static int hme_version_printed;
|
||||
|
|
|
@ -1206,68 +1206,61 @@ void gelic_net_get_drvinfo(struct net_device *netdev,
|
|||
strlcpy(info->version, DRV_VERSION, sizeof(info->version));
|
||||
}
|
||||
|
||||
static int gelic_ether_get_link_ksettings(struct net_device *netdev,
|
||||
struct ethtool_link_ksettings *cmd)
|
||||
static int gelic_ether_get_settings(struct net_device *netdev,
|
||||
struct ethtool_cmd *cmd)
|
||||
{
|
||||
struct gelic_card *card = netdev_card(netdev);
|
||||
u32 supported, advertising;
|
||||
|
||||
gelic_card_get_ether_port_status(card, 0);
|
||||
|
||||
if (card->ether_port_status & GELIC_LV1_ETHER_FULL_DUPLEX)
|
||||
cmd->base.duplex = DUPLEX_FULL;
|
||||
cmd->duplex = DUPLEX_FULL;
|
||||
else
|
||||
cmd->base.duplex = DUPLEX_HALF;
|
||||
cmd->duplex = DUPLEX_HALF;
|
||||
|
||||
switch (card->ether_port_status & GELIC_LV1_ETHER_SPEED_MASK) {
|
||||
case GELIC_LV1_ETHER_SPEED_10:
|
||||
cmd->base.speed = SPEED_10;
|
||||
ethtool_cmd_speed_set(cmd, SPEED_10);
|
||||
break;
|
||||
case GELIC_LV1_ETHER_SPEED_100:
|
||||
cmd->base.speed = SPEED_100;
|
||||
ethtool_cmd_speed_set(cmd, SPEED_100);
|
||||
break;
|
||||
case GELIC_LV1_ETHER_SPEED_1000:
|
||||
cmd->base.speed = SPEED_1000;
|
||||
ethtool_cmd_speed_set(cmd, SPEED_1000);
|
||||
break;
|
||||
default:
|
||||
pr_info("%s: speed unknown\n", __func__);
|
||||
cmd->base.speed = SPEED_10;
|
||||
ethtool_cmd_speed_set(cmd, SPEED_10);
|
||||
break;
|
||||
}
|
||||
|
||||
supported = SUPPORTED_TP | SUPPORTED_Autoneg |
|
||||
cmd->supported = SUPPORTED_TP | SUPPORTED_Autoneg |
|
||||
SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full |
|
||||
SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full |
|
||||
SUPPORTED_1000baseT_Full;
|
||||
advertising = supported;
|
||||
cmd->advertising = cmd->supported;
|
||||
if (card->link_mode & GELIC_LV1_ETHER_AUTO_NEG) {
|
||||
cmd->base.autoneg = AUTONEG_ENABLE;
|
||||
cmd->autoneg = AUTONEG_ENABLE;
|
||||
} else {
|
||||
cmd->base.autoneg = AUTONEG_DISABLE;
|
||||
advertising &= ~ADVERTISED_Autoneg;
|
||||
cmd->autoneg = AUTONEG_DISABLE;
|
||||
cmd->advertising &= ~ADVERTISED_Autoneg;
|
||||
}
|
||||
cmd->base.port = PORT_TP;
|
||||
|
||||
ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported,
|
||||
supported);
|
||||
ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising,
|
||||
advertising);
|
||||
cmd->port = PORT_TP;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
gelic_ether_set_link_ksettings(struct net_device *netdev,
|
||||
const struct ethtool_link_ksettings *cmd)
|
||||
static int gelic_ether_set_settings(struct net_device *netdev,
|
||||
struct ethtool_cmd *cmd)
|
||||
{
|
||||
struct gelic_card *card = netdev_card(netdev);
|
||||
u64 mode;
|
||||
int ret;
|
||||
|
||||
if (cmd->base.autoneg == AUTONEG_ENABLE) {
|
||||
if (cmd->autoneg == AUTONEG_ENABLE) {
|
||||
mode = GELIC_LV1_ETHER_AUTO_NEG;
|
||||
} else {
|
||||
switch (cmd->base.speed) {
|
||||
switch (cmd->speed) {
|
||||
case SPEED_10:
|
||||
mode = GELIC_LV1_ETHER_SPEED_10;
|
||||
break;
|
||||
|
@ -1280,9 +1273,9 @@ gelic_ether_set_link_ksettings(struct net_device *netdev,
|
|||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
if (cmd->base.duplex == DUPLEX_FULL) {
|
||||
if (cmd->duplex == DUPLEX_FULL)
|
||||
mode |= GELIC_LV1_ETHER_FULL_DUPLEX;
|
||||
} else if (cmd->base.speed == SPEED_1000) {
|
||||
else if (cmd->speed == SPEED_1000) {
|
||||
pr_info("1000 half duplex is not supported.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -1377,11 +1370,11 @@ static int gelic_net_set_wol(struct net_device *netdev,
|
|||
|
||||
static const struct ethtool_ops gelic_ether_ethtool_ops = {
|
||||
.get_drvinfo = gelic_net_get_drvinfo,
|
||||
.get_settings = gelic_ether_get_settings,
|
||||
.set_settings = gelic_ether_set_settings,
|
||||
.get_link = ethtool_op_get_link,
|
||||
.get_wol = gelic_net_get_wol,
|
||||
.set_wol = gelic_net_set_wol,
|
||||
.get_link_ksettings = gelic_ether_get_link_ksettings,
|
||||
.set_link_ksettings = gelic_ether_set_link_ksettings,
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -47,23 +47,19 @@ static struct {
|
|||
};
|
||||
|
||||
static int
|
||||
spider_net_ethtool_get_link_ksettings(struct net_device *netdev,
|
||||
struct ethtool_link_ksettings *cmd)
|
||||
spider_net_ethtool_get_settings(struct net_device *netdev,
|
||||
struct ethtool_cmd *cmd)
|
||||
{
|
||||
struct spider_net_card *card;
|
||||
card = netdev_priv(netdev);
|
||||
|
||||
ethtool_link_ksettings_zero_link_mode(cmd, supported);
|
||||
ethtool_link_ksettings_add_link_mode(cmd, supported, 1000baseT_Full);
|
||||
ethtool_link_ksettings_add_link_mode(cmd, supported, FIBRE);
|
||||
|
||||
ethtool_link_ksettings_zero_link_mode(cmd, advertising);
|
||||
ethtool_link_ksettings_add_link_mode(cmd, advertising, 1000baseT_Full);
|
||||
ethtool_link_ksettings_add_link_mode(cmd, advertising, FIBRE);
|
||||
|
||||
cmd->base.port = PORT_FIBRE;
|
||||
cmd->base.speed = card->phy.speed;
|
||||
cmd->base.duplex = DUPLEX_FULL;
|
||||
cmd->supported = (SUPPORTED_1000baseT_Full |
|
||||
SUPPORTED_FIBRE);
|
||||
cmd->advertising = (ADVERTISED_1000baseT_Full |
|
||||
ADVERTISED_FIBRE);
|
||||
cmd->port = PORT_FIBRE;
|
||||
ethtool_cmd_speed_set(cmd, card->phy.speed);
|
||||
cmd->duplex = DUPLEX_FULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -170,6 +166,7 @@ static void spider_net_get_strings(struct net_device *netdev, u32 stringset,
|
|||
}
|
||||
|
||||
const struct ethtool_ops spider_net_ethtool_ops = {
|
||||
.get_settings = spider_net_ethtool_get_settings,
|
||||
.get_drvinfo = spider_net_ethtool_get_drvinfo,
|
||||
.get_wol = spider_net_ethtool_get_wol,
|
||||
.get_msglevel = spider_net_ethtool_get_msglevel,
|
||||
|
@ -180,6 +177,5 @@ const struct ethtool_ops spider_net_ethtool_ops = {
|
|||
.get_strings = spider_net_get_strings,
|
||||
.get_sset_count = spider_net_get_sset_count,
|
||||
.get_ethtool_stats = spider_net_get_ethtool_stats,
|
||||
.get_link_ksettings = spider_net_ethtool_get_link_ksettings,
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue