Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
[pandora-kernel.git] / drivers / staging / et131x / et131x_netdev.c
1 /*
2  * Agere Systems Inc.
3  * 10/100/1000 Base-T Ethernet Driver for the ET1301 and ET131x series MACs
4  *
5  * Copyright © 2005 Agere Systems Inc.
6  * All rights reserved.
7  *   http://www.agere.com
8  *
9  *------------------------------------------------------------------------------
10  *
11  * et131x_netdev.c - Routines and data required by all Linux network devices.
12  *
13  *------------------------------------------------------------------------------
14  *
15  * SOFTWARE LICENSE
16  *
17  * This software is provided subject to the following terms and conditions,
18  * which you should read carefully before using the software.  Using this
19  * software indicates your acceptance of these terms and conditions.  If you do
20  * not agree with these terms and conditions, do not use the software.
21  *
22  * Copyright © 2005 Agere Systems Inc.
23  * All rights reserved.
24  *
25  * Redistribution and use in source or binary forms, with or without
26  * modifications, are permitted provided that the following conditions are met:
27  *
28  * . Redistributions of source code must retain the above copyright notice, this
29  *    list of conditions and the following Disclaimer as comments in the code as
30  *    well as in the documentation and/or other materials provided with the
31  *    distribution.
32  *
33  * . Redistributions in binary form must reproduce the above copyright notice,
34  *    this list of conditions and the following Disclaimer in the documentation
35  *    and/or other materials provided with the distribution.
36  *
37  * . Neither the name of Agere Systems Inc. nor the names of the contributors
38  *    may be used to endorse or promote products derived from this software
39  *    without specific prior written permission.
40  *
41  * Disclaimer
42  *
43  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
44  * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
45  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  ANY
46  * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
47  * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY
48  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
49  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
50  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
51  * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT
52  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
53  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
54  * DAMAGE.
55  *
56  */
57
58 #include "et131x_version.h"
59 #include "et131x_defs.h"
60
61 #include <linux/init.h>
62 #include <linux/module.h>
63 #include <linux/types.h>
64 #include <linux/kernel.h>
65
66 #include <linux/sched.h>
67 #include <linux/ptrace.h>
68 #include <linux/ctype.h>
69 #include <linux/string.h>
70 #include <linux/timer.h>
71 #include <linux/interrupt.h>
72 #include <linux/in.h>
73 #include <linux/delay.h>
74 #include <linux/io.h>
75 #include <linux/bitops.h>
76 #include <linux/pci.h>
77 #include <asm/system.h>
78
79 #include <linux/mii.h>
80 #include <linux/netdevice.h>
81 #include <linux/etherdevice.h>
82 #include <linux/skbuff.h>
83 #include <linux/if_arp.h>
84 #include <linux/ioport.h>
85
86 #include "et1310_phy.h"
87 #include "et1310_tx.h"
88 #include "et131x_adapter.h"
89 #include "et131x.h"
90
91 struct net_device_stats *et131x_stats(struct net_device *netdev);
92 int et131x_open(struct net_device *netdev);
93 int et131x_close(struct net_device *netdev);
94 int et131x_ioctl(struct net_device *netdev, struct ifreq *reqbuf, int cmd);
95 void et131x_multicast(struct net_device *netdev);
96 int et131x_tx(struct sk_buff *skb, struct net_device *netdev);
97 void et131x_tx_timeout(struct net_device *netdev);
98 int et131x_change_mtu(struct net_device *netdev, int new_mtu);
99 int et131x_set_mac_addr(struct net_device *netdev, void *new_mac);
100 void et131x_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid);
101 void et131x_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid);
102
103 static const struct net_device_ops et131x_netdev_ops = {
104         .ndo_open               = et131x_open,
105         .ndo_stop               = et131x_close,
106         .ndo_start_xmit         = et131x_tx,
107         .ndo_set_multicast_list = et131x_multicast,
108         .ndo_tx_timeout         = et131x_tx_timeout,
109         .ndo_change_mtu         = et131x_change_mtu,
110         .ndo_set_mac_address    = et131x_set_mac_addr,
111         .ndo_validate_addr      = eth_validate_addr,
112         .ndo_get_stats          = et131x_stats,
113         .ndo_do_ioctl           = et131x_ioctl,
114 };
115
116 /**
117  * et131x_device_alloc
118  *
119  * Returns pointer to the allocated and initialized net_device struct for
120  * this device.
121  *
122  * Create instances of net_device and wl_private for the new adapter and
123  * register the device's entry points in the net_device structure.
124  */
125 struct net_device *et131x_device_alloc(void)
126 {
127         struct net_device *netdev;
128
129         /* Alloc net_device and adapter structs */
130         netdev = alloc_etherdev(sizeof(struct et131x_adapter));
131
132         if (netdev == NULL) {
133                 printk(KERN_ERR "et131x: Alloc of net_device struct failed\n");
134                 return NULL;
135         }
136
137         /* Setup the function registration table (and other data) for a
138          * net_device
139          */
140         /* netdev->init               = &et131x_init; */
141         /* netdev->set_config = &et131x_config; */
142         netdev->watchdog_timeo = ET131X_TX_TIMEOUT;
143         netdev->netdev_ops = &et131x_netdev_ops;
144
145         /* netdev->ethtool_ops        = &et131x_ethtool_ops; */
146
147         /* Poll? */
148         /* netdev->poll               = &et131x_poll; */
149         /* netdev->poll_controller    = &et131x_poll_controller; */
150         return netdev;
151 }
152
153 /**
154  * et131x_stats - Return the current device statistics.
155  * @netdev: device whose stats are being queried
156  *
157  * Returns 0 on success, errno on failure (as defined in errno.h)
158  */
159 struct net_device_stats *et131x_stats(struct net_device *netdev)
160 {
161         struct et131x_adapter *adapter = netdev_priv(netdev);
162         struct net_device_stats *stats = &adapter->net_stats;
163         CE_STATS_t *devstat = &adapter->Stats;
164
165         stats->rx_packets = devstat->ipackets;
166         stats->tx_packets = devstat->opackets;
167         stats->rx_errors = devstat->length_err + devstat->alignment_err +
168             devstat->crc_err + devstat->code_violations + devstat->other_errors;
169         stats->tx_errors = devstat->max_pkt_error;
170         stats->multicast = devstat->multircv;
171         stats->collisions = devstat->collisions;
172
173         stats->rx_length_errors = devstat->length_err;
174         stats->rx_over_errors = devstat->rx_ov_flow;
175         stats->rx_crc_errors = devstat->crc_err;
176
177         /* NOTE: These stats don't have corresponding values in CE_STATS,
178          * so we're going to have to update these directly from within the
179          * TX/RX code
180          */
181         /* stats->rx_bytes            = 20; devstat->; */
182         /* stats->tx_bytes            = 20;  devstat->; */
183         /* stats->rx_dropped          = devstat->; */
184         /* stats->tx_dropped          = devstat->; */
185
186         /*  NOTE: Not used, can't find analogous statistics */
187         /* stats->rx_frame_errors     = devstat->; */
188         /* stats->rx_fifo_errors      = devstat->; */
189         /* stats->rx_missed_errors    = devstat->; */
190
191         /* stats->tx_aborted_errors   = devstat->; */
192         /* stats->tx_carrier_errors   = devstat->; */
193         /* stats->tx_fifo_errors      = devstat->; */
194         /* stats->tx_heartbeat_errors = devstat->; */
195         /* stats->tx_window_errors    = devstat->; */
196         return stats;
197 }
198
199 /**
200  * et131x_open - Open the device for use.
201  * @netdev: device to be opened
202  *
203  * Returns 0 on success, errno on failure (as defined in errno.h)
204  */
205 int et131x_open(struct net_device *netdev)
206 {
207         int result = 0;
208         struct et131x_adapter *adapter = netdev_priv(netdev);
209
210         /* Start the timer to track NIC errors */
211         add_timer(&adapter->ErrorTimer);
212
213         /* Register our IRQ */
214         result = request_irq(netdev->irq, et131x_isr, IRQF_SHARED,
215                                         netdev->name, netdev);
216         if (result) {
217                 dev_err(&adapter->pdev->dev, "c ould not register IRQ %d\n",
218                         netdev->irq);
219                 return result;
220         }
221
222         /* Enable the Tx and Rx DMA engines (if not already enabled) */
223         et131x_rx_dma_enable(adapter);
224         et131x_tx_dma_enable(adapter);
225
226         /* Enable device interrupts */
227         et131x_enable_interrupts(adapter);
228
229         adapter->Flags |= fMP_ADAPTER_INTERRUPT_IN_USE;
230
231         /* We're ready to move some data, so start the queue */
232         netif_start_queue(netdev);
233         return result;
234 }
235
236 /**
237  * et131x_close - Close the device
238  * @netdev: device to be closed
239  *
240  * Returns 0 on success, errno on failure (as defined in errno.h)
241  */
242 int et131x_close(struct net_device *netdev)
243 {
244         struct et131x_adapter *adapter = netdev_priv(netdev);
245
246         /* First thing is to stop the queue */
247         netif_stop_queue(netdev);
248
249         /* Stop the Tx and Rx DMA engines */
250         et131x_rx_dma_disable(adapter);
251         et131x_tx_dma_disable(adapter);
252
253         /* Disable device interrupts */
254         et131x_disable_interrupts(adapter);
255
256         /* Deregistering ISR */
257         adapter->Flags &= ~fMP_ADAPTER_INTERRUPT_IN_USE;
258         free_irq(netdev->irq, netdev);
259
260         /* Stop the error timer */
261         del_timer_sync(&adapter->ErrorTimer);
262         return 0;
263 }
264
265 /**
266  * et131x_ioctl_mii - The function which handles MII IOCTLs
267  * @netdev: device on which the query is being made
268  * @reqbuf: the request-specific data buffer
269  * @cmd: the command request code
270  *
271  * Returns 0 on success, errno on failure (as defined in errno.h)
272  */
273 int et131x_ioctl_mii(struct net_device *netdev, struct ifreq *reqbuf, int cmd)
274 {
275         int status = 0;
276         struct et131x_adapter *etdev = netdev_priv(netdev);
277         struct mii_ioctl_data *data = if_mii(reqbuf);
278
279         switch (cmd) {
280         case SIOCGMIIPHY:
281                 data->phy_id = etdev->Stats.xcvr_addr;
282                 break;
283
284         case SIOCGMIIREG:
285                 if (!capable(CAP_NET_ADMIN))
286                         status = -EPERM;
287                 else
288                         status = MiRead(etdev,
289                                         data->reg_num, &data->val_out);
290                 break;
291
292         case SIOCSMIIREG:
293                 if (!capable(CAP_NET_ADMIN))
294                         status = -EPERM;
295                 else
296                         status = MiWrite(etdev, data->reg_num,
297                                          data->val_in);
298                 break;
299
300         default:
301                 status = -EOPNOTSUPP;
302         }
303         return status;
304 }
305
306 /**
307  * et131x_ioctl - The I/O Control handler for the driver
308  * @netdev: device on which the control request is being made
309  * @reqbuf: a pointer to the IOCTL request buffer
310  * @cmd: the IOCTL command code
311  *
312  * Returns 0 on success, errno on failure (as defined in errno.h)
313  */
314 int et131x_ioctl(struct net_device *netdev, struct ifreq *reqbuf, int cmd)
315 {
316         int status = 0;
317
318         switch (cmd) {
319         case SIOCGMIIPHY:
320         case SIOCGMIIREG:
321         case SIOCSMIIREG:
322                 status = et131x_ioctl_mii(netdev, reqbuf, cmd);
323                 break;
324
325         default:
326                 status = -EOPNOTSUPP;
327         }
328         return status;
329 }
330
331 /**
332  * et131x_set_packet_filter - Configures the Rx Packet filtering on the device
333  * @adapter: pointer to our private adapter structure
334  *
335  * FIXME: lot of dups with MAC code
336  *
337  * Returns 0 on success, errno on failure
338  */
339 int et131x_set_packet_filter(struct et131x_adapter *adapter)
340 {
341         int status = 0;
342         uint32_t filter = adapter->PacketFilter;
343         u32 ctrl;
344         u32 pf_ctrl;
345
346         ctrl = readl(&adapter->regs->rxmac.ctrl);
347         pf_ctrl = readl(&adapter->regs->rxmac.pf_ctrl);
348
349         /* Default to disabled packet filtering.  Enable it in the individual
350          * case statements that require the device to filter something
351          */
352         ctrl |= 0x04;
353
354         /* Set us to be in promiscuous mode so we receive everything, this
355          * is also true when we get a packet filter of 0
356          */
357         if ((filter & ET131X_PACKET_TYPE_PROMISCUOUS) || filter == 0)
358                 pf_ctrl &= ~7;  /* Clear filter bits */
359         else {
360                 /*
361                  * Set us up with Multicast packet filtering.  Three cases are
362                  * possible - (1) we have a multi-cast list, (2) we receive ALL
363                  * multicast entries or (3) we receive none.
364                  */
365                 if (filter & ET131X_PACKET_TYPE_ALL_MULTICAST)
366                         pf_ctrl &= ~2;  /* Multicast filter bit */
367                 else {
368                         SetupDeviceForMulticast(adapter);
369                         pf_ctrl |= 2;
370                         ctrl &= ~0x04;
371                 }
372
373                 /* Set us up with Unicast packet filtering */
374                 if (filter & ET131X_PACKET_TYPE_DIRECTED) {
375                         SetupDeviceForUnicast(adapter);
376                         pf_ctrl |= 4;
377                         ctrl &= ~0x04;
378                 }
379
380                 /* Set us up with Broadcast packet filtering */
381                 if (filter & ET131X_PACKET_TYPE_BROADCAST) {
382                         pf_ctrl |= 1;   /* Broadcast filter bit */
383                         ctrl &= ~0x04;
384                 } else
385                         pf_ctrl &= ~1;
386
387                 /* Setup the receive mac configuration registers - Packet
388                  * Filter control + the enable / disable for packet filter
389                  * in the control reg.
390                  */
391                 writel(pf_ctrl, &adapter->regs->rxmac.pf_ctrl);
392                 writel(ctrl, &adapter->regs->rxmac.ctrl);
393         }
394         return status;
395 }
396
397 /**
398  * et131x_multicast - The handler to configure multicasting on the interface
399  * @netdev: a pointer to a net_device struct representing the device
400  */
401 void et131x_multicast(struct net_device *netdev)
402 {
403         struct et131x_adapter *adapter = netdev_priv(netdev);
404         uint32_t PacketFilter = 0;
405         unsigned long flags;
406         struct netdev_hw_addr *ha;
407         int i;
408
409         spin_lock_irqsave(&adapter->Lock, flags);
410
411         /* Before we modify the platform-independent filter flags, store them
412          * locally. This allows us to determine if anything's changed and if
413          * we even need to bother the hardware
414          */
415         PacketFilter = adapter->PacketFilter;
416
417         /* Clear the 'multicast' flag locally; because we only have a single
418          * flag to check multicast, and multiple multicast addresses can be
419          * set, this is the easiest way to determine if more than one
420          * multicast address is being set.
421          */
422         PacketFilter &= ~ET131X_PACKET_TYPE_MULTICAST;
423
424         /* Check the net_device flags and set the device independent flags
425          * accordingly
426          */
427
428         if (netdev->flags & IFF_PROMISC)
429                 adapter->PacketFilter |= ET131X_PACKET_TYPE_PROMISCUOUS;
430         else
431                 adapter->PacketFilter &= ~ET131X_PACKET_TYPE_PROMISCUOUS;
432
433         if (netdev->flags & IFF_ALLMULTI)
434                 adapter->PacketFilter |= ET131X_PACKET_TYPE_ALL_MULTICAST;
435
436         if (netdev_mc_count(netdev) > NIC_MAX_MCAST_LIST)
437                 adapter->PacketFilter |= ET131X_PACKET_TYPE_ALL_MULTICAST;
438
439         if (netdev_mc_count(netdev) < 1) {
440                 adapter->PacketFilter &= ~ET131X_PACKET_TYPE_ALL_MULTICAST;
441                 adapter->PacketFilter &= ~ET131X_PACKET_TYPE_MULTICAST;
442         } else
443                 adapter->PacketFilter |= ET131X_PACKET_TYPE_MULTICAST;
444
445         /* Set values in the private adapter struct */
446         i = 0;
447         netdev_for_each_mc_addr(ha, netdev) {
448                 if (i == NIC_MAX_MCAST_LIST)
449                         break;
450                 memcpy(adapter->MCList[i++], ha->addr, ETH_ALEN);
451         }
452         adapter->MCAddressCount = i;
453
454         /* Are the new flags different from the previous ones? If not, then no
455          * action is required
456          *
457          * NOTE - This block will always update the MCList with the hardware,
458          *        even if the addresses aren't the same.
459          */
460         if (PacketFilter != adapter->PacketFilter) {
461                 /* Call the device's filter function */
462                 et131x_set_packet_filter(adapter);
463         }
464         spin_unlock_irqrestore(&adapter->Lock, flags);
465 }
466
467 /**
468  * et131x_tx - The handler to tx a packet on the device
469  * @skb: data to be Tx'd
470  * @netdev: device on which data is to be Tx'd
471  *
472  * Returns 0 on success, errno on failure (as defined in errno.h)
473  */
474 int et131x_tx(struct sk_buff *skb, struct net_device *netdev)
475 {
476         int status = 0;
477
478         /* Save the timestamp for the TX timeout watchdog */
479         netdev->trans_start = jiffies;
480
481         /* Call the device-specific data Tx routine */
482         status = et131x_send_packets(skb, netdev);
483
484         /* Check status and manage the netif queue if necessary */
485         if (status != 0) {
486                 if (status == -ENOMEM) {
487                         /* Put the queue to sleep until resources are
488                          * available
489                          */
490                         netif_stop_queue(netdev);
491                         status = NETDEV_TX_BUSY;
492                 } else {
493                         status = NETDEV_TX_OK;
494                 }
495         }
496         return status;
497 }
498
499 /**
500  * et131x_tx_timeout - Timeout handler
501  * @netdev: a pointer to a net_device struct representing the device
502  *
503  * The handler called when a Tx request times out. The timeout period is
504  * specified by the 'tx_timeo" element in the net_device structure (see
505  * et131x_alloc_device() to see how this value is set).
506  */
507 void et131x_tx_timeout(struct net_device *netdev)
508 {
509         struct et131x_adapter *etdev = netdev_priv(netdev);
510         struct tcb *tcb;
511         unsigned long flags;
512
513         /* Just skip this part if the adapter is doing link detection */
514         if (etdev->Flags & fMP_ADAPTER_LINK_DETECTION)
515                 return;
516
517         /* Any nonrecoverable hardware error?
518          * Checks adapter->flags for any failure in phy reading
519          */
520         if (etdev->Flags & fMP_ADAPTER_NON_RECOVER_ERROR)
521                 return;
522
523         /* Hardware failure? */
524         if (etdev->Flags & fMP_ADAPTER_HARDWARE_ERROR) {
525                 dev_err(&etdev->pdev->dev, "hardware error - reset\n");
526                 return;
527         }
528
529         /* Is send stuck? */
530         spin_lock_irqsave(&etdev->TCBSendQLock, flags);
531
532         tcb = etdev->tx_ring.send_head;
533
534         if (tcb != NULL) {
535                 tcb->count++;
536
537                 if (tcb->count > NIC_SEND_HANG_THRESHOLD) {
538                         spin_unlock_irqrestore(&etdev->TCBSendQLock,
539                                                flags);
540
541                         dev_warn(&etdev->pdev->dev,
542                                 "Send stuck - reset.  tcb->WrIndex %x, Flags 0x%08x\n",
543                                 tcb->index,
544                                 tcb->flags);
545
546                         et131x_close(netdev);
547                         et131x_open(netdev);
548
549                         return;
550                 }
551         }
552
553         spin_unlock_irqrestore(&etdev->TCBSendQLock, flags);
554 }
555
556 /**
557  * et131x_change_mtu - The handler called to change the MTU for the device
558  * @netdev: device whose MTU is to be changed
559  * @new_mtu: the desired MTU
560  *
561  * Returns 0 on success, errno on failure (as defined in errno.h)
562  */
563 int et131x_change_mtu(struct net_device *netdev, int new_mtu)
564 {
565         int result = 0;
566         struct et131x_adapter *adapter = netdev_priv(netdev);
567
568         /* Make sure the requested MTU is valid */
569         if (new_mtu < 64 || new_mtu > 9216)
570                 return -EINVAL;
571
572         /* Stop the netif queue */
573         netif_stop_queue(netdev);
574
575         /* Stop the Tx and Rx DMA engines */
576         et131x_rx_dma_disable(adapter);
577         et131x_tx_dma_disable(adapter);
578
579         /* Disable device interrupts */
580         et131x_disable_interrupts(adapter);
581         et131x_handle_send_interrupt(adapter);
582         et131x_handle_recv_interrupt(adapter);
583
584         /* Set the new MTU */
585         netdev->mtu = new_mtu;
586
587         /* Free Rx DMA memory */
588         et131x_adapter_memory_free(adapter);
589
590         /* Set the config parameter for Jumbo Packet support */
591         adapter->RegistryJumboPacket = new_mtu + 14;
592         et131x_soft_reset(adapter);
593
594         /* Alloc and init Rx DMA memory */
595         result = et131x_adapter_memory_alloc(adapter);
596         if (result != 0) {
597                 dev_warn(&adapter->pdev->dev,
598                         "Change MTU failed; couldn't re-alloc DMA memory\n");
599                 return result;
600         }
601
602         et131x_init_send(adapter);
603
604         et131x_hwaddr_init(adapter);
605         memcpy(netdev->dev_addr, adapter->addr, ETH_ALEN);
606
607         /* Init the device with the new settings */
608         et131x_adapter_setup(adapter);
609
610         /* Enable interrupts */
611         if (adapter->Flags & fMP_ADAPTER_INTERRUPT_IN_USE)
612                 et131x_enable_interrupts(adapter);
613
614         /* Restart the Tx and Rx DMA engines */
615         et131x_rx_dma_enable(adapter);
616         et131x_tx_dma_enable(adapter);
617
618         /* Restart the netif queue */
619         netif_wake_queue(netdev);
620         return result;
621 }
622
623 /**
624  * et131x_set_mac_addr - handler to change the MAC address for the device
625  * @netdev: device whose MAC is to be changed
626  * @new_mac: the desired MAC address
627  *
628  * Returns 0 on success, errno on failure (as defined in errno.h)
629  *
630  * IMPLEMENTED BY : blux http://berndlux.de 22.01.2007 21:14
631  */
632 int et131x_set_mac_addr(struct net_device *netdev, void *new_mac)
633 {
634         int result = 0;
635         struct et131x_adapter *adapter = netdev_priv(netdev);
636         struct sockaddr *address = new_mac;
637
638         /* begin blux */
639
640         if (adapter == NULL)
641                 return -ENODEV;
642
643         /* Make sure the requested MAC is valid */
644         if (!is_valid_ether_addr(address->sa_data))
645                 return -EINVAL;
646
647         /* Stop the netif queue */
648         netif_stop_queue(netdev);
649
650         /* Stop the Tx and Rx DMA engines */
651         et131x_rx_dma_disable(adapter);
652         et131x_tx_dma_disable(adapter);
653
654         /* Disable device interrupts */
655         et131x_disable_interrupts(adapter);
656         et131x_handle_send_interrupt(adapter);
657         et131x_handle_recv_interrupt(adapter);
658
659         /* Set the new MAC */
660         /* netdev->set_mac_address  = &new_mac; */
661         /* netdev->mtu = new_mtu; */
662
663         memcpy(netdev->dev_addr, address->sa_data, netdev->addr_len);
664
665         printk(KERN_INFO "%s: Setting MAC address to %pM\n",
666                         netdev->name, netdev->dev_addr);
667
668         /* Free Rx DMA memory */
669         et131x_adapter_memory_free(adapter);
670
671         /* Set the config parameter for Jumbo Packet support */
672         /* adapter->RegistryJumboPacket = new_mtu + 14; */
673         /* blux: not needet here, we'll change the MAC */
674
675         et131x_soft_reset(adapter);
676
677         /* Alloc and init Rx DMA memory */
678         result = et131x_adapter_memory_alloc(adapter);
679         if (result != 0) {
680                 dev_err(&adapter->pdev->dev,
681                         "Change MAC failed; couldn't re-alloc DMA memory\n");
682                 return result;
683         }
684
685         et131x_init_send(adapter);
686
687         et131x_hwaddr_init(adapter);
688
689         /* Init the device with the new settings */
690         et131x_adapter_setup(adapter);
691
692         /* Enable interrupts */
693         if (adapter->Flags & fMP_ADAPTER_INTERRUPT_IN_USE)
694                 et131x_enable_interrupts(adapter);
695
696         /* Restart the Tx and Rx DMA engines */
697         et131x_rx_dma_enable(adapter);
698         et131x_tx_dma_enable(adapter);
699
700         /* Restart the netif queue */
701         netif_wake_queue(netdev);
702         return result;
703 }