blob: 28e2b52bf85111cffec9c635607e4c19cf06ef9d [file] [log] [blame]
Swen Schillig41fa2ad2007-09-07 09:15:31 +02001/*
Andreas Herrmann4a9d2d82006-05-22 18:14:08 +02002 * This file is part of the zfcp device driver for
3 * FCP adapters for IBM System z9 and zSeries.
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 *
Andreas Herrmann4a9d2d82006-05-22 18:14:08 +02005 * (C) Copyright IBM Corp. 2002, 2006
Swen Schillig41fa2ad2007-09-07 09:15:31 +02006 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Linus Torvalds1da177e2005-04-16 15:20:36 -070020 */
21
22#define ZFCP_LOG_AREA ZFCP_LOG_AREA_SCSI
23
Linus Torvalds1da177e2005-04-16 15:20:36 -070024#include "zfcp_ext.h"
Christof Schmitt5f852be2007-05-08 11:16:52 +020025#include <asm/atomic.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070026
27static void zfcp_scsi_slave_destroy(struct scsi_device *sdp);
28static int zfcp_scsi_slave_alloc(struct scsi_device *sdp);
29static int zfcp_scsi_slave_configure(struct scsi_device *sdp);
30static int zfcp_scsi_queuecommand(struct scsi_cmnd *,
31 void (*done) (struct scsi_cmnd *));
32static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *);
33static int zfcp_scsi_eh_device_reset_handler(struct scsi_cmnd *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070034static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *);
Maxim Shchetynin8a36e452005-09-13 21:50:38 +020035static int zfcp_task_management_function(struct zfcp_unit *, u8,
36 struct scsi_cmnd *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070037
Andreas Herrmann06506d02006-05-22 18:18:19 +020038static struct zfcp_unit *zfcp_unit_lookup(struct zfcp_adapter *, int,
39 unsigned int, unsigned int);
Linus Torvalds1da177e2005-04-16 15:20:36 -070040
41static struct device_attribute *zfcp_sysfs_sdev_attrs[];
42
Linus Torvalds1da177e2005-04-16 15:20:36 -070043struct zfcp_data zfcp_data = {
44 .scsi_host_template = {
Heiko Carstensd2c993d2006-07-12 16:41:55 +020045 .name = ZFCP_NAME,
Heiko Carstensdd52e0e2006-09-18 22:28:49 +020046 .module = THIS_MODULE,
Heiko Carstensd2c993d2006-07-12 16:41:55 +020047 .proc_name = "zfcp",
Heiko Carstensd2c993d2006-07-12 16:41:55 +020048 .slave_alloc = zfcp_scsi_slave_alloc,
49 .slave_configure = zfcp_scsi_slave_configure,
50 .slave_destroy = zfcp_scsi_slave_destroy,
51 .queuecommand = zfcp_scsi_queuecommand,
52 .eh_abort_handler = zfcp_scsi_eh_abort_handler,
53 .eh_device_reset_handler = zfcp_scsi_eh_device_reset_handler,
Heiko Carstensd2c993d2006-07-12 16:41:55 +020054 .eh_host_reset_handler = zfcp_scsi_eh_host_reset_handler,
55 .can_queue = 4096,
56 .this_id = -1,
Heiko Carstensd2c993d2006-07-12 16:41:55 +020057 .sg_tablesize = ZFCP_MAX_SBALES_PER_REQ,
58 .cmd_per_lun = 1,
Heiko Carstensd2c993d2006-07-12 16:41:55 +020059 .use_clustering = 1,
60 .sdev_attrs = zfcp_sysfs_sdev_attrs,
Swen Schillig8d1a0062006-10-12 11:43:44 +020061 .max_sectors = ZFCP_MAX_SECTORS,
Linus Torvalds1da177e2005-04-16 15:20:36 -070062 },
63 .driver_version = ZFCP_VERSION,
Linus Torvalds1da177e2005-04-16 15:20:36 -070064};
65
66/* Find start of Response Information in FCP response unit*/
67char *
68zfcp_get_fcp_rsp_info_ptr(struct fcp_rsp_iu *fcp_rsp_iu)
69{
70 char *fcp_rsp_info_ptr;
71
72 fcp_rsp_info_ptr =
73 (unsigned char *) fcp_rsp_iu + (sizeof (struct fcp_rsp_iu));
74
75 return fcp_rsp_info_ptr;
76}
77
78/* Find start of Sense Information in FCP response unit*/
79char *
80zfcp_get_fcp_sns_info_ptr(struct fcp_rsp_iu *fcp_rsp_iu)
81{
82 char *fcp_sns_info_ptr;
83
84 fcp_sns_info_ptr =
85 (unsigned char *) fcp_rsp_iu + (sizeof (struct fcp_rsp_iu));
86 if (fcp_rsp_iu->validity.bits.fcp_rsp_len_valid)
87 fcp_sns_info_ptr = (char *) fcp_sns_info_ptr +
88 fcp_rsp_iu->fcp_rsp_len;
89
90 return fcp_sns_info_ptr;
91}
92
Heiko Carstens2b67fc42007-02-05 21:16:47 +010093static fcp_dl_t *
Linus Torvalds1da177e2005-04-16 15:20:36 -070094zfcp_get_fcp_dl_ptr(struct fcp_cmnd_iu * fcp_cmd)
95{
96 int additional_length = fcp_cmd->add_fcp_cdb_length << 2;
97 fcp_dl_t *fcp_dl_addr;
98
99 fcp_dl_addr = (fcp_dl_t *)
100 ((unsigned char *) fcp_cmd +
101 sizeof (struct fcp_cmnd_iu) + additional_length);
102 /*
Swen Schillig41fa2ad2007-09-07 09:15:31 +0200103 * fcp_dl_addr = start address of fcp_cmnd structure +
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104 * size of fixed part + size of dynamically sized add_dcp_cdb field
105 * SEE FCP-2 documentation
106 */
107 return fcp_dl_addr;
108}
109
110fcp_dl_t
111zfcp_get_fcp_dl(struct fcp_cmnd_iu * fcp_cmd)
112{
113 return *zfcp_get_fcp_dl_ptr(fcp_cmd);
114}
115
116void
117zfcp_set_fcp_dl(struct fcp_cmnd_iu *fcp_cmd, fcp_dl_t fcp_dl)
118{
119 *zfcp_get_fcp_dl_ptr(fcp_cmd) = fcp_dl;
120}
121
122/*
123 * note: it's a bit-or operation not an assignment
124 * regarding the specified byte
125 */
126static inline void
Heiko Carstens2b67fc42007-02-05 21:16:47 +0100127set_byte(int *result, char status, char pos)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700128{
129 *result |= status << (pos * 8);
130}
131
132void
Heiko Carstens2b67fc42007-02-05 21:16:47 +0100133set_host_byte(int *result, char status)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700134{
135 set_byte(result, status, 2);
136}
137
138void
Heiko Carstens2b67fc42007-02-05 21:16:47 +0100139set_driver_byte(int *result, char status)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700140{
141 set_byte(result, status, 3);
142}
143
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144static int
145zfcp_scsi_slave_alloc(struct scsi_device *sdp)
146{
147 struct zfcp_adapter *adapter;
148 struct zfcp_unit *unit;
149 unsigned long flags;
Andreas Herrmannfb121b02005-12-01 02:49:29 +0100150 int retval = -ENXIO;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700151
152 adapter = (struct zfcp_adapter *) sdp->host->hostdata[0];
153 if (!adapter)
154 goto out;
155
156 read_lock_irqsave(&zfcp_data.config_lock, flags);
157 unit = zfcp_unit_lookup(adapter, sdp->channel, sdp->id, sdp->lun);
Andreas Herrmannad58f7d2006-03-10 00:56:16 +0100158 if (unit && atomic_test_mask(ZFCP_STATUS_UNIT_REGISTERED,
159 &unit->status)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700160 sdp->hostdata = unit;
161 unit->device = sdp;
162 zfcp_unit_get(unit);
163 retval = 0;
164 }
165 read_unlock_irqrestore(&zfcp_data.config_lock, flags);
166 out:
167 return retval;
168}
169
Andreas Herrmannf6c0e7a2006-08-02 11:05:52 +0200170/**
171 * zfcp_scsi_slave_destroy - called when scsi device is removed
172 *
173 * Remove reference to associated scsi device for an zfcp_unit.
174 * Mark zfcp_unit as failed. The scsi device might be deleted via sysfs
175 * or a scan for this device might have failed.
176 */
177static void zfcp_scsi_slave_destroy(struct scsi_device *sdpnt)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700178{
179 struct zfcp_unit *unit = (struct zfcp_unit *) sdpnt->hostdata;
180
181 if (unit) {
Christof Schmitt5f852be2007-05-08 11:16:52 +0200182 zfcp_erp_wait(unit->port->adapter);
183 wait_event(unit->scsi_scan_wq,
184 atomic_test_mask(ZFCP_STATUS_UNIT_SCSI_WORK_PENDING,
185 &unit->status) == 0);
Andreas Herrmannad58f7d2006-03-10 00:56:16 +0100186 atomic_clear_mask(ZFCP_STATUS_UNIT_REGISTERED, &unit->status);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700187 sdpnt->hostdata = NULL;
188 unit->device = NULL;
Andreas Herrmannf6c0e7a2006-08-02 11:05:52 +0200189 zfcp_erp_unit_failed(unit);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700190 zfcp_unit_put(unit);
Christof Schmitt6b76a722007-08-28 09:30:59 +0200191 } else
Linus Torvalds1da177e2005-04-16 15:20:36 -0700192 ZFCP_LOG_NORMAL("bug: no unit associated with SCSI device at "
193 "address %p\n", sdpnt);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700194}
195
Swen Schillig41fa2ad2007-09-07 09:15:31 +0200196/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700197 * called from scsi midlayer to allow finetuning of a device.
198 */
199static int
200zfcp_scsi_slave_configure(struct scsi_device *sdp)
201{
202 if (sdp->tagged_supported)
203 scsi_adjust_queue_depth(sdp, MSG_SIMPLE_TAG, ZFCP_CMND_PER_LUN);
204 else
205 scsi_adjust_queue_depth(sdp, 0, 1);
206 return 0;
207}
208
209/**
210 * zfcp_scsi_command_fail - set result in scsi_cmnd and call scsi_done function
211 * @scpnt: pointer to struct scsi_cmnd where result is set
212 * @result: result to be set in scpnt (e.g. DID_ERROR)
213 */
214static void
215zfcp_scsi_command_fail(struct scsi_cmnd *scpnt, int result)
216{
217 set_host_byte(&scpnt->result, result);
Maxim Shchetynin8a36e452005-09-13 21:50:38 +0200218 if ((scpnt->device != NULL) && (scpnt->device->host != NULL))
219 zfcp_scsi_dbf_event_result("fail", 4,
220 (struct zfcp_adapter*) scpnt->device->host->hostdata[0],
Maxim Shchetynined829ad2006-02-11 01:42:58 +0100221 scpnt, NULL);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700222 /* return directly */
223 scpnt->scsi_done(scpnt);
224}
225
226/**
227 * zfcp_scsi_command_async - worker for zfcp_scsi_queuecommand and
228 * zfcp_scsi_command_sync
229 * @adapter: adapter where scsi command is issued
230 * @unit: unit to which scsi command is sent
231 * @scpnt: scsi command to be sent
232 * @timer: timer to be started if request is successfully initiated
233 *
234 * Note: In scsi_done function must be set in scpnt.
235 */
236int
237zfcp_scsi_command_async(struct zfcp_adapter *adapter, struct zfcp_unit *unit,
Andreas Herrmann2abbe862006-09-18 22:29:56 +0200238 struct scsi_cmnd *scpnt, int use_timer)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700239{
240 int tmp;
241 int retval;
242
243 retval = 0;
244
245 BUG_ON((adapter == NULL) || (adapter != unit->port->adapter));
246 BUG_ON(scpnt->scsi_done == NULL);
247
248 if (unlikely(NULL == unit)) {
249 zfcp_scsi_command_fail(scpnt, DID_NO_CONNECT);
250 goto out;
251 }
252
253 if (unlikely(
254 atomic_test_mask(ZFCP_STATUS_COMMON_ERP_FAILED, &unit->status) ||
255 !atomic_test_mask(ZFCP_STATUS_COMMON_RUNNING, &unit->status))) {
256 ZFCP_LOG_DEBUG("stopping SCSI I/O on unit 0x%016Lx on port "
257 "0x%016Lx on adapter %s\n",
258 unit->fcp_lun, unit->port->wwpn,
259 zfcp_get_busid_by_adapter(adapter));
260 zfcp_scsi_command_fail(scpnt, DID_ERROR);
261 goto out;
262 }
263
264 if (unlikely(
265 !atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED, &unit->status))) {
266 ZFCP_LOG_DEBUG("adapter %s not ready or unit 0x%016Lx "
267 "on port 0x%016Lx in recovery\n",
268 zfcp_get_busid_by_unit(unit),
269 unit->fcp_lun, unit->port->wwpn);
Andreas Herrmannad58f7d2006-03-10 00:56:16 +0100270 zfcp_scsi_command_fail(scpnt, DID_NO_CONNECT);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700271 goto out;
272 }
273
Andreas Herrmann2abbe862006-09-18 22:29:56 +0200274 tmp = zfcp_fsf_send_fcp_command_task(adapter, unit, scpnt, use_timer,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700275 ZFCP_REQ_AUTO_CLEANUP);
276
277 if (unlikely(tmp < 0)) {
278 ZFCP_LOG_DEBUG("error: initiation of Send FCP Cmnd failed\n");
279 retval = SCSI_MLQUEUE_HOST_BUSY;
280 }
281
282out:
283 return retval;
284}
285
Heiko Carstens2b67fc42007-02-05 21:16:47 +0100286static void
Linus Torvalds1da177e2005-04-16 15:20:36 -0700287zfcp_scsi_command_sync_handler(struct scsi_cmnd *scpnt)
288{
289 struct completion *wait = (struct completion *) scpnt->SCp.ptr;
290 complete(wait);
291}
292
293
294/**
295 * zfcp_scsi_command_sync - send a SCSI command and wait for completion
296 * @unit: unit where command is sent to
297 * @scpnt: scsi command to be sent
Andreas Herrmann2abbe862006-09-18 22:29:56 +0200298 * @use_timer: indicates whether timer should be setup or not
Linus Torvalds1da177e2005-04-16 15:20:36 -0700299 * Return: 0
300 *
301 * Errors are indicated in scpnt->result
302 */
303int
304zfcp_scsi_command_sync(struct zfcp_unit *unit, struct scsi_cmnd *scpnt,
Andreas Herrmann2abbe862006-09-18 22:29:56 +0200305 int use_timer)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700306{
307 int ret;
Peter Zijlstra6e9a4732006-09-30 23:28:10 -0700308 DECLARE_COMPLETION_ONSTACK(wait);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700309
310 scpnt->SCp.ptr = (void *) &wait; /* silent re-use */
311 scpnt->scsi_done = zfcp_scsi_command_sync_handler;
Andreas Herrmann2abbe862006-09-18 22:29:56 +0200312 ret = zfcp_scsi_command_async(unit->port->adapter, unit, scpnt,
313 use_timer);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700314 if (ret == 0)
315 wait_for_completion(&wait);
316
317 scpnt->SCp.ptr = NULL;
318
319 return 0;
320}
321
322/*
323 * function: zfcp_scsi_queuecommand
324 *
325 * purpose: enqueues a SCSI command to the specified target device
326 *
327 * returns: 0 - success, SCSI command enqueued
328 * !0 - failure
329 */
Heiko Carstens2b67fc42007-02-05 21:16:47 +0100330static int
Linus Torvalds1da177e2005-04-16 15:20:36 -0700331zfcp_scsi_queuecommand(struct scsi_cmnd *scpnt,
332 void (*done) (struct scsi_cmnd *))
333{
334 struct zfcp_unit *unit;
335 struct zfcp_adapter *adapter;
336
337 /* reset the status for this request */
338 scpnt->result = 0;
339 scpnt->host_scribble = NULL;
340 scpnt->scsi_done = done;
341
342 /*
343 * figure out adapter and target device
344 * (stored there by zfcp_scsi_slave_alloc)
345 */
346 adapter = (struct zfcp_adapter *) scpnt->device->host->hostdata[0];
347 unit = (struct zfcp_unit *) scpnt->device->hostdata;
348
Andreas Herrmann2abbe862006-09-18 22:29:56 +0200349 return zfcp_scsi_command_async(adapter, unit, scpnt, 0);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700350}
351
Linus Torvalds1da177e2005-04-16 15:20:36 -0700352static struct zfcp_unit *
Andreas Herrmann06506d02006-05-22 18:18:19 +0200353zfcp_unit_lookup(struct zfcp_adapter *adapter, int channel, unsigned int id,
354 unsigned int lun)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700355{
356 struct zfcp_port *port;
357 struct zfcp_unit *unit, *retval = NULL;
358
359 list_for_each_entry(port, &adapter->port_list_head, list) {
Andreas Herrmann3859f6a2005-08-27 11:07:54 -0700360 if (!port->rport || (id != port->rport->scsi_target_id))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700361 continue;
Christof Schmitt6b76a722007-08-28 09:30:59 +0200362 list_for_each_entry(unit, &port->unit_list_head, list)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700363 if (lun == unit->scsi_lun) {
364 retval = unit;
365 goto out;
366 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700367 }
368 out:
369 return retval;
370}
371
Andreas Herrmann059c97d2005-09-13 21:47:52 +0200372/**
373 * zfcp_scsi_eh_abort_handler - abort the specified SCSI command
Swen Schillig41fa2ad2007-09-07 09:15:31 +0200374 * @scpnt: pointer to scsi_cmnd to be aborted
Andreas Herrmann059c97d2005-09-13 21:47:52 +0200375 * Return: SUCCESS - command has been aborted and cleaned up in internal
376 * bookkeeping, SCSI stack won't be called for aborted command
377 * FAILED - otherwise
Linus Torvalds1da177e2005-04-16 15:20:36 -0700378 *
Andreas Herrmann059c97d2005-09-13 21:47:52 +0200379 * We do not need to care for a SCSI command which completes normally
380 * but late during this abort routine runs. We are allowed to return
381 * late commands to the SCSI stack. It tracks the state of commands and
382 * will handle late commands. (Usually, the normal completion of late
383 * commands is ignored with respect to the running abort operation.)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700384 */
Heiko Carstens2b67fc42007-02-05 21:16:47 +0100385static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700386{
Andreas Herrmann059c97d2005-09-13 21:47:52 +0200387 struct Scsi_Host *scsi_host;
388 struct zfcp_adapter *adapter;
389 struct zfcp_unit *unit;
Andreas Herrmann4eff4a32006-09-18 22:29:20 +0200390 struct zfcp_fsf_req *fsf_req;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700391 unsigned long flags;
Andreas Herrmann4eff4a32006-09-18 22:29:20 +0200392 unsigned long old_req_id;
393 int retval = SUCCESS;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700394
Andreas Herrmann059c97d2005-09-13 21:47:52 +0200395 scsi_host = scpnt->device->host;
396 adapter = (struct zfcp_adapter *) scsi_host->hostdata[0];
397 unit = (struct zfcp_unit *) scpnt->device->hostdata;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700398
399 ZFCP_LOG_INFO("aborting scsi_cmnd=%p on adapter %s\n",
400 scpnt, zfcp_get_busid_by_adapter(adapter));
401
Andreas Herrmann059c97d2005-09-13 21:47:52 +0200402 /* avoid race condition between late normal completion and abort */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700403 write_lock_irqsave(&adapter->abort_lock, flags);
404
Andreas Herrmann4eff4a32006-09-18 22:29:20 +0200405 /* Check whether corresponding fsf_req is still pending */
406 spin_lock(&adapter->req_list_lock);
Heiko Carstensca2d02c2007-05-08 11:17:54 +0200407 fsf_req = zfcp_reqlist_find(adapter,
408 (unsigned long) scpnt->host_scribble);
Andreas Herrmann4eff4a32006-09-18 22:29:20 +0200409 spin_unlock(&adapter->req_list_lock);
410 if (!fsf_req) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700411 write_unlock_irqrestore(&adapter->abort_lock, flags);
Andreas Herrmann4eff4a32006-09-18 22:29:20 +0200412 zfcp_scsi_dbf_event_abort("lte1", adapter, scpnt, NULL, 0);
Maxim Shchetynin8a36e452005-09-13 21:50:38 +0200413 retval = SUCCESS;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700414 goto out;
415 }
Andreas Herrmann4eff4a32006-09-18 22:29:20 +0200416 fsf_req->data = 0;
417 fsf_req->status |= ZFCP_STATUS_FSFREQ_ABORTING;
418 old_req_id = fsf_req->req_id;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700419
Andreas Herrmann4eff4a32006-09-18 22:29:20 +0200420 /* don't access old fsf_req after releasing the abort_lock */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700421 write_unlock_irqrestore(&adapter->abort_lock, flags);
Andreas Herrmann4eff4a32006-09-18 22:29:20 +0200422
423 fsf_req = zfcp_fsf_abort_fcp_command(old_req_id, adapter, unit, 0);
424 if (!fsf_req) {
Maxim Shchetynin8a36e452005-09-13 21:50:38 +0200425 ZFCP_LOG_INFO("error: initiation of Abort FCP Cmnd failed\n");
Maxim Shchetynined829ad2006-02-11 01:42:58 +0100426 zfcp_scsi_dbf_event_abort("nres", adapter, scpnt, NULL,
Andreas Herrmann4eff4a32006-09-18 22:29:20 +0200427 old_req_id);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700428 retval = FAILED;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700429 goto out;
430 }
431
Andreas Herrmann4eff4a32006-09-18 22:29:20 +0200432 __wait_event(fsf_req->completion_wq,
433 fsf_req->status & ZFCP_STATUS_FSFREQ_COMPLETED);
Andreas Herrmann059c97d2005-09-13 21:47:52 +0200434
Andreas Herrmann4eff4a32006-09-18 22:29:20 +0200435 if (fsf_req->status & ZFCP_STATUS_FSFREQ_ABORTSUCCEEDED) {
436 zfcp_scsi_dbf_event_abort("okay", adapter, scpnt, fsf_req, 0);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700437 retval = SUCCESS;
Andreas Herrmann4eff4a32006-09-18 22:29:20 +0200438 } else if (fsf_req->status & ZFCP_STATUS_FSFREQ_ABORTNOTNEEDED) {
439 zfcp_scsi_dbf_event_abort("lte2", adapter, scpnt, fsf_req, 0);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700440 retval = SUCCESS;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700441 } else {
Andreas Herrmann4eff4a32006-09-18 22:29:20 +0200442 zfcp_scsi_dbf_event_abort("fail", adapter, scpnt, fsf_req, 0);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700443 retval = FAILED;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700444 }
Andreas Herrmann4eff4a32006-09-18 22:29:20 +0200445 zfcp_fsf_req_free(fsf_req);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700446 out:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700447 return retval;
448}
449
Heiko Carstens2b67fc42007-02-05 21:16:47 +0100450static int
Linus Torvalds1da177e2005-04-16 15:20:36 -0700451zfcp_scsi_eh_device_reset_handler(struct scsi_cmnd *scpnt)
452{
453 int retval;
454 struct zfcp_unit *unit = (struct zfcp_unit *) scpnt->device->hostdata;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700455
Linus Torvalds1da177e2005-04-16 15:20:36 -0700456 if (!unit) {
457 ZFCP_LOG_NORMAL("bug: Tried reset for nonexistent unit\n");
458 retval = SUCCESS;
459 goto out;
460 }
461 ZFCP_LOG_NORMAL("resetting unit 0x%016Lx\n", unit->fcp_lun);
462
463 /*
464 * If we do not know whether the unit supports 'logical unit reset'
465 * then try 'logical unit reset' and proceed with 'target reset'
466 * if 'logical unit reset' fails.
467 * If the unit is known not to support 'logical unit reset' then
468 * skip 'logical unit reset' and try 'target reset' immediately.
469 */
470 if (!atomic_test_mask(ZFCP_STATUS_UNIT_NOTSUPPUNITRESET,
471 &unit->status)) {
Maxim Shchetynin8a36e452005-09-13 21:50:38 +0200472 retval = zfcp_task_management_function(unit,
473 FCP_LOGICAL_UNIT_RESET,
474 scpnt);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700475 if (retval) {
476 ZFCP_LOG_DEBUG("unit reset failed (unit=%p)\n", unit);
477 if (retval == -ENOTSUPP)
478 atomic_set_mask
479 (ZFCP_STATUS_UNIT_NOTSUPPUNITRESET,
480 &unit->status);
481 /* fall through and try 'target reset' next */
482 } else {
483 ZFCP_LOG_DEBUG("unit reset succeeded (unit=%p)\n",
484 unit);
485 /* avoid 'target reset' */
486 retval = SUCCESS;
487 goto out;
488 }
489 }
Maxim Shchetynin8a36e452005-09-13 21:50:38 +0200490 retval = zfcp_task_management_function(unit, FCP_TARGET_RESET, scpnt);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700491 if (retval) {
492 ZFCP_LOG_DEBUG("target reset failed (unit=%p)\n", unit);
493 retval = FAILED;
494 } else {
495 ZFCP_LOG_DEBUG("target reset succeeded (unit=%p)\n", unit);
496 retval = SUCCESS;
497 }
498 out:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700499 return retval;
500}
501
502static int
Maxim Shchetynin8a36e452005-09-13 21:50:38 +0200503zfcp_task_management_function(struct zfcp_unit *unit, u8 tm_flags,
504 struct scsi_cmnd *scpnt)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700505{
506 struct zfcp_adapter *adapter = unit->port->adapter;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700507 struct zfcp_fsf_req *fsf_req;
Andreas Herrmann77eb1692005-09-13 21:48:33 +0200508 int retval = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700509
510 /* issue task management function */
511 fsf_req = zfcp_fsf_send_fcp_command_task_management
512 (adapter, unit, tm_flags, 0);
513 if (!fsf_req) {
514 ZFCP_LOG_INFO("error: creation of task management request "
515 "failed for unit 0x%016Lx on port 0x%016Lx on "
516 "adapter %s\n", unit->fcp_lun, unit->port->wwpn,
517 zfcp_get_busid_by_adapter(adapter));
Maxim Shchetynin8a36e452005-09-13 21:50:38 +0200518 zfcp_scsi_dbf_event_devreset("nres", tm_flags, unit, scpnt);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700519 retval = -ENOMEM;
520 goto out;
521 }
522
Andreas Herrmann77eb1692005-09-13 21:48:33 +0200523 __wait_event(fsf_req->completion_wq,
524 fsf_req->status & ZFCP_STATUS_FSFREQ_COMPLETED);
525
Maxim Shchetynin8a36e452005-09-13 21:50:38 +0200526 /*
527 * check completion status of task management function
528 */
529 if (fsf_req->status & ZFCP_STATUS_FSFREQ_TMFUNCFAILED) {
530 zfcp_scsi_dbf_event_devreset("fail", tm_flags, unit, scpnt);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700531 retval = -EIO;
Maxim Shchetynin8a36e452005-09-13 21:50:38 +0200532 } else if (fsf_req->status & ZFCP_STATUS_FSFREQ_TMFUNCNOTSUPP) {
533 zfcp_scsi_dbf_event_devreset("nsup", tm_flags, unit, scpnt);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700534 retval = -ENOTSUPP;
Maxim Shchetynin8a36e452005-09-13 21:50:38 +0200535 } else
536 zfcp_scsi_dbf_event_devreset("okay", tm_flags, unit, scpnt);
Andreas Herrmann77eb1692005-09-13 21:48:33 +0200537
538 zfcp_fsf_req_free(fsf_req);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700539 out:
540 return retval;
541}
542
Andreas Herrmann810f1e3e2005-09-13 21:49:52 +0200543/**
Christof Schmitta11b4742007-11-05 12:37:43 +0100544 * zfcp_scsi_eh_host_reset_handler - handler for host reset
Linus Torvalds1da177e2005-04-16 15:20:36 -0700545 */
Heiko Carstens2b67fc42007-02-05 21:16:47 +0100546static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700547{
Andreas Herrmannf6c0e7a2006-08-02 11:05:52 +0200548 struct zfcp_unit *unit;
549 struct zfcp_adapter *adapter;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700550
Andreas Herrmannf6c0e7a2006-08-02 11:05:52 +0200551 unit = (struct zfcp_unit*) scpnt->device->hostdata;
552 adapter = unit->port->adapter;
553
Christof Schmitta11b4742007-11-05 12:37:43 +0100554 ZFCP_LOG_NORMAL("host reset because of problems with "
Linus Torvalds1da177e2005-04-16 15:20:36 -0700555 "unit 0x%016Lx\n", unit->fcp_lun);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700556
Andreas Herrmann81654282006-09-18 22:30:36 +0200557 zfcp_erp_adapter_reopen(adapter, 0);
558 zfcp_erp_wait(adapter);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700559
Andreas Herrmann810f1e3e2005-09-13 21:49:52 +0200560 return SUCCESS;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700561}
562
Linus Torvalds1da177e2005-04-16 15:20:36 -0700563int
564zfcp_adapter_scsi_register(struct zfcp_adapter *adapter)
565{
566 int retval = 0;
567 static unsigned int unique_id = 0;
568
Michael Loehr9f287452007-05-09 11:01:24 +0200569 if (adapter->scsi_host)
570 goto out;
571
Linus Torvalds1da177e2005-04-16 15:20:36 -0700572 /* register adapter as SCSI host with mid layer of SCSI stack */
573 adapter->scsi_host = scsi_host_alloc(&zfcp_data.scsi_host_template,
574 sizeof (struct zfcp_adapter *));
575 if (!adapter->scsi_host) {
576 ZFCP_LOG_NORMAL("error: registration with SCSI stack failed "
577 "for adapter %s ",
578 zfcp_get_busid_by_adapter(adapter));
579 retval = -EIO;
580 goto out;
581 }
582 ZFCP_LOG_DEBUG("host registered, scsi_host=%p\n", adapter->scsi_host);
583
584 /* tell the SCSI stack some characteristics of this adapter */
585 adapter->scsi_host->max_id = 1;
586 adapter->scsi_host->max_lun = 1;
587 adapter->scsi_host->max_channel = 0;
588 adapter->scsi_host->unique_id = unique_id++; /* FIXME */
589 adapter->scsi_host->max_cmd_len = ZFCP_MAX_SCSI_CMND_LENGTH;
Heiko Carstensdd52e0e2006-09-18 22:28:49 +0200590 adapter->scsi_host->transportt = zfcp_data.scsi_transport_template;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700591
592 /*
593 * save a pointer to our own adapter data structure within
594 * hostdata field of SCSI host data structure
595 */
596 adapter->scsi_host->hostdata[0] = (unsigned long) adapter;
597
598 if (scsi_add_host(adapter->scsi_host, &adapter->ccw_device->dev)) {
599 scsi_host_put(adapter->scsi_host);
600 retval = -EIO;
601 goto out;
602 }
603 atomic_set_mask(ZFCP_STATUS_ADAPTER_REGISTERED, &adapter->status);
604 out:
605 return retval;
606}
607
Linus Torvalds1da177e2005-04-16 15:20:36 -0700608void
609zfcp_adapter_scsi_unregister(struct zfcp_adapter *adapter)
610{
611 struct Scsi_Host *shost;
Andreas Herrmann13e1e1f2005-09-19 16:56:17 +0200612 struct zfcp_port *port;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700613
614 shost = adapter->scsi_host;
615 if (!shost)
616 return;
Andreas Herrmann13e1e1f2005-09-19 16:56:17 +0200617 read_lock_irq(&zfcp_data.config_lock);
618 list_for_each_entry(port, &adapter->port_list_head, list)
619 if (port->rport)
620 port->rport = NULL;
621 read_unlock_irq(&zfcp_data.config_lock);
Andreas Herrmann3859f6a2005-08-27 11:07:54 -0700622 fc_remove_host(shost);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700623 scsi_remove_host(shost);
624 scsi_host_put(shost);
625 adapter->scsi_host = NULL;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700626 atomic_clear_mask(ZFCP_STATUS_ADAPTER_REGISTERED, &adapter->status);
627
628 return;
629}
630
Linus Torvalds1da177e2005-04-16 15:20:36 -0700631/*
632 * Support functions for FC transport class
633 */
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100634static struct fc_host_statistics*
635zfcp_init_fc_host_stats(struct zfcp_adapter *adapter)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700636{
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100637 struct fc_host_statistics *fc_stats;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700638
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100639 if (!adapter->fc_stats) {
640 fc_stats = kmalloc(sizeof(*fc_stats), GFP_KERNEL);
641 if (!fc_stats)
642 return NULL;
643 adapter->fc_stats = fc_stats; /* freed in adater_dequeue */
644 }
645 memset(adapter->fc_stats, 0, sizeof(*adapter->fc_stats));
646 return adapter->fc_stats;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700647}
648
649static void
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100650zfcp_adjust_fc_host_stats(struct fc_host_statistics *fc_stats,
651 struct fsf_qtcb_bottom_port *data,
652 struct fsf_qtcb_bottom_port *old)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700653{
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100654 fc_stats->seconds_since_last_reset = data->seconds_since_last_reset -
655 old->seconds_since_last_reset;
656 fc_stats->tx_frames = data->tx_frames - old->tx_frames;
657 fc_stats->tx_words = data->tx_words - old->tx_words;
658 fc_stats->rx_frames = data->rx_frames - old->rx_frames;
659 fc_stats->rx_words = data->rx_words - old->rx_words;
660 fc_stats->lip_count = data->lip - old->lip;
661 fc_stats->nos_count = data->nos - old->nos;
662 fc_stats->error_frames = data->error_frames - old->error_frames;
663 fc_stats->dumped_frames = data->dumped_frames - old->dumped_frames;
664 fc_stats->link_failure_count = data->link_failure - old->link_failure;
665 fc_stats->loss_of_sync_count = data->loss_of_sync - old->loss_of_sync;
666 fc_stats->loss_of_signal_count = data->loss_of_signal -
667 old->loss_of_signal;
668 fc_stats->prim_seq_protocol_err_count = data->psp_error_counts -
669 old->psp_error_counts;
670 fc_stats->invalid_tx_word_count = data->invalid_tx_words -
671 old->invalid_tx_words;
672 fc_stats->invalid_crc_count = data->invalid_crcs - old->invalid_crcs;
673 fc_stats->fcp_input_requests = data->input_requests -
674 old->input_requests;
675 fc_stats->fcp_output_requests = data->output_requests -
676 old->output_requests;
677 fc_stats->fcp_control_requests = data->control_requests -
678 old->control_requests;
679 fc_stats->fcp_input_megabytes = data->input_mb - old->input_mb;
680 fc_stats->fcp_output_megabytes = data->output_mb - old->output_mb;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700681}
682
683static void
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100684zfcp_set_fc_host_stats(struct fc_host_statistics *fc_stats,
685 struct fsf_qtcb_bottom_port *data)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700686{
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100687 fc_stats->seconds_since_last_reset = data->seconds_since_last_reset;
688 fc_stats->tx_frames = data->tx_frames;
689 fc_stats->tx_words = data->tx_words;
690 fc_stats->rx_frames = data->rx_frames;
691 fc_stats->rx_words = data->rx_words;
692 fc_stats->lip_count = data->lip;
693 fc_stats->nos_count = data->nos;
694 fc_stats->error_frames = data->error_frames;
695 fc_stats->dumped_frames = data->dumped_frames;
696 fc_stats->link_failure_count = data->link_failure;
697 fc_stats->loss_of_sync_count = data->loss_of_sync;
698 fc_stats->loss_of_signal_count = data->loss_of_signal;
699 fc_stats->prim_seq_protocol_err_count = data->psp_error_counts;
700 fc_stats->invalid_tx_word_count = data->invalid_tx_words;
701 fc_stats->invalid_crc_count = data->invalid_crcs;
702 fc_stats->fcp_input_requests = data->input_requests;
703 fc_stats->fcp_output_requests = data->output_requests;
704 fc_stats->fcp_control_requests = data->control_requests;
705 fc_stats->fcp_input_megabytes = data->input_mb;
706 fc_stats->fcp_output_megabytes = data->output_mb;
707}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700708
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100709/**
710 * zfcp_get_fc_host_stats - provide fc_host_statistics for scsi_transport_fc
711 *
712 * assumption: scsi_transport_fc synchronizes calls of
713 * get_fc_host_stats and reset_fc_host_stats
714 * (XXX to be checked otherwise introduce locking)
715 */
716static struct fc_host_statistics *
717zfcp_get_fc_host_stats(struct Scsi_Host *shost)
718{
719 struct zfcp_adapter *adapter;
720 struct fc_host_statistics *fc_stats;
721 struct fsf_qtcb_bottom_port *data;
722 int ret;
723
724 adapter = (struct zfcp_adapter *)shost->hostdata[0];
725 fc_stats = zfcp_init_fc_host_stats(adapter);
726 if (!fc_stats)
727 return NULL;
728
Andreas Herrmannec4081c2006-05-22 18:17:30 +0200729 data = kzalloc(sizeof(*data), GFP_KERNEL);
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100730 if (!data)
731 return NULL;
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100732
Swen Schillig52ef11a2007-08-28 09:31:09 +0200733 ret = zfcp_fsf_exchange_port_data_sync(adapter, data);
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100734 if (ret) {
735 kfree(data);
736 return NULL; /* XXX return zeroed fc_stats? */
737 }
738
739 if (adapter->stats_reset &&
740 ((jiffies/HZ - adapter->stats_reset) <
741 data->seconds_since_last_reset)) {
742 zfcp_adjust_fc_host_stats(fc_stats, data,
743 adapter->stats_reset_data);
744 } else
745 zfcp_set_fc_host_stats(fc_stats, data);
746
747 kfree(data);
748 return fc_stats;
749}
750
751static void
752zfcp_reset_fc_host_stats(struct Scsi_Host *shost)
753{
754 struct zfcp_adapter *adapter;
755 struct fsf_qtcb_bottom_port *data, *old_data;
756 int ret;
757
758 adapter = (struct zfcp_adapter *)shost->hostdata[0];
Andreas Herrmannec4081c2006-05-22 18:17:30 +0200759 data = kzalloc(sizeof(*data), GFP_KERNEL);
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100760 if (!data)
761 return;
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100762
Swen Schillig52ef11a2007-08-28 09:31:09 +0200763 ret = zfcp_fsf_exchange_port_data_sync(adapter, data);
Heiko Carstens83f6d6d2007-08-08 10:47:02 +0200764 if (ret) {
765 kfree(data);
766 } else {
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100767 adapter->stats_reset = jiffies/HZ;
768 old_data = adapter->stats_reset_data;
769 adapter->stats_reset_data = data; /* finally freed in
770 adater_dequeue */
771 kfree(old_data);
772 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700773}
774
Andreas Herrmann338151e2006-05-22 18:25:56 +0200775static void zfcp_set_rport_dev_loss_tmo(struct fc_rport *rport, u32 timeout)
776{
777 rport->dev_loss_tmo = timeout;
778}
779
Linus Torvalds1da177e2005-04-16 15:20:36 -0700780struct fc_function_template zfcp_transport_functions = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700781 .show_starget_port_id = 1,
782 .show_starget_port_name = 1,
783 .show_starget_node_name = 1,
Andreas Herrmann3859f6a2005-08-27 11:07:54 -0700784 .show_rport_supported_classes = 1,
Ralph Wuerthner75bfc282006-05-22 18:24:33 +0200785 .show_rport_maxframe_size = 1,
Andreas Herrmann338151e2006-05-22 18:25:56 +0200786 .show_rport_dev_loss_tmo = 1,
Andreas Herrmann3859f6a2005-08-27 11:07:54 -0700787 .show_host_node_name = 1,
788 .show_host_port_name = 1,
Andreas Herrmannad757cd2006-01-13 02:26:11 +0100789 .show_host_permanent_port_name = 1,
Andreas Herrmann3859f6a2005-08-27 11:07:54 -0700790 .show_host_supported_classes = 1,
Andreas Herrmannad757cd2006-01-13 02:26:11 +0100791 .show_host_supported_speeds = 1,
Andreas Herrmann13e1e1f2005-09-19 16:56:17 +0200792 .show_host_maxframe_size = 1,
Andreas Herrmann3859f6a2005-08-27 11:07:54 -0700793 .show_host_serial_number = 1,
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100794 .get_fc_host_stats = zfcp_get_fc_host_stats,
795 .reset_fc_host_stats = zfcp_reset_fc_host_stats,
Andreas Herrmann338151e2006-05-22 18:25:56 +0200796 .set_rport_dev_loss_tmo = zfcp_set_rport_dev_loss_tmo,
Andreas Herrmannf6cd94b2006-01-05 09:59:34 +0100797 /* no functions registered for following dynamic attributes but
798 directly set by LLDD */
Andreas Herrmannad757cd2006-01-13 02:26:11 +0100799 .show_host_port_type = 1,
Andreas Herrmann13e1e1f2005-09-19 16:56:17 +0200800 .show_host_speed = 1,
801 .show_host_port_id = 1,
Swen Schillig52ef11a2007-08-28 09:31:09 +0200802 .disable_target_scan = 1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700803};
804
805/**
806 * ZFCP_DEFINE_SCSI_ATTR
807 * @_name: name of show attribute
808 * @_format: format string
809 * @_value: value to print
810 *
811 * Generates attribute for a unit.
812 */
813#define ZFCP_DEFINE_SCSI_ATTR(_name, _format, _value) \
Yani Ioannou10523b32005-05-17 06:43:37 -0400814static ssize_t zfcp_sysfs_scsi_##_name##_show(struct device *dev, struct device_attribute *attr, \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700815 char *buf) \
816{ \
817 struct scsi_device *sdev; \
818 struct zfcp_unit *unit; \
819 \
820 sdev = to_scsi_device(dev); \
821 unit = sdev->hostdata; \
822 return sprintf(buf, _format, _value); \
823} \
824 \
825static DEVICE_ATTR(_name, S_IRUGO, zfcp_sysfs_scsi_##_name##_show, NULL);
826
827ZFCP_DEFINE_SCSI_ATTR(hba_id, "%s\n", zfcp_get_busid_by_unit(unit));
828ZFCP_DEFINE_SCSI_ATTR(wwpn, "0x%016llx\n", unit->port->wwpn);
829ZFCP_DEFINE_SCSI_ATTR(fcp_lun, "0x%016llx\n", unit->fcp_lun);
830
831static struct device_attribute *zfcp_sysfs_sdev_attrs[] = {
832 &dev_attr_fcp_lun,
833 &dev_attr_wwpn,
834 &dev_attr_hba_id,
835 NULL
836};
837
838#undef ZFCP_LOG_AREA