diff options
author | Ursula Braun <ursula.braun@de.ibm.com> | 2009-11-11 19:11:43 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-11-16 05:42:07 -0500 |
commit | aa90922479513db0d080239324d0d04701418ba5 (patch) | |
tree | 6399b72c47c9826049a62d8217f1613f729c47dd /drivers/s390/net | |
parent | f20b04597b9f75dce16c898abb487eff06ddf677 (diff) |
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: Ursula Braun <ursula.braun@de.ibm.com>
Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/s390/net')
-rw-r--r-- | drivers/s390/net/qeth_core_main.c | 26 | ||||
-rw-r--r-- | drivers/s390/net/qeth_l2_main.c | 26 | ||||
-rw-r--r-- | drivers/s390/net/qeth_l3_main.c | 25 |
3 files changed, 31 insertions, 46 deletions
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index 2c71948c71a1..819a3b5a647d 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
@@ -3883,30 +3883,36 @@ static int qeth_core_driver_group(const char *buf, struct device *root_dev, | |||
3883 | int qeth_core_hardsetup_card(struct qeth_card *card) | 3883 | int qeth_core_hardsetup_card(struct qeth_card *card) |
3884 | { | 3884 | { |
3885 | struct qdio_ssqd_desc *ssqd; | 3885 | struct qdio_ssqd_desc *ssqd; |
3886 | int retries = 3; | 3886 | int retries = 0; |
3887 | int mpno = 0; | 3887 | int mpno = 0; |
3888 | int rc; | 3888 | int rc; |
3889 | 3889 | ||
3890 | QETH_DBF_TEXT(SETUP, 2, "hrdsetup"); | 3890 | QETH_DBF_TEXT(SETUP, 2, "hrdsetup"); |
3891 | atomic_set(&card->force_alloc_skb, 0); | 3891 | atomic_set(&card->force_alloc_skb, 0); |
3892 | retry: | 3892 | retry: |
3893 | if (retries < 3) { | 3893 | if (retries) |
3894 | QETH_DBF_MESSAGE(2, "%s Retrying to do IDX activates.\n", | 3894 | QETH_DBF_MESSAGE(2, "%s Retrying to do IDX activates.\n", |
3895 | dev_name(&card->gdev->dev)); | 3895 | dev_name(&card->gdev->dev)); |
3896 | ccw_device_set_offline(CARD_DDEV(card)); | 3896 | ccw_device_set_offline(CARD_DDEV(card)); |
3897 | ccw_device_set_offline(CARD_WDEV(card)); | 3897 | ccw_device_set_offline(CARD_WDEV(card)); |
3898 | ccw_device_set_offline(CARD_RDEV(card)); | 3898 | ccw_device_set_offline(CARD_RDEV(card)); |
3899 | ccw_device_set_online(CARD_RDEV(card)); | 3899 | rc = ccw_device_set_online(CARD_RDEV(card)); |
3900 | ccw_device_set_online(CARD_WDEV(card)); | 3900 | if (rc) |
3901 | ccw_device_set_online(CARD_DDEV(card)); | 3901 | goto retriable; |
3902 | } | 3902 | rc = ccw_device_set_online(CARD_WDEV(card)); |
3903 | if (rc) | ||
3904 | goto retriable; | ||
3905 | rc = ccw_device_set_online(CARD_DDEV(card)); | ||
3906 | if (rc) | ||
3907 | goto retriable; | ||
3903 | rc = qeth_qdio_clear_card(card, card->info.type != QETH_CARD_TYPE_IQD); | 3908 | rc = qeth_qdio_clear_card(card, card->info.type != QETH_CARD_TYPE_IQD); |
3909 | retriable: | ||
3904 | if (rc == -ERESTARTSYS) { | 3910 | if (rc == -ERESTARTSYS) { |
3905 | QETH_DBF_TEXT(SETUP, 2, "break1"); | 3911 | QETH_DBF_TEXT(SETUP, 2, "break1"); |
3906 | return rc; | 3912 | return rc; |
3907 | } else if (rc) { | 3913 | } else if (rc) { |
3908 | QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc); | 3914 | QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc); |
3909 | if (--retries < 0) | 3915 | if (++retries > 3) |
3910 | goto out; | 3916 | goto out; |
3911 | else | 3917 | else |
3912 | goto retry; | 3918 | goto retry; |
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c index a63a3dfcdf63..372f2c0cd547 100644 --- a/drivers/s390/net/qeth_l2_main.c +++ b/drivers/s390/net/qeth_l2_main.c | |||
@@ -940,30 +940,17 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode) | |||
940 | 940 | ||
941 | qeth_set_allowed_threads(card, QETH_RECOVER_THREAD, 1); | 941 | qeth_set_allowed_threads(card, QETH_RECOVER_THREAD, 1); |
942 | recover_flag = card->state; | 942 | recover_flag = card->state; |
943 | rc = ccw_device_set_online(CARD_RDEV(card)); | ||
944 | if (rc) { | ||
945 | QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc); | ||
946 | return -EIO; | ||
947 | } | ||
948 | rc = ccw_device_set_online(CARD_WDEV(card)); | ||
949 | if (rc) { | ||
950 | QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc); | ||
951 | return -EIO; | ||
952 | } | ||
953 | rc = ccw_device_set_online(CARD_DDEV(card)); | ||
954 | if (rc) { | ||
955 | QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc); | ||
956 | return -EIO; | ||
957 | } | ||
958 | |||
959 | rc = qeth_core_hardsetup_card(card); | 943 | rc = qeth_core_hardsetup_card(card); |
960 | if (rc) { | 944 | if (rc) { |
961 | QETH_DBF_TEXT_(SETUP, 2, "2err%d", rc); | 945 | QETH_DBF_TEXT_(SETUP, 2, "2err%d", rc); |
946 | rc = -ENODEV; | ||
962 | goto out_remove; | 947 | goto out_remove; |
963 | } | 948 | } |
964 | 949 | ||
965 | if (!card->dev && qeth_l2_setup_netdev(card)) | 950 | if (!card->dev && qeth_l2_setup_netdev(card)) { |
951 | rc = -ENODEV; | ||
966 | goto out_remove; | 952 | goto out_remove; |
953 | } | ||
967 | 954 | ||
968 | if (card->info.type != QETH_CARD_TYPE_OSN) | 955 | if (card->info.type != QETH_CARD_TYPE_OSN) |
969 | qeth_l2_send_setmac(card, &card->dev->dev_addr[0]); | 956 | 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 | card->lan_online = 0; | 970 | card->lan_online = 0; |
984 | return 0; | 971 | return 0; |
985 | } | 972 | } |
973 | rc = -ENODEV; | ||
986 | goto out_remove; | 974 | goto out_remove; |
987 | } else | 975 | } else |
988 | card->lan_online = 1; | 976 | card->lan_online = 1; |
@@ -999,6 +987,7 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode) | |||
999 | rc = qeth_init_qdio_queues(card); | 987 | rc = qeth_init_qdio_queues(card); |
1000 | if (rc) { | 988 | if (rc) { |
1001 | QETH_DBF_TEXT_(SETUP, 2, "6err%d", rc); | 989 | QETH_DBF_TEXT_(SETUP, 2, "6err%d", rc); |
990 | rc = -ENODEV; | ||
1002 | goto out_remove; | 991 | goto out_remove; |
1003 | } | 992 | } |
1004 | card->state = CARD_STATE_SOFTSETUP; | 993 | card->state = CARD_STATE_SOFTSETUP; |
@@ -1020,6 +1009,7 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode) | |||
1020 | /* let user_space know that device is online */ | 1009 | /* let user_space know that device is online */ |
1021 | kobject_uevent(&gdev->dev.kobj, KOBJ_CHANGE); | 1010 | kobject_uevent(&gdev->dev.kobj, KOBJ_CHANGE); |
1022 | return 0; | 1011 | return 0; |
1012 | |||
1023 | out_remove: | 1013 | out_remove: |
1024 | card->use_hard_stop = 1; | 1014 | card->use_hard_stop = 1; |
1025 | qeth_l2_stop_card(card, 0); | 1015 | qeth_l2_stop_card(card, 0); |
@@ -1030,7 +1020,7 @@ out_remove: | |||
1030 | card->state = CARD_STATE_RECOVER; | 1020 | card->state = CARD_STATE_RECOVER; |
1031 | else | 1021 | else |
1032 | card->state = CARD_STATE_DOWN; | 1022 | card->state = CARD_STATE_DOWN; |
1033 | return -ENODEV; | 1023 | return rc; |
1034 | } | 1024 | } |
1035 | 1025 | ||
1036 | static int qeth_l2_set_online(struct ccwgroup_device *gdev) | 1026 | static int qeth_l2_set_online(struct ccwgroup_device *gdev) |
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index dd6766672a00..03f67bb51e99 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c | |||
@@ -3156,32 +3156,19 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode) | |||
3156 | qeth_set_allowed_threads(card, QETH_RECOVER_THREAD, 1); | 3156 | qeth_set_allowed_threads(card, QETH_RECOVER_THREAD, 1); |
3157 | 3157 | ||
3158 | recover_flag = card->state; | 3158 | recover_flag = card->state; |
3159 | rc = ccw_device_set_online(CARD_RDEV(card)); | ||
3160 | if (rc) { | ||
3161 | QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc); | ||
3162 | return -EIO; | ||
3163 | } | ||
3164 | rc = ccw_device_set_online(CARD_WDEV(card)); | ||
3165 | if (rc) { | ||
3166 | QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc); | ||
3167 | return -EIO; | ||
3168 | } | ||
3169 | rc = ccw_device_set_online(CARD_DDEV(card)); | ||
3170 | if (rc) { | ||
3171 | QETH_DBF_TEXT_(SETUP, 2, "1err%d", rc); | ||
3172 | return -EIO; | ||
3173 | } | ||
3174 | |||
3175 | rc = qeth_core_hardsetup_card(card); | 3159 | rc = qeth_core_hardsetup_card(card); |
3176 | if (rc) { | 3160 | if (rc) { |
3177 | QETH_DBF_TEXT_(SETUP, 2, "2err%d", rc); | 3161 | QETH_DBF_TEXT_(SETUP, 2, "2err%d", rc); |
3162 | rc = -ENODEV; | ||
3178 | goto out_remove; | 3163 | goto out_remove; |
3179 | } | 3164 | } |
3180 | 3165 | ||
3181 | qeth_l3_query_ipassists(card, QETH_PROT_IPV4); | 3166 | qeth_l3_query_ipassists(card, QETH_PROT_IPV4); |
3182 | 3167 | ||
3183 | if (!card->dev && qeth_l3_setup_netdev(card)) | 3168 | if (!card->dev && qeth_l3_setup_netdev(card)) { |
3169 | rc = -ENODEV; | ||
3184 | goto out_remove; | 3170 | goto out_remove; |
3171 | } | ||
3185 | 3172 | ||
3186 | card->state = CARD_STATE_HARDSETUP; | 3173 | card->state = CARD_STATE_HARDSETUP; |
3187 | qeth_print_status_message(card); | 3174 | qeth_print_status_message(card); |
@@ -3198,6 +3185,7 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode) | |||
3198 | card->lan_online = 0; | 3185 | card->lan_online = 0; |
3199 | return 0; | 3186 | return 0; |
3200 | } | 3187 | } |
3188 | rc = -ENODEV; | ||
3201 | goto out_remove; | 3189 | goto out_remove; |
3202 | } else | 3190 | } else |
3203 | card->lan_online = 1; | 3191 | card->lan_online = 1; |
@@ -3220,6 +3208,7 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode) | |||
3220 | rc = qeth_init_qdio_queues(card); | 3208 | rc = qeth_init_qdio_queues(card); |
3221 | if (rc) { | 3209 | if (rc) { |
3222 | QETH_DBF_TEXT_(SETUP, 2, "6err%d", rc); | 3210 | QETH_DBF_TEXT_(SETUP, 2, "6err%d", rc); |
3211 | rc = -ENODEV; | ||
3223 | goto out_remove; | 3212 | goto out_remove; |
3224 | } | 3213 | } |
3225 | card->state = CARD_STATE_SOFTSETUP; | 3214 | card->state = CARD_STATE_SOFTSETUP; |
@@ -3250,7 +3239,7 @@ out_remove: | |||
3250 | card->state = CARD_STATE_RECOVER; | 3239 | card->state = CARD_STATE_RECOVER; |
3251 | else | 3240 | else |
3252 | card->state = CARD_STATE_DOWN; | 3241 | card->state = CARD_STATE_DOWN; |
3253 | return -ENODEV; | 3242 | return rc; |
3254 | } | 3243 | } |
3255 | 3244 | ||
3256 | static int qeth_l3_set_online(struct ccwgroup_device *gdev) | 3245 | static int qeth_l3_set_online(struct ccwgroup_device *gdev) |