aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/lpfc/lpfc.h3
-rw-r--r--drivers/scsi/lpfc/lpfc_attr.c17
-rw-r--r--drivers/scsi/lpfc/lpfc_debugfs.c159
-rw-r--r--drivers/scsi/lpfc/lpfc_hbadisc.c2
-rw-r--r--drivers/scsi/lpfc/lpfc_mbox.c2
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c6
-rw-r--r--drivers/scsi/lpfc/lpfc_version.h2
7 files changed, 168 insertions, 23 deletions
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index 5a76d2b4253b..a6dd13e05ab2 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
@@ -430,7 +430,7 @@ struct lpfc_hba {
430 430
431 /* HBA Config Parameters */ 431 /* HBA Config Parameters */
432 uint32_t cfg_ack0; 432 uint32_t cfg_ack0;
433 uint32_t cfg_npiv_enable; 433 uint32_t cfg_enable_npiv;
434 uint32_t cfg_topology; 434 uint32_t cfg_topology;
435 uint32_t cfg_link_speed; 435 uint32_t cfg_link_speed;
436 uint32_t cfg_cr_delay; 436 uint32_t cfg_cr_delay;
@@ -551,6 +551,7 @@ struct lpfc_hba {
551#ifdef CONFIG_LPFC_DEBUG_FS 551#ifdef CONFIG_LPFC_DEBUG_FS
552 struct dentry *hba_debugfs_root; 552 struct dentry *hba_debugfs_root;
553 atomic_t debugfs_vport_count; 553 atomic_t debugfs_vport_count;
554 struct dentry *debug_hbqinfo;
554 struct dentry *debug_dumpslim; 555 struct dentry *debug_dumpslim;
555 struct dentry *debug_slow_ring_trc; 556 struct dentry *debug_slow_ring_trc;
556 struct lpfc_debugfs_trc *slow_ring_trc; 557 struct lpfc_debugfs_trc *slow_ring_trc;
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index c1cedc3d1b70..0a7f06ba77c0 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -68,12 +68,6 @@ lpfc_drvr_version_show(struct class_device *cdev, char *buf)
68} 68}
69 69
70static ssize_t 70static ssize_t
71management_version_show(struct class_device *cdev, char *buf)
72{
73 return snprintf(buf, PAGE_SIZE, DFC_API_VERSION "\n");
74}
75
76static ssize_t
77lpfc_info_show(struct class_device *cdev, char *buf) 71lpfc_info_show(struct class_device *cdev, char *buf)
78{ 72{
79 struct Scsi_Host *host = class_to_shost(cdev); 73 struct Scsi_Host *host = class_to_shost(cdev);
@@ -904,8 +898,6 @@ static CLASS_DEVICE_ATTR(num_discovered_ports, S_IRUGO,
904static CLASS_DEVICE_ATTR(nport_evt_cnt, S_IRUGO, lpfc_nport_evt_cnt_show, NULL); 898static CLASS_DEVICE_ATTR(nport_evt_cnt, S_IRUGO, lpfc_nport_evt_cnt_show, NULL);
905static CLASS_DEVICE_ATTR(lpfc_drvr_version, S_IRUGO, lpfc_drvr_version_show, 899static CLASS_DEVICE_ATTR(lpfc_drvr_version, S_IRUGO, lpfc_drvr_version_show,
906 NULL); 900 NULL);
907static CLASS_DEVICE_ATTR(management_version, S_IRUGO, management_version_show,
908 NULL);
909static CLASS_DEVICE_ATTR(board_mode, S_IRUGO | S_IWUSR, 901static CLASS_DEVICE_ATTR(board_mode, S_IRUGO | S_IWUSR,
910 lpfc_board_mode_show, lpfc_board_mode_store); 902 lpfc_board_mode_show, lpfc_board_mode_store);
911static CLASS_DEVICE_ATTR(issue_reset, S_IWUSR, NULL, lpfc_issue_reset); 903static CLASS_DEVICE_ATTR(issue_reset, S_IWUSR, NULL, lpfc_issue_reset);
@@ -1110,7 +1102,7 @@ MODULE_PARM_DESC(lpfc_sli_mode, "SLI mode selector:"
1110 " 2 - select SLI-2 even on SLI-3 capable HBAs," 1102 " 2 - select SLI-2 even on SLI-3 capable HBAs,"
1111 " 3 - select SLI-3"); 1103 " 3 - select SLI-3");
1112 1104
1113LPFC_ATTR_R(npiv_enable, 0, 0, 1, "Enable NPIV functionality"); 1105LPFC_ATTR_R(enable_npiv, 0, 0, 1, "Enable NPIV functionality");
1114 1106
1115/* 1107/*
1116# lpfc_nodev_tmo: If set, it will hold all I/O errors on devices that disappear 1108# lpfc_nodev_tmo: If set, it will hold all I/O errors on devices that disappear
@@ -1530,9 +1522,8 @@ struct class_device_attribute *lpfc_hba_attrs[] = {
1530 &class_device_attr_lpfc_multi_ring_type, 1522 &class_device_attr_lpfc_multi_ring_type,
1531 &class_device_attr_lpfc_fdmi_on, 1523 &class_device_attr_lpfc_fdmi_on,
1532 &class_device_attr_lpfc_max_luns, 1524 &class_device_attr_lpfc_max_luns,
1533 &class_device_attr_lpfc_npiv_enable, 1525 &class_device_attr_lpfc_enable_npiv,
1534 &class_device_attr_nport_evt_cnt, 1526 &class_device_attr_nport_evt_cnt,
1535 &class_device_attr_management_version,
1536 &class_device_attr_board_mode, 1527 &class_device_attr_board_mode,
1537 &class_device_attr_max_vpi, 1528 &class_device_attr_max_vpi,
1538 &class_device_attr_used_vpi, 1529 &class_device_attr_used_vpi,
@@ -1569,7 +1560,6 @@ struct class_device_attribute *lpfc_vport_attrs[] = {
1569 &class_device_attr_lpfc_fdmi_on, 1560 &class_device_attr_lpfc_fdmi_on,
1570 &class_device_attr_lpfc_max_luns, 1561 &class_device_attr_lpfc_max_luns,
1571 &class_device_attr_nport_evt_cnt, 1562 &class_device_attr_nport_evt_cnt,
1572 &class_device_attr_management_version,
1573 &class_device_attr_npiv_info, 1563 &class_device_attr_npiv_info,
1574 NULL, 1564 NULL,
1575}; 1565};
@@ -2413,7 +2403,6 @@ struct fc_function_template lpfc_vport_transport_functions = {
2413 .get_starget_port_name = lpfc_get_starget_port_name, 2403 .get_starget_port_name = lpfc_get_starget_port_name,
2414 .show_starget_port_name = 1, 2404 .show_starget_port_name = 1,
2415 2405
2416 .issue_fc_host_lip = lpfc_issue_lip,
2417 .dev_loss_tmo_callbk = lpfc_dev_loss_tmo_callbk, 2406 .dev_loss_tmo_callbk = lpfc_dev_loss_tmo_callbk,
2418 .terminate_rport_io = lpfc_terminate_rport_io, 2407 .terminate_rport_io = lpfc_terminate_rport_io,
2419 2408
@@ -2432,7 +2421,7 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
2432 lpfc_topology_init(phba, lpfc_topology); 2421 lpfc_topology_init(phba, lpfc_topology);
2433 lpfc_link_speed_init(phba, lpfc_link_speed); 2422 lpfc_link_speed_init(phba, lpfc_link_speed);
2434 lpfc_poll_tmo_init(phba, lpfc_poll_tmo); 2423 lpfc_poll_tmo_init(phba, lpfc_poll_tmo);
2435 lpfc_npiv_enable_init(phba, lpfc_npiv_enable); 2424 lpfc_enable_npiv_init(phba, lpfc_enable_npiv);
2436 lpfc_use_msi_init(phba, lpfc_use_msi); 2425 lpfc_use_msi_init(phba, lpfc_use_msi);
2437 phba->cfg_poll = lpfc_poll; 2426 phba->cfg_poll = lpfc_poll;
2438 phba->cfg_soft_wwnn = 0L; 2427 phba->cfg_soft_wwnn = 0L;
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
index dc7b858b95fa..f334761d04df 100644
--- a/drivers/scsi/lpfc/lpfc_debugfs.c
+++ b/drivers/scsi/lpfc/lpfc_debugfs.c
@@ -101,14 +101,20 @@ MODULE_PARM_DESC(lpfc_debugfs_mask_disc_trc,
101#define LPFC_NODELIST_SIZE 8192 101#define LPFC_NODELIST_SIZE 8192
102#define LPFC_NODELIST_ENTRY_SIZE 120 102#define LPFC_NODELIST_ENTRY_SIZE 120
103 103
104/* dump_slim output buffer size */ 104/* dumpslim output buffer size */
105#define LPFC_DUMPSLIM_SIZE 4096 105#define LPFC_DUMPSLIM_SIZE 4096
106 106
107/* hbqinfo output buffer size */
108#define LPFC_HBQINFO_SIZE 8192
109
107struct lpfc_debug { 110struct lpfc_debug {
108 char *buffer; 111 char *buffer;
109 int len; 112 int len;
110}; 113};
111 114
115extern struct lpfc_hbq_init *lpfc_hbq_defs[];
116extern int lpfc_sli_hbq_count(void);
117
112atomic_t lpfc_debugfs_seq_trc_cnt = ATOMIC_INIT(0); 118atomic_t lpfc_debugfs_seq_trc_cnt = ATOMIC_INIT(0);
113unsigned long lpfc_debugfs_start_time = 0L; 119unsigned long lpfc_debugfs_start_time = 0L;
114 120
@@ -196,6 +202,105 @@ lpfc_debugfs_slow_ring_trc_data(struct lpfc_hba *phba, char *buf, int size)
196 return len; 202 return len;
197} 203}
198 204
205int lpfc_debugfs_last_hbq = -1;
206
207static int
208lpfc_debugfs_hbqinfo_data(struct lpfc_hba *phba, char *buf, int size)
209{
210 int len = 0;
211 int cnt, i, j, found, posted, low;
212 uint32_t phys, raw_index, getidx;
213 struct lpfc_hbq_init *hip;
214 struct hbq_s *hbqs;
215 struct lpfc_hbq_entry *hbqe;
216 struct lpfc_dmabuf *d_buf;
217 struct hbq_dmabuf *hbq_buf;
218
219 cnt = LPFC_HBQINFO_SIZE;
220 spin_lock_irq(&phba->hbalock);
221
222 /* toggle between multiple hbqs, if any */
223 i = lpfc_sli_hbq_count();
224 if (i > 1) {
225 lpfc_debugfs_last_hbq++;
226 if (lpfc_debugfs_last_hbq >= i)
227 lpfc_debugfs_last_hbq = 0;
228 }
229 else
230 lpfc_debugfs_last_hbq = 0;
231
232 i = lpfc_debugfs_last_hbq;
233
234 len += snprintf(buf+len, size-len, "HBQ %d Info\n", i);
235
236 posted = 0;
237 list_for_each_entry(d_buf, &phba->hbq_buffer_list, list)
238 posted++;
239
240 hip = lpfc_hbq_defs[i];
241 len += snprintf(buf+len, size-len,
242 "idx:%d prof:%d rn:%d bufcnt:%d icnt:%d acnt:%d posted %d\n",
243 hip->hbq_index, hip->profile, hip->rn,
244 hip->buffer_count, hip->init_count, hip->add_count, posted);
245
246 hbqs = &phba->hbqs[i];
247 raw_index = phba->hbq_get[i];
248 getidx = le32_to_cpu(raw_index);
249 len += snprintf(buf+len, size-len,
250 "entrys:%d Put:%d nPut:%d localGet:%d hbaGet:%d\n",
251 hbqs->entry_count, hbqs->hbqPutIdx, hbqs->next_hbqPutIdx,
252 hbqs->local_hbqGetIdx, getidx);
253
254 hbqe = (struct lpfc_hbq_entry *) phba->hbqslimp.virt;
255 for (j=0; j<hbqs->entry_count; j++) {
256 len += snprintf(buf+len, size-len,
257 "%03d: %08x %04x %05x ", j,
258 hbqe->bde.addrLow, hbqe->bde.tus.w, hbqe->buffer_tag);
259
260 i = 0;
261 found = 0;
262
263 /* First calculate if slot has an associated posted buffer */
264 low = hbqs->hbqPutIdx - posted;
265 if (low >= 0) {
266 if ((j >= hbqs->hbqPutIdx) || (j < low)) {
267 len += snprintf(buf+len, size-len, "Unused\n");
268 goto skipit;
269 }
270 }
271 else {
272 if ((j >= hbqs->hbqPutIdx) &&
273 (j < (hbqs->entry_count+low))) {
274 len += snprintf(buf+len, size-len, "Unused\n");
275 goto skipit;
276 }
277 }
278
279 /* Get the Buffer info for the posted buffer */
280 list_for_each_entry(d_buf, &phba->hbq_buffer_list, list) {
281 hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf);
282 phys = ((uint64_t)hbq_buf->dbuf.phys & 0xffffffff);
283 if (phys == hbqe->bde.addrLow) {
284 len += snprintf(buf+len, size-len,
285 "Buf%d: %p %06x\n", i,
286 hbq_buf->dbuf.virt, hbq_buf->tag);
287 found = 1;
288 break;
289 }
290 i++;
291 }
292 if (!found) {
293 len += snprintf(buf+len, size-len, "No DMAinfo?\n");
294 }
295skipit:
296 hbqe++;
297 if (len > LPFC_HBQINFO_SIZE - 54)
298 break;
299 }
300 spin_unlock_irq(&phba->hbalock);
301 return len;
302}
303
199static int 304static int
200lpfc_debugfs_dumpslim_data(struct lpfc_hba *phba, char *buf, int size) 305lpfc_debugfs_dumpslim_data(struct lpfc_hba *phba, char *buf, int size)
201{ 306{
@@ -492,6 +597,33 @@ out:
492} 597}
493 598
494static int 599static int
600lpfc_debugfs_hbqinfo_open(struct inode *inode, struct file *file)
601{
602 struct lpfc_hba *phba = inode->i_private;
603 struct lpfc_debug *debug;
604 int rc = -ENOMEM;
605
606 debug = kmalloc(sizeof(*debug), GFP_KERNEL);
607 if (!debug)
608 goto out;
609
610 /* Round to page boundry */
611 debug->buffer = kmalloc(LPFC_HBQINFO_SIZE, GFP_KERNEL);
612 if (!debug->buffer) {
613 kfree(debug);
614 goto out;
615 }
616
617 debug->len = lpfc_debugfs_hbqinfo_data(phba, debug->buffer,
618 LPFC_HBQINFO_SIZE);
619 file->private_data = debug;
620
621 rc = 0;
622out:
623 return rc;
624}
625
626static int
495lpfc_debugfs_dumpslim_open(struct inode *inode, struct file *file) 627lpfc_debugfs_dumpslim_open(struct inode *inode, struct file *file)
496{ 628{
497 struct lpfc_hba *phba = inode->i_private; 629 struct lpfc_hba *phba = inode->i_private;
@@ -604,6 +736,15 @@ static struct file_operations lpfc_debugfs_op_nodelist = {
604 .release = lpfc_debugfs_release, 736 .release = lpfc_debugfs_release,
605}; 737};
606 738
739#undef lpfc_debugfs_op_hbqinfo
740static struct file_operations lpfc_debugfs_op_hbqinfo = {
741 .owner = THIS_MODULE,
742 .open = lpfc_debugfs_hbqinfo_open,
743 .llseek = lpfc_debugfs_lseek,
744 .read = lpfc_debugfs_read,
745 .release = lpfc_debugfs_release,
746};
747
607#undef lpfc_debugfs_op_dumpslim 748#undef lpfc_debugfs_op_dumpslim
608static struct file_operations lpfc_debugfs_op_dumpslim = { 749static struct file_operations lpfc_debugfs_op_dumpslim = {
609 .owner = THIS_MODULE, 750 .owner = THIS_MODULE,
@@ -663,6 +804,18 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
663 atomic_inc(&lpfc_debugfs_hba_count); 804 atomic_inc(&lpfc_debugfs_hba_count);
664 atomic_set(&phba->debugfs_vport_count, 0); 805 atomic_set(&phba->debugfs_vport_count, 0);
665 806
807 /* Setup hbqinfo */
808 snprintf(name, sizeof(name), "hbqinfo");
809 phba->debug_hbqinfo =
810 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
811 phba->hba_debugfs_root,
812 phba, &lpfc_debugfs_op_hbqinfo);
813 if (!phba->debug_hbqinfo) {
814 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
815 "0409 Cannot create debugfs hbqinfo\n");
816 goto debug_failed;
817 }
818
666 /* Setup dumpslim */ 819 /* Setup dumpslim */
667 snprintf(name, sizeof(name), "dumpslim"); 820 snprintf(name, sizeof(name), "dumpslim");
668 phba->debug_dumpslim = 821 phba->debug_dumpslim =
@@ -819,6 +972,10 @@ lpfc_debugfs_terminate(struct lpfc_vport *vport)
819 } 972 }
820 if (atomic_read(&phba->debugfs_vport_count) == 0) { 973 if (atomic_read(&phba->debugfs_vport_count) == 0) {
821 974
975 if (phba->debug_hbqinfo) {
976 debugfs_remove(phba->debug_hbqinfo); /* hbqinfo */
977 phba->debug_hbqinfo = NULL;
978 }
822 if (phba->debug_dumpslim) { 979 if (phba->debug_dumpslim) {
823 debugfs_remove(phba->debug_dumpslim); /* dumpslim */ 980 debugfs_remove(phba->debug_dumpslim); /* dumpslim */
824 phba->debug_dumpslim = NULL; 981 phba->debug_dumpslim = NULL;
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index 55c4e5455a57..f96ab75ba637 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -990,7 +990,7 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la)
990 } 990 }
991 } else { 991 } else {
992 if (!(phba->sli3_options & LPFC_SLI3_NPIV_ENABLED)) { 992 if (!(phba->sli3_options & LPFC_SLI3_NPIV_ENABLED)) {
993 if (phba->max_vpi && phba->cfg_npiv_enable && 993 if (phba->max_vpi && phba->cfg_enable_npiv &&
994 (phba->sli_rev == 3)) 994 (phba->sli_rev == 3))
995 phba->sli3_options |= LPFC_SLI3_NPIV_ENABLED; 995 phba->sli3_options |= LPFC_SLI3_NPIV_ENABLED;
996 } 996 }
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c
index 5fa1c6f70a98..09ecdcb63a74 100644
--- a/drivers/scsi/lpfc/lpfc_mbox.c
+++ b/drivers/scsi/lpfc/lpfc_mbox.c
@@ -688,7 +688,7 @@ lpfc_config_port(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
688 if (phba->sli_rev == 3 && phba->vpd.sli3Feat.cerbm) { 688 if (phba->sli_rev == 3 && phba->vpd.sli3Feat.cerbm) {
689 mb->un.varCfgPort.cerbm = 1; /* Request HBQs */ 689 mb->un.varCfgPort.cerbm = 1; /* Request HBQs */
690 mb->un.varCfgPort.max_hbq = 1; /* Requesting 2 HBQs */ 690 mb->un.varCfgPort.max_hbq = 1; /* Requesting 2 HBQs */
691 if (phba->max_vpi && phba->cfg_npiv_enable && 691 if (phba->max_vpi && phba->cfg_enable_npiv &&
692 phba->vpd.sli3Feat.cmv) { 692 phba->vpd.sli3Feat.cmv) {
693 mb->un.varCfgPort.max_vpi = phba->max_vpi; 693 mb->un.varCfgPort.max_vpi = phba->max_vpi;
694 mb->un.varCfgPort.cmv = 1; 694 mb->un.varCfgPort.cmv = 1;
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 2da75d85de84..5417bc26f181 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -602,7 +602,7 @@ static struct lpfc_hbq_init lpfc_els_hbq = {
602 .add_count = 5, 602 .add_count = 5,
603}; 603};
604 604
605static struct lpfc_hbq_init *lpfc_hbq_defs[] = { 605struct lpfc_hbq_init *lpfc_hbq_defs[] = {
606 &lpfc_els_hbq, 606 &lpfc_els_hbq,
607}; 607};
608 608
@@ -2136,7 +2136,7 @@ lpfc_sli_chipset_init(struct lpfc_hba *phba)
2136 return 0; 2136 return 0;
2137} 2137}
2138 2138
2139static int 2139int
2140lpfc_sli_hbq_count(void) 2140lpfc_sli_hbq_count(void)
2141{ 2141{
2142 return ARRAY_SIZE(lpfc_hbq_defs); 2142 return ARRAY_SIZE(lpfc_hbq_defs);
@@ -2309,7 +2309,7 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba)
2309 2309
2310 switch (lpfc_sli_mode) { 2310 switch (lpfc_sli_mode) {
2311 case 2: 2311 case 2:
2312 if (phba->cfg_npiv_enable) { 2312 if (phba->cfg_enable_npiv) {
2313 lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT, 2313 lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT,
2314 "1824 NPIV enabled: Override lpfc_sli_mode " 2314 "1824 NPIV enabled: Override lpfc_sli_mode "
2315 "parameter (%d) to auto (0).\n", 2315 "parameter (%d) to auto (0).\n",
diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h
index a5bc79eef052..0b4e6fd02679 100644
--- a/drivers/scsi/lpfc/lpfc_version.h
+++ b/drivers/scsi/lpfc/lpfc_version.h
@@ -25,5 +25,3 @@
25#define LPFC_MODULE_DESC "Emulex LightPulse Fibre Channel SCSI driver " \ 25#define LPFC_MODULE_DESC "Emulex LightPulse Fibre Channel SCSI driver " \
26 LPFC_DRIVER_VERSION 26 LPFC_DRIVER_VERSION
27#define LPFC_COPYRIGHT "Copyright(c) 2004-2007 Emulex. All rights reserved." 27#define LPFC_COPYRIGHT "Copyright(c) 2004-2007 Emulex. All rights reserved."
28
29#define DFC_API_VERSION "0.0.0"