aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bfa
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/bfa')
-rw-r--r--drivers/scsi/bfa/bfa_fcs.c32
-rw-r--r--drivers/scsi/bfa/bfa_fcs.h2
-rw-r--r--drivers/scsi/bfa/bfa_ioc.h4
-rw-r--r--drivers/scsi/bfa/bfad.c36
-rw-r--r--drivers/scsi/bfa/bfad_attr.c48
-rw-r--r--drivers/scsi/bfa/bfad_im.c19
6 files changed, 101 insertions, 40 deletions
diff --git a/drivers/scsi/bfa/bfa_fcs.c b/drivers/scsi/bfa/bfa_fcs.c
index 6c8a27e78974..b9f9e15a02a1 100644
--- a/drivers/scsi/bfa/bfa_fcs.c
+++ b/drivers/scsi/bfa/bfa_fcs.c
@@ -92,25 +92,49 @@ bfa_fcs_attach(struct bfa_fcs_s *fcs, struct bfa_s *bfa, struct bfad_s *bfad,
92void 92void
93bfa_fcs_init(struct bfa_fcs_s *fcs) 93bfa_fcs_init(struct bfa_fcs_s *fcs)
94{ 94{
95 int i, npbc_vports; 95 int i;
96 struct bfa_fcs_mod_s *mod; 96 struct bfa_fcs_mod_s *mod;
97 struct bfi_pbc_vport_s pbc_vports[BFI_PBC_MAX_VPORTS];
98 97
99 for (i = 0; i < sizeof(fcs_modules) / sizeof(fcs_modules[0]); i++) { 98 for (i = 0; i < sizeof(fcs_modules) / sizeof(fcs_modules[0]); i++) {
100 mod = &fcs_modules[i]; 99 mod = &fcs_modules[i];
101 if (mod->modinit) 100 if (mod->modinit)
102 mod->modinit(fcs); 101 mod->modinit(fcs);
103 } 102 }
103}
104
105/*
106 * FCS update cfg - reset the pwwn/nwwn of fabric base logical port
107 * with values learned during bfa_init firmware GETATTR REQ.
108 */
109void
110bfa_fcs_update_cfg(struct bfa_fcs_s *fcs)
111{
112 struct bfa_fcs_fabric_s *fabric = &fcs->fabric;
113 struct bfa_lport_cfg_s *port_cfg = &fabric->bport.port_cfg;
114 struct bfa_ioc_s *ioc = &fabric->fcs->bfa->ioc;
115
116 port_cfg->nwwn = ioc->attr->nwwn;
117 port_cfg->pwwn = ioc->attr->pwwn;
118}
119
120/*
121 * fcs pbc vport initialization
122 */
123void
124bfa_fcs_pbc_vport_init(struct bfa_fcs_s *fcs)
125{
126 int i, npbc_vports;
127 struct bfi_pbc_vport_s pbc_vports[BFI_PBC_MAX_VPORTS];
128
104 /* Initialize pbc vports */ 129 /* Initialize pbc vports */
105 if (!fcs->min_cfg) { 130 if (!fcs->min_cfg) {
106 npbc_vports = 131 npbc_vports =
107 bfa_iocfc_get_pbc_vports(fcs->bfa, pbc_vports); 132 bfa_iocfc_get_pbc_vports(fcs->bfa, pbc_vports);
108 for (i = 0; i < npbc_vports; i++) 133 for (i = 0; i < npbc_vports; i++)
109 bfa_fcb_pbc_vport_create(fcs->bfa->bfad, pbc_vports[i]); 134 bfa_fcb_pbc_vport_create(fcs->bfa->bfad, pbc_vports[i]);
110 } 135 }
111} 136}
112 137
113
114/* 138/*
115 * brief 139 * brief
116 * FCS driver details initialization. 140 * FCS driver details initialization.
diff --git a/drivers/scsi/bfa/bfa_fcs.h b/drivers/scsi/bfa/bfa_fcs.h
index 4cfd2e949ce2..c418c31a490c 100644
--- a/drivers/scsi/bfa/bfa_fcs.h
+++ b/drivers/scsi/bfa/bfa_fcs.h
@@ -721,6 +721,8 @@ void bfa_fcs_attach(struct bfa_fcs_s *fcs, struct bfa_s *bfa,
721 struct bfad_s *bfad, 721 struct bfad_s *bfad,
722 bfa_boolean_t min_cfg); 722 bfa_boolean_t min_cfg);
723void bfa_fcs_init(struct bfa_fcs_s *fcs); 723void bfa_fcs_init(struct bfa_fcs_s *fcs);
724void bfa_fcs_pbc_vport_init(struct bfa_fcs_s *fcs);
725void bfa_fcs_update_cfg(struct bfa_fcs_s *fcs);
724void bfa_fcs_driver_info_init(struct bfa_fcs_s *fcs, 726void bfa_fcs_driver_info_init(struct bfa_fcs_s *fcs,
725 struct bfa_fcs_driver_info_s *driver_info); 727 struct bfa_fcs_driver_info_s *driver_info);
726void bfa_fcs_exit(struct bfa_fcs_s *fcs); 728void bfa_fcs_exit(struct bfa_fcs_s *fcs);
diff --git a/drivers/scsi/bfa/bfa_ioc.h b/drivers/scsi/bfa/bfa_ioc.h
index 527e613530e3..c717b2035573 100644
--- a/drivers/scsi/bfa/bfa_ioc.h
+++ b/drivers/scsi/bfa/bfa_ioc.h
@@ -287,8 +287,8 @@ struct bfa_ioc_hwif_s {
287#define bfa_ioc_portid(__ioc) ((__ioc)->port_id) 287#define bfa_ioc_portid(__ioc) ((__ioc)->port_id)
288#define bfa_ioc_asic_gen(__ioc) ((__ioc)->asic_gen) 288#define bfa_ioc_asic_gen(__ioc) ((__ioc)->asic_gen)
289#define bfa_ioc_is_cna(__ioc) \ 289#define bfa_ioc_is_cna(__ioc) \
290 ((bfa_ioc_get_type(ioc) == BFA_IOC_TYPE_FCoE) || \ 290 ((bfa_ioc_get_type(__ioc) == BFA_IOC_TYPE_FCoE) || \
291 (bfa_ioc_get_type(ioc) == BFA_IOC_TYPE_LL)) 291 (bfa_ioc_get_type(__ioc) == BFA_IOC_TYPE_LL))
292#define bfa_ioc_fetch_stats(__ioc, __stats) \ 292#define bfa_ioc_fetch_stats(__ioc, __stats) \
293 (((__stats)->drv_stats) = (__ioc)->stats) 293 (((__stats)->drv_stats) = (__ioc)->stats)
294#define bfa_ioc_clr_stats(__ioc) \ 294#define bfa_ioc_clr_stats(__ioc) \
diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c
index cdf84f67f0c2..0db583c50ba2 100644
--- a/drivers/scsi/bfa/bfad.c
+++ b/drivers/scsi/bfa/bfad.c
@@ -915,12 +915,29 @@ bfad_drv_init(struct bfad_s *bfad)
915 bfa_fcs_attach(&bfad->bfa_fcs, &bfad->bfa, bfad, BFA_FALSE); 915 bfa_fcs_attach(&bfad->bfa_fcs, &bfad->bfa, bfad, BFA_FALSE);
916 bfad->bfa_fcs.fdmi_enabled = fdmi_enable; 916 bfad->bfa_fcs.fdmi_enabled = fdmi_enable;
917 bfad->bfa_fcs.bbscn_enabled = fc_credit_recovery; 917 bfad->bfa_fcs.bbscn_enabled = fc_credit_recovery;
918 bfa_fcs_init(&bfad->bfa_fcs);
918 spin_unlock_irqrestore(&bfad->bfad_lock, flags); 919 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
919 920
920 bfad->bfad_flags |= BFAD_DRV_INIT_DONE; 921 bfad->bfad_flags |= BFAD_DRV_INIT_DONE;
921 922
923 /* configure base port */
924 rc = bfad_cfg_pport(bfad, BFA_LPORT_ROLE_FCP_IM);
925 if (rc != BFA_STATUS_OK)
926 goto out_cfg_pport_fail;
927
922 return BFA_STATUS_OK; 928 return BFA_STATUS_OK;
923 929
930out_cfg_pport_fail:
931 /* fcs exit - on cfg pport failure */
932 spin_lock_irqsave(&bfad->bfad_lock, flags);
933 init_completion(&bfad->comp);
934 bfad->pport.flags |= BFAD_PORT_DELETE;
935 bfa_fcs_exit(&bfad->bfa_fcs);
936 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
937 wait_for_completion(&bfad->comp);
938 /* bfa detach - free hal memory */
939 bfa_detach(&bfad->bfa);
940 bfad_hal_mem_release(bfad);
924out_hal_mem_alloc_failure: 941out_hal_mem_alloc_failure:
925 return BFA_STATUS_FAILED; 942 return BFA_STATUS_FAILED;
926} 943}
@@ -952,6 +969,7 @@ bfad_drv_start(struct bfad_s *bfad)
952 969
953 spin_lock_irqsave(&bfad->bfad_lock, flags); 970 spin_lock_irqsave(&bfad->bfad_lock, flags);
954 bfa_iocfc_start(&bfad->bfa); 971 bfa_iocfc_start(&bfad->bfa);
972 bfa_fcs_pbc_vport_init(&bfad->bfa_fcs);
955 bfa_fcs_fabric_modstart(&bfad->bfa_fcs); 973 bfa_fcs_fabric_modstart(&bfad->bfa_fcs);
956 bfad->bfad_flags |= BFAD_HAL_START_DONE; 974 bfad->bfad_flags |= BFAD_HAL_START_DONE;
957 spin_unlock_irqrestore(&bfad->bfad_lock, flags); 975 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
@@ -1056,19 +1074,19 @@ bfad_start_ops(struct bfad_s *bfad) {
1056 strncpy(driver_info.os_device_name, bfad->pci_name, 1074 strncpy(driver_info.os_device_name, bfad->pci_name,
1057 sizeof(driver_info.os_device_name - 1)); 1075 sizeof(driver_info.os_device_name - 1));
1058 1076
1059 /* FCS INIT */ 1077 /* FCS driver info init */
1060 spin_lock_irqsave(&bfad->bfad_lock, flags); 1078 spin_lock_irqsave(&bfad->bfad_lock, flags);
1061 bfa_fcs_driver_info_init(&bfad->bfa_fcs, &driver_info); 1079 bfa_fcs_driver_info_init(&bfad->bfa_fcs, &driver_info);
1062 bfa_fcs_init(&bfad->bfa_fcs);
1063 spin_unlock_irqrestore(&bfad->bfad_lock, flags); 1080 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
1064 1081
1065 retval = bfad_cfg_pport(bfad, BFA_LPORT_ROLE_FCP_IM); 1082 /*
1066 if (retval != BFA_STATUS_OK) { 1083 * FCS update cfg - reset the pwwn/nwwn of fabric base logical port
1067 if (bfa_sm_cmp_state(bfad, bfad_sm_initializing)) 1084 * with values learned during bfa_init firmware GETATTR REQ.
1068 bfa_sm_set_state(bfad, bfad_sm_failed); 1085 */
1069 bfad_stop(bfad); 1086 bfa_fcs_update_cfg(&bfad->bfa_fcs);
1070 return BFA_STATUS_FAILED; 1087
1071 } 1088 /* Setup fc host fixed attribute if the lk supports */
1089 bfad_fc_host_init(bfad->pport.im_port);
1072 1090
1073 /* BFAD level FC4 IM specific resource allocation */ 1091 /* BFAD level FC4 IM specific resource allocation */
1074 retval = bfad_im_probe(bfad); 1092 retval = bfad_im_probe(bfad);
diff --git a/drivers/scsi/bfa/bfad_attr.c b/drivers/scsi/bfa/bfad_attr.c
index 3127df2951e6..97391cc727b3 100644
--- a/drivers/scsi/bfa/bfad_attr.c
+++ b/drivers/scsi/bfa/bfad_attr.c
@@ -677,8 +677,10 @@ bfad_im_model_desc_show(struct device *dev, struct device_attribute *attr,
677 struct bfad_s *bfad = im_port->bfad; 677 struct bfad_s *bfad = im_port->bfad;
678 char model[BFA_ADAPTER_MODEL_NAME_LEN]; 678 char model[BFA_ADAPTER_MODEL_NAME_LEN];
679 char model_descr[BFA_ADAPTER_MODEL_DESCR_LEN]; 679 char model_descr[BFA_ADAPTER_MODEL_DESCR_LEN];
680 int nports = 0;
680 681
681 bfa_get_adapter_model(&bfad->bfa, model); 682 bfa_get_adapter_model(&bfad->bfa, model);
683 nports = bfa_get_nports(&bfad->bfa);
682 if (!strcmp(model, "Brocade-425")) 684 if (!strcmp(model, "Brocade-425"))
683 snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN, 685 snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
684 "Brocade 4Gbps PCIe dual port FC HBA"); 686 "Brocade 4Gbps PCIe dual port FC HBA");
@@ -687,10 +689,10 @@ bfad_im_model_desc_show(struct device *dev, struct device_attribute *attr,
687 "Brocade 8Gbps PCIe dual port FC HBA"); 689 "Brocade 8Gbps PCIe dual port FC HBA");
688 else if (!strcmp(model, "Brocade-42B")) 690 else if (!strcmp(model, "Brocade-42B"))
689 snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN, 691 snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
690 "HP 4Gbps PCIe dual port FC HBA"); 692 "Brocade 4Gbps PCIe dual port FC HBA for HP");
691 else if (!strcmp(model, "Brocade-82B")) 693 else if (!strcmp(model, "Brocade-82B"))
692 snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN, 694 snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
693 "HP 8Gbps PCIe dual port FC HBA"); 695 "Brocade 8Gbps PCIe dual port FC HBA for HP");
694 else if (!strcmp(model, "Brocade-1010")) 696 else if (!strcmp(model, "Brocade-1010"))
695 snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN, 697 snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
696 "Brocade 10Gbps single port CNA"); 698 "Brocade 10Gbps single port CNA");
@@ -699,7 +701,7 @@ bfad_im_model_desc_show(struct device *dev, struct device_attribute *attr,
699 "Brocade 10Gbps dual port CNA"); 701 "Brocade 10Gbps dual port CNA");
700 else if (!strcmp(model, "Brocade-1007")) 702 else if (!strcmp(model, "Brocade-1007"))
701 snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN, 703 snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
702 "Brocade 10Gbps CNA"); 704 "Brocade 10Gbps CNA for IBM Blade Center");
703 else if (!strcmp(model, "Brocade-415")) 705 else if (!strcmp(model, "Brocade-415"))
704 snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN, 706 snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
705 "Brocade 4Gbps PCIe single port FC HBA"); 707 "Brocade 4Gbps PCIe single port FC HBA");
@@ -708,17 +710,45 @@ bfad_im_model_desc_show(struct device *dev, struct device_attribute *attr,
708 "Brocade 8Gbps PCIe single port FC HBA"); 710 "Brocade 8Gbps PCIe single port FC HBA");
709 else if (!strcmp(model, "Brocade-41B")) 711 else if (!strcmp(model, "Brocade-41B"))
710 snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN, 712 snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
711 "HP 4Gbps PCIe single port FC HBA"); 713 "Brocade 4Gbps PCIe single port FC HBA for HP");
712 else if (!strcmp(model, "Brocade-81B")) 714 else if (!strcmp(model, "Brocade-81B"))
713 snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN, 715 snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
714 "HP 8Gbps PCIe single port FC HBA"); 716 "Brocade 8Gbps PCIe single port FC HBA for HP");
715 else if (!strcmp(model, "Brocade-804")) 717 else if (!strcmp(model, "Brocade-804"))
716 snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN, 718 snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
717 "HP Bladesystem C-class 8Gbps FC HBA"); 719 "Brocade 8Gbps FC HBA for HP Bladesystem C-class");
718 else if (!strcmp(model, "Brocade-902")) 720 else if (!strcmp(model, "Brocade-902") ||
721 !strcmp(model, "Brocade-1741"))
719 snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN, 722 snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
720 "Brocade 10Gbps CNA"); 723 "Brocade 10Gbps CNA for Dell M-Series Blade Servers");
721 else 724 else if (strstr(model, "Brocade-1560")) {
725 if (nports == 1)
726 snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
727 "Brocade 16Gbps PCIe single port FC HBA");
728 else
729 snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
730 "Brocade 16Gbps PCIe dual port FC HBA");
731 } else if (strstr(model, "Brocade-1710")) {
732 if (nports == 1)
733 snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
734 "Brocade 10Gbps single port CNA");
735 else
736 snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
737 "Brocade 10Gbps dual port CNA");
738 } else if (strstr(model, "Brocade-1860")) {
739 if (nports == 1 && bfa_ioc_is_cna(&bfad->bfa.ioc))
740 snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
741 "Brocade 10Gbps single port CNA");
742 else if (nports == 1 && !bfa_ioc_is_cna(&bfad->bfa.ioc))
743 snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
744 "Brocade 16Gbps PCIe single port FC HBA");
745 else if (nports == 2 && bfa_ioc_is_cna(&bfad->bfa.ioc))
746 snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
747 "Brocade 10Gbps dual port CNA");
748 else if (nports == 2 && !bfa_ioc_is_cna(&bfad->bfa.ioc))
749 snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
750 "Brocade 16Gbps PCIe dual port FC HBA");
751 } else
722 snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN, 752 snprintf(model_descr, BFA_ADAPTER_MODEL_DESCR_LEN,
723 "Invalid Model"); 753 "Invalid Model");
724 754
diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c
index 451ff556625d..06cd113f890a 100644
--- a/drivers/scsi/bfa/bfad_im.c
+++ b/drivers/scsi/bfa/bfad_im.c
@@ -175,21 +175,11 @@ bfad_im_info(struct Scsi_Host *shost)
175 struct bfad_im_port_s *im_port = 175 struct bfad_im_port_s *im_port =
176 (struct bfad_im_port_s *) shost->hostdata[0]; 176 (struct bfad_im_port_s *) shost->hostdata[0];
177 struct bfad_s *bfad = im_port->bfad; 177 struct bfad_s *bfad = im_port->bfad;
178 struct bfa_s *bfa = &bfad->bfa;
179 struct bfa_ioc_s *ioc = &bfa->ioc;
180 char model[BFA_ADAPTER_MODEL_NAME_LEN];
181
182 bfa_get_adapter_model(bfa, model);
183 178
184 memset(bfa_buf, 0, sizeof(bfa_buf)); 179 memset(bfa_buf, 0, sizeof(bfa_buf));
185 if (bfa_ioc_is_cna(ioc)) 180 snprintf(bfa_buf, sizeof(bfa_buf),
186 snprintf(bfa_buf, sizeof(bfa_buf), 181 "Brocade FC/FCOE Adapter, " "hwpath: %s driver: %s",
187 "Brocade FCOE Adapter, " "model: %s hwpath: %s driver: %s", 182 bfad->pci_name, BFAD_DRIVER_VERSION);
188 model, bfad->pci_name, BFAD_DRIVER_VERSION);
189 else
190 snprintf(bfa_buf, sizeof(bfa_buf),
191 "Brocade FC Adapter, " "model: %s hwpath: %s driver: %s",
192 model, bfad->pci_name, BFAD_DRIVER_VERSION);
193 183
194 return bfa_buf; 184 return bfa_buf;
195} 185}
@@ -572,9 +562,6 @@ bfad_im_scsi_host_alloc(struct bfad_s *bfad, struct bfad_im_port_s *im_port,
572 goto out_fc_rel; 562 goto out_fc_rel;
573 } 563 }
574 564
575 /* setup host fixed attribute if the lk supports */
576 bfad_fc_host_init(im_port);
577
578 return 0; 565 return 0;
579 566
580out_fc_rel: 567out_fc_rel: