]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/suse-2.6.27.31/patches.drivers/qla4xxx-5.01.00-k8_sles11-04-update
Add a patch to fix Intel E100 wake-on-lan problems.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.drivers / qla4xxx-5.01.00-k8_sles11-04-update
CommitLineData
2cb7cef9
BS
1From: David Somayajulu <david.somayajulu@qlogic.com>
2Subject: qla4xxx driver SLES 11 Beta6 update
3References: bnc#458186
4
5This updates the qla4xxx driver with the following bug fixes:
61. Fix the handling of qla4xxx firmware Device DataBase Entry removal.
72. Fix the pass thru scsi_cmnd handling. This prevented our
8 configuration tool SanSurfer from operating properly.
93. updates version to 5.01.00-k8_sles11-04
10
11and quite some whitespace fixes.
12
13Signed-off-by: David Somayajulu <david.somayajulu@qlogic.com>
14Signed-off-by: Hannes Reinecke <hare@suse.de>
15
16diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h
17index 5764a25..2b5af89 100644
18--- a/drivers/scsi/qla4xxx/ql4_def.h
19+++ b/drivers/scsi/qla4xxx/ql4_def.h
20@@ -144,7 +144,6 @@
21 #define RESET_FIRMWARE_TOV 30
22 #define LOGOUT_TOV 10
23 #define IOCB_TOV_MARGIN 10
24-#define ISNS_DEREG_TOV 5
25
26 #define MAX_RESET_HA_RETRIES 2
27
28@@ -232,6 +231,8 @@ struct ddb_entry {
29 uint8_t ip_addr[ISCSI_IPADDR_SIZE];
30 uint8_t iscsi_name[ISCSI_NAME_SIZE]; /* 72 x48 */
31 uint8_t iscsi_alias[0x20];
32+ uint8_t isid[6];
33+ uint8_t rsrvd[2];
34 };
35
36 /*
37@@ -243,6 +244,8 @@ struct ddb_entry {
38 * commands */
39 #define DDB_STATE_MISSING 2 /* Device logged off, trying
40 * to re-login */
41+#define DDB_STATE_REMOVED 3 /* The fw ddb_entry is freed
42+ * the session can be destroyed */
43
44 /*
45 * DDB flags.
46@@ -252,7 +255,7 @@ struct ddb_entry {
47 * logged it out */
48 #define DF_SCAN_ISSUED 2
49 #define DF_OFFLINE 3 /* Offline Device */
50-#define DF_DELETED 4 /* Device has been removed */
51+#define DF_REMOVE 4 /* FW DDB is destroyed */
52
53 /*
54 * Asynchronous Event Queue structure
55@@ -305,11 +308,10 @@ struct scsi_qla_host {
56 #define DPC_RELOGIN_DEVICE 3 /* 0x00000008 */
57 #define DPC_RESET_HA_DESTROY_DDB_LIST 4 /* 0x00000010 */
58 #define DPC_RESET_HA_INTR 5 /* 0x00000020 */
59-#define DPC_ISNS_RESTART 7 /* 0x00000080 */
60 #define DPC_AEN 9 /* 0x00000200 */
61 #define DPC_GET_DHCP_IP_ADDR 15 /* 0x00008000 */
62 #define DPC_OFFLINE_DEVICE 16 /* 0x00010000 */
63-#define DPC_DELETE_DEVICE 17 /* 0x00020000 */
64+#define DPC_REMOVE_DEVICE 17 /* 0x00020000 */
65
66 uint16_t iocb_cnt;
67 uint16_t iocb_hiwat;
68diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c
69index 3b38d79..cc17469 100644
70--- a/drivers/scsi/qla4xxx/ql4_init.c
71+++ b/drivers/scsi/qla4xxx/ql4_init.c
72@@ -14,7 +14,7 @@
73
74 /* link auto negotiation normally takes roughly 2s. */
75 /* If we don't have link in 3 times that period quit. */
76-#define QLA4XXX_LINK_UP_DELAY 6
77+#define QLA4XXX_LINK_UP_DELAY 6
78
79 /*
80 * QLogic ISP4xxx Hardware Support Function Prototypes.
81@@ -63,8 +63,10 @@ void qla4xxx_free_ddb(struct scsi_qla_host *ha, struct ddb_entry *ddb_entry)
82 list_del_init(&ddb_entry->list);
83
84 /* Remove device pointer from index mapping arrays */
85- ha->fw_ddb_index_map[ddb_entry->fw_ddb_index] = NULL;
86- ha->tot_ddbs--;
87+ if (!QL_DDB_STATE_REMOVED(ddb_entry)) {
88+ ha->fw_ddb_index_map[ddb_entry->fw_ddb_index] = NULL;
89+ ha->tot_ddbs--;
90+ }
91
92 /* Free memory and scsi-ml struct for device entry */
93 qla4xxx_destroy_sess(ddb_entry);
94@@ -267,14 +269,6 @@ static int qla4xxx_fw_ready(struct scsi_qla_host *ha)
95 (ha->addl_fw_state &
96 FW_ADDSTATE_LINK_UP) != 0 ?
97 "UP" : "DOWN"));
98- DEBUG2(dev_info(&ha->pdev->dev,
99- "scsi%ld: %s: iSNS Service "
100- "Started %s\n",
101- ha->host_no, __func__,
102- (ha->addl_fw_state &
103- FW_ADDSTATE_ISNS_SVC_ENABLED) != 0 ?
104- "YES" : "NO"));
105-
106 ready = 1;
107 break;
108 }
109@@ -341,6 +335,7 @@ static void qla4xxx_fill_ddb(struct ddb_entry *ddb_entry,
110
111 ddb_entry->port = le16_to_cpu(fw_ddb_entry->port);
112 ddb_entry->tpgt = le32_to_cpu(fw_ddb_entry->tgt_portal_grp);
113+ memcpy(ddb_entry->isid, fw_ddb_entry->isid, sizeof(ddb_entry->isid));
114 memcpy(&ddb_entry->iscsi_name[0], &fw_ddb_entry->iscsi_name[0],
115 min(sizeof(ddb_entry->iscsi_name),
116 sizeof(fw_ddb_entry->iscsi_name)));
117@@ -396,7 +391,7 @@ struct ddb_entry * qla4xxx_alloc_ddb(struct scsi_qla_host *ha,
118 * @ha: Pointer to host adapter structure.
119 *
120 * This routine searches for all valid firmware ddb entries and builds
121- * an internal ddb list. Ddbs that are considered valid are those with
122+ * an internal ddb list. Ddbs that are considered valid are those with
123 * a device state of SESSION_ACTIVE.
124 **/
125 static int qla4xxx_build_ddb_list(struct scsi_qla_host *ha)
126@@ -486,19 +481,6 @@ static int qla4xxx_build_ddb_list(struct scsi_qla_host *ha)
127 qla4xxx_fill_ddb(ddb_entry, fw_ddb_entry);
128 ddb_entry->fw_ddb_device_state = ddb_state;
129
130- if (ddb_entry->fw_ddb_device_state == DDB_DS_SESSION_ACTIVE) {
131- atomic_set(&ddb_entry->state, DDB_STATE_ONLINE);
132- dev_info(&ha->pdev->dev,
133- "scsi%ld: %s: ddb[%d] os[%d] marked ONLINE\n",
134- ha->host_no, __func__, ddb_entry->fw_ddb_index,
135- ddb_entry->os_target_id);
136- } else {
137- atomic_set(&ddb_entry->state, DDB_STATE_MISSING);
138- dev_info(&ha->pdev->dev,
139- "scsi%ld: %s: ddb[%d] os[%d] marked MISSING\n",
140- ha->host_no, __func__, ddb_entry->fw_ddb_index,
141- ddb_entry->os_target_id);
142- }
143 DEBUG6(dev_info(&ha->pdev->dev, "%s: DDB[%d] osIdx = %d State %04x"
144 " ConnErr %08x %d.%d.%d.%d:%04d \"%s\"\n", __func__,
145 fw_ddb_index, ddb_entry->os_target_id, ddb_state, conn_err,
146@@ -714,7 +696,7 @@ static int qla4xxx_initialize_ddb_list(struct scsi_qla_host *ha)
147 }
148
149 /**
150- * qla4xxx_update_ddb_list - update the driver ddb list
151+ * qla4xxx_reinitialize_ddb_list - update the driver ddb list
152 * @ha: pointer to host adapter structure.
153 *
154 * This routine obtains device information from the F/W database after
155@@ -735,11 +717,12 @@ int qla4xxx_reinitialize_ddb_list(struct scsi_qla_host *ha)
156
157 /* Update the device information for all devices. */
158 list_for_each_entry_safe(ddb_entry, detemp, &ha->ddb_list, list) {
159- if (qla4xxx_get_fwddb_entry(ha, ddb_entry->fw_ddb_index,
160- fw_ddb_entry, fw_ddb_entry_dma, NULL, NULL,
161- &ddb_entry->fw_ddb_device_state, NULL,
162- &ddb_entry->tcp_source_port_num,
163- &ddb_entry->connection_id) == QLA_SUCCESS) {
164+ if (!QL_DDB_STATE_REMOVED(ddb_entry) &&
165+ (qla4xxx_get_fwddb_entry(ha, ddb_entry->fw_ddb_index,
166+ fw_ddb_entry, fw_ddb_entry_dma, NULL, NULL,
167+ &ddb_entry->fw_ddb_device_state, NULL,
168+ &ddb_entry->tcp_source_port_num,
169+ &ddb_entry->connection_id) == QLA_SUCCESS)) {
170
171 qla4xxx_fill_ddb(ddb_entry, fw_ddb_entry);
172
173@@ -1192,8 +1175,13 @@ static void qla4xxx_add_device_dynamically(struct scsi_qla_host *ha,
174 }
175
176 list_for_each_entry(ddb_entry, &ha->ddb_list, list) {
177- if (memcmp(ddb_entry->iscsi_name, fw_ddb_entry->iscsi_name,
178- ISCSI_NAME_SIZE) == 0) {
179+ if ((memcmp(ddb_entry->iscsi_name, fw_ddb_entry->iscsi_name,
180+ ISCSI_NAME_SIZE) == 0) &&
181+ (ddb_entry->tpgt ==
182+ le32_to_cpu(fw_ddb_entry->tgt_portal_grp)) &&
183+ (memcmp(ddb_entry->isid, fw_ddb_entry->isid,
184+ sizeof(ddb_entry->isid)) == 0) &&
185+ !QL_DDB_STATE_REMOVED(ddb_entry)) {
186 found = 1;
187
188 DEBUG6(dev_info(&ha->pdev->dev, "%s found target ddb = 0x%p"
189diff --git a/drivers/scsi/qla4xxx/ql4_inline.h b/drivers/scsi/qla4xxx/ql4_inline.h
190index bdf2475..a93b817 100644
191--- a/drivers/scsi/qla4xxx/ql4_inline.h
192+++ b/drivers/scsi/qla4xxx/ql4_inline.h
193@@ -55,8 +55,8 @@ static inline void qla4xxx_check_for_clear_ddb(struct scsi_qla_host *ha,
194 dev_info(&ha->pdev->dev, "%s: ddb[%d] os[%d] freed\n",
195 __func__, ddb_entry->fw_ddb_index,
196 ddb_entry->os_target_id);
197- set_bit(DF_DELETED, &ddb_entry->flags);
198- set_bit(DPC_DELETE_DEVICE, &ha->dpc_flags);
199+ set_bit(DF_REMOVE, &ddb_entry->flags);
200+ set_bit(DPC_REMOVE_DEVICE, &ha->dpc_flags);
201 queue_work(ha->dpc_thread, &ha->dpc_work);
202 }
203 }
204diff --git a/drivers/scsi/qla4xxx/ql4_iocb.c b/drivers/scsi/qla4xxx/ql4_iocb.c
205index bfe4d1e..67071d6 100644
206--- a/drivers/scsi/qla4xxx/ql4_iocb.c
207+++ b/drivers/scsi/qla4xxx/ql4_iocb.c
208@@ -27,12 +27,6 @@ static void qla4xxx_build_scsi_iocbs(struct srb *srb,
209 cmd = srb->cmd;
210 ha = srb->ha;
211
212- if (!scsi_bufflen(cmd) || cmd->sc_data_direction == DMA_NONE) {
213- /* No data being transferred */
214- cmd_entry->ttlByteCnt = __constant_cpu_to_le32(0);
215- return;
216- }
217-
218 avail_dsds = COMMAND_SEG;
219 cur_dsd = (struct data_seg_a64 *) & (cmd_entry->dataseg[0]);
220
221@@ -43,6 +37,12 @@ static void qla4xxx_build_scsi_iocbs(struct srb *srb,
222 return;
223 }
224
225+ if (!scsi_bufflen(cmd) || cmd->sc_data_direction == DMA_NONE) {
226+ /* No data being transferred */
227+ cmd_entry->ttlByteCnt = __constant_cpu_to_le32(0);
228+ return;
229+ }
230+
231 scsi_for_each_sg(cmd, sg, tot_dsds, i) {
232 dma_addr_t sle_dma;
233
234@@ -155,7 +155,7 @@ int qla4xxx_send_command_to_isp(struct scsi_qla_host *ha, struct srb * srb)
235
236 int_to_scsilun(cmd->device->lun, &cmd_entry->lun);
237 cmd_entry->cmdSeqNum = cpu_to_le32(ddb_entry->CmdSn);
238- cmd_entry->ttlByteCnt = cpu_to_le32(scsi_bufflen(cmd));
239+
240 memcpy(cmd_entry->cdb, cmd->cmnd, cmd->cmd_len);
241 cmd_entry->dataSegCnt = cpu_to_le16(tot_dsds);
242 cmd_entry->hdr.entryCount = req_cnt;
243@@ -165,6 +165,9 @@ int qla4xxx_send_command_to_isp(struct scsi_qla_host *ha, struct srb * srb)
244 * transferred, as the data direction bit is sometimed filled
245 * in when there is no data to be transferred */
246 cmd_entry->control_flags = CF_NO_DATA;
247+
248+ cmd_entry->ttlByteCnt = cpu_to_le32(scsi_bufflen(cmd));
249+
250 if (scsi_bufflen(cmd)) {
251 if (cmd->sc_data_direction == DMA_TO_DEVICE)
252 cmd_entry->control_flags = CF_WRITE;
253@@ -203,7 +206,7 @@ int qla4xxx_send_command_to_isp(struct scsi_qla_host *ha, struct srb * srb)
254 wmb();
255
256 /*
257- * Check to see if adapter is online before placing request on
258+ * Check to see if adapter is online before placing request on
259 * request queue. If a reset occurs and a request is in the queue,
260 * the firmware will still attempt to process the request, retrieving
261 * garbage for pointers.
262@@ -243,4 +246,3 @@ queuing_error:
263
264 return QLA_ERROR;
265 }
266-
267diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
268index 2efcc20..a5cd40d 100644
269--- a/drivers/scsi/qla4xxx/ql4_os.c
270+++ b/drivers/scsi/qla4xxx/ql4_os.c
271@@ -111,6 +111,8 @@ static struct scsi_host_template qla4xxx_driver_template = {
272 .slave_alloc = qla4xxx_slave_alloc,
273 .slave_destroy = qla4xxx_slave_destroy,
274
275+ .target_destroy = qla4xxx_target_destroy,
276+
277 .this_id = -1,
278 .cmd_per_lun = 3,
279 .use_clustering = ENABLE_CLUSTERING,
280@@ -290,7 +292,8 @@ void qla4xxx_destroy_sess(struct ddb_entry *ddb_entry)
281 if (ddb_entry->conn) {
282 QL_ISCSI_IF_DESTROY_SESSION_DONE(ddb_entry);
283 QL_ISCSI_DESTROY_CONN(ddb_entry);
284- iscsi_remove_session(ddb_entry->sess);
285+ if (!QL_DDB_STATE_REMOVED(ddb_entry))
286+ iscsi_remove_session(ddb_entry->sess);
287 }
288 iscsi_free_session(ddb_entry->sess);
289 }
290@@ -385,7 +388,8 @@ void qla4xxx_mark_device_missing(struct scsi_qla_host *ha,
291 dev_info(&ha->pdev->dev, "%s: ddb[%d] os[%d] marked MISSING\n",
292 __func__, ddb_entry->fw_ddb_index, ddb_entry->os_target_id);
293
294- qla4xxx_conn_stop(ddb_entry->conn, STOP_CONN_RECOVER);
295+ if (ddb_entry->conn)
296+ qla4xxx_conn_stop(ddb_entry->conn, STOP_CONN_RECOVER);
297 }
298
299 static struct srb* qla4xxx_get_new_srb(struct scsi_qla_host *ha,
300@@ -444,7 +448,8 @@ static int qla4xxx_queuecommand(struct scsi_cmnd *cmd,
301 int rval;
302
303 if (atomic_read(&ddb_entry->state) != DDB_STATE_ONLINE) {
304- if (atomic_read(&ddb_entry->state) == DDB_STATE_DEAD) {
305+ if ((atomic_read(&ddb_entry->state) == DDB_STATE_DEAD) ||
306+ QL_DDB_STATE_REMOVED(ddb_entry)) {
307 cmd->result = DID_NO_CONNECT << 16;
308 goto qc_fail_command;
309 }
310@@ -602,8 +607,9 @@ static void qla4xxx_timer(struct scsi_qla_host *ha)
311 list_for_each_entry_safe(ddb_entry, dtemp, &ha->ddb_list, list) {
312 /* Count down time between sending relogins */
313 if (adapter_up(ha) &&
314- !test_bit(DF_RELOGIN, &ddb_entry->flags) &&
315- atomic_read(&ddb_entry->state) != DDB_STATE_ONLINE) {
316+ !test_bit(DF_RELOGIN, &ddb_entry->flags) &&
317+ !QL_DDB_STATE_REMOVED(ddb_entry) &&
318+ atomic_read(&ddb_entry->state) != DDB_STATE_ONLINE) {
319 if (atomic_read(&ddb_entry->retry_relogin_timer) !=
320 INVALID_ENTRY) {
321 if (atomic_read(&ddb_entry->retry_relogin_timer)
322@@ -626,15 +632,16 @@ static void qla4xxx_timer(struct scsi_qla_host *ha)
323
324 /* Wait for relogin to timeout */
325 if (atomic_read(&ddb_entry->relogin_timer) &&
326- (atomic_dec_and_test(&ddb_entry->relogin_timer) != 0)) {
327+ (atomic_dec_and_test(&ddb_entry->relogin_timer) != 0)) {
328 /*
329 * If the relogin times out and the device is
330 * still NOT ONLINE then try and relogin again.
331 */
332 if (atomic_read(&ddb_entry->state) !=
333- DDB_STATE_ONLINE &&
334- ddb_entry->fw_ddb_device_state ==
335- DDB_DS_SESSION_FAILED) {
336+ DDB_STATE_ONLINE &&
337+ !QL_DDB_STATE_REMOVED(ddb_entry) &&
338+ ddb_entry->fw_ddb_device_state ==
339+ DDB_DS_SESSION_FAILED) {
340 /* Reset retry relogin timer */
341 atomic_inc(&ddb_entry->relogin_retry_count);
342 DEBUG2(printk("scsi%ld: index[%d] relogin"
343@@ -678,6 +685,7 @@ static void qla4xxx_timer(struct scsi_qla_host *ha)
344 test_bit(DPC_RESET_HA_DESTROY_DDB_LIST, &ha->dpc_flags) ||
345 test_bit(DPC_RESET_HA_INTR, &ha->dpc_flags) ||
346 test_bit(DPC_GET_DHCP_IP_ADDR, &ha->dpc_flags) ||
347+ test_bit(DPC_REMOVE_DEVICE, &ha->dpc_flags) ||
348 QL_DPC_OFFLINE_SET(ha) ||
349 test_bit(DPC_AEN, &ha->dpc_flags)) &&
350 ha->dpc_thread) {
351@@ -1061,31 +1069,7 @@ static QL_DECLARE_DPC(qla4xxx_do_dpc, data)
352
353 qla4xxx_check_dev_offline(ha);
354
355- if (test_and_clear_bit(DPC_DELETE_DEVICE, &ha->dpc_flags)) {
356- list_for_each_entry_safe(ddb_entry, dtemp,
357- &ha->ddb_list, list) {
358- if (test_and_clear_bit(DF_DELETED,
359- &ddb_entry->flags)) {
360- if (atomic_read(&ddb_entry->state) ==
361- DDB_STATE_DEAD) {
362- dev_info(&ha->pdev->dev,
363- "%s: ddb[%d] os[%d] - "
364- "delete\n",
365- __func__,
366- ddb_entry->fw_ddb_index,
367- ddb_entry->os_target_id);
368- } else {
369- dev_info(&ha->pdev->dev,
370- "%s: ddb[%d] os[%d] - "
371- "ddb state not dead but"
372- " marked for delete\n",
373- __func__,
374- ddb_entry->fw_ddb_index,
375- ddb_entry->os_target_id);
376- }
377- }
378- }
379- }
380+ qla4xxx_remove_device(ha);
381
382 /* ---- relogin device? --- */
383 if (adapter_up(ha) &&
384@@ -1093,6 +1077,7 @@ static QL_DECLARE_DPC(qla4xxx_do_dpc, data)
385 list_for_each_entry_safe(ddb_entry, dtemp,
386 &ha->ddb_list, list) {
387 if (test_and_clear_bit(DF_RELOGIN, &ddb_entry->flags) &&
388+ !QL_DDB_STATE_REMOVED(ddb_entry) &&
389 (atomic_read(&ddb_entry->state) !=
390 DDB_STATE_ONLINE))
391 qla4xxx_relogin_device(ha, ddb_entry);
392@@ -1181,7 +1166,6 @@ static int qla4xxx_iospace_config(struct scsi_qla_host *ha)
393 if (!(mmio_flags & IORESOURCE_MEM)) {
394 dev_err(&ha->pdev->dev,
395 "region #0 not an MMIO resource, aborting\n");
396-
397 goto iospace_error_exit;
398 }
399 if (mmio_len < MIN_IOBASE_LEN) {
400@@ -1336,7 +1320,7 @@ static int __devinit qla4xxx_probe_adapter(struct pci_dev *pdev,
401 /* Start timer thread. */
402 qla4xxx_start_timer(ha, qla4xxx_timer, 1);
403
404- set_bit(AF_INIT_DONE, &ha->flags);
405+// set_bit(AF_INIT_DONE, &ha->flags);
406
407 pci_set_drvdata(pdev, ha);
408
409@@ -1382,7 +1366,7 @@ static int __devinit qla4xxx_probe_adapter(struct pci_dev *pdev,
410 DEBUG2(dev_info(&ha->pdev->dev, "listhead=%p, done adding ha=%p i=%d\n",
411 &qla4xxx_hostlist, &ha->node, ha->instance));
412
413-// set_bit(AF_INIT_DONE, &ha->flags);
414+ set_bit(AF_INIT_DONE, &ha->flags);
415 dev_info(&ha->pdev->dev, "%s: AF_INIT_DONE\n", __func__);
416
417 return 0;
418@@ -1465,6 +1449,7 @@ static int qla4xxx_slave_alloc(struct scsi_device *sdev)
419
420 if (sess) {
421 sdev->hostdata = sess->dd_data;
422+ QL_SET_SDEV_HOSTDATA(sdev, sess);
423 return 0;
424 }
425 return FAILED;
426diff --git a/drivers/scsi/qla4xxx/ql4_os.h b/drivers/scsi/qla4xxx/ql4_os.h
427index 71c3da0..c96ab8f 100644
428--- a/drivers/scsi/qla4xxx/ql4_os.h
429+++ b/drivers/scsi/qla4xxx/ql4_os.h
430@@ -44,13 +44,16 @@
431 iscsi_unblock_session(ddb_entry->sess)
432 #define QL_ISCSI_ALLOC_SESSION(ha, trans) \
433 iscsi_alloc_session(ha->host, trans, sizeof(struct ddb_entry))
434+#define QL_SET_SDEV_HOSTDATA(sdev, sess)
435
436+#define QL_DDB_STATE_REMOVED(ddb_entry) 0
437
438 #define QL_MISC_INIT 0
439 #define QL_MISC_EXIT
440
441 #define qla4xxx_check_dev_offline(ha)
442 #define qla4xxx_proc_info NULL
443+#define qla4xxx_target_destroy NULL
444
445 #define QL_SET_SCSI_RESID(cmd, residual) scsi_set_resid(cmd, residual)
446 #define QL_SCSI_BUFFLEN(cmd) scsi_bufflen(cmd)
447@@ -69,10 +72,8 @@
448 void dpc_func(struct work_struct *data)
449
450 #define QL_INIT_SESSION_DATASIZE(sessiondata_size)
451-// .sessiondata_size = sizeof(struct ddb_entry),
452
453 #define QL_INIT_HOST_TEMPLATE(host_template)
454-// .host_template = &qla4xxx_driver_template,
455
456 QL_DECLARE_INTR_HANDLER(qla4xxx_intr_handler, irq, dev_id, regs);
457
458@@ -122,4 +123,22 @@ static inline void qla4xxx_srb_free_dma(struct scsi_qla_host *ha,
459 cmd->SCp.ptr = NULL;
460 }
461
462+static inline void qla4xxx_remove_device(struct scsi_qla_host *ha)
463+{
464+ struct ddb_entry *ddb_entry, *dtemp;
465+
466+ if (test_and_clear_bit(DPC_REMOVE_DEVICE, &ha->dpc_flags)) {
467+ list_for_each_entry_safe(ddb_entry, dtemp,
468+ &ha->ddb_list, list) {
469+ if (test_and_clear_bit(DF_REMOVE, &ddb_entry->flags)) {
470+ dev_info(&ha->pdev->dev,
471+ "%s: ddb[%d] os[%d] - removed\n",
472+ __func__, ddb_entry->fw_ddb_index,
473+ ddb_entry->os_target_id);
474+ qla4xxx_free_ddb(ha, ddb_entry);
475+ }
476+ }
477+ }
478+}
479+
480 #endif /* _QLA4x_OS_H */
481diff --git a/drivers/scsi/qla4xxx/ql4_version.h b/drivers/scsi/qla4xxx/ql4_version.h
482index d6ff1b7..073e401 100644
483--- a/drivers/scsi/qla4xxx/ql4_version.h
484+++ b/drivers/scsi/qla4xxx/ql4_version.h
485@@ -5,5 +5,5 @@
486 * See LICENSE.qla4xxx for copyright and licensing details.
487 */
488
489-#define QLA4XXX_DRIVER_VERSION "5.01.00-k8_sles11-03"
490+#define QLA4XXX_DRIVER_VERSION "5.01.00-k8_sles11-04"
491