Commit | Line | Data |
---|---|---|
1da177e4 | 1 | /* |
1da177e4 LT |
2 | * Copyright (C) 2002 Intersil Americas Inc. |
3 | * Copyright (C) 2004 Aurelien Alleaume <slts@free.fr> | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of the GNU General Public License as published by | |
6 | * the Free Software Foundation; either version 2 of the License | |
7 | * | |
8 | * This program is distributed in the hope that it will be useful, | |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | * GNU General Public License for more details. | |
12 | * | |
13 | * You should have received a copy of the GNU General Public License | |
14 | * along with this program; if not, write to the Free Software | |
15 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
16 | * | |
17 | */ | |
18 | ||
1da177e4 LT |
19 | #include <linux/module.h> |
20 | ||
21 | #include <linux/pci.h> | |
22 | #include <linux/delay.h> | |
23 | #include <linux/netdevice.h> | |
24 | #include <linux/etherdevice.h> | |
25 | #include <linux/if_arp.h> | |
26 | ||
27 | #include "prismcompat.h" | |
28 | #include "isl_38xx.h" | |
29 | #include "islpci_eth.h" | |
30 | #include "islpci_mgt.h" | |
31 | #include "oid_mgt.h" | |
32 | ||
33 | /****************************************************************************** | |
34 | Network Interface functions | |
35 | ******************************************************************************/ | |
36 | void | |
37 | islpci_eth_cleanup_transmit(islpci_private *priv, | |
38 | isl38xx_control_block *control_block) | |
39 | { | |
40 | struct sk_buff *skb; | |
41 | u32 index; | |
42 | ||
43 | /* compare the control block read pointer with the free pointer */ | |
44 | while (priv->free_data_tx != | |
45 | le32_to_cpu(control_block-> | |
46 | device_curr_frag[ISL38XX_CB_TX_DATA_LQ])) { | |
47 | /* read the index of the first fragment to be freed */ | |
48 | index = priv->free_data_tx % ISL38XX_CB_TX_QSIZE; | |
49 | ||
93b2dd12 | 50 | /* check for holes in the arrays caused by multi fragment frames |
1da177e4 LT |
51 | * searching for the last fragment of a frame */ |
52 | if (priv->pci_map_tx_address[index] != (dma_addr_t) NULL) { | |
53 | /* entry is the last fragment of a frame | |
54 | * free the skb structure and unmap pci memory */ | |
55 | skb = priv->data_low_tx[index]; | |
56 | ||
57 | #if VERBOSE > SHOW_ERROR_MESSAGES | |
58 | DEBUG(SHOW_TRACING, | |
59 | "cleanup skb %p skb->data %p skb->len %u truesize %u\n ", | |
60 | skb, skb->data, skb->len, skb->truesize); | |
61 | #endif | |
62 | ||
63 | pci_unmap_single(priv->pdev, | |
64 | priv->pci_map_tx_address[index], | |
65 | skb->len, PCI_DMA_TODEVICE); | |
66 | dev_kfree_skb_irq(skb); | |
67 | skb = NULL; | |
68 | } | |
69 | /* increment the free data low queue pointer */ | |
70 | priv->free_data_tx++; | |
71 | } | |
72 | } | |
73 | ||
74 | int | |
75 | islpci_eth_transmit(struct sk_buff *skb, struct net_device *ndev) | |
76 | { | |
77 | islpci_private *priv = netdev_priv(ndev); | |
78 | isl38xx_control_block *cb = priv->control_block; | |
79 | u32 index; | |
80 | dma_addr_t pci_map_address; | |
81 | int frame_size; | |
82 | isl38xx_fragment *fragment; | |
83 | int offset; | |
84 | struct sk_buff *newskb; | |
85 | int newskb_offset; | |
86 | unsigned long flags; | |
87 | unsigned char wds_mac[6]; | |
88 | u32 curr_frag; | |
89 | int err = 0; | |
90 | ||
91 | #if VERBOSE > SHOW_ERROR_MESSAGES | |
92 | DEBUG(SHOW_FUNCTION_CALLS, "islpci_eth_transmit \n"); | |
93 | #endif | |
94 | ||
95 | /* lock the driver code */ | |
96 | spin_lock_irqsave(&priv->slock, flags); | |
97 | ||
1da177e4 LT |
98 | /* check whether the destination queue has enough fragments for the frame */ |
99 | curr_frag = le32_to_cpu(cb->driver_curr_frag[ISL38XX_CB_TX_DATA_LQ]); | |
100 | if (unlikely(curr_frag - priv->free_data_tx >= ISL38XX_CB_TX_QSIZE)) { | |
101 | printk(KERN_ERR "%s: transmit device queue full when awake\n", | |
102 | ndev->name); | |
103 | netif_stop_queue(ndev); | |
104 | ||
105 | /* trigger the device */ | |
106 | isl38xx_w32_flush(priv->device_base, ISL38XX_DEV_INT_UPDATE, | |
107 | ISL38XX_DEV_INT_REG); | |
108 | udelay(ISL38XX_WRITEIO_DELAY); | |
109 | ||
110 | err = -EBUSY; | |
111 | goto drop_free; | |
112 | } | |
113 | /* Check alignment and WDS frame formatting. The start of the packet should | |
114 | * be aligned on a 4-byte boundary. If WDS is enabled add another 6 bytes | |
115 | * and add WDS address information */ | |
116 | if (likely(((long) skb->data & 0x03) | init_wds)) { | |
117 | /* get the number of bytes to add and re-allign */ | |
118 | offset = (4 - (long) skb->data) & 0x03; | |
119 | offset += init_wds ? 6 : 0; | |
120 | ||
121 | /* check whether the current skb can be used */ | |
122 | if (!skb_cloned(skb) && (skb_tailroom(skb) >= offset)) { | |
123 | unsigned char *src = skb->data; | |
124 | ||
125 | #if VERBOSE > SHOW_ERROR_MESSAGES | |
126 | DEBUG(SHOW_TRACING, "skb offset %i wds %i\n", offset, | |
127 | init_wds); | |
128 | #endif | |
129 | ||
130 | /* align the buffer on 4-byte boundary */ | |
131 | skb_reserve(skb, (4 - (long) skb->data) & 0x03); | |
132 | if (init_wds) { | |
133 | /* wds requires an additional address field of 6 bytes */ | |
134 | skb_put(skb, 6); | |
135 | #ifdef ISLPCI_ETH_DEBUG | |
136 | printk("islpci_eth_transmit:wds_mac\n"); | |
137 | #endif | |
138 | memmove(skb->data + 6, src, skb->len); | |
139 | memcpy(skb->data, wds_mac, 6); | |
140 | } else { | |
141 | memmove(skb->data, src, skb->len); | |
142 | } | |
143 | ||
144 | #if VERBOSE > SHOW_ERROR_MESSAGES | |
145 | DEBUG(SHOW_TRACING, "memmove %p %p %i \n", skb->data, | |
146 | src, skb->len); | |
147 | #endif | |
148 | } else { | |
149 | newskb = | |
150 | dev_alloc_skb(init_wds ? skb->len + 6 : skb->len); | |
151 | if (unlikely(newskb == NULL)) { | |
152 | printk(KERN_ERR "%s: Cannot allocate skb\n", | |
153 | ndev->name); | |
154 | err = -ENOMEM; | |
155 | goto drop_free; | |
156 | } | |
157 | newskb_offset = (4 - (long) newskb->data) & 0x03; | |
158 | ||
159 | /* Check if newskb->data is aligned */ | |
160 | if (newskb_offset) | |
161 | skb_reserve(newskb, newskb_offset); | |
162 | ||
163 | skb_put(newskb, init_wds ? skb->len + 6 : skb->len); | |
164 | if (init_wds) { | |
165 | memcpy(newskb->data + 6, skb->data, skb->len); | |
166 | memcpy(newskb->data, wds_mac, 6); | |
167 | #ifdef ISLPCI_ETH_DEBUG | |
168 | printk("islpci_eth_transmit:wds_mac\n"); | |
169 | #endif | |
170 | } else | |
171 | memcpy(newskb->data, skb->data, skb->len); | |
172 | ||
173 | #if VERBOSE > SHOW_ERROR_MESSAGES | |
174 | DEBUG(SHOW_TRACING, "memcpy %p %p %i wds %i\n", | |
175 | newskb->data, skb->data, skb->len, init_wds); | |
176 | #endif | |
177 | ||
178 | newskb->dev = skb->dev; | |
caa06b61 | 179 | dev_kfree_skb_irq(skb); |
1da177e4 LT |
180 | skb = newskb; |
181 | } | |
182 | } | |
183 | /* display the buffer contents for debugging */ | |
184 | #if VERBOSE > SHOW_ERROR_MESSAGES | |
185 | DEBUG(SHOW_BUFFER_CONTENTS, "\ntx %p ", skb->data); | |
186 | display_buffer((char *) skb->data, skb->len); | |
187 | #endif | |
188 | ||
189 | /* map the skb buffer to pci memory for DMA operation */ | |
190 | pci_map_address = pci_map_single(priv->pdev, | |
191 | (void *) skb->data, skb->len, | |
192 | PCI_DMA_TODEVICE); | |
193 | if (unlikely(pci_map_address == 0)) { | |
194 | printk(KERN_WARNING "%s: cannot map buffer to PCI\n", | |
195 | ndev->name); | |
196 | ||
197 | err = -EIO; | |
198 | goto drop_free; | |
199 | } | |
200 | /* Place the fragment in the control block structure. */ | |
201 | index = curr_frag % ISL38XX_CB_TX_QSIZE; | |
202 | fragment = &cb->tx_data_low[index]; | |
203 | ||
204 | priv->pci_map_tx_address[index] = pci_map_address; | |
205 | /* store the skb address for future freeing */ | |
206 | priv->data_low_tx[index] = skb; | |
207 | /* set the proper fragment start address and size information */ | |
008d5590 | 208 | frame_size = skb->len; |
1da177e4 LT |
209 | fragment->size = cpu_to_le16(frame_size); |
210 | fragment->flags = cpu_to_le16(0); /* set to 1 if more fragments */ | |
211 | fragment->address = cpu_to_le32(pci_map_address); | |
212 | curr_frag++; | |
213 | ||
214 | /* The fragment address in the control block must have been | |
215 | * written before announcing the frame buffer to device. */ | |
216 | wmb(); | |
217 | cb->driver_curr_frag[ISL38XX_CB_TX_DATA_LQ] = cpu_to_le32(curr_frag); | |
218 | ||
219 | if (curr_frag - priv->free_data_tx + ISL38XX_MIN_QTHRESHOLD | |
220 | > ISL38XX_CB_TX_QSIZE) { | |
221 | /* stop sends from upper layers */ | |
222 | netif_stop_queue(ndev); | |
223 | ||
224 | /* set the full flag for the transmission queue */ | |
225 | priv->data_low_tx_full = 1; | |
226 | } | |
227 | ||
0b47939f RW |
228 | /* set the transmission time */ |
229 | ndev->trans_start = jiffies; | |
230 | priv->statistics.tx_packets++; | |
231 | priv->statistics.tx_bytes += skb->len; | |
232 | ||
1da177e4 LT |
233 | /* trigger the device */ |
234 | islpci_trigger(priv); | |
235 | ||
236 | /* unlock the driver code */ | |
237 | spin_unlock_irqrestore(&priv->slock, flags); | |
238 | ||
1da177e4 LT |
239 | return 0; |
240 | ||
241 | drop_free: | |
1da177e4 LT |
242 | priv->statistics.tx_dropped++; |
243 | spin_unlock_irqrestore(&priv->slock, flags); | |
e71180f3 | 244 | dev_kfree_skb(skb); |
1da177e4 LT |
245 | return err; |
246 | } | |
247 | ||
248 | static inline int | |
249 | islpci_monitor_rx(islpci_private *priv, struct sk_buff **skb) | |
250 | { | |
251 | /* The card reports full 802.11 packets but with a 20 bytes | |
252 | * header and without the FCS. But there a is a bit that | |
253 | * indicates if the packet is corrupted :-) */ | |
254 | struct rfmon_header *hdr = (struct rfmon_header *) (*skb)->data; | |
d18e0c4a | 255 | |
1da177e4 LT |
256 | if (hdr->flags & 0x01) |
257 | /* This one is bad. Drop it ! */ | |
258 | return -1; | |
259 | if (priv->ndev->type == ARPHRD_IEEE80211_PRISM) { | |
260 | struct avs_80211_1_header *avs; | |
261 | /* extract the relevant data from the header */ | |
262 | u32 clock = le32_to_cpu(hdr->clock); | |
263 | u8 rate = hdr->rate; | |
264 | u16 freq = le16_to_cpu(hdr->freq); | |
265 | u8 rssi = hdr->rssi; | |
266 | ||
267 | skb_pull(*skb, sizeof (struct rfmon_header)); | |
268 | ||
269 | if (skb_headroom(*skb) < sizeof (struct avs_80211_1_header)) { | |
270 | struct sk_buff *newskb = skb_copy_expand(*skb, | |
271 | sizeof (struct | |
272 | avs_80211_1_header), | |
273 | 0, GFP_ATOMIC); | |
274 | if (newskb) { | |
275 | dev_kfree_skb_irq(*skb); | |
276 | *skb = newskb; | |
277 | } else | |
278 | return -1; | |
279 | /* This behavior is not very subtile... */ | |
280 | } | |
281 | ||
282 | /* make room for the new header and fill it. */ | |
283 | avs = | |
284 | (struct avs_80211_1_header *) skb_push(*skb, | |
285 | sizeof (struct | |
286 | avs_80211_1_header)); | |
93b2dd12 | 287 | |
1da177e4 LT |
288 | avs->version = cpu_to_be32(P80211CAPTURE_VERSION); |
289 | avs->length = cpu_to_be32(sizeof (struct avs_80211_1_header)); | |
290 | avs->mactime = cpu_to_be64(le64_to_cpu(clock)); | |
291 | avs->hosttime = cpu_to_be64(jiffies); | |
292 | avs->phytype = cpu_to_be32(6); /*OFDM: 6 for (g), 8 for (a) */ | |
293 | avs->channel = cpu_to_be32(channel_of_freq(freq)); | |
294 | avs->datarate = cpu_to_be32(rate * 5); | |
295 | avs->antenna = cpu_to_be32(0); /*unknown */ | |
296 | avs->priority = cpu_to_be32(0); /*unknown */ | |
297 | avs->ssi_type = cpu_to_be32(3); /*2: dBm, 3: raw RSSI */ | |
298 | avs->ssi_signal = cpu_to_be32(rssi & 0x7f); | |
299 | avs->ssi_noise = cpu_to_be32(priv->local_iwstatistics.qual.noise); /*better than 'undefined', I assume */ | |
300 | avs->preamble = cpu_to_be32(0); /*unknown */ | |
301 | avs->encoding = cpu_to_be32(0); /*unknown */ | |
302 | } else | |
303 | skb_pull(*skb, sizeof (struct rfmon_header)); | |
304 | ||
305 | (*skb)->protocol = htons(ETH_P_802_2); | |
459a98ed | 306 | skb_reset_mac_header(*skb); |
1da177e4 LT |
307 | (*skb)->pkt_type = PACKET_OTHERHOST; |
308 | ||
309 | return 0; | |
310 | } | |
311 | ||
312 | int | |
313 | islpci_eth_receive(islpci_private *priv) | |
314 | { | |
315 | struct net_device *ndev = priv->ndev; | |
316 | isl38xx_control_block *control_block = priv->control_block; | |
317 | struct sk_buff *skb; | |
318 | u16 size; | |
319 | u32 index, offset; | |
320 | unsigned char *src; | |
321 | int discard = 0; | |
322 | ||
323 | #if VERBOSE > SHOW_ERROR_MESSAGES | |
324 | DEBUG(SHOW_FUNCTION_CALLS, "islpci_eth_receive \n"); | |
325 | #endif | |
326 | ||
327 | /* the device has written an Ethernet frame in the data area | |
328 | * of the sk_buff without updating the structure, do it now */ | |
329 | index = priv->free_data_rx % ISL38XX_CB_RX_QSIZE; | |
330 | size = le16_to_cpu(control_block->rx_data_low[index].size); | |
331 | skb = priv->data_low_rx[index]; | |
332 | offset = ((unsigned long) | |
333 | le32_to_cpu(control_block->rx_data_low[index].address) - | |
334 | (unsigned long) skb->data) & 3; | |
335 | ||
336 | #if VERBOSE > SHOW_ERROR_MESSAGES | |
337 | DEBUG(SHOW_TRACING, | |
338 | "frq->addr %x skb->data %p skb->len %u offset %u truesize %u\n ", | |
339 | control_block->rx_data_low[priv->free_data_rx].address, skb->data, | |
340 | skb->len, offset, skb->truesize); | |
341 | #endif | |
342 | ||
343 | /* delete the streaming DMA mapping before processing the skb */ | |
344 | pci_unmap_single(priv->pdev, | |
345 | priv->pci_map_rx_address[index], | |
346 | MAX_FRAGMENT_SIZE_RX + 2, PCI_DMA_FROMDEVICE); | |
347 | ||
348 | /* update the skb structure and allign the buffer */ | |
349 | skb_put(skb, size); | |
350 | if (offset) { | |
351 | /* shift the buffer allocation offset bytes to get the right frame */ | |
352 | skb_pull(skb, 2); | |
353 | skb_put(skb, 2); | |
354 | } | |
355 | #if VERBOSE > SHOW_ERROR_MESSAGES | |
356 | /* display the buffer contents for debugging */ | |
357 | DEBUG(SHOW_BUFFER_CONTENTS, "\nrx %p ", skb->data); | |
358 | display_buffer((char *) skb->data, skb->len); | |
359 | #endif | |
360 | ||
361 | /* check whether WDS is enabled and whether the data frame is a WDS frame */ | |
362 | ||
363 | if (init_wds) { | |
364 | /* WDS enabled, check for the wds address on the first 6 bytes of the buffer */ | |
365 | src = skb->data + 6; | |
366 | memmove(skb->data, src, skb->len - 6); | |
367 | skb_trim(skb, skb->len - 6); | |
368 | } | |
369 | #if VERBOSE > SHOW_ERROR_MESSAGES | |
370 | DEBUG(SHOW_TRACING, "Fragment size %i in skb at %p\n", size, skb); | |
371 | DEBUG(SHOW_TRACING, "Skb data at %p, length %i\n", skb->data, skb->len); | |
372 | ||
373 | /* display the buffer contents for debugging */ | |
374 | DEBUG(SHOW_BUFFER_CONTENTS, "\nrx %p ", skb->data); | |
375 | display_buffer((char *) skb->data, skb->len); | |
376 | #endif | |
1da177e4 LT |
377 | /* take care of monitor mode and spy monitoring. */ |
378 | if (unlikely(priv->iw_mode == IW_MODE_MONITOR)) | |
379 | discard = islpci_monitor_rx(priv, &skb); | |
380 | else { | |
381 | if (unlikely(skb->data[2 * ETH_ALEN] == 0)) { | |
382 | /* The packet has a rx_annex. Read it for spy monitoring, Then | |
383 | * remove it, while keeping the 2 leading MAC addr. | |
384 | */ | |
385 | struct iw_quality wstats; | |
386 | struct rx_annex_header *annex = | |
387 | (struct rx_annex_header *) skb->data; | |
388 | wstats.level = annex->rfmon.rssi; | |
93b2dd12 | 389 | /* The noise value can be a bit outdated if nobody's |
1da177e4 LT |
390 | * reading wireless stats... */ |
391 | wstats.noise = priv->local_iwstatistics.qual.noise; | |
392 | wstats.qual = wstats.level - wstats.noise; | |
393 | wstats.updated = 0x07; | |
394 | /* Update spy records */ | |
395 | wireless_spy_update(ndev, annex->addr2, &wstats); | |
396 | ||
397 | memcpy(skb->data + sizeof (struct rfmon_header), | |
398 | skb->data, 2 * ETH_ALEN); | |
399 | skb_pull(skb, sizeof (struct rfmon_header)); | |
400 | } | |
401 | skb->protocol = eth_type_trans(skb, ndev); | |
402 | } | |
403 | skb->ip_summed = CHECKSUM_NONE; | |
404 | priv->statistics.rx_packets++; | |
405 | priv->statistics.rx_bytes += size; | |
406 | ||
407 | /* deliver the skb to the network layer */ | |
408 | #ifdef ISLPCI_ETH_DEBUG | |
409 | printk | |
410 | ("islpci_eth_receive:netif_rx %2.2X %2.2X %2.2X %2.2X %2.2X %2.2X\n", | |
411 | skb->data[0], skb->data[1], skb->data[2], skb->data[3], | |
412 | skb->data[4], skb->data[5]); | |
413 | #endif | |
414 | if (unlikely(discard)) { | |
415 | dev_kfree_skb_irq(skb); | |
416 | skb = NULL; | |
417 | } else | |
418 | netif_rx(skb); | |
419 | ||
420 | /* increment the read index for the rx data low queue */ | |
421 | priv->free_data_rx++; | |
422 | ||
423 | /* add one or more sk_buff structures */ | |
424 | while (index = | |
425 | le32_to_cpu(control_block-> | |
426 | driver_curr_frag[ISL38XX_CB_RX_DATA_LQ]), | |
427 | index - priv->free_data_rx < ISL38XX_CB_RX_QSIZE) { | |
428 | /* allocate an sk_buff for received data frames storage | |
429 | * include any required allignment operations */ | |
430 | skb = dev_alloc_skb(MAX_FRAGMENT_SIZE_RX + 2); | |
431 | if (unlikely(skb == NULL)) { | |
432 | /* error allocating an sk_buff structure elements */ | |
433 | DEBUG(SHOW_ERROR_MESSAGES, "Error allocating skb \n"); | |
434 | break; | |
435 | } | |
436 | skb_reserve(skb, (4 - (long) skb->data) & 0x03); | |
437 | /* store the new skb structure pointer */ | |
438 | index = index % ISL38XX_CB_RX_QSIZE; | |
439 | priv->data_low_rx[index] = skb; | |
440 | ||
441 | #if VERBOSE > SHOW_ERROR_MESSAGES | |
442 | DEBUG(SHOW_TRACING, | |
443 | "new alloc skb %p skb->data %p skb->len %u index %u truesize %u\n ", | |
444 | skb, skb->data, skb->len, index, skb->truesize); | |
445 | #endif | |
446 | ||
447 | /* set the streaming DMA mapping for proper PCI bus operation */ | |
448 | priv->pci_map_rx_address[index] = | |
449 | pci_map_single(priv->pdev, (void *) skb->data, | |
450 | MAX_FRAGMENT_SIZE_RX + 2, | |
451 | PCI_DMA_FROMDEVICE); | |
452 | if (unlikely(priv->pci_map_rx_address[index] == (dma_addr_t) NULL)) { | |
453 | /* error mapping the buffer to device accessable memory address */ | |
454 | DEBUG(SHOW_ERROR_MESSAGES, | |
455 | "Error mapping DMA address\n"); | |
456 | ||
457 | /* free the skbuf structure before aborting */ | |
458 | dev_kfree_skb_irq((struct sk_buff *) skb); | |
459 | skb = NULL; | |
460 | break; | |
461 | } | |
462 | /* update the fragment address */ | |
d18e0c4a DT |
463 | control_block->rx_data_low[index].address = |
464 | cpu_to_le32((u32)priv->pci_map_rx_address[index]); | |
1da177e4 LT |
465 | wmb(); |
466 | ||
467 | /* increment the driver read pointer */ | |
468 | add_le32p((u32 *) &control_block-> | |
469 | driver_curr_frag[ISL38XX_CB_RX_DATA_LQ], 1); | |
470 | } | |
471 | ||
472 | /* trigger the device */ | |
473 | islpci_trigger(priv); | |
474 | ||
475 | return 0; | |
476 | } | |
477 | ||
478 | void | |
c4028958 | 479 | islpci_do_reset_and_wake(struct work_struct *work) |
1da177e4 | 480 | { |
c4028958 | 481 | islpci_private *priv = container_of(work, islpci_private, reset_task); |
d18e0c4a | 482 | |
1da177e4 | 483 | islpci_reset(priv, 1); |
1da177e4 | 484 | priv->reset_task_pending = 0; |
d18e0c4a DT |
485 | smp_wmb(); |
486 | netif_wake_queue(priv->ndev); | |
1da177e4 LT |
487 | } |
488 | ||
489 | void | |
490 | islpci_eth_tx_timeout(struct net_device *ndev) | |
491 | { | |
492 | islpci_private *priv = netdev_priv(ndev); | |
493 | struct net_device_stats *statistics = &priv->statistics; | |
494 | ||
495 | /* increment the transmit error counter */ | |
496 | statistics->tx_errors++; | |
497 | ||
1da177e4 | 498 | if (!priv->reset_task_pending) { |
d18e0c4a DT |
499 | printk(KERN_WARNING |
500 | "%s: tx_timeout, scheduling reset", ndev->name); | |
1da177e4 | 501 | netif_stop_queue(ndev); |
d18e0c4a | 502 | priv->reset_task_pending = 1; |
1da177e4 | 503 | schedule_work(&priv->reset_task); |
d18e0c4a DT |
504 | } else { |
505 | printk(KERN_WARNING | |
506 | "%s: tx_timeout, waiting for reset", ndev->name); | |
1da177e4 | 507 | } |
1da177e4 | 508 | } |