Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 15b64a83 authored by Jing Huang's avatar Jing Huang Committed by James Bottomley
Browse files

[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: default avatarJing Huang <huangj@brocade.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent 1769f990
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1569,6 +1569,9 @@ bfa_fcport_get_attr(struct bfa_s *bfa, struct bfa_pport_attr_s *attr)
	attr->nwwn = fcport->nwwn;
	attr->pwwn = fcport->pwwn;

	attr->factorypwwn =  bfa_ioc_get_mfg_pwwn(&bfa->ioc);
	attr->factorynwwn =  bfa_ioc_get_mfg_nwwn(&bfa->ioc);

	bfa_os_memcpy(&attr->pport_cfg, &fcport->cfg,
		      sizeof(struct bfa_pport_cfg_s));
	/*
+29 −29
Original line number Diff line number Diff line
@@ -1838,52 +1838,52 @@ bfa_ioc_get_attr(struct bfa_ioc_s *ioc, struct bfa_ioc_attr_s *ioc_attr)
}

/**
 *  hal_wwn_public
 *  bfa_wwn_public
 */
wwn_t
bfa_ioc_get_pwwn(struct bfa_ioc_s *ioc)
{
	union {
		wwn_t           wwn;
		u8         byte[sizeof(wwn_t)];
	}
	w;

	w.wwn = ioc->attr->mfg_wwn;

	if (bfa_ioc_portid(ioc) == 1)
		w.byte[7]++;

	return w.wwn;
	return ioc->attr->pwwn;
}

wwn_t
bfa_ioc_get_nwwn(struct bfa_ioc_s *ioc)
{
	union {
		wwn_t           wwn;
		u8         byte[sizeof(wwn_t)];
	return ioc->attr->nwwn;
}
	w;

	w.wwn = ioc->attr->mfg_wwn;

	if (bfa_ioc_portid(ioc) == 1)
		w.byte[7]++;
u64
bfa_ioc_get_adid(struct bfa_ioc_s *ioc)
{
	return ioc->attr->mfg_pwwn;
}

	w.byte[0] = 0x20;
mac_t
bfa_ioc_get_mac(struct bfa_ioc_s *ioc)
{
	/*
	 * Currently mfg mac is used as FCoE enode mac (not configured by PBC)
	 */
	if (bfa_ioc_get_type(ioc) == BFA_IOC_TYPE_FCoE)
		return bfa_ioc_get_mfg_mac(ioc);
	else
		return ioc->attr->mac;
}

	return w.wwn;
wwn_t
bfa_ioc_get_mfg_pwwn(struct bfa_ioc_s *ioc)
{
	return ioc->attr->mfg_pwwn;
}

u64
bfa_ioc_get_adid(struct bfa_ioc_s *ioc)
wwn_t
bfa_ioc_get_mfg_nwwn(struct bfa_ioc_s *ioc)
{
	return ioc->attr->mfg_wwn;
	return ioc->attr->mfg_nwwn;
}

mac_t
bfa_ioc_get_mac(struct bfa_ioc_s *ioc)
bfa_ioc_get_mfg_mac(struct bfa_ioc_s *ioc)
{
	mac_t   mac;

+3 −0
Original line number Diff line number Diff line
@@ -304,6 +304,9 @@ bfa_boolean_t bfa_ioc_fwver_cmp(struct bfa_ioc_s *ioc,
wwn_t bfa_ioc_get_pwwn(struct bfa_ioc_s *ioc);
wwn_t bfa_ioc_get_nwwn(struct bfa_ioc_s *ioc);
mac_t bfa_ioc_get_mac(struct bfa_ioc_s *ioc);
wwn_t bfa_ioc_get_mfg_pwwn(struct bfa_ioc_s *ioc);
wwn_t bfa_ioc_get_mfg_nwwn(struct bfa_ioc_s *ioc);
mac_t bfa_ioc_get_mfg_mac(struct bfa_ioc_s *ioc);
u64 bfa_ioc_get_adid(struct bfa_ioc_s *ioc);

#endif /* __BFA_IOC_H__ */
+14 −4
Original line number Diff line number Diff line
@@ -861,13 +861,23 @@ bfa_iocfc_is_operational(struct bfa_s *bfa)
 * Return boot target port wwns -- read from boot information in flash.
 */
void
bfa_iocfc_get_bootwwns(struct bfa_s *bfa, u8 *nwwns, wwn_t **wwns)
bfa_iocfc_get_bootwwns(struct bfa_s *bfa, u8 *nwwns, wwn_t *wwns)
{
	struct bfa_iocfc_s *iocfc = &bfa->iocfc;
	struct bfi_iocfc_cfgrsp_s *cfgrsp = iocfc->cfgrsp;
	int i;

	if (cfgrsp->pbc_cfg.boot_enabled && cfgrsp->pbc_cfg.nbluns) {
		bfa_trc(bfa, cfgrsp->pbc_cfg.nbluns);
		*nwwns = cfgrsp->pbc_cfg.nbluns;
		for (i = 0; i < cfgrsp->pbc_cfg.nbluns; i++)
			wwns[i] = cfgrsp->pbc_cfg.blun[i].tgt_pwwn;

		return;
	}

	*nwwns = cfgrsp->bootwwns.nwwns;
	*wwns = cfgrsp->bootwwns.wwn;
	memcpy(wwns, cfgrsp->bootwwns.wwn, sizeof(cfgrsp->bootwwns.wwn));
}

void
+1 −1
Original line number Diff line number Diff line
@@ -167,7 +167,7 @@ void bfa_hwct_msix_getvecs(struct bfa_s *bfa, u32 *vecmap,
void bfa_com_meminfo(bfa_boolean_t mincfg, u32 *dm_len);
void bfa_com_attach(struct bfa_s *bfa, struct bfa_meminfo_s *mi,
		bfa_boolean_t mincfg);
void bfa_iocfc_get_bootwwns(struct bfa_s *bfa, u8 *nwwns, wwn_t **wwns);
void bfa_iocfc_get_bootwwns(struct bfa_s *bfa, u8 *nwwns, wwn_t *wwns);
void bfa_iocfc_get_pbc_boot_cfg(struct bfa_s *bfa,
		struct bfa_boot_pbc_s *pbcfg);
int bfa_iocfc_get_pbc_vports(struct bfa_s *bfa,
Loading