| 926 | } |
| 927 | |
| 928 | static int |
| 929 | nfp_fw_setup(struct rte_pci_device *dev, |
| 930 | struct nfp_cpp *cpp, |
| 931 | struct nfp_eth_table *nfp_eth_table, |
| 932 | struct nfp_hwinfo *hwinfo, |
| 933 | const struct nfp_dev_info *dev_info, |
| 934 | struct nfp_multi_pf *multi_pf) |
| 935 | { |
| 936 | int err; |
| 937 | char card_desc[100]; |
| 938 | struct nfp_nsp *nsp; |
| 939 | const char *nfp_fw_model; |
| 940 | |
| 941 | nfp_fw_model = nfp_hwinfo_lookup(hwinfo, "nffw.partno"); |
| 942 | if (nfp_fw_model == NULL) |
| 943 | nfp_fw_model = nfp_hwinfo_lookup(hwinfo, "assembly.partno"); |
| 944 | |
| 945 | if (nfp_fw_model != NULL) { |
| 946 | PMD_DRV_LOG(INFO, "firmware model found: %s", nfp_fw_model); |
| 947 | } else { |
| 948 | PMD_DRV_LOG(ERR, "firmware model NOT found"); |
| 949 | return -EIO; |
| 950 | } |
| 951 | |
| 952 | if (nfp_eth_table->count == 0 || nfp_eth_table->count > 8) { |
| 953 | PMD_DRV_LOG(ERR, "NFP ethernet table reports wrong ports: %u", |
| 954 | nfp_eth_table->count); |
| 955 | return -EIO; |
| 956 | } |
| 957 | |
| 958 | PMD_DRV_LOG(INFO, "NFP ethernet port table reports %u ports", |
| 959 | nfp_eth_table->count); |
| 960 | |
| 961 | PMD_DRV_LOG(INFO, "Port speed: %u", nfp_eth_table->ports[0].speed); |
| 962 | |
| 963 | snprintf(card_desc, sizeof(card_desc), "nic_%s_%dx%d.nffw", |
| 964 | nfp_fw_model, nfp_eth_table->count, |
| 965 | nfp_eth_table->ports[0].speed / 1000); |
| 966 | |
| 967 | nsp = nfp_nsp_open(cpp); |
| 968 | if (nsp == NULL) { |
| 969 | PMD_DRV_LOG(ERR, "NFP error when obtaining NSP handle"); |
| 970 | return -EIO; |
| 971 | } |
| 972 | |
| 973 | if (multi_pf->enabled) |
| 974 | err = nfp_fw_reload_for_multipf(dev, nsp, card_desc, cpp, dev_info, multi_pf); |
| 975 | else |
| 976 | err = nfp_fw_reload(dev, nsp, card_desc); |
| 977 | |
| 978 | nfp_nsp_close(nsp); |
| 979 | return err; |
| 980 | } |
| 981 | |
| 982 | static inline bool |
| 983 | nfp_check_multi_pf_from_fw(uint32_t total_vnics) |
no test coverage detected