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