提交 aa909224 编写于 作者: U Ursula Braun 提交者: David S. Miller

qeth: Recognize return codes of ccw_device_set_online

Setting a qeth device online requires to call function
ccw_device_set_online() for read-, write-, and data-subchannel.
Failures should be detected immediately without an attempt to
invoke follow-on activity qeth_qdio_clear_card().,

In addition, ccw_device_set_online calls are consolidated in
qeth_core_main.c only.
Signed-off-by: NUrsula Braun <ursula.braun@de.ibm.com>
Signed-off-by: NFrank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 f20b0459
...@@ -3883,30 +3883,36 @@ static int qeth_core_driver_group(const char *buf, struct device *root_dev, ...@@ -3883,30 +3883,36 @@ static int qeth_core_driver_group(const char *buf, struct device *root_dev,
int qeth_core_hardsetup_card(struct qeth_card *card) int qeth_core_hardsetup_card(struct qeth_card *card)
{ {
struct qdio_ssqd_desc *ssqd; struct qdio_ssqd_desc *ssqd;
int retries = 3; int retries = 0;
int mpno = 0; int mpno = 0;
int rc; int rc;
QETH_DBF_TEXT(SETUP, 2, "hrdsetup"); QETH_DBF_TEXT(SETUP, 2, "hrdsetup");
atomic_set(&card->force_alloc_skb, 0); atomic_set(&card->force_alloc_skb, 0);
retry: retry:
if (retries < 3) { if (retries)
QETH_DBF_MESSAGE(2, "%s Retrying to do IDX activates.\n", QETH_DBF_MESSAGE(2, "%s Retrying to do IDX activates.\n",
dev_name(&card->gdev->dev)); dev_name(&card->gdev->dev));
ccw_device_set_offline(CARD_DDEV(card)); ccw_device_set_offline(CARD_DDEV(card));
ccw_device_set_offline(CARD_WDEV(card)); ccw_device_set_offline(CARD_WDEV(card));
ccw_device_set_offline(CARD_RDEV(card)); ccw_device_set_offline(CARD_RDEV(card));
ccw_device_set_online(CARD_RDEV(card)); rc = ccw_device_set_online(CARD_RDEV(card));
ccw_device_set_online(CARD_WDEV(card)); if (rc)
ccw_device_set_online(CARD_DDEV(card)); goto retriable;
} rc = ccw_device_set_online(CARD_WDEV(card));
if (rc)
goto retriable;
rc = ccw_device_set_online(CARD_DDEV(card));
if (rc)
goto retriable;
rc = qeth_qdio_clear_card(card, card->info.type != QETH_CARD_TYPE_IQD); rc = qeth_qdio_clear_card(card, card->info.type != QETH_CARD_TYPE_IQD);
retriable:
if (rc == -ERESTARTSYS) { if (rc == -ERESTARTSYS) {
QETH_DBF_TEXT(SETUP, 2, "break1"); QETH_DBF_TEXT(SETUP, 2, "break1");
return rc; return rc;
} else if (rc) { } else if (rc) {
QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc); QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc);
if (--retries < 0) if (++retries > 3)
goto out; goto out;
else else
goto retry; goto retry;
......
...@@ -940,30 +940,17 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode) ...@@ -940,30 +940,17 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode)
qeth_set_allowed_threads(card, QETH_RECOVER_THREAD, 1); qeth_set_allowed_threads(card, QETH_RECOVER_THREAD, 1);
recover_flag = card->state; recover_flag = card->state;
rc = ccw_device_set_online(CARD_RDEV(card));
if (rc) {
QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc);
return -EIO;
}
rc = ccw_device_set_online(CARD_WDEV(card));
if (rc) {
QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc);
return -EIO;
}
rc = ccw_device_set_online(CARD_DDEV(card));
if (rc) {
QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc);
return -EIO;
}
rc = qeth_core_hardsetup_card(card); rc = qeth_core_hardsetup_card(card);
if (rc) { if (rc) {
QETH_DBF_TEXT_(SETUP, 2, "2err%d", rc); QETH_DBF_TEXT_(SETUP, 2, "2err%d", rc);
rc = -ENODEV;
goto out_remove; goto out_remove;
} }
if (!card->dev && qeth_l2_setup_netdev(card)) if (!card->dev && qeth_l2_setup_netdev(card)) {
rc = -ENODEV;
goto out_remove; goto out_remove;
}
if (card->info.type != QETH_CARD_TYPE_OSN) if (card->info.type != QETH_CARD_TYPE_OSN)
qeth_l2_send_setmac(card, &card->dev->dev_addr[0]); qeth_l2_send_setmac(card, &card->dev->dev_addr[0]);
...@@ -983,6 +970,7 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode) ...@@ -983,6 +970,7 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode)
card->lan_online = 0; card->lan_online = 0;
return 0; return 0;
} }
rc = -ENODEV;
goto out_remove; goto out_remove;
} else } else
card->lan_online = 1; card->lan_online = 1;
...@@ -999,6 +987,7 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode) ...@@ -999,6 +987,7 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode)
rc = qeth_init_qdio_queues(card); rc = qeth_init_qdio_queues(card);
if (rc) { if (rc) {
QETH_DBF_TEXT_(SETUP, 2, "6err%d", rc); QETH_DBF_TEXT_(SETUP, 2, "6err%d", rc);
rc = -ENODEV;
goto out_remove; goto out_remove;
} }
card->state = CARD_STATE_SOFTSETUP; card->state = CARD_STATE_SOFTSETUP;
...@@ -1020,6 +1009,7 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode) ...@@ -1020,6 +1009,7 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode)
/* let user_space know that device is online */ /* let user_space know that device is online */
kobject_uevent(&gdev->dev.kobj, KOBJ_CHANGE); kobject_uevent(&gdev->dev.kobj, KOBJ_CHANGE);
return 0; return 0;
out_remove: out_remove:
card->use_hard_stop = 1; card->use_hard_stop = 1;
qeth_l2_stop_card(card, 0); qeth_l2_stop_card(card, 0);
...@@ -1030,7 +1020,7 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode) ...@@ -1030,7 +1020,7 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode)
card->state = CARD_STATE_RECOVER; card->state = CARD_STATE_RECOVER;
else else
card->state = CARD_STATE_DOWN; card->state = CARD_STATE_DOWN;
return -ENODEV; return rc;
} }
static int qeth_l2_set_online(struct ccwgroup_device *gdev) static int qeth_l2_set_online(struct ccwgroup_device *gdev)
......
...@@ -3156,32 +3156,19 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode) ...@@ -3156,32 +3156,19 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode)
qeth_set_allowed_threads(card, QETH_RECOVER_THREAD, 1); qeth_set_allowed_threads(card, QETH_RECOVER_THREAD, 1);
recover_flag = card->state; recover_flag = card->state;
rc = ccw_device_set_online(CARD_RDEV(card));
if (rc) {
QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc);
return -EIO;
}
rc = ccw_device_set_online(CARD_WDEV(card));
if (rc) {
QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc);
return -EIO;
}
rc = ccw_device_set_online(CARD_DDEV(card));
if (rc) {
QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc);
return -EIO;
}
rc = qeth_core_hardsetup_card(card); rc = qeth_core_hardsetup_card(card);
if (rc) { if (rc) {
QETH_DBF_TEXT_(SETUP, 2, "2err%d", rc); QETH_DBF_TEXT_(SETUP, 2, "2err%d", rc);
rc = -ENODEV;
goto out_remove; goto out_remove;
} }
qeth_l3_query_ipassists(card, QETH_PROT_IPV4); qeth_l3_query_ipassists(card, QETH_PROT_IPV4);
if (!card->dev && qeth_l3_setup_netdev(card)) if (!card->dev && qeth_l3_setup_netdev(card)) {
rc = -ENODEV;
goto out_remove; goto out_remove;
}
card->state = CARD_STATE_HARDSETUP; card->state = CARD_STATE_HARDSETUP;
qeth_print_status_message(card); qeth_print_status_message(card);
...@@ -3198,6 +3185,7 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode) ...@@ -3198,6 +3185,7 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode)
card->lan_online = 0; card->lan_online = 0;
return 0; return 0;
} }
rc = -ENODEV;
goto out_remove; goto out_remove;
} else } else
card->lan_online = 1; card->lan_online = 1;
...@@ -3220,6 +3208,7 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode) ...@@ -3220,6 +3208,7 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode)
rc = qeth_init_qdio_queues(card); rc = qeth_init_qdio_queues(card);
if (rc) { if (rc) {
QETH_DBF_TEXT_(SETUP, 2, "6err%d", rc); QETH_DBF_TEXT_(SETUP, 2, "6err%d", rc);
rc = -ENODEV;
goto out_remove; goto out_remove;
} }
card->state = CARD_STATE_SOFTSETUP; card->state = CARD_STATE_SOFTSETUP;
...@@ -3250,7 +3239,7 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode) ...@@ -3250,7 +3239,7 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode)
card->state = CARD_STATE_RECOVER; card->state = CARD_STATE_RECOVER;
else else
card->state = CARD_STATE_DOWN; card->state = CARD_STATE_DOWN;
return -ENODEV; return rc;
} }
static int qeth_l3_set_online(struct ccwgroup_device *gdev) static int qeth_l3_set_online(struct ccwgroup_device *gdev)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册