Commit 774afb8e authored by Julian Wiedmann's avatar Julian Wiedmann Committed by David S. Miller

s390/qeth: clean up qeth_set_ecmd_adv_sup()

In preparation for moving to get_link_ksettings(), clean up how
we build the supported and advertised port/speed masks.
Signed-off-by: default avatarJulian Wiedmann <jwi@linux.vnet.ibm.com>
Reviewed-by: default avatarThomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: default avatarUrsula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2aedd56a
...@@ -6024,57 +6024,56 @@ void qeth_core_get_drvinfo(struct net_device *dev, ...@@ -6024,57 +6024,56 @@ void qeth_core_get_drvinfo(struct net_device *dev,
} }
EXPORT_SYMBOL_GPL(qeth_core_get_drvinfo); EXPORT_SYMBOL_GPL(qeth_core_get_drvinfo);
/* Helper function to fill 'advertizing' and 'supported' which are the same. */ /* Helper function to fill 'advertising' and 'supported' which are the same. */
/* Autoneg and full-duplex are supported and advertized uncondionally. */ /* Autoneg and full-duplex are supported and advertised unconditionally. */
/* Always advertize and support all speeds up to specified, and only one */ /* Always advertise and support all speeds up to specified, and only one */
/* specified port type. */ /* specified port type. */
static void qeth_set_ecmd_adv_sup(struct ethtool_cmd *ecmd, static void qeth_set_ecmd_adv_sup(struct ethtool_cmd *ecmd,
int maxspeed, int porttype) int maxspeed, int porttype)
{ {
int port_sup, port_adv, spd_sup, spd_adv; u32 sup, adv;
sup = SUPPORTED_Autoneg;
adv = ADVERTISED_Autoneg;
switch (porttype) { switch (porttype) {
case PORT_TP: case PORT_TP:
port_sup = SUPPORTED_TP; sup |= SUPPORTED_TP;
port_adv = ADVERTISED_TP; adv |= ADVERTISED_TP;
break; break;
case PORT_FIBRE: case PORT_FIBRE:
port_sup = SUPPORTED_FIBRE; sup |= SUPPORTED_FIBRE;
port_adv = ADVERTISED_FIBRE; adv |= ADVERTISED_FIBRE;
break; break;
default: default:
port_sup = SUPPORTED_TP; sup |= SUPPORTED_TP;
port_adv = ADVERTISED_TP; adv |= ADVERTISED_TP;
WARN_ON_ONCE(1); WARN_ON_ONCE(1);
} }
/* "Fallthrough" case'es ordered from high to low result in setting */ /* fallthrough from high to low, to select all legal speeds: */
/* flags cumulatively, starting from the specified speed and down to */
/* the lowest possible. */
spd_sup = 0;
spd_adv = 0;
switch (maxspeed) { switch (maxspeed) {
case SPEED_10000: case SPEED_10000:
spd_sup |= SUPPORTED_10000baseT_Full; sup |= SUPPORTED_10000baseT_Full;
spd_adv |= ADVERTISED_10000baseT_Full; adv |= ADVERTISED_10000baseT_Full;
case SPEED_1000: case SPEED_1000:
spd_sup |= SUPPORTED_1000baseT_Half | SUPPORTED_1000baseT_Full; sup |= SUPPORTED_1000baseT_Half | SUPPORTED_1000baseT_Full;
spd_adv |= ADVERTISED_1000baseT_Half | adv |= ADVERTISED_1000baseT_Half | ADVERTISED_1000baseT_Full;
ADVERTISED_1000baseT_Full;
case SPEED_100: case SPEED_100:
spd_sup |= SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full; sup |= SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full;
spd_adv |= ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full; adv |= ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full;
case SPEED_10: case SPEED_10:
spd_sup |= SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full; sup |= SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full;
spd_adv |= ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full; adv |= ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full;
break; /* end fallthrough */
break;
default: default:
spd_sup = SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full; sup |= SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full;
spd_adv = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full; adv |= ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full;
WARN_ON_ONCE(1); WARN_ON_ONCE(1);
} }
ecmd->advertising = ADVERTISED_Autoneg | port_adv | spd_adv; ecmd->supported = sup;
ecmd->supported = SUPPORTED_Autoneg | port_sup | spd_sup; ecmd->advertising = adv;
} }
int qeth_core_ethtool_get_settings(struct net_device *netdev, int qeth_core_ethtool_get_settings(struct net_device *netdev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment