aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2006-12-06 10:01:18 -0500
committerDavid Howells <dhowells@warthog.cambridge.redhat.com>2006-12-06 10:01:18 -0500
commit4796b71fbb907ce6b8a9acf1852d3646a80b4576 (patch)
tree6263f165446c581efdbb760205c1f85378fe6259 /drivers/scsi/lpfc
parent6d5aefb8eaa38e44b5b8cf60c812aceafc02d924 (diff)
parentec0bf39a471bf6fcd01def2bd677128cea940b73 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts: drivers/pcmcia/ds.c Fix up merge failures with Linus's head and fix new compile failures. Signed-Off-By: David Howells <dhowells@redhat.com>
Diffstat (limited to 'drivers/scsi/lpfc')
-rw-r--r--drivers/scsi/lpfc/lpfc.h6
-rw-r--r--drivers/scsi/lpfc/lpfc_attr.c118
-rw-r--r--drivers/scsi/lpfc/lpfc_ct.c24
-rw-r--r--drivers/scsi/lpfc/lpfc_els.c34
-rw-r--r--drivers/scsi/lpfc/lpfc_hbadisc.c229
-rw-r--r--drivers/scsi/lpfc/lpfc_hw.h35
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c136
-rw-r--r--drivers/scsi/lpfc/lpfc_logmsg.h2
-rw-r--r--drivers/scsi/lpfc/lpfc_nportdisc.c9
-rw-r--r--drivers/scsi/lpfc/lpfc_scsi.c56
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c42
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.h2
-rw-r--r--drivers/scsi/lpfc/lpfc_version.h2
13 files changed, 378 insertions, 317 deletions
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index 3f7f5f8abd75..a7de0bca5bdd 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
@@ -296,13 +296,17 @@ struct lpfc_hba {
296 uint32_t cfg_cr_delay; 296 uint32_t cfg_cr_delay;
297 uint32_t cfg_cr_count; 297 uint32_t cfg_cr_count;
298 uint32_t cfg_multi_ring_support; 298 uint32_t cfg_multi_ring_support;
299 uint32_t cfg_multi_ring_rctl;
300 uint32_t cfg_multi_ring_type;
299 uint32_t cfg_fdmi_on; 301 uint32_t cfg_fdmi_on;
300 uint32_t cfg_discovery_threads; 302 uint32_t cfg_discovery_threads;
301 uint32_t cfg_max_luns; 303 uint32_t cfg_max_luns;
302 uint32_t cfg_poll; 304 uint32_t cfg_poll;
303 uint32_t cfg_poll_tmo; 305 uint32_t cfg_poll_tmo;
306 uint32_t cfg_use_msi;
304 uint32_t cfg_sg_seg_cnt; 307 uint32_t cfg_sg_seg_cnt;
305 uint32_t cfg_sg_dma_buf_size; 308 uint32_t cfg_sg_dma_buf_size;
309 uint64_t cfg_soft_wwnn;
306 uint64_t cfg_soft_wwpn; 310 uint64_t cfg_soft_wwpn;
307 311
308 uint32_t dev_loss_tmo_changed; 312 uint32_t dev_loss_tmo_changed;
@@ -355,7 +359,7 @@ struct lpfc_hba {
355#define VPD_PORT 0x8 /* valid vpd port data */ 359#define VPD_PORT 0x8 /* valid vpd port data */
356#define VPD_MASK 0xf /* mask for any vpd data */ 360#define VPD_MASK 0xf /* mask for any vpd data */
357 361
358 uint8_t soft_wwpn_enable; 362 uint8_t soft_wwn_enable;
359 363
360 struct timer_list fcp_poll_timer; 364 struct timer_list fcp_poll_timer;
361 struct timer_list els_tmofunc; 365 struct timer_list els_tmofunc;
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 2a4e02e7a392..f247e786af99 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -552,10 +552,10 @@ static CLASS_DEVICE_ATTR(board_mode, S_IRUGO | S_IWUSR,
552static CLASS_DEVICE_ATTR(issue_reset, S_IWUSR, NULL, lpfc_issue_reset); 552static CLASS_DEVICE_ATTR(issue_reset, S_IWUSR, NULL, lpfc_issue_reset);
553 553
554 554
555static char *lpfc_soft_wwpn_key = "C99G71SL8032A"; 555static char *lpfc_soft_wwn_key = "C99G71SL8032A";
556 556
557static ssize_t 557static ssize_t
558lpfc_soft_wwpn_enable_store(struct class_device *cdev, const char *buf, 558lpfc_soft_wwn_enable_store(struct class_device *cdev, const char *buf,
559 size_t count) 559 size_t count)
560{ 560{
561 struct Scsi_Host *host = class_to_shost(cdev); 561 struct Scsi_Host *host = class_to_shost(cdev);
@@ -579,15 +579,15 @@ lpfc_soft_wwpn_enable_store(struct class_device *cdev, const char *buf,
579 if (buf[cnt-1] == '\n') 579 if (buf[cnt-1] == '\n')
580 cnt--; 580 cnt--;
581 581
582 if ((cnt != strlen(lpfc_soft_wwpn_key)) || 582 if ((cnt != strlen(lpfc_soft_wwn_key)) ||
583 (strncmp(buf, lpfc_soft_wwpn_key, strlen(lpfc_soft_wwpn_key)) != 0)) 583 (strncmp(buf, lpfc_soft_wwn_key, strlen(lpfc_soft_wwn_key)) != 0))
584 return -EINVAL; 584 return -EINVAL;
585 585
586 phba->soft_wwpn_enable = 1; 586 phba->soft_wwn_enable = 1;
587 return count; 587 return count;
588} 588}
589static CLASS_DEVICE_ATTR(lpfc_soft_wwpn_enable, S_IWUSR, NULL, 589static CLASS_DEVICE_ATTR(lpfc_soft_wwn_enable, S_IWUSR, NULL,
590 lpfc_soft_wwpn_enable_store); 590 lpfc_soft_wwn_enable_store);
591 591
592static ssize_t 592static ssize_t
593lpfc_soft_wwpn_show(struct class_device *cdev, char *buf) 593lpfc_soft_wwpn_show(struct class_device *cdev, char *buf)
@@ -613,12 +613,12 @@ lpfc_soft_wwpn_store(struct class_device *cdev, const char *buf, size_t count)
613 if (buf[cnt-1] == '\n') 613 if (buf[cnt-1] == '\n')
614 cnt--; 614 cnt--;
615 615
616 if (!phba->soft_wwpn_enable || (cnt < 16) || (cnt > 18) || 616 if (!phba->soft_wwn_enable || (cnt < 16) || (cnt > 18) ||
617 ((cnt == 17) && (*buf++ != 'x')) || 617 ((cnt == 17) && (*buf++ != 'x')) ||
618 ((cnt == 18) && ((*buf++ != '0') || (*buf++ != 'x')))) 618 ((cnt == 18) && ((*buf++ != '0') || (*buf++ != 'x'))))
619 return -EINVAL; 619 return -EINVAL;
620 620
621 phba->soft_wwpn_enable = 0; 621 phba->soft_wwn_enable = 0;
622 622
623 memset(wwpn, 0, sizeof(wwpn)); 623 memset(wwpn, 0, sizeof(wwpn));
624 624
@@ -639,6 +639,8 @@ lpfc_soft_wwpn_store(struct class_device *cdev, const char *buf, size_t count)
639 } 639 }
640 phba->cfg_soft_wwpn = wwn_to_u64(wwpn); 640 phba->cfg_soft_wwpn = wwn_to_u64(wwpn);
641 fc_host_port_name(host) = phba->cfg_soft_wwpn; 641 fc_host_port_name(host) = phba->cfg_soft_wwpn;
642 if (phba->cfg_soft_wwnn)
643 fc_host_node_name(host) = phba->cfg_soft_wwnn;
642 644
643 dev_printk(KERN_NOTICE, &phba->pcidev->dev, 645 dev_printk(KERN_NOTICE, &phba->pcidev->dev,
644 "lpfc%d: Reinitializing to use soft_wwpn\n", phba->brd_no); 646 "lpfc%d: Reinitializing to use soft_wwpn\n", phba->brd_no);
@@ -664,6 +666,66 @@ lpfc_soft_wwpn_store(struct class_device *cdev, const char *buf, size_t count)
664static CLASS_DEVICE_ATTR(lpfc_soft_wwpn, S_IRUGO | S_IWUSR,\ 666static CLASS_DEVICE_ATTR(lpfc_soft_wwpn, S_IRUGO | S_IWUSR,\
665 lpfc_soft_wwpn_show, lpfc_soft_wwpn_store); 667 lpfc_soft_wwpn_show, lpfc_soft_wwpn_store);
666 668
669static ssize_t
670lpfc_soft_wwnn_show(struct class_device *cdev, char *buf)
671{
672 struct Scsi_Host *host = class_to_shost(cdev);
673 struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata;
674 return snprintf(buf, PAGE_SIZE, "0x%llx\n",
675 (unsigned long long)phba->cfg_soft_wwnn);
676}
677
678
679static ssize_t
680lpfc_soft_wwnn_store(struct class_device *cdev, const char *buf, size_t count)
681{
682 struct Scsi_Host *host = class_to_shost(cdev);
683 struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata;
684 unsigned int i, j, cnt=count;
685 u8 wwnn[8];
686
687 /* count may include a LF at end of string */
688 if (buf[cnt-1] == '\n')
689 cnt--;
690
691 if (!phba->soft_wwn_enable || (cnt < 16) || (cnt > 18) ||
692 ((cnt == 17) && (*buf++ != 'x')) ||
693 ((cnt == 18) && ((*buf++ != '0') || (*buf++ != 'x'))))
694 return -EINVAL;
695
696 /*
697 * Allow wwnn to be set many times, as long as the enable is set.
698 * However, once the wwpn is set, everything locks.
699 */
700
701 memset(wwnn, 0, sizeof(wwnn));
702
703 /* Validate and store the new name */
704 for (i=0, j=0; i < 16; i++) {
705 if ((*buf >= 'a') && (*buf <= 'f'))
706 j = ((j << 4) | ((*buf++ -'a') + 10));
707 else if ((*buf >= 'A') && (*buf <= 'F'))
708 j = ((j << 4) | ((*buf++ -'A') + 10));
709 else if ((*buf >= '0') && (*buf <= '9'))
710 j = ((j << 4) | (*buf++ -'0'));
711 else
712 return -EINVAL;
713 if (i % 2) {
714 wwnn[i/2] = j & 0xff;
715 j = 0;
716 }
717 }
718 phba->cfg_soft_wwnn = wwn_to_u64(wwnn);
719
720 dev_printk(KERN_NOTICE, &phba->pcidev->dev,
721 "lpfc%d: soft_wwnn set. Value will take effect upon "
722 "setting of the soft_wwpn\n", phba->brd_no);
723
724 return count;
725}
726static CLASS_DEVICE_ATTR(lpfc_soft_wwnn, S_IRUGO | S_IWUSR,\
727 lpfc_soft_wwnn_show, lpfc_soft_wwnn_store);
728
667 729
668static int lpfc_poll = 0; 730static int lpfc_poll = 0;
669module_param(lpfc_poll, int, 0); 731module_param(lpfc_poll, int, 0);
@@ -802,12 +864,11 @@ static CLASS_DEVICE_ATTR(lpfc_devloss_tmo, S_IRUGO | S_IWUSR,
802# LOG_MBOX 0x4 Mailbox events 864# LOG_MBOX 0x4 Mailbox events
803# LOG_INIT 0x8 Initialization events 865# LOG_INIT 0x8 Initialization events
804# LOG_LINK_EVENT 0x10 Link events 866# LOG_LINK_EVENT 0x10 Link events
805# LOG_IP 0x20 IP traffic history
806# LOG_FCP 0x40 FCP traffic history 867# LOG_FCP 0x40 FCP traffic history
807# LOG_NODE 0x80 Node table events 868# LOG_NODE 0x80 Node table events
808# LOG_MISC 0x400 Miscellaneous events 869# LOG_MISC 0x400 Miscellaneous events
809# LOG_SLI 0x800 SLI events 870# LOG_SLI 0x800 SLI events
810# LOG_CHK_COND 0x1000 FCP Check condition flag 871# LOG_FCP_ERROR 0x1000 Only log FCP errors
811# LOG_LIBDFC 0x2000 LIBDFC events 872# LOG_LIBDFC 0x2000 LIBDFC events
812# LOG_ALL_MSG 0xffff LOG all messages 873# LOG_ALL_MSG 0xffff LOG all messages
813*/ 874*/
@@ -916,6 +977,22 @@ LPFC_ATTR_R(multi_ring_support, 1, 1, 2, "Determines number of primary "
916 "SLI rings to spread IOCB entries across"); 977 "SLI rings to spread IOCB entries across");
917 978
918/* 979/*
980# lpfc_multi_ring_rctl: If lpfc_multi_ring_support is enabled, this
981# identifies what rctl value to configure the additional ring for.
982# Value range is [1,0xff]. Default value is 4 (Unsolicated Data).
983*/
984LPFC_ATTR_R(multi_ring_rctl, FC_UNSOL_DATA, 1,
985 255, "Identifies RCTL for additional ring configuration");
986
987/*
988# lpfc_multi_ring_type: If lpfc_multi_ring_support is enabled, this
989# identifies what type value to configure the additional ring for.
990# Value range is [1,0xff]. Default value is 5 (LLC/SNAP).
991*/
992LPFC_ATTR_R(multi_ring_type, FC_LLC_SNAP, 1,
993 255, "Identifies TYPE for additional ring configuration");
994
995/*
919# lpfc_fdmi_on: controls FDMI support. 996# lpfc_fdmi_on: controls FDMI support.
920# 0 = no FDMI support 997# 0 = no FDMI support
921# 1 = support FDMI without attribute of hostname 998# 1 = support FDMI without attribute of hostname
@@ -946,6 +1023,15 @@ LPFC_ATTR_R(max_luns, 255, 0, 65535,
946LPFC_ATTR_RW(poll_tmo, 10, 1, 255, 1023LPFC_ATTR_RW(poll_tmo, 10, 1, 255,
947 "Milliseconds driver will wait between polling FCP ring"); 1024 "Milliseconds driver will wait between polling FCP ring");
948 1025
1026/*
1027# lpfc_use_msi: Use MSI (Message Signaled Interrupts) in systems that
1028# support this feature
1029# 0 = MSI disabled (default)
1030# 1 = MSI enabled
1031# Value range is [0,1]. Default value is 0.
1032*/
1033LPFC_ATTR_R(use_msi, 0, 0, 1, "Use Message Signaled Interrupts, if possible");
1034
949 1035
950struct class_device_attribute *lpfc_host_attrs[] = { 1036struct class_device_attribute *lpfc_host_attrs[] = {
951 &class_device_attr_info, 1037 &class_device_attr_info,
@@ -974,6 +1060,8 @@ struct class_device_attribute *lpfc_host_attrs[] = {
974 &class_device_attr_lpfc_cr_delay, 1060 &class_device_attr_lpfc_cr_delay,
975 &class_device_attr_lpfc_cr_count, 1061 &class_device_attr_lpfc_cr_count,
976 &class_device_attr_lpfc_multi_ring_support, 1062 &class_device_attr_lpfc_multi_ring_support,
1063 &class_device_attr_lpfc_multi_ring_rctl,
1064 &class_device_attr_lpfc_multi_ring_type,
977 &class_device_attr_lpfc_fdmi_on, 1065 &class_device_attr_lpfc_fdmi_on,
978 &class_device_attr_lpfc_max_luns, 1066 &class_device_attr_lpfc_max_luns,
979 &class_device_attr_nport_evt_cnt, 1067 &class_device_attr_nport_evt_cnt,
@@ -982,8 +1070,10 @@ struct class_device_attribute *lpfc_host_attrs[] = {
982 &class_device_attr_issue_reset, 1070 &class_device_attr_issue_reset,
983 &class_device_attr_lpfc_poll, 1071 &class_device_attr_lpfc_poll,
984 &class_device_attr_lpfc_poll_tmo, 1072 &class_device_attr_lpfc_poll_tmo,
1073 &class_device_attr_lpfc_use_msi,
1074 &class_device_attr_lpfc_soft_wwnn,
985 &class_device_attr_lpfc_soft_wwpn, 1075 &class_device_attr_lpfc_soft_wwpn,
986 &class_device_attr_lpfc_soft_wwpn_enable, 1076 &class_device_attr_lpfc_soft_wwn_enable,
987 NULL, 1077 NULL,
988}; 1078};
989 1079
@@ -1771,6 +1861,8 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
1771 lpfc_cr_delay_init(phba, lpfc_cr_delay); 1861 lpfc_cr_delay_init(phba, lpfc_cr_delay);
1772 lpfc_cr_count_init(phba, lpfc_cr_count); 1862 lpfc_cr_count_init(phba, lpfc_cr_count);
1773 lpfc_multi_ring_support_init(phba, lpfc_multi_ring_support); 1863 lpfc_multi_ring_support_init(phba, lpfc_multi_ring_support);
1864 lpfc_multi_ring_rctl_init(phba, lpfc_multi_ring_rctl);
1865 lpfc_multi_ring_type_init(phba, lpfc_multi_ring_type);
1774 lpfc_lun_queue_depth_init(phba, lpfc_lun_queue_depth); 1866 lpfc_lun_queue_depth_init(phba, lpfc_lun_queue_depth);
1775 lpfc_fcp_class_init(phba, lpfc_fcp_class); 1867 lpfc_fcp_class_init(phba, lpfc_fcp_class);
1776 lpfc_use_adisc_init(phba, lpfc_use_adisc); 1868 lpfc_use_adisc_init(phba, lpfc_use_adisc);
@@ -1782,9 +1874,11 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
1782 lpfc_discovery_threads_init(phba, lpfc_discovery_threads); 1874 lpfc_discovery_threads_init(phba, lpfc_discovery_threads);
1783 lpfc_max_luns_init(phba, lpfc_max_luns); 1875 lpfc_max_luns_init(phba, lpfc_max_luns);
1784 lpfc_poll_tmo_init(phba, lpfc_poll_tmo); 1876 lpfc_poll_tmo_init(phba, lpfc_poll_tmo);
1877 lpfc_use_msi_init(phba, lpfc_use_msi);
1785 lpfc_devloss_tmo_init(phba, lpfc_devloss_tmo); 1878 lpfc_devloss_tmo_init(phba, lpfc_devloss_tmo);
1786 lpfc_nodev_tmo_init(phba, lpfc_nodev_tmo); 1879 lpfc_nodev_tmo_init(phba, lpfc_nodev_tmo);
1787 phba->cfg_poll = lpfc_poll; 1880 phba->cfg_poll = lpfc_poll;
1881 phba->cfg_soft_wwnn = 0L;
1788 phba->cfg_soft_wwpn = 0L; 1882 phba->cfg_soft_wwpn = 0L;
1789 1883
1790 /* 1884 /*
diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c
index 3add7c237859..a51a41b7f15d 100644
--- a/drivers/scsi/lpfc/lpfc_ct.c
+++ b/drivers/scsi/lpfc/lpfc_ct.c
@@ -558,6 +558,14 @@ lpfc_cmpl_ct_cmd_rsnn_nn(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
558 return; 558 return;
559} 559}
560 560
561static void
562lpfc_cmpl_ct_cmd_rff_id(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
563 struct lpfc_iocbq * rspiocb)
564{
565 lpfc_cmpl_ct_cmd_rft_id(phba, cmdiocb, rspiocb);
566 return;
567}
568
561void 569void
562lpfc_get_hba_sym_node_name(struct lpfc_hba * phba, uint8_t * symbp) 570lpfc_get_hba_sym_node_name(struct lpfc_hba * phba, uint8_t * symbp)
563{ 571{
@@ -629,6 +637,8 @@ lpfc_ns_cmd(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, int cmdcode)
629 bpl->tus.f.bdeSize = RNN_REQUEST_SZ; 637 bpl->tus.f.bdeSize = RNN_REQUEST_SZ;
630 else if (cmdcode == SLI_CTNS_RSNN_NN) 638 else if (cmdcode == SLI_CTNS_RSNN_NN)
631 bpl->tus.f.bdeSize = RSNN_REQUEST_SZ; 639 bpl->tus.f.bdeSize = RSNN_REQUEST_SZ;
640 else if (cmdcode == SLI_CTNS_RFF_ID)
641 bpl->tus.f.bdeSize = RFF_REQUEST_SZ;
632 else 642 else
633 bpl->tus.f.bdeSize = 0; 643 bpl->tus.f.bdeSize = 0;
634 bpl->tus.w = le32_to_cpu(bpl->tus.w); 644 bpl->tus.w = le32_to_cpu(bpl->tus.w);
@@ -660,6 +670,17 @@ lpfc_ns_cmd(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, int cmdcode)
660 cmpl = lpfc_cmpl_ct_cmd_rft_id; 670 cmpl = lpfc_cmpl_ct_cmd_rft_id;
661 break; 671 break;
662 672
673 case SLI_CTNS_RFF_ID:
674 CtReq->CommandResponse.bits.CmdRsp =
675 be16_to_cpu(SLI_CTNS_RFF_ID);
676 CtReq->un.rff.PortId = be32_to_cpu(phba->fc_myDID);
677 CtReq->un.rff.feature_res = 0;
678 CtReq->un.rff.feature_tgt = 0;
679 CtReq->un.rff.type_code = FC_FCP_DATA;
680 CtReq->un.rff.feature_init = 1;
681 cmpl = lpfc_cmpl_ct_cmd_rff_id;
682 break;
683
663 case SLI_CTNS_RNN_ID: 684 case SLI_CTNS_RNN_ID:
664 CtReq->CommandResponse.bits.CmdRsp = 685 CtReq->CommandResponse.bits.CmdRsp =
665 be16_to_cpu(SLI_CTNS_RNN_ID); 686 be16_to_cpu(SLI_CTNS_RNN_ID);
@@ -934,7 +955,8 @@ lpfc_fdmi_cmd(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, int cmdcode)
934 ae = (ATTRIBUTE_ENTRY *) ((uint8_t *) rh + size); 955 ae = (ATTRIBUTE_ENTRY *) ((uint8_t *) rh + size);
935 ae->ad.bits.AttrType = be16_to_cpu(OS_NAME_VERSION); 956 ae->ad.bits.AttrType = be16_to_cpu(OS_NAME_VERSION);
936 sprintf(ae->un.OsNameVersion, "%s %s %s", 957 sprintf(ae->un.OsNameVersion, "%s %s %s",
937 init_utsname()->sysname, init_utsname()->release, 958 init_utsname()->sysname,
959 init_utsname()->release,
938 init_utsname()->version); 960 init_utsname()->version);
939 len = strlen(ae->un.OsNameVersion); 961 len = strlen(ae->un.OsNameVersion);
940 len += (len & 3) ? (4 - (len & 3)) : 4; 962 len += (len & 3) ? (4 - (len & 3)) : 4;
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 71864cdc6c71..a5f33a0dd4e7 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -243,6 +243,7 @@ lpfc_cmpl_els_flogi_fabric(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp,
243 struct serv_parm *sp, IOCB_t *irsp) 243 struct serv_parm *sp, IOCB_t *irsp)
244{ 244{
245 LPFC_MBOXQ_t *mbox; 245 LPFC_MBOXQ_t *mbox;
246 struct lpfc_dmabuf *mp;
246 int rc; 247 int rc;
247 248
248 spin_lock_irq(phba->host->host_lock); 249 spin_lock_irq(phba->host->host_lock);
@@ -307,10 +308,14 @@ lpfc_cmpl_els_flogi_fabric(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp,
307 308
308 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT | MBX_STOP_IOCB); 309 rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT | MBX_STOP_IOCB);
309 if (rc == MBX_NOT_FINISHED) 310 if (rc == MBX_NOT_FINISHED)
310 goto fail_free_mbox; 311 goto fail_issue_reg_login;
311 312
312 return 0; 313 return 0;
313 314
315 fail_issue_reg_login:
316 mp = (struct lpfc_dmabuf *) mbox->context1;
317 lpfc_mbuf_free(phba, mp->virt, mp->phys);
318 kfree(mp);
314 fail_free_mbox: 319 fail_free_mbox:
315 mempool_free(mbox, phba->mbox_mem_pool); 320 mempool_free(mbox, phba->mbox_mem_pool);
316 fail: 321 fail:
@@ -657,6 +662,12 @@ lpfc_plogi_confirm_nport(struct lpfc_hba * phba, struct lpfc_dmabuf *prsp,
657 uint8_t name[sizeof (struct lpfc_name)]; 662 uint8_t name[sizeof (struct lpfc_name)];
658 uint32_t rc; 663 uint32_t rc;
659 664
665 /* Fabric nodes can have the same WWPN so we don't bother searching
666 * by WWPN. Just return the ndlp that was given to us.
667 */
668 if (ndlp->nlp_type & NLP_FABRIC)
669 return ndlp;
670
660 lp = (uint32_t *) prsp->virt; 671 lp = (uint32_t *) prsp->virt;
661 sp = (struct serv_parm *) ((uint8_t *) lp + sizeof (uint32_t)); 672 sp = (struct serv_parm *) ((uint8_t *) lp + sizeof (uint32_t));
662 memset(name, 0, sizeof (struct lpfc_name)); 673 memset(name, 0, sizeof (struct lpfc_name));
@@ -1122,7 +1133,7 @@ lpfc_cmpl_els_adisc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
1122 mempool_free(mbox, 1133 mempool_free(mbox,
1123 phba->mbox_mem_pool); 1134 phba->mbox_mem_pool);
1124 lpfc_disc_flush_list(phba); 1135 lpfc_disc_flush_list(phba);
1125 psli->ring[(psli->ip_ring)]. 1136 psli->ring[(psli->extra_ring)].
1126 flag &= 1137 flag &=
1127 ~LPFC_STOP_IOCB_EVENT; 1138 ~LPFC_STOP_IOCB_EVENT;
1128 psli->ring[(psli->fcp_ring)]. 1139 psli->ring[(psli->fcp_ring)].
@@ -1851,6 +1862,7 @@ lpfc_cmpl_els_acc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
1851 IOCB_t *irsp; 1862 IOCB_t *irsp;
1852 struct lpfc_nodelist *ndlp; 1863 struct lpfc_nodelist *ndlp;
1853 LPFC_MBOXQ_t *mbox = NULL; 1864 LPFC_MBOXQ_t *mbox = NULL;
1865 struct lpfc_dmabuf *mp;
1854 1866
1855 irsp = &rspiocb->iocb; 1867 irsp = &rspiocb->iocb;
1856 1868
@@ -1862,6 +1874,11 @@ lpfc_cmpl_els_acc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
1862 /* Check to see if link went down during discovery */ 1874 /* Check to see if link went down during discovery */
1863 if ((lpfc_els_chk_latt(phba)) || !ndlp) { 1875 if ((lpfc_els_chk_latt(phba)) || !ndlp) {
1864 if (mbox) { 1876 if (mbox) {
1877 mp = (struct lpfc_dmabuf *) mbox->context1;
1878 if (mp) {
1879 lpfc_mbuf_free(phba, mp->virt, mp->phys);
1880 kfree(mp);
1881 }
1865 mempool_free( mbox, phba->mbox_mem_pool); 1882 mempool_free( mbox, phba->mbox_mem_pool);
1866 } 1883 }
1867 goto out; 1884 goto out;
@@ -1893,9 +1910,7 @@ lpfc_cmpl_els_acc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
1893 } 1910 }
1894 /* NOTE: we should have messages for unsuccessful 1911 /* NOTE: we should have messages for unsuccessful
1895 reglogin */ 1912 reglogin */
1896 mempool_free( mbox, phba->mbox_mem_pool);
1897 } else { 1913 } else {
1898 mempool_free( mbox, phba->mbox_mem_pool);
1899 /* Do not call NO_LIST for lpfc_els_abort'ed ELS cmds */ 1914 /* Do not call NO_LIST for lpfc_els_abort'ed ELS cmds */
1900 if (!((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) && 1915 if (!((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) &&
1901 ((irsp->un.ulpWord[4] == IOERR_SLI_ABORTED) || 1916 ((irsp->un.ulpWord[4] == IOERR_SLI_ABORTED) ||
@@ -1907,6 +1922,12 @@ lpfc_cmpl_els_acc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
1907 } 1922 }
1908 } 1923 }
1909 } 1924 }
1925 mp = (struct lpfc_dmabuf *) mbox->context1;
1926 if (mp) {
1927 lpfc_mbuf_free(phba, mp->virt, mp->phys);
1928 kfree(mp);
1929 }
1930 mempool_free(mbox, phba->mbox_mem_pool);
1910 } 1931 }
1911out: 1932out:
1912 if (ndlp) { 1933 if (ndlp) {
@@ -2644,6 +2665,7 @@ lpfc_els_handle_rscn(struct lpfc_hba * phba)
2644 ndlp->nlp_type |= NLP_FABRIC; 2665 ndlp->nlp_type |= NLP_FABRIC;
2645 ndlp->nlp_prev_state = ndlp->nlp_state; 2666 ndlp->nlp_prev_state = ndlp->nlp_state;
2646 ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; 2667 ndlp->nlp_state = NLP_STE_PLOGI_ISSUE;
2668 lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST);
2647 lpfc_issue_els_plogi(phba, NameServer_DID, 0); 2669 lpfc_issue_els_plogi(phba, NameServer_DID, 0);
2648 /* Wait for NameServer login cmpl before we can 2670 /* Wait for NameServer login cmpl before we can
2649 continue */ 2671 continue */
@@ -3039,7 +3061,7 @@ lpfc_els_rcv_farp(struct lpfc_hba * phba,
3039 /* FARP-REQ received from DID <did> */ 3061 /* FARP-REQ received from DID <did> */
3040 lpfc_printf_log(phba, 3062 lpfc_printf_log(phba,
3041 KERN_INFO, 3063 KERN_INFO,
3042 LOG_IP, 3064 LOG_ELS,
3043 "%d:0601 FARP-REQ received from DID x%x\n", 3065 "%d:0601 FARP-REQ received from DID x%x\n",
3044 phba->brd_no, did); 3066 phba->brd_no, did);
3045 3067
@@ -3101,7 +3123,7 @@ lpfc_els_rcv_farpr(struct lpfc_hba * phba,
3101 /* FARP-RSP received from DID <did> */ 3123 /* FARP-RSP received from DID <did> */
3102 lpfc_printf_log(phba, 3124 lpfc_printf_log(phba,
3103 KERN_INFO, 3125 KERN_INFO,
3104 LOG_IP, 3126 LOG_ELS,
3105 "%d:0600 FARP-RSP received from DID x%x\n", 3127 "%d:0600 FARP-RSP received from DID x%x\n",
3106 phba->brd_no, did); 3128 phba->brd_no, did);
3107 3129
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index 19c79a0549a7..c39564e85e94 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -525,7 +525,7 @@ lpfc_mbx_cmpl_clear_la(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
525 psli = &phba->sli; 525 psli = &phba->sli;
526 mb = &pmb->mb; 526 mb = &pmb->mb;
527 /* Since we don't do discovery right now, turn these off here */ 527 /* Since we don't do discovery right now, turn these off here */
528 psli->ring[psli->ip_ring].flag &= ~LPFC_STOP_IOCB_EVENT; 528 psli->ring[psli->extra_ring].flag &= ~LPFC_STOP_IOCB_EVENT;
529 psli->ring[psli->fcp_ring].flag &= ~LPFC_STOP_IOCB_EVENT; 529 psli->ring[psli->fcp_ring].flag &= ~LPFC_STOP_IOCB_EVENT;
530 psli->ring[psli->next_ring].flag &= ~LPFC_STOP_IOCB_EVENT; 530 psli->ring[psli->next_ring].flag &= ~LPFC_STOP_IOCB_EVENT;
531 531
@@ -641,7 +641,7 @@ out:
641 if (rc == MBX_NOT_FINISHED) { 641 if (rc == MBX_NOT_FINISHED) {
642 mempool_free(pmb, phba->mbox_mem_pool); 642 mempool_free(pmb, phba->mbox_mem_pool);
643 lpfc_disc_flush_list(phba); 643 lpfc_disc_flush_list(phba);
644 psli->ring[(psli->ip_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; 644 psli->ring[(psli->extra_ring)].flag &= ~LPFC_STOP_IOCB_EVENT;
645 psli->ring[(psli->fcp_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; 645 psli->ring[(psli->fcp_ring)].flag &= ~LPFC_STOP_IOCB_EVENT;
646 psli->ring[(psli->next_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; 646 psli->ring[(psli->next_ring)].flag &= ~LPFC_STOP_IOCB_EVENT;
647 phba->hba_state = LPFC_HBA_READY; 647 phba->hba_state = LPFC_HBA_READY;
@@ -672,6 +672,8 @@ lpfc_mbx_cmpl_read_sparam(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
672 672
673 memcpy((uint8_t *) & phba->fc_sparam, (uint8_t *) mp->virt, 673 memcpy((uint8_t *) & phba->fc_sparam, (uint8_t *) mp->virt,
674 sizeof (struct serv_parm)); 674 sizeof (struct serv_parm));
675 if (phba->cfg_soft_wwnn)
676 u64_to_wwn(phba->cfg_soft_wwnn, phba->fc_sparam.nodeName.u.wwn);
675 if (phba->cfg_soft_wwpn) 677 if (phba->cfg_soft_wwpn)
676 u64_to_wwn(phba->cfg_soft_wwpn, phba->fc_sparam.portName.u.wwn); 678 u64_to_wwn(phba->cfg_soft_wwpn, phba->fc_sparam.portName.u.wwn);
677 memcpy((uint8_t *) & phba->fc_nodename, 679 memcpy((uint8_t *) & phba->fc_nodename,
@@ -696,7 +698,7 @@ out:
696 == MBX_NOT_FINISHED) { 698 == MBX_NOT_FINISHED) {
697 mempool_free( pmb, phba->mbox_mem_pool); 699 mempool_free( pmb, phba->mbox_mem_pool);
698 lpfc_disc_flush_list(phba); 700 lpfc_disc_flush_list(phba);
699 psli->ring[(psli->ip_ring)].flag &= 701 psli->ring[(psli->extra_ring)].flag &=
700 ~LPFC_STOP_IOCB_EVENT; 702 ~LPFC_STOP_IOCB_EVENT;
701 psli->ring[(psli->fcp_ring)].flag &= 703 psli->ring[(psli->fcp_ring)].flag &=
702 ~LPFC_STOP_IOCB_EVENT; 704 ~LPFC_STOP_IOCB_EVENT;
@@ -715,6 +717,9 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la)
715{ 717{
716 int i; 718 int i;
717 LPFC_MBOXQ_t *sparam_mbox, *cfglink_mbox; 719 LPFC_MBOXQ_t *sparam_mbox, *cfglink_mbox;
720 struct lpfc_dmabuf *mp;
721 int rc;
722
718 sparam_mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); 723 sparam_mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
719 cfglink_mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); 724 cfglink_mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
720 725
@@ -793,16 +798,27 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la)
793 if (sparam_mbox) { 798 if (sparam_mbox) {
794 lpfc_read_sparam(phba, sparam_mbox); 799 lpfc_read_sparam(phba, sparam_mbox);
795 sparam_mbox->mbox_cmpl = lpfc_mbx_cmpl_read_sparam; 800 sparam_mbox->mbox_cmpl = lpfc_mbx_cmpl_read_sparam;
796 lpfc_sli_issue_mbox(phba, sparam_mbox, 801 rc = lpfc_sli_issue_mbox(phba, sparam_mbox,
797 (MBX_NOWAIT | MBX_STOP_IOCB)); 802 (MBX_NOWAIT | MBX_STOP_IOCB));
803 if (rc == MBX_NOT_FINISHED) {
804 mp = (struct lpfc_dmabuf *) sparam_mbox->context1;
805 lpfc_mbuf_free(phba, mp->virt, mp->phys);
806 kfree(mp);
807 mempool_free(sparam_mbox, phba->mbox_mem_pool);
808 if (cfglink_mbox)
809 mempool_free(cfglink_mbox, phba->mbox_mem_pool);
810 return;
811 }
798 } 812 }
799 813
800 if (cfglink_mbox) { 814 if (cfglink_mbox) {
801 phba->hba_state = LPFC_LOCAL_CFG_LINK; 815 phba->hba_state = LPFC_LOCAL_CFG_LINK;
802 lpfc_config_link(phba, cfglink_mbox); 816 lpfc_config_link(phba, cfglink_mbox);
803 cfglink_mbox->mbox_cmpl = lpfc_mbx_cmpl_local_config_link; 817 cfglink_mbox->mbox_cmpl = lpfc_mbx_cmpl_local_config_link;
804 lpfc_sli_issue_mbox(phba, cfglink_mbox, 818 rc = lpfc_sli_issue_mbox(phba, cfglink_mbox,
805 (MBX_NOWAIT | MBX_STOP_IOCB)); 819 (MBX_NOWAIT | MBX_STOP_IOCB));
820 if (rc == MBX_NOT_FINISHED)
821 mempool_free(cfglink_mbox, phba->mbox_mem_pool);
806 } 822 }
807} 823}
808 824
@@ -1067,6 +1083,7 @@ lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
1067 lpfc_ns_cmd(phba, ndlp, SLI_CTNS_RNN_ID); 1083 lpfc_ns_cmd(phba, ndlp, SLI_CTNS_RNN_ID);
1068 lpfc_ns_cmd(phba, ndlp, SLI_CTNS_RSNN_NN); 1084 lpfc_ns_cmd(phba, ndlp, SLI_CTNS_RSNN_NN);
1069 lpfc_ns_cmd(phba, ndlp, SLI_CTNS_RFT_ID); 1085 lpfc_ns_cmd(phba, ndlp, SLI_CTNS_RFT_ID);
1086 lpfc_ns_cmd(phba, ndlp, SLI_CTNS_RFF_ID);
1070 } 1087 }
1071 1088
1072 phba->fc_ns_retry = 0; 1089 phba->fc_ns_retry = 0;
@@ -1423,7 +1440,7 @@ lpfc_check_sli_ndlp(struct lpfc_hba * phba,
1423 if (iocb->context1 == (uint8_t *) ndlp) 1440 if (iocb->context1 == (uint8_t *) ndlp)
1424 return 1; 1441 return 1;
1425 } 1442 }
1426 } else if (pring->ringno == psli->ip_ring) { 1443 } else if (pring->ringno == psli->extra_ring) {
1427 1444
1428 } else if (pring->ringno == psli->fcp_ring) { 1445 } else if (pring->ringno == psli->fcp_ring) {
1429 /* Skip match check if waiting to relogin to FCP target */ 1446 /* Skip match check if waiting to relogin to FCP target */
@@ -1680,112 +1697,38 @@ lpfc_matchdid(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp, uint32_t did)
1680struct lpfc_nodelist * 1697struct lpfc_nodelist *
1681lpfc_findnode_did(struct lpfc_hba * phba, uint32_t order, uint32_t did) 1698lpfc_findnode_did(struct lpfc_hba * phba, uint32_t order, uint32_t did)
1682{ 1699{
1683 struct lpfc_nodelist *ndlp, *next_ndlp; 1700 struct lpfc_nodelist *ndlp;
1701 struct list_head *lists[]={&phba->fc_nlpunmap_list,
1702 &phba->fc_nlpmap_list,
1703 &phba->fc_plogi_list,
1704 &phba->fc_adisc_list,
1705 &phba->fc_reglogin_list,
1706 &phba->fc_prli_list,
1707 &phba->fc_npr_list,
1708 &phba->fc_unused_list};
1709 uint32_t search[]={NLP_SEARCH_UNMAPPED,
1710 NLP_SEARCH_MAPPED,
1711 NLP_SEARCH_PLOGI,
1712 NLP_SEARCH_ADISC,
1713 NLP_SEARCH_REGLOGIN,
1714 NLP_SEARCH_PRLI,
1715 NLP_SEARCH_NPR,
1716 NLP_SEARCH_UNUSED};
1717 int i;
1684 uint32_t data1; 1718 uint32_t data1;
1685 1719
1686 spin_lock_irq(phba->host->host_lock); 1720 spin_lock_irq(phba->host->host_lock);
1687 if (order & NLP_SEARCH_UNMAPPED) { 1721 for (i = 0; i < ARRAY_SIZE(lists); i++ ) {
1688 list_for_each_entry_safe(ndlp, next_ndlp, 1722 if (!(order & search[i]))
1689 &phba->fc_nlpunmap_list, nlp_listp) { 1723 continue;
1690 if (lpfc_matchdid(phba, ndlp, did)) { 1724 list_for_each_entry(ndlp, lists[i], nlp_listp) {
1691 data1 = (((uint32_t) ndlp->nlp_state << 24) |
1692 ((uint32_t) ndlp->nlp_xri << 16) |
1693 ((uint32_t) ndlp->nlp_type << 8) |
1694 ((uint32_t) ndlp->nlp_rpi & 0xff));
1695 /* FIND node DID unmapped */
1696 lpfc_printf_log(phba, KERN_INFO, LOG_NODE,
1697 "%d:0929 FIND node DID unmapped"
1698 " Data: x%p x%x x%x x%x\n",
1699 phba->brd_no,
1700 ndlp, ndlp->nlp_DID,
1701 ndlp->nlp_flag, data1);
1702 spin_unlock_irq(phba->host->host_lock);
1703 return ndlp;
1704 }
1705 }
1706 }
1707
1708 if (order & NLP_SEARCH_MAPPED) {
1709 list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_nlpmap_list,
1710 nlp_listp) {
1711 if (lpfc_matchdid(phba, ndlp, did)) {
1712
1713 data1 = (((uint32_t) ndlp->nlp_state << 24) |
1714 ((uint32_t) ndlp->nlp_xri << 16) |
1715 ((uint32_t) ndlp->nlp_type << 8) |
1716 ((uint32_t) ndlp->nlp_rpi & 0xff));
1717 /* FIND node DID mapped */
1718 lpfc_printf_log(phba, KERN_INFO, LOG_NODE,
1719 "%d:0930 FIND node DID mapped "
1720 "Data: x%p x%x x%x x%x\n",
1721 phba->brd_no,
1722 ndlp, ndlp->nlp_DID,
1723 ndlp->nlp_flag, data1);
1724 spin_unlock_irq(phba->host->host_lock);
1725 return ndlp;
1726 }
1727 }
1728 }
1729
1730 if (order & NLP_SEARCH_PLOGI) {
1731 list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_plogi_list,
1732 nlp_listp) {
1733 if (lpfc_matchdid(phba, ndlp, did)) {
1734
1735 data1 = (((uint32_t) ndlp->nlp_state << 24) |
1736 ((uint32_t) ndlp->nlp_xri << 16) |
1737 ((uint32_t) ndlp->nlp_type << 8) |
1738 ((uint32_t) ndlp->nlp_rpi & 0xff));
1739 /* LOG change to PLOGI */
1740 /* FIND node DID plogi */
1741 lpfc_printf_log(phba, KERN_INFO, LOG_NODE,
1742 "%d:0908 FIND node DID plogi "
1743 "Data: x%p x%x x%x x%x\n",
1744 phba->brd_no,
1745 ndlp, ndlp->nlp_DID,
1746 ndlp->nlp_flag, data1);
1747 spin_unlock_irq(phba->host->host_lock);
1748 return ndlp;
1749 }
1750 }
1751 }
1752
1753 if (order & NLP_SEARCH_ADISC) {
1754 list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_adisc_list,
1755 nlp_listp) {
1756 if (lpfc_matchdid(phba, ndlp, did)) {
1757
1758 data1 = (((uint32_t) ndlp->nlp_state << 24) |
1759 ((uint32_t) ndlp->nlp_xri << 16) |
1760 ((uint32_t) ndlp->nlp_type << 8) |
1761 ((uint32_t) ndlp->nlp_rpi & 0xff));
1762 /* LOG change to ADISC */
1763 /* FIND node DID adisc */
1764 lpfc_printf_log(phba, KERN_INFO, LOG_NODE,
1765 "%d:0931 FIND node DID adisc "
1766 "Data: x%p x%x x%x x%x\n",
1767 phba->brd_no,
1768 ndlp, ndlp->nlp_DID,
1769 ndlp->nlp_flag, data1);
1770 spin_unlock_irq(phba->host->host_lock);
1771 return ndlp;
1772 }
1773 }
1774 }
1775
1776 if (order & NLP_SEARCH_REGLOGIN) {
1777 list_for_each_entry_safe(ndlp, next_ndlp,
1778 &phba->fc_reglogin_list, nlp_listp) {
1779 if (lpfc_matchdid(phba, ndlp, did)) { 1725 if (lpfc_matchdid(phba, ndlp, did)) {
1780
1781 data1 = (((uint32_t) ndlp->nlp_state << 24) | 1726 data1 = (((uint32_t) ndlp->nlp_state << 24) |
1782 ((uint32_t) ndlp->nlp_xri << 16) | 1727 ((uint32_t) ndlp->nlp_xri << 16) |
1783 ((uint32_t) ndlp->nlp_type << 8) | 1728 ((uint32_t) ndlp->nlp_type << 8) |
1784 ((uint32_t) ndlp->nlp_rpi & 0xff)); 1729 ((uint32_t) ndlp->nlp_rpi & 0xff));
1785 /* LOG change to REGLOGIN */
1786 /* FIND node DID reglogin */
1787 lpfc_printf_log(phba, KERN_INFO, LOG_NODE, 1730 lpfc_printf_log(phba, KERN_INFO, LOG_NODE,
1788 "%d:0901 FIND node DID reglogin" 1731 "%d:0929 FIND node DID "
1789 " Data: x%p x%x x%x x%x\n", 1732 " Data: x%p x%x x%x x%x\n",
1790 phba->brd_no, 1733 phba->brd_no,
1791 ndlp, ndlp->nlp_DID, 1734 ndlp, ndlp->nlp_DID,
@@ -1795,86 +1738,12 @@ lpfc_findnode_did(struct lpfc_hba * phba, uint32_t order, uint32_t did)
1795 } 1738 }
1796 } 1739 }
1797 } 1740 }
1798
1799 if (order & NLP_SEARCH_PRLI) {
1800 list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_prli_list,
1801 nlp_listp) {
1802 if (lpfc_matchdid(phba, ndlp, did)) {
1803
1804 data1 = (((uint32_t) ndlp->nlp_state << 24) |
1805 ((uint32_t) ndlp->nlp_xri << 16) |
1806 ((uint32_t) ndlp->nlp_type << 8) |
1807 ((uint32_t) ndlp->nlp_rpi & 0xff));
1808 /* LOG change to PRLI */
1809 /* FIND node DID prli */
1810 lpfc_printf_log(phba, KERN_INFO, LOG_NODE,
1811 "%d:0902 FIND node DID prli "
1812 "Data: x%p x%x x%x x%x\n",
1813 phba->brd_no,
1814 ndlp, ndlp->nlp_DID,
1815 ndlp->nlp_flag, data1);
1816 spin_unlock_irq(phba->host->host_lock);
1817 return ndlp;
1818 }
1819 }
1820 }
1821
1822 if (order & NLP_SEARCH_NPR) {
1823 list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_npr_list,
1824 nlp_listp) {
1825 if (lpfc_matchdid(phba, ndlp, did)) {
1826
1827 data1 = (((uint32_t) ndlp->nlp_state << 24) |
1828 ((uint32_t) ndlp->nlp_xri << 16) |
1829 ((uint32_t) ndlp->nlp_type << 8) |
1830 ((uint32_t) ndlp->nlp_rpi & 0xff));
1831 /* LOG change to NPR */
1832 /* FIND node DID npr */
1833 lpfc_printf_log(phba, KERN_INFO, LOG_NODE,
1834 "%d:0903 FIND node DID npr "
1835 "Data: x%p x%x x%x x%x\n",
1836 phba->brd_no,
1837 ndlp, ndlp->nlp_DID,
1838 ndlp->nlp_flag, data1);
1839 spin_unlock_irq(phba->host->host_lock);
1840 return ndlp;
1841 }
1842 }
1843 }
1844
1845 if (order & NLP_SEARCH_UNUSED) {
1846 list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_adisc_list,
1847 nlp_listp) {
1848 if (lpfc_matchdid(phba, ndlp, did)) {
1849
1850 data1 = (((uint32_t) ndlp->nlp_state << 24) |
1851 ((uint32_t) ndlp->nlp_xri << 16) |
1852 ((uint32_t) ndlp->nlp_type << 8) |
1853 ((uint32_t) ndlp->nlp_rpi & 0xff));
1854 /* LOG change to UNUSED */
1855 /* FIND node DID unused */
1856 lpfc_printf_log(phba, KERN_INFO, LOG_NODE,
1857 "%d:0905 FIND node DID unused "
1858 "Data: x%p x%x x%x x%x\n",
1859 phba->brd_no,
1860 ndlp, ndlp->nlp_DID,
1861 ndlp->nlp_flag, data1);
1862 spin_unlock_irq(phba->host->host_lock);
1863 return ndlp;
1864 }
1865 }
1866 }
1867
1868 spin_unlock_irq(phba->host->host_lock); 1741 spin_unlock_irq(phba->host->host_lock);
1869 1742
1870 /* FIND node did <did> NOT FOUND */ 1743 /* FIND node did <did> NOT FOUND */
1871 lpfc_printf_log(phba, 1744 lpfc_printf_log(phba, KERN_INFO, LOG_NODE,
1872 KERN_INFO,
1873 LOG_NODE,
1874 "%d:0932 FIND node did x%x NOT FOUND Data: x%x\n", 1745 "%d:0932 FIND node did x%x NOT FOUND Data: x%x\n",
1875 phba->brd_no, did, order); 1746 phba->brd_no, did, order);
1876
1877 /* no match found */
1878 return NULL; 1747 return NULL;
1879} 1748}
1880 1749
@@ -2036,7 +1905,7 @@ lpfc_disc_start(struct lpfc_hba * phba)
2036 if (rc == MBX_NOT_FINISHED) { 1905 if (rc == MBX_NOT_FINISHED) {
2037 mempool_free( mbox, phba->mbox_mem_pool); 1906 mempool_free( mbox, phba->mbox_mem_pool);
2038 lpfc_disc_flush_list(phba); 1907 lpfc_disc_flush_list(phba);
2039 psli->ring[(psli->ip_ring)].flag &= 1908 psli->ring[(psli->extra_ring)].flag &=
2040 ~LPFC_STOP_IOCB_EVENT; 1909 ~LPFC_STOP_IOCB_EVENT;
2041 psli->ring[(psli->fcp_ring)].flag &= 1910 psli->ring[(psli->fcp_ring)].flag &=
2042 ~LPFC_STOP_IOCB_EVENT; 1911 ~LPFC_STOP_IOCB_EVENT;
@@ -2415,7 +2284,7 @@ lpfc_disc_timeout_handler(struct lpfc_hba *phba)
2415 2284
2416 if (clrlaerr) { 2285 if (clrlaerr) {
2417 lpfc_disc_flush_list(phba); 2286 lpfc_disc_flush_list(phba);
2418 psli->ring[(psli->ip_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; 2287 psli->ring[(psli->extra_ring)].flag &= ~LPFC_STOP_IOCB_EVENT;
2419 psli->ring[(psli->fcp_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; 2288 psli->ring[(psli->fcp_ring)].flag &= ~LPFC_STOP_IOCB_EVENT;
2420 psli->ring[(psli->next_ring)].flag &= ~LPFC_STOP_IOCB_EVENT; 2289 psli->ring[(psli->next_ring)].flag &= ~LPFC_STOP_IOCB_EVENT;
2421 phba->hba_state = LPFC_HBA_READY; 2290 phba->hba_state = LPFC_HBA_READY;
diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h
index eedf98801366..f79cb6136906 100644
--- a/drivers/scsi/lpfc/lpfc_hw.h
+++ b/drivers/scsi/lpfc/lpfc_hw.h
@@ -42,14 +42,14 @@
42#define FCELSSIZE 1024 /* maximum ELS transfer size */ 42#define FCELSSIZE 1024 /* maximum ELS transfer size */
43 43
44#define LPFC_FCP_RING 0 /* ring 0 for FCP initiator commands */ 44#define LPFC_FCP_RING 0 /* ring 0 for FCP initiator commands */
45#define LPFC_IP_RING 1 /* ring 1 for IP commands */ 45#define LPFC_EXTRA_RING 1 /* ring 1 for other protocols */
46#define LPFC_ELS_RING 2 /* ring 2 for ELS commands */ 46#define LPFC_ELS_RING 2 /* ring 2 for ELS commands */
47#define LPFC_FCP_NEXT_RING 3 47#define LPFC_FCP_NEXT_RING 3
48 48
49#define SLI2_IOCB_CMD_R0_ENTRIES 172 /* SLI-2 FCP command ring entries */ 49#define SLI2_IOCB_CMD_R0_ENTRIES 172 /* SLI-2 FCP command ring entries */
50#define SLI2_IOCB_RSP_R0_ENTRIES 134 /* SLI-2 FCP response ring entries */ 50#define SLI2_IOCB_RSP_R0_ENTRIES 134 /* SLI-2 FCP response ring entries */
51#define SLI2_IOCB_CMD_R1_ENTRIES 4 /* SLI-2 IP command ring entries */ 51#define SLI2_IOCB_CMD_R1_ENTRIES 4 /* SLI-2 extra command ring entries */
52#define SLI2_IOCB_RSP_R1_ENTRIES 4 /* SLI-2 IP response ring entries */ 52#define SLI2_IOCB_RSP_R1_ENTRIES 4 /* SLI-2 extra response ring entries */
53#define SLI2_IOCB_CMD_R1XTRA_ENTRIES 36 /* SLI-2 extra FCP cmd ring entries */ 53#define SLI2_IOCB_CMD_R1XTRA_ENTRIES 36 /* SLI-2 extra FCP cmd ring entries */
54#define SLI2_IOCB_RSP_R1XTRA_ENTRIES 52 /* SLI-2 extra FCP rsp ring entries */ 54#define SLI2_IOCB_RSP_R1XTRA_ENTRIES 52 /* SLI-2 extra FCP rsp ring entries */
55#define SLI2_IOCB_CMD_R2_ENTRIES 20 /* SLI-2 ELS command ring entries */ 55#define SLI2_IOCB_CMD_R2_ENTRIES 20 /* SLI-2 ELS command ring entries */
@@ -121,6 +121,20 @@ struct lpfc_sli_ct_request {
121 121
122 uint32_t rsvd[7]; 122 uint32_t rsvd[7];
123 } rft; 123 } rft;
124 struct rff {
125 uint32_t PortId;
126 uint8_t reserved[2];
127#ifdef __BIG_ENDIAN_BITFIELD
128 uint8_t feature_res:6;
129 uint8_t feature_init:1;
130 uint8_t feature_tgt:1;
131#else /* __LITTLE_ENDIAN_BITFIELD */
132 uint8_t feature_tgt:1;
133 uint8_t feature_init:1;
134 uint8_t feature_res:6;
135#endif
136 uint8_t type_code; /* type=8 for FCP */
137 } rff;
124 struct rnn { 138 struct rnn {
125 uint32_t PortId; /* For RNN_ID requests */ 139 uint32_t PortId; /* For RNN_ID requests */
126 uint8_t wwnn[8]; 140 uint8_t wwnn[8];
@@ -136,6 +150,7 @@ struct lpfc_sli_ct_request {
136#define SLI_CT_REVISION 1 150#define SLI_CT_REVISION 1
137#define GID_REQUEST_SZ (sizeof(struct lpfc_sli_ct_request) - 260) 151#define GID_REQUEST_SZ (sizeof(struct lpfc_sli_ct_request) - 260)
138#define RFT_REQUEST_SZ (sizeof(struct lpfc_sli_ct_request) - 228) 152#define RFT_REQUEST_SZ (sizeof(struct lpfc_sli_ct_request) - 228)
153#define RFF_REQUEST_SZ (sizeof(struct lpfc_sli_ct_request) - 235)
139#define RNN_REQUEST_SZ (sizeof(struct lpfc_sli_ct_request) - 252) 154#define RNN_REQUEST_SZ (sizeof(struct lpfc_sli_ct_request) - 252)
140#define RSNN_REQUEST_SZ (sizeof(struct lpfc_sli_ct_request)) 155#define RSNN_REQUEST_SZ (sizeof(struct lpfc_sli_ct_request))
141 156
@@ -225,6 +240,7 @@ struct lpfc_sli_ct_request {
225#define SLI_CTNS_RNN_ID 0x0213 240#define SLI_CTNS_RNN_ID 0x0213
226#define SLI_CTNS_RCS_ID 0x0214 241#define SLI_CTNS_RCS_ID 0x0214
227#define SLI_CTNS_RFT_ID 0x0217 242#define SLI_CTNS_RFT_ID 0x0217
243#define SLI_CTNS_RFF_ID 0x021F
228#define SLI_CTNS_RSPN_ID 0x0218 244#define SLI_CTNS_RSPN_ID 0x0218
229#define SLI_CTNS_RPT_ID 0x021A 245#define SLI_CTNS_RPT_ID 0x021A
230#define SLI_CTNS_RIP_NN 0x0235 246#define SLI_CTNS_RIP_NN 0x0235
@@ -1089,12 +1105,6 @@ typedef struct {
1089#define PCI_DEVICE_ID_ZEPHYR_SCSP 0xfe11 1105#define PCI_DEVICE_ID_ZEPHYR_SCSP 0xfe11
1090#define PCI_DEVICE_ID_ZEPHYR_DCSP 0xfe12 1106#define PCI_DEVICE_ID_ZEPHYR_DCSP 0xfe12
1091 1107
1092#define PCI_SUBSYSTEM_ID_LP11000S 0xfc11
1093#define PCI_SUBSYSTEM_ID_LP11002S 0xfc12
1094#define PCI_SUBSYSTEM_ID_LPE11000S 0xfc21
1095#define PCI_SUBSYSTEM_ID_LPE11002S 0xfc22
1096#define PCI_SUBSYSTEM_ID_LPE11010S 0xfc2A
1097
1098#define JEDEC_ID_ADDRESS 0x0080001c 1108#define JEDEC_ID_ADDRESS 0x0080001c
1099#define FIREFLY_JEDEC_ID 0x1ACC 1109#define FIREFLY_JEDEC_ID 0x1ACC
1100#define SUPERFLY_JEDEC_ID 0x0020 1110#define SUPERFLY_JEDEC_ID 0x0020
@@ -1284,6 +1294,10 @@ typedef struct { /* FireFly BIU registers */
1284#define CMD_FCP_IREAD_CX 0x1B 1294#define CMD_FCP_IREAD_CX 0x1B
1285#define CMD_FCP_ICMND_CR 0x1C 1295#define CMD_FCP_ICMND_CR 0x1C
1286#define CMD_FCP_ICMND_CX 0x1D 1296#define CMD_FCP_ICMND_CX 0x1D
1297#define CMD_FCP_TSEND_CX 0x1F
1298#define CMD_FCP_TRECEIVE_CX 0x21
1299#define CMD_FCP_TRSP_CX 0x23
1300#define CMD_FCP_AUTO_TRSP_CX 0x29
1287 1301
1288#define CMD_ADAPTER_MSG 0x20 1302#define CMD_ADAPTER_MSG 0x20
1289#define CMD_ADAPTER_DUMP 0x22 1303#define CMD_ADAPTER_DUMP 0x22
@@ -1310,6 +1324,9 @@ typedef struct { /* FireFly BIU registers */
1310#define CMD_FCP_IREAD64_CX 0x9B 1324#define CMD_FCP_IREAD64_CX 0x9B
1311#define CMD_FCP_ICMND64_CR 0x9C 1325#define CMD_FCP_ICMND64_CR 0x9C
1312#define CMD_FCP_ICMND64_CX 0x9D 1326#define CMD_FCP_ICMND64_CX 0x9D
1327#define CMD_FCP_TSEND64_CX 0x9F
1328#define CMD_FCP_TRECEIVE64_CX 0xA1
1329#define CMD_FCP_TRSP64_CX 0xA3
1313 1330
1314#define CMD_GEN_REQUEST64_CR 0xC2 1331#define CMD_GEN_REQUEST64_CR 0xC2
1315#define CMD_GEN_REQUEST64_CX 0xC3 1332#define CMD_GEN_REQUEST64_CX 0xC3
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index a5723ad0a099..afca45cdbcef 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -268,6 +268,8 @@ lpfc_config_port_post(struct lpfc_hba * phba)
268 kfree(mp); 268 kfree(mp);
269 pmb->context1 = NULL; 269 pmb->context1 = NULL;
270 270
271 if (phba->cfg_soft_wwnn)
272 u64_to_wwn(phba->cfg_soft_wwnn, phba->fc_sparam.nodeName.u.wwn);
271 if (phba->cfg_soft_wwpn) 273 if (phba->cfg_soft_wwpn)
272 u64_to_wwn(phba->cfg_soft_wwpn, phba->fc_sparam.portName.u.wwn); 274 u64_to_wwn(phba->cfg_soft_wwpn, phba->fc_sparam.portName.u.wwn);
273 memcpy(&phba->fc_nodename, &phba->fc_sparam.nodeName, 275 memcpy(&phba->fc_nodename, &phba->fc_sparam.nodeName,
@@ -349,8 +351,8 @@ lpfc_config_port_post(struct lpfc_hba * phba)
349 phba->hba_state = LPFC_LINK_DOWN; 351 phba->hba_state = LPFC_LINK_DOWN;
350 352
351 /* Only process IOCBs on ring 0 till hba_state is READY */ 353 /* Only process IOCBs on ring 0 till hba_state is READY */
352 if (psli->ring[psli->ip_ring].cmdringaddr) 354 if (psli->ring[psli->extra_ring].cmdringaddr)
353 psli->ring[psli->ip_ring].flag |= LPFC_STOP_IOCB_EVENT; 355 psli->ring[psli->extra_ring].flag |= LPFC_STOP_IOCB_EVENT;
354 if (psli->ring[psli->fcp_ring].cmdringaddr) 356 if (psli->ring[psli->fcp_ring].cmdringaddr)
355 psli->ring[psli->fcp_ring].flag |= LPFC_STOP_IOCB_EVENT; 357 psli->ring[psli->fcp_ring].flag |= LPFC_STOP_IOCB_EVENT;
356 if (psli->ring[psli->next_ring].cmdringaddr) 358 if (psli->ring[psli->next_ring].cmdringaddr)
@@ -517,7 +519,8 @@ lpfc_handle_eratt(struct lpfc_hba * phba)
517 struct lpfc_sli_ring *pring; 519 struct lpfc_sli_ring *pring;
518 uint32_t event_data; 520 uint32_t event_data;
519 521
520 if (phba->work_hs & HS_FFER6) { 522 if (phba->work_hs & HS_FFER6 ||
523 phba->work_hs & HS_FFER5) {
521 /* Re-establishing Link */ 524 /* Re-establishing Link */
522 lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, 525 lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT,
523 "%d:1301 Re-establishing Link " 526 "%d:1301 Re-establishing Link "
@@ -611,7 +614,7 @@ lpfc_handle_latt(struct lpfc_hba * phba)
611 pmb->mbox_cmpl = lpfc_mbx_cmpl_read_la; 614 pmb->mbox_cmpl = lpfc_mbx_cmpl_read_la;
612 rc = lpfc_sli_issue_mbox (phba, pmb, (MBX_NOWAIT | MBX_STOP_IOCB)); 615 rc = lpfc_sli_issue_mbox (phba, pmb, (MBX_NOWAIT | MBX_STOP_IOCB));
613 if (rc == MBX_NOT_FINISHED) 616 if (rc == MBX_NOT_FINISHED)
614 goto lpfc_handle_latt_free_mp; 617 goto lpfc_handle_latt_free_mbuf;
615 618
616 /* Clear Link Attention in HA REG */ 619 /* Clear Link Attention in HA REG */
617 spin_lock_irq(phba->host->host_lock); 620 spin_lock_irq(phba->host->host_lock);
@@ -621,6 +624,8 @@ lpfc_handle_latt(struct lpfc_hba * phba)
621 624
622 return; 625 return;
623 626
627lpfc_handle_latt_free_mbuf:
628 lpfc_mbuf_free(phba, mp->virt, mp->phys);
624lpfc_handle_latt_free_mp: 629lpfc_handle_latt_free_mp:
625 kfree(mp); 630 kfree(mp);
626lpfc_handle_latt_free_pmb: 631lpfc_handle_latt_free_pmb:
@@ -802,19 +807,13 @@ lpfc_get_hba_model_desc(struct lpfc_hba * phba, uint8_t * mdp, uint8_t * descp)
802{ 807{
803 lpfc_vpd_t *vp; 808 lpfc_vpd_t *vp;
804 uint16_t dev_id = phba->pcidev->device; 809 uint16_t dev_id = phba->pcidev->device;
805 uint16_t dev_subid = phba->pcidev->subsystem_device;
806 uint8_t hdrtype;
807 int max_speed; 810 int max_speed;
808 char * ports;
809 struct { 811 struct {
810 char * name; 812 char * name;
811 int max_speed; 813 int max_speed;
812 char * ports;
813 char * bus; 814 char * bus;
814 } m = {"<Unknown>", 0, "", ""}; 815 } m = {"<Unknown>", 0, ""};
815 816
816 pci_read_config_byte(phba->pcidev, PCI_HEADER_TYPE, &hdrtype);
817 ports = (hdrtype == 0x80) ? "2-port " : "";
818 if (mdp && mdp[0] != '\0' 817 if (mdp && mdp[0] != '\0'
819 && descp && descp[0] != '\0') 818 && descp && descp[0] != '\0')
820 return; 819 return;
@@ -834,130 +833,93 @@ lpfc_get_hba_model_desc(struct lpfc_hba * phba, uint8_t * mdp, uint8_t * descp)
834 833
835 switch (dev_id) { 834 switch (dev_id) {
836 case PCI_DEVICE_ID_FIREFLY: 835 case PCI_DEVICE_ID_FIREFLY:
837 m = (typeof(m)){"LP6000", max_speed, "", "PCI"}; 836 m = (typeof(m)){"LP6000", max_speed, "PCI"};
838 break; 837 break;
839 case PCI_DEVICE_ID_SUPERFLY: 838 case PCI_DEVICE_ID_SUPERFLY:
840 if (vp->rev.biuRev >= 1 && vp->rev.biuRev <= 3) 839 if (vp->rev.biuRev >= 1 && vp->rev.biuRev <= 3)
841 m = (typeof(m)){"LP7000", max_speed, "", "PCI"}; 840 m = (typeof(m)){"LP7000", max_speed, "PCI"};
842 else 841 else
843 m = (typeof(m)){"LP7000E", max_speed, "", "PCI"}; 842 m = (typeof(m)){"LP7000E", max_speed, "PCI"};
844 break; 843 break;
845 case PCI_DEVICE_ID_DRAGONFLY: 844 case PCI_DEVICE_ID_DRAGONFLY:
846 m = (typeof(m)){"LP8000", max_speed, "", "PCI"}; 845 m = (typeof(m)){"LP8000", max_speed, "PCI"};
847 break; 846 break;
848 case PCI_DEVICE_ID_CENTAUR: 847 case PCI_DEVICE_ID_CENTAUR:
849 if (FC_JEDEC_ID(vp->rev.biuRev) == CENTAUR_2G_JEDEC_ID) 848 if (FC_JEDEC_ID(vp->rev.biuRev) == CENTAUR_2G_JEDEC_ID)
850 m = (typeof(m)){"LP9002", max_speed, "", "PCI"}; 849 m = (typeof(m)){"LP9002", max_speed, "PCI"};
851 else 850 else
852 m = (typeof(m)){"LP9000", max_speed, "", "PCI"}; 851 m = (typeof(m)){"LP9000", max_speed, "PCI"};
853 break; 852 break;
854 case PCI_DEVICE_ID_RFLY: 853 case PCI_DEVICE_ID_RFLY:
855 m = (typeof(m)){"LP952", max_speed, "", "PCI"}; 854 m = (typeof(m)){"LP952", max_speed, "PCI"};
856 break; 855 break;
857 case PCI_DEVICE_ID_PEGASUS: 856 case PCI_DEVICE_ID_PEGASUS:
858 m = (typeof(m)){"LP9802", max_speed, "", "PCI-X"}; 857 m = (typeof(m)){"LP9802", max_speed, "PCI-X"};
859 break; 858 break;
860 case PCI_DEVICE_ID_THOR: 859 case PCI_DEVICE_ID_THOR:
861 if (hdrtype == 0x80) 860 m = (typeof(m)){"LP10000", max_speed, "PCI-X"};
862 m = (typeof(m)){"LP10000DC",
863 max_speed, ports, "PCI-X"};
864 else
865 m = (typeof(m)){"LP10000",
866 max_speed, ports, "PCI-X"};
867 break; 861 break;
868 case PCI_DEVICE_ID_VIPER: 862 case PCI_DEVICE_ID_VIPER:
869 m = (typeof(m)){"LPX1000", max_speed, "", "PCI-X"}; 863 m = (typeof(m)){"LPX1000", max_speed, "PCI-X"};
870 break; 864 break;
871 case PCI_DEVICE_ID_PFLY: 865 case PCI_DEVICE_ID_PFLY:
872 m = (typeof(m)){"LP982", max_speed, "", "PCI-X"}; 866 m = (typeof(m)){"LP982", max_speed, "PCI-X"};
873 break; 867 break;
874 case PCI_DEVICE_ID_TFLY: 868 case PCI_DEVICE_ID_TFLY:
875 if (hdrtype == 0x80) 869 m = (typeof(m)){"LP1050", max_speed, "PCI-X"};
876 m = (typeof(m)){"LP1050DC", max_speed, ports, "PCI-X"};
877 else
878 m = (typeof(m)){"LP1050", max_speed, ports, "PCI-X"};
879 break; 870 break;
880 case PCI_DEVICE_ID_HELIOS: 871 case PCI_DEVICE_ID_HELIOS:
881 if (hdrtype == 0x80) 872 m = (typeof(m)){"LP11000", max_speed, "PCI-X2"};
882 m = (typeof(m)){"LP11002", max_speed, ports, "PCI-X2"};
883 else
884 m = (typeof(m)){"LP11000", max_speed, ports, "PCI-X2"};
885 break; 873 break;
886 case PCI_DEVICE_ID_HELIOS_SCSP: 874 case PCI_DEVICE_ID_HELIOS_SCSP:
887 m = (typeof(m)){"LP11000-SP", max_speed, ports, "PCI-X2"}; 875 m = (typeof(m)){"LP11000-SP", max_speed, "PCI-X2"};
888 break; 876 break;
889 case PCI_DEVICE_ID_HELIOS_DCSP: 877 case PCI_DEVICE_ID_HELIOS_DCSP:
890 m = (typeof(m)){"LP11002-SP", max_speed, ports, "PCI-X2"}; 878 m = (typeof(m)){"LP11002-SP", max_speed, "PCI-X2"};
891 break; 879 break;
892 case PCI_DEVICE_ID_NEPTUNE: 880 case PCI_DEVICE_ID_NEPTUNE:
893 if (hdrtype == 0x80) 881 m = (typeof(m)){"LPe1000", max_speed, "PCIe"};
894 m = (typeof(m)){"LPe1002", max_speed, ports, "PCIe"};
895 else
896 m = (typeof(m)){"LPe1000", max_speed, ports, "PCIe"};
897 break; 882 break;
898 case PCI_DEVICE_ID_NEPTUNE_SCSP: 883 case PCI_DEVICE_ID_NEPTUNE_SCSP:
899 m = (typeof(m)){"LPe1000-SP", max_speed, ports, "PCIe"}; 884 m = (typeof(m)){"LPe1000-SP", max_speed, "PCIe"};
900 break; 885 break;
901 case PCI_DEVICE_ID_NEPTUNE_DCSP: 886 case PCI_DEVICE_ID_NEPTUNE_DCSP:
902 m = (typeof(m)){"LPe1002-SP", max_speed, ports, "PCIe"}; 887 m = (typeof(m)){"LPe1002-SP", max_speed, "PCIe"};
903 break; 888 break;
904 case PCI_DEVICE_ID_BMID: 889 case PCI_DEVICE_ID_BMID:
905 m = (typeof(m)){"LP1150", max_speed, ports, "PCI-X2"}; 890 m = (typeof(m)){"LP1150", max_speed, "PCI-X2"};
906 break; 891 break;
907 case PCI_DEVICE_ID_BSMB: 892 case PCI_DEVICE_ID_BSMB:
908 m = (typeof(m)){"LP111", max_speed, ports, "PCI-X2"}; 893 m = (typeof(m)){"LP111", max_speed, "PCI-X2"};
909 break; 894 break;
910 case PCI_DEVICE_ID_ZEPHYR: 895 case PCI_DEVICE_ID_ZEPHYR:
911 if (hdrtype == 0x80) 896 m = (typeof(m)){"LPe11000", max_speed, "PCIe"};
912 m = (typeof(m)){"LPe11002", max_speed, ports, "PCIe"};
913 else
914 m = (typeof(m)){"LPe11000", max_speed, ports, "PCIe"};
915 break; 897 break;
916 case PCI_DEVICE_ID_ZEPHYR_SCSP: 898 case PCI_DEVICE_ID_ZEPHYR_SCSP:
917 m = (typeof(m)){"LPe11000", max_speed, ports, "PCIe"}; 899 m = (typeof(m)){"LPe11000", max_speed, "PCIe"};
918 break; 900 break;
919 case PCI_DEVICE_ID_ZEPHYR_DCSP: 901 case PCI_DEVICE_ID_ZEPHYR_DCSP:
920 m = (typeof(m)){"LPe11002-SP", max_speed, ports, "PCIe"}; 902 m = (typeof(m)){"LPe11002-SP", max_speed, "PCIe"};
921 break; 903 break;
922 case PCI_DEVICE_ID_ZMID: 904 case PCI_DEVICE_ID_ZMID:
923 m = (typeof(m)){"LPe1150", max_speed, ports, "PCIe"}; 905 m = (typeof(m)){"LPe1150", max_speed, "PCIe"};
924 break; 906 break;
925 case PCI_DEVICE_ID_ZSMB: 907 case PCI_DEVICE_ID_ZSMB:
926 m = (typeof(m)){"LPe111", max_speed, ports, "PCIe"}; 908 m = (typeof(m)){"LPe111", max_speed, "PCIe"};
927 break; 909 break;
928 case PCI_DEVICE_ID_LP101: 910 case PCI_DEVICE_ID_LP101:
929 m = (typeof(m)){"LP101", max_speed, ports, "PCI-X"}; 911 m = (typeof(m)){"LP101", max_speed, "PCI-X"};
930 break; 912 break;
931 case PCI_DEVICE_ID_LP10000S: 913 case PCI_DEVICE_ID_LP10000S:
932 m = (typeof(m)){"LP10000-S", max_speed, ports, "PCI"}; 914 m = (typeof(m)){"LP10000-S", max_speed, "PCI"};
933 break; 915 break;
934 case PCI_DEVICE_ID_LP11000S: 916 case PCI_DEVICE_ID_LP11000S:
917 m = (typeof(m)){"LP11000-S", max_speed,
918 "PCI-X2"};
919 break;
935 case PCI_DEVICE_ID_LPE11000S: 920 case PCI_DEVICE_ID_LPE11000S:
936 switch (dev_subid) { 921 m = (typeof(m)){"LPe11000-S", max_speed,
937 case PCI_SUBSYSTEM_ID_LP11000S: 922 "PCIe"};
938 m = (typeof(m)){"LP11000-S", max_speed,
939 ports, "PCI-X2"};
940 break;
941 case PCI_SUBSYSTEM_ID_LP11002S:
942 m = (typeof(m)){"LP11002-S", max_speed,
943 ports, "PCI-X2"};
944 break;
945 case PCI_SUBSYSTEM_ID_LPE11000S:
946 m = (typeof(m)){"LPe11000-S", max_speed,
947 ports, "PCIe"};
948 break;
949 case PCI_SUBSYSTEM_ID_LPE11002S:
950 m = (typeof(m)){"LPe11002-S", max_speed,
951 ports, "PCIe"};
952 break;
953 case PCI_SUBSYSTEM_ID_LPE11010S:
954 m = (typeof(m)){"LPe11010-S", max_speed,
955 "10-port ", "PCIe"};
956 break;
957 default:
958 m = (typeof(m)){ NULL };
959 break;
960 }
961 break; 923 break;
962 default: 924 default:
963 m = (typeof(m)){ NULL }; 925 m = (typeof(m)){ NULL };
@@ -968,8 +930,8 @@ lpfc_get_hba_model_desc(struct lpfc_hba * phba, uint8_t * mdp, uint8_t * descp)
968 snprintf(mdp, 79,"%s", m.name); 930 snprintf(mdp, 79,"%s", m.name);
969 if (descp && descp[0] == '\0') 931 if (descp && descp[0] == '\0')
970 snprintf(descp, 255, 932 snprintf(descp, 255,
971 "Emulex %s %dGb %s%s Fibre Channel Adapter", 933 "Emulex %s %dGb %s Fibre Channel Adapter",
972 m.name, m.max_speed, m.ports, m.bus); 934 m.name, m.max_speed, m.bus);
973} 935}
974 936
975/**************************************************/ 937/**************************************************/
@@ -1651,6 +1613,14 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
1651 if (error) 1613 if (error)
1652 goto out_remove_host; 1614 goto out_remove_host;
1653 1615
1616 if (phba->cfg_use_msi) {
1617 error = pci_enable_msi(phba->pcidev);
1618 if (error)
1619 lpfc_printf_log(phba, KERN_INFO, LOG_INIT, "%d:0452 "
1620 "Enable MSI failed, continuing with "
1621 "IRQ\n", phba->brd_no);
1622 }
1623
1654 error = request_irq(phba->pcidev->irq, lpfc_intr_handler, IRQF_SHARED, 1624 error = request_irq(phba->pcidev->irq, lpfc_intr_handler, IRQF_SHARED,
1655 LPFC_DRIVER_NAME, phba); 1625 LPFC_DRIVER_NAME, phba);
1656 if (error) { 1626 if (error) {
@@ -1730,6 +1700,7 @@ out_free_irq:
1730 lpfc_stop_timer(phba); 1700 lpfc_stop_timer(phba);
1731 phba->work_hba_events = 0; 1701 phba->work_hba_events = 0;
1732 free_irq(phba->pcidev->irq, phba); 1702 free_irq(phba->pcidev->irq, phba);
1703 pci_disable_msi(phba->pcidev);
1733out_free_sysfs_attr: 1704out_free_sysfs_attr:
1734 lpfc_free_sysfs_attr(phba); 1705 lpfc_free_sysfs_attr(phba);
1735out_remove_host: 1706out_remove_host:
@@ -1796,6 +1767,7 @@ lpfc_pci_remove_one(struct pci_dev *pdev)
1796 1767
1797 /* Release the irq reservation */ 1768 /* Release the irq reservation */
1798 free_irq(phba->pcidev->irq, phba); 1769 free_irq(phba->pcidev->irq, phba);
1770 pci_disable_msi(phba->pcidev);
1799 1771
1800 lpfc_cleanup(phba, 0); 1772 lpfc_cleanup(phba, 0);
1801 lpfc_stop_timer(phba); 1773 lpfc_stop_timer(phba);
diff --git a/drivers/scsi/lpfc/lpfc_logmsg.h b/drivers/scsi/lpfc/lpfc_logmsg.h
index 62c8ca862e9e..438cbcd9eb13 100644
--- a/drivers/scsi/lpfc/lpfc_logmsg.h
+++ b/drivers/scsi/lpfc/lpfc_logmsg.h
@@ -28,7 +28,7 @@
28#define LOG_NODE 0x80 /* Node table events */ 28#define LOG_NODE 0x80 /* Node table events */
29#define LOG_MISC 0x400 /* Miscellaneous events */ 29#define LOG_MISC 0x400 /* Miscellaneous events */
30#define LOG_SLI 0x800 /* SLI events */ 30#define LOG_SLI 0x800 /* SLI events */
31#define LOG_CHK_COND 0x1000 /* FCP Check condition flag */ 31#define LOG_FCP_ERROR 0x1000 /* log errors, not underruns */
32#define LOG_LIBDFC 0x2000 /* Libdfc events */ 32#define LOG_LIBDFC 0x2000 /* Libdfc events */
33#define LOG_ALL_MSG 0xffff /* LOG all messages */ 33#define LOG_ALL_MSG 0xffff /* LOG all messages */
34 34
diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c
index d5f415007db2..0c7e731dc45a 100644
--- a/drivers/scsi/lpfc/lpfc_nportdisc.c
+++ b/drivers/scsi/lpfc/lpfc_nportdisc.c
@@ -739,7 +739,7 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_hba * phba,
739 uint32_t evt) 739 uint32_t evt)
740{ 740{
741 struct lpfc_iocbq *cmdiocb, *rspiocb; 741 struct lpfc_iocbq *cmdiocb, *rspiocb;
742 struct lpfc_dmabuf *pcmd, *prsp; 742 struct lpfc_dmabuf *pcmd, *prsp, *mp;
743 uint32_t *lp; 743 uint32_t *lp;
744 IOCB_t *irsp; 744 IOCB_t *irsp;
745 struct serv_parm *sp; 745 struct serv_parm *sp;
@@ -829,6 +829,9 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_hba * phba,
829 NLP_REGLOGIN_LIST); 829 NLP_REGLOGIN_LIST);
830 return ndlp->nlp_state; 830 return ndlp->nlp_state;
831 } 831 }
832 mp = (struct lpfc_dmabuf *)mbox->context1;
833 lpfc_mbuf_free(phba, mp->virt, mp->phys);
834 kfree(mp);
832 mempool_free(mbox, phba->mbox_mem_pool); 835 mempool_free(mbox, phba->mbox_mem_pool);
833 } else { 836 } else {
834 mempool_free(mbox, phba->mbox_mem_pool); 837 mempool_free(mbox, phba->mbox_mem_pool);
@@ -1620,8 +1623,8 @@ lpfc_rcv_padisc_npr_node(struct lpfc_hba * phba,
1620 * or discovery in progress for this node. Starting discovery 1623 * or discovery in progress for this node. Starting discovery
1621 * here will affect the counting of discovery threads. 1624 * here will affect the counting of discovery threads.
1622 */ 1625 */
1623 if ((!(ndlp->nlp_flag & NLP_DELAY_TMO)) && 1626 if (!(ndlp->nlp_flag & NLP_DELAY_TMO) &&
1624 (ndlp->nlp_flag & NLP_NPR_2B_DISC)){ 1627 !(ndlp->nlp_flag & NLP_NPR_2B_DISC)){
1625 if (ndlp->nlp_flag & NLP_NPR_ADISC) { 1628 if (ndlp->nlp_flag & NLP_NPR_ADISC) {
1626 ndlp->nlp_prev_state = NLP_STE_NPR_NODE; 1629 ndlp->nlp_prev_state = NLP_STE_NPR_NODE;
1627 ndlp->nlp_state = NLP_STE_ADISC_ISSUE; 1630 ndlp->nlp_state = NLP_STE_ADISC_ISSUE;
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 97ae98dc95d0..c3e68e0d8f74 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -297,8 +297,10 @@ lpfc_handle_fcp_err(struct lpfc_scsi_buf *lpfc_cmd)
297 uint32_t fcpi_parm = lpfc_cmd->cur_iocbq.iocb.un.fcpi.fcpi_parm; 297 uint32_t fcpi_parm = lpfc_cmd->cur_iocbq.iocb.un.fcpi.fcpi_parm;
298 uint32_t resp_info = fcprsp->rspStatus2; 298 uint32_t resp_info = fcprsp->rspStatus2;
299 uint32_t scsi_status = fcprsp->rspStatus3; 299 uint32_t scsi_status = fcprsp->rspStatus3;
300 uint32_t *lp;
300 uint32_t host_status = DID_OK; 301 uint32_t host_status = DID_OK;
301 uint32_t rsplen = 0; 302 uint32_t rsplen = 0;
303 uint32_t logit = LOG_FCP | LOG_FCP_ERROR;
302 304
303 /* 305 /*
304 * If this is a task management command, there is no 306 * If this is a task management command, there is no
@@ -310,10 +312,25 @@ lpfc_handle_fcp_err(struct lpfc_scsi_buf *lpfc_cmd)
310 goto out; 312 goto out;
311 } 313 }
312 314
313 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP, 315 if ((resp_info & SNS_LEN_VALID) && fcprsp->rspSnsLen) {
314 "%d:0730 FCP command failed: RSP " 316 uint32_t snslen = be32_to_cpu(fcprsp->rspSnsLen);
315 "Data: x%x x%x x%x x%x x%x x%x\n", 317 if (snslen > SCSI_SENSE_BUFFERSIZE)
316 phba->brd_no, resp_info, scsi_status, 318 snslen = SCSI_SENSE_BUFFERSIZE;
319
320 if (resp_info & RSP_LEN_VALID)
321 rsplen = be32_to_cpu(fcprsp->rspRspLen);
322 memcpy(cmnd->sense_buffer, &fcprsp->rspInfo0 + rsplen, snslen);
323 }
324 lp = (uint32_t *)cmnd->sense_buffer;
325
326 if (!scsi_status && (resp_info & RESID_UNDER))
327 logit = LOG_FCP;
328
329 lpfc_printf_log(phba, KERN_WARNING, logit,
330 "%d:0730 FCP command x%x failed: x%x SNS x%x x%x "
331 "Data: x%x x%x x%x x%x x%x\n",
332 phba->brd_no, cmnd->cmnd[0], scsi_status,
333 be32_to_cpu(*lp), be32_to_cpu(*(lp + 3)), resp_info,
317 be32_to_cpu(fcprsp->rspResId), 334 be32_to_cpu(fcprsp->rspResId),
318 be32_to_cpu(fcprsp->rspSnsLen), 335 be32_to_cpu(fcprsp->rspSnsLen),
319 be32_to_cpu(fcprsp->rspRspLen), 336 be32_to_cpu(fcprsp->rspRspLen),
@@ -328,14 +345,6 @@ lpfc_handle_fcp_err(struct lpfc_scsi_buf *lpfc_cmd)
328 } 345 }
329 } 346 }
330 347
331 if ((resp_info & SNS_LEN_VALID) && fcprsp->rspSnsLen) {
332 uint32_t snslen = be32_to_cpu(fcprsp->rspSnsLen);
333 if (snslen > SCSI_SENSE_BUFFERSIZE)
334 snslen = SCSI_SENSE_BUFFERSIZE;
335
336 memcpy(cmnd->sense_buffer, &fcprsp->rspInfo0 + rsplen, snslen);
337 }
338
339 cmnd->resid = 0; 348 cmnd->resid = 0;
340 if (resp_info & RESID_UNDER) { 349 if (resp_info & RESID_UNDER) {
341 cmnd->resid = be32_to_cpu(fcprsp->rspResId); 350 cmnd->resid = be32_to_cpu(fcprsp->rspResId);
@@ -378,7 +387,7 @@ lpfc_handle_fcp_err(struct lpfc_scsi_buf *lpfc_cmd)
378 */ 387 */
379 } else if ((scsi_status == SAM_STAT_GOOD) && fcpi_parm && 388 } else if ((scsi_status == SAM_STAT_GOOD) && fcpi_parm &&
380 (cmnd->sc_data_direction == DMA_FROM_DEVICE)) { 389 (cmnd->sc_data_direction == DMA_FROM_DEVICE)) {
381 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP, 390 lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_FCP_ERROR,
382 "%d:0734 FCP Read Check Error Data: " 391 "%d:0734 FCP Read Check Error Data: "
383 "x%x x%x x%x x%x\n", phba->brd_no, 392 "x%x x%x x%x x%x\n", phba->brd_no,
384 be32_to_cpu(fcpcmd->fcpDl), 393 be32_to_cpu(fcpcmd->fcpDl),
@@ -670,6 +679,9 @@ lpfc_scsi_tgt_reset(struct lpfc_scsi_buf * lpfc_cmd, struct lpfc_hba * phba,
670 struct lpfc_iocbq *iocbqrsp; 679 struct lpfc_iocbq *iocbqrsp;
671 int ret; 680 int ret;
672 681
682 if (!rdata->pnode)
683 return FAILED;
684
673 lpfc_cmd->rdata = rdata; 685 lpfc_cmd->rdata = rdata;
674 ret = lpfc_scsi_prep_task_mgmt_cmd(phba, lpfc_cmd, lun, 686 ret = lpfc_scsi_prep_task_mgmt_cmd(phba, lpfc_cmd, lun,
675 FCP_TARGET_RESET); 687 FCP_TARGET_RESET);
@@ -976,20 +988,34 @@ lpfc_reset_lun_handler(struct scsi_cmnd *cmnd)
976 988
977 lpfc_block_error_handler(cmnd); 989 lpfc_block_error_handler(cmnd);
978 spin_lock_irq(shost->host_lock); 990 spin_lock_irq(shost->host_lock);
991 loopcnt = 0;
979 /* 992 /*
980 * If target is not in a MAPPED state, delay the reset until 993 * If target is not in a MAPPED state, delay the reset until
981 * target is rediscovered or devloss timeout expires. 994 * target is rediscovered or devloss timeout expires.
982 */ 995 */
983 while ( 1 ) { 996 while ( 1 ) {
984 if (!pnode) 997 if (!pnode)
985 break; 998 return FAILED;
986 999
987 if (pnode->nlp_state != NLP_STE_MAPPED_NODE) { 1000 if (pnode->nlp_state != NLP_STE_MAPPED_NODE) {
988 spin_unlock_irq(phba->host->host_lock); 1001 spin_unlock_irq(phba->host->host_lock);
989 schedule_timeout_uninterruptible(msecs_to_jiffies(500)); 1002 schedule_timeout_uninterruptible(msecs_to_jiffies(500));
990 spin_lock_irq(phba->host->host_lock); 1003 spin_lock_irq(phba->host->host_lock);
1004 loopcnt++;
1005 rdata = cmnd->device->hostdata;
1006 if (!rdata ||
1007 (loopcnt > ((phba->cfg_devloss_tmo * 2) + 1))) {
1008 lpfc_printf_log(phba, KERN_ERR, LOG_FCP,
1009 "%d:0721 LUN Reset rport failure:"
1010 " cnt x%x rdata x%p\n",
1011 phba->brd_no, loopcnt, rdata);
1012 goto out;
1013 }
1014 pnode = rdata->pnode;
1015 if (!pnode)
1016 return FAILED;
991 } 1017 }
992 if ((pnode) && (pnode->nlp_state == NLP_STE_MAPPED_NODE)) 1018 if (pnode->nlp_state == NLP_STE_MAPPED_NODE)
993 break; 1019 break;
994 } 1020 }
995 1021
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 582f5ea4e84e..a4128e19338a 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -117,6 +117,10 @@ lpfc_sli_iocb_cmd_type(uint8_t iocb_cmnd)
117 case CMD_FCP_IREAD_CX: 117 case CMD_FCP_IREAD_CX:
118 case CMD_FCP_ICMND_CR: 118 case CMD_FCP_ICMND_CR:
119 case CMD_FCP_ICMND_CX: 119 case CMD_FCP_ICMND_CX:
120 case CMD_FCP_TSEND_CX:
121 case CMD_FCP_TRSP_CX:
122 case CMD_FCP_TRECEIVE_CX:
123 case CMD_FCP_AUTO_TRSP_CX:
120 case CMD_ADAPTER_MSG: 124 case CMD_ADAPTER_MSG:
121 case CMD_ADAPTER_DUMP: 125 case CMD_ADAPTER_DUMP:
122 case CMD_XMIT_SEQUENCE64_CR: 126 case CMD_XMIT_SEQUENCE64_CR:
@@ -131,6 +135,9 @@ lpfc_sli_iocb_cmd_type(uint8_t iocb_cmnd)
131 case CMD_FCP_IREAD64_CX: 135 case CMD_FCP_IREAD64_CX:
132 case CMD_FCP_ICMND64_CR: 136 case CMD_FCP_ICMND64_CR:
133 case CMD_FCP_ICMND64_CX: 137 case CMD_FCP_ICMND64_CX:
138 case CMD_FCP_TSEND64_CX:
139 case CMD_FCP_TRSP64_CX:
140 case CMD_FCP_TRECEIVE64_CX:
134 case CMD_GEN_REQUEST64_CR: 141 case CMD_GEN_REQUEST64_CR:
135 case CMD_GEN_REQUEST64_CX: 142 case CMD_GEN_REQUEST64_CX:
136 case CMD_XMIT_ELS_RSP64_CX: 143 case CMD_XMIT_ELS_RSP64_CX:
@@ -1098,6 +1105,7 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba * phba,
1098 lpfc_sli_pcimem_bcopy((uint32_t *) entry, 1105 lpfc_sli_pcimem_bcopy((uint32_t *) entry,
1099 (uint32_t *) &rspiocbq.iocb, 1106 (uint32_t *) &rspiocbq.iocb,
1100 sizeof (IOCB_t)); 1107 sizeof (IOCB_t));
1108 INIT_LIST_HEAD(&(rspiocbq.list));
1101 irsp = &rspiocbq.iocb; 1109 irsp = &rspiocbq.iocb;
1102 1110
1103 type = lpfc_sli_iocb_cmd_type(irsp->ulpCommand & CMD_IOCB_MASK); 1111 type = lpfc_sli_iocb_cmd_type(irsp->ulpCommand & CMD_IOCB_MASK);
@@ -1149,6 +1157,11 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba * phba,
1149 } 1157 }
1150 } 1158 }
1151 break; 1159 break;
1160 case LPFC_UNSOL_IOCB:
1161 spin_unlock_irqrestore(phba->host->host_lock, iflag);
1162 lpfc_sli_process_unsol_iocb(phba, pring, &rspiocbq);
1163 spin_lock_irqsave(phba->host->host_lock, iflag);
1164 break;
1152 default: 1165 default:
1153 if (irsp->ulpCommand == CMD_ADAPTER_MSG) { 1166 if (irsp->ulpCommand == CMD_ADAPTER_MSG) {
1154 char adaptermsg[LPFC_MAX_ADPTMSG]; 1167 char adaptermsg[LPFC_MAX_ADPTMSG];
@@ -2472,13 +2485,17 @@ lpfc_extra_ring_setup( struct lpfc_hba *phba)
2472 psli = &phba->sli; 2485 psli = &phba->sli;
2473 2486
2474 /* Adjust cmd/rsp ring iocb entries more evenly */ 2487 /* Adjust cmd/rsp ring iocb entries more evenly */
2488
2489 /* Take some away from the FCP ring */
2475 pring = &psli->ring[psli->fcp_ring]; 2490 pring = &psli->ring[psli->fcp_ring];
2476 pring->numCiocb -= SLI2_IOCB_CMD_R1XTRA_ENTRIES; 2491 pring->numCiocb -= SLI2_IOCB_CMD_R1XTRA_ENTRIES;
2477 pring->numRiocb -= SLI2_IOCB_RSP_R1XTRA_ENTRIES; 2492 pring->numRiocb -= SLI2_IOCB_RSP_R1XTRA_ENTRIES;
2478 pring->numCiocb -= SLI2_IOCB_CMD_R3XTRA_ENTRIES; 2493 pring->numCiocb -= SLI2_IOCB_CMD_R3XTRA_ENTRIES;
2479 pring->numRiocb -= SLI2_IOCB_RSP_R3XTRA_ENTRIES; 2494 pring->numRiocb -= SLI2_IOCB_RSP_R3XTRA_ENTRIES;
2480 2495
2481 pring = &psli->ring[1]; 2496 /* and give them to the extra ring */
2497 pring = &psli->ring[psli->extra_ring];
2498
2482 pring->numCiocb += SLI2_IOCB_CMD_R1XTRA_ENTRIES; 2499 pring->numCiocb += SLI2_IOCB_CMD_R1XTRA_ENTRIES;
2483 pring->numRiocb += SLI2_IOCB_RSP_R1XTRA_ENTRIES; 2500 pring->numRiocb += SLI2_IOCB_RSP_R1XTRA_ENTRIES;
2484 pring->numCiocb += SLI2_IOCB_CMD_R3XTRA_ENTRIES; 2501 pring->numCiocb += SLI2_IOCB_CMD_R3XTRA_ENTRIES;
@@ -2488,8 +2505,8 @@ lpfc_extra_ring_setup( struct lpfc_hba *phba)
2488 pring->iotag_max = 4096; 2505 pring->iotag_max = 4096;
2489 pring->num_mask = 1; 2506 pring->num_mask = 1;
2490 pring->prt[0].profile = 0; /* Mask 0 */ 2507 pring->prt[0].profile = 0; /* Mask 0 */
2491 pring->prt[0].rctl = FC_UNSOL_DATA; 2508 pring->prt[0].rctl = phba->cfg_multi_ring_rctl;
2492 pring->prt[0].type = 5; 2509 pring->prt[0].type = phba->cfg_multi_ring_type;
2493 pring->prt[0].lpfc_sli_rcv_unsol_event = NULL; 2510 pring->prt[0].lpfc_sli_rcv_unsol_event = NULL;
2494 return 0; 2511 return 0;
2495} 2512}
@@ -2505,7 +2522,7 @@ lpfc_sli_setup(struct lpfc_hba *phba)
2505 psli->sli_flag = 0; 2522 psli->sli_flag = 0;
2506 psli->fcp_ring = LPFC_FCP_RING; 2523 psli->fcp_ring = LPFC_FCP_RING;
2507 psli->next_ring = LPFC_FCP_NEXT_RING; 2524 psli->next_ring = LPFC_FCP_NEXT_RING;
2508 psli->ip_ring = LPFC_IP_RING; 2525 psli->extra_ring = LPFC_EXTRA_RING;
2509 2526
2510 psli->iocbq_lookup = NULL; 2527 psli->iocbq_lookup = NULL;
2511 psli->iocbq_lookup_len = 0; 2528 psli->iocbq_lookup_len = 0;
@@ -2528,7 +2545,7 @@ lpfc_sli_setup(struct lpfc_hba *phba)
2528 pring->fast_iotag = pring->iotag_max; 2545 pring->fast_iotag = pring->iotag_max;
2529 pring->num_mask = 0; 2546 pring->num_mask = 0;
2530 break; 2547 break;
2531 case LPFC_IP_RING: /* ring 1 - IP */ 2548 case LPFC_EXTRA_RING: /* ring 1 - EXTRA */
2532 /* numCiocb and numRiocb are used in config_port */ 2549 /* numCiocb and numRiocb are used in config_port */
2533 pring->numCiocb = SLI2_IOCB_CMD_R1_ENTRIES; 2550 pring->numCiocb = SLI2_IOCB_CMD_R1_ENTRIES;
2534 pring->numRiocb = SLI2_IOCB_RSP_R1_ENTRIES; 2551 pring->numRiocb = SLI2_IOCB_RSP_R1_ENTRIES;
@@ -3238,6 +3255,21 @@ lpfc_intr_handler(int irq, void *dev_id)
3238 lpfc_sli_handle_fast_ring_event(phba, 3255 lpfc_sli_handle_fast_ring_event(phba,
3239 &phba->sli.ring[LPFC_FCP_RING], 3256 &phba->sli.ring[LPFC_FCP_RING],
3240 status); 3257 status);
3258
3259 if (phba->cfg_multi_ring_support == 2) {
3260 /*
3261 * Process all events on extra ring. Take the optimized path
3262 * for extra ring IO. Any other IO is slow path and is handled
3263 * by the worker thread.
3264 */
3265 status = (ha_copy & (HA_RXMASK << (4*LPFC_EXTRA_RING)));
3266 status >>= (4*LPFC_EXTRA_RING);
3267 if (status & HA_RXATT) {
3268 lpfc_sli_handle_fast_ring_event(phba,
3269 &phba->sli.ring[LPFC_EXTRA_RING],
3270 status);
3271 }
3272 }
3241 return IRQ_HANDLED; 3273 return IRQ_HANDLED;
3242 3274
3243} /* lpfc_intr_handler */ 3275} /* lpfc_intr_handler */
diff --git a/drivers/scsi/lpfc/lpfc_sli.h b/drivers/scsi/lpfc/lpfc_sli.h
index e26de6809358..a43549959dc7 100644
--- a/drivers/scsi/lpfc/lpfc_sli.h
+++ b/drivers/scsi/lpfc/lpfc_sli.h
@@ -198,7 +198,7 @@ struct lpfc_sli {
198 int fcp_ring; /* ring used for FCP initiator commands */ 198 int fcp_ring; /* ring used for FCP initiator commands */
199 int next_ring; 199 int next_ring;
200 200
201 int ip_ring; /* ring used for IP network drv cmds */ 201 int extra_ring; /* extra ring used for other protocols */
202 202
203 struct lpfc_sli_stat slistat; /* SLI statistical info */ 203 struct lpfc_sli_stat slistat; /* SLI statistical info */
204 struct list_head mboxq; 204 struct list_head mboxq;
diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h
index ac417908b407..a61ef3d1e7f1 100644
--- a/drivers/scsi/lpfc/lpfc_version.h
+++ b/drivers/scsi/lpfc/lpfc_version.h
@@ -18,7 +18,7 @@
18 * included with this package. * 18 * included with this package. *
19 *******************************************************************/ 19 *******************************************************************/
20 20
21#define LPFC_DRIVER_VERSION "8.1.10" 21#define LPFC_DRIVER_VERSION "8.1.11"
22 22
23#define LPFC_DRIVER_NAME "lpfc" 23#define LPFC_DRIVER_NAME "lpfc"
24 24