s390/qeth: improve selection of ethtool link modes
The link mode is a combination of port speed and port mode. But we
currently only consider the speed, and then typically select the
corresponding TP-based link mode. For 1G and 10G Fibre links this means
we display the wrong link modes.
Move the SPEED_* switch statements inside the PORT_* cases, and only
consider valid combinations where we can select the corresponding
link mode. Add the relevant link modes (1000baseX, 10000baseSR and
1000baseLR) that were introduced back with
commit 5711a98221
("net: ethtool: add support for 1000BaseX and missing 10G link modes").
To differentiate between 10000baseSR and 10000baseLR, use the detailed
media_type information that QUERY OAT provides.
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
e92d42e760
commit
235db52783
|
@ -701,10 +701,17 @@ enum qeth_pnso_mode {
|
||||||
QETH_PNSO_ADDR_INFO,
|
QETH_PNSO_ADDR_INFO,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum qeth_link_mode {
|
||||||
|
QETH_LINK_MODE_UNKNOWN,
|
||||||
|
QETH_LINK_MODE_FIBRE_SHORT,
|
||||||
|
QETH_LINK_MODE_FIBRE_LONG,
|
||||||
|
};
|
||||||
|
|
||||||
struct qeth_link_info {
|
struct qeth_link_info {
|
||||||
u32 speed;
|
u32 speed;
|
||||||
u8 duplex;
|
u8 duplex;
|
||||||
u8 port;
|
u8 port;
|
||||||
|
enum qeth_link_mode link_mode;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define QETH_BROADCAST_WITH_ECHO 0x01
|
#define QETH_BROADCAST_WITH_ECHO 0x01
|
||||||
|
|
|
@ -5018,13 +5018,19 @@ static int qeth_init_link_info_oat_cb(struct qeth_card *card,
|
||||||
switch (phys_if->media_type) {
|
switch (phys_if->media_type) {
|
||||||
case QETH_QOAT_PHYS_MEDIA_COPPER:
|
case QETH_QOAT_PHYS_MEDIA_COPPER:
|
||||||
link_info->port = PORT_TP;
|
link_info->port = PORT_TP;
|
||||||
|
link_info->link_mode = QETH_LINK_MODE_UNKNOWN;
|
||||||
break;
|
break;
|
||||||
case QETH_QOAT_PHYS_MEDIA_FIBRE_SHORT:
|
case QETH_QOAT_PHYS_MEDIA_FIBRE_SHORT:
|
||||||
|
link_info->port = PORT_FIBRE;
|
||||||
|
link_info->link_mode = QETH_LINK_MODE_FIBRE_SHORT;
|
||||||
|
break;
|
||||||
case QETH_QOAT_PHYS_MEDIA_FIBRE_LONG:
|
case QETH_QOAT_PHYS_MEDIA_FIBRE_LONG:
|
||||||
link_info->port = PORT_FIBRE;
|
link_info->port = PORT_FIBRE;
|
||||||
|
link_info->link_mode = QETH_LINK_MODE_FIBRE_LONG;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
link_info->port = PORT_OTHER;
|
link_info->port = PORT_OTHER;
|
||||||
|
link_info->link_mode = QETH_LINK_MODE_UNKNOWN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5038,6 +5044,7 @@ static void qeth_init_link_info(struct qeth_card *card)
|
||||||
if (IS_IQD(card) || IS_VM_NIC(card)) {
|
if (IS_IQD(card) || IS_VM_NIC(card)) {
|
||||||
card->info.link_info.speed = SPEED_10000;
|
card->info.link_info.speed = SPEED_10000;
|
||||||
card->info.link_info.port = PORT_FIBRE;
|
card->info.link_info.port = PORT_FIBRE;
|
||||||
|
card->info.link_info.link_mode = QETH_LINK_MODE_FIBRE_SHORT;
|
||||||
} else {
|
} else {
|
||||||
switch (card->info.link_type) {
|
switch (card->info.link_type) {
|
||||||
case QETH_LINK_TYPE_FAST_ETH:
|
case QETH_LINK_TYPE_FAST_ETH:
|
||||||
|
@ -5064,6 +5071,8 @@ static void qeth_init_link_info(struct qeth_card *card)
|
||||||
card->info.link_info.speed = SPEED_UNKNOWN;
|
card->info.link_info.speed = SPEED_UNKNOWN;
|
||||||
card->info.link_info.port = PORT_OTHER;
|
card->info.link_info.port = PORT_OTHER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
card->info.link_info.link_mode = QETH_LINK_MODE_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get more accurate data via QUERY OAT: */
|
/* Get more accurate data via QUERY OAT: */
|
||||||
|
@ -5089,6 +5098,8 @@ static void qeth_init_link_info(struct qeth_card *card)
|
||||||
card->info.link_info.duplex = link_info.duplex;
|
card->info.link_info.duplex = link_info.duplex;
|
||||||
if (link_info.port != PORT_OTHER)
|
if (link_info.port != PORT_OTHER)
|
||||||
card->info.link_info.port = link_info.port;
|
card->info.link_info.port = link_info.port;
|
||||||
|
if (link_info.link_mode != QETH_LINK_MODE_UNKNOWN)
|
||||||
|
card->info.link_info.link_mode = link_info.link_mode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -324,7 +324,8 @@ static int qeth_set_per_queue_coalesce(struct net_device *dev, u32 queue,
|
||||||
/* Autoneg and full-duplex are supported and advertised unconditionally. */
|
/* Autoneg and full-duplex are supported and advertised unconditionally. */
|
||||||
/* Always advertise 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_ethtool_link_modes(struct ethtool_link_ksettings *cmd)
|
static void qeth_set_ethtool_link_modes(struct ethtool_link_ksettings *cmd,
|
||||||
|
enum qeth_link_mode link_mode)
|
||||||
{
|
{
|
||||||
ethtool_link_ksettings_zero_link_mode(cmd, supported);
|
ethtool_link_ksettings_zero_link_mode(cmd, supported);
|
||||||
ethtool_link_ksettings_zero_link_mode(cmd, advertising);
|
ethtool_link_ksettings_zero_link_mode(cmd, advertising);
|
||||||
|
@ -337,58 +338,83 @@ static void qeth_set_ethtool_link_modes(struct ethtool_link_ksettings *cmd)
|
||||||
case PORT_TP:
|
case PORT_TP:
|
||||||
ethtool_link_ksettings_add_link_mode(cmd, supported, TP);
|
ethtool_link_ksettings_add_link_mode(cmd, supported, TP);
|
||||||
ethtool_link_ksettings_add_link_mode(cmd, advertising, TP);
|
ethtool_link_ksettings_add_link_mode(cmd, advertising, TP);
|
||||||
|
|
||||||
|
switch (cmd->base.speed) {
|
||||||
|
case SPEED_10000:
|
||||||
|
ethtool_link_ksettings_add_link_mode(cmd, supported,
|
||||||
|
10000baseT_Full);
|
||||||
|
ethtool_link_ksettings_add_link_mode(cmd, advertising,
|
||||||
|
10000baseT_Full);
|
||||||
|
fallthrough;
|
||||||
|
case SPEED_1000:
|
||||||
|
ethtool_link_ksettings_add_link_mode(cmd, supported,
|
||||||
|
1000baseT_Full);
|
||||||
|
ethtool_link_ksettings_add_link_mode(cmd, advertising,
|
||||||
|
1000baseT_Full);
|
||||||
|
ethtool_link_ksettings_add_link_mode(cmd, supported,
|
||||||
|
1000baseT_Half);
|
||||||
|
ethtool_link_ksettings_add_link_mode(cmd, advertising,
|
||||||
|
1000baseT_Half);
|
||||||
|
fallthrough;
|
||||||
|
case SPEED_100:
|
||||||
|
ethtool_link_ksettings_add_link_mode(cmd, supported,
|
||||||
|
100baseT_Full);
|
||||||
|
ethtool_link_ksettings_add_link_mode(cmd, advertising,
|
||||||
|
100baseT_Full);
|
||||||
|
ethtool_link_ksettings_add_link_mode(cmd, supported,
|
||||||
|
100baseT_Half);
|
||||||
|
ethtool_link_ksettings_add_link_mode(cmd, advertising,
|
||||||
|
100baseT_Half);
|
||||||
|
fallthrough;
|
||||||
|
case SPEED_10:
|
||||||
|
ethtool_link_ksettings_add_link_mode(cmd, supported,
|
||||||
|
10baseT_Full);
|
||||||
|
ethtool_link_ksettings_add_link_mode(cmd, advertising,
|
||||||
|
10baseT_Full);
|
||||||
|
ethtool_link_ksettings_add_link_mode(cmd, supported,
|
||||||
|
10baseT_Half);
|
||||||
|
ethtool_link_ksettings_add_link_mode(cmd, advertising,
|
||||||
|
10baseT_Half);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case PORT_FIBRE:
|
case PORT_FIBRE:
|
||||||
ethtool_link_ksettings_add_link_mode(cmd, supported, FIBRE);
|
ethtool_link_ksettings_add_link_mode(cmd, supported, FIBRE);
|
||||||
ethtool_link_ksettings_add_link_mode(cmd, advertising, FIBRE);
|
ethtool_link_ksettings_add_link_mode(cmd, advertising, FIBRE);
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* partially does fall through, to also select lower speeds */
|
switch (cmd->base.speed) {
|
||||||
switch (cmd->base.speed) {
|
case SPEED_25000:
|
||||||
case SPEED_25000:
|
ethtool_link_ksettings_add_link_mode(cmd, supported,
|
||||||
ethtool_link_ksettings_add_link_mode(cmd, supported,
|
25000baseSR_Full);
|
||||||
25000baseSR_Full);
|
ethtool_link_ksettings_add_link_mode(cmd, advertising,
|
||||||
ethtool_link_ksettings_add_link_mode(cmd, advertising,
|
25000baseSR_Full);
|
||||||
25000baseSR_Full);
|
break;
|
||||||
break;
|
case SPEED_10000:
|
||||||
case SPEED_10000:
|
if (link_mode == QETH_LINK_MODE_FIBRE_LONG) {
|
||||||
ethtool_link_ksettings_add_link_mode(cmd, supported,
|
ethtool_link_ksettings_add_link_mode(cmd, supported,
|
||||||
10000baseT_Full);
|
10000baseLR_Full);
|
||||||
ethtool_link_ksettings_add_link_mode(cmd, advertising,
|
ethtool_link_ksettings_add_link_mode(cmd, advertising,
|
||||||
10000baseT_Full);
|
10000baseLR_Full);
|
||||||
fallthrough;
|
} else if (link_mode == QETH_LINK_MODE_FIBRE_SHORT) {
|
||||||
case SPEED_1000:
|
ethtool_link_ksettings_add_link_mode(cmd, supported,
|
||||||
ethtool_link_ksettings_add_link_mode(cmd, supported,
|
10000baseSR_Full);
|
||||||
1000baseT_Full);
|
ethtool_link_ksettings_add_link_mode(cmd, advertising,
|
||||||
ethtool_link_ksettings_add_link_mode(cmd, advertising,
|
10000baseSR_Full);
|
||||||
1000baseT_Full);
|
}
|
||||||
ethtool_link_ksettings_add_link_mode(cmd, supported,
|
break;
|
||||||
1000baseT_Half);
|
case SPEED_1000:
|
||||||
ethtool_link_ksettings_add_link_mode(cmd, advertising,
|
ethtool_link_ksettings_add_link_mode(cmd, supported,
|
||||||
1000baseT_Half);
|
1000baseX_Full);
|
||||||
fallthrough;
|
ethtool_link_ksettings_add_link_mode(cmd, advertising,
|
||||||
case SPEED_100:
|
1000baseX_Full);
|
||||||
ethtool_link_ksettings_add_link_mode(cmd, supported,
|
break;
|
||||||
100baseT_Full);
|
default:
|
||||||
ethtool_link_ksettings_add_link_mode(cmd, advertising,
|
break;
|
||||||
100baseT_Full);
|
}
|
||||||
ethtool_link_ksettings_add_link_mode(cmd, supported,
|
|
||||||
100baseT_Half);
|
|
||||||
ethtool_link_ksettings_add_link_mode(cmd, advertising,
|
|
||||||
100baseT_Half);
|
|
||||||
fallthrough;
|
|
||||||
case SPEED_10:
|
|
||||||
ethtool_link_ksettings_add_link_mode(cmd, supported,
|
|
||||||
10baseT_Full);
|
|
||||||
ethtool_link_ksettings_add_link_mode(cmd, advertising,
|
|
||||||
10baseT_Full);
|
|
||||||
ethtool_link_ksettings_add_link_mode(cmd, supported,
|
|
||||||
10baseT_Half);
|
|
||||||
ethtool_link_ksettings_add_link_mode(cmd, advertising,
|
|
||||||
10baseT_Half);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -420,7 +446,7 @@ static int qeth_get_link_ksettings(struct net_device *netdev,
|
||||||
cmd->base.port = link_info.port;
|
cmd->base.port = link_info.port;
|
||||||
}
|
}
|
||||||
|
|
||||||
qeth_set_ethtool_link_modes(cmd);
|
qeth_set_ethtool_link_modes(cmd, card->info.link_info.link_mode);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue