aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netxen
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/netxen')
-rw-r--r--drivers/net/netxen/netxen_nic.h14
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c2
-rw-r--r--drivers/net/netxen/netxen_nic_init.c14
-rw-r--r--drivers/net/netxen/netxen_nic_isr.c3
-rw-r--r--drivers/net/netxen/netxen_nic_main.c40
5 files changed, 34 insertions, 39 deletions
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index b4c4fc0c7218..6490acf05305 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -63,7 +63,7 @@
63 63
64#include "netxen_nic_hw.h" 64#include "netxen_nic_hw.h"
65 65
66#define NETXEN_NIC_BUILD_NO "1" 66#define NETXEN_NIC_BUILD_NO "4"
67#define _NETXEN_NIC_LINUX_MAJOR 3 67#define _NETXEN_NIC_LINUX_MAJOR 3
68#define _NETXEN_NIC_LINUX_MINOR 3 68#define _NETXEN_NIC_LINUX_MINOR 3
69#define _NETXEN_NIC_LINUX_SUBVERSION 2 69#define _NETXEN_NIC_LINUX_SUBVERSION 2
@@ -137,7 +137,7 @@ extern struct workqueue_struct *netxen_workq;
137#define THIRD_PAGE_GROUP_SIZE THIRD_PAGE_GROUP_END - THIRD_PAGE_GROUP_START 137#define THIRD_PAGE_GROUP_SIZE THIRD_PAGE_GROUP_END - THIRD_PAGE_GROUP_START
138 138
139#define MAX_RX_BUFFER_LENGTH 1760 139#define MAX_RX_BUFFER_LENGTH 1760
140#define MAX_RX_JUMBO_BUFFER_LENGTH 9046 140#define MAX_RX_JUMBO_BUFFER_LENGTH 8062
141#define MAX_RX_LRO_BUFFER_LENGTH ((48*1024)-512) 141#define MAX_RX_LRO_BUFFER_LENGTH ((48*1024)-512)
142#define RX_DMA_MAP_LEN (MAX_RX_BUFFER_LENGTH - 2) 142#define RX_DMA_MAP_LEN (MAX_RX_BUFFER_LENGTH - 2)
143#define RX_JUMBO_DMA_MAP_LEN \ 143#define RX_JUMBO_DMA_MAP_LEN \
@@ -199,9 +199,9 @@ enum {
199 (RCV_DESC_NORMAL))) 199 (RCV_DESC_NORMAL)))
200 200
201#define MAX_CMD_DESCRIPTORS 1024 201#define MAX_CMD_DESCRIPTORS 1024
202#define MAX_RCV_DESCRIPTORS 32768 202#define MAX_RCV_DESCRIPTORS 16384
203#define MAX_JUMBO_RCV_DESCRIPTORS 4096 203#define MAX_JUMBO_RCV_DESCRIPTORS 1024
204#define MAX_LRO_RCV_DESCRIPTORS 2048 204#define MAX_LRO_RCV_DESCRIPTORS 64
205#define MAX_RCVSTATUS_DESCRIPTORS MAX_RCV_DESCRIPTORS 205#define MAX_RCVSTATUS_DESCRIPTORS MAX_RCV_DESCRIPTORS
206#define MAX_JUMBO_RCV_DESC MAX_JUMBO_RCV_DESCRIPTORS 206#define MAX_JUMBO_RCV_DESC MAX_JUMBO_RCV_DESCRIPTORS
207#define MAX_RCV_DESC MAX_RCV_DESCRIPTORS 207#define MAX_RCV_DESC MAX_RCV_DESCRIPTORS
@@ -852,8 +852,6 @@ struct netxen_adapter {
852 spinlock_t tx_lock; 852 spinlock_t tx_lock;
853 spinlock_t lock; 853 spinlock_t lock;
854 struct work_struct watchdog_task; 854 struct work_struct watchdog_task;
855 struct work_struct tx_timeout_task;
856 struct net_device *netdev;
857 struct timer_list watchdog_timer; 855 struct timer_list watchdog_timer;
858 856
859 u32 curr_window; 857 u32 curr_window;
@@ -887,7 +885,6 @@ struct netxen_adapter {
887 struct netxen_recv_context recv_ctx[MAX_RCV_CTX]; 885 struct netxen_recv_context recv_ctx[MAX_RCV_CTX];
888 886
889 int is_up; 887 int is_up;
890 int number;
891 struct netxen_dummy_dma dummy_dma; 888 struct netxen_dummy_dma dummy_dma;
892 889
893 /* Context interface shared between card and host */ 890 /* Context interface shared between card and host */
@@ -950,6 +947,7 @@ struct netxen_port {
950 struct pci_dev *pdev; 947 struct pci_dev *pdev;
951 struct net_device_stats net_stats; 948 struct net_device_stats net_stats;
952 struct netxen_port_stats stats; 949 struct netxen_port_stats stats;
950 struct work_struct tx_timeout_task;
953}; 951};
954 952
955#define PCI_OFFSET_FIRST_RANGE(adapter, off) \ 953#define PCI_OFFSET_FIRST_RANGE(adapter, off) \
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index 5dac50c87075..c0c31d1914a7 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -376,7 +376,7 @@ void netxen_tso_check(struct netxen_adapter *adapter,
376 ((skb->nh.iph)->ihl * sizeof(u32)) + 376 ((skb->nh.iph)->ihl * sizeof(u32)) +
377 ((skb->h.th)->doff * sizeof(u32)); 377 ((skb->h.th)->doff * sizeof(u32));
378 netxen_set_cmd_desc_opcode(desc, TX_TCP_LSO); 378 netxen_set_cmd_desc_opcode(desc, TX_TCP_LSO);
379 } else if (skb->ip_summed == CHECKSUM_COMPLETE) { 379 } else if (skb->ip_summed == CHECKSUM_PARTIAL) {
380 if (skb->nh.iph->protocol == IPPROTO_TCP) { 380 if (skb->nh.iph->protocol == IPPROTO_TCP) {
381 netxen_set_cmd_desc_opcode(desc, TX_TCP_PKT); 381 netxen_set_cmd_desc_opcode(desc, TX_TCP_PKT);
382 } else if (skb->nh.iph->protocol == IPPROTO_UDP) { 382 } else if (skb->nh.iph->protocol == IPPROTO_UDP) {
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index deacc61e199c..c3e41f368554 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -927,7 +927,7 @@ u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctxid, int max)
927 } 927 }
928 netxen_process_rcv(adapter, ctxid, desc); 928 netxen_process_rcv(adapter, ctxid, desc);
929 netxen_clear_sts_owner(desc); 929 netxen_clear_sts_owner(desc);
930 netxen_set_sts_owner(desc, STATUS_OWNER_PHANTOM); 930 netxen_set_sts_owner(desc, cpu_to_le16(STATUS_OWNER_PHANTOM));
931 consumer = (consumer + 1) & (adapter->max_rx_desc_count - 1); 931 consumer = (consumer + 1) & (adapter->max_rx_desc_count - 1);
932 count++; 932 count++;
933 } 933 }
@@ -1022,7 +1022,7 @@ int netxen_process_cmd_ring(unsigned long data)
1022 && netif_carrier_ok(port->netdev)) 1022 && netif_carrier_ok(port->netdev))
1023 && ((jiffies - port->netdev->trans_start) > 1023 && ((jiffies - port->netdev->trans_start) >
1024 port->netdev->watchdog_timeo)) { 1024 port->netdev->watchdog_timeo)) {
1025 SCHEDULE_WORK(&port->adapter->tx_timeout_task); 1025 SCHEDULE_WORK(&port->tx_timeout_task);
1026 } 1026 }
1027 1027
1028 last_consumer = get_next_index(last_consumer, 1028 last_consumer = get_next_index(last_consumer,
@@ -1137,13 +1137,13 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid)
1137 */ 1137 */
1138 dma = pci_map_single(pdev, skb->data, rcv_desc->dma_size, 1138 dma = pci_map_single(pdev, skb->data, rcv_desc->dma_size,
1139 PCI_DMA_FROMDEVICE); 1139 PCI_DMA_FROMDEVICE);
1140 pdesc->addr_buffer = dma; 1140 pdesc->addr_buffer = cpu_to_le64(dma);
1141 buffer->skb = skb; 1141 buffer->skb = skb;
1142 buffer->state = NETXEN_BUFFER_BUSY; 1142 buffer->state = NETXEN_BUFFER_BUSY;
1143 buffer->dma = dma; 1143 buffer->dma = dma;
1144 /* make a rcv descriptor */ 1144 /* make a rcv descriptor */
1145 pdesc->reference_handle = buffer->ref_handle; 1145 pdesc->reference_handle = cpu_to_le16(buffer->ref_handle);
1146 pdesc->buffer_length = rcv_desc->dma_size; 1146 pdesc->buffer_length = cpu_to_le32(rcv_desc->dma_size);
1147 DPRINTK(INFO, "done writing descripter\n"); 1147 DPRINTK(INFO, "done writing descripter\n");
1148 producer = 1148 producer =
1149 get_next_index(producer, rcv_desc->max_rx_desc_count); 1149 get_next_index(producer, rcv_desc->max_rx_desc_count);
@@ -1231,8 +1231,8 @@ void netxen_post_rx_buffers_nodb(struct netxen_adapter *adapter, uint32_t ctx,
1231 PCI_DMA_FROMDEVICE); 1231 PCI_DMA_FROMDEVICE);
1232 1232
1233 /* make a rcv descriptor */ 1233 /* make a rcv descriptor */
1234 pdesc->reference_handle = le16_to_cpu(buffer->ref_handle); 1234 pdesc->reference_handle = cpu_to_le16(buffer->ref_handle);
1235 pdesc->buffer_length = le16_to_cpu(rcv_desc->dma_size); 1235 pdesc->buffer_length = cpu_to_le16(rcv_desc->dma_size);
1236 pdesc->addr_buffer = cpu_to_le64(buffer->dma); 1236 pdesc->addr_buffer = cpu_to_le64(buffer->dma);
1237 DPRINTK(INFO, "done writing descripter\n"); 1237 DPRINTK(INFO, "done writing descripter\n");
1238 producer = 1238 producer =
diff --git a/drivers/net/netxen/netxen_nic_isr.c b/drivers/net/netxen/netxen_nic_isr.c
index 1b45f50fa6aa..06847d4252c3 100644
--- a/drivers/net/netxen/netxen_nic_isr.c
+++ b/drivers/net/netxen/netxen_nic_isr.c
@@ -157,7 +157,8 @@ void netxen_nic_isr_other(struct netxen_adapter *adapter)
157 for (portno = 0; portno < NETXEN_NIU_MAX_GBE_PORTS; portno++) { 157 for (portno = 0; portno < NETXEN_NIU_MAX_GBE_PORTS; portno++) {
158 linkup = val & 1; 158 linkup = val & 1;
159 if (linkup != (qg_linksup & 1)) { 159 if (linkup != (qg_linksup & 1)) {
160 printk(KERN_INFO "%s: PORT %d link %s\n", 160 printk(KERN_INFO "%s: %s PORT %d link %s\n",
161 adapter->port[portno]->netdev->name,
161 netxen_nic_driver_name, portno, 162 netxen_nic_driver_name, portno,
162 ((linkup == 0) ? "down" : "up")); 163 ((linkup == 0) ? "down" : "up"));
163 netxen_indicate_link_status(adapter, portno, linkup); 164 netxen_indicate_link_status(adapter, portno, linkup);
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}