Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bna: IOC uninit check and misc cleanup

Change Details:
- Added a check in ioc firmware lock function to see if IOC is
in BFI_IOC_UNINIT state or not. If it is not in UNINIT state
and the last IOC boot was not done by OS driver, force IOC state
to BFI_IOC_UNINIT
- Unused macro and API cleanup

Signed-off-by: Debashis Dutt <ddutt@brocade.com>
Signed-off-by: Rasesh Mody <rmody@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Rasesh Mody and committed by
David S. Miller
2c7d3821 f7c0fa4c

+2 -65
-22
drivers/net/bna/bfa_defs_mfg_comm.h
··· 95 95 (type) == BFA_MFG_TYPE_CNA10P1 || \ 96 96 bfa_mfg_is_mezz(type))) 97 97 98 - /** 99 - * Check if the card having old wwn/mac handling 100 - */ 101 - #define bfa_mfg_is_old_wwn_mac_model(type) (( \ 102 - (type) == BFA_MFG_TYPE_FC8P2 || \ 103 - (type) == BFA_MFG_TYPE_FC8P1 || \ 104 - (type) == BFA_MFG_TYPE_FC4P2 || \ 105 - (type) == BFA_MFG_TYPE_FC4P1 || \ 106 - (type) == BFA_MFG_TYPE_CNA10P2 || \ 107 - (type) == BFA_MFG_TYPE_CNA10P1 || \ 108 - (type) == BFA_MFG_TYPE_JAYHAWK || \ 109 - (type) == BFA_MFG_TYPE_WANCHESE)) 110 - 111 - #define bfa_mfg_increment_wwn_mac(m, i) \ 112 - do { \ 113 - u32 t = ((m)[0] << 16) | ((m)[1] << 8) | (m)[2]; \ 114 - t += (i); \ 115 - (m)[0] = (t >> 16) & 0xFF; \ 116 - (m)[1] = (t >> 8) & 0xFF; \ 117 - (m)[2] = t & 0xFF; \ 118 - } while (0) 119 - 120 98 #define bfa_mfg_adapter_prop_init_flash(card_type, prop) \ 121 99 do { \ 122 100 switch ((card_type)) { \
+2 -43
drivers/net/bna/bfa_ioc.c
··· 58 58 #define bfa_ioc_notify_hbfail(__ioc) \ 59 59 ((__ioc)->ioc_hwif->ioc_notify_hbfail(__ioc)) 60 60 61 - #define bfa_ioc_is_optrom(__ioc) \ 62 - (bfa_cb_image_get_size(BFA_IOC_FWIMG_TYPE(__ioc)) < BFA_IOC_FWIMG_MINSZ) 63 - 64 61 #define bfa_ioc_mbox_cmd_pending(__ioc) \ 65 62 (!list_empty(&((__ioc)->mbox_mod.cmd_q)) || \ 66 63 readl((__ioc)->ioc_regs.hfn_mbox_cmd)) ··· 98 101 char *manufacturer); 99 102 static void bfa_ioc_get_adapter_model(struct bfa_ioc *ioc, char *model); 100 103 static u64 bfa_ioc_get_pwwn(struct bfa_ioc *ioc); 101 - static mac_t bfa_ioc_get_mfg_mac(struct bfa_ioc *ioc); 102 104 103 105 /** 104 106 * IOC state machine events ··· 861 865 { 862 866 struct bfi_ioc_image_hdr fwhdr, *drv_fwhdr; 863 867 864 - /** 865 - * If bios/efi boot (flash based) -- return true 866 - */ 867 - if (bfa_ioc_is_optrom(ioc)) 868 - return true; 869 - 870 868 bfa_nw_ioc_fwver_get(ioc, &fwhdr); 871 869 drv_fwhdr = (struct bfi_ioc_image_hdr *) 872 870 bfa_cb_image_get_chunk(BFA_IOC_FWIMG_TYPE(ioc), 0); ··· 924 934 /** 925 935 * If IOC function is disabled and firmware version is same, 926 936 * just re-enable IOC. 927 - * 928 - * If option rom, IOC must not be in operational state. With 929 - * convergence, IOC will be in operational state when 2nd driver 930 - * is loaded. 931 937 */ 932 - if (ioc_fwstate == BFI_IOC_DISABLED || 933 - (!bfa_ioc_is_optrom(ioc) && ioc_fwstate == BFI_IOC_OP)) { 938 + if (ioc_fwstate == BFI_IOC_DISABLED || ioc_fwstate == BFI_IOC_OP) { 934 939 /** 935 940 * When using MSI-X any pending firmware ready event should 936 941 * be flushed. Otherwise MSI-X interrupts are not delivered. ··· 1063 1078 */ 1064 1079 bfa_ioc_lmem_init(ioc); 1065 1080 1066 - /** 1067 - * Flash based firmware boot 1068 - */ 1069 - if (bfa_ioc_is_optrom(ioc)) 1070 - boot_type = BFI_BOOT_TYPE_FLASH; 1071 1081 fwimg = bfa_cb_image_get_chunk(BFA_IOC_FWIMG_TYPE(ioc), chunkno); 1072 1082 1073 1083 pgnum = bfa_ioc_smem_pgnum(ioc, loff); ··· 1669 1689 mac_t 1670 1690 bfa_nw_ioc_get_mac(struct bfa_ioc *ioc) 1671 1691 { 1672 - /* 1673 - * Currently mfg mac is used as FCoE enode mac (not configured by PBC) 1674 - */ 1675 - if (bfa_ioc_get_type(ioc) == BFA_IOC_TYPE_FCoE) 1676 - return bfa_ioc_get_mfg_mac(ioc); 1677 - else 1678 - return ioc->attr->mac; 1679 - } 1680 - 1681 - static mac_t 1682 - bfa_ioc_get_mfg_mac(struct bfa_ioc *ioc) 1683 - { 1684 - mac_t m; 1685 - 1686 - m = ioc->attr->mfg_mac; 1687 - if (bfa_mfg_is_old_wwn_mac_model(ioc->attr->card_type)) 1688 - m.mac[MAC_ADDRLEN - 1] += bfa_ioc_pcifn(ioc); 1689 - else 1690 - bfa_mfg_increment_wwn_mac(&(m.mac[MAC_ADDRLEN-3]), 1691 - bfa_ioc_pcifn(ioc)); 1692 - 1693 - return m; 1692 + return ioc->attr->mac; 1694 1693 } 1695 1694 1696 1695 /**