diff options
-rw-r--r-- | drivers/net/netxen/Makefile | 2 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic.h | 6 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_init.c | 56 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_isr.c | 220 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_main.c | 121 |
5 files changed, 122 insertions, 283 deletions
diff --git a/drivers/net/netxen/Makefile b/drivers/net/netxen/Makefile index a07cdc6f7384..c63a20790659 100644 --- a/drivers/net/netxen/Makefile +++ b/drivers/net/netxen/Makefile | |||
@@ -32,4 +32,4 @@ | |||
32 | obj-$(CONFIG_NETXEN_NIC) := netxen_nic.o | 32 | obj-$(CONFIG_NETXEN_NIC) := netxen_nic.o |
33 | 33 | ||
34 | netxen_nic-y := netxen_nic_hw.o netxen_nic_main.o netxen_nic_init.o \ | 34 | netxen_nic-y := netxen_nic_hw.o netxen_nic_main.o netxen_nic_init.o \ |
35 | netxen_nic_isr.o netxen_nic_ethtool.o netxen_nic_niu.o | 35 | netxen_nic_ethtool.o netxen_nic_niu.o |
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index b23a5a447f0c..87be0a6ef51a 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -810,8 +810,7 @@ struct netxen_hardware_context { | |||
810 | u8 revision_id; | 810 | u8 revision_id; |
811 | u16 board_type; | 811 | u16 board_type; |
812 | struct netxen_board_info boardcfg; | 812 | struct netxen_board_info boardcfg; |
813 | u32 xg_linkup; | 813 | u32 linkup; |
814 | u32 qg_linksup; | ||
815 | /* Address of cmd ring in Phantom */ | 814 | /* Address of cmd ring in Phantom */ |
816 | struct cmd_desc_type0 *cmd_desc_head; | 815 | struct cmd_desc_type0 *cmd_desc_head; |
817 | dma_addr_t cmd_desc_phys_addr; | 816 | dma_addr_t cmd_desc_phys_addr; |
@@ -965,7 +964,6 @@ struct netxen_adapter { | |||
965 | int msi_mode; | 964 | int msi_mode; |
966 | int (*enable_phy_interrupts) (struct netxen_adapter *); | 965 | int (*enable_phy_interrupts) (struct netxen_adapter *); |
967 | int (*disable_phy_interrupts) (struct netxen_adapter *); | 966 | int (*disable_phy_interrupts) (struct netxen_adapter *); |
968 | void (*handle_phy_intr) (struct netxen_adapter *); | ||
969 | int (*macaddr_set) (struct netxen_adapter *, netxen_ethernet_macaddr_t); | 967 | int (*macaddr_set) (struct netxen_adapter *, netxen_ethernet_macaddr_t); |
970 | int (*set_mtu) (struct netxen_adapter *, int); | 968 | int (*set_mtu) (struct netxen_adapter *, int); |
971 | int (*set_promisc) (struct netxen_adapter *, netxen_niu_prom_mode_t); | 969 | int (*set_promisc) (struct netxen_adapter *, netxen_niu_prom_mode_t); |
@@ -1049,8 +1047,6 @@ int netxen_niu_xgbe_enable_phy_interrupts(struct netxen_adapter *adapter); | |||
1049 | int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter); | 1047 | int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter); |
1050 | int netxen_niu_xgbe_disable_phy_interrupts(struct netxen_adapter *adapter); | 1048 | int netxen_niu_xgbe_disable_phy_interrupts(struct netxen_adapter *adapter); |
1051 | int netxen_niu_gbe_disable_phy_interrupts(struct netxen_adapter *adapter); | 1049 | int netxen_niu_gbe_disable_phy_interrupts(struct netxen_adapter *adapter); |
1052 | void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter); | ||
1053 | void netxen_nic_gbe_handle_phy_intr(struct netxen_adapter *adapter); | ||
1054 | int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long reg, | 1050 | int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long reg, |
1055 | __u32 * readval); | 1051 | __u32 * readval); |
1056 | int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, | 1052 | int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, |
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index c6e2bc71d8f3..7c3fbc4a5723 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
@@ -324,7 +324,6 @@ void netxen_initialize_adapter_ops(struct netxen_adapter *adapter) | |||
324 | netxen_niu_gbe_enable_phy_interrupts; | 324 | netxen_niu_gbe_enable_phy_interrupts; |
325 | adapter->disable_phy_interrupts = | 325 | adapter->disable_phy_interrupts = |
326 | netxen_niu_gbe_disable_phy_interrupts; | 326 | netxen_niu_gbe_disable_phy_interrupts; |
327 | adapter->handle_phy_intr = netxen_nic_gbe_handle_phy_intr; | ||
328 | adapter->macaddr_set = netxen_niu_macaddr_set; | 327 | adapter->macaddr_set = netxen_niu_macaddr_set; |
329 | adapter->set_mtu = netxen_nic_set_mtu_gb; | 328 | adapter->set_mtu = netxen_nic_set_mtu_gb; |
330 | adapter->set_promisc = netxen_niu_set_promiscuous_mode; | 329 | adapter->set_promisc = netxen_niu_set_promiscuous_mode; |
@@ -339,7 +338,6 @@ void netxen_initialize_adapter_ops(struct netxen_adapter *adapter) | |||
339 | netxen_niu_xgbe_enable_phy_interrupts; | 338 | netxen_niu_xgbe_enable_phy_interrupts; |
340 | adapter->disable_phy_interrupts = | 339 | adapter->disable_phy_interrupts = |
341 | netxen_niu_xgbe_disable_phy_interrupts; | 340 | netxen_niu_xgbe_disable_phy_interrupts; |
342 | adapter->handle_phy_intr = netxen_nic_xgbe_handle_phy_intr; | ||
343 | adapter->macaddr_set = netxen_niu_xg_macaddr_set; | 341 | adapter->macaddr_set = netxen_niu_xg_macaddr_set; |
344 | adapter->set_mtu = netxen_nic_set_mtu_xgb; | 342 | adapter->set_mtu = netxen_nic_set_mtu_xgb; |
345 | adapter->init_port = netxen_niu_xg_init_port; | 343 | adapter->init_port = netxen_niu_xg_init_port; |
@@ -1139,60 +1137,6 @@ int netxen_receive_peg_ready(struct netxen_adapter *adapter) | |||
1139 | return 0; | 1137 | return 0; |
1140 | } | 1138 | } |
1141 | 1139 | ||
1142 | static int netxen_nic_check_temp(struct netxen_adapter *adapter) | ||
1143 | { | ||
1144 | struct net_device *netdev = adapter->netdev; | ||
1145 | uint32_t temp, temp_state, temp_val; | ||
1146 | int rv = 0; | ||
1147 | |||
1148 | temp = adapter->pci_read_normalize(adapter, CRB_TEMP_STATE); | ||
1149 | |||
1150 | temp_state = nx_get_temp_state(temp); | ||
1151 | temp_val = nx_get_temp_val(temp); | ||
1152 | |||
1153 | if (temp_state == NX_TEMP_PANIC) { | ||
1154 | printk(KERN_ALERT | ||
1155 | "%s: Device temperature %d degrees C exceeds" | ||
1156 | " maximum allowed. Hardware has been shut down.\n", | ||
1157 | netxen_nic_driver_name, temp_val); | ||
1158 | |||
1159 | netif_carrier_off(netdev); | ||
1160 | netif_stop_queue(netdev); | ||
1161 | rv = 1; | ||
1162 | } else if (temp_state == NX_TEMP_WARN) { | ||
1163 | if (adapter->temp == NX_TEMP_NORMAL) { | ||
1164 | printk(KERN_ALERT | ||
1165 | "%s: Device temperature %d degrees C " | ||
1166 | "exceeds operating range." | ||
1167 | " Immediate action needed.\n", | ||
1168 | netxen_nic_driver_name, temp_val); | ||
1169 | } | ||
1170 | } else { | ||
1171 | if (adapter->temp == NX_TEMP_WARN) { | ||
1172 | printk(KERN_INFO | ||
1173 | "%s: Device temperature is now %d degrees C" | ||
1174 | " in normal range.\n", netxen_nic_driver_name, | ||
1175 | temp_val); | ||
1176 | } | ||
1177 | } | ||
1178 | adapter->temp = temp_state; | ||
1179 | return rv; | ||
1180 | } | ||
1181 | |||
1182 | void netxen_watchdog_task(struct work_struct *work) | ||
1183 | { | ||
1184 | struct netxen_adapter *adapter = | ||
1185 | container_of(work, struct netxen_adapter, watchdog_task); | ||
1186 | |||
1187 | if ((adapter->portnum == 0) && netxen_nic_check_temp(adapter)) | ||
1188 | return; | ||
1189 | |||
1190 | if (adapter->handle_phy_intr) | ||
1191 | adapter->handle_phy_intr(adapter); | ||
1192 | |||
1193 | mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); | ||
1194 | } | ||
1195 | |||
1196 | /* | 1140 | /* |
1197 | * netxen_process_rcv() send the received packet to the protocol stack. | 1141 | * netxen_process_rcv() send the received packet to the protocol stack. |
1198 | * and if the number of receives exceeds RX_BUFFERS_REFILL, then we | 1142 | * and if the number of receives exceeds RX_BUFFERS_REFILL, then we |
diff --git a/drivers/net/netxen/netxen_nic_isr.c b/drivers/net/netxen/netxen_nic_isr.c deleted file mode 100644 index 104c287d77ac..000000000000 --- a/drivers/net/netxen/netxen_nic_isr.c +++ /dev/null | |||
@@ -1,220 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2003 - 2006 NetXen, Inc. | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version 2 | ||
8 | * of the License, or (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, but | ||
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, | ||
18 | * MA 02111-1307, USA. | ||
19 | * | ||
20 | * The full GNU General Public License is included in this distribution | ||
21 | * in the file called LICENSE. | ||
22 | * | ||
23 | * Contact Information: | ||
24 | * info@netxen.com | ||
25 | * NetXen, | ||
26 | * 3965 Freedom Circle, Fourth floor, | ||
27 | * Santa Clara, CA 95054 | ||
28 | */ | ||
29 | |||
30 | #include <linux/netdevice.h> | ||
31 | #include <linux/delay.h> | ||
32 | |||
33 | #include "netxen_nic.h" | ||
34 | #include "netxen_nic_hw.h" | ||
35 | #include "netxen_nic_phan_reg.h" | ||
36 | |||
37 | /* | ||
38 | * netxen_nic_get_stats - Get System Network Statistics | ||
39 | * @netdev: network interface device structure | ||
40 | */ | ||
41 | struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev) | ||
42 | { | ||
43 | struct netxen_adapter *adapter = netdev_priv(netdev); | ||
44 | struct net_device_stats *stats = &adapter->net_stats; | ||
45 | |||
46 | memset(stats, 0, sizeof(*stats)); | ||
47 | |||
48 | /* total packets received */ | ||
49 | stats->rx_packets = adapter->stats.no_rcv; | ||
50 | /* total packets transmitted */ | ||
51 | stats->tx_packets = adapter->stats.xmitedframes + | ||
52 | adapter->stats.xmitfinished; | ||
53 | /* total bytes received */ | ||
54 | stats->rx_bytes = adapter->stats.rxbytes; | ||
55 | /* total bytes transmitted */ | ||
56 | stats->tx_bytes = adapter->stats.txbytes; | ||
57 | /* bad packets received */ | ||
58 | stats->rx_errors = adapter->stats.rcvdbadskb; | ||
59 | /* packet transmit problems */ | ||
60 | stats->tx_errors = adapter->stats.nocmddescriptor; | ||
61 | /* no space in linux buffers */ | ||
62 | stats->rx_dropped = adapter->stats.rxdropped; | ||
63 | /* no space available in linux */ | ||
64 | stats->tx_dropped = adapter->stats.txdropped; | ||
65 | |||
66 | return stats; | ||
67 | } | ||
68 | |||
69 | static void netxen_indicate_link_status(struct netxen_adapter *adapter, | ||
70 | u32 link) | ||
71 | { | ||
72 | struct net_device *netdev = adapter->netdev; | ||
73 | |||
74 | if (link) | ||
75 | netif_carrier_on(netdev); | ||
76 | else | ||
77 | netif_carrier_off(netdev); | ||
78 | } | ||
79 | |||
80 | #if 0 | ||
81 | void netxen_handle_port_int(struct netxen_adapter *adapter, u32 enable) | ||
82 | { | ||
83 | __u32 int_src; | ||
84 | |||
85 | /* This should clear the interrupt source */ | ||
86 | if (adapter->phy_read) | ||
87 | adapter->phy_read(adapter, | ||
88 | NETXEN_NIU_GB_MII_MGMT_ADDR_INT_STATUS, | ||
89 | &int_src); | ||
90 | if (int_src == 0) { | ||
91 | DPRINTK(INFO, "No phy interrupts for port #%d\n", portno); | ||
92 | return; | ||
93 | } | ||
94 | if (adapter->disable_phy_interrupts) | ||
95 | adapter->disable_phy_interrupts(adapter); | ||
96 | |||
97 | if (netxen_get_phy_int_jabber(int_src)) | ||
98 | DPRINTK(INFO, "Jabber interrupt \n"); | ||
99 | |||
100 | if (netxen_get_phy_int_polarity_changed(int_src)) | ||
101 | DPRINTK(INFO, "POLARITY CHANGED int \n"); | ||
102 | |||
103 | if (netxen_get_phy_int_energy_detect(int_src)) | ||
104 | DPRINTK(INFO, "ENERGY DETECT INT \n"); | ||
105 | |||
106 | if (netxen_get_phy_int_downshift(int_src)) | ||
107 | DPRINTK(INFO, "DOWNSHIFT INT \n"); | ||
108 | /* write it down later.. */ | ||
109 | if ((netxen_get_phy_int_speed_changed(int_src)) | ||
110 | || (netxen_get_phy_int_link_status_changed(int_src))) { | ||
111 | __u32 status; | ||
112 | |||
113 | DPRINTK(INFO, "SPEED CHANGED OR LINK STATUS CHANGED \n"); | ||
114 | |||
115 | if (adapter->phy_read | ||
116 | && adapter->phy_read(adapter, | ||
117 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, | ||
118 | &status) == 0) { | ||
119 | if (netxen_get_phy_int_link_status_changed(int_src)) { | ||
120 | if (netxen_get_phy_link(status)) { | ||
121 | printk(KERN_INFO "%s: %s Link UP\n", | ||
122 | netxen_nic_driver_name, | ||
123 | adapter->netdev->name); | ||
124 | |||
125 | } else { | ||
126 | printk(KERN_INFO "%s: %s Link DOWN\n", | ||
127 | netxen_nic_driver_name, | ||
128 | adapter->netdev->name); | ||
129 | } | ||
130 | netxen_indicate_link_status(adapter, | ||
131 | netxen_get_phy_link | ||
132 | (status)); | ||
133 | } | ||
134 | } | ||
135 | } | ||
136 | if (adapter->enable_phy_interrupts) | ||
137 | adapter->enable_phy_interrupts(adapter); | ||
138 | } | ||
139 | #endif /* 0 */ | ||
140 | |||
141 | static void netxen_nic_isr_other(struct netxen_adapter *adapter) | ||
142 | { | ||
143 | int portno = adapter->portnum; | ||
144 | u32 val, linkup, qg_linksup; | ||
145 | |||
146 | /* verify the offset */ | ||
147 | val = adapter->pci_read_normalize(adapter, CRB_XG_STATE); | ||
148 | val = val >> adapter->physical_port; | ||
149 | if (val == adapter->ahw.qg_linksup) | ||
150 | return; | ||
151 | |||
152 | qg_linksup = adapter->ahw.qg_linksup; | ||
153 | adapter->ahw.qg_linksup = val; | ||
154 | DPRINTK(INFO, "link update 0x%08x\n", val); | ||
155 | |||
156 | linkup = val & 1; | ||
157 | |||
158 | if (linkup != (qg_linksup & 1)) { | ||
159 | printk(KERN_INFO "%s: %s PORT %d link %s\n", | ||
160 | adapter->netdev->name, | ||
161 | netxen_nic_driver_name, portno, | ||
162 | ((linkup == 0) ? "down" : "up")); | ||
163 | netxen_indicate_link_status(adapter, linkup); | ||
164 | if (linkup) | ||
165 | netxen_nic_set_link_parameters(adapter); | ||
166 | |||
167 | } | ||
168 | } | ||
169 | |||
170 | void netxen_nic_gbe_handle_phy_intr(struct netxen_adapter *adapter) | ||
171 | { | ||
172 | netxen_nic_isr_other(adapter); | ||
173 | } | ||
174 | |||
175 | #if 0 | ||
176 | int netxen_nic_link_ok(struct netxen_adapter *adapter) | ||
177 | { | ||
178 | switch (adapter->ahw.board_type) { | ||
179 | case NETXEN_NIC_GBE: | ||
180 | return ((adapter->ahw.qg_linksup) & 1); | ||
181 | |||
182 | case NETXEN_NIC_XGBE: | ||
183 | return ((adapter->ahw.xg_linkup) & 1); | ||
184 | |||
185 | default: | ||
186 | printk(KERN_ERR"%s: Function: %s, Unknown board type\n", | ||
187 | netxen_nic_driver_name, __FUNCTION__); | ||
188 | break; | ||
189 | } | ||
190 | |||
191 | return 0; | ||
192 | } | ||
193 | #endif /* 0 */ | ||
194 | |||
195 | void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter) | ||
196 | { | ||
197 | struct net_device *netdev = adapter->netdev; | ||
198 | u32 val; | ||
199 | |||
200 | /* WINDOW = 1 */ | ||
201 | val = adapter->pci_read_normalize(adapter, CRB_XG_STATE); | ||
202 | val >>= (adapter->physical_port * 8); | ||
203 | val &= 0xff; | ||
204 | |||
205 | if (adapter->ahw.xg_linkup == 1 && val != XG_LINK_UP) { | ||
206 | printk(KERN_INFO "%s: %s NIC Link is down\n", | ||
207 | netxen_nic_driver_name, netdev->name); | ||
208 | adapter->ahw.xg_linkup = 0; | ||
209 | if (netif_running(netdev)) { | ||
210 | netif_carrier_off(netdev); | ||
211 | netif_stop_queue(netdev); | ||
212 | } | ||
213 | } else if (adapter->ahw.xg_linkup == 0 && val == XG_LINK_UP) { | ||
214 | printk(KERN_INFO "%s: %s NIC Link is up\n", | ||
215 | netxen_nic_driver_name, netdev->name); | ||
216 | adapter->ahw.xg_linkup = 1; | ||
217 | netif_carrier_on(netdev); | ||
218 | netif_wake_queue(netdev); | ||
219 | } | ||
220 | } | ||
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 4d32f3cc2fbd..2d0963f4d194 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -904,7 +904,7 @@ request_msi: | |||
904 | goto err_out_disable_msi; | 904 | goto err_out_disable_msi; |
905 | 905 | ||
906 | init_timer(&adapter->watchdog_timer); | 906 | init_timer(&adapter->watchdog_timer); |
907 | adapter->ahw.xg_linkup = 0; | 907 | adapter->ahw.linkup = 0; |
908 | adapter->watchdog_timer.function = &netxen_watchdog; | 908 | adapter->watchdog_timer.function = &netxen_watchdog; |
909 | adapter->watchdog_timer.data = (unsigned long)adapter; | 909 | adapter->watchdog_timer.data = (unsigned long)adapter; |
910 | INIT_WORK(&adapter->watchdog_task, netxen_watchdog_task); | 910 | INIT_WORK(&adapter->watchdog_task, netxen_watchdog_task); |
@@ -1335,6 +1335,80 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1335 | return NETDEV_TX_OK; | 1335 | return NETDEV_TX_OK; |
1336 | } | 1336 | } |
1337 | 1337 | ||
1338 | static int netxen_nic_check_temp(struct netxen_adapter *adapter) | ||
1339 | { | ||
1340 | struct net_device *netdev = adapter->netdev; | ||
1341 | uint32_t temp, temp_state, temp_val; | ||
1342 | int rv = 0; | ||
1343 | |||
1344 | temp = adapter->pci_read_normalize(adapter, CRB_TEMP_STATE); | ||
1345 | |||
1346 | temp_state = nx_get_temp_state(temp); | ||
1347 | temp_val = nx_get_temp_val(temp); | ||
1348 | |||
1349 | if (temp_state == NX_TEMP_PANIC) { | ||
1350 | printk(KERN_ALERT | ||
1351 | "%s: Device temperature %d degrees C exceeds" | ||
1352 | " maximum allowed. Hardware has been shut down.\n", | ||
1353 | netxen_nic_driver_name, temp_val); | ||
1354 | |||
1355 | netif_carrier_off(netdev); | ||
1356 | netif_stop_queue(netdev); | ||
1357 | rv = 1; | ||
1358 | } else if (temp_state == NX_TEMP_WARN) { | ||
1359 | if (adapter->temp == NX_TEMP_NORMAL) { | ||
1360 | printk(KERN_ALERT | ||
1361 | "%s: Device temperature %d degrees C " | ||
1362 | "exceeds operating range." | ||
1363 | " Immediate action needed.\n", | ||
1364 | netxen_nic_driver_name, temp_val); | ||
1365 | } | ||
1366 | } else { | ||
1367 | if (adapter->temp == NX_TEMP_WARN) { | ||
1368 | printk(KERN_INFO | ||
1369 | "%s: Device temperature is now %d degrees C" | ||
1370 | " in normal range.\n", netxen_nic_driver_name, | ||
1371 | temp_val); | ||
1372 | } | ||
1373 | } | ||
1374 | adapter->temp = temp_state; | ||
1375 | return rv; | ||
1376 | } | ||
1377 | |||
1378 | static void netxen_nic_handle_phy_intr(struct netxen_adapter *adapter) | ||
1379 | { | ||
1380 | struct net_device *netdev = adapter->netdev; | ||
1381 | u32 val, port, linkup; | ||
1382 | |||
1383 | port = adapter->physical_port; | ||
1384 | |||
1385 | val = adapter->pci_read_normalize(adapter, CRB_XG_STATE); | ||
1386 | if (adapter->ahw.board_type == NETXEN_NIC_GBE) | ||
1387 | linkup = (val >> port) & 1; | ||
1388 | else { | ||
1389 | val = (val >> port*8) & 0xff; | ||
1390 | linkup = (val == XG_LINK_UP); | ||
1391 | } | ||
1392 | |||
1393 | if (adapter->ahw.linkup && !linkup) { | ||
1394 | printk(KERN_INFO "%s: %s NIC Link is down\n", | ||
1395 | netxen_nic_driver_name, netdev->name); | ||
1396 | adapter->ahw.linkup = 0; | ||
1397 | if (netif_running(netdev)) { | ||
1398 | netif_carrier_off(netdev); | ||
1399 | netif_stop_queue(netdev); | ||
1400 | } | ||
1401 | } else if (!adapter->ahw.linkup && linkup) { | ||
1402 | printk(KERN_INFO "%s: %s NIC Link is up\n", | ||
1403 | netxen_nic_driver_name, netdev->name); | ||
1404 | adapter->ahw.linkup = 1; | ||
1405 | if (netif_running(netdev)) { | ||
1406 | netif_carrier_on(netdev); | ||
1407 | netif_wake_queue(netdev); | ||
1408 | } | ||
1409 | } | ||
1410 | } | ||
1411 | |||
1338 | static void netxen_watchdog(unsigned long v) | 1412 | static void netxen_watchdog(unsigned long v) |
1339 | { | 1413 | { |
1340 | struct netxen_adapter *adapter = (struct netxen_adapter *)v; | 1414 | struct netxen_adapter *adapter = (struct netxen_adapter *)v; |
@@ -1342,6 +1416,19 @@ static void netxen_watchdog(unsigned long v) | |||
1342 | SCHEDULE_WORK(&adapter->watchdog_task); | 1416 | SCHEDULE_WORK(&adapter->watchdog_task); |
1343 | } | 1417 | } |
1344 | 1418 | ||
1419 | void netxen_watchdog_task(struct work_struct *work) | ||
1420 | { | ||
1421 | struct netxen_adapter *adapter = | ||
1422 | container_of(work, struct netxen_adapter, watchdog_task); | ||
1423 | |||
1424 | if ((adapter->portnum == 0) && netxen_nic_check_temp(adapter)) | ||
1425 | return; | ||
1426 | |||
1427 | netxen_nic_handle_phy_intr(adapter); | ||
1428 | |||
1429 | mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); | ||
1430 | } | ||
1431 | |||
1345 | static void netxen_tx_timeout(struct net_device *netdev) | 1432 | static void netxen_tx_timeout(struct net_device *netdev) |
1346 | { | 1433 | { |
1347 | struct netxen_adapter *adapter = (struct netxen_adapter *) | 1434 | struct netxen_adapter *adapter = (struct netxen_adapter *) |
@@ -1367,6 +1454,38 @@ static void netxen_tx_timeout_task(struct work_struct *work) | |||
1367 | netif_wake_queue(adapter->netdev); | 1454 | netif_wake_queue(adapter->netdev); |
1368 | } | 1455 | } |
1369 | 1456 | ||
1457 | /* | ||
1458 | * netxen_nic_get_stats - Get System Network Statistics | ||
1459 | * @netdev: network interface device structure | ||
1460 | */ | ||
1461 | struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev) | ||
1462 | { | ||
1463 | struct netxen_adapter *adapter = netdev_priv(netdev); | ||
1464 | struct net_device_stats *stats = &adapter->net_stats; | ||
1465 | |||
1466 | memset(stats, 0, sizeof(*stats)); | ||
1467 | |||
1468 | /* total packets received */ | ||
1469 | stats->rx_packets = adapter->stats.no_rcv; | ||
1470 | /* total packets transmitted */ | ||
1471 | stats->tx_packets = adapter->stats.xmitedframes + | ||
1472 | adapter->stats.xmitfinished; | ||
1473 | /* total bytes received */ | ||
1474 | stats->rx_bytes = adapter->stats.rxbytes; | ||
1475 | /* total bytes transmitted */ | ||
1476 | stats->tx_bytes = adapter->stats.txbytes; | ||
1477 | /* bad packets received */ | ||
1478 | stats->rx_errors = adapter->stats.rcvdbadskb; | ||
1479 | /* packet transmit problems */ | ||
1480 | stats->tx_errors = adapter->stats.nocmddescriptor; | ||
1481 | /* no space in linux buffers */ | ||
1482 | stats->rx_dropped = adapter->stats.rxdropped; | ||
1483 | /* no space available in linux */ | ||
1484 | stats->tx_dropped = adapter->stats.txdropped; | ||
1485 | |||
1486 | return stats; | ||
1487 | } | ||
1488 | |||
1370 | static inline void | 1489 | static inline void |
1371 | netxen_handle_int(struct netxen_adapter *adapter) | 1490 | netxen_handle_int(struct netxen_adapter *adapter) |
1372 | { | 1491 | { |