fc.c (f9c5af5f8ff14a31468546b9b1a876d537019e9a) | fc.c (d09f2b45f346f0a9e5e1b5fcea531b1b393671dc) |
---|---|
1/* 2 * Copyright (c) 2016 Avago Technologies. All rights reserved. 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of version 2 of the GNU General Public License as 6 * published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful. --- 2218 unchanged lines hidden (view full) --- 2227 if (ret) 2228 goto out_delete_hw_queues; 2229 2230 return 0; 2231 2232out_delete_hw_queues: 2233 nvme_fc_delete_hw_io_queues(ctrl); 2234out_cleanup_blk_queue: | 1/* 2 * Copyright (c) 2016 Avago Technologies. All rights reserved. 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of version 2 of the GNU General Public License as 6 * published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful. --- 2218 unchanged lines hidden (view full) --- 2227 if (ret) 2228 goto out_delete_hw_queues; 2229 2230 return 0; 2231 2232out_delete_hw_queues: 2233 nvme_fc_delete_hw_io_queues(ctrl); 2234out_cleanup_blk_queue: |
2235 nvme_stop_keep_alive(&ctrl->ctrl); | |
2236 blk_cleanup_queue(ctrl->ctrl.connect_q); 2237out_free_tag_set: 2238 blk_mq_free_tag_set(&ctrl->tag_set); 2239 nvme_fc_free_io_queues(ctrl); 2240 2241 /* force put free routine to ignore io queues */ 2242 ctrl->ctrl.tagset = NULL; 2243 --- 117 unchanged lines hidden (view full) --- 2361 2362 /* FC-NVME does not have other data in the capsule */ 2363 if (ctrl->ctrl.icdoff) { 2364 dev_err(ctrl->ctrl.device, "icdoff %d is not supported!\n", 2365 ctrl->ctrl.icdoff); 2366 goto out_disconnect_admin_queue; 2367 } 2368 | 2235 blk_cleanup_queue(ctrl->ctrl.connect_q); 2236out_free_tag_set: 2237 blk_mq_free_tag_set(&ctrl->tag_set); 2238 nvme_fc_free_io_queues(ctrl); 2239 2240 /* force put free routine to ignore io queues */ 2241 ctrl->ctrl.tagset = NULL; 2242 --- 117 unchanged lines hidden (view full) --- 2360 2361 /* FC-NVME does not have other data in the capsule */ 2362 if (ctrl->ctrl.icdoff) { 2363 dev_err(ctrl->ctrl.device, "icdoff %d is not supported!\n", 2364 ctrl->ctrl.icdoff); 2365 goto out_disconnect_admin_queue; 2366 } 2367 |
2369 nvme_start_keep_alive(&ctrl->ctrl); 2370 | |
2371 /* FC-NVME supports normal SGL Data Block Descriptors */ 2372 2373 if (opts->queue_size > ctrl->ctrl.maxcmd) { 2374 /* warn if maxcmd is lower than queue_size */ 2375 dev_warn(ctrl->ctrl.device, 2376 "queue_size %zu > ctrl maxcmd %u, reducing " 2377 "to queue_size\n", 2378 opts->queue_size, ctrl->ctrl.maxcmd); --- 17 unchanged lines hidden (view full) --- 2396 goto out_term_aen_ops; 2397 } 2398 2399 changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_LIVE); 2400 WARN_ON_ONCE(!changed); 2401 2402 ctrl->ctrl.nr_reconnects = 0; 2403 | 2368 /* FC-NVME supports normal SGL Data Block Descriptors */ 2369 2370 if (opts->queue_size > ctrl->ctrl.maxcmd) { 2371 /* warn if maxcmd is lower than queue_size */ 2372 dev_warn(ctrl->ctrl.device, 2373 "queue_size %zu > ctrl maxcmd %u, reducing " 2374 "to queue_size\n", 2375 opts->queue_size, ctrl->ctrl.maxcmd); --- 17 unchanged lines hidden (view full) --- 2393 goto out_term_aen_ops; 2394 } 2395 2396 changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_LIVE); 2397 WARN_ON_ONCE(!changed); 2398 2399 ctrl->ctrl.nr_reconnects = 0; 2400 |
2404 if (ctrl->ctrl.queue_count > 1) { 2405 nvme_start_queues(&ctrl->ctrl); 2406 nvme_queue_scan(&ctrl->ctrl); 2407 nvme_queue_async_events(&ctrl->ctrl); 2408 } | 2401 nvme_start_ctrl(&ctrl->ctrl); |
2409 2410 return 0; /* Success */ 2411 2412out_term_aen_ops: 2413 nvme_fc_term_aen_ops(ctrl); | 2402 2403 return 0; /* Success */ 2404 2405out_term_aen_ops: 2406 nvme_fc_term_aen_ops(ctrl); |
2414 nvme_stop_keep_alive(&ctrl->ctrl); | |
2415out_disconnect_admin_queue: 2416 /* send a Disconnect(association) LS to fc-nvme target */ 2417 nvme_fc_xmt_disconnect_assoc(ctrl); 2418out_delete_hw_queue: 2419 __nvme_fc_delete_hw_queue(ctrl, &ctrl->queues[0], 0); 2420out_free_queue: 2421 nvme_fc_free_queue(&ctrl->queues[0]); 2422 --- 6 unchanged lines hidden (view full) --- 2429 * outstanding ios on them terminated via FC ABTS. 2430 * On the link side: the association is terminated. 2431 */ 2432static void 2433nvme_fc_delete_association(struct nvme_fc_ctrl *ctrl) 2434{ 2435 unsigned long flags; 2436 | 2407out_disconnect_admin_queue: 2408 /* send a Disconnect(association) LS to fc-nvme target */ 2409 nvme_fc_xmt_disconnect_assoc(ctrl); 2410out_delete_hw_queue: 2411 __nvme_fc_delete_hw_queue(ctrl, &ctrl->queues[0], 0); 2412out_free_queue: 2413 nvme_fc_free_queue(&ctrl->queues[0]); 2414 --- 6 unchanged lines hidden (view full) --- 2421 * outstanding ios on them terminated via FC ABTS. 2422 * On the link side: the association is terminated. 2423 */ 2424static void 2425nvme_fc_delete_association(struct nvme_fc_ctrl *ctrl) 2426{ 2427 unsigned long flags; 2428 |
2437 nvme_stop_keep_alive(&ctrl->ctrl); 2438 | |
2439 spin_lock_irqsave(&ctrl->lock, flags); 2440 ctrl->flags |= FCCTRL_TERMIO; 2441 ctrl->iocnt = 0; 2442 spin_unlock_irqrestore(&ctrl->lock, flags); 2443 2444 /* 2445 * If io queues are present, stop them and terminate all outstanding 2446 * ios on them. As FC allocates FC exchange for each io, the --- 65 unchanged lines hidden (view full) --- 2512static void 2513nvme_fc_delete_ctrl_work(struct work_struct *work) 2514{ 2515 struct nvme_fc_ctrl *ctrl = 2516 container_of(work, struct nvme_fc_ctrl, delete_work); 2517 2518 cancel_work_sync(&ctrl->ctrl.reset_work); 2519 cancel_delayed_work_sync(&ctrl->connect_work); | 2429 spin_lock_irqsave(&ctrl->lock, flags); 2430 ctrl->flags |= FCCTRL_TERMIO; 2431 ctrl->iocnt = 0; 2432 spin_unlock_irqrestore(&ctrl->lock, flags); 2433 2434 /* 2435 * If io queues are present, stop them and terminate all outstanding 2436 * ios on them. As FC allocates FC exchange for each io, the --- 65 unchanged lines hidden (view full) --- 2502static void 2503nvme_fc_delete_ctrl_work(struct work_struct *work) 2504{ 2505 struct nvme_fc_ctrl *ctrl = 2506 container_of(work, struct nvme_fc_ctrl, delete_work); 2507 2508 cancel_work_sync(&ctrl->ctrl.reset_work); 2509 cancel_delayed_work_sync(&ctrl->connect_work); |
2520 | 2510 nvme_stop_ctrl(&ctrl->ctrl); 2511 nvme_remove_namespaces(&ctrl->ctrl); |
2521 /* 2522 * kill the association on the link side. this will block 2523 * waiting for io to terminate 2524 */ 2525 nvme_fc_delete_association(ctrl); 2526 2527 /* 2528 * tear down the controller --- 78 unchanged lines hidden (view full) --- 2607 2608static void 2609nvme_fc_reset_ctrl_work(struct work_struct *work) 2610{ 2611 struct nvme_fc_ctrl *ctrl = 2612 container_of(work, struct nvme_fc_ctrl, ctrl.reset_work); 2613 int ret; 2614 | 2512 /* 2513 * kill the association on the link side. this will block 2514 * waiting for io to terminate 2515 */ 2516 nvme_fc_delete_association(ctrl); 2517 2518 /* 2519 * tear down the controller --- 78 unchanged lines hidden (view full) --- 2598 2599static void 2600nvme_fc_reset_ctrl_work(struct work_struct *work) 2601{ 2602 struct nvme_fc_ctrl *ctrl = 2603 container_of(work, struct nvme_fc_ctrl, ctrl.reset_work); 2604 int ret; 2605 |
2606 nvme_stop_ctrl(&ctrl->ctrl); |
|
2615 /* will block will waiting for io to terminate */ 2616 nvme_fc_delete_association(ctrl); 2617 2618 ret = nvme_fc_create_association(ctrl); 2619 if (ret) 2620 nvme_fc_reconnect_or_delete(ctrl, ret); 2621 else 2622 dev_info(ctrl->ctrl.device, --- 329 unchanged lines hidden --- | 2607 /* will block will waiting for io to terminate */ 2608 nvme_fc_delete_association(ctrl); 2609 2610 ret = nvme_fc_create_association(ctrl); 2611 if (ret) 2612 nvme_fc_reconnect_or_delete(ctrl, ret); 2613 else 2614 dev_info(ctrl->ctrl.device, --- 329 unchanged lines hidden --- |