diff options
Diffstat (limited to 'drivers/net/netxen')
-rw-r--r-- | drivers/net/netxen/netxen_nic.h | 8 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_ethtool.c | 1 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_hdr.h | 2 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_hw.c | 59 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_init.c | 28 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_main.c | 220 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_phan_reg.h | 2 |
7 files changed, 159 insertions, 161 deletions
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index 93a7b9b668d5..244ab49c4337 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -45,7 +45,6 @@ | |||
45 | #include <linux/in.h> | 45 | #include <linux/in.h> |
46 | #include <linux/tcp.h> | 46 | #include <linux/tcp.h> |
47 | #include <linux/skbuff.h> | 47 | #include <linux/skbuff.h> |
48 | #include <linux/version.h> | ||
49 | 48 | ||
50 | #include <linux/ethtool.h> | 49 | #include <linux/ethtool.h> |
51 | #include <linux/mii.h> | 50 | #include <linux/mii.h> |
@@ -66,8 +65,8 @@ | |||
66 | 65 | ||
67 | #define _NETXEN_NIC_LINUX_MAJOR 4 | 66 | #define _NETXEN_NIC_LINUX_MAJOR 4 |
68 | #define _NETXEN_NIC_LINUX_MINOR 0 | 67 | #define _NETXEN_NIC_LINUX_MINOR 0 |
69 | #define _NETXEN_NIC_LINUX_SUBVERSION 0 | 68 | #define _NETXEN_NIC_LINUX_SUBVERSION 11 |
70 | #define NETXEN_NIC_LINUX_VERSIONID "4.0.0" | 69 | #define NETXEN_NIC_LINUX_VERSIONID "4.0.11" |
71 | 70 | ||
72 | #define NETXEN_VERSION_CODE(a, b, c) (((a) << 16) + ((b) << 8) + (c)) | 71 | #define NETXEN_VERSION_CODE(a, b, c) (((a) << 16) + ((b) << 8) + (c)) |
73 | 72 | ||
@@ -1615,7 +1614,8 @@ dma_watchdog_wakeup(struct netxen_adapter *adapter) | |||
1615 | 1614 | ||
1616 | 1615 | ||
1617 | int netxen_is_flash_supported(struct netxen_adapter *adapter); | 1616 | int netxen_is_flash_supported(struct netxen_adapter *adapter); |
1618 | int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, __le64 mac[]); | 1617 | int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, __le64 *mac); |
1618 | int netxen_p3_get_mac_addr(struct netxen_adapter *adapter, __le64 *mac); | ||
1619 | extern void netxen_change_ringparam(struct netxen_adapter *adapter); | 1619 | extern void netxen_change_ringparam(struct netxen_adapter *adapter); |
1620 | extern int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr, | 1620 | extern int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr, |
1621 | int *valp); | 1621 | int *valp); |
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c index 4ad3e0844b99..b974ca0fc530 100644 --- a/drivers/net/netxen/netxen_nic_ethtool.c +++ b/drivers/net/netxen/netxen_nic_ethtool.c | |||
@@ -38,7 +38,6 @@ | |||
38 | #include <asm/io.h> | 38 | #include <asm/io.h> |
39 | #include <linux/netdevice.h> | 39 | #include <linux/netdevice.h> |
40 | #include <linux/ethtool.h> | 40 | #include <linux/ethtool.h> |
41 | #include <linux/version.h> | ||
42 | 41 | ||
43 | #include "netxen_nic.h" | 42 | #include "netxen_nic.h" |
44 | #include "netxen_nic_hw.h" | 43 | #include "netxen_nic_hw.h" |
diff --git a/drivers/net/netxen/netxen_nic_hdr.h b/drivers/net/netxen/netxen_nic_hdr.h index e8e8d73f6ed7..e80f9e3e5973 100644 --- a/drivers/net/netxen/netxen_nic_hdr.h +++ b/drivers/net/netxen/netxen_nic_hdr.h | |||
@@ -32,8 +32,6 @@ | |||
32 | 32 | ||
33 | #include <linux/module.h> | 33 | #include <linux/module.h> |
34 | #include <linux/kernel.h> | 34 | #include <linux/kernel.h> |
35 | #include <linux/version.h> | ||
36 | |||
37 | #include <linux/spinlock.h> | 35 | #include <linux/spinlock.h> |
38 | #include <asm/irq.h> | 36 | #include <asm/irq.h> |
39 | #include <linux/init.h> | 37 | #include <linux/init.h> |
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index 9aa20f961618..84978f80f396 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -733,31 +733,56 @@ static int netxen_get_flash_block(struct netxen_adapter *adapter, int base, | |||
733 | return 0; | 733 | return 0; |
734 | } | 734 | } |
735 | 735 | ||
736 | int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, __le64 mac[]) | 736 | int netxen_get_flash_mac_addr(struct netxen_adapter *adapter, __le64 *mac) |
737 | { | 737 | { |
738 | __le32 *pmac = (__le32 *) & mac[0]; | 738 | __le32 *pmac = (__le32 *) mac; |
739 | u32 offset; | ||
739 | 740 | ||
740 | if (netxen_get_flash_block(adapter, | 741 | offset = NETXEN_USER_START + |
741 | NETXEN_USER_START + | 742 | offsetof(struct netxen_new_user_info, mac_addr) + |
742 | offsetof(struct netxen_new_user_info, | 743 | adapter->portnum * sizeof(u64); |
743 | mac_addr), | 744 | |
744 | FLASH_NUM_PORTS * sizeof(u64), pmac) == -1) { | 745 | if (netxen_get_flash_block(adapter, offset, sizeof(u64), pmac) == -1) |
745 | return -1; | 746 | return -1; |
746 | } | 747 | |
747 | if (*mac == cpu_to_le64(~0ULL)) { | 748 | if (*mac == cpu_to_le64(~0ULL)) { |
749 | |||
750 | offset = NETXEN_USER_START_OLD + | ||
751 | offsetof(struct netxen_user_old_info, mac_addr) + | ||
752 | adapter->portnum * sizeof(u64); | ||
753 | |||
748 | if (netxen_get_flash_block(adapter, | 754 | if (netxen_get_flash_block(adapter, |
749 | NETXEN_USER_START_OLD + | 755 | offset, sizeof(u64), pmac) == -1) |
750 | offsetof(struct netxen_user_old_info, | ||
751 | mac_addr), | ||
752 | FLASH_NUM_PORTS * sizeof(u64), | ||
753 | pmac) == -1) | ||
754 | return -1; | 756 | return -1; |
757 | |||
755 | if (*mac == cpu_to_le64(~0ULL)) | 758 | if (*mac == cpu_to_le64(~0ULL)) |
756 | return -1; | 759 | return -1; |
757 | } | 760 | } |
758 | return 0; | 761 | return 0; |
759 | } | 762 | } |
760 | 763 | ||
764 | int netxen_p3_get_mac_addr(struct netxen_adapter *adapter, __le64 *mac) | ||
765 | { | ||
766 | uint32_t crbaddr, mac_hi, mac_lo; | ||
767 | int pci_func = adapter->ahw.pci_func; | ||
768 | |||
769 | crbaddr = CRB_MAC_BLOCK_START + | ||
770 | (4 * ((pci_func/2) * 3)) + (4 * (pci_func & 1)); | ||
771 | |||
772 | adapter->hw_read_wx(adapter, crbaddr, &mac_lo, 4); | ||
773 | adapter->hw_read_wx(adapter, crbaddr+4, &mac_hi, 4); | ||
774 | |||
775 | mac_hi = cpu_to_le32(mac_hi); | ||
776 | mac_lo = cpu_to_le32(mac_lo); | ||
777 | |||
778 | if (pci_func & 1) | ||
779 | *mac = ((mac_lo >> 16) | ((u64)mac_hi << 16)); | ||
780 | else | ||
781 | *mac = ((mac_lo) | ((u64)mac_hi << 32)); | ||
782 | |||
783 | return 0; | ||
784 | } | ||
785 | |||
761 | #define CRB_WIN_LOCK_TIMEOUT 100000000 | 786 | #define CRB_WIN_LOCK_TIMEOUT 100000000 |
762 | 787 | ||
763 | static int crb_win_lock(struct netxen_adapter *adapter) | 788 | static int crb_win_lock(struct netxen_adapter *adapter) |
@@ -2183,10 +2208,10 @@ void netxen_nic_flash_print(struct netxen_adapter *adapter) | |||
2183 | if (adapter->portnum == 0) { | 2208 | if (adapter->portnum == 0) { |
2184 | get_brd_name_by_type(board_info->board_type, brd_name); | 2209 | get_brd_name_by_type(board_info->board_type, brd_name); |
2185 | 2210 | ||
2186 | printk("NetXen %s Board S/N %s Chip id 0x%x\n", | 2211 | printk(KERN_INFO "NetXen %s Board S/N %s Chip rev 0x%x\n", |
2187 | brd_name, serial_num, board_info->chip_id); | 2212 | brd_name, serial_num, adapter->ahw.revision_id); |
2188 | printk("NetXen Firmware version %d.%d.%d\n", fw_major, | 2213 | printk(KERN_INFO "NetXen Firmware version %d.%d.%d\n", |
2189 | fw_minor, fw_build); | 2214 | fw_major, fw_minor, fw_build); |
2190 | } | 2215 | } |
2191 | 2216 | ||
2192 | if (NETXEN_VERSION_CODE(fw_major, fw_minor, fw_build) < | 2217 | if (NETXEN_VERSION_CODE(fw_major, fw_minor, fw_build) < |
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index 519fc860e17e..5bba675d0504 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
@@ -1079,10 +1079,12 @@ int netxen_initialize_adapter_offload(struct netxen_adapter *adapter) | |||
1079 | 1079 | ||
1080 | void netxen_free_adapter_offload(struct netxen_adapter *adapter) | 1080 | void netxen_free_adapter_offload(struct netxen_adapter *adapter) |
1081 | { | 1081 | { |
1082 | int i; | 1082 | int i = 100; |
1083 | |||
1084 | if (!adapter->dummy_dma.addr) | ||
1085 | return; | ||
1083 | 1086 | ||
1084 | if (adapter->dummy_dma.addr) { | 1087 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { |
1085 | i = 100; | ||
1086 | do { | 1088 | do { |
1087 | if (dma_watchdog_shutdown_request(adapter) == 1) | 1089 | if (dma_watchdog_shutdown_request(adapter) == 1) |
1088 | break; | 1090 | break; |
@@ -1090,17 +1092,17 @@ void netxen_free_adapter_offload(struct netxen_adapter *adapter) | |||
1090 | if (dma_watchdog_shutdown_poll_result(adapter) == 1) | 1092 | if (dma_watchdog_shutdown_poll_result(adapter) == 1) |
1091 | break; | 1093 | break; |
1092 | } while (--i); | 1094 | } while (--i); |
1095 | } | ||
1093 | 1096 | ||
1094 | if (i) { | 1097 | if (i) { |
1095 | pci_free_consistent(adapter->pdev, | 1098 | pci_free_consistent(adapter->pdev, |
1096 | NETXEN_HOST_DUMMY_DMA_SIZE, | 1099 | NETXEN_HOST_DUMMY_DMA_SIZE, |
1097 | adapter->dummy_dma.addr, | 1100 | adapter->dummy_dma.addr, |
1098 | adapter->dummy_dma.phys_addr); | 1101 | adapter->dummy_dma.phys_addr); |
1099 | adapter->dummy_dma.addr = NULL; | 1102 | adapter->dummy_dma.addr = NULL; |
1100 | } else { | 1103 | } else { |
1101 | printk(KERN_ERR "%s: dma_watchdog_shutdown failed\n", | 1104 | printk(KERN_ERR "%s: dma_watchdog_shutdown failed\n", |
1102 | adapter->netdev->name); | 1105 | adapter->netdev->name); |
1103 | } | ||
1104 | } | 1106 | } |
1105 | } | 1107 | } |
1106 | 1108 | ||
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 7615c715e66e..008fd6618a5f 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -149,76 +149,18 @@ static uint32_t msi_tgt_status[8] = { | |||
149 | 149 | ||
150 | static struct netxen_legacy_intr_set legacy_intr[] = NX_LEGACY_INTR_CONFIG; | 150 | static struct netxen_legacy_intr_set legacy_intr[] = NX_LEGACY_INTR_CONFIG; |
151 | 151 | ||
152 | static void netxen_nic_disable_int(struct netxen_adapter *adapter) | 152 | static inline void netxen_nic_disable_int(struct netxen_adapter *adapter) |
153 | { | 153 | { |
154 | u32 mask = 0x7ff; | 154 | adapter->pci_write_normalize(adapter, adapter->crb_intr_mask, 0); |
155 | int retries = 32; | ||
156 | int pci_fn = adapter->ahw.pci_func; | ||
157 | |||
158 | if (adapter->msi_mode != MSI_MODE_MULTIFUNC) | ||
159 | adapter->pci_write_normalize(adapter, | ||
160 | adapter->crb_intr_mask, 0); | ||
161 | |||
162 | if (adapter->intr_scheme != -1 && | ||
163 | adapter->intr_scheme != INTR_SCHEME_PERPORT) | ||
164 | adapter->pci_write_immediate(adapter, ISR_INT_MASK, mask); | ||
165 | |||
166 | if (!NETXEN_IS_MSI_FAMILY(adapter)) { | ||
167 | do { | ||
168 | adapter->pci_write_immediate(adapter, | ||
169 | adapter->legacy_intr.tgt_status_reg, | ||
170 | 0xffffffff); | ||
171 | mask = adapter->pci_read_immediate(adapter, | ||
172 | ISR_INT_VECTOR); | ||
173 | if (!(mask & 0x80)) | ||
174 | break; | ||
175 | udelay(10); | ||
176 | } while (--retries); | ||
177 | |||
178 | if (!retries) { | ||
179 | printk(KERN_NOTICE "%s: Failed to disable interrupt\n", | ||
180 | netxen_nic_driver_name); | ||
181 | } | ||
182 | } else { | ||
183 | if (adapter->msi_mode == MSI_MODE_MULTIFUNC) { | ||
184 | adapter->pci_write_immediate(adapter, | ||
185 | msi_tgt_status[pci_fn], 0xffffffff); | ||
186 | } | ||
187 | } | ||
188 | } | 155 | } |
189 | 156 | ||
190 | static void netxen_nic_enable_int(struct netxen_adapter *adapter) | 157 | static inline void netxen_nic_enable_int(struct netxen_adapter *adapter) |
191 | { | 158 | { |
192 | u32 mask; | ||
193 | |||
194 | if (adapter->intr_scheme != -1 && | ||
195 | adapter->intr_scheme != INTR_SCHEME_PERPORT) { | ||
196 | switch (adapter->ahw.board_type) { | ||
197 | case NETXEN_NIC_GBE: | ||
198 | mask = 0x77b; | ||
199 | break; | ||
200 | case NETXEN_NIC_XGBE: | ||
201 | mask = 0x77f; | ||
202 | break; | ||
203 | default: | ||
204 | mask = 0x7ff; | ||
205 | break; | ||
206 | } | ||
207 | |||
208 | adapter->pci_write_immediate(adapter, ISR_INT_MASK, mask); | ||
209 | } | ||
210 | |||
211 | adapter->pci_write_normalize(adapter, adapter->crb_intr_mask, 0x1); | 159 | adapter->pci_write_normalize(adapter, adapter->crb_intr_mask, 0x1); |
212 | 160 | ||
213 | if (!NETXEN_IS_MSI_FAMILY(adapter)) { | 161 | if (!NETXEN_IS_MSI_FAMILY(adapter)) |
214 | mask = 0xbff; | 162 | adapter->pci_write_immediate(adapter, |
215 | if (adapter->intr_scheme == INTR_SCHEME_PERPORT) | 163 | adapter->legacy_intr.tgt_mask_reg, 0xfbff); |
216 | adapter->pci_write_immediate(adapter, | ||
217 | adapter->legacy_intr.tgt_mask_reg, mask); | ||
218 | else | ||
219 | adapter->pci_write_normalize(adapter, | ||
220 | CRB_INT_VECTOR, 0); | ||
221 | } | ||
222 | } | 164 | } |
223 | 165 | ||
224 | static int nx_set_dma_mask(struct netxen_adapter *adapter, uint8_t revision_id) | 166 | static int nx_set_dma_mask(struct netxen_adapter *adapter, uint8_t revision_id) |
@@ -417,16 +359,6 @@ static void netxen_pcie_strap_init(struct netxen_adapter *adapter) | |||
417 | int i, pos; | 359 | int i, pos; |
418 | struct pci_dev *pdev; | 360 | struct pci_dev *pdev; |
419 | 361 | ||
420 | pdev = pci_get_device(0x1166, 0x0140, NULL); | ||
421 | if (pdev) { | ||
422 | pci_dev_put(pdev); | ||
423 | adapter->hw_read_wx(adapter, | ||
424 | NETXEN_PCIE_REG(PCIE_TGT_SPLIT_CHICKEN), &chicken, 4); | ||
425 | chicken |= 0x4000; | ||
426 | adapter->hw_write_wx(adapter, | ||
427 | NETXEN_PCIE_REG(PCIE_TGT_SPLIT_CHICKEN), &chicken, 4); | ||
428 | } | ||
429 | |||
430 | pdev = adapter->pdev; | 362 | pdev = adapter->pdev; |
431 | 363 | ||
432 | adapter->hw_read_wx(adapter, | 364 | adapter->hw_read_wx(adapter, |
@@ -501,6 +433,44 @@ static void netxen_init_msix_entries(struct netxen_adapter *adapter) | |||
501 | adapter->msix_entries[i].entry = i; | 433 | adapter->msix_entries[i].entry = i; |
502 | } | 434 | } |
503 | 435 | ||
436 | static int | ||
437 | netxen_read_mac_addr(struct netxen_adapter *adapter) | ||
438 | { | ||
439 | int i; | ||
440 | unsigned char *p; | ||
441 | __le64 mac_addr; | ||
442 | DECLARE_MAC_BUF(mac); | ||
443 | struct net_device *netdev = adapter->netdev; | ||
444 | struct pci_dev *pdev = adapter->pdev; | ||
445 | |||
446 | if (netxen_is_flash_supported(adapter) != 0) | ||
447 | return -EIO; | ||
448 | |||
449 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { | ||
450 | if (netxen_p3_get_mac_addr(adapter, &mac_addr) != 0) | ||
451 | return -EIO; | ||
452 | } else { | ||
453 | if (netxen_get_flash_mac_addr(adapter, &mac_addr) != 0) | ||
454 | return -EIO; | ||
455 | } | ||
456 | |||
457 | p = (unsigned char *)&mac_addr; | ||
458 | for (i = 0; i < 6; i++) | ||
459 | netdev->dev_addr[i] = *(p + 5 - i); | ||
460 | |||
461 | memcpy(netdev->perm_addr, netdev->dev_addr, netdev->addr_len); | ||
462 | |||
463 | /* set station address */ | ||
464 | |||
465 | if (!is_valid_ether_addr(netdev->perm_addr)) { | ||
466 | dev_warn(&pdev->dev, "Bad MAC address %s.\n", | ||
467 | print_mac(mac, netdev->dev_addr)); | ||
468 | } else | ||
469 | adapter->macaddr_set(adapter, netdev->dev_addr); | ||
470 | |||
471 | return 0; | ||
472 | } | ||
473 | |||
504 | /* | 474 | /* |
505 | * netxen_nic_probe() | 475 | * netxen_nic_probe() |
506 | * | 476 | * |
@@ -529,10 +499,8 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
529 | unsigned long mem_base, mem_len, db_base, db_len, pci_len0 = 0; | 499 | unsigned long mem_base, mem_len, db_base, db_len, pci_len0 = 0; |
530 | int i = 0, err; | 500 | int i = 0, err; |
531 | int first_driver, first_boot; | 501 | int first_driver, first_boot; |
532 | __le64 mac_addr[FLASH_NUM_PORTS + 1]; | ||
533 | u32 val; | 502 | u32 val; |
534 | int pci_func_id = PCI_FUNC(pdev->devfn); | 503 | int pci_func_id = PCI_FUNC(pdev->devfn); |
535 | DECLARE_MAC_BUF(mac); | ||
536 | struct netxen_legacy_intr_set *legacy_intrp; | 504 | struct netxen_legacy_intr_set *legacy_intrp; |
537 | uint8_t revision_id; | 505 | uint8_t revision_id; |
538 | 506 | ||
@@ -545,6 +513,13 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
545 | return -ENODEV; | 513 | return -ENODEV; |
546 | } | 514 | } |
547 | 515 | ||
516 | if (pdev->revision >= NX_P3_A0 && pdev->revision < NX_P3_B1) { | ||
517 | printk(KERN_WARNING "NetXen chip revisions between 0x%x-0x%x" | ||
518 | "will not be enabled.\n", | ||
519 | NX_P3_A0, NX_P3_B1); | ||
520 | return -ENODEV; | ||
521 | } | ||
522 | |||
548 | if ((err = pci_enable_device(pdev))) | 523 | if ((err = pci_enable_device(pdev))) |
549 | return err; | 524 | return err; |
550 | 525 | ||
@@ -898,34 +873,14 @@ request_msi: | |||
898 | goto err_out_disable_msi; | 873 | goto err_out_disable_msi; |
899 | 874 | ||
900 | init_timer(&adapter->watchdog_timer); | 875 | init_timer(&adapter->watchdog_timer); |
901 | adapter->ahw.linkup = 0; | ||
902 | adapter->watchdog_timer.function = &netxen_watchdog; | 876 | adapter->watchdog_timer.function = &netxen_watchdog; |
903 | adapter->watchdog_timer.data = (unsigned long)adapter; | 877 | adapter->watchdog_timer.data = (unsigned long)adapter; |
904 | INIT_WORK(&adapter->watchdog_task, netxen_watchdog_task); | 878 | INIT_WORK(&adapter->watchdog_task, netxen_watchdog_task); |
905 | INIT_WORK(&adapter->tx_timeout_task, netxen_tx_timeout_task); | 879 | INIT_WORK(&adapter->tx_timeout_task, netxen_tx_timeout_task); |
906 | 880 | ||
907 | if (netxen_is_flash_supported(adapter) == 0 && | 881 | err = netxen_read_mac_addr(adapter); |
908 | netxen_get_flash_mac_addr(adapter, mac_addr) == 0) { | 882 | if (err) |
909 | unsigned char *p; | 883 | dev_warn(&pdev->dev, "failed to read mac addr\n"); |
910 | |||
911 | p = (unsigned char *)&mac_addr[adapter->portnum]; | ||
912 | netdev->dev_addr[0] = *(p + 5); | ||
913 | netdev->dev_addr[1] = *(p + 4); | ||
914 | netdev->dev_addr[2] = *(p + 3); | ||
915 | netdev->dev_addr[3] = *(p + 2); | ||
916 | netdev->dev_addr[4] = *(p + 1); | ||
917 | netdev->dev_addr[5] = *(p + 0); | ||
918 | |||
919 | memcpy(netdev->perm_addr, netdev->dev_addr, | ||
920 | netdev->addr_len); | ||
921 | if (!is_valid_ether_addr(netdev->perm_addr)) { | ||
922 | printk(KERN_ERR "%s: Bad MAC address %s.\n", | ||
923 | netxen_nic_driver_name, | ||
924 | print_mac(mac, netdev->dev_addr)); | ||
925 | } else { | ||
926 | adapter->macaddr_set(adapter, netdev->dev_addr); | ||
927 | } | ||
928 | } | ||
929 | 884 | ||
930 | netif_carrier_off(netdev); | 885 | netif_carrier_off(netdev); |
931 | netif_stop_queue(netdev); | 886 | netif_stop_queue(netdev); |
@@ -1000,6 +955,7 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) | |||
1000 | 955 | ||
1001 | if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) { | 956 | if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) { |
1002 | netxen_free_hw_resources(adapter); | 957 | netxen_free_hw_resources(adapter); |
958 | netxen_release_rx_buffers(adapter); | ||
1003 | netxen_free_sw_resources(adapter); | 959 | netxen_free_sw_resources(adapter); |
1004 | } | 960 | } |
1005 | 961 | ||
@@ -1069,6 +1025,15 @@ static int netxen_nic_open(struct net_device *netdev) | |||
1069 | goto err_out_free_sw; | 1025 | goto err_out_free_sw; |
1070 | } | 1026 | } |
1071 | 1027 | ||
1028 | if ((adapter->msi_mode != MSI_MODE_MULTIFUNC) || | ||
1029 | (adapter->intr_scheme != INTR_SCHEME_PERPORT)) { | ||
1030 | printk(KERN_ERR "%s: Firmware interrupt scheme is " | ||
1031 | "incompatible with driver\n", | ||
1032 | netdev->name); | ||
1033 | adapter->driver_mismatch = 1; | ||
1034 | goto err_out_free_hw; | ||
1035 | } | ||
1036 | |||
1072 | if (adapter->fw_major < 4) { | 1037 | if (adapter->fw_major < 4) { |
1073 | adapter->crb_addr_cmd_producer = | 1038 | adapter->crb_addr_cmd_producer = |
1074 | crb_cmd_producer[adapter->portnum]; | 1039 | crb_cmd_producer[adapter->portnum]; |
@@ -1094,7 +1059,7 @@ static int netxen_nic_open(struct net_device *netdev) | |||
1094 | flags, netdev->name, adapter); | 1059 | flags, netdev->name, adapter); |
1095 | if (err) { | 1060 | if (err) { |
1096 | printk(KERN_ERR "request_irq failed with: %d\n", err); | 1061 | printk(KERN_ERR "request_irq failed with: %d\n", err); |
1097 | goto err_out_free_hw; | 1062 | goto err_out_free_rxbuf; |
1098 | } | 1063 | } |
1099 | 1064 | ||
1100 | adapter->is_up = NETXEN_ADAPTER_UP_MAGIC; | 1065 | adapter->is_up = NETXEN_ADAPTER_UP_MAGIC; |
@@ -1116,6 +1081,7 @@ static int netxen_nic_open(struct net_device *netdev) | |||
1116 | if (adapter->set_mtu) | 1081 | if (adapter->set_mtu) |
1117 | adapter->set_mtu(adapter, netdev->mtu); | 1082 | adapter->set_mtu(adapter, netdev->mtu); |
1118 | 1083 | ||
1084 | adapter->ahw.linkup = 0; | ||
1119 | mod_timer(&adapter->watchdog_timer, jiffies); | 1085 | mod_timer(&adapter->watchdog_timer, jiffies); |
1120 | 1086 | ||
1121 | napi_enable(&adapter->napi); | 1087 | napi_enable(&adapter->napi); |
@@ -1127,6 +1093,8 @@ static int netxen_nic_open(struct net_device *netdev) | |||
1127 | 1093 | ||
1128 | err_out_free_irq: | 1094 | err_out_free_irq: |
1129 | free_irq(adapter->irq, adapter); | 1095 | free_irq(adapter->irq, adapter); |
1096 | err_out_free_rxbuf: | ||
1097 | netxen_release_rx_buffers(adapter); | ||
1130 | err_out_free_hw: | 1098 | err_out_free_hw: |
1131 | netxen_free_hw_resources(adapter); | 1099 | netxen_free_hw_resources(adapter); |
1132 | err_out_free_sw: | 1100 | err_out_free_sw: |
@@ -1152,10 +1120,8 @@ static int netxen_nic_close(struct net_device *netdev) | |||
1152 | 1120 | ||
1153 | netxen_release_tx_buffers(adapter); | 1121 | netxen_release_tx_buffers(adapter); |
1154 | 1122 | ||
1155 | if (adapter->is_up == NETXEN_ADAPTER_UP_MAGIC) { | 1123 | FLUSH_SCHEDULED_WORK(); |
1156 | FLUSH_SCHEDULED_WORK(); | 1124 | del_timer_sync(&adapter->watchdog_timer); |
1157 | del_timer_sync(&adapter->watchdog_timer); | ||
1158 | } | ||
1159 | 1125 | ||
1160 | return 0; | 1126 | return 0; |
1161 | } | 1127 | } |
@@ -1458,7 +1424,8 @@ void netxen_watchdog_task(struct work_struct *work) | |||
1458 | 1424 | ||
1459 | netxen_nic_handle_phy_intr(adapter); | 1425 | netxen_nic_handle_phy_intr(adapter); |
1460 | 1426 | ||
1461 | mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); | 1427 | if (netif_running(adapter->netdev)) |
1428 | mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); | ||
1462 | } | 1429 | } |
1463 | 1430 | ||
1464 | static void netxen_tx_timeout(struct net_device *netdev) | 1431 | static void netxen_tx_timeout(struct net_device *netdev) |
@@ -1518,18 +1485,9 @@ struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev) | |||
1518 | return stats; | 1485 | return stats; |
1519 | } | 1486 | } |
1520 | 1487 | ||
1521 | static inline void | ||
1522 | netxen_handle_int(struct netxen_adapter *adapter) | ||
1523 | { | ||
1524 | netxen_nic_disable_int(adapter); | ||
1525 | napi_schedule(&adapter->napi); | ||
1526 | } | ||
1527 | |||
1528 | static irqreturn_t netxen_intr(int irq, void *data) | 1488 | static irqreturn_t netxen_intr(int irq, void *data) |
1529 | { | 1489 | { |
1530 | struct netxen_adapter *adapter = data; | 1490 | struct netxen_adapter *adapter = data; |
1531 | u32 our_int = 0; | ||
1532 | |||
1533 | u32 status = 0; | 1491 | u32 status = 0; |
1534 | 1492 | ||
1535 | status = adapter->pci_read_immediate(adapter, ISR_INT_VECTOR); | 1493 | status = adapter->pci_read_immediate(adapter, ISR_INT_VECTOR); |
@@ -1544,22 +1502,32 @@ static irqreturn_t netxen_intr(int irq, void *data) | |||
1544 | if (!ISR_LEGACY_INT_TRIGGERED(status)) | 1502 | if (!ISR_LEGACY_INT_TRIGGERED(status)) |
1545 | return IRQ_NONE; | 1503 | return IRQ_NONE; |
1546 | 1504 | ||
1547 | } else if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { | 1505 | } else { |
1506 | unsigned long our_int = 0; | ||
1548 | 1507 | ||
1549 | our_int = adapter->pci_read_normalize(adapter, CRB_INT_VECTOR); | 1508 | our_int = adapter->pci_read_normalize(adapter, CRB_INT_VECTOR); |
1509 | |||
1550 | /* not our interrupt */ | 1510 | /* not our interrupt */ |
1551 | if ((our_int & (0x80 << adapter->portnum)) == 0) | 1511 | if (!test_and_clear_bit((7 + adapter->portnum), &our_int)) |
1552 | return IRQ_NONE; | 1512 | return IRQ_NONE; |
1553 | 1513 | ||
1554 | if (adapter->intr_scheme == INTR_SCHEME_PERPORT) { | 1514 | /* claim interrupt */ |
1555 | /* claim interrupt */ | 1515 | adapter->pci_write_normalize(adapter, |
1556 | adapter->pci_write_normalize(adapter, | 1516 | CRB_INT_VECTOR, (our_int & 0xffffffff)); |
1557 | CRB_INT_VECTOR, | ||
1558 | our_int & ~((u32)(0x80 << adapter->portnum))); | ||
1559 | } | ||
1560 | } | 1517 | } |
1561 | 1518 | ||
1562 | netxen_handle_int(adapter); | 1519 | /* clear interrupt */ |
1520 | if (adapter->fw_major < 4) | ||
1521 | netxen_nic_disable_int(adapter); | ||
1522 | |||
1523 | adapter->pci_write_immediate(adapter, | ||
1524 | adapter->legacy_intr.tgt_status_reg, | ||
1525 | 0xffffffff); | ||
1526 | /* read twice to ensure write is flushed */ | ||
1527 | adapter->pci_read_immediate(adapter, ISR_INT_VECTOR); | ||
1528 | adapter->pci_read_immediate(adapter, ISR_INT_VECTOR); | ||
1529 | |||
1530 | napi_schedule(&adapter->napi); | ||
1563 | 1531 | ||
1564 | return IRQ_HANDLED; | 1532 | return IRQ_HANDLED; |
1565 | } | 1533 | } |
@@ -1568,7 +1536,11 @@ static irqreturn_t netxen_msi_intr(int irq, void *data) | |||
1568 | { | 1536 | { |
1569 | struct netxen_adapter *adapter = data; | 1537 | struct netxen_adapter *adapter = data; |
1570 | 1538 | ||
1571 | netxen_handle_int(adapter); | 1539 | /* clear interrupt */ |
1540 | adapter->pci_write_immediate(adapter, | ||
1541 | msi_tgt_status[adapter->ahw.pci_func], 0xffffffff); | ||
1542 | |||
1543 | napi_schedule(&adapter->napi); | ||
1572 | return IRQ_HANDLED; | 1544 | return IRQ_HANDLED; |
1573 | } | 1545 | } |
1574 | 1546 | ||
diff --git a/drivers/net/netxen/netxen_nic_phan_reg.h b/drivers/net/netxen/netxen_nic_phan_reg.h index 83e5ee57bfef..b293adcc95ab 100644 --- a/drivers/net/netxen/netxen_nic_phan_reg.h +++ b/drivers/net/netxen/netxen_nic_phan_reg.h | |||
@@ -125,6 +125,8 @@ | |||
125 | #define CRB_SW_INT_MASK_2 NETXEN_NIC_REG(0x1e4) | 125 | #define CRB_SW_INT_MASK_2 NETXEN_NIC_REG(0x1e4) |
126 | #define CRB_SW_INT_MASK_3 NETXEN_NIC_REG(0x1e8) | 126 | #define CRB_SW_INT_MASK_3 NETXEN_NIC_REG(0x1e8) |
127 | 127 | ||
128 | #define CRB_MAC_BLOCK_START NETXEN_CAM_RAM(0x1c0) | ||
129 | |||
128 | /* | 130 | /* |
129 | * capabilities register, can be used to selectively enable/disable features | 131 | * capabilities register, can be used to selectively enable/disable features |
130 | * for backward compability | 132 | * for backward compability |