fc.c (6f50fa2a6f1395ad5f59ce7b87730f1f3ea19d76) fc.c (c0f2f45be2976abe973c8cd544f38e2d928771b0)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (c) 2016 Avago Technologies. All rights reserved.
4 */
5#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
6#include <linux/module.h>
7#include <linux/parser.h>
8#include <uapi/scsi/fc/fc_fs.h>

--- 2634 unchanged lines hidden (view full) ---

2643
2644 /*
2645 * Check controller capabilities
2646 *
2647 * todo:- add code to check if ctrl attributes changed from
2648 * prior connection values
2649 */
2650
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (c) 2016 Avago Technologies. All rights reserved.
4 */
5#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
6#include <linux/module.h>
7#include <linux/parser.h>
8#include <uapi/scsi/fc/fc_fs.h>

--- 2634 unchanged lines hidden (view full) ---

2643
2644 /*
2645 * Check controller capabilities
2646 *
2647 * todo:- add code to check if ctrl attributes changed from
2648 * prior connection values
2649 */
2650
2651 ret = nvmf_reg_read64(&ctrl->ctrl, NVME_REG_CAP, &ctrl->ctrl.cap);
2652 if (ret) {
2653 dev_err(ctrl->ctrl.device,
2654 "prop_get NVME_REG_CAP failed\n");
2655 goto out_disconnect_admin_queue;
2656 }
2657
2658 ctrl->ctrl.sqsize =
2659 min_t(int, NVME_CAP_MQES(ctrl->ctrl.cap), ctrl->ctrl.sqsize);
2660
2661 ret = nvme_enable_ctrl(&ctrl->ctrl, ctrl->ctrl.cap);
2651 ret = nvme_enable_ctrl(&ctrl->ctrl);
2662 if (ret)
2663 goto out_disconnect_admin_queue;
2664
2665 ctrl->ctrl.max_hw_sectors =
2666 (ctrl->lport->ops->max_sgl_segments - 1) << (PAGE_SHIFT - 9);
2667
2668 ret = nvme_init_identify(&ctrl->ctrl);
2669 if (ret)

--- 99 unchanged lines hidden (view full) ---

2769 * will have an aborted status. The done path will return the
2770 * io requests back to the block layer as part of normal completions
2771 * (but with error status).
2772 */
2773 if (ctrl->ctrl.queue_count > 1) {
2774 nvme_stop_queues(&ctrl->ctrl);
2775 blk_mq_tagset_busy_iter(&ctrl->tag_set,
2776 nvme_fc_terminate_exchange, &ctrl->ctrl);
2652 if (ret)
2653 goto out_disconnect_admin_queue;
2654
2655 ctrl->ctrl.max_hw_sectors =
2656 (ctrl->lport->ops->max_sgl_segments - 1) << (PAGE_SHIFT - 9);
2657
2658 ret = nvme_init_identify(&ctrl->ctrl);
2659 if (ret)

--- 99 unchanged lines hidden (view full) ---

2759 * will have an aborted status. The done path will return the
2760 * io requests back to the block layer as part of normal completions
2761 * (but with error status).
2762 */
2763 if (ctrl->ctrl.queue_count > 1) {
2764 nvme_stop_queues(&ctrl->ctrl);
2765 blk_mq_tagset_busy_iter(&ctrl->tag_set,
2766 nvme_fc_terminate_exchange, &ctrl->ctrl);
2767 blk_mq_tagset_wait_completed_request(&ctrl->tag_set);
2777 }
2778
2779 /*
2780 * Other transports, which don't have link-level contexts bound
2781 * to sqe's, would try to gracefully shutdown the controller by
2782 * writing the registers for shutdown and polling (call
2783 * nvme_shutdown_ctrl()). Given a bunch of i/o was potentially
2784 * just aborted and we will wait on those contexts, and given

--- 6 unchanged lines hidden (view full) ---

2791 /*
2792 * clean up the admin queue. Same thing as above.
2793 * use blk_mq_tagset_busy_itr() and the transport routine to
2794 * terminate the exchanges.
2795 */
2796 blk_mq_quiesce_queue(ctrl->ctrl.admin_q);
2797 blk_mq_tagset_busy_iter(&ctrl->admin_tag_set,
2798 nvme_fc_terminate_exchange, &ctrl->ctrl);
2768 }
2769
2770 /*
2771 * Other transports, which don't have link-level contexts bound
2772 * to sqe's, would try to gracefully shutdown the controller by
2773 * writing the registers for shutdown and polling (call
2774 * nvme_shutdown_ctrl()). Given a bunch of i/o was potentially
2775 * just aborted and we will wait on those contexts, and given

--- 6 unchanged lines hidden (view full) ---

2782 /*
2783 * clean up the admin queue. Same thing as above.
2784 * use blk_mq_tagset_busy_itr() and the transport routine to
2785 * terminate the exchanges.
2786 */
2787 blk_mq_quiesce_queue(ctrl->ctrl.admin_q);
2788 blk_mq_tagset_busy_iter(&ctrl->admin_tag_set,
2789 nvme_fc_terminate_exchange, &ctrl->ctrl);
2790 blk_mq_tagset_wait_completed_request(&ctrl->admin_tag_set);
2799
2800 /* kill the aens as they are a separate path */
2801 nvme_fc_abort_aen_ops(ctrl);
2802
2803 /* wait for all io that had to be aborted */
2804 spin_lock_irq(&ctrl->lock);
2805 wait_event_lock_irq(ctrl->ioabort_wait, ctrl->iocnt == 0, ctrl->lock);
2806 ctrl->flags &= ~FCCTRL_TERMIO;

--- 718 unchanged lines hidden ---
2791
2792 /* kill the aens as they are a separate path */
2793 nvme_fc_abort_aen_ops(ctrl);
2794
2795 /* wait for all io that had to be aborted */
2796 spin_lock_irq(&ctrl->lock);
2797 wait_event_lock_irq(ctrl->ioabort_wait, ctrl->iocnt == 0, ctrl->lock);
2798 ctrl->flags &= ~FCCTRL_TERMIO;

--- 718 unchanged lines hidden ---