aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_erp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/scsi/zfcp_erp.c')
-rw-r--r--drivers/s390/scsi/zfcp_erp.c114
1 files changed, 4 insertions, 110 deletions
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index ee19be13e708..4a6d08363d4b 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -114,41 +114,6 @@ static void zfcp_erp_action_to_running(struct zfcp_erp_action *);
114static void zfcp_erp_memwait_handler(unsigned long); 114static void zfcp_erp_memwait_handler(unsigned long);
115 115
116/** 116/**
117 * zfcp_close_qdio - close qdio queues for an adapter
118 */
119static void zfcp_close_qdio(struct zfcp_adapter *adapter)
120{
121 struct zfcp_qdio_queue *req_queue;
122 int first, count;
123
124 if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_QDIOUP, &adapter->status))
125 return;
126
127 /* clear QDIOUP flag, thus do_QDIO is not called during qdio_shutdown */
128 req_queue = &adapter->request_queue;
129 write_lock_irq(&req_queue->queue_lock);
130 atomic_clear_mask(ZFCP_STATUS_ADAPTER_QDIOUP, &adapter->status);
131 write_unlock_irq(&req_queue->queue_lock);
132
133 while (qdio_shutdown(adapter->ccw_device,
134 QDIO_FLAG_CLEANUP_USING_CLEAR) == -EINPROGRESS)
135 ssleep(1);
136
137 /* cleanup used outbound sbals */
138 count = atomic_read(&req_queue->free_count);
139 if (count < QDIO_MAX_BUFFERS_PER_Q) {
140 first = (req_queue->free_index+count) % QDIO_MAX_BUFFERS_PER_Q;
141 count = QDIO_MAX_BUFFERS_PER_Q - count;
142 zfcp_qdio_zero_sbals(req_queue->buffer, first, count);
143 }
144 req_queue->free_index = 0;
145 atomic_set(&req_queue->free_count, 0);
146 req_queue->distance_from_int = 0;
147 adapter->response_queue.free_index = 0;
148 atomic_set(&adapter->response_queue.free_count, 0);
149}
150
151/**
152 * zfcp_close_fsf - stop FSF operations for an adapter 117 * zfcp_close_fsf - stop FSF operations for an adapter
153 * 118 *
154 * Dismiss and cleanup all pending fsf_reqs (this wakes up all initiators of 119 * Dismiss and cleanup all pending fsf_reqs (this wakes up all initiators of
@@ -158,7 +123,7 @@ static void zfcp_close_qdio(struct zfcp_adapter *adapter)
158static void zfcp_close_fsf(struct zfcp_adapter *adapter) 123static void zfcp_close_fsf(struct zfcp_adapter *adapter)
159{ 124{
160 /* close queues to ensure that buffers are not accessed by adapter */ 125 /* close queues to ensure that buffers are not accessed by adapter */
161 zfcp_close_qdio(adapter); 126 zfcp_qdio_close(adapter);
162 zfcp_fsf_req_dismiss_all(adapter); 127 zfcp_fsf_req_dismiss_all(adapter);
163 /* reset FSF request sequence number */ 128 /* reset FSF request sequence number */
164 adapter->fsf_req_seq_no = 0; 129 adapter->fsf_req_seq_no = 0;
@@ -1735,88 +1700,17 @@ zfcp_erp_adapter_strategy_generic(struct zfcp_erp_action *erp_action, int close)
1735static int 1700static int
1736zfcp_erp_adapter_strategy_open_qdio(struct zfcp_erp_action *erp_action) 1701zfcp_erp_adapter_strategy_open_qdio(struct zfcp_erp_action *erp_action)
1737{ 1702{
1738 int retval;
1739 int i;
1740 volatile struct qdio_buffer_element *sbale;
1741 struct zfcp_adapter *adapter = erp_action->adapter; 1703 struct zfcp_adapter *adapter = erp_action->adapter;
1742 1704
1743 if (atomic_test_mask(ZFCP_STATUS_ADAPTER_QDIOUP, &adapter->status)) { 1705 if (zfcp_qdio_open(adapter))
1744 ZFCP_LOG_NORMAL("bug: second attempt to set up QDIO on " 1706 return ZFCP_ERP_FAILED;
1745 "adapter %s\n",
1746 zfcp_get_busid_by_adapter(adapter));
1747 goto failed_sanity;
1748 }
1749
1750 if (qdio_establish(&adapter->qdio_init_data) != 0) {
1751 ZFCP_LOG_INFO("error: establishment of QDIO queues failed "
1752 "on adapter %s\n",
1753 zfcp_get_busid_by_adapter(adapter));
1754 goto failed_qdio_establish;
1755 }
1756
1757 if (qdio_activate(adapter->ccw_device, 0) != 0) {
1758 ZFCP_LOG_INFO("error: activation of QDIO queues failed "
1759 "on adapter %s\n",
1760 zfcp_get_busid_by_adapter(adapter));
1761 goto failed_qdio_activate;
1762 }
1763
1764 /*
1765 * put buffers into response queue,
1766 */
1767 for (i = 0; i < QDIO_MAX_BUFFERS_PER_Q; i++) {
1768 sbale = &(adapter->response_queue.buffer[i]->element[0]);
1769 sbale->length = 0;
1770 sbale->flags = SBAL_FLAGS_LAST_ENTRY;
1771 sbale->addr = NULL;
1772 }
1773
1774 ZFCP_LOG_TRACE("calling do_QDIO on adapter %s (flags=0x%x, "
1775 "queue_no=%i, index_in_queue=%i, count=%i)\n",
1776 zfcp_get_busid_by_adapter(adapter),
1777 QDIO_FLAG_SYNC_INPUT, 0, 0, QDIO_MAX_BUFFERS_PER_Q);
1778
1779 retval = do_QDIO(adapter->ccw_device,
1780 QDIO_FLAG_SYNC_INPUT,
1781 0, 0, QDIO_MAX_BUFFERS_PER_Q, NULL);
1782
1783 if (retval) {
1784 ZFCP_LOG_NORMAL("bug: setup of QDIO failed (retval=%d)\n",
1785 retval);
1786 goto failed_do_qdio;
1787 } else {
1788 adapter->response_queue.free_index = 0;
1789 atomic_set(&adapter->response_queue.free_count, 0);
1790 ZFCP_LOG_DEBUG("%i buffers successfully enqueued to "
1791 "response queue\n", QDIO_MAX_BUFFERS_PER_Q);
1792 }
1793 /* set index of first avalable SBALS / number of available SBALS */
1794 adapter->request_queue.free_index = 0;
1795 atomic_set(&adapter->request_queue.free_count, QDIO_MAX_BUFFERS_PER_Q);
1796 adapter->request_queue.distance_from_int = 0;
1797 1707
1798 /* initialize waitqueue used to wait for free SBALs in requests queue */ 1708 /* initialize waitqueue used to wait for free SBALs in requests queue */
1799 init_waitqueue_head(&adapter->request_wq); 1709 init_waitqueue_head(&adapter->request_wq);
1800 1710
1801 /* ok, we did it - skip all cleanups for different failures */ 1711 /* ok, we did it - skip all cleanups for different failures */
1802 atomic_set_mask(ZFCP_STATUS_ADAPTER_QDIOUP, &adapter->status); 1712 atomic_set_mask(ZFCP_STATUS_ADAPTER_QDIOUP, &adapter->status);
1803 retval = ZFCP_ERP_SUCCEEDED; 1713 return ZFCP_ERP_SUCCEEDED;
1804 goto out;
1805
1806 failed_do_qdio:
1807 /* NOP */
1808
1809 failed_qdio_activate:
1810 while (qdio_shutdown(adapter->ccw_device,
1811 QDIO_FLAG_CLEANUP_USING_CLEAR) == -EINPROGRESS)
1812 ssleep(1);
1813
1814 failed_qdio_establish:
1815 failed_sanity:
1816 retval = ZFCP_ERP_FAILED;
1817
1818 out:
1819 return retval;
1820} 1714}
1821 1715
1822 1716