Commit baf7998d authored by Julian Wiedmann's avatar Julian Wiedmann Committed by Jakub Kicinski

s390/qeth: set static link info during initialization

Hard-code the minimal link info at initialization time, after we
obtained the link_type. qeth_get_link_ksettings() can still override
this with more accurate data from QUERY CARD INFO later on.

Don't set arbitrary defaults for unknown OSA link types, they
certainly won't match any future type.
Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 4139b2b1
......@@ -738,6 +738,7 @@ struct qeth_card_info {
struct qeth_card_blkt blkt;
__u32 diagass_support;
__u32 hwtrap;
struct qeth_link_info link_info;
};
enum qeth_discipline_id {
......
......@@ -4951,6 +4951,42 @@ int qeth_query_card_info(struct qeth_card *card,
return qeth_send_ipa_cmd(card, iob, qeth_query_card_info_cb, link_info);
}
static void qeth_init_link_info(struct qeth_card *card)
{
card->info.link_info.duplex = DUPLEX_FULL;
if (IS_IQD(card) || IS_VM_NIC(card)) {
card->info.link_info.speed = SPEED_10000;
card->info.link_info.port = PORT_FIBRE;
} else {
switch (card->info.link_type) {
case QETH_LINK_TYPE_FAST_ETH:
case QETH_LINK_TYPE_LANE_ETH100:
card->info.link_info.speed = SPEED_100;
card->info.link_info.port = PORT_TP;
break;
case QETH_LINK_TYPE_GBIT_ETH:
case QETH_LINK_TYPE_LANE_ETH1000:
card->info.link_info.speed = SPEED_1000;
card->info.link_info.port = PORT_FIBRE;
break;
case QETH_LINK_TYPE_10GBIT_ETH:
card->info.link_info.speed = SPEED_10000;
card->info.link_info.port = PORT_FIBRE;
break;
case QETH_LINK_TYPE_25GBIT_ETH:
card->info.link_info.speed = SPEED_25000;
card->info.link_info.port = PORT_FIBRE;
break;
default:
dev_info(&card->gdev->dev, "Unknown link type %x\n",
card->info.link_type);
card->info.link_info.speed = SPEED_UNKNOWN;
card->info.link_info.port = PORT_OTHER;
}
}
}
/**
* qeth_vm_request_mac() - Request a hypervisor-managed MAC address
* @card: pointer to a qeth_card
......@@ -5335,6 +5371,8 @@ static int qeth_hardsetup_card(struct qeth_card *card, bool *carrier_ok)
goto out;
}
qeth_init_link_info(card);
rc = qeth_init_qdio_queues(card);
if (rc) {
QETH_CARD_TEXT_(card, 2, "9err%d", rc);
......
......@@ -410,44 +410,16 @@ static int qeth_get_link_ksettings(struct net_device *netdev,
{
struct qeth_card *card = netdev->ml_priv;
struct qeth_link_info link_info;
enum qeth_link_types link_type;
if (IS_IQD(card) || IS_VM_NIC(card))
link_type = QETH_LINK_TYPE_10GBIT_ETH;
else
link_type = card->info.link_type;
cmd->base.duplex = DUPLEX_FULL;
cmd->base.speed = card->info.link_info.speed;
cmd->base.duplex = card->info.link_info.duplex;
cmd->base.port = card->info.link_info.port;
cmd->base.autoneg = AUTONEG_ENABLE;
cmd->base.phy_address = 0;
cmd->base.mdio_support = 0;
cmd->base.eth_tp_mdix = ETH_TP_MDI_INVALID;
cmd->base.eth_tp_mdix_ctrl = ETH_TP_MDI_INVALID;
switch (link_type) {
case QETH_LINK_TYPE_FAST_ETH:
case QETH_LINK_TYPE_LANE_ETH100:
cmd->base.speed = SPEED_100;
cmd->base.port = PORT_TP;
break;
case QETH_LINK_TYPE_GBIT_ETH:
case QETH_LINK_TYPE_LANE_ETH1000:
cmd->base.speed = SPEED_1000;
cmd->base.port = PORT_FIBRE;
break;
case QETH_LINK_TYPE_10GBIT_ETH:
cmd->base.speed = SPEED_10000;
cmd->base.port = PORT_FIBRE;
break;
case QETH_LINK_TYPE_25GBIT_ETH:
cmd->base.speed = SPEED_25000;
cmd->base.port = PORT_FIBRE;
break;
default:
cmd->base.speed = SPEED_10;
cmd->base.port = PORT_TP;
}
/* Check if we can obtain more accurate information. */
if (!qeth_query_card_info(card, &link_info)) {
if (link_info.speed != SPEED_UNKNOWN)
......
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