s390/qeth: do early device setup for z/VM IQD NICs
qeth currently supports early setup for OSM and OSN devices. This patch adds early setup support for z/VM HiperSockets, since they can only be coupled to L3 networks. Based on an initial version by Dmitriy Lakhvich. Signed-off-by: Julian Wiedmann <jwi@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
79a04e40f7
commit
c70eb09dc2
|
@ -659,6 +659,7 @@ struct qeth_card_info {
|
||||||
int max_mtu;
|
int max_mtu;
|
||||||
int broadcast_capable;
|
int broadcast_capable;
|
||||||
int unique_id;
|
int unique_id;
|
||||||
|
bool layer_enforced;
|
||||||
struct qeth_card_blkt blkt;
|
struct qeth_card_blkt blkt;
|
||||||
enum qeth_ipa_promisc_modes promisc_mode;
|
enum qeth_ipa_promisc_modes promisc_mode;
|
||||||
__u32 diagass_support;
|
__u32 diagass_support;
|
||||||
|
@ -696,6 +697,7 @@ struct qeth_osn_info {
|
||||||
};
|
};
|
||||||
|
|
||||||
enum qeth_discipline_id {
|
enum qeth_discipline_id {
|
||||||
|
QETH_DISCIPLINE_UNDETERMINED = -1,
|
||||||
QETH_DISCIPLINE_LAYER3 = 0,
|
QETH_DISCIPLINE_LAYER3 = 0,
|
||||||
QETH_DISCIPLINE_LAYER2 = 1,
|
QETH_DISCIPLINE_LAYER2 = 1,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1723,6 +1723,25 @@ static void qeth_configure_unitaddr(struct qeth_card *card, char *prcd)
|
||||||
(prcd[0x11] == _ascebc['M']));
|
(prcd[0x11] == _ascebc['M']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Determine whether the device requires a specific layer discipline */
|
||||||
|
static enum qeth_discipline_id qeth_enforce_discipline(struct qeth_card *card)
|
||||||
|
{
|
||||||
|
if (card->info.type == QETH_CARD_TYPE_OSM ||
|
||||||
|
card->info.type == QETH_CARD_TYPE_OSN) {
|
||||||
|
QETH_DBF_TEXT(SETUP, 3, "force l2");
|
||||||
|
return QETH_DISCIPLINE_LAYER2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* virtual HiperSocket is L3 only: */
|
||||||
|
if (card->info.guestlan && card->info.type == QETH_CARD_TYPE_IQD) {
|
||||||
|
QETH_DBF_TEXT(SETUP, 3, "force l3");
|
||||||
|
return QETH_DISCIPLINE_LAYER3;
|
||||||
|
}
|
||||||
|
|
||||||
|
QETH_DBF_TEXT(SETUP, 3, "force no");
|
||||||
|
return QETH_DISCIPLINE_UNDETERMINED;
|
||||||
|
}
|
||||||
|
|
||||||
static void qeth_configure_blkt_default(struct qeth_card *card, char *prcd)
|
static void qeth_configure_blkt_default(struct qeth_card *card, char *prcd)
|
||||||
{
|
{
|
||||||
QETH_DBF_TEXT(SETUP, 2, "cfgblkt");
|
QETH_DBF_TEXT(SETUP, 2, "cfgblkt");
|
||||||
|
@ -5485,6 +5504,7 @@ int qeth_core_load_discipline(struct qeth_card *card,
|
||||||
enum qeth_discipline_id discipline)
|
enum qeth_discipline_id discipline)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
mutex_lock(&qeth_mod_mutex);
|
mutex_lock(&qeth_mod_mutex);
|
||||||
switch (discipline) {
|
switch (discipline) {
|
||||||
case QETH_DISCIPLINE_LAYER3:
|
case QETH_DISCIPLINE_LAYER3:
|
||||||
|
@ -5495,7 +5515,10 @@ int qeth_core_load_discipline(struct qeth_card *card,
|
||||||
card->discipline = try_then_request_module(
|
card->discipline = try_then_request_module(
|
||||||
symbol_get(qeth_l2_discipline), "qeth_l2");
|
symbol_get(qeth_l2_discipline), "qeth_l2");
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!card->discipline) {
|
if (!card->discipline) {
|
||||||
dev_err(&card->gdev->dev, "There is no kernel module to "
|
dev_err(&card->gdev->dev, "There is no kernel module to "
|
||||||
"support discipline %d\n", discipline);
|
"support discipline %d\n", discipline);
|
||||||
|
@ -5598,6 +5621,7 @@ static int qeth_core_probe_device(struct ccwgroup_device *gdev)
|
||||||
struct qeth_card *card;
|
struct qeth_card *card;
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
int rc;
|
int rc;
|
||||||
|
enum qeth_discipline_id enforced_disc;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
char dbf_name[DBF_NAME_LEN];
|
char dbf_name[DBF_NAME_LEN];
|
||||||
|
|
||||||
|
@ -5645,10 +5669,15 @@ static int qeth_core_probe_device(struct ccwgroup_device *gdev)
|
||||||
goto err_card;
|
goto err_card;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (card->info.type) {
|
qeth_determine_capabilities(card);
|
||||||
case QETH_CARD_TYPE_OSN:
|
enforced_disc = qeth_enforce_discipline(card);
|
||||||
case QETH_CARD_TYPE_OSM:
|
switch (enforced_disc) {
|
||||||
rc = qeth_core_load_discipline(card, QETH_DISCIPLINE_LAYER2);
|
case QETH_DISCIPLINE_UNDETERMINED:
|
||||||
|
gdev->dev.type = &qeth_generic_devtype;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
card->info.layer_enforced = true;
|
||||||
|
rc = qeth_core_load_discipline(card, enforced_disc);
|
||||||
if (rc)
|
if (rc)
|
||||||
goto err_card;
|
goto err_card;
|
||||||
|
|
||||||
|
@ -5659,16 +5688,11 @@ static int qeth_core_probe_device(struct ccwgroup_device *gdev)
|
||||||
if (rc)
|
if (rc)
|
||||||
goto err_disc;
|
goto err_disc;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
gdev->dev.type = &qeth_generic_devtype;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
write_lock_irqsave(&qeth_core_card_list.rwlock, flags);
|
write_lock_irqsave(&qeth_core_card_list.rwlock, flags);
|
||||||
list_add_tail(&card->list, &qeth_core_card_list.list);
|
list_add_tail(&card->list, &qeth_core_card_list.list);
|
||||||
write_unlock_irqrestore(&qeth_core_card_list.rwlock, flags);
|
write_unlock_irqrestore(&qeth_core_card_list.rwlock, flags);
|
||||||
|
|
||||||
qeth_determine_capabilities(card);
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_disc:
|
err_disc:
|
||||||
|
@ -5705,7 +5729,7 @@ static int qeth_core_set_online(struct ccwgroup_device *gdev)
|
||||||
{
|
{
|
||||||
struct qeth_card *card = dev_get_drvdata(&gdev->dev);
|
struct qeth_card *card = dev_get_drvdata(&gdev->dev);
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
int def_discipline;
|
enum qeth_discipline_id def_discipline;
|
||||||
|
|
||||||
if (!card->discipline) {
|
if (!card->discipline) {
|
||||||
if (card->info.type == QETH_CARD_TYPE_IQD)
|
if (card->info.type == QETH_CARD_TYPE_IQD)
|
||||||
|
|
|
@ -413,7 +413,7 @@ static ssize_t qeth_dev_layer2_store(struct device *dev,
|
||||||
|
|
||||||
if (card->options.layer2 == newdis)
|
if (card->options.layer2 == newdis)
|
||||||
goto out;
|
goto out;
|
||||||
if (card->info.type == QETH_CARD_TYPE_OSM) {
|
if (card->info.layer_enforced) {
|
||||||
/* fixed layer, can't switch */
|
/* fixed layer, can't switch */
|
||||||
rc = -EOPNOTSUPP;
|
rc = -EOPNOTSUPP;
|
||||||
goto out;
|
goto out;
|
||||||
|
|
Loading…
Reference in New Issue