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

Merge branch 'be2net'

Sathya Perla says:

====================
be2net: patch set

Hi Dave, pls consider applying the following patch-set to the
net-next tree. It has 5 code/style cleanup patches and 4 patches that
add functionality to the driver.

Patch 1 moves routines that were not needed to be in be.h to the respective
src files, to avoid unnecessary compilation.

Patch 2 replaces (1 << x) with BIT(x) macro

Patch 3 refactors code that checks if a FW flash file is compatible
with the adapter. The code is now refactored into 2 routines, the first one
gets the file type from the image file and the 2nd routine checks if the
file type is compatible with the adapter.

Patch 4 adds compatibility checks for flashing a FW image on the new
Skyhawk P2 HW revision.

Patch 5 adds support for a new "offset based" flashing scheme, wherein
the driver informs the FW of the offset at which each component in the flash
file is to be flashed at. This helps flashing components that were
previously not recognized by the running FW.

Patch 6 simplifies the be_cmd_rx_filter() routine, by passing to it the
filter flags already used in the FW cmd, instead of the netdev flags that
were converted to the FW-cmd flags.

Patch 7 introduces helper routines in be_set_rx_mode() and be_vid_config()
to improve code readability.

Patch 8 adds processing of port-misconfig async event sent by the FW.

Patch 9 removes unnecessary swapping of a field in the TX desc.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+648 -454
+20 -179
drivers/net/ethernet/emulex/benet/be.h
··· 59 59 #define OC_SUBSYS_DEVICE_ID3 0xE612 60 60 #define OC_SUBSYS_DEVICE_ID4 0xE652 61 61 62 - static inline char *nic_name(struct pci_dev *pdev) 63 - { 64 - switch (pdev->device) { 65 - case OC_DEVICE_ID1: 66 - return OC_NAME; 67 - case OC_DEVICE_ID2: 68 - return OC_NAME_BE; 69 - case OC_DEVICE_ID3: 70 - case OC_DEVICE_ID4: 71 - return OC_NAME_LANCER; 72 - case BE_DEVICE_ID2: 73 - return BE3_NAME; 74 - case OC_DEVICE_ID5: 75 - case OC_DEVICE_ID6: 76 - return OC_NAME_SH; 77 - default: 78 - return BE_NAME; 79 - } 80 - } 81 - 82 62 /* Number of bytes of an RX frame that are copied to skb->data */ 83 63 #define BE_HDR_LEN ((u16) 64) 84 64 /* allocate extra space to allow tunneling decapsulation without head reallocation */ ··· 361 381 ASSIGNED = 1 362 382 }; 363 383 364 - #define BE_FLAGS_LINK_STATUS_INIT 1 365 - #define BE_FLAGS_SRIOV_ENABLED (1 << 2) 366 - #define BE_FLAGS_WORKER_SCHEDULED (1 << 3) 367 - #define BE_FLAGS_VLAN_PROMISC (1 << 4) 368 - #define BE_FLAGS_MCAST_PROMISC (1 << 5) 369 - #define BE_FLAGS_NAPI_ENABLED (1 << 9) 370 - #define BE_FLAGS_QNQ_ASYNC_EVT_RCVD (1 << 11) 371 - #define BE_FLAGS_VXLAN_OFFLOADS (1 << 12) 372 - #define BE_FLAGS_SETUP_DONE (1 << 13) 384 + #define BE_FLAGS_LINK_STATUS_INIT BIT(1) 385 + #define BE_FLAGS_SRIOV_ENABLED BIT(2) 386 + #define BE_FLAGS_WORKER_SCHEDULED BIT(3) 387 + #define BE_FLAGS_NAPI_ENABLED BIT(6) 388 + #define BE_FLAGS_QNQ_ASYNC_EVT_RCVD BIT(7) 389 + #define BE_FLAGS_VXLAN_OFFLOADS BIT(8) 390 + #define BE_FLAGS_SETUP_DONE BIT(9) 391 + #define BE_FLAGS_EVT_INCOMPATIBLE_SFP BIT(10) 373 392 374 393 #define BE_UC_PMAC_COUNT 30 375 394 #define BE_VF_UC_PMAC_COUNT 2 ··· 378 399 #define LANCER_DELETE_FW_DUMP 0x2 379 400 380 401 struct phy_info { 402 + /* From SFF-8472 spec */ 403 + #define SFP_VENDOR_NAME_LEN 17 381 404 u8 transceiver; 382 405 u8 autoneg; 383 406 u8 fc_autoneg; ··· 393 412 u32 advertising; 394 413 u32 supported; 395 414 u8 cable_type; 415 + u8 vendor_name[SFP_VENDOR_NAME_LEN]; 416 + u8 vendor_pn[SFP_VENDOR_NAME_LEN]; 396 417 }; 397 418 398 419 struct be_resources { ··· 452 469 453 470 struct be_drv_stats drv_stats; 454 471 struct be_aic_obj aic_obj[MAX_EVT_QS]; 455 - u16 vlans_added; 456 - unsigned long vids[BITS_TO_LONGS(VLAN_N_VID)]; 457 472 u8 vlan_prio_bmap; /* Available Priority BitMap */ 458 473 u16 recommended_prio; /* Recommended Priority */ 459 474 struct be_dma_mem rx_filter; /* Cmd DMA mem for rx-filter */ ··· 467 486 /* Ethtool knobs and info */ 468 487 char fw_ver[FW_VER_LEN]; 469 488 char fw_on_flash[FW_VER_LEN]; 489 + 490 + /* IFACE filtering fields */ 470 491 int if_handle; /* Used to configure filtering */ 492 + u32 if_flags; /* Interface filtering flags */ 471 493 u32 *pmac_id; /* MAC addr handle used by BE card */ 494 + u32 uc_macs; /* Count of secondary UC MAC programmed */ 495 + unsigned long vids[BITS_TO_LONGS(VLAN_N_VID)]; 496 + u16 vlans_added; 497 + 472 498 u32 beacon_state; /* for set_phys_id */ 473 499 474 500 bool eeh_error; ··· 483 495 bool hw_error; 484 496 485 497 u32 port_num; 486 - bool promiscuous; 498 + char port_name; 487 499 u8 mc_type; 488 500 u32 function_mode; 489 501 u32 function_caps; ··· 516 528 struct phy_info phy; 517 529 u8 wol_cap; 518 530 bool wol_en; 519 - u32 uc_macs; /* Count of secondary UC MAC programmed */ 520 531 u16 asic_rev; 521 532 u16 qnq_vid; 522 533 u32 msg_enable; ··· 721 734 return skb->protocol == htons(ETH_P_IP) && ip_hdr(skb)->version == 4; 722 735 } 723 736 724 - static inline void be_vf_eth_addr_generate(struct be_adapter *adapter, u8 *mac) 725 - { 726 - u32 addr; 727 - 728 - addr = jhash(adapter->netdev->dev_addr, ETH_ALEN, 0); 729 - 730 - mac[5] = (u8)(addr & 0xFF); 731 - mac[4] = (u8)((addr >> 8) & 0xFF); 732 - mac[3] = (u8)((addr >> 16) & 0xFF); 733 - /* Use the OUI from the current MAC address */ 734 - memcpy(mac, adapter->netdev->dev_addr, 3); 735 - } 736 - 737 737 static inline bool be_multi_rxq(const struct be_adapter *adapter) 738 738 { 739 739 return adapter->num_rx_qs > 1; ··· 743 769 adapter->fw_timeout = false; 744 770 } 745 771 746 - static inline bool be_is_wol_excluded(struct be_adapter *adapter) 747 - { 748 - struct pci_dev *pdev = adapter->pdev; 749 - 750 - if (!be_physfn(adapter)) 751 - return true; 752 - 753 - switch (pdev->subsystem_device) { 754 - case OC_SUBSYS_DEVICE_ID1: 755 - case OC_SUBSYS_DEVICE_ID2: 756 - case OC_SUBSYS_DEVICE_ID3: 757 - case OC_SUBSYS_DEVICE_ID4: 758 - return true; 759 - default: 760 - return false; 761 - } 762 - } 763 - 764 - static inline int qnq_async_evt_rcvd(struct be_adapter *adapter) 765 - { 766 - return adapter->flags & BE_FLAGS_QNQ_ASYNC_EVT_RCVD; 767 - } 768 - 769 - #ifdef CONFIG_NET_RX_BUSY_POLL 770 - static inline bool be_lock_napi(struct be_eq_obj *eqo) 771 - { 772 - bool status = true; 773 - 774 - spin_lock(&eqo->lock); /* BH is already disabled */ 775 - if (eqo->state & BE_EQ_LOCKED) { 776 - WARN_ON(eqo->state & BE_EQ_NAPI); 777 - eqo->state |= BE_EQ_NAPI_YIELD; 778 - status = false; 779 - } else { 780 - eqo->state = BE_EQ_NAPI; 781 - } 782 - spin_unlock(&eqo->lock); 783 - return status; 784 - } 785 - 786 - static inline void be_unlock_napi(struct be_eq_obj *eqo) 787 - { 788 - spin_lock(&eqo->lock); /* BH is already disabled */ 789 - 790 - WARN_ON(eqo->state & (BE_EQ_POLL | BE_EQ_NAPI_YIELD)); 791 - eqo->state = BE_EQ_IDLE; 792 - 793 - spin_unlock(&eqo->lock); 794 - } 795 - 796 - static inline bool be_lock_busy_poll(struct be_eq_obj *eqo) 797 - { 798 - bool status = true; 799 - 800 - spin_lock_bh(&eqo->lock); 801 - if (eqo->state & BE_EQ_LOCKED) { 802 - eqo->state |= BE_EQ_POLL_YIELD; 803 - status = false; 804 - } else { 805 - eqo->state |= BE_EQ_POLL; 806 - } 807 - spin_unlock_bh(&eqo->lock); 808 - return status; 809 - } 810 - 811 - static inline void be_unlock_busy_poll(struct be_eq_obj *eqo) 812 - { 813 - spin_lock_bh(&eqo->lock); 814 - 815 - WARN_ON(eqo->state & (BE_EQ_NAPI)); 816 - eqo->state = BE_EQ_IDLE; 817 - 818 - spin_unlock_bh(&eqo->lock); 819 - } 820 - 821 - static inline void be_enable_busy_poll(struct be_eq_obj *eqo) 822 - { 823 - spin_lock_init(&eqo->lock); 824 - eqo->state = BE_EQ_IDLE; 825 - } 826 - 827 - static inline void be_disable_busy_poll(struct be_eq_obj *eqo) 828 - { 829 - local_bh_disable(); 830 - 831 - /* It's enough to just acquire napi lock on the eqo to stop 832 - * be_busy_poll() from processing any queueus. 833 - */ 834 - while (!be_lock_napi(eqo)) 835 - mdelay(1); 836 - 837 - local_bh_enable(); 838 - } 839 - 840 - #else /* CONFIG_NET_RX_BUSY_POLL */ 841 - 842 - static inline bool be_lock_napi(struct be_eq_obj *eqo) 843 - { 844 - return true; 845 - } 846 - 847 - static inline void be_unlock_napi(struct be_eq_obj *eqo) 848 - { 849 - } 850 - 851 - static inline bool be_lock_busy_poll(struct be_eq_obj *eqo) 852 - { 853 - return false; 854 - } 855 - 856 - static inline void be_unlock_busy_poll(struct be_eq_obj *eqo) 857 - { 858 - } 859 - 860 - static inline void be_enable_busy_poll(struct be_eq_obj *eqo) 861 - { 862 - } 863 - 864 - static inline void be_disable_busy_poll(struct be_eq_obj *eqo) 865 - { 866 - } 867 - #endif /* CONFIG_NET_RX_BUSY_POLL */ 868 - 869 772 void be_cq_notify(struct be_adapter *adapter, u16 qid, bool arm, 870 773 u16 num_popped); 871 774 void be_link_status_update(struct be_adapter *adapter, u8 link_status); ··· 751 900 bool be_is_wol_supported(struct be_adapter *adapter); 752 901 bool be_pause_supported(struct be_adapter *adapter); 753 902 u32 be_get_fw_log_level(struct be_adapter *adapter); 754 - 755 - static inline int fw_major_num(const char *fw_ver) 756 - { 757 - int fw_major = 0; 758 - 759 - sscanf(fw_ver, "%d.", &fw_major); 760 - 761 - return fw_major; 762 - } 763 - 764 903 int be_update_queues(struct be_adapter *adapter); 765 904 int be_poll(struct napi_struct *napi, int budget); 766 905
+145 -62
drivers/net/ethernet/emulex/benet/be_cmds.c
··· 19 19 #include "be.h" 20 20 #include "be_cmds.h" 21 21 22 + static char *be_port_misconfig_evt_desc[] = { 23 + "A valid SFP module detected", 24 + "Optics faulted/ incorrectly installed/ not installed.", 25 + "Optics of two types installed.", 26 + "Incompatible optics.", 27 + "Unknown port SFP status" 28 + }; 29 + 30 + static char *be_port_misconfig_remedy_desc[] = { 31 + "", 32 + "Reseat optics. If issue not resolved, replace", 33 + "Remove one optic or install matching pair of optics", 34 + "Replace with compatible optics for card to function", 35 + "" 36 + }; 37 + 22 38 static struct be_cmd_priv_map cmd_priv_map[] = { 23 39 { 24 40 OPCODE_ETH_ACPI_WOL_MAGIC_CONFIG, ··· 265 249 evt->port_link_status & LINK_STATUS_MASK); 266 250 } 267 251 252 + static void be_async_port_misconfig_event_process(struct be_adapter *adapter, 253 + struct be_mcc_compl *compl) 254 + { 255 + struct be_async_event_misconfig_port *evt = 256 + (struct be_async_event_misconfig_port *)compl; 257 + u32 sfp_mismatch_evt = le32_to_cpu(evt->event_data_word1); 258 + struct device *dev = &adapter->pdev->dev; 259 + u8 port_misconfig_evt; 260 + 261 + port_misconfig_evt = 262 + ((sfp_mismatch_evt >> (adapter->hba_port_num * 8)) & 0xff); 263 + 264 + /* Log an error message that would allow a user to determine 265 + * whether the SFPs have an issue 266 + */ 267 + dev_info(dev, "Port %c: %s %s", adapter->port_name, 268 + be_port_misconfig_evt_desc[port_misconfig_evt], 269 + be_port_misconfig_remedy_desc[port_misconfig_evt]); 270 + 271 + if (port_misconfig_evt == INCOMPATIBLE_SFP) 272 + adapter->flags |= BE_FLAGS_EVT_INCOMPATIBLE_SFP; 273 + } 274 + 268 275 /* Grp5 CoS Priority evt */ 269 276 static void be_async_grp5_cos_priority_process(struct be_adapter *adapter, 270 277 struct be_mcc_compl *compl) ··· 373 334 } 374 335 } 375 336 337 + static void be_async_sliport_evt_process(struct be_adapter *adapter, 338 + struct be_mcc_compl *cmp) 339 + { 340 + u8 event_type = (cmp->flags >> ASYNC_EVENT_TYPE_SHIFT) & 341 + ASYNC_EVENT_TYPE_MASK; 342 + 343 + if (event_type == ASYNC_EVENT_PORT_MISCONFIG) 344 + be_async_port_misconfig_event_process(adapter, cmp); 345 + } 346 + 376 347 static inline bool is_link_state_evt(u32 flags) 377 348 { 378 349 return ((flags >> ASYNC_EVENT_CODE_SHIFT) & ASYNC_EVENT_CODE_MASK) == ··· 401 352 ASYNC_EVENT_CODE_QNQ; 402 353 } 403 354 355 + static inline bool is_sliport_evt(u32 flags) 356 + { 357 + return ((flags >> ASYNC_EVENT_CODE_SHIFT) & ASYNC_EVENT_CODE_MASK) == 358 + ASYNC_EVENT_CODE_SLIPORT; 359 + } 360 + 404 361 static void be_mcc_event_process(struct be_adapter *adapter, 405 362 struct be_mcc_compl *compl) 406 363 { ··· 416 361 be_async_grp5_evt_process(adapter, compl); 417 362 else if (is_dbg_evt(compl->flags)) 418 363 be_async_dbg_evt_process(adapter, compl); 364 + else if (is_sliport_evt(compl->flags)) 365 + be_async_sliport_evt_process(adapter, compl); 419 366 } 420 367 421 368 static struct be_mcc_compl *be_mcc_compl_get(struct be_adapter *adapter) ··· 1228 1171 ctxt, 1); 1229 1172 } 1230 1173 1231 - /* Subscribe to Link State and Group 5 Events(bits 1 and 5 set) */ 1232 - req->async_event_bitmap[0] = cpu_to_le32(0x00000022); 1233 - req->async_event_bitmap[0] |= cpu_to_le32(1 << ASYNC_EVENT_CODE_QNQ); 1174 + /* Subscribe to Link State, Sliport Event and Group 5 Events 1175 + * (bits 1, 5 and 17 set) 1176 + */ 1177 + req->async_event_bitmap[0] = 1178 + cpu_to_le32(BIT(ASYNC_EVENT_CODE_LINK_STATE) | 1179 + BIT(ASYNC_EVENT_CODE_GRP_5) | 1180 + BIT(ASYNC_EVENT_CODE_QNQ) | 1181 + BIT(ASYNC_EVENT_CODE_SLIPORT)); 1182 + 1234 1183 be_dws_cpu_to_le(ctxt, sizeof(req->context)); 1235 1184 1236 1185 be_cmd_page_addrs_prepare(req->pages, ARRAY_SIZE(req->pages), q_mem); ··· 1949 1886 return status; 1950 1887 } 1951 1888 1952 - int be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 value) 1889 + static int __be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 value) 1953 1890 { 1954 1891 struct be_mcc_wrb *wrb; 1955 1892 struct be_dma_mem *mem = &adapter->rx_filter; ··· 1969 1906 wrb, mem); 1970 1907 1971 1908 req->if_id = cpu_to_le32(adapter->if_handle); 1972 - if (flags & IFF_PROMISC) { 1973 - req->if_flags_mask = cpu_to_le32(BE_IF_FLAGS_PROMISCUOUS | 1974 - BE_IF_FLAGS_VLAN_PROMISCUOUS | 1975 - BE_IF_FLAGS_MCAST_PROMISCUOUS); 1976 - if (value == ON) 1977 - req->if_flags = 1978 - cpu_to_le32(BE_IF_FLAGS_PROMISCUOUS | 1979 - BE_IF_FLAGS_VLAN_PROMISCUOUS | 1980 - BE_IF_FLAGS_MCAST_PROMISCUOUS); 1981 - } else if (flags & IFF_ALLMULTI) { 1982 - req->if_flags_mask = cpu_to_le32(BE_IF_FLAGS_MCAST_PROMISCUOUS); 1983 - req->if_flags = cpu_to_le32(BE_IF_FLAGS_MCAST_PROMISCUOUS); 1984 - } else if (flags & BE_FLAGS_VLAN_PROMISC) { 1985 - req->if_flags_mask = cpu_to_le32(BE_IF_FLAGS_VLAN_PROMISCUOUS); 1909 + req->if_flags_mask = cpu_to_le32(flags); 1910 + req->if_flags = (value == ON) ? req->if_flags_mask : 0; 1986 1911 1987 - if (value == ON) 1988 - req->if_flags = 1989 - cpu_to_le32(BE_IF_FLAGS_VLAN_PROMISCUOUS); 1990 - } else { 1912 + if (flags & BE_IF_FLAGS_MULTICAST) { 1991 1913 struct netdev_hw_addr *ha; 1992 1914 int i = 0; 1993 - 1994 - req->if_flags_mask = cpu_to_le32(BE_IF_FLAGS_MULTICAST); 1995 - req->if_flags = cpu_to_le32(BE_IF_FLAGS_MULTICAST); 1996 1915 1997 1916 /* Reset mcast promisc mode if already set by setting mask 1998 1917 * and not setting flags field ··· 1987 1942 memcpy(req->mcast_mac[i++].byte, ha->addr, ETH_ALEN); 1988 1943 } 1989 1944 1990 - if ((req->if_flags_mask & cpu_to_le32(be_if_cap_flags(adapter))) != 1991 - req->if_flags_mask) { 1992 - dev_warn(&adapter->pdev->dev, 1993 - "Cannot set rx filter flags 0x%x\n", 1994 - req->if_flags_mask); 1995 - dev_warn(&adapter->pdev->dev, 1996 - "Interface is capable of 0x%x flags only\n", 1997 - be_if_cap_flags(adapter)); 1998 - } 1999 - req->if_flags_mask &= cpu_to_le32(be_if_cap_flags(adapter)); 2000 - 2001 1945 status = be_mcc_notify_wait(adapter); 2002 - 2003 1946 err: 2004 1947 spin_unlock_bh(&adapter->mcc_lock); 2005 1948 return status; 1949 + } 1950 + 1951 + int be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 value) 1952 + { 1953 + struct device *dev = &adapter->pdev->dev; 1954 + 1955 + if ((flags & be_if_cap_flags(adapter)) != flags) { 1956 + dev_warn(dev, "Cannot set rx filter flags 0x%x\n", flags); 1957 + dev_warn(dev, "Interface is capable of 0x%x flags only\n", 1958 + be_if_cap_flags(adapter)); 1959 + } 1960 + flags &= be_if_cap_flags(adapter); 1961 + 1962 + return __be_cmd_rx_filter(adapter, flags, value); 2006 1963 } 2007 1964 2008 1965 /* Uses synchrounous mcc */ ··· 2407 2360 return status; 2408 2361 } 2409 2362 2363 + int be_cmd_query_sfp_info(struct be_adapter *adapter) 2364 + { 2365 + u8 page_data[PAGE_DATA_LEN]; 2366 + int status; 2367 + 2368 + status = be_cmd_read_port_transceiver_data(adapter, TR_PAGE_A0, 2369 + page_data); 2370 + if (!status) { 2371 + strlcpy(adapter->phy.vendor_name, page_data + 2372 + SFP_VENDOR_NAME_OFFSET, SFP_VENDOR_NAME_LEN - 1); 2373 + strlcpy(adapter->phy.vendor_pn, 2374 + page_data + SFP_VENDOR_PN_OFFSET, 2375 + SFP_VENDOR_NAME_LEN - 1); 2376 + } 2377 + 2378 + return status; 2379 + } 2380 + 2410 2381 int lancer_cmd_delete_object(struct be_adapter *adapter, const char *obj_name) 2411 2382 { 2412 2383 struct lancer_cmd_req_delete_object *req; ··· 2501 2436 } 2502 2437 2503 2438 int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd, 2504 - u32 flash_type, u32 flash_opcode, u32 buf_size) 2439 + u32 flash_type, u32 flash_opcode, u32 img_offset, 2440 + u32 buf_size) 2505 2441 { 2506 2442 struct be_mcc_wrb *wrb; 2507 2443 struct be_cmd_write_flashrom *req; ··· 2523 2457 cmd); 2524 2458 2525 2459 req->params.op_type = cpu_to_le32(flash_type); 2460 + if (flash_type == OPTYPE_OFFSET_SPECIFIED) 2461 + req->params.offset = cpu_to_le32(img_offset); 2462 + 2526 2463 req->params.op_code = cpu_to_le32(flash_opcode); 2527 2464 req->params.data_buf_size = cpu_to_le32(buf_size); 2528 2465 ··· 2546 2477 } 2547 2478 2548 2479 int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc, 2549 - u16 optype, int offset) 2480 + u16 img_optype, u32 img_offset, u32 crc_offset) 2550 2481 { 2551 - struct be_mcc_wrb *wrb; 2552 2482 struct be_cmd_read_flash_crc *req; 2483 + struct be_mcc_wrb *wrb; 2553 2484 int status; 2554 2485 2555 2486 spin_lock_bh(&adapter->mcc_lock); ··· 2565 2496 OPCODE_COMMON_READ_FLASHROM, sizeof(*req), 2566 2497 wrb, NULL); 2567 2498 2568 - req->params.op_type = cpu_to_le32(optype); 2499 + req->params.op_type = cpu_to_le32(img_optype); 2500 + if (img_optype == OPTYPE_OFFSET_SPECIFIED) 2501 + req->params.offset = cpu_to_le32(img_offset + crc_offset); 2502 + else 2503 + req->params.offset = cpu_to_le32(crc_offset); 2504 + 2569 2505 req->params.op_code = cpu_to_le32(FLASHROM_OPER_REPORT); 2570 - req->params.offset = cpu_to_le32(offset); 2571 2506 req->params.data_buf_size = cpu_to_le32(0x4); 2572 2507 2573 2508 status = be_mcc_notify_wait(adapter); ··· 3314 3241 return status; 3315 3242 } 3316 3243 3244 + static bool be_is_wol_excluded(struct be_adapter *adapter) 3245 + { 3246 + struct pci_dev *pdev = adapter->pdev; 3247 + 3248 + if (!be_physfn(adapter)) 3249 + return true; 3250 + 3251 + switch (pdev->subsystem_device) { 3252 + case OC_SUBSYS_DEVICE_ID1: 3253 + case OC_SUBSYS_DEVICE_ID2: 3254 + case OC_SUBSYS_DEVICE_ID3: 3255 + case OC_SUBSYS_DEVICE_ID4: 3256 + return true; 3257 + default: 3258 + return false; 3259 + } 3260 + } 3261 + 3317 3262 int be_cmd_get_acpi_wol_cap(struct be_adapter *adapter) 3318 3263 { 3319 3264 struct be_mcc_wrb *wrb; ··· 3518 3427 return status; 3519 3428 } 3520 3429 3521 - int be_cmd_query_port_name(struct be_adapter *adapter, u8 *port_name) 3430 + int be_cmd_query_port_name(struct be_adapter *adapter) 3522 3431 { 3523 - struct be_mcc_wrb *wrb; 3524 3432 struct be_cmd_req_get_port_name *req; 3433 + struct be_mcc_wrb *wrb; 3525 3434 int status; 3526 3435 3527 - if (!lancer_chip(adapter)) { 3528 - *port_name = adapter->hba_port_num + '0'; 3529 - return 0; 3530 - } 3436 + if (mutex_lock_interruptible(&adapter->mbox_lock)) 3437 + return -1; 3531 3438 3532 - spin_lock_bh(&adapter->mcc_lock); 3533 - 3534 - wrb = wrb_from_mccq(adapter); 3535 - if (!wrb) { 3536 - status = -EBUSY; 3537 - goto err; 3538 - } 3539 - 3439 + wrb = wrb_from_mbox(adapter); 3540 3440 req = embedded_payload(wrb); 3541 3441 3542 3442 be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, 3543 3443 OPCODE_COMMON_GET_PORT_NAME, sizeof(*req), wrb, 3544 3444 NULL); 3545 - req->hdr.version = 1; 3445 + if (!BEx_chip(adapter)) 3446 + req->hdr.version = 1; 3546 3447 3547 - status = be_mcc_notify_wait(adapter); 3448 + status = be_mbox_notify_wait(adapter); 3548 3449 if (!status) { 3549 3450 struct be_cmd_resp_get_port_name *resp = embedded_payload(wrb); 3550 3451 3551 - *port_name = resp->port_name[adapter->hba_port_num]; 3452 + adapter->port_name = resp->port_name[adapter->hba_port_num]; 3552 3453 } else { 3553 - *port_name = adapter->hba_port_num + '0'; 3454 + adapter->port_name = adapter->hba_port_num + '0'; 3554 3455 } 3555 - err: 3556 - spin_unlock_bh(&adapter->mcc_lock); 3456 + 3457 + mutex_unlock(&adapter->mbox_lock); 3557 3458 return status; 3558 3459 } 3559 3460
+36 -7
drivers/net/ethernet/emulex/benet/be_cmds.h
··· 44 44 } payload; 45 45 }; 46 46 47 - #define CQE_FLAGS_VALID_MASK (1 << 31) 48 - #define CQE_FLAGS_ASYNC_MASK (1 << 30) 49 - #define CQE_FLAGS_COMPLETED_MASK (1 << 28) 50 - #define CQE_FLAGS_CONSUMED_MASK (1 << 27) 47 + #define CQE_FLAGS_VALID_MASK BIT(31) 48 + #define CQE_FLAGS_ASYNC_MASK BIT(30) 49 + #define CQE_FLAGS_COMPLETED_MASK BIT(28) 50 + #define CQE_FLAGS_CONSUMED_MASK BIT(27) 51 51 52 52 /* Completion Status */ 53 53 enum mcc_base_status { ··· 102 102 #define ASYNC_EVENT_PVID_STATE 0x3 103 103 #define ASYNC_EVENT_CODE_QNQ 0x6 104 104 #define ASYNC_DEBUG_EVENT_TYPE_QNQ 1 105 + #define ASYNC_EVENT_CODE_SLIPORT 0x11 106 + #define ASYNC_EVENT_PORT_MISCONFIG 0x9 105 107 106 108 enum { 107 109 LINK_DOWN = 0x0, ··· 168 166 u16 vlan_tag; 169 167 u32 event_tag; 170 168 u8 rsvd1[4]; 169 + u32 flags; 170 + } __packed; 171 + 172 + #define INCOMPATIBLE_SFP 0x3 173 + /* async event indicating misconfigured port */ 174 + struct be_async_event_misconfig_port { 175 + u32 event_data_word1; 176 + u32 event_data_word2; 177 + u32 rsvd0; 171 178 u32 flags; 172 179 } __packed; 173 180 ··· 596 585 BE_IF_FLAGS_VLAN | BE_IF_FLAGS_MCAST_PROMISCUOUS |\ 597 586 BE_IF_FLAGS_PASS_L3L4_ERRORS | BE_IF_FLAGS_MULTICAST |\ 598 587 BE_IF_FLAGS_UNTAGGED) 588 + 589 + #define BE_IF_FLAGS_ALL_PROMISCUOUS (BE_IF_FLAGS_PROMISCUOUS | \ 590 + BE_IF_FLAGS_VLAN_PROMISCUOUS |\ 591 + BE_IF_FLAGS_MCAST_PROMISCUOUS) 599 592 600 593 /* An RX interface is an object with one or more MAC addresses and 601 594 * filtering capabilities. */ ··· 1039 1024 #define SFP_PLUS_SFF_8472_COMP 0x5E 1040 1025 #define SFP_PLUS_CABLE_TYPE_OFFSET 0x8 1041 1026 #define SFP_PLUS_COPPER_CABLE 0x4 1027 + #define SFP_VENDOR_NAME_OFFSET 0x14 1028 + #define SFP_VENDOR_PN_OFFSET 0x28 1042 1029 1043 1030 #define PAGE_DATA_LEN 256 1044 1031 struct be_cmd_resp_port_type { ··· 1107 1090 struct be_cmd_req_hdr hdr; 1108 1091 u32 rsvd[31]; 1109 1092 }; 1093 + 1094 + /* ASIC revisions */ 1095 + #define ASIC_REV_B0 0x10 1096 + #define ASIC_REV_P2 0x11 1110 1097 1111 1098 struct be_cmd_resp_query_fw_cfg { 1112 1099 struct be_cmd_resp_hdr hdr; ··· 1189 1168 #define OPTYPE_REDBOOT 1 1190 1169 #define OPTYPE_BIOS 2 1191 1170 #define OPTYPE_PXE_BIOS 3 1171 + #define OPTYPE_OFFSET_SPECIFIED 7 1192 1172 #define OPTYPE_FCOE_BIOS 8 1193 1173 #define OPTYPE_ISCSI_BACKUP 9 1194 1174 #define OPTYPE_FCOE_FW_ACTIVE 10 ··· 1281 1259 u32 num_imgs; 1282 1260 u8 build[24]; 1283 1261 }; 1262 + 1263 + /* First letter of the build version of the image */ 1264 + #define BLD_STR_UFI_TYPE_BE2 '2' 1265 + #define BLD_STR_UFI_TYPE_BE3 '3' 1266 + #define BLD_STR_UFI_TYPE_SH '4' 1284 1267 1285 1268 struct flash_file_hdr_g3 { 1286 1269 u8 sign[52]; ··· 2272 2245 int be_cmd_read_port_transceiver_data(struct be_adapter *adapter, 2273 2246 u8 page_num, u8 *data); 2274 2247 int be_cmd_query_cable_type(struct be_adapter *adapter); 2248 + int be_cmd_query_sfp_info(struct be_adapter *adapter); 2275 2249 int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd, 2276 - u32 flash_oper, u32 flash_opcode, u32 buf_size); 2250 + u32 flash_oper, u32 flash_opcode, u32 img_offset, 2251 + u32 buf_size); 2277 2252 int lancer_cmd_write_object(struct be_adapter *adapter, struct be_dma_mem *cmd, 2278 2253 u32 data_size, u32 data_offset, 2279 2254 const char *obj_name, u32 *data_written, ··· 2285 2256 u32 *data_read, u32 *eof, u8 *addn_status); 2286 2257 int lancer_cmd_delete_object(struct be_adapter *adapter, const char *obj_name); 2287 2258 int be_cmd_get_flash_crc(struct be_adapter *adapter, u8 *flashed_crc, 2288 - u16 optype, int offset); 2259 + u16 img_optype, u32 img_offset, u32 crc_offset); 2289 2260 int be_cmd_enable_magic_wol(struct be_adapter *adapter, u8 *mac, 2290 2261 struct be_dma_mem *nonemb_cmd); 2291 2262 int be_cmd_fw_init(struct be_adapter *adapter); ··· 2340 2311 int lancer_delete_dump(struct be_adapter *adapter); 2341 2312 bool dump_present(struct be_adapter *adapter); 2342 2313 int lancer_test_and_set_rdy_state(struct be_adapter *adapter); 2343 - int be_cmd_query_port_name(struct be_adapter *adapter, u8 *port_name); 2314 + int be_cmd_query_port_name(struct be_adapter *adapter); 2344 2315 int be_cmd_get_func_config(struct be_adapter *adapter, 2345 2316 struct be_resources *res); 2346 2317 int be_cmd_get_profile_config(struct be_adapter *adapter,
+7 -7
drivers/net/ethernet/emulex/benet/be_hw.h
··· 75 75 * atomically without having to arbitrate for the PCI Interrupt Disable bit 76 76 * with the OS. 77 77 */ 78 - #define MEMBAR_CTRL_INT_CTRL_HOSTINTR_MASK (1 << 29) /* bit 29 */ 78 + #define MEMBAR_CTRL_INT_CTRL_HOSTINTR_MASK BIT(29) /* bit 29 */ 79 79 80 80 /********* PCI Function Capability *********/ 81 81 #define BE_FUNCTION_CAPS_RSS 0x2 ··· 193 193 /* TX Queue Descriptor */ 194 194 #define ETH_WRB_FRAG_LEN_MASK 0xFFFF 195 195 struct be_eth_wrb { 196 - u32 frag_pa_hi; /* dword 0 */ 197 - u32 frag_pa_lo; /* dword 1 */ 198 - u32 rsvd0; /* dword 2 */ 199 - u32 frag_len; /* dword 3: bits 0 - 15 */ 196 + __le32 frag_pa_hi; /* dword 0 */ 197 + __le32 frag_pa_lo; /* dword 1 */ 198 + u32 rsvd0; /* dword 2 */ 199 + __le32 frag_len; /* dword 3: bits 0 - 15 */ 200 200 } __packed; 201 201 202 202 /* Pseudo amap definition for eth_hdr_wrb in which each bit of the ··· 224 224 } __packed; 225 225 226 226 #define TX_HDR_WRB_COMPL 1 /* word 2 */ 227 - #define TX_HDR_WRB_EVT (1 << 1) /* word 2 */ 227 + #define TX_HDR_WRB_EVT BIT(1) /* word 2 */ 228 228 #define TX_HDR_WRB_NUM_SHIFT 13 /* word 2: bits 13:17 */ 229 229 #define TX_HDR_WRB_NUM_MASK 0x1F /* word 2: bits 13:17 */ 230 230 231 231 struct be_eth_hdr_wrb { 232 - u32 dw[4]; 232 + __le32 dw[4]; 233 233 }; 234 234 235 235 /********* Tx Compl Status Encoding *********/
+440 -199
drivers/net/ethernet/emulex/benet/be_main.c
··· 682 682 683 683 static inline void wrb_fill(struct be_eth_wrb *wrb, u64 addr, int len) 684 684 { 685 - wrb->frag_pa_hi = upper_32_bits(addr); 686 - wrb->frag_pa_lo = addr & 0xFFFFFFFF; 687 - wrb->frag_len = len & ETH_WRB_FRAG_LEN_MASK; 685 + wrb->frag_pa_hi = cpu_to_le32(upper_32_bits(addr)); 686 + wrb->frag_pa_lo = cpu_to_le32(lower_32_bits(addr)); 687 + wrb->frag_len = cpu_to_le32(len & ETH_WRB_FRAG_LEN_MASK); 688 + wrb->rsvd0 = 0; 689 + } 690 + 691 + /* A dummy wrb is just all zeros. Using a separate routine for dummy-wrb 692 + * to avoid the swap and shift/mask operations in wrb_fill(). 693 + */ 694 + static inline void wrb_fill_dummy(struct be_eth_wrb *wrb) 695 + { 696 + wrb->frag_pa_hi = 0; 697 + wrb->frag_pa_lo = 0; 698 + wrb->frag_len = 0; 688 699 wrb->rsvd0 = 0; 689 700 } 690 701 ··· 776 765 bool unmap_single) 777 766 { 778 767 dma_addr_t dma; 768 + u32 frag_len = le32_to_cpu(wrb->frag_len); 779 769 780 - be_dws_le_to_cpu(wrb, sizeof(*wrb)); 781 770 782 - dma = (u64)wrb->frag_pa_hi << 32 | (u64)wrb->frag_pa_lo; 783 - if (wrb->frag_len) { 771 + dma = (u64)le32_to_cpu(wrb->frag_pa_hi) << 32 | 772 + (u64)le32_to_cpu(wrb->frag_pa_lo); 773 + if (frag_len) { 784 774 if (unmap_single) 785 - dma_unmap_single(dev, dma, wrb->frag_len, 786 - DMA_TO_DEVICE); 775 + dma_unmap_single(dev, dma, frag_len, DMA_TO_DEVICE); 787 776 else 788 - dma_unmap_page(dev, dma, wrb->frag_len, DMA_TO_DEVICE); 777 + dma_unmap_page(dev, dma, frag_len, DMA_TO_DEVICE); 789 778 } 790 779 } 791 780 ··· 817 806 map_single = true; 818 807 wrb = queue_head_node(txq); 819 808 wrb_fill(wrb, busaddr, len); 820 - be_dws_cpu_to_le(wrb, sizeof(*wrb)); 821 809 queue_head_inc(txq); 822 810 copied += len; 823 811 } ··· 830 820 goto dma_err; 831 821 wrb = queue_head_node(txq); 832 822 wrb_fill(wrb, busaddr, skb_frag_size(frag)); 833 - be_dws_cpu_to_le(wrb, sizeof(*wrb)); 834 823 queue_head_inc(txq); 835 824 copied += skb_frag_size(frag); 836 825 } ··· 855 846 wrb = queue_head_node(txq); 856 847 unmap_tx_frag(dev, wrb, map_single); 857 848 map_single = false; 858 - copied -= wrb->frag_len; 849 + copied -= le32_to_cpu(wrb->frag_len); 859 850 adapter->drv_stats.dma_map_errors++; 860 851 queue_head_inc(txq); 861 852 } 862 853 txq->head = head; 863 854 return 0; 855 + } 856 + 857 + static inline int qnq_async_evt_rcvd(struct be_adapter *adapter) 858 + { 859 + return adapter->flags & BE_FLAGS_QNQ_ASYNC_EVT_RCVD; 864 860 } 865 861 866 862 static struct sk_buff *be_insert_vlan_in_pkt(struct be_adapter *adapter, ··· 1046 1032 1047 1033 /* compose a dummy wrb if there are odd set of wrbs to notify */ 1048 1034 if (!lancer_chip(adapter) && (txo->pend_wrb_cnt & 1)) { 1049 - wrb_fill(queue_head_node(txq), 0, 0); 1035 + wrb_fill_dummy(queue_head_node(txq)); 1050 1036 queue_head_inc(txq); 1051 1037 atomic_inc(&txq->used); 1052 1038 txo->pend_wrb_cnt++; ··· 1113 1099 return 0; 1114 1100 } 1115 1101 1102 + static inline bool be_in_all_promisc(struct be_adapter *adapter) 1103 + { 1104 + return (adapter->if_flags & BE_IF_FLAGS_ALL_PROMISCUOUS) == 1105 + BE_IF_FLAGS_ALL_PROMISCUOUS; 1106 + } 1107 + 1108 + static int be_set_vlan_promisc(struct be_adapter *adapter) 1109 + { 1110 + struct device *dev = &adapter->pdev->dev; 1111 + int status; 1112 + 1113 + if (adapter->if_flags & BE_IF_FLAGS_VLAN_PROMISCUOUS) 1114 + return 0; 1115 + 1116 + status = be_cmd_rx_filter(adapter, BE_IF_FLAGS_VLAN_PROMISCUOUS, ON); 1117 + if (!status) { 1118 + dev_info(dev, "Enabled VLAN promiscuous mode\n"); 1119 + adapter->if_flags |= BE_IF_FLAGS_VLAN_PROMISCUOUS; 1120 + } else { 1121 + dev_err(dev, "Failed to enable VLAN promiscuous mode\n"); 1122 + } 1123 + return status; 1124 + } 1125 + 1126 + static int be_clear_vlan_promisc(struct be_adapter *adapter) 1127 + { 1128 + struct device *dev = &adapter->pdev->dev; 1129 + int status; 1130 + 1131 + status = be_cmd_rx_filter(adapter, BE_IF_FLAGS_VLAN_PROMISCUOUS, OFF); 1132 + if (!status) { 1133 + dev_info(dev, "Disabling VLAN promiscuous mode\n"); 1134 + adapter->if_flags &= ~BE_IF_FLAGS_VLAN_PROMISCUOUS; 1135 + } 1136 + return status; 1137 + } 1138 + 1116 1139 /* 1117 1140 * A max of 64 (BE_NUM_VLANS_SUPPORTED) vlans can be configured in BE. 1118 1141 * If the user configures more, place BE in vlan promiscuous mode. ··· 1162 1111 int status = 0; 1163 1112 1164 1113 /* No need to further configure vids if in promiscuous mode */ 1165 - if (adapter->promiscuous) 1114 + if (be_in_all_promisc(adapter)) 1166 1115 return 0; 1167 1116 1168 1117 if (adapter->vlans_added > be_max_vlans(adapter)) 1169 - goto set_vlan_promisc; 1118 + return be_set_vlan_promisc(adapter); 1170 1119 1171 1120 /* Construct VLAN Table to give to HW */ 1172 1121 for_each_set_bit(i, adapter->vids, VLAN_N_VID) ··· 1174 1123 1175 1124 status = be_cmd_vlan_config(adapter, adapter->if_handle, vids, num); 1176 1125 if (status) { 1126 + dev_err(dev, "Setting HW VLAN filtering failed\n"); 1177 1127 /* Set to VLAN promisc mode as setting VLAN filter failed */ 1178 1128 if (addl_status(status) == 1179 1129 MCC_ADDL_STATUS_INSUFFICIENT_RESOURCES) 1180 - goto set_vlan_promisc; 1181 - dev_err(dev, "Setting HW VLAN filtering failed\n"); 1182 - } else { 1183 - if (adapter->flags & BE_FLAGS_VLAN_PROMISC) { 1184 - /* hw VLAN filtering re-enabled. */ 1185 - status = be_cmd_rx_filter(adapter, 1186 - BE_FLAGS_VLAN_PROMISC, OFF); 1187 - if (!status) { 1188 - dev_info(dev, 1189 - "Disabling VLAN Promiscuous mode\n"); 1190 - adapter->flags &= ~BE_FLAGS_VLAN_PROMISC; 1191 - } 1192 - } 1130 + return be_set_vlan_promisc(adapter); 1131 + } else if (adapter->if_flags & BE_IF_FLAGS_VLAN_PROMISCUOUS) { 1132 + status = be_clear_vlan_promisc(adapter); 1193 1133 } 1194 - 1195 - return status; 1196 - 1197 - set_vlan_promisc: 1198 - if (adapter->flags & BE_FLAGS_VLAN_PROMISC) 1199 - return 0; 1200 - 1201 - status = be_cmd_rx_filter(adapter, BE_FLAGS_VLAN_PROMISC, ON); 1202 - if (!status) { 1203 - dev_info(dev, "Enable VLAN Promiscuous mode\n"); 1204 - adapter->flags |= BE_FLAGS_VLAN_PROMISC; 1205 - } else 1206 - dev_err(dev, "Failed to enable VLAN Promiscuous mode\n"); 1207 1134 return status; 1208 1135 } 1209 1136 ··· 1223 1194 return be_vid_config(adapter); 1224 1195 } 1225 1196 1226 - static void be_clear_promisc(struct be_adapter *adapter) 1197 + static void be_clear_all_promisc(struct be_adapter *adapter) 1227 1198 { 1228 - adapter->promiscuous = false; 1229 - adapter->flags &= ~(BE_FLAGS_VLAN_PROMISC | BE_FLAGS_MCAST_PROMISC); 1199 + be_cmd_rx_filter(adapter, BE_IF_FLAGS_ALL_PROMISCUOUS, OFF); 1200 + adapter->if_flags &= ~BE_IF_FLAGS_ALL_PROMISCUOUS; 1201 + } 1230 1202 1231 - be_cmd_rx_filter(adapter, IFF_PROMISC, OFF); 1203 + static void be_set_all_promisc(struct be_adapter *adapter) 1204 + { 1205 + be_cmd_rx_filter(adapter, BE_IF_FLAGS_ALL_PROMISCUOUS, ON); 1206 + adapter->if_flags |= BE_IF_FLAGS_ALL_PROMISCUOUS; 1207 + } 1208 + 1209 + static void be_set_mc_promisc(struct be_adapter *adapter) 1210 + { 1211 + int status; 1212 + 1213 + if (adapter->if_flags & BE_IF_FLAGS_MCAST_PROMISCUOUS) 1214 + return; 1215 + 1216 + status = be_cmd_rx_filter(adapter, BE_IF_FLAGS_MCAST_PROMISCUOUS, ON); 1217 + if (!status) 1218 + adapter->if_flags |= BE_IF_FLAGS_MCAST_PROMISCUOUS; 1219 + } 1220 + 1221 + static void be_set_mc_list(struct be_adapter *adapter) 1222 + { 1223 + int status; 1224 + 1225 + status = be_cmd_rx_filter(adapter, BE_IF_FLAGS_MULTICAST, ON); 1226 + if (!status) 1227 + adapter->if_flags &= ~BE_IF_FLAGS_MCAST_PROMISCUOUS; 1228 + else 1229 + be_set_mc_promisc(adapter); 1230 + } 1231 + 1232 + static void be_set_uc_list(struct be_adapter *adapter) 1233 + { 1234 + struct netdev_hw_addr *ha; 1235 + int i = 1; /* First slot is claimed by the Primary MAC */ 1236 + 1237 + for (; adapter->uc_macs > 0; adapter->uc_macs--, i++) 1238 + be_cmd_pmac_del(adapter, adapter->if_handle, 1239 + adapter->pmac_id[i], 0); 1240 + 1241 + if (netdev_uc_count(adapter->netdev) > be_max_uc(adapter)) { 1242 + be_set_all_promisc(adapter); 1243 + return; 1244 + } 1245 + 1246 + netdev_for_each_uc_addr(ha, adapter->netdev) { 1247 + adapter->uc_macs++; /* First slot is for Primary MAC */ 1248 + be_cmd_pmac_add(adapter, (u8 *)ha->addr, adapter->if_handle, 1249 + &adapter->pmac_id[adapter->uc_macs], 0); 1250 + } 1251 + } 1252 + 1253 + static void be_clear_uc_list(struct be_adapter *adapter) 1254 + { 1255 + int i; 1256 + 1257 + for (i = 1; i < (adapter->uc_macs + 1); i++) 1258 + be_cmd_pmac_del(adapter, adapter->if_handle, 1259 + adapter->pmac_id[i], 0); 1260 + adapter->uc_macs = 0; 1232 1261 } 1233 1262 1234 1263 static void be_set_rx_mode(struct net_device *netdev) 1235 1264 { 1236 1265 struct be_adapter *adapter = netdev_priv(netdev); 1237 - int status; 1238 1266 1239 1267 if (netdev->flags & IFF_PROMISC) { 1240 - be_cmd_rx_filter(adapter, IFF_PROMISC, ON); 1241 - adapter->promiscuous = true; 1242 - goto done; 1268 + be_set_all_promisc(adapter); 1269 + return; 1243 1270 } 1244 1271 1245 - /* BE was previously in promiscuous mode; disable it */ 1246 - if (adapter->promiscuous) { 1247 - be_clear_promisc(adapter); 1272 + /* Interface was previously in promiscuous mode; disable it */ 1273 + if (be_in_all_promisc(adapter)) { 1274 + be_clear_all_promisc(adapter); 1248 1275 if (adapter->vlans_added) 1249 1276 be_vid_config(adapter); 1250 1277 } 1251 1278 1252 1279 /* Enable multicast promisc if num configured exceeds what we support */ 1253 1280 if (netdev->flags & IFF_ALLMULTI || 1254 - netdev_mc_count(netdev) > be_max_mc(adapter)) 1255 - goto set_mcast_promisc; 1256 - 1257 - if (netdev_uc_count(netdev) != adapter->uc_macs) { 1258 - struct netdev_hw_addr *ha; 1259 - int i = 1; /* First slot is claimed by the Primary MAC */ 1260 - 1261 - for (; adapter->uc_macs > 0; adapter->uc_macs--, i++) { 1262 - be_cmd_pmac_del(adapter, adapter->if_handle, 1263 - adapter->pmac_id[i], 0); 1264 - } 1265 - 1266 - if (netdev_uc_count(netdev) > be_max_uc(adapter)) { 1267 - be_cmd_rx_filter(adapter, IFF_PROMISC, ON); 1268 - adapter->promiscuous = true; 1269 - goto done; 1270 - } 1271 - 1272 - netdev_for_each_uc_addr(ha, adapter->netdev) { 1273 - adapter->uc_macs++; /* First slot is for Primary MAC */ 1274 - be_cmd_pmac_add(adapter, (u8 *)ha->addr, 1275 - adapter->if_handle, 1276 - &adapter->pmac_id[adapter->uc_macs], 0); 1277 - } 1278 - } 1279 - 1280 - status = be_cmd_rx_filter(adapter, IFF_MULTICAST, ON); 1281 - if (!status) { 1282 - if (adapter->flags & BE_FLAGS_MCAST_PROMISC) 1283 - adapter->flags &= ~BE_FLAGS_MCAST_PROMISC; 1284 - goto done; 1285 - } 1286 - 1287 - set_mcast_promisc: 1288 - if (adapter->flags & BE_FLAGS_MCAST_PROMISC) 1281 + netdev_mc_count(netdev) > be_max_mc(adapter)) { 1282 + be_set_mc_promisc(adapter); 1289 1283 return; 1284 + } 1290 1285 1291 - /* Set to MCAST promisc mode if setting MULTICAST address fails 1292 - * or if num configured exceeds what we support 1293 - */ 1294 - status = be_cmd_rx_filter(adapter, IFF_ALLMULTI, ON); 1295 - if (!status) 1296 - adapter->flags |= BE_FLAGS_MCAST_PROMISC; 1297 - done: 1298 - return; 1286 + if (netdev_uc_count(netdev) != adapter->uc_macs) 1287 + be_set_uc_list(adapter); 1288 + 1289 + be_set_mc_list(adapter); 1299 1290 } 1300 1291 1301 1292 static int be_set_vf_mac(struct net_device *netdev, int vf, u8 *mac) ··· 2575 2526 } 2576 2527 } 2577 2528 2529 + #ifdef CONFIG_NET_RX_BUSY_POLL 2530 + static inline bool be_lock_napi(struct be_eq_obj *eqo) 2531 + { 2532 + bool status = true; 2533 + 2534 + spin_lock(&eqo->lock); /* BH is already disabled */ 2535 + if (eqo->state & BE_EQ_LOCKED) { 2536 + WARN_ON(eqo->state & BE_EQ_NAPI); 2537 + eqo->state |= BE_EQ_NAPI_YIELD; 2538 + status = false; 2539 + } else { 2540 + eqo->state = BE_EQ_NAPI; 2541 + } 2542 + spin_unlock(&eqo->lock); 2543 + return status; 2544 + } 2545 + 2546 + static inline void be_unlock_napi(struct be_eq_obj *eqo) 2547 + { 2548 + spin_lock(&eqo->lock); /* BH is already disabled */ 2549 + 2550 + WARN_ON(eqo->state & (BE_EQ_POLL | BE_EQ_NAPI_YIELD)); 2551 + eqo->state = BE_EQ_IDLE; 2552 + 2553 + spin_unlock(&eqo->lock); 2554 + } 2555 + 2556 + static inline bool be_lock_busy_poll(struct be_eq_obj *eqo) 2557 + { 2558 + bool status = true; 2559 + 2560 + spin_lock_bh(&eqo->lock); 2561 + if (eqo->state & BE_EQ_LOCKED) { 2562 + eqo->state |= BE_EQ_POLL_YIELD; 2563 + status = false; 2564 + } else { 2565 + eqo->state |= BE_EQ_POLL; 2566 + } 2567 + spin_unlock_bh(&eqo->lock); 2568 + return status; 2569 + } 2570 + 2571 + static inline void be_unlock_busy_poll(struct be_eq_obj *eqo) 2572 + { 2573 + spin_lock_bh(&eqo->lock); 2574 + 2575 + WARN_ON(eqo->state & (BE_EQ_NAPI)); 2576 + eqo->state = BE_EQ_IDLE; 2577 + 2578 + spin_unlock_bh(&eqo->lock); 2579 + } 2580 + 2581 + static inline void be_enable_busy_poll(struct be_eq_obj *eqo) 2582 + { 2583 + spin_lock_init(&eqo->lock); 2584 + eqo->state = BE_EQ_IDLE; 2585 + } 2586 + 2587 + static inline void be_disable_busy_poll(struct be_eq_obj *eqo) 2588 + { 2589 + local_bh_disable(); 2590 + 2591 + /* It's enough to just acquire napi lock on the eqo to stop 2592 + * be_busy_poll() from processing any queueus. 2593 + */ 2594 + while (!be_lock_napi(eqo)) 2595 + mdelay(1); 2596 + 2597 + local_bh_enable(); 2598 + } 2599 + 2600 + #else /* CONFIG_NET_RX_BUSY_POLL */ 2601 + 2602 + static inline bool be_lock_napi(struct be_eq_obj *eqo) 2603 + { 2604 + return true; 2605 + } 2606 + 2607 + static inline void be_unlock_napi(struct be_eq_obj *eqo) 2608 + { 2609 + } 2610 + 2611 + static inline bool be_lock_busy_poll(struct be_eq_obj *eqo) 2612 + { 2613 + return false; 2614 + } 2615 + 2616 + static inline void be_unlock_busy_poll(struct be_eq_obj *eqo) 2617 + { 2618 + } 2619 + 2620 + static inline void be_enable_busy_poll(struct be_eq_obj *eqo) 2621 + { 2622 + } 2623 + 2624 + static inline void be_disable_busy_poll(struct be_eq_obj *eqo) 2625 + { 2626 + } 2627 + #endif /* CONFIG_NET_RX_BUSY_POLL */ 2628 + 2578 2629 int be_poll(struct napi_struct *napi, int budget) 2579 2630 { 2580 2631 struct be_eq_obj *eqo = container_of(napi, struct be_eq_obj, napi); ··· 2994 2845 be_tx_compl_clean(adapter); 2995 2846 2996 2847 be_rx_qs_destroy(adapter); 2997 - 2998 - for (i = 1; i < (adapter->uc_macs + 1); i++) 2999 - be_cmd_pmac_del(adapter, adapter->if_handle, 3000 - adapter->pmac_id[i], 0); 3001 - adapter->uc_macs = 0; 2848 + be_clear_uc_list(adapter); 3002 2849 3003 2850 for_all_evt_queues(adapter, eqo, i) { 3004 2851 if (msix_enabled(adapter)) ··· 3165 3020 return status; 3166 3021 } 3167 3022 3023 + static void be_vf_eth_addr_generate(struct be_adapter *adapter, u8 *mac) 3024 + { 3025 + u32 addr; 3026 + 3027 + addr = jhash(adapter->netdev->dev_addr, ETH_ALEN, 0); 3028 + 3029 + mac[5] = (u8)(addr & 0xFF); 3030 + mac[4] = (u8)((addr >> 8) & 0xFF); 3031 + mac[3] = (u8)((addr >> 16) & 0xFF); 3032 + /* Use the OUI from the current MAC address */ 3033 + memcpy(mac, adapter->netdev->dev_addr, 3); 3034 + } 3035 + 3168 3036 /* 3169 3037 * Generate a seed MAC address from the PF MAC Address using jhash. 3170 3038 * MAC Address for VFs are assigned incrementally starting from the seed. ··· 3278 3120 3279 3121 static void be_mac_clear(struct be_adapter *adapter) 3280 3122 { 3281 - int i; 3282 - 3283 3123 if (adapter->pmac_id) { 3284 - for (i = 0; i < (adapter->uc_macs + 1); i++) 3285 - be_cmd_pmac_del(adapter, adapter->if_handle, 3286 - adapter->pmac_id[i], 0); 3287 - adapter->uc_macs = 0; 3288 - 3124 + be_cmd_pmac_del(adapter, adapter->if_handle, 3125 + adapter->pmac_id[0], 0); 3289 3126 kfree(adapter->pmac_id); 3290 3127 adapter->pmac_id = NULL; 3291 3128 } ··· 3564 3411 adapter->phy.link_speed = -1; 3565 3412 adapter->if_handle = -1; 3566 3413 adapter->be3_native = false; 3567 - adapter->promiscuous = false; 3414 + adapter->if_flags = 0; 3568 3415 if (be_physfn(adapter)) 3569 3416 adapter->cmd_privileges = MAX_PRIVILEGES; 3570 3417 else ··· 3691 3538 if (status) 3692 3539 return status; 3693 3540 3694 - if (be_physfn(adapter)) { 3541 + be_cmd_query_port_name(adapter); 3542 + 3543 + if (be_physfn(adapter)) { 3695 3544 status = be_cmd_get_active_profile(adapter, &profile_id); 3696 3545 if (!status) 3697 3546 dev_info(&adapter->pdev->dev, ··· 3817 3662 status = be_open(netdev); 3818 3663 3819 3664 return status; 3665 + } 3666 + 3667 + static inline int fw_major_num(const char *fw_ver) 3668 + { 3669 + int fw_major = 0, i; 3670 + 3671 + i = sscanf(fw_ver, "%d.", &fw_major); 3672 + if (i != 1) 3673 + return 0; 3674 + 3675 + return fw_major; 3820 3676 } 3821 3677 3822 3678 static int be_setup(struct be_adapter *adapter) ··· 3979 3813 int status; 3980 3814 u8 crc[4]; 3981 3815 3982 - status = be_cmd_get_flash_crc(adapter, crc, img_optype, img_size - 4); 3816 + status = be_cmd_get_flash_crc(adapter, crc, img_optype, img_offset, 3817 + img_size - 4); 3983 3818 if (status) 3984 3819 return status; 3985 3820 ··· 3996 3829 } 3997 3830 3998 3831 static int be_flash(struct be_adapter *adapter, const u8 *img, 3999 - struct be_dma_mem *flash_cmd, int optype, int img_size) 3832 + struct be_dma_mem *flash_cmd, int optype, int img_size, 3833 + u32 img_offset) 4000 3834 { 3835 + u32 flash_op, num_bytes, total_bytes = img_size, bytes_sent = 0; 4001 3836 struct be_cmd_write_flashrom *req = flash_cmd->va; 4002 - u32 total_bytes, flash_op, num_bytes; 4003 3837 int status; 4004 3838 4005 - total_bytes = img_size; 4006 3839 while (total_bytes) { 4007 3840 num_bytes = min_t(u32, 32*1024, total_bytes); 4008 3841 ··· 4023 3856 memcpy(req->data_buf, img, num_bytes); 4024 3857 img += num_bytes; 4025 3858 status = be_cmd_write_flashrom(adapter, flash_cmd, optype, 4026 - flash_op, num_bytes); 3859 + flash_op, img_offset + 3860 + bytes_sent, num_bytes); 4027 3861 if (base_status(status) == MCC_STATUS_ILLEGAL_REQUEST && 4028 3862 optype == OPTYPE_PHY_FW) 4029 3863 break; 4030 3864 else if (status) 4031 3865 return status; 3866 + 3867 + bytes_sent += num_bytes; 4032 3868 } 4033 3869 return 0; 4034 3870 } ··· 4099 3929 pflashcomp = gen2_flash_types; 4100 3930 filehdr_size = sizeof(struct flash_file_hdr_g2); 4101 3931 num_comp = ARRAY_SIZE(gen2_flash_types); 3932 + img_hdrs_size = 0; 4102 3933 } 4103 3934 4104 3935 /* Get flash section info*/ ··· 4144 3973 return -1; 4145 3974 4146 3975 status = be_flash(adapter, p, flash_cmd, pflashcomp[i].optype, 4147 - pflashcomp[i].size); 3976 + pflashcomp[i].size, 0); 4148 3977 if (status) { 4149 3978 dev_err(dev, "Flashing section type 0x%x failed\n", 4150 3979 pflashcomp[i].img_type); ··· 4211 4040 struct be_dma_mem *flash_cmd, int num_of_images) 4212 4041 { 4213 4042 int img_hdrs_size = num_of_images * sizeof(struct image_hdr); 4043 + bool crc_match, old_fw_img, flash_offset_support = true; 4214 4044 struct device *dev = &adapter->pdev->dev; 4215 4045 struct flash_section_info *fsec = NULL; 4216 4046 u32 img_offset, img_size, img_type; 4047 + u16 img_optype, flash_optype; 4217 4048 int status, i, filehdr_size; 4218 - bool crc_match, old_fw_img; 4219 - u16 img_optype; 4220 4049 const u8 *p; 4221 4050 4222 4051 filehdr_size = sizeof(struct flash_file_hdr_g3); ··· 4226 4055 return -EINVAL; 4227 4056 } 4228 4057 4058 + retry_flash: 4229 4059 for (i = 0; i < le32_to_cpu(fsec->fsec_hdr.num_images); i++) { 4230 4060 img_offset = le32_to_cpu(fsec->fsec_entry[i].offset); 4231 4061 img_size = le32_to_cpu(fsec->fsec_entry[i].pad_size); ··· 4236 4064 4237 4065 if (img_optype == 0xFFFF) 4238 4066 continue; 4067 + 4068 + if (flash_offset_support) 4069 + flash_optype = OPTYPE_OFFSET_SPECIFIED; 4070 + else 4071 + flash_optype = img_optype; 4072 + 4239 4073 /* Don't bother verifying CRC if an old FW image is being 4240 4074 * flashed 4241 4075 */ ··· 4250 4072 4251 4073 status = be_check_flash_crc(adapter, fw->data, img_offset, 4252 4074 img_size, filehdr_size + 4253 - img_hdrs_size, img_optype, 4075 + img_hdrs_size, flash_optype, 4254 4076 &crc_match); 4255 - /* The current FW image on the card does not recognize the new 4256 - * FLASH op_type. The FW download is partially complete. 4257 - * Reboot the server now to enable FW image to recognize the 4258 - * new FLASH op_type. To complete the remaining process, 4259 - * download the same FW again after the reboot. 4260 - */ 4261 4077 if (base_status(status) == MCC_STATUS_ILLEGAL_REQUEST || 4262 4078 base_status(status) == MCC_STATUS_ILLEGAL_FIELD) { 4079 + /* The current FW image on the card does not support 4080 + * OFFSET based flashing. Retry using older mechanism 4081 + * of OPTYPE based flashing 4082 + */ 4083 + if (flash_optype == OPTYPE_OFFSET_SPECIFIED) { 4084 + flash_offset_support = false; 4085 + goto retry_flash; 4086 + } 4087 + 4088 + /* The current FW image on the card does not recognize 4089 + * the new FLASH op_type. The FW download is partially 4090 + * complete. Reboot the server now to enable FW image 4091 + * to recognize the new FLASH op_type. To complete the 4092 + * remaining process, download the same FW again after 4093 + * the reboot. 4094 + */ 4263 4095 dev_err(dev, "Flash incomplete. Reset the server\n"); 4264 4096 dev_err(dev, "Download FW image again after reset\n"); 4265 4097 return -EAGAIN; ··· 4287 4099 if (p + img_size > fw->data + fw->size) 4288 4100 return -1; 4289 4101 4290 - status = be_flash(adapter, p, flash_cmd, img_optype, img_size); 4102 + status = be_flash(adapter, p, flash_cmd, flash_optype, img_size, 4103 + img_offset); 4104 + 4105 + /* The current FW image on the card does not support OFFSET 4106 + * based flashing. Retry using older mechanism of OPTYPE based 4107 + * flashing 4108 + */ 4109 + if (base_status(status) == MCC_STATUS_ILLEGAL_FIELD && 4110 + flash_optype == OPTYPE_OFFSET_SPECIFIED) { 4111 + flash_offset_support = false; 4112 + goto retry_flash; 4113 + } 4114 + 4291 4115 /* For old FW images ignore ILLEGAL_FIELD error or errors on 4292 4116 * UFI_DIR region 4293 4117 */ ··· 4402 4202 return 0; 4403 4203 } 4404 4204 4405 - #define UFI_TYPE2 2 4406 - #define UFI_TYPE3 3 4407 - #define UFI_TYPE3R 10 4408 - #define UFI_TYPE4 4 4205 + #define BE2_UFI 2 4206 + #define BE3_UFI 3 4207 + #define BE3R_UFI 10 4208 + #define SH_UFI 4 4209 + #define SH_P2_UFI 11 4210 + 4409 4211 static int be_get_ufi_type(struct be_adapter *adapter, 4410 4212 struct flash_file_hdr_g3 *fhdr) 4411 4213 { 4412 - if (!fhdr) 4413 - goto be_get_ufi_exit; 4214 + if (!fhdr) { 4215 + dev_err(&adapter->pdev->dev, "Invalid FW UFI file"); 4216 + return -1; 4217 + } 4414 4218 4415 - if (skyhawk_chip(adapter) && fhdr->build[0] == '4') 4416 - return UFI_TYPE4; 4417 - else if (BE3_chip(adapter) && fhdr->build[0] == '3') { 4418 - if (fhdr->asic_type_rev == 0x10) 4419 - return UFI_TYPE3R; 4420 - else 4421 - return UFI_TYPE3; 4422 - } else if (BE2_chip(adapter) && fhdr->build[0] == '2') 4423 - return UFI_TYPE2; 4219 + /* First letter of the build version is used to identify 4220 + * which chip this image file is meant for. 4221 + */ 4222 + switch (fhdr->build[0]) { 4223 + case BLD_STR_UFI_TYPE_SH: 4224 + return (fhdr->asic_type_rev == ASIC_REV_P2) ? SH_P2_UFI : 4225 + SH_UFI; 4226 + case BLD_STR_UFI_TYPE_BE3: 4227 + return (fhdr->asic_type_rev == ASIC_REV_B0) ? BE3R_UFI : 4228 + BE3_UFI; 4229 + case BLD_STR_UFI_TYPE_BE2: 4230 + return BE2_UFI; 4231 + default: 4232 + return -1; 4233 + } 4234 + } 4424 4235 4425 - be_get_ufi_exit: 4426 - dev_err(&adapter->pdev->dev, 4427 - "UFI and Interface are not compatible for flashing\n"); 4428 - return -1; 4236 + /* Check if the flash image file is compatible with the adapter that 4237 + * is being flashed. 4238 + * BE3 chips with asic-rev B0 must be flashed only with BE3R_UFI type. 4239 + * Skyhawk chips with asic-rev P2 must be flashed only with SH_P2_UFI type. 4240 + */ 4241 + static bool be_check_ufi_compatibility(struct be_adapter *adapter, 4242 + struct flash_file_hdr_g3 *fhdr) 4243 + { 4244 + int ufi_type = be_get_ufi_type(adapter, fhdr); 4245 + 4246 + switch (ufi_type) { 4247 + case SH_P2_UFI: 4248 + return skyhawk_chip(adapter); 4249 + case SH_UFI: 4250 + return (skyhawk_chip(adapter) && 4251 + adapter->asic_rev < ASIC_REV_P2); 4252 + case BE3R_UFI: 4253 + return BE3_chip(adapter); 4254 + case BE3_UFI: 4255 + return (BE3_chip(adapter) && adapter->asic_rev < ASIC_REV_B0); 4256 + case BE2_UFI: 4257 + return BE2_chip(adapter); 4258 + default: 4259 + return false; 4260 + } 4429 4261 } 4430 4262 4431 4263 static int be_fw_download(struct be_adapter *adapter, const struct firmware* fw) 4432 4264 { 4265 + struct device *dev = &adapter->pdev->dev; 4433 4266 struct flash_file_hdr_g3 *fhdr3; 4434 - struct image_hdr *img_hdr_ptr = NULL; 4267 + struct image_hdr *img_hdr_ptr; 4268 + int status = 0, i, num_imgs; 4435 4269 struct be_dma_mem flash_cmd; 4436 - const u8 *p; 4437 - int status = 0, i = 0, num_imgs = 0, ufi_type = 0; 4438 4270 4439 - flash_cmd.size = sizeof(struct be_cmd_write_flashrom); 4440 - flash_cmd.va = dma_alloc_coherent(&adapter->pdev->dev, flash_cmd.size, 4441 - &flash_cmd.dma, GFP_KERNEL); 4442 - if (!flash_cmd.va) { 4443 - status = -ENOMEM; 4444 - goto be_fw_exit; 4271 + fhdr3 = (struct flash_file_hdr_g3 *)fw->data; 4272 + if (!be_check_ufi_compatibility(adapter, fhdr3)) { 4273 + dev_err(dev, "Flash image is not compatible with adapter\n"); 4274 + return -EINVAL; 4445 4275 } 4446 4276 4447 - p = fw->data; 4448 - fhdr3 = (struct flash_file_hdr_g3 *)p; 4449 - 4450 - ufi_type = be_get_ufi_type(adapter, fhdr3); 4277 + flash_cmd.size = sizeof(struct be_cmd_write_flashrom); 4278 + flash_cmd.va = dma_alloc_coherent(dev, flash_cmd.size, &flash_cmd.dma, 4279 + GFP_KERNEL); 4280 + if (!flash_cmd.va) 4281 + return -ENOMEM; 4451 4282 4452 4283 num_imgs = le32_to_cpu(fhdr3->num_imgs); 4453 4284 for (i = 0; i < num_imgs; i++) { 4454 4285 img_hdr_ptr = (struct image_hdr *)(fw->data + 4455 4286 (sizeof(struct flash_file_hdr_g3) + 4456 4287 i * sizeof(struct image_hdr))); 4457 - if (le32_to_cpu(img_hdr_ptr->imageid) == 1) { 4458 - switch (ufi_type) { 4459 - case UFI_TYPE4: 4460 - status = be_flash_skyhawk(adapter, fw, 4461 - &flash_cmd, num_imgs); 4462 - break; 4463 - case UFI_TYPE3R: 4464 - status = be_flash_BEx(adapter, fw, &flash_cmd, 4465 - num_imgs); 4466 - break; 4467 - case UFI_TYPE3: 4468 - /* Do not flash this ufi on BE3-R cards */ 4469 - if (adapter->asic_rev < 0x10) 4470 - status = be_flash_BEx(adapter, fw, 4471 - &flash_cmd, 4472 - num_imgs); 4473 - else { 4474 - status = -EINVAL; 4475 - dev_err(&adapter->pdev->dev, 4476 - "Can't load BE3 UFI on BE3R\n"); 4477 - } 4478 - } 4479 - } 4288 + if (!BE2_chip(adapter) && 4289 + le32_to_cpu(img_hdr_ptr->imageid) != 1) 4290 + continue; 4291 + 4292 + if (skyhawk_chip(adapter)) 4293 + status = be_flash_skyhawk(adapter, fw, &flash_cmd, 4294 + num_imgs); 4295 + else 4296 + status = be_flash_BEx(adapter, fw, &flash_cmd, 4297 + num_imgs); 4480 4298 } 4481 4299 4482 - if (ufi_type == UFI_TYPE2) 4483 - status = be_flash_BEx(adapter, fw, &flash_cmd, 0); 4484 - else if (ufi_type == -1) 4485 - status = -EINVAL; 4300 + dma_free_coherent(dev, flash_cmd.size, flash_cmd.va, flash_cmd.dma); 4301 + if (!status) 4302 + dev_info(dev, "Firmware flashed successfully\n"); 4486 4303 4487 - dma_free_coherent(&adapter->pdev->dev, flash_cmd.size, flash_cmd.va, 4488 - flash_cmd.dma); 4489 - if (status) { 4490 - dev_err(&adapter->pdev->dev, "Firmware load error\n"); 4491 - goto be_fw_exit; 4492 - } 4493 - 4494 - dev_info(&adapter->pdev->dev, "Firmware flashed successfully\n"); 4495 - 4496 - be_fw_exit: 4497 4304 return status; 4498 4305 } 4499 4306 ··· 5063 4856 msecs_to_jiffies(1000)); 5064 4857 } 5065 4858 4859 + static void be_log_sfp_info(struct be_adapter *adapter) 4860 + { 4861 + int status; 4862 + 4863 + status = be_cmd_query_sfp_info(adapter); 4864 + if (!status) { 4865 + dev_err(&adapter->pdev->dev, 4866 + "Unqualified SFP+ detected on %c from %s part no: %s", 4867 + adapter->port_name, adapter->phy.vendor_name, 4868 + adapter->phy.vendor_pn); 4869 + } 4870 + adapter->flags &= ~BE_FLAGS_EVT_INCOMPATIBLE_SFP; 4871 + } 4872 + 5066 4873 static void be_worker(struct work_struct *work) 5067 4874 { 5068 4875 struct be_adapter *adapter = ··· 5114 4893 } 5115 4894 5116 4895 be_eqd_update(adapter); 4896 + 4897 + if (adapter->flags & BE_FLAGS_EVT_INCOMPATIBLE_SFP) 4898 + be_log_sfp_info(adapter); 5117 4899 5118 4900 reschedule: 5119 4901 adapter->work_counter++; ··· 5164 4940 return be_physfn(adapter) ? "PF" : "VF"; 5165 4941 } 5166 4942 4943 + static inline char *nic_name(struct pci_dev *pdev) 4944 + { 4945 + switch (pdev->device) { 4946 + case OC_DEVICE_ID1: 4947 + return OC_NAME; 4948 + case OC_DEVICE_ID2: 4949 + return OC_NAME_BE; 4950 + case OC_DEVICE_ID3: 4951 + case OC_DEVICE_ID4: 4952 + return OC_NAME_LANCER; 4953 + case BE_DEVICE_ID2: 4954 + return BE3_NAME; 4955 + case OC_DEVICE_ID5: 4956 + case OC_DEVICE_ID6: 4957 + return OC_NAME_SH; 4958 + default: 4959 + return BE_NAME; 4960 + } 4961 + } 4962 + 5167 4963 static int be_probe(struct pci_dev *pdev, const struct pci_device_id *pdev_id) 5168 4964 { 5169 - int status = 0; 5170 4965 struct be_adapter *adapter; 5171 4966 struct net_device *netdev; 5172 - char port_name; 4967 + int status = 0; 5173 4968 5174 4969 dev_info(&pdev->dev, "%s version is %s\n", DRV_NAME, DRV_VER); 5175 4970 ··· 5282 5039 schedule_delayed_work(&adapter->func_recovery_work, 5283 5040 msecs_to_jiffies(1000)); 5284 5041 5285 - be_cmd_query_port_name(adapter, &port_name); 5286 - 5287 5042 dev_info(&pdev->dev, "%s: %s %s port %c\n", nic_name(pdev), 5288 - func_name(adapter), mc_name(adapter), port_name); 5043 + func_name(adapter), mc_name(adapter), adapter->port_name); 5289 5044 5290 5045 return 0; 5291 5046