]>
Commit | Line | Data |
---|---|---|
82094b55 AF |
1 | From: Gerald Schaefer <geraldsc@de.ibm.com> |
2 | Subject: [PATCH] zfcp: Move debug data from zfcp_data to own data structure | |
3 | References: bnc#532063,LTC#55526 | |
4 | ||
5 | From: Christof Schmitt <christof.schmitt@de.ibm.com> | |
6 | ||
7 | The struct zfcp_adapter includes everything related to the debug | |
8 | traces. This introduces dependences between the definitions in | |
9 | zfcp_def.h and zfcp_dbf.h. Move all debug related data structures to a | |
10 | new data structure to break those dependencies and manage the debug | |
11 | data in zfcp_dbf.[hc]. | |
12 | ||
13 | Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> | |
14 | ||
15 | Acked-by: John Jolly <jjolly@suse.de> | |
16 | --- | |
17 | ||
18 | drivers/s390/scsi/zfcp_aux.c | 4 | |
19 | drivers/s390/scsi/zfcp_dbf.c | 217 ++++++++++++++++++++++++------------------- | |
20 | drivers/s390/scsi/zfcp_dbf.h | 17 +++ | |
21 | drivers/s390/scsi/zfcp_def.h | 15 -- | |
22 | drivers/s390/scsi/zfcp_fsf.h | 3 | |
23 | 5 files changed, 143 insertions(+), 113 deletions(-) | |
24 | ||
25 | Index: linux-sles11/drivers/s390/scsi/zfcp_aux.c | |
26 | =================================================================== | |
27 | --- linux-sles11.orig/drivers/s390/scsi/zfcp_aux.c 2009-08-17 15:31:25.000000000 +0200 | |
28 | +++ linux-sles11/drivers/s390/scsi/zfcp_aux.c 2009-08-17 15:31:35.000000000 +0200 | |
29 | @@ -494,10 +494,6 @@ | |
30 | ||
31 | spin_lock_init(&adapter->req_list_lock); | |
32 | ||
33 | - spin_lock_init(&adapter->hba_dbf_lock); | |
34 | - spin_lock_init(&adapter->san_dbf_lock); | |
35 | - spin_lock_init(&adapter->scsi_dbf_lock); | |
36 | - spin_lock_init(&adapter->rec_dbf_lock); | |
37 | spin_lock_init(&adapter->req_q_lock); | |
38 | spin_lock_init(&adapter->qdio_stat_lock); | |
39 | ||
40 | Index: linux-sles11/drivers/s390/scsi/zfcp_dbf.c | |
41 | =================================================================== | |
42 | --- linux-sles11.orig/drivers/s390/scsi/zfcp_dbf.c 2009-08-17 15:31:25.000000000 +0200 | |
43 | +++ linux-sles11/drivers/s390/scsi/zfcp_dbf.c 2009-08-17 15:31:35.000000000 +0200 | |
44 | @@ -3,13 +3,14 @@ | |
45 | * | |
46 | * Debug traces for zfcp. | |
47 | * | |
48 | - * Copyright IBM Corporation 2002, 2008 | |
49 | + * Copyright IBM Corporation 2002, 2009 | |
50 | */ | |
51 | ||
52 | #define KMSG_COMPONENT "zfcp" | |
53 | ||
54 | #include <linux/ctype.h> | |
55 | #include <asm/debug.h> | |
56 | +#include "zfcp_dbf.h" | |
57 | #include "zfcp_ext.h" | |
58 | ||
59 | static u32 dbfsize = 4; | |
60 | @@ -125,6 +126,7 @@ | |
61 | void zfcp_hba_dbf_event_fsf_response(struct zfcp_fsf_req *fsf_req) | |
62 | { | |
63 | struct zfcp_adapter *adapter = fsf_req->adapter; | |
64 | + struct zfcp_dbf *dbf = adapter->dbf; | |
65 | struct fsf_qtcb *qtcb = fsf_req->qtcb; | |
66 | union fsf_prot_status_qual *prot_status_qual = | |
67 | &qtcb->prefix.prot_status_qual; | |
68 | @@ -133,12 +135,12 @@ | |
69 | struct zfcp_port *port; | |
70 | struct zfcp_unit *unit; | |
71 | struct zfcp_send_els *send_els; | |
72 | - struct zfcp_hba_dbf_record *rec = &adapter->hba_dbf_buf; | |
73 | + struct zfcp_hba_dbf_record *rec = &dbf->hba_dbf_buf; | |
74 | struct zfcp_hba_dbf_record_response *response = &rec->u.response; | |
75 | int level; | |
76 | unsigned long flags; | |
77 | ||
78 | - spin_lock_irqsave(&adapter->hba_dbf_lock, flags); | |
79 | + spin_lock_irqsave(&dbf->hba_dbf_lock, flags); | |
80 | memset(rec, 0, sizeof(*rec)); | |
81 | strncpy(rec->tag, "resp", ZFCP_DBF_TAG_SIZE); | |
82 | ||
83 | @@ -223,7 +225,7 @@ | |
84 | break; | |
85 | } | |
86 | ||
87 | - debug_event(adapter->hba_dbf, level, rec, sizeof(*rec)); | |
88 | + debug_event(dbf->hba_dbf, level, rec, sizeof(*rec)); | |
89 | ||
90 | /* have fcp channel microcode fixed to use as little as possible */ | |
91 | if (fsf_req->fsf_command != FSF_QTCB_FCP_CMND) { | |
92 | @@ -231,11 +233,11 @@ | |
93 | char *buf = (char *)qtcb + qtcb->header.log_start; | |
94 | int len = qtcb->header.log_length; | |
95 | for (; len && !buf[len - 1]; len--); | |
96 | - zfcp_dbf_hexdump(adapter->hba_dbf, rec, sizeof(*rec), level, | |
97 | - buf, len); | |
98 | + zfcp_dbf_hexdump(dbf->hba_dbf, rec, sizeof(*rec), level, buf, | |
99 | + len); | |
100 | } | |
101 | ||
102 | - spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags); | |
103 | + spin_unlock_irqrestore(&dbf->hba_dbf_lock, flags); | |
104 | } | |
105 | ||
106 | /** | |
107 | @@ -247,10 +249,11 @@ | |
108 | void zfcp_hba_dbf_event_fsf_unsol(const char *tag, struct zfcp_adapter *adapter, | |
109 | struct fsf_status_read_buffer *status_buffer) | |
110 | { | |
111 | - struct zfcp_hba_dbf_record *rec = &adapter->hba_dbf_buf; | |
112 | + struct zfcp_dbf *dbf = adapter->dbf; | |
113 | + struct zfcp_hba_dbf_record *rec = &dbf->hba_dbf_buf; | |
114 | unsigned long flags; | |
115 | ||
116 | - spin_lock_irqsave(&adapter->hba_dbf_lock, flags); | |
117 | + spin_lock_irqsave(&dbf->hba_dbf_lock, flags); | |
118 | memset(rec, 0, sizeof(*rec)); | |
119 | strncpy(rec->tag, "stat", ZFCP_DBF_TAG_SIZE); | |
120 | strncpy(rec->tag2, tag, ZFCP_DBF_TAG_SIZE); | |
121 | @@ -292,8 +295,8 @@ | |
122 | &status_buffer->payload, rec->u.status.payload_size); | |
123 | } | |
124 | ||
125 | - debug_event(adapter->hba_dbf, 2, rec, sizeof(*rec)); | |
126 | - spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags); | |
127 | + debug_event(dbf->hba_dbf, 2, rec, sizeof(*rec)); | |
128 | + spin_unlock_irqrestore(&dbf->hba_dbf_lock, flags); | |
129 | } | |
130 | ||
131 | /** | |
132 | @@ -307,17 +310,18 @@ | |
133 | unsigned int qdio_error, int sbal_index, | |
134 | int sbal_count) | |
135 | { | |
136 | - struct zfcp_hba_dbf_record *r = &adapter->hba_dbf_buf; | |
137 | + struct zfcp_dbf *dbf = adapter->dbf; | |
138 | + struct zfcp_hba_dbf_record *r = &dbf->hba_dbf_buf; | |
139 | unsigned long flags; | |
140 | ||
141 | - spin_lock_irqsave(&adapter->hba_dbf_lock, flags); | |
142 | + spin_lock_irqsave(&dbf->hba_dbf_lock, flags); | |
143 | memset(r, 0, sizeof(*r)); | |
144 | strncpy(r->tag, "qdio", ZFCP_DBF_TAG_SIZE); | |
145 | r->u.qdio.qdio_error = qdio_error; | |
146 | r->u.qdio.sbal_index = sbal_index; | |
147 | r->u.qdio.sbal_count = sbal_count; | |
148 | - debug_event(adapter->hba_dbf, 0, r, sizeof(*r)); | |
149 | - spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags); | |
150 | + debug_event(dbf->hba_dbf, 0, r, sizeof(*r)); | |
151 | + spin_unlock_irqrestore(&dbf->hba_dbf_lock, flags); | |
152 | } | |
153 | ||
154 | /** | |
155 | @@ -328,17 +332,18 @@ | |
156 | void zfcp_hba_dbf_event_berr(struct zfcp_adapter *adapter, | |
157 | struct zfcp_fsf_req *req) | |
158 | { | |
159 | - struct zfcp_hba_dbf_record *r = &adapter->hba_dbf_buf; | |
160 | + struct zfcp_dbf *dbf = adapter->dbf; | |
161 | + struct zfcp_hba_dbf_record *r = &dbf->hba_dbf_buf; | |
162 | struct fsf_status_read_buffer *sr_buf = req->data; | |
163 | struct fsf_bit_error_payload *err = &sr_buf->payload.bit_error; | |
164 | unsigned long flags; | |
165 | ||
166 | - spin_lock_irqsave(&adapter->hba_dbf_lock, flags); | |
167 | + spin_lock_irqsave(&dbf->hba_dbf_lock, flags); | |
168 | memset(r, 0, sizeof(*r)); | |
169 | strncpy(r->tag, "berr", ZFCP_DBF_TAG_SIZE); | |
170 | memcpy(&r->u.berr, err, sizeof(struct fsf_bit_error_payload)); | |
171 | - debug_event(adapter->hba_dbf, 0, r, sizeof(*r)); | |
172 | - spin_unlock_irqrestore(&adapter->hba_dbf_lock, flags); | |
173 | + debug_event(dbf->hba_dbf, 0, r, sizeof(*r)); | |
174 | + spin_unlock_irqrestore(&dbf->hba_dbf_lock, flags); | |
175 | } | |
176 | static void zfcp_hba_dbf_view_response(char **p, | |
177 | struct zfcp_hba_dbf_record_response *r) | |
178 | @@ -707,7 +712,8 @@ | |
179 | */ | |
180 | void zfcp_rec_dbf_event_thread(u8 id2, struct zfcp_adapter *adapter) | |
181 | { | |
182 | - struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf; | |
183 | + struct zfcp_dbf *dbf = adapter->dbf; | |
184 | + struct zfcp_rec_dbf_record *r = &dbf->rec_dbf_buf; | |
185 | unsigned long flags = 0; | |
186 | struct list_head *entry; | |
187 | unsigned ready = 0, running = 0, total; | |
188 | @@ -718,15 +724,15 @@ | |
189 | running++; | |
190 | total = adapter->erp_total_count; | |
191 | ||
192 | - spin_lock_irqsave(&adapter->rec_dbf_lock, flags); | |
193 | + spin_lock_irqsave(&dbf->rec_dbf_lock, flags); | |
194 | memset(r, 0, sizeof(*r)); | |
195 | r->id = ZFCP_REC_DBF_ID_THREAD; | |
196 | r->id2 = id2; | |
197 | r->u.thread.total = total; | |
198 | r->u.thread.ready = ready; | |
199 | r->u.thread.running = running; | |
200 | - debug_event(adapter->rec_dbf, 6, r, sizeof(*r)); | |
201 | - spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags); | |
202 | + debug_event(dbf->rec_dbf, 6, r, sizeof(*r)); | |
203 | + spin_unlock_irqrestore(&dbf->rec_dbf_lock, flags); | |
204 | } | |
205 | ||
206 | /** | |
207 | @@ -749,10 +755,11 @@ | |
208 | atomic_t *status, atomic_t *erp_count, | |
209 | u64 wwpn, u32 d_id, u64 fcp_lun) | |
210 | { | |
211 | - struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf; | |
212 | + struct zfcp_dbf *dbf = adapter->dbf; | |
213 | + struct zfcp_rec_dbf_record *r = &dbf->rec_dbf_buf; | |
214 | unsigned long flags; | |
215 | ||
216 | - spin_lock_irqsave(&adapter->rec_dbf_lock, flags); | |
217 | + spin_lock_irqsave(&dbf->rec_dbf_lock, flags); | |
218 | memset(r, 0, sizeof(*r)); | |
219 | r->id = ZFCP_REC_DBF_ID_TARGET; | |
220 | r->id2 = id2; | |
221 | @@ -762,8 +769,8 @@ | |
222 | r->u.target.d_id = d_id; | |
223 | r->u.target.fcp_lun = fcp_lun; | |
224 | r->u.target.erp_count = atomic_read(erp_count); | |
225 | - debug_event(adapter->rec_dbf, 3, r, sizeof(*r)); | |
226 | - spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags); | |
227 | + debug_event(dbf->rec_dbf, 3, r, sizeof(*r)); | |
228 | + spin_unlock_irqrestore(&dbf->rec_dbf_lock, flags); | |
229 | } | |
230 | ||
231 | /** | |
232 | @@ -824,10 +831,11 @@ | |
233 | void *action, struct zfcp_adapter *adapter, | |
234 | struct zfcp_port *port, struct zfcp_unit *unit) | |
235 | { | |
236 | - struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf; | |
237 | + struct zfcp_dbf *dbf = adapter->dbf; | |
238 | + struct zfcp_rec_dbf_record *r = &dbf->rec_dbf_buf; | |
239 | unsigned long flags; | |
240 | ||
241 | - spin_lock_irqsave(&adapter->rec_dbf_lock, flags); | |
242 | + spin_lock_irqsave(&dbf->rec_dbf_lock, flags); | |
243 | memset(r, 0, sizeof(*r)); | |
244 | r->id = ZFCP_REC_DBF_ID_TRIGGER; | |
245 | r->id2 = id2; | |
246 | @@ -844,8 +852,8 @@ | |
247 | r->u.trigger.us = atomic_read(&unit->status); | |
248 | r->u.trigger.fcp_lun = unit->fcp_lun; | |
249 | } | |
250 | - debug_event(adapter->rec_dbf, action ? 1 : 4, r, sizeof(*r)); | |
251 | - spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags); | |
252 | + debug_event(dbf->rec_dbf, action ? 1 : 4, r, sizeof(*r)); | |
253 | + spin_unlock_irqrestore(&dbf->rec_dbf_lock, flags); | |
254 | } | |
255 | ||
256 | /** | |
257 | @@ -856,10 +864,11 @@ | |
258 | void zfcp_rec_dbf_event_action(u8 id2, struct zfcp_erp_action *erp_action) | |
259 | { | |
260 | struct zfcp_adapter *adapter = erp_action->adapter; | |
261 | - struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf; | |
262 | + struct zfcp_dbf *dbf = adapter->dbf; | |
263 | + struct zfcp_rec_dbf_record *r = &dbf->rec_dbf_buf; | |
264 | unsigned long flags; | |
265 | ||
266 | - spin_lock_irqsave(&adapter->rec_dbf_lock, flags); | |
267 | + spin_lock_irqsave(&dbf->rec_dbf_lock, flags); | |
268 | memset(r, 0, sizeof(*r)); | |
269 | r->id = ZFCP_REC_DBF_ID_ACTION; | |
270 | r->id2 = id2; | |
271 | @@ -867,8 +876,8 @@ | |
272 | r->u.action.status = erp_action->status; | |
273 | r->u.action.step = erp_action->step; | |
274 | r->u.action.fsf_req = (unsigned long)erp_action->fsf_req; | |
275 | - debug_event(adapter->rec_dbf, 5, r, sizeof(*r)); | |
276 | - spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags); | |
277 | + debug_event(dbf->rec_dbf, 5, r, sizeof(*r)); | |
278 | + spin_unlock_irqrestore(&dbf->rec_dbf_lock, flags); | |
279 | } | |
280 | ||
281 | /** | |
282 | @@ -880,13 +889,14 @@ | |
283 | struct zfcp_send_ct *ct = (struct zfcp_send_ct *)fsf_req->data; | |
284 | struct zfcp_wka_port *wka_port = ct->wka_port; | |
285 | struct zfcp_adapter *adapter = wka_port->adapter; | |
286 | + struct zfcp_dbf *dbf = adapter->dbf; | |
287 | struct ct_hdr *hdr = sg_virt(ct->req); | |
288 | - struct zfcp_san_dbf_record *r = &adapter->san_dbf_buf; | |
289 | + struct zfcp_san_dbf_record *r = &dbf->san_dbf_buf; | |
290 | struct zfcp_san_dbf_record_ct_request *oct = &r->u.ct_req; | |
291 | int level = 3; | |
292 | unsigned long flags; | |
293 | ||
294 | - spin_lock_irqsave(&adapter->san_dbf_lock, flags); | |
295 | + spin_lock_irqsave(&dbf->san_dbf_lock, flags); | |
296 | memset(r, 0, sizeof(*r)); | |
297 | strncpy(r->tag, "octc", ZFCP_DBF_TAG_SIZE); | |
298 | r->fsf_reqid = (unsigned long)fsf_req; | |
299 | @@ -901,10 +911,10 @@ | |
300 | oct->max_res_size = hdr->max_res_size; | |
301 | oct->len = min((int)ct->req->length - (int)sizeof(struct ct_hdr), | |
302 | ZFCP_DBF_SAN_MAX_PAYLOAD); | |
303 | - debug_event(adapter->san_dbf, level, r, sizeof(*r)); | |
304 | - zfcp_dbf_hexdump(adapter->san_dbf, r, sizeof(*r), level, | |
305 | + debug_event(dbf->san_dbf, level, r, sizeof(*r)); | |
306 | + zfcp_dbf_hexdump(dbf->san_dbf, r, sizeof(*r), level, | |
307 | (void *)hdr + sizeof(struct ct_hdr), oct->len); | |
308 | - spin_unlock_irqrestore(&adapter->san_dbf_lock, flags); | |
309 | + spin_unlock_irqrestore(&dbf->san_dbf_lock, flags); | |
310 | } | |
311 | ||
312 | /** | |
313 | @@ -917,12 +927,13 @@ | |
314 | struct zfcp_wka_port *wka_port = ct->wka_port; | |
315 | struct zfcp_adapter *adapter = wka_port->adapter; | |
316 | struct ct_hdr *hdr = sg_virt(ct->resp); | |
317 | - struct zfcp_san_dbf_record *r = &adapter->san_dbf_buf; | |
318 | + struct zfcp_dbf *dbf = adapter->dbf; | |
319 | + struct zfcp_san_dbf_record *r = &dbf->san_dbf_buf; | |
320 | struct zfcp_san_dbf_record_ct_response *rct = &r->u.ct_resp; | |
321 | int level = 3; | |
322 | unsigned long flags; | |
323 | ||
324 | - spin_lock_irqsave(&adapter->san_dbf_lock, flags); | |
325 | + spin_lock_irqsave(&dbf->san_dbf_lock, flags); | |
326 | memset(r, 0, sizeof(*r)); | |
327 | strncpy(r->tag, "rctc", ZFCP_DBF_TAG_SIZE); | |
328 | r->fsf_reqid = (unsigned long)fsf_req; | |
329 | @@ -937,10 +948,10 @@ | |
330 | rct->max_res_size = hdr->max_res_size; | |
331 | rct->len = min((int)ct->resp->length - (int)sizeof(struct ct_hdr), | |
332 | ZFCP_DBF_SAN_MAX_PAYLOAD); | |
333 | - debug_event(adapter->san_dbf, level, r, sizeof(*r)); | |
334 | - zfcp_dbf_hexdump(adapter->san_dbf, r, sizeof(*r), level, | |
335 | + debug_event(dbf->san_dbf, level, r, sizeof(*r)); | |
336 | + zfcp_dbf_hexdump(dbf->san_dbf, r, sizeof(*r), level, | |
337 | (void *)hdr + sizeof(struct ct_hdr), rct->len); | |
338 | - spin_unlock_irqrestore(&adapter->san_dbf_lock, flags); | |
339 | + spin_unlock_irqrestore(&dbf->san_dbf_lock, flags); | |
340 | } | |
341 | ||
342 | static void zfcp_san_dbf_event_els(const char *tag, int level, | |
343 | @@ -949,10 +960,11 @@ | |
344 | int buflen) | |
345 | { | |
346 | struct zfcp_adapter *adapter = fsf_req->adapter; | |
347 | - struct zfcp_san_dbf_record *rec = &adapter->san_dbf_buf; | |
348 | + struct zfcp_dbf *dbf = adapter->dbf; | |
349 | + struct zfcp_san_dbf_record *rec = &dbf->san_dbf_buf; | |
350 | unsigned long flags; | |
351 | ||
352 | - spin_lock_irqsave(&adapter->san_dbf_lock, flags); | |
353 | + spin_lock_irqsave(&dbf->san_dbf_lock, flags); | |
354 | memset(rec, 0, sizeof(*rec)); | |
355 | strncpy(rec->tag, tag, ZFCP_DBF_TAG_SIZE); | |
356 | rec->fsf_reqid = (unsigned long)fsf_req; | |
357 | @@ -960,10 +972,10 @@ | |
358 | rec->s_id = s_id; | |
359 | rec->d_id = d_id; | |
360 | rec->u.els.ls_code = ls_code; | |
361 | - debug_event(adapter->san_dbf, level, rec, sizeof(*rec)); | |
362 | - zfcp_dbf_hexdump(adapter->san_dbf, rec, sizeof(*rec), level, | |
363 | + debug_event(dbf->san_dbf, level, rec, sizeof(*rec)); | |
364 | + zfcp_dbf_hexdump(dbf->san_dbf, rec, sizeof(*rec), level, | |
365 | buffer, min(buflen, ZFCP_DBF_SAN_MAX_PAYLOAD)); | |
366 | - spin_unlock_irqrestore(&adapter->san_dbf_lock, flags); | |
367 | + spin_unlock_irqrestore(&dbf->san_dbf_lock, flags); | |
368 | } | |
369 | ||
370 | /** | |
371 | @@ -1067,14 +1079,15 @@ | |
372 | struct zfcp_fsf_req *fsf_req, | |
373 | unsigned long old_req_id) | |
374 | { | |
375 | - struct zfcp_scsi_dbf_record *rec = &adapter->scsi_dbf_buf; | |
376 | + struct zfcp_dbf *dbf = adapter->dbf; | |
377 | + struct zfcp_scsi_dbf_record *rec = &dbf->scsi_dbf_buf; | |
378 | struct zfcp_dbf_dump *dump = (struct zfcp_dbf_dump *)rec; | |
379 | unsigned long flags; | |
380 | struct fcp_rsp_iu *fcp_rsp; | |
381 | char *fcp_rsp_info = NULL, *fcp_sns_info = NULL; | |
382 | int offset = 0, buflen = 0; | |
383 | ||
384 | - spin_lock_irqsave(&adapter->scsi_dbf_lock, flags); | |
385 | + spin_lock_irqsave(&dbf->scsi_dbf_lock, flags); | |
386 | do { | |
387 | memset(rec, 0, sizeof(*rec)); | |
388 | if (offset == 0) { | |
389 | @@ -1133,9 +1146,9 @@ | |
390 | memcpy(dump->data, fcp_sns_info + offset, dump->size); | |
391 | offset += dump->size; | |
392 | } | |
393 | - debug_event(adapter->scsi_dbf, level, rec, sizeof(*rec)); | |
394 | + debug_event(dbf->scsi_dbf, level, rec, sizeof(*rec)); | |
395 | } while (offset < buflen); | |
396 | - spin_unlock_irqrestore(&adapter->scsi_dbf_lock, flags); | |
397 | + spin_unlock_irqrestore(&dbf->scsi_dbf_lock, flags); | |
398 | } | |
399 | ||
400 | /** | |
401 | @@ -1239,6 +1252,22 @@ | |
402 | NULL | |
403 | }; | |
404 | ||
405 | +static debug_info_t *zfcp_dbf_reg(const char *name, int level, | |
406 | + struct debug_view *view, int size) | |
407 | +{ | |
408 | + struct debug_info *d; | |
409 | + | |
410 | + d = debug_register(name, dbfsize, level, size); | |
411 | + if (!d) | |
412 | + return NULL; | |
413 | + | |
414 | + debug_register_view(d, &debug_hex_ascii_view); | |
415 | + debug_register_view(d, view); | |
416 | + debug_set_level(d, level); | |
417 | + | |
418 | + return d; | |
419 | +} | |
420 | + | |
421 | /** | |
422 | * zfcp_adapter_debug_register - registers debug feature for an adapter | |
423 | * @adapter: pointer to adapter for which debug features should be registered | |
424 | @@ -1247,52 +1276,56 @@ | |
425 | int zfcp_adapter_debug_register(struct zfcp_adapter *adapter) | |
426 | { | |
427 | char dbf_name[DEBUG_MAX_NAME_LEN]; | |
428 | + struct zfcp_dbf *dbf; | |
429 | + | |
430 | + dbf = kmalloc(sizeof(struct zfcp_dbf), GFP_KERNEL); | |
431 | + if (!dbf) | |
432 | + return -ENOMEM; | |
433 | + | |
434 | + spin_lock_init(&dbf->hba_dbf_lock); | |
435 | + spin_lock_init(&dbf->san_dbf_lock); | |
436 | + spin_lock_init(&dbf->scsi_dbf_lock); | |
437 | + spin_lock_init(&dbf->rec_dbf_lock); | |
438 | ||
439 | /* debug feature area which records recovery activity */ | |
440 | sprintf(dbf_name, "zfcp_%s_rec", zfcp_get_busid_by_adapter(adapter)); | |
441 | - adapter->rec_dbf = debug_register(dbf_name, dbfsize, 1, | |
442 | - sizeof(struct zfcp_rec_dbf_record)); | |
443 | - if (!adapter->rec_dbf) | |
444 | - goto failed; | |
445 | - debug_register_view(adapter->rec_dbf, &debug_hex_ascii_view); | |
446 | - debug_register_view(adapter->rec_dbf, &zfcp_rec_dbf_view); | |
447 | - debug_set_level(adapter->rec_dbf, 3); | |
448 | + dbf->rec_dbf = zfcp_dbf_reg(dbf_name, 3, &zfcp_rec_dbf_view, | |
449 | + sizeof(struct zfcp_rec_dbf_record)); | |
450 | + if (!dbf->rec_dbf) | |
451 | + goto fail_rec; | |
452 | ||
453 | /* debug feature area which records HBA (FSF and QDIO) conditions */ | |
454 | sprintf(dbf_name, "zfcp_%s_hba", zfcp_get_busid_by_adapter(adapter)); | |
455 | - adapter->hba_dbf = debug_register(dbf_name, dbfsize, 1, | |
456 | - sizeof(struct zfcp_hba_dbf_record)); | |
457 | - if (!adapter->hba_dbf) | |
458 | - goto failed; | |
459 | - debug_register_view(adapter->hba_dbf, &debug_hex_ascii_view); | |
460 | - debug_register_view(adapter->hba_dbf, &zfcp_hba_dbf_view); | |
461 | - debug_set_level(adapter->hba_dbf, 3); | |
462 | + dbf->hba_dbf = zfcp_dbf_reg(dbf_name, 3, &zfcp_hba_dbf_view, | |
463 | + sizeof(struct zfcp_hba_dbf_record)); | |
464 | + if (!dbf->hba_dbf) | |
465 | + goto fail_hba; | |
466 | ||
467 | /* debug feature area which records SAN command failures and recovery */ | |
468 | sprintf(dbf_name, "zfcp_%s_san", zfcp_get_busid_by_adapter(adapter)); | |
469 | - adapter->san_dbf = debug_register(dbf_name, dbfsize, 1, | |
470 | - sizeof(struct zfcp_san_dbf_record)); | |
471 | - if (!adapter->san_dbf) | |
472 | - goto failed; | |
473 | - debug_register_view(adapter->san_dbf, &debug_hex_ascii_view); | |
474 | - debug_register_view(adapter->san_dbf, &zfcp_san_dbf_view); | |
475 | - debug_set_level(adapter->san_dbf, 6); | |
476 | + dbf->san_dbf = zfcp_dbf_reg(dbf_name, 6, &zfcp_san_dbf_view, | |
477 | + sizeof(struct zfcp_san_dbf_record)); | |
478 | + if (!dbf->san_dbf) | |
479 | + goto fail_san; | |
480 | ||
481 | /* debug feature area which records SCSI command failures and recovery */ | |
482 | sprintf(dbf_name, "zfcp_%s_scsi", zfcp_get_busid_by_adapter(adapter)); | |
483 | - adapter->scsi_dbf = debug_register(dbf_name, dbfsize, 1, | |
484 | - sizeof(struct zfcp_scsi_dbf_record)); | |
485 | - if (!adapter->scsi_dbf) | |
486 | - goto failed; | |
487 | - debug_register_view(adapter->scsi_dbf, &debug_hex_ascii_view); | |
488 | - debug_register_view(adapter->scsi_dbf, &zfcp_scsi_dbf_view); | |
489 | - debug_set_level(adapter->scsi_dbf, 3); | |
490 | + dbf->scsi_dbf = zfcp_dbf_reg(dbf_name, 3, &zfcp_scsi_dbf_view, | |
491 | + sizeof(struct zfcp_scsi_dbf_record)); | |
492 | + if (!dbf->scsi_dbf) | |
493 | + goto fail_scsi; | |
494 | ||
495 | + adapter->dbf = dbf; | |
496 | return 0; | |
497 | ||
498 | - failed: | |
499 | - zfcp_adapter_debug_unregister(adapter); | |
500 | - | |
501 | +fail_scsi: | |
502 | + debug_unregister(dbf->san_dbf); | |
503 | +fail_san: | |
504 | + debug_unregister(dbf->hba_dbf); | |
505 | +fail_hba: | |
506 | + debug_unregister(dbf->rec_dbf); | |
507 | +fail_rec: | |
508 | + kfree(dbf); | |
509 | return -ENOMEM; | |
510 | } | |
511 | ||
512 | @@ -1302,12 +1335,10 @@ | |
513 | */ | |
514 | void zfcp_adapter_debug_unregister(struct zfcp_adapter *adapter) | |
515 | { | |
516 | - debug_unregister(adapter->scsi_dbf); | |
517 | - debug_unregister(adapter->san_dbf); | |
518 | - debug_unregister(adapter->hba_dbf); | |
519 | - debug_unregister(adapter->rec_dbf); | |
520 | - adapter->scsi_dbf = NULL; | |
521 | - adapter->san_dbf = NULL; | |
522 | - adapter->hba_dbf = NULL; | |
523 | - adapter->rec_dbf = NULL; | |
524 | + debug_unregister(adapter->dbf->scsi_dbf); | |
525 | + debug_unregister(adapter->dbf->san_dbf); | |
526 | + debug_unregister(adapter->dbf->hba_dbf); | |
527 | + debug_unregister(adapter->dbf->rec_dbf); | |
528 | + kfree(adapter->dbf); | |
529 | + adapter->dbf = NULL; | |
530 | } | |
531 | Index: linux-sles11/drivers/s390/scsi/zfcp_dbf.h | |
532 | =================================================================== | |
533 | --- linux-sles11.orig/drivers/s390/scsi/zfcp_dbf.h 2009-08-17 15:31:25.000000000 +0200 | |
534 | +++ linux-sles11/drivers/s390/scsi/zfcp_dbf.h 2009-08-17 15:31:35.000000000 +0200 | |
535 | @@ -2,7 +2,7 @@ | |
536 | * This file is part of the zfcp device driver for | |
537 | * FCP adapters for IBM System z9 and zSeries. | |
538 | * | |
539 | - * Copyright IBM Corp. 2008, 2008 | |
540 | + * Copyright IBM Corp. 2008, 2009 | |
541 | * | |
542 | * This program is free software; you can redistribute it and/or modify | |
543 | * it under the terms of the GNU General Public License as published by | |
544 | @@ -221,4 +221,19 @@ | |
545 | u8 sns_info[ZFCP_DBF_SCSI_FCP_SNS_INFO]; | |
546 | } __attribute__ ((packed)); | |
547 | ||
548 | +struct zfcp_dbf { | |
549 | + debug_info_t *rec_dbf; | |
550 | + debug_info_t *hba_dbf; | |
551 | + debug_info_t *san_dbf; | |
552 | + debug_info_t *scsi_dbf; | |
553 | + spinlock_t rec_dbf_lock; | |
554 | + spinlock_t hba_dbf_lock; | |
555 | + spinlock_t san_dbf_lock; | |
556 | + spinlock_t scsi_dbf_lock; | |
557 | + struct zfcp_rec_dbf_record rec_dbf_buf; | |
558 | + struct zfcp_hba_dbf_record hba_dbf_buf; | |
559 | + struct zfcp_san_dbf_record san_dbf_buf; | |
560 | + struct zfcp_scsi_dbf_record scsi_dbf_buf; | |
561 | +}; | |
562 | + | |
563 | #endif /* ZFCP_DBF_H */ | |
564 | Index: linux-sles11/drivers/s390/scsi/zfcp_def.h | |
565 | =================================================================== | |
566 | --- linux-sles11.orig/drivers/s390/scsi/zfcp_def.h 2009-08-17 15:31:29.000000000 +0200 | |
567 | +++ linux-sles11/drivers/s390/scsi/zfcp_def.h 2009-08-17 15:31:35.000000000 +0200 | |
568 | @@ -33,10 +33,8 @@ | |
569 | #include <asm/qdio.h> | |
570 | #include <asm/debug.h> | |
571 | #include <asm/ebcdic.h> | |
572 | -#include "zfcp_dbf.h" | |
573 | #include "zfcp_fsf.h" | |
574 | ||
575 | - | |
576 | /********************* GENERAL DEFINES *********************************/ | |
577 | ||
578 | #define REQUEST_LIST_SIZE 128 | |
579 | @@ -499,18 +497,7 @@ | |
580 | u32 erp_low_mem_count; /* nr of erp actions waiting | |
581 | for memory */ | |
582 | struct zfcp_wka_port nsp; /* adapter's nameserver */ | |
583 | - debug_info_t *rec_dbf; | |
584 | - debug_info_t *hba_dbf; | |
585 | - debug_info_t *san_dbf; /* debug feature areas */ | |
586 | - debug_info_t *scsi_dbf; | |
587 | - spinlock_t rec_dbf_lock; | |
588 | - spinlock_t hba_dbf_lock; | |
589 | - spinlock_t san_dbf_lock; | |
590 | - spinlock_t scsi_dbf_lock; | |
591 | - struct zfcp_rec_dbf_record rec_dbf_buf; | |
592 | - struct zfcp_hba_dbf_record hba_dbf_buf; | |
593 | - struct zfcp_san_dbf_record san_dbf_buf; | |
594 | - struct zfcp_scsi_dbf_record scsi_dbf_buf; | |
595 | + struct zfcp_dbf *dbf; /* debug traces */ | |
596 | struct zfcp_adapter_mempool pool; /* Adapter memory pools */ | |
597 | struct qdio_initialize qdio_init_data; /* for qdio_establish */ | |
598 | struct fc_host_statistics *fc_stats; | |
599 | Index: linux-sles11/drivers/s390/scsi/zfcp_fsf.h | |
600 | =================================================================== | |
601 | --- linux-sles11.orig/drivers/s390/scsi/zfcp_fsf.h 2009-08-17 15:31:25.000000000 +0200 | |
602 | +++ linux-sles11/drivers/s390/scsi/zfcp_fsf.h 2009-08-17 15:31:35.000000000 +0200 | |
603 | @@ -3,13 +3,14 @@ | |
604 | * | |
605 | * Interface to the FSF support functions. | |
606 | * | |
607 | - * Copyright IBM Corporation 2002, 2008 | |
608 | + * Copyright IBM Corporation 2002, 2009 | |
609 | */ | |
610 | ||
611 | #ifndef FSF_H | |
612 | #define FSF_H | |
613 | ||
614 | #include <linux/pfn.h> | |
615 | +#include <linux/scatterlist.h> | |
616 | ||
617 | #define FSF_QTCB_CURRENT_VERSION 0x00000001 | |
618 |