aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netxen/netxen_nic_main.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.osdl.org>2006-12-29 13:03:54 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-29 13:03:54 -0500
commit6c722e90d7ede7db2d2b28a3cc69a8545db67ea1 (patch)
tree2473530190795c11f841db37b7d74df9bcc0416b /drivers/net/netxen/netxen_nic_main.c
parent007fb598b4674de82492a9961e82826875012229 (diff)
parent81f4e6c190a0fa016fd7eecaf76a5f95d121afc2 (diff)
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6: (42 commits) r8169: extraneous Cmd{Tx/Rx}Enb write forcedeth: modified comment header NetXen: Reducing ring sizes for IOMMU issue. NetXen: Fix for PPC machines. NetXen: work queue fixes. NetXen: Link status message correction for quad port cards. NetXen: Multiple adapter fix. NetXen: Using correct CHECKSUM flag. NetXen: driver reload fix for newer firmware. NetXen: Adding new device ids. PHY probe not working properly for ibm_emac (PPC4xx) ep93xx: some minor cleanups to the ep93xx eth driver sky2: phy power down needs PCI config write enabled sky2: power management/MSI workaround sky2: dual port NAPI problem via-velocity uses INET interfaces e1000: Do not truncate TSO TCP header with 82544 workaround myri10ge: handle failures in suspend and resume myri10ge: no need to save MSI and PCIe state in the driver myri10ge: make msi configurable at runtime through sysfs ...
Diffstat (limited to 'drivers/net/netxen/netxen_nic_main.c')
-rw-r--r--drivers/net/netxen/netxen_nic_main.c40
1 files changed, 18 insertions, 22 deletions
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 1658ca1fa230..8a5792fea774 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -52,8 +52,6 @@ char netxen_nic_driver_name[] = "netxen-nic";
52static char netxen_nic_driver_string[] = "NetXen Network Driver version " 52static char netxen_nic_driver_string[] = "NetXen Network Driver version "
53 NETXEN_NIC_LINUX_VERSIONID; 53 NETXEN_NIC_LINUX_VERSIONID;
54 54
55struct netxen_adapter *g_adapter = NULL;
56
57#define NETXEN_NETDEV_WEIGHT 120 55#define NETXEN_NETDEV_WEIGHT 120
58#define NETXEN_ADAPTER_UP_MAGIC 777 56#define NETXEN_ADAPTER_UP_MAGIC 777
59#define NETXEN_NIC_PEG_TUNE 0 57#define NETXEN_NIC_PEG_TUNE 0
@@ -87,6 +85,8 @@ static struct pci_device_id netxen_pci_tbl[] __devinitdata = {
87 {PCI_DEVICE(0x4040, 0x0003)}, 85 {PCI_DEVICE(0x4040, 0x0003)},
88 {PCI_DEVICE(0x4040, 0x0004)}, 86 {PCI_DEVICE(0x4040, 0x0004)},
89 {PCI_DEVICE(0x4040, 0x0005)}, 87 {PCI_DEVICE(0x4040, 0x0005)},
88 {PCI_DEVICE(0x4040, 0x0024)},
89 {PCI_DEVICE(0x4040, 0x0025)},
90 {0,} 90 {0,}
91}; 91};
92 92
@@ -126,7 +126,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
126 struct netxen_cmd_buffer *cmd_buf_arr = NULL; 126 struct netxen_cmd_buffer *cmd_buf_arr = NULL;
127 u64 mac_addr[FLASH_NUM_PORTS + 1]; 127 u64 mac_addr[FLASH_NUM_PORTS + 1];
128 int valid_mac = 0; 128 int valid_mac = 0;
129 static int netxen_cards_found = 0;
130 129
131 printk(KERN_INFO "%s \n", netxen_nic_driver_string); 130 printk(KERN_INFO "%s \n", netxen_nic_driver_string);
132 /* In current scheme, we use only PCI function 0 */ 131 /* In current scheme, we use only PCI function 0 */
@@ -217,9 +216,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
217 goto err_out_dbunmap; 216 goto err_out_dbunmap;
218 } 217 }
219 218
220 if (netxen_cards_found == 0) {
221 g_adapter = adapter;
222 }
223 adapter->max_tx_desc_count = MAX_CMD_DESCRIPTORS; 219 adapter->max_tx_desc_count = MAX_CMD_DESCRIPTORS;
224 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS; 220 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS;
225 adapter->max_jumbo_rx_desc_count = MAX_JUMBO_RCV_DESCRIPTORS; 221 adapter->max_jumbo_rx_desc_count = MAX_JUMBO_RCV_DESCRIPTORS;
@@ -424,8 +420,7 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
424 netdev->dev_addr); 420 netdev->dev_addr);
425 } 421 }
426 } 422 }
427 adapter->netdev = netdev; 423 INIT_WORK(&port->tx_timeout_task, netxen_tx_timeout_task);
428 INIT_WORK(&adapter->tx_timeout_task, netxen_tx_timeout_task);
429 netif_carrier_off(netdev); 424 netif_carrier_off(netdev);
430 netif_stop_queue(netdev); 425 netif_stop_queue(netdev);
431 426
@@ -440,6 +435,11 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
440 adapter->port[i] = port; 435 adapter->port[i] = port;
441 } 436 }
442 437
438 writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE));
439 netxen_pinit_from_rom(adapter, 0);
440 udelay(500);
441 netxen_load_firmware(adapter);
442 netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);
443 /* 443 /*
444 * delay a while to ensure that the Pegs are up & running. 444 * delay a while to ensure that the Pegs are up & running.
445 * Otherwise, we might see some flaky behaviour. 445 * Otherwise, we might see some flaky behaviour.
@@ -457,7 +457,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
457 break; 457 break;
458 } 458 }
459 459
460 adapter->number = netxen_cards_found;
461 adapter->driver_mismatch = 0; 460 adapter->driver_mismatch = 0;
462 461
463 return 0; 462 return 0;
@@ -527,6 +526,8 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
527 526
528 netxen_nic_stop_all_ports(adapter); 527 netxen_nic_stop_all_ports(adapter);
529 /* leave the hw in the same state as reboot */ 528 /* leave the hw in the same state as reboot */
529 netxen_pinit_from_rom(adapter, 0);
530 writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_STATE));
530 netxen_load_firmware(adapter); 531 netxen_load_firmware(adapter);
531 netxen_free_adapter_offload(adapter); 532 netxen_free_adapter_offload(adapter);
532 533
@@ -817,8 +818,8 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
817 /* Take skb->data itself */ 818 /* Take skb->data itself */
818 pbuf = &adapter->cmd_buf_arr[producer]; 819 pbuf = &adapter->cmd_buf_arr[producer];
819 if ((netdev->features & NETIF_F_TSO) && skb_shinfo(skb)->gso_size > 0) { 820 if ((netdev->features & NETIF_F_TSO) && skb_shinfo(skb)->gso_size > 0) {
820 pbuf->mss = skb_shinfo(skb)->gso_size; 821 pbuf->mss = cpu_to_le16(skb_shinfo(skb)->gso_size);
821 hwdesc->mss = skb_shinfo(skb)->gso_size; 822 hwdesc->mss = cpu_to_le16(skb_shinfo(skb)->gso_size);
822 } else { 823 } else {
823 pbuf->mss = 0; 824 pbuf->mss = 0;
824 hwdesc->mss = 0; 825 hwdesc->mss = 0;
@@ -952,11 +953,6 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
952static void netxen_watchdog(unsigned long v) 953static void netxen_watchdog(unsigned long v)
953{ 954{
954 struct netxen_adapter *adapter = (struct netxen_adapter *)v; 955 struct netxen_adapter *adapter = (struct netxen_adapter *)v;
955 if (adapter != g_adapter) {
956 printk("%s: ***BUG*** adapter[%p] != g_adapter[%p]\n",
957 __FUNCTION__, adapter, g_adapter);
958 return;
959 }
960 956
961 SCHEDULE_WORK(&adapter->watchdog_task); 957 SCHEDULE_WORK(&adapter->watchdog_task);
962} 958}
@@ -965,23 +961,23 @@ static void netxen_tx_timeout(struct net_device *netdev)
965{ 961{
966 struct netxen_port *port = (struct netxen_port *)netdev_priv(netdev); 962 struct netxen_port *port = (struct netxen_port *)netdev_priv(netdev);
967 963
968 SCHEDULE_WORK(&port->adapter->tx_timeout_task); 964 SCHEDULE_WORK(&port->tx_timeout_task);
969} 965}
970 966
971static void netxen_tx_timeout_task(struct work_struct *work) 967static void netxen_tx_timeout_task(struct work_struct *work)
972{ 968{
973 struct netxen_adapter *adapter = 969 struct netxen_port *port =
974 container_of(work, struct netxen_adapter, tx_timeout_task); 970 container_of(work, struct netxen_port, tx_timeout_task);
975 struct net_device *netdev = adapter->netdev; 971 struct net_device *netdev = port->netdev;
976 unsigned long flags; 972 unsigned long flags;
977 973
978 printk(KERN_ERR "%s %s: transmit timeout, resetting.\n", 974 printk(KERN_ERR "%s %s: transmit timeout, resetting.\n",
979 netxen_nic_driver_name, netdev->name); 975 netxen_nic_driver_name, netdev->name);
980 976
981 spin_lock_irqsave(&adapter->lock, flags); 977 spin_lock_irqsave(&port->adapter->lock, flags);
982 netxen_nic_close(netdev); 978 netxen_nic_close(netdev);
983 netxen_nic_open(netdev); 979 netxen_nic_open(netdev);
984 spin_unlock_irqrestore(&adapter->lock, flags); 980 spin_unlock_irqrestore(&port->adapter->lock, flags);
985 netdev->trans_start = jiffies; 981 netdev->trans_start = jiffies;
986 netif_wake_queue(netdev); 982 netif_wake_queue(netdev);
987} 983}