diff options
Diffstat (limited to 'drivers/s390/scsi/zfcp_erp.c')
-rw-r--r-- | drivers/s390/scsi/zfcp_erp.c | 95 |
1 files changed, 87 insertions, 8 deletions
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c index 376cb0f6cb74..c4a6799aed44 100644 --- a/drivers/s390/scsi/zfcp_erp.c +++ b/drivers/s390/scsi/zfcp_erp.c | |||
@@ -82,6 +82,7 @@ static int zfcp_erp_adapter_strategy_open(struct zfcp_erp_action *); | |||
82 | static int zfcp_erp_adapter_strategy_open_qdio(struct zfcp_erp_action *); | 82 | static int zfcp_erp_adapter_strategy_open_qdio(struct zfcp_erp_action *); |
83 | static int zfcp_erp_adapter_strategy_open_fsf(struct zfcp_erp_action *); | 83 | static int zfcp_erp_adapter_strategy_open_fsf(struct zfcp_erp_action *); |
84 | static int zfcp_erp_adapter_strategy_open_fsf_xconfig(struct zfcp_erp_action *); | 84 | static int zfcp_erp_adapter_strategy_open_fsf_xconfig(struct zfcp_erp_action *); |
85 | static int zfcp_erp_adapter_strategy_open_fsf_xport(struct zfcp_erp_action *); | ||
85 | static int zfcp_erp_adapter_strategy_open_fsf_statusread( | 86 | static int zfcp_erp_adapter_strategy_open_fsf_statusread( |
86 | struct zfcp_erp_action *); | 87 | struct zfcp_erp_action *); |
87 | 88 | ||
@@ -2258,16 +2259,21 @@ zfcp_erp_adapter_strategy_close_qdio(struct zfcp_erp_action *erp_action) | |||
2258 | static int | 2259 | static int |
2259 | zfcp_erp_adapter_strategy_open_fsf(struct zfcp_erp_action *erp_action) | 2260 | zfcp_erp_adapter_strategy_open_fsf(struct zfcp_erp_action *erp_action) |
2260 | { | 2261 | { |
2261 | int retval; | 2262 | int xconfig, xport; |
2263 | |||
2264 | if (atomic_test_mask(ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED, | ||
2265 | &erp_action->adapter->status)) { | ||
2266 | zfcp_erp_adapter_strategy_open_fsf_xport(erp_action); | ||
2267 | atomic_set(&erp_action->adapter->erp_counter, 0); | ||
2268 | return ZFCP_ERP_FAILED; | ||
2269 | } | ||
2262 | 2270 | ||
2263 | /* do 'exchange configuration data' */ | 2271 | xconfig = zfcp_erp_adapter_strategy_open_fsf_xconfig(erp_action); |
2264 | retval = zfcp_erp_adapter_strategy_open_fsf_xconfig(erp_action); | 2272 | xport = zfcp_erp_adapter_strategy_open_fsf_xport(erp_action); |
2265 | if (retval == ZFCP_ERP_FAILED) | 2273 | if ((xconfig == ZFCP_ERP_FAILED) || (xport == ZFCP_ERP_FAILED)) |
2266 | return retval; | 2274 | return ZFCP_ERP_FAILED; |
2267 | 2275 | ||
2268 | /* start the desired number of Status Reads */ | 2276 | return zfcp_erp_adapter_strategy_open_fsf_statusread(erp_action); |
2269 | retval = zfcp_erp_adapter_strategy_open_fsf_statusread(erp_action); | ||
2270 | return retval; | ||
2271 | } | 2277 | } |
2272 | 2278 | ||
2273 | /* | 2279 | /* |
@@ -2350,6 +2356,76 @@ zfcp_erp_adapter_strategy_open_fsf_xconfig(struct zfcp_erp_action *erp_action) | |||
2350 | return retval; | 2356 | return retval; |
2351 | } | 2357 | } |
2352 | 2358 | ||
2359 | static int | ||
2360 | zfcp_erp_adapter_strategy_open_fsf_xport(struct zfcp_erp_action *erp_action) | ||
2361 | { | ||
2362 | int retval = ZFCP_ERP_SUCCEEDED; | ||
2363 | int retries; | ||
2364 | int sleep; | ||
2365 | struct zfcp_adapter *adapter = erp_action->adapter; | ||
2366 | |||
2367 | atomic_clear_mask(ZFCP_STATUS_ADAPTER_XPORT_OK, &adapter->status); | ||
2368 | |||
2369 | for (retries = 0; ; retries++) { | ||
2370 | ZFCP_LOG_DEBUG("Doing exchange port data\n"); | ||
2371 | zfcp_erp_action_to_running(erp_action); | ||
2372 | zfcp_erp_timeout_init(erp_action); | ||
2373 | if (zfcp_fsf_exchange_port_data(erp_action, adapter, NULL)) { | ||
2374 | retval = ZFCP_ERP_FAILED; | ||
2375 | debug_text_event(adapter->erp_dbf, 5, "a_fstx_xf"); | ||
2376 | ZFCP_LOG_INFO("error: initiation of exchange of " | ||
2377 | "port data failed for adapter %s\n", | ||
2378 | zfcp_get_busid_by_adapter(adapter)); | ||
2379 | break; | ||
2380 | } | ||
2381 | debug_text_event(adapter->erp_dbf, 6, "a_fstx_xok"); | ||
2382 | ZFCP_LOG_DEBUG("Xchange underway\n"); | ||
2383 | |||
2384 | /* | ||
2385 | * Why this works: | ||
2386 | * Both the normal completion handler as well as the timeout | ||
2387 | * handler will do an 'up' when the 'exchange port data' | ||
2388 | * request completes or times out. Thus, the signal to go on | ||
2389 | * won't be lost utilizing this semaphore. | ||
2390 | * Furthermore, this 'adapter_reopen' action is | ||
2391 | * guaranteed to be the only action being there (highest action | ||
2392 | * which prevents other actions from being created). | ||
2393 | * Resulting from that, the wake signal recognized here | ||
2394 | * _must_ be the one belonging to the 'exchange port | ||
2395 | * data' request. | ||
2396 | */ | ||
2397 | down(&adapter->erp_ready_sem); | ||
2398 | if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) { | ||
2399 | ZFCP_LOG_INFO("error: exchange of port data " | ||
2400 | "for adapter %s timed out\n", | ||
2401 | zfcp_get_busid_by_adapter(adapter)); | ||
2402 | break; | ||
2403 | } | ||
2404 | |||
2405 | if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED, | ||
2406 | &adapter->status)) | ||
2407 | break; | ||
2408 | |||
2409 | ZFCP_LOG_DEBUG("host connection still initialising... " | ||
2410 | "waiting and retrying...\n"); | ||
2411 | /* sleep a little bit before retry */ | ||
2412 | sleep = retries < ZFCP_EXCHANGE_PORT_DATA_SHORT_RETRIES ? | ||
2413 | ZFCP_EXCHANGE_PORT_DATA_SHORT_SLEEP : | ||
2414 | ZFCP_EXCHANGE_PORT_DATA_LONG_SLEEP; | ||
2415 | msleep(jiffies_to_msecs(sleep)); | ||
2416 | } | ||
2417 | |||
2418 | if (atomic_test_mask(ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED, | ||
2419 | &adapter->status)) { | ||
2420 | ZFCP_LOG_INFO("error: exchange of port data for " | ||
2421 | "adapter %s failed\n", | ||
2422 | zfcp_get_busid_by_adapter(adapter)); | ||
2423 | retval = ZFCP_ERP_FAILED; | ||
2424 | } | ||
2425 | |||
2426 | return retval; | ||
2427 | } | ||
2428 | |||
2353 | /* | 2429 | /* |
2354 | * function: | 2430 | * function: |
2355 | * | 2431 | * |
@@ -3599,6 +3675,9 @@ zfcp_erp_adapter_access_changed(struct zfcp_adapter *adapter) | |||
3599 | struct zfcp_port *port; | 3675 | struct zfcp_port *port; |
3600 | unsigned long flags; | 3676 | unsigned long flags; |
3601 | 3677 | ||
3678 | if (adapter->connection_features & FSF_FEATURE_NPIV_MODE) | ||
3679 | return; | ||
3680 | |||
3602 | debug_text_event(adapter->erp_dbf, 3, "a_access_recover"); | 3681 | debug_text_event(adapter->erp_dbf, 3, "a_access_recover"); |
3603 | debug_event(adapter->erp_dbf, 3, &adapter->name, 8); | 3682 | debug_event(adapter->erp_dbf, 3, &adapter->name, 8); |
3604 | 3683 | ||