blob: e03140fec179cdab7dd6658aba4c6c78b2f89855 [file] [log] [blame]
8482e1182005-04-17 15:04:54 -05001/*
Andrew Vasquezfa90c542005-10-27 11:10:08 -07002 * QLogic Fibre Channel HBA Driver
3 * Copyright (c) 2003-2005 QLogic Corporation
8482e1182005-04-17 15:04:54 -05004 *
Andrew Vasquezfa90c542005-10-27 11:10:08 -07005 * See LICENSE.qla2xxx for copyright and licensing details.
8482e1182005-04-17 15:04:54 -05006 */
7#include "qla_def.h"
8
7aaef272005-04-17 16:32:42 -05009#include <linux/vmalloc.h>
8482e1182005-04-17 15:04:54 -050010#include <scsi/scsi_transport_fc.h>
11
12/* SYSFS attributes --------------------------------------------------------- */
13
14static ssize_t
15qla2x00_sysfs_read_fw_dump(struct kobject *kobj, char *buf, loff_t off,
16 size_t count)
17{
18 struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
19 struct device, kobj)));
20
21 if (ha->fw_dump_reading == 0)
22 return 0;
23 if (off > ha->fw_dump_buffer_len)
24 return 0;
25 if (off + count > ha->fw_dump_buffer_len)
26 count = ha->fw_dump_buffer_len - off;
27
28 memcpy(buf, &ha->fw_dump_buffer[off], count);
29
30 return (count);
31}
32
33static ssize_t
34qla2x00_sysfs_write_fw_dump(struct kobject *kobj, char *buf, loff_t off,
35 size_t count)
36{
37 struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
38 struct device, kobj)));
39 int reading;
40 uint32_t dump_size;
41
42 if (off != 0)
43 return (0);
44
45 reading = simple_strtol(buf, NULL, 10);
46 switch (reading) {
47 case 0:
48 if (ha->fw_dump_reading == 1) {
49 qla_printk(KERN_INFO, ha,
50 "Firmware dump cleared on (%ld).\n",
51 ha->host_no);
52
53 vfree(ha->fw_dump_buffer);
Andrew Vasquezfca29702005-07-06 10:31:47 -070054 if (!IS_QLA24XX(ha) && !IS_QLA25XX(ha))
55 free_pages((unsigned long)ha->fw_dump,
56 ha->fw_dump_order);
8482e1182005-04-17 15:04:54 -050057
58 ha->fw_dump_reading = 0;
59 ha->fw_dump_buffer = NULL;
60 ha->fw_dump = NULL;
Andrew Vasquezfca29702005-07-06 10:31:47 -070061 ha->fw_dumped = 0;
8482e1182005-04-17 15:04:54 -050062 }
63 break;
64 case 1:
Andrew Vasquezfca29702005-07-06 10:31:47 -070065 if ((ha->fw_dump || ha->fw_dumped) && !ha->fw_dump_reading) {
8482e1182005-04-17 15:04:54 -050066 ha->fw_dump_reading = 1;
67
Andrew Vasquezfca29702005-07-06 10:31:47 -070068 if (IS_QLA24XX(ha) || IS_QLA25XX(ha))
69 dump_size = FW_DUMP_SIZE_24XX;
70 else {
71 dump_size = FW_DUMP_SIZE_1M;
72 if (ha->fw_memory_size < 0x20000)
73 dump_size = FW_DUMP_SIZE_128K;
74 else if (ha->fw_memory_size < 0x80000)
75 dump_size = FW_DUMP_SIZE_512K;
76 }
8482e1182005-04-17 15:04:54 -050077 ha->fw_dump_buffer = (char *)vmalloc(dump_size);
78 if (ha->fw_dump_buffer == NULL) {
79 qla_printk(KERN_WARNING, ha,
80 "Unable to allocate memory for firmware "
81 "dump buffer (%d).\n", dump_size);
82
83 ha->fw_dump_reading = 0;
84 return (count);
85 }
86 qla_printk(KERN_INFO, ha,
87 "Firmware dump ready for read on (%ld).\n",
88 ha->host_no);
89 memset(ha->fw_dump_buffer, 0, dump_size);
Andrew Vasquezabbd8872005-07-06 10:30:05 -070090 ha->isp_ops.ascii_fw_dump(ha);
8482e1182005-04-17 15:04:54 -050091 ha->fw_dump_buffer_len = strlen(ha->fw_dump_buffer);
92 }
93 break;
94 }
95 return (count);
96}
97
98static struct bin_attribute sysfs_fw_dump_attr = {
99 .attr = {
100 .name = "fw_dump",
101 .mode = S_IRUSR | S_IWUSR,
102 .owner = THIS_MODULE,
103 },
104 .size = 0,
105 .read = qla2x00_sysfs_read_fw_dump,
106 .write = qla2x00_sysfs_write_fw_dump,
107};
108
109static ssize_t
110qla2x00_sysfs_read_nvram(struct kobject *kobj, char *buf, loff_t off,
111 size_t count)
112{
113 struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
114 struct device, kobj)));
8482e1182005-04-17 15:04:54 -0500115 unsigned long flags;
8482e1182005-04-17 15:04:54 -0500116
Andrew Vasquez459c5372005-07-06 10:31:07 -0700117 if (!capable(CAP_SYS_ADMIN) || off != 0 || count != ha->nvram_size)
8482e1182005-04-17 15:04:54 -0500118 return 0;
119
120 /* Read NVRAM. */
121 spin_lock_irqsave(&ha->hardware_lock, flags);
Andrew Vasquez459c5372005-07-06 10:31:07 -0700122 ha->isp_ops.read_nvram(ha, (uint8_t *)buf, ha->nvram_base,
123 ha->nvram_size);
8482e1182005-04-17 15:04:54 -0500124 spin_unlock_irqrestore(&ha->hardware_lock, flags);
125
126 return (count);
127}
128
129static ssize_t
130qla2x00_sysfs_write_nvram(struct kobject *kobj, char *buf, loff_t off,
131 size_t count)
132{
133 struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
134 struct device, kobj)));
8482e1182005-04-17 15:04:54 -0500135 unsigned long flags;
136 uint16_t cnt;
8482e1182005-04-17 15:04:54 -0500137
Andrew Vasquez459c5372005-07-06 10:31:07 -0700138 if (!capable(CAP_SYS_ADMIN) || off != 0 || count != ha->nvram_size)
8482e1182005-04-17 15:04:54 -0500139 return 0;
140
141 /* Checksum NVRAM. */
Andrew Vasquez459c5372005-07-06 10:31:07 -0700142 if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) {
143 uint32_t *iter;
144 uint32_t chksum;
145
146 iter = (uint32_t *)buf;
147 chksum = 0;
148 for (cnt = 0; cnt < ((count >> 2) - 1); cnt++)
149 chksum += le32_to_cpu(*iter++);
150 chksum = ~chksum + 1;
151 *iter = cpu_to_le32(chksum);
152 } else {
153 uint8_t *iter;
154 uint8_t chksum;
155
156 iter = (uint8_t *)buf;
157 chksum = 0;
158 for (cnt = 0; cnt < count - 1; cnt++)
159 chksum += *iter++;
160 chksum = ~chksum + 1;
161 *iter = chksum;
162 }
8482e1182005-04-17 15:04:54 -0500163
164 /* Write NVRAM. */
165 spin_lock_irqsave(&ha->hardware_lock, flags);
Andrew Vasquez459c5372005-07-06 10:31:07 -0700166 ha->isp_ops.write_nvram(ha, (uint8_t *)buf, ha->nvram_base, count);
8482e1182005-04-17 15:04:54 -0500167 spin_unlock_irqrestore(&ha->hardware_lock, flags);
168
169 return (count);
170}
171
172static struct bin_attribute sysfs_nvram_attr = {
173 .attr = {
174 .name = "nvram",
175 .mode = S_IRUSR | S_IWUSR,
176 .owner = THIS_MODULE,
177 },
Andrew Vasquez459c5372005-07-06 10:31:07 -0700178 .size = 0,
8482e1182005-04-17 15:04:54 -0500179 .read = qla2x00_sysfs_read_nvram,
180 .write = qla2x00_sysfs_write_nvram,
181};
182
183void
184qla2x00_alloc_sysfs_attr(scsi_qla_host_t *ha)
185{
186 struct Scsi_Host *host = ha->host;
187
188 sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_fw_dump_attr);
Andrew Vasquez459c5372005-07-06 10:31:07 -0700189 sysfs_nvram_attr.size = ha->nvram_size;
8482e1182005-04-17 15:04:54 -0500190 sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_nvram_attr);
191}
192
193void
194qla2x00_free_sysfs_attr(scsi_qla_host_t *ha)
195{
196 struct Scsi_Host *host = ha->host;
197
198 sysfs_remove_bin_file(&host->shost_gendev.kobj, &sysfs_fw_dump_attr);
199 sysfs_remove_bin_file(&host->shost_gendev.kobj, &sysfs_nvram_attr);
200}
201
Andrew Vasquezafb046e2005-08-26 19:09:40 -0700202/* Scsi_Host attributes. */
203
204static ssize_t
205qla2x00_drvr_version_show(struct class_device *cdev, char *buf)
206{
207 return snprintf(buf, PAGE_SIZE, "%s\n", qla2x00_version_str);
208}
209
210static ssize_t
211qla2x00_fw_version_show(struct class_device *cdev, char *buf)
212{
213 scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
214 char fw_str[30];
215
216 return snprintf(buf, PAGE_SIZE, "%s\n",
217 ha->isp_ops.fw_version_str(ha, fw_str));
218}
219
220static ssize_t
221qla2x00_serial_num_show(struct class_device *cdev, char *buf)
222{
223 scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
224 uint32_t sn;
225
226 sn = ((ha->serial0 & 0x1f) << 16) | (ha->serial2 << 8) | ha->serial1;
227 return snprintf(buf, PAGE_SIZE, "%c%05d\n", 'A' + sn / 100000,
228 sn % 100000);
229}
230
231static ssize_t
232qla2x00_isp_name_show(struct class_device *cdev, char *buf)
233{
234 scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
Andrew Vasquez54333832005-11-09 15:49:04 -0800235 return snprintf(buf, PAGE_SIZE, "ISP%04X\n", ha->pdev->device);
Andrew Vasquezafb046e2005-08-26 19:09:40 -0700236}
237
238static ssize_t
239qla2x00_isp_id_show(struct class_device *cdev, char *buf)
240{
241 scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
242 return snprintf(buf, PAGE_SIZE, "%04x %04x %04x %04x\n",
243 ha->product_id[0], ha->product_id[1], ha->product_id[2],
244 ha->product_id[3]);
245}
246
247static ssize_t
248qla2x00_model_name_show(struct class_device *cdev, char *buf)
249{
250 scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
251 return snprintf(buf, PAGE_SIZE, "%s\n", ha->model_number);
252}
253
254static ssize_t
255qla2x00_model_desc_show(struct class_device *cdev, char *buf)
256{
257 scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
258 return snprintf(buf, PAGE_SIZE, "%s\n",
259 ha->model_desc ? ha->model_desc: "");
260}
261
262static ssize_t
263qla2x00_pci_info_show(struct class_device *cdev, char *buf)
264{
265 scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
266 char pci_info[30];
267
268 return snprintf(buf, PAGE_SIZE, "%s\n",
269 ha->isp_ops.pci_info_str(ha, pci_info));
270}
271
272static ssize_t
273qla2x00_state_show(struct class_device *cdev, char *buf)
274{
275 scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
276 int len = 0;
277
278 if (atomic_read(&ha->loop_state) == LOOP_DOWN ||
279 atomic_read(&ha->loop_state) == LOOP_DEAD)
280 len = snprintf(buf, PAGE_SIZE, "Link Down\n");
281 else if (atomic_read(&ha->loop_state) != LOOP_READY ||
282 test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) ||
283 test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags))
284 len = snprintf(buf, PAGE_SIZE, "Unknown Link State\n");
285 else {
286 len = snprintf(buf, PAGE_SIZE, "Link Up - ");
287
288 switch (ha->current_topology) {
289 case ISP_CFG_NL:
290 len += snprintf(buf + len, PAGE_SIZE-len, "Loop\n");
291 break;
292 case ISP_CFG_FL:
293 len += snprintf(buf + len, PAGE_SIZE-len, "FL_Port\n");
294 break;
295 case ISP_CFG_N:
296 len += snprintf(buf + len, PAGE_SIZE-len,
297 "N_Port to N_Port\n");
298 break;
299 case ISP_CFG_F:
300 len += snprintf(buf + len, PAGE_SIZE-len, "F_Port\n");
301 break;
302 default:
303 len += snprintf(buf + len, PAGE_SIZE-len, "Loop\n");
304 break;
305 }
306 }
307 return len;
308}
309
Andrew Vasquez4fdfefe2005-10-27 11:09:48 -0700310static ssize_t
311qla2x00_zio_show(struct class_device *cdev, char *buf)
312{
313 scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
314 int len = 0;
315
316 switch (ha->zio_mode) {
317 case QLA_ZIO_MODE_5:
318 len += snprintf(buf + len, PAGE_SIZE-len, "Mode 5\n");
319 break;
320 case QLA_ZIO_MODE_6:
321 len += snprintf(buf + len, PAGE_SIZE-len, "Mode 6\n");
322 break;
323 case QLA_ZIO_DISABLED:
324 len += snprintf(buf + len, PAGE_SIZE-len, "Disabled\n");
325 break;
326 }
327 return len;
328}
329
330static ssize_t
331qla2x00_zio_store(struct class_device *cdev, const char *buf, size_t count)
332{
333 scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
334 int val = 0;
335 uint16_t zio_mode;
336
337 if (sscanf(buf, "%d", &val) != 1)
338 return -EINVAL;
339
340 switch (val) {
341 case 1:
342 zio_mode = QLA_ZIO_MODE_5;
343 break;
344 case 2:
345 zio_mode = QLA_ZIO_MODE_6;
346 break;
347 default:
348 zio_mode = QLA_ZIO_DISABLED;
349 break;
350 }
351
352 /* Update per-hba values and queue a reset. */
353 if (zio_mode != QLA_ZIO_DISABLED || ha->zio_mode != QLA_ZIO_DISABLED) {
354 ha->zio_mode = zio_mode;
355 set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
356 }
357 return strlen(buf);
358}
359
360static ssize_t
361qla2x00_zio_timer_show(struct class_device *cdev, char *buf)
362{
363 scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
364
365 return snprintf(buf, PAGE_SIZE, "%d us\n", ha->zio_timer * 100);
366}
367
368static ssize_t
369qla2x00_zio_timer_store(struct class_device *cdev, const char *buf,
370 size_t count)
371{
372 scsi_qla_host_t *ha = to_qla_host(class_to_shost(cdev));
373 int val = 0;
374 uint16_t zio_timer;
375
376 if (sscanf(buf, "%d", &val) != 1)
377 return -EINVAL;
378 if (val > 25500 || val < 100)
379 return -ERANGE;
380
381 zio_timer = (uint16_t)(val / 100);
382 ha->zio_timer = zio_timer;
383
384 return strlen(buf);
385}
386
Andrew Vasquezafb046e2005-08-26 19:09:40 -0700387static CLASS_DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_drvr_version_show,
388 NULL);
389static CLASS_DEVICE_ATTR(fw_version, S_IRUGO, qla2x00_fw_version_show, NULL);
390static CLASS_DEVICE_ATTR(serial_num, S_IRUGO, qla2x00_serial_num_show, NULL);
391static CLASS_DEVICE_ATTR(isp_name, S_IRUGO, qla2x00_isp_name_show, NULL);
392static CLASS_DEVICE_ATTR(isp_id, S_IRUGO, qla2x00_isp_id_show, NULL);
393static CLASS_DEVICE_ATTR(model_name, S_IRUGO, qla2x00_model_name_show, NULL);
394static CLASS_DEVICE_ATTR(model_desc, S_IRUGO, qla2x00_model_desc_show, NULL);
395static CLASS_DEVICE_ATTR(pci_info, S_IRUGO, qla2x00_pci_info_show, NULL);
396static CLASS_DEVICE_ATTR(state, S_IRUGO, qla2x00_state_show, NULL);
Andrew Vasquez4fdfefe2005-10-27 11:09:48 -0700397static CLASS_DEVICE_ATTR(zio, S_IRUGO | S_IWUSR, qla2x00_zio_show,
398 qla2x00_zio_store);
399static CLASS_DEVICE_ATTR(zio_timer, S_IRUGO | S_IWUSR, qla2x00_zio_timer_show,
400 qla2x00_zio_timer_store);
Andrew Vasquezafb046e2005-08-26 19:09:40 -0700401
402struct class_device_attribute *qla2x00_host_attrs[] = {
403 &class_device_attr_driver_version,
404 &class_device_attr_fw_version,
405 &class_device_attr_serial_num,
406 &class_device_attr_isp_name,
407 &class_device_attr_isp_id,
408 &class_device_attr_model_name,
409 &class_device_attr_model_desc,
410 &class_device_attr_pci_info,
411 &class_device_attr_state,
Andrew Vasquez4fdfefe2005-10-27 11:09:48 -0700412 &class_device_attr_zio,
413 &class_device_attr_zio_timer,
Andrew Vasquezafb046e2005-08-26 19:09:40 -0700414 NULL,
415};
416
8482e1182005-04-17 15:04:54 -0500417/* Host attributes. */
418
419static void
420qla2x00_get_host_port_id(struct Scsi_Host *shost)
421{
422 scsi_qla_host_t *ha = to_qla_host(shost);
423
424 fc_host_port_id(shost) = ha->d_id.b.domain << 16 |
425 ha->d_id.b.area << 8 | ha->d_id.b.al_pa;
426}
427
428static void
andrew.vasquez@qlogic.com04414012006-01-31 16:04:51 -0800429qla2x00_get_host_speed(struct Scsi_Host *shost)
430{
431 scsi_qla_host_t *ha = to_qla_host(shost);
432 uint32_t speed = 0;
433
434 switch (ha->link_data_rate) {
435 case LDR_1GB:
436 speed = 1;
437 break;
438 case LDR_2GB:
439 speed = 2;
440 break;
441 case LDR_4GB:
442 speed = 4;
443 break;
444 }
445 fc_host_speed(shost) = speed;
446}
447
448static void
8482e1182005-04-17 15:04:54 -0500449qla2x00_get_starget_node_name(struct scsi_target *starget)
450{
451 struct Scsi_Host *host = dev_to_shost(starget->dev.parent);
452 scsi_qla_host_t *ha = to_qla_host(host);
bdf79622005-04-17 15:06:53 -0500453 fc_port_t *fcport;
Andrew Vasquezf8b02a82005-08-31 15:21:20 -0700454 u64 node_name = 0;
8482e1182005-04-17 15:04:54 -0500455
bdf79622005-04-17 15:06:53 -0500456 list_for_each_entry(fcport, &ha->fcports, list) {
457 if (starget->id == fcport->os_target_id) {
Andrew Vasquezf8b02a82005-08-31 15:21:20 -0700458 node_name = wwn_to_u64(fcport->node_name);
bdf79622005-04-17 15:06:53 -0500459 break;
460 }
461 }
462
Andrew Vasquezf8b02a82005-08-31 15:21:20 -0700463 fc_starget_node_name(starget) = node_name;
8482e1182005-04-17 15:04:54 -0500464}
465
466static void
467qla2x00_get_starget_port_name(struct scsi_target *starget)
468{
469 struct Scsi_Host *host = dev_to_shost(starget->dev.parent);
470 scsi_qla_host_t *ha = to_qla_host(host);
bdf79622005-04-17 15:06:53 -0500471 fc_port_t *fcport;
Andrew Vasquezf8b02a82005-08-31 15:21:20 -0700472 u64 port_name = 0;
8482e1182005-04-17 15:04:54 -0500473
bdf79622005-04-17 15:06:53 -0500474 list_for_each_entry(fcport, &ha->fcports, list) {
475 if (starget->id == fcport->os_target_id) {
Andrew Vasquezf8b02a82005-08-31 15:21:20 -0700476 port_name = wwn_to_u64(fcport->port_name);
bdf79622005-04-17 15:06:53 -0500477 break;
478 }
479 }
480
Andrew Vasquezf8b02a82005-08-31 15:21:20 -0700481 fc_starget_port_name(starget) = port_name;
8482e1182005-04-17 15:04:54 -0500482}
483
484static void
485qla2x00_get_starget_port_id(struct scsi_target *starget)
486{
487 struct Scsi_Host *host = dev_to_shost(starget->dev.parent);
488 scsi_qla_host_t *ha = to_qla_host(host);
bdf79622005-04-17 15:06:53 -0500489 fc_port_t *fcport;
490 uint32_t port_id = ~0U;
8482e1182005-04-17 15:04:54 -0500491
bdf79622005-04-17 15:06:53 -0500492 list_for_each_entry(fcport, &ha->fcports, list) {
493 if (starget->id == fcport->os_target_id) {
494 port_id = fcport->d_id.b.domain << 16 |
495 fcport->d_id.b.area << 8 | fcport->d_id.b.al_pa;
496 break;
497 }
498 }
499
8482e1182005-04-17 15:04:54 -0500500 fc_starget_port_id(starget) = port_id;
501}
502
503static void
504qla2x00_get_rport_loss_tmo(struct fc_rport *rport)
505{
bdf79622005-04-17 15:06:53 -0500506 struct Scsi_Host *host = rport_to_shost(rport);
507 scsi_qla_host_t *ha = to_qla_host(host);
8482e1182005-04-17 15:04:54 -0500508
509 rport->dev_loss_tmo = ha->port_down_retry_count + 5;
510}
511
512static void
513qla2x00_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout)
514{
bdf79622005-04-17 15:06:53 -0500515 struct Scsi_Host *host = rport_to_shost(rport);
516 scsi_qla_host_t *ha = to_qla_host(host);
8482e1182005-04-17 15:04:54 -0500517
518 if (timeout)
519 ha->port_down_retry_count = timeout;
520 else
521 ha->port_down_retry_count = 1;
522
523 rport->dev_loss_tmo = ha->port_down_retry_count + 5;
524}
525
Andrew Vasquez91ca7b02005-10-27 16:03:37 -0700526static int
527qla2x00_issue_lip(struct Scsi_Host *shost)
528{
529 scsi_qla_host_t *ha = to_qla_host(shost);
530
531 set_bit(LOOP_RESET_NEEDED, &ha->dpc_flags);
532 return 0;
533}
534
Andrew Vasquez1c97a122005-04-21 16:13:36 -0400535struct fc_function_template qla2xxx_transport_functions = {
8482e1182005-04-17 15:04:54 -0500536
537 .show_host_node_name = 1,
538 .show_host_port_name = 1,
Andrew Vasquezad3e0ed2005-08-26 19:08:10 -0700539 .show_host_supported_classes = 1,
540
8482e1182005-04-17 15:04:54 -0500541 .get_host_port_id = qla2x00_get_host_port_id,
542 .show_host_port_id = 1,
andrew.vasquez@qlogic.com04414012006-01-31 16:04:51 -0800543 .get_host_speed = qla2x00_get_host_speed,
544 .show_host_speed = 1,
8482e1182005-04-17 15:04:54 -0500545
bdf79622005-04-17 15:06:53 -0500546 .dd_fcrport_size = sizeof(struct fc_port *),
Andrew Vasquezad3e0ed2005-08-26 19:08:10 -0700547 .show_rport_supported_classes = 1,
8482e1182005-04-17 15:04:54 -0500548
549 .get_starget_node_name = qla2x00_get_starget_node_name,
550 .show_starget_node_name = 1,
551 .get_starget_port_name = qla2x00_get_starget_port_name,
552 .show_starget_port_name = 1,
553 .get_starget_port_id = qla2x00_get_starget_port_id,
554 .show_starget_port_id = 1,
555
556 .get_rport_dev_loss_tmo = qla2x00_get_rport_loss_tmo,
557 .set_rport_dev_loss_tmo = qla2x00_set_rport_loss_tmo,
558 .show_rport_dev_loss_tmo = 1,
559
Andrew Vasquez91ca7b02005-10-27 16:03:37 -0700560 .issue_fc_host_lip = qla2x00_issue_lip,
8482e1182005-04-17 15:04:54 -0500561};
562
8482e1182005-04-17 15:04:54 -0500563void
564qla2x00_init_host_attr(scsi_qla_host_t *ha)
565{
andrew.vasquez@qlogic.comdad9c8c2006-01-13 17:04:49 -0800566 fc_host_node_name(ha->host) = wwn_to_u64(ha->node_name);
567 fc_host_port_name(ha->host) = wwn_to_u64(ha->port_name);
Andrew Vasquezad3e0ed2005-08-26 19:08:10 -0700568 fc_host_supported_classes(ha->host) = FC_COS_CLASS3;
8482e1182005-04-17 15:04:54 -0500569}