aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bfa
diff options
context:
space:
mode:
authorJing Huang <huangj@brocade.com>2010-07-08 22:48:12 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-07-27 13:04:06 -0400
commit15b64a835def4c784c6e62ad762677f5cb56eba2 (patch)
tree0d6ca06f6472c2bb71d254dbbc255ea6f18f8988 /drivers/scsi/bfa
parent1769f990fc182695bc215ce4369688064addcd1e (diff)
[SCSI] bfa: ioc attributes fix
This patch fixes the APIs to obtain ioc attributes - fix API to obtain wwpn, wwnn, and mac. - add API to get mfg wwpn, wwnn, and mac. - fix API to obtain wwn of boot target. Signed-off-by: Jing Huang <huangj@brocade.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/bfa')
-rw-r--r--drivers/scsi/bfa/bfa_fcport.c3
-rw-r--r--drivers/scsi/bfa/bfa_ioc.c58
-rw-r--r--drivers/scsi/bfa/bfa_ioc.h3
-rw-r--r--drivers/scsi/bfa/bfa_iocfc.c18
-rw-r--r--drivers/scsi/bfa/bfa_iocfc.h2
-rw-r--r--drivers/scsi/bfa/bfad_im.c8
-rw-r--r--drivers/scsi/bfa/fabric.c16
-rw-r--r--drivers/scsi/bfa/fcs_fabric.h2
-rw-r--r--drivers/scsi/bfa/include/bfi/bfi_ioc.h19
-rw-r--r--drivers/scsi/bfa/ns.c4
10 files changed, 86 insertions, 47 deletions
diff --git a/drivers/scsi/bfa/bfa_fcport.c b/drivers/scsi/bfa/bfa_fcport.c
index 4961b8da9127..d28b721acaf8 100644
--- a/drivers/scsi/bfa/bfa_fcport.c
+++ b/drivers/scsi/bfa/bfa_fcport.c
@@ -1569,6 +1569,9 @@ bfa_fcport_get_attr(struct bfa_s *bfa, struct bfa_pport_attr_s *attr)
1569 attr->nwwn = fcport->nwwn; 1569 attr->nwwn = fcport->nwwn;
1570 attr->pwwn = fcport->pwwn; 1570 attr->pwwn = fcport->pwwn;
1571 1571
1572 attr->factorypwwn = bfa_ioc_get_mfg_pwwn(&bfa->ioc);
1573 attr->factorynwwn = bfa_ioc_get_mfg_nwwn(&bfa->ioc);
1574
1572 bfa_os_memcpy(&attr->pport_cfg, &fcport->cfg, 1575 bfa_os_memcpy(&attr->pport_cfg, &fcport->cfg,
1573 sizeof(struct bfa_pport_cfg_s)); 1576 sizeof(struct bfa_pport_cfg_s));
1574 /* 1577 /*
diff --git a/drivers/scsi/bfa/bfa_ioc.c b/drivers/scsi/bfa/bfa_ioc.c
index 268c071ce673..1600f747eb6c 100644
--- a/drivers/scsi/bfa/bfa_ioc.c
+++ b/drivers/scsi/bfa/bfa_ioc.c
@@ -1838,54 +1838,54 @@ bfa_ioc_get_attr(struct bfa_ioc_s *ioc, struct bfa_ioc_attr_s *ioc_attr)
1838} 1838}
1839 1839
1840/** 1840/**
1841 * hal_wwn_public 1841 * bfa_wwn_public
1842 */ 1842 */
1843wwn_t 1843wwn_t
1844bfa_ioc_get_pwwn(struct bfa_ioc_s *ioc) 1844bfa_ioc_get_pwwn(struct bfa_ioc_s *ioc)
1845{ 1845{
1846 union { 1846 return ioc->attr->pwwn;
1847 wwn_t wwn;
1848 u8 byte[sizeof(wwn_t)];
1849 }
1850 w;
1851
1852 w.wwn = ioc->attr->mfg_wwn;
1853
1854 if (bfa_ioc_portid(ioc) == 1)
1855 w.byte[7]++;
1856
1857 return w.wwn;
1858} 1847}
1859 1848
1860wwn_t 1849wwn_t
1861bfa_ioc_get_nwwn(struct bfa_ioc_s *ioc) 1850bfa_ioc_get_nwwn(struct bfa_ioc_s *ioc)
1862{ 1851{
1863 union { 1852 return ioc->attr->nwwn;
1864 wwn_t wwn;
1865 u8 byte[sizeof(wwn_t)];
1866 }
1867 w;
1868
1869 w.wwn = ioc->attr->mfg_wwn;
1870
1871 if (bfa_ioc_portid(ioc) == 1)
1872 w.byte[7]++;
1873
1874 w.byte[0] = 0x20;
1875
1876 return w.wwn;
1877} 1853}
1878 1854
1879u64 1855u64
1880bfa_ioc_get_adid(struct bfa_ioc_s *ioc) 1856bfa_ioc_get_adid(struct bfa_ioc_s *ioc)
1881{ 1857{
1882 return ioc->attr->mfg_wwn; 1858 return ioc->attr->mfg_pwwn;
1883} 1859}
1884 1860
1885mac_t 1861mac_t
1886bfa_ioc_get_mac(struct bfa_ioc_s *ioc) 1862bfa_ioc_get_mac(struct bfa_ioc_s *ioc)
1887{ 1863{
1888 mac_t mac; 1864 /*
1865 * Currently mfg mac is used as FCoE enode mac (not configured by PBC)
1866 */
1867 if (bfa_ioc_get_type(ioc) == BFA_IOC_TYPE_FCoE)
1868 return bfa_ioc_get_mfg_mac(ioc);
1869 else
1870 return ioc->attr->mac;
1871}
1872
1873wwn_t
1874bfa_ioc_get_mfg_pwwn(struct bfa_ioc_s *ioc)
1875{
1876 return ioc->attr->mfg_pwwn;
1877}
1878
1879wwn_t
1880bfa_ioc_get_mfg_nwwn(struct bfa_ioc_s *ioc)
1881{
1882 return ioc->attr->mfg_nwwn;
1883}
1884
1885mac_t
1886bfa_ioc_get_mfg_mac(struct bfa_ioc_s *ioc)
1887{
1888 mac_t mac;
1889 1889
1890 mac = ioc->attr->mfg_mac; 1890 mac = ioc->attr->mfg_mac;
1891 mac.mac[MAC_ADDRLEN - 1] += bfa_ioc_pcifn(ioc); 1891 mac.mac[MAC_ADDRLEN - 1] += bfa_ioc_pcifn(ioc);
diff --git a/drivers/scsi/bfa/bfa_ioc.h b/drivers/scsi/bfa/bfa_ioc.h
index df15eccd760f..2425c00a72d3 100644
--- a/drivers/scsi/bfa/bfa_ioc.h
+++ b/drivers/scsi/bfa/bfa_ioc.h
@@ -304,6 +304,9 @@ bfa_boolean_t bfa_ioc_fwver_cmp(struct bfa_ioc_s *ioc,
304wwn_t bfa_ioc_get_pwwn(struct bfa_ioc_s *ioc); 304wwn_t bfa_ioc_get_pwwn(struct bfa_ioc_s *ioc);
305wwn_t bfa_ioc_get_nwwn(struct bfa_ioc_s *ioc); 305wwn_t bfa_ioc_get_nwwn(struct bfa_ioc_s *ioc);
306mac_t bfa_ioc_get_mac(struct bfa_ioc_s *ioc); 306mac_t bfa_ioc_get_mac(struct bfa_ioc_s *ioc);
307wwn_t bfa_ioc_get_mfg_pwwn(struct bfa_ioc_s *ioc);
308wwn_t bfa_ioc_get_mfg_nwwn(struct bfa_ioc_s *ioc);
309mac_t bfa_ioc_get_mfg_mac(struct bfa_ioc_s *ioc);
307u64 bfa_ioc_get_adid(struct bfa_ioc_s *ioc); 310u64 bfa_ioc_get_adid(struct bfa_ioc_s *ioc);
308 311
309#endif /* __BFA_IOC_H__ */ 312#endif /* __BFA_IOC_H__ */
diff --git a/drivers/scsi/bfa/bfa_iocfc.c b/drivers/scsi/bfa/bfa_iocfc.c
index d3f1052744d3..6f54bea356c6 100644
--- a/drivers/scsi/bfa/bfa_iocfc.c
+++ b/drivers/scsi/bfa/bfa_iocfc.c
@@ -861,13 +861,23 @@ bfa_iocfc_is_operational(struct bfa_s *bfa)
861 * Return boot target port wwns -- read from boot information in flash. 861 * Return boot target port wwns -- read from boot information in flash.
862 */ 862 */
863void 863void
864bfa_iocfc_get_bootwwns(struct bfa_s *bfa, u8 *nwwns, wwn_t **wwns) 864bfa_iocfc_get_bootwwns(struct bfa_s *bfa, u8 *nwwns, wwn_t *wwns)
865{ 865{
866 struct bfa_iocfc_s *iocfc = &bfa->iocfc; 866 struct bfa_iocfc_s *iocfc = &bfa->iocfc;
867 struct bfi_iocfc_cfgrsp_s *cfgrsp = iocfc->cfgrsp; 867 struct bfi_iocfc_cfgrsp_s *cfgrsp = iocfc->cfgrsp;
868 int i;
869
870 if (cfgrsp->pbc_cfg.boot_enabled && cfgrsp->pbc_cfg.nbluns) {
871 bfa_trc(bfa, cfgrsp->pbc_cfg.nbluns);
872 *nwwns = cfgrsp->pbc_cfg.nbluns;
873 for (i = 0; i < cfgrsp->pbc_cfg.nbluns; i++)
874 wwns[i] = cfgrsp->pbc_cfg.blun[i].tgt_pwwn;
875
876 return;
877 }
868 878
869 *nwwns = cfgrsp->bootwwns.nwwns; 879 *nwwns = cfgrsp->bootwwns.nwwns;
870 *wwns = cfgrsp->bootwwns.wwn; 880 memcpy(wwns, cfgrsp->bootwwns.wwn, sizeof(cfgrsp->bootwwns.wwn));
871} 881}
872 882
873void 883void
diff --git a/drivers/scsi/bfa/bfa_iocfc.h b/drivers/scsi/bfa/bfa_iocfc.h
index a08309fb981d..2b281037fd79 100644
--- a/drivers/scsi/bfa/bfa_iocfc.h
+++ b/drivers/scsi/bfa/bfa_iocfc.h
@@ -167,7 +167,7 @@ void bfa_hwct_msix_getvecs(struct bfa_s *bfa, u32 *vecmap,
167void bfa_com_meminfo(bfa_boolean_t mincfg, u32 *dm_len); 167void bfa_com_meminfo(bfa_boolean_t mincfg, u32 *dm_len);
168void bfa_com_attach(struct bfa_s *bfa, struct bfa_meminfo_s *mi, 168void bfa_com_attach(struct bfa_s *bfa, struct bfa_meminfo_s *mi,
169 bfa_boolean_t mincfg); 169 bfa_boolean_t mincfg);
170void bfa_iocfc_get_bootwwns(struct bfa_s *bfa, u8 *nwwns, wwn_t **wwns); 170void bfa_iocfc_get_bootwwns(struct bfa_s *bfa, u8 *nwwns, wwn_t *wwns);
171void bfa_iocfc_get_pbc_boot_cfg(struct bfa_s *bfa, 171void bfa_iocfc_get_pbc_boot_cfg(struct bfa_s *bfa,
172 struct bfa_boot_pbc_s *pbcfg); 172 struct bfa_boot_pbc_s *pbcfg);
173int bfa_iocfc_get_pbc_vports(struct bfa_s *bfa, 173int bfa_iocfc_get_pbc_vports(struct bfa_s *bfa,
diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c
index 0dff0d4b03c9..943bc4b37284 100644
--- a/drivers/scsi/bfa/bfad_im.c
+++ b/drivers/scsi/bfa/bfad_im.c
@@ -1205,9 +1205,9 @@ int
1205bfad_os_get_linkup_delay(struct bfad_s *bfad) 1205bfad_os_get_linkup_delay(struct bfad_s *bfad)
1206{ 1206{
1207 1207
1208 u8 nwwns = 0; 1208 u8 nwwns = 0;
1209 wwn_t *wwns; 1209 wwn_t wwns[BFA_PREBOOT_BOOTLUN_MAX];
1210 int ldelay; 1210 int ldelay;
1211 1211
1212 /* 1212 /*
1213 * Querying for the boot target port wwns 1213 * Querying for the boot target port wwns
@@ -1216,7 +1216,7 @@ bfad_os_get_linkup_delay(struct bfad_s *bfad)
1216 * else => local boot machine set bfa_linkup_delay = 10 1216 * else => local boot machine set bfa_linkup_delay = 10
1217 */ 1217 */
1218 1218
1219 bfa_iocfc_get_bootwwns(&bfad->bfa, &nwwns, &wwns); 1219 bfa_iocfc_get_bootwwns(&bfad->bfa, &nwwns, wwns);
1220 1220
1221 if (nwwns > 0) { 1221 if (nwwns > 0) {
1222 /* If boot over SAN; linkup_delay = 30sec */ 1222 /* If boot over SAN; linkup_delay = 30sec */
diff --git a/drivers/scsi/bfa/fabric.c b/drivers/scsi/bfa/fabric.c
index 9315383fff8a..c646d6dd789b 100644
--- a/drivers/scsi/bfa/fabric.c
+++ b/drivers/scsi/bfa/fabric.c
@@ -1271,6 +1271,22 @@ bfa_fcs_fabric_set_fabric_name(struct bfa_fcs_fabric_s *fabric,
1271} 1271}
1272 1272
1273/** 1273/**
1274 *
1275 * @param[in] fabric - fabric
1276 * @param[in] node_symname -
1277 * Caller allocated buffer to receive the symbolic name
1278 *
1279 * @return - none
1280 */
1281void
1282bfa_fcs_get_sym_name(const struct bfa_fcs_s *fcs, char *node_symname)
1283{
1284 bfa_os_memcpy(node_symname,
1285 fcs->fabric.bport.port_cfg.sym_name.symname,
1286 BFA_SYMNAME_MAXLEN);
1287}
1288
1289/**
1274 * Not used by FCS. 1290 * Not used by FCS.
1275 */ 1291 */
1276void 1292void
diff --git a/drivers/scsi/bfa/fcs_fabric.h b/drivers/scsi/bfa/fcs_fabric.h
index 244c3f00c50c..ed532db14e86 100644
--- a/drivers/scsi/bfa/fcs_fabric.h
+++ b/drivers/scsi/bfa/fcs_fabric.h
@@ -60,4 +60,6 @@ void bfa_fcs_auth_finished(struct bfa_fcs_fabric_s *fabric,
60 60
61void bfa_fcs_fabric_set_fabric_name(struct bfa_fcs_fabric_s *fabric, 61void bfa_fcs_fabric_set_fabric_name(struct bfa_fcs_fabric_s *fabric,
62 wwn_t fabric_name); 62 wwn_t fabric_name);
63void bfa_fcs_get_sym_name(const struct bfa_fcs_s *fcs, char *node_symname);
64
63#endif /* __FCS_FABRIC_H__ */ 65#endif /* __FCS_FABRIC_H__ */
diff --git a/drivers/scsi/bfa/include/bfi/bfi_ioc.h b/drivers/scsi/bfa/include/bfi/bfi_ioc.h
index 03a9c9408ca5..7c5e6d5716df 100644
--- a/drivers/scsi/bfa/include/bfi/bfi_ioc.h
+++ b/drivers/scsi/bfa/include/bfi/bfi_ioc.h
@@ -48,9 +48,14 @@ struct bfi_ioc_getattr_req_s {
48}; 48};
49 49
50struct bfi_ioc_attr_s { 50struct bfi_ioc_attr_s {
51 wwn_t mfg_wwn; 51 wwn_t mfg_pwwn; /* Mfg port wwn */
52 wwn_t mfg_nwwn; /* Mfg node wwn */
52 mac_t mfg_mac; 53 mac_t mfg_mac;
53 u16 rsvd_a; 54 u16 rsvd_a;
55 wwn_t pwwn;
56 wwn_t nwwn;
57 mac_t mac; /* PBC or Mfg mac */
58 u16 rsvd_b;
54 char brcd_serialnum[STRSZ(BFA_MFG_SERIALNUM_SIZE)]; 59 char brcd_serialnum[STRSZ(BFA_MFG_SERIALNUM_SIZE)];
55 u8 pcie_gen; 60 u8 pcie_gen;
56 u8 pcie_lanes_orig; 61 u8 pcie_lanes_orig;
@@ -58,12 +63,12 @@ struct bfi_ioc_attr_s {
58 u8 rx_bbcredit; /* receive buffer credits */ 63 u8 rx_bbcredit; /* receive buffer credits */
59 u32 adapter_prop; /* adapter properties */ 64 u32 adapter_prop; /* adapter properties */
60 u16 maxfrsize; /* max receive frame size */ 65 u16 maxfrsize; /* max receive frame size */
61 char asic_rev; 66 char asic_rev;
62 u8 rsvd_b; 67 u8 rsvd_c;
63 char fw_version[BFA_VERSION_LEN]; 68 char fw_version[BFA_VERSION_LEN];
64 char optrom_version[BFA_VERSION_LEN]; 69 char optrom_version[BFA_VERSION_LEN];
65 struct bfa_mfg_vpd_s vpd; 70 struct bfa_mfg_vpd_s vpd;
66 uint32_t card_type; /* card type */ 71 u32 card_type; /* card type */
67}; 72};
68 73
69/** 74/**
diff --git a/drivers/scsi/bfa/ns.c b/drivers/scsi/bfa/ns.c
index d20dd7e15742..2d6d2d6ff8dc 100644
--- a/drivers/scsi/bfa/ns.c
+++ b/drivers/scsi/bfa/ns.c
@@ -1228,10 +1228,10 @@ bfa_fcs_port_ns_boot_target_disc(struct bfa_fcs_port_s *port)
1228 1228
1229 struct bfa_fcs_rport_s *rport; 1229 struct bfa_fcs_rport_s *rport;
1230 u8 nwwns; 1230 u8 nwwns;
1231 wwn_t *wwns; 1231 wwn_t wwns[BFA_PREBOOT_BOOTLUN_MAX];
1232 int ii; 1232 int ii;
1233 1233
1234 bfa_iocfc_get_bootwwns(port->fcs->bfa, &nwwns, &wwns); 1234 bfa_iocfc_get_bootwwns(port->fcs->bfa, &nwwns, wwns);
1235 1235
1236 for (ii = 0; ii < nwwns; ++ii) { 1236 for (ii = 0; ii < nwwns; ++ii) {
1237 rport = bfa_fcs_rport_create_by_wwn(port, wwns[ii]); 1237 rport = bfa_fcs_rport_create_by_wwn(port, wwns[ii]);