diff options
Diffstat (limited to 'drivers/s390/scsi/zfcp_aux.c')
-rw-r--r-- | drivers/s390/scsi/zfcp_aux.c | 90 |
1 files changed, 14 insertions, 76 deletions
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c index 1f9554e08013..324899c96efe 100644 --- a/drivers/s390/scsi/zfcp_aux.c +++ b/drivers/s390/scsi/zfcp_aux.c | |||
@@ -118,97 +118,32 @@ _zfcp_hex_dump(char *addr, int count) | |||
118 | 118 | ||
119 | #define ZFCP_LOG_AREA ZFCP_LOG_AREA_FSF | 119 | #define ZFCP_LOG_AREA ZFCP_LOG_AREA_FSF |
120 | 120 | ||
121 | static int zfcp_reqlist_init(struct zfcp_adapter *adapter) | 121 | static int zfcp_reqlist_alloc(struct zfcp_adapter *adapter) |
122 | { | 122 | { |
123 | int i; | 123 | int idx; |
124 | 124 | ||
125 | adapter->req_list = kcalloc(REQUEST_LIST_SIZE, sizeof(struct list_head), | 125 | adapter->req_list = kcalloc(REQUEST_LIST_SIZE, sizeof(struct list_head), |
126 | GFP_KERNEL); | 126 | GFP_KERNEL); |
127 | |||
128 | if (!adapter->req_list) | 127 | if (!adapter->req_list) |
129 | return -ENOMEM; | 128 | return -ENOMEM; |
130 | 129 | ||
131 | for (i=0; i<REQUEST_LIST_SIZE; i++) | 130 | for (idx = 0; idx < REQUEST_LIST_SIZE; idx++) |
132 | INIT_LIST_HEAD(&adapter->req_list[i]); | 131 | INIT_LIST_HEAD(&adapter->req_list[idx]); |
133 | |||
134 | return 0; | 132 | return 0; |
135 | } | 133 | } |
136 | 134 | ||
137 | static void zfcp_reqlist_free(struct zfcp_adapter *adapter) | 135 | static void zfcp_reqlist_free(struct zfcp_adapter *adapter) |
138 | { | 136 | { |
139 | struct zfcp_fsf_req *request, *tmp; | ||
140 | unsigned int i; | ||
141 | |||
142 | for (i=0; i<REQUEST_LIST_SIZE; i++) { | ||
143 | if (list_empty(&adapter->req_list[i])) | ||
144 | continue; | ||
145 | |||
146 | list_for_each_entry_safe(request, tmp, | ||
147 | &adapter->req_list[i], list) | ||
148 | list_del(&request->list); | ||
149 | } | ||
150 | |||
151 | kfree(adapter->req_list); | 137 | kfree(adapter->req_list); |
152 | } | 138 | } |
153 | 139 | ||
154 | void zfcp_reqlist_add(struct zfcp_adapter *adapter, | ||
155 | struct zfcp_fsf_req *fsf_req) | ||
156 | { | ||
157 | unsigned int i; | ||
158 | |||
159 | i = fsf_req->req_id % REQUEST_LIST_SIZE; | ||
160 | list_add_tail(&fsf_req->list, &adapter->req_list[i]); | ||
161 | } | ||
162 | |||
163 | void zfcp_reqlist_remove(struct zfcp_adapter *adapter, unsigned long req_id) | ||
164 | { | ||
165 | struct zfcp_fsf_req *request, *tmp; | ||
166 | unsigned int i, counter; | ||
167 | u64 dbg_tmp[2]; | ||
168 | |||
169 | i = req_id % REQUEST_LIST_SIZE; | ||
170 | BUG_ON(list_empty(&adapter->req_list[i])); | ||
171 | |||
172 | counter = 0; | ||
173 | list_for_each_entry_safe(request, tmp, &adapter->req_list[i], list) { | ||
174 | if (request->req_id == req_id) { | ||
175 | dbg_tmp[0] = (u64) atomic_read(&adapter->reqs_active); | ||
176 | dbg_tmp[1] = (u64) counter; | ||
177 | debug_event(adapter->erp_dbf, 4, (void *) dbg_tmp, 16); | ||
178 | list_del(&request->list); | ||
179 | break; | ||
180 | } | ||
181 | counter++; | ||
182 | } | ||
183 | } | ||
184 | |||
185 | struct zfcp_fsf_req *zfcp_reqlist_ismember(struct zfcp_adapter *adapter, | ||
186 | unsigned long req_id) | ||
187 | { | ||
188 | struct zfcp_fsf_req *request, *tmp; | ||
189 | unsigned int i; | ||
190 | |||
191 | /* 0 is reserved as an invalid req_id */ | ||
192 | if (req_id == 0) | ||
193 | return NULL; | ||
194 | |||
195 | i = req_id % REQUEST_LIST_SIZE; | ||
196 | |||
197 | list_for_each_entry_safe(request, tmp, &adapter->req_list[i], list) | ||
198 | if (request->req_id == req_id) | ||
199 | return request; | ||
200 | |||
201 | return NULL; | ||
202 | } | ||
203 | |||
204 | int zfcp_reqlist_isempty(struct zfcp_adapter *adapter) | 140 | int zfcp_reqlist_isempty(struct zfcp_adapter *adapter) |
205 | { | 141 | { |
206 | unsigned int i; | 142 | unsigned int idx; |
207 | 143 | ||
208 | for (i=0; i<REQUEST_LIST_SIZE; i++) | 144 | for (idx = 0; idx < REQUEST_LIST_SIZE; idx++) |
209 | if (!list_empty(&adapter->req_list[i])) | 145 | if (!list_empty(&adapter->req_list[idx])) |
210 | return 0; | 146 | return 0; |
211 | |||
212 | return 1; | 147 | return 1; |
213 | } | 148 | } |
214 | 149 | ||
@@ -913,6 +848,8 @@ zfcp_unit_enqueue(struct zfcp_port *port, fcp_lun_t fcp_lun) | |||
913 | unit->sysfs_device.release = zfcp_sysfs_unit_release; | 848 | unit->sysfs_device.release = zfcp_sysfs_unit_release; |
914 | dev_set_drvdata(&unit->sysfs_device, unit); | 849 | dev_set_drvdata(&unit->sysfs_device, unit); |
915 | 850 | ||
851 | init_waitqueue_head(&unit->scsi_scan_wq); | ||
852 | |||
916 | /* mark unit unusable as long as sysfs registration is not complete */ | 853 | /* mark unit unusable as long as sysfs registration is not complete */ |
917 | atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE, &unit->status); | 854 | atomic_set_mask(ZFCP_STATUS_COMMON_REMOVE, &unit->status); |
918 | 855 | ||
@@ -1104,7 +1041,7 @@ zfcp_adapter_enqueue(struct ccw_device *ccw_device) | |||
1104 | 1041 | ||
1105 | /* initialize list of fsf requests */ | 1042 | /* initialize list of fsf requests */ |
1106 | spin_lock_init(&adapter->req_list_lock); | 1043 | spin_lock_init(&adapter->req_list_lock); |
1107 | retval = zfcp_reqlist_init(adapter); | 1044 | retval = zfcp_reqlist_alloc(adapter); |
1108 | if (retval) { | 1045 | if (retval) { |
1109 | ZFCP_LOG_INFO("request list initialization failed\n"); | 1046 | ZFCP_LOG_INFO("request list initialization failed\n"); |
1110 | goto failed_low_mem_buffers; | 1047 | goto failed_low_mem_buffers; |
@@ -1165,6 +1102,7 @@ zfcp_adapter_enqueue(struct ccw_device *ccw_device) | |||
1165 | zfcp_sysfs_adapter_remove_files(&adapter->ccw_device->dev); | 1102 | zfcp_sysfs_adapter_remove_files(&adapter->ccw_device->dev); |
1166 | sysfs_failed: | 1103 | sysfs_failed: |
1167 | dev_set_drvdata(&ccw_device->dev, NULL); | 1104 | dev_set_drvdata(&ccw_device->dev, NULL); |
1105 | zfcp_reqlist_free(adapter); | ||
1168 | failed_low_mem_buffers: | 1106 | failed_low_mem_buffers: |
1169 | zfcp_free_low_mem_buffers(adapter); | 1107 | zfcp_free_low_mem_buffers(adapter); |
1170 | if (qdio_free(ccw_device) != 0) | 1108 | if (qdio_free(ccw_device) != 0) |
@@ -1497,7 +1435,7 @@ zfcp_fsf_incoming_els_plogi(struct zfcp_adapter *adapter, | |||
1497 | 1435 | ||
1498 | if (!port || (port->wwpn != (*(wwn_t *) &els_plogi->serv_param.wwpn))) { | 1436 | if (!port || (port->wwpn != (*(wwn_t *) &els_plogi->serv_param.wwpn))) { |
1499 | ZFCP_LOG_DEBUG("ignored incoming PLOGI for nonexisting port " | 1437 | ZFCP_LOG_DEBUG("ignored incoming PLOGI for nonexisting port " |
1500 | "with d_id 0x%08x on adapter %s\n", | 1438 | "with d_id 0x%06x on adapter %s\n", |
1501 | status_buffer->d_id, | 1439 | status_buffer->d_id, |
1502 | zfcp_get_busid_by_adapter(adapter)); | 1440 | zfcp_get_busid_by_adapter(adapter)); |
1503 | } else { | 1441 | } else { |
@@ -1522,7 +1460,7 @@ zfcp_fsf_incoming_els_logo(struct zfcp_adapter *adapter, | |||
1522 | 1460 | ||
1523 | if (!port || (port->wwpn != els_logo->nport_wwpn)) { | 1461 | if (!port || (port->wwpn != els_logo->nport_wwpn)) { |
1524 | ZFCP_LOG_DEBUG("ignored incoming LOGO for nonexisting port " | 1462 | ZFCP_LOG_DEBUG("ignored incoming LOGO for nonexisting port " |
1525 | "with d_id 0x%08x on adapter %s\n", | 1463 | "with d_id 0x%06x on adapter %s\n", |
1526 | status_buffer->d_id, | 1464 | status_buffer->d_id, |
1527 | zfcp_get_busid_by_adapter(adapter)); | 1465 | zfcp_get_busid_by_adapter(adapter)); |
1528 | } else { | 1466 | } else { |
@@ -1704,7 +1642,7 @@ static void zfcp_ns_gid_pn_handler(unsigned long data) | |||
1704 | /* looks like a valid d_id */ | 1642 | /* looks like a valid d_id */ |
1705 | port->d_id = ct_iu_resp->d_id & ZFCP_DID_MASK; | 1643 | port->d_id = ct_iu_resp->d_id & ZFCP_DID_MASK; |
1706 | atomic_set_mask(ZFCP_STATUS_PORT_DID_DID, &port->status); | 1644 | atomic_set_mask(ZFCP_STATUS_PORT_DID_DID, &port->status); |
1707 | ZFCP_LOG_DEBUG("adapter %s: wwpn=0x%016Lx ---> d_id=0x%08x\n", | 1645 | ZFCP_LOG_DEBUG("adapter %s: wwpn=0x%016Lx ---> d_id=0x%06x\n", |
1708 | zfcp_get_busid_by_port(port), port->wwpn, port->d_id); | 1646 | zfcp_get_busid_by_port(port), port->wwpn, port->d_id); |
1709 | goto out; | 1647 | goto out; |
1710 | 1648 | ||