diff options
Diffstat (limited to 'drivers/net/netxen/netxen_nic_hw.c')
-rw-r--r-- | drivers/net/netxen/netxen_nic_hw.c | 64 |
1 files changed, 31 insertions, 33 deletions
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index 29d7b93d0493..5cef718fe35f 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -319,6 +319,8 @@ static unsigned crb_hub_agt[64] = | |||
319 | 319 | ||
320 | #define NETXEN_PCIE_SEM_TIMEOUT 10000 | 320 | #define NETXEN_PCIE_SEM_TIMEOUT 10000 |
321 | 321 | ||
322 | static int netxen_nic_set_mtu_xgb(struct netxen_adapter *adapter, int new_mtu); | ||
323 | |||
322 | int | 324 | int |
323 | netxen_pcie_sem_lock(struct netxen_adapter *adapter, int sem, u32 id_reg) | 325 | netxen_pcie_sem_lock(struct netxen_adapter *adapter, int sem, u32 id_reg) |
324 | { | 326 | { |
@@ -345,7 +347,7 @@ netxen_pcie_sem_unlock(struct netxen_adapter *adapter, int sem) | |||
345 | NXRD32(adapter, NETXEN_PCIE_REG(PCIE_SEM_UNLOCK(sem))); | 347 | NXRD32(adapter, NETXEN_PCIE_REG(PCIE_SEM_UNLOCK(sem))); |
346 | } | 348 | } |
347 | 349 | ||
348 | int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port) | 350 | static int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port) |
349 | { | 351 | { |
350 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { | 352 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { |
351 | NXWR32(adapter, NETXEN_NIU_XGE_CONFIG_1+(0x10000*port), 0x1447); | 353 | NXWR32(adapter, NETXEN_NIU_XGE_CONFIG_1+(0x10000*port), 0x1447); |
@@ -356,7 +358,7 @@ int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port) | |||
356 | } | 358 | } |
357 | 359 | ||
358 | /* Disable an XG interface */ | 360 | /* Disable an XG interface */ |
359 | int netxen_niu_disable_xg_port(struct netxen_adapter *adapter) | 361 | static int netxen_niu_disable_xg_port(struct netxen_adapter *adapter) |
360 | { | 362 | { |
361 | __u32 mac_cfg; | 363 | __u32 mac_cfg; |
362 | u32 port = adapter->physical_port; | 364 | u32 port = adapter->physical_port; |
@@ -383,7 +385,7 @@ int netxen_niu_disable_xg_port(struct netxen_adapter *adapter) | |||
383 | #define MAC_LO(addr) \ | 385 | #define MAC_LO(addr) \ |
384 | ((addr[5] << 16) | (addr[4] << 8) | (addr[3])) | 386 | ((addr[5] << 16) | (addr[4] << 8) | (addr[3])) |
385 | 387 | ||
386 | int netxen_p2_nic_set_promisc(struct netxen_adapter *adapter, u32 mode) | 388 | static int netxen_p2_nic_set_promisc(struct netxen_adapter *adapter, u32 mode) |
387 | { | 389 | { |
388 | u32 mac_cfg; | 390 | u32 mac_cfg; |
389 | u32 cnt = 0; | 391 | u32 cnt = 0; |
@@ -434,7 +436,7 @@ int netxen_p2_nic_set_promisc(struct netxen_adapter *adapter, u32 mode) | |||
434 | return 0; | 436 | return 0; |
435 | } | 437 | } |
436 | 438 | ||
437 | int netxen_p2_nic_set_mac_addr(struct netxen_adapter *adapter, u8 *addr) | 439 | static int netxen_p2_nic_set_mac_addr(struct netxen_adapter *adapter, u8 *addr) |
438 | { | 440 | { |
439 | u32 mac_hi, mac_lo; | 441 | u32 mac_hi, mac_lo; |
440 | u32 reg_hi, reg_lo; | 442 | u32 reg_hi, reg_lo; |
@@ -531,7 +533,7 @@ netxen_nic_set_mcast_addr(struct netxen_adapter *adapter, | |||
531 | return 0; | 533 | return 0; |
532 | } | 534 | } |
533 | 535 | ||
534 | void netxen_p2_nic_set_multi(struct net_device *netdev) | 536 | static void netxen_p2_nic_set_multi(struct net_device *netdev) |
535 | { | 537 | { |
536 | struct netxen_adapter *adapter = netdev_priv(netdev); | 538 | struct netxen_adapter *adapter = netdev_priv(netdev); |
537 | struct netdev_hw_addr *ha; | 539 | struct netdev_hw_addr *ha; |
@@ -598,8 +600,14 @@ netxen_send_cmd_descs(struct netxen_adapter *adapter, | |||
598 | 600 | ||
599 | if (nr_desc >= netxen_tx_avail(tx_ring)) { | 601 | if (nr_desc >= netxen_tx_avail(tx_ring)) { |
600 | netif_tx_stop_queue(tx_ring->txq); | 602 | netif_tx_stop_queue(tx_ring->txq); |
601 | __netif_tx_unlock_bh(tx_ring->txq); | 603 | smp_mb(); |
602 | return -EBUSY; | 604 | if (netxen_tx_avail(tx_ring) > nr_desc) { |
605 | if (netxen_tx_avail(tx_ring) > TX_STOP_THRESH) | ||
606 | netif_tx_wake_queue(tx_ring->txq); | ||
607 | } else { | ||
608 | __netif_tx_unlock_bh(tx_ring->txq); | ||
609 | return -EBUSY; | ||
610 | } | ||
603 | } | 611 | } |
604 | 612 | ||
605 | do { | 613 | do { |
@@ -647,7 +655,7 @@ nx_p3_sre_macaddr_change(struct netxen_adapter *adapter, u8 *addr, unsigned op) | |||
647 | } | 655 | } |
648 | 656 | ||
649 | static int nx_p3_nic_add_mac(struct netxen_adapter *adapter, | 657 | static int nx_p3_nic_add_mac(struct netxen_adapter *adapter, |
650 | u8 *addr, struct list_head *del_list) | 658 | const u8 *addr, struct list_head *del_list) |
651 | { | 659 | { |
652 | struct list_head *head; | 660 | struct list_head *head; |
653 | nx_mac_list_t *cur; | 661 | nx_mac_list_t *cur; |
@@ -674,11 +682,13 @@ static int nx_p3_nic_add_mac(struct netxen_adapter *adapter, | |||
674 | cur->mac_addr, NETXEN_MAC_ADD); | 682 | cur->mac_addr, NETXEN_MAC_ADD); |
675 | } | 683 | } |
676 | 684 | ||
677 | void netxen_p3_nic_set_multi(struct net_device *netdev) | 685 | static void netxen_p3_nic_set_multi(struct net_device *netdev) |
678 | { | 686 | { |
679 | struct netxen_adapter *adapter = netdev_priv(netdev); | 687 | struct netxen_adapter *adapter = netdev_priv(netdev); |
680 | struct netdev_hw_addr *ha; | 688 | struct netdev_hw_addr *ha; |
681 | u8 bcast_addr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; | 689 | static const u8 bcast_addr[ETH_ALEN] = { |
690 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff | ||
691 | }; | ||
682 | u32 mode = VPORT_MISS_MODE_DROP; | 692 | u32 mode = VPORT_MISS_MODE_DROP; |
683 | LIST_HEAD(del_list); | 693 | LIST_HEAD(del_list); |
684 | struct list_head *head; | 694 | struct list_head *head; |
@@ -721,7 +731,7 @@ send_fw_cmd: | |||
721 | } | 731 | } |
722 | } | 732 | } |
723 | 733 | ||
724 | int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32 mode) | 734 | static int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32 mode) |
725 | { | 735 | { |
726 | nx_nic_req_t req; | 736 | nx_nic_req_t req; |
727 | u64 word; | 737 | u64 word; |
@@ -754,7 +764,7 @@ void netxen_p3_free_mac_list(struct netxen_adapter *adapter) | |||
754 | } | 764 | } |
755 | } | 765 | } |
756 | 766 | ||
757 | int netxen_p3_nic_set_mac_addr(struct netxen_adapter *adapter, u8 *addr) | 767 | static int netxen_p3_nic_set_mac_addr(struct netxen_adapter *adapter, u8 *addr) |
758 | { | 768 | { |
759 | /* assuming caller has already copied new addr to netdev */ | 769 | /* assuming caller has already copied new addr to netdev */ |
760 | netxen_p3_nic_set_multi(adapter->netdev); | 770 | netxen_p3_nic_set_multi(adapter->netdev); |
@@ -799,9 +809,6 @@ int netxen_config_hw_lro(struct netxen_adapter *adapter, int enable) | |||
799 | u64 word; | 809 | u64 word; |
800 | int rv = 0; | 810 | int rv = 0; |
801 | 811 | ||
802 | if ((adapter->flags & NETXEN_NIC_LRO_ENABLED) == enable) | ||
803 | return 0; | ||
804 | |||
805 | memset(&req, 0, sizeof(nx_nic_req_t)); | 812 | memset(&req, 0, sizeof(nx_nic_req_t)); |
806 | 813 | ||
807 | req.qhdr = cpu_to_le64(NX_HOST_REQUEST << 23); | 814 | req.qhdr = cpu_to_le64(NX_HOST_REQUEST << 23); |
@@ -817,8 +824,6 @@ int netxen_config_hw_lro(struct netxen_adapter *adapter, int enable) | |||
817 | "configure hw lro request\n"); | 824 | "configure hw lro request\n"); |
818 | } | 825 | } |
819 | 826 | ||
820 | adapter->flags ^= NETXEN_NIC_LRO_ENABLED; | ||
821 | |||
822 | return rv; | 827 | return rv; |
823 | } | 828 | } |
824 | 829 | ||
@@ -861,9 +866,11 @@ int netxen_config_rss(struct netxen_adapter *adapter, int enable) | |||
861 | u64 word; | 866 | u64 word; |
862 | int i, rv; | 867 | int i, rv; |
863 | 868 | ||
864 | u64 key[] = { 0xbeac01fa6a42b73bULL, 0x8030f20c77cb2da3ULL, | 869 | static const u64 key[] = { |
865 | 0xae7b30b4d0ca2bcbULL, 0x43a38fb04167253dULL, | 870 | 0xbeac01fa6a42b73bULL, 0x8030f20c77cb2da3ULL, |
866 | 0x255b0ec26d5a56daULL }; | 871 | 0xae7b30b4d0ca2bcbULL, 0x43a38fb04167253dULL, |
872 | 0x255b0ec26d5a56daULL | ||
873 | }; | ||
867 | 874 | ||
868 | 875 | ||
869 | memset(&req, 0, sizeof(nx_nic_req_t)); | 876 | memset(&req, 0, sizeof(nx_nic_req_t)); |
@@ -887,7 +894,7 @@ int netxen_config_rss(struct netxen_adapter *adapter, int enable) | |||
887 | ((u64)(enable & 0x1) << 8) | | 894 | ((u64)(enable & 0x1) << 8) | |
888 | ((0x7ULL) << 48); | 895 | ((0x7ULL) << 48); |
889 | req.words[0] = cpu_to_le64(word); | 896 | req.words[0] = cpu_to_le64(word); |
890 | for (i = 0; i < 5; i++) | 897 | for (i = 0; i < ARRAY_SIZE(key); i++) |
891 | req.words[i+1] = cpu_to_le64(key[i]); | 898 | req.words[i+1] = cpu_to_le64(key[i]); |
892 | 899 | ||
893 | 900 | ||
@@ -1816,14 +1823,14 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter) | |||
1816 | if (netxen_rom_fast_read(adapter, offset, &board_type)) | 1823 | if (netxen_rom_fast_read(adapter, offset, &board_type)) |
1817 | return -EIO; | 1824 | return -EIO; |
1818 | 1825 | ||
1819 | adapter->ahw.board_type = board_type; | ||
1820 | |||
1821 | if (board_type == NETXEN_BRDTYPE_P3_4_GB_MM) { | 1826 | if (board_type == NETXEN_BRDTYPE_P3_4_GB_MM) { |
1822 | u32 gpio = NXRD32(adapter, NETXEN_ROMUSB_GLB_PAD_GPIO_I); | 1827 | u32 gpio = NXRD32(adapter, NETXEN_ROMUSB_GLB_PAD_GPIO_I); |
1823 | if ((gpio & 0x8000) == 0) | 1828 | if ((gpio & 0x8000) == 0) |
1824 | board_type = NETXEN_BRDTYPE_P3_10G_TP; | 1829 | board_type = NETXEN_BRDTYPE_P3_10G_TP; |
1825 | } | 1830 | } |
1826 | 1831 | ||
1832 | adapter->ahw.board_type = board_type; | ||
1833 | |||
1827 | switch (board_type) { | 1834 | switch (board_type) { |
1828 | case NETXEN_BRDTYPE_P2_SB35_4G: | 1835 | case NETXEN_BRDTYPE_P2_SB35_4G: |
1829 | adapter->ahw.port_type = NETXEN_NIC_GBE; | 1836 | adapter->ahw.port_type = NETXEN_NIC_GBE; |
@@ -1867,16 +1874,7 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter) | |||
1867 | } | 1874 | } |
1868 | 1875 | ||
1869 | /* NIU access sections */ | 1876 | /* NIU access sections */ |
1870 | 1877 | static int netxen_nic_set_mtu_xgb(struct netxen_adapter *adapter, int new_mtu) | |
1871 | int netxen_nic_set_mtu_gb(struct netxen_adapter *adapter, int new_mtu) | ||
1872 | { | ||
1873 | new_mtu += MTU_FUDGE_FACTOR; | ||
1874 | NXWR32(adapter, NETXEN_NIU_GB_MAX_FRAME_SIZE(adapter->physical_port), | ||
1875 | new_mtu); | ||
1876 | return 0; | ||
1877 | } | ||
1878 | |||
1879 | int netxen_nic_set_mtu_xgb(struct netxen_adapter *adapter, int new_mtu) | ||
1880 | { | 1878 | { |
1881 | new_mtu += MTU_FUDGE_FACTOR; | 1879 | new_mtu += MTU_FUDGE_FACTOR; |
1882 | if (adapter->physical_port == 0) | 1880 | if (adapter->physical_port == 0) |