• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/staging/et131x/
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
91struct net_device_stats *et131x_stats(struct net_device *netdev);
92int et131x_open(struct net_device *netdev);
93int et131x_close(struct net_device *netdev);
94int et131x_ioctl(struct net_device *netdev, struct ifreq *reqbuf, int cmd);
95void et131x_multicast(struct net_device *netdev);
96int et131x_tx(struct sk_buff *skb, struct net_device *netdev);
97void et131x_tx_timeout(struct net_device *netdev);
98int et131x_change_mtu(struct net_device *netdev, int new_mtu);
99int et131x_set_mac_addr(struct net_device *netdev, void *new_mac);
100void et131x_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp);
101void et131x_vlan_rx_add_vid(struct net_device *netdev, uint16_t vid);
102void et131x_vlan_rx_kill_vid(struct net_device *netdev, uint16_t vid);
103
104static const struct net_device_ops et131x_netdev_ops = {
105	.ndo_open		= et131x_open,
106	.ndo_stop		= et131x_close,
107	.ndo_start_xmit		= et131x_tx,
108	.ndo_set_multicast_list	= et131x_multicast,
109	.ndo_tx_timeout		= et131x_tx_timeout,
110	.ndo_change_mtu		= et131x_change_mtu,
111	.ndo_set_mac_address	= et131x_set_mac_addr,
112	.ndo_validate_addr	= eth_validate_addr,
113	.ndo_get_stats		= et131x_stats,
114	.ndo_do_ioctl		= et131x_ioctl,
115};
116
117/**
118 * et131x_device_alloc
119 *
120 * Returns pointer to the allocated and initialized net_device struct for
121 * this device.
122 *
123 * Create instances of net_device and wl_private for the new adapter and
124 * register the device's entry points in the net_device structure.
125 */
126struct net_device *et131x_device_alloc(void)
127{
128	struct net_device *netdev;
129
130	/* Alloc net_device and adapter structs */
131	netdev = alloc_etherdev(sizeof(struct et131x_adapter));
132
133	if (netdev == NULL) {
134		printk(KERN_ERR "et131x: Alloc of net_device struct failed\n");
135		return NULL;
136	}
137
138	/* Setup the function registration table (and other data) for a
139	 * net_device
140	 */
141	/* netdev->init               = &et131x_init; */
142	/* netdev->set_config = &et131x_config; */
143	netdev->watchdog_timeo = ET131X_TX_TIMEOUT;
144	netdev->netdev_ops = &et131x_netdev_ops;
145
146	/* netdev->ethtool_ops        = &et131x_ethtool_ops; */
147
148	/* Poll? */
149	/* netdev->poll               = &et131x_poll; */
150	/* netdev->poll_controller    = &et131x_poll_controller; */
151	return netdev;
152}
153
154/**
155 * et131x_stats - Return the current device statistics.
156 * @netdev: device whose stats are being queried
157 *
158 * Returns 0 on success, errno on failure (as defined in errno.h)
159 */
160struct net_device_stats *et131x_stats(struct net_device *netdev)
161{
162	struct et131x_adapter *adapter = netdev_priv(netdev);
163	struct net_device_stats *stats = &adapter->net_stats;
164	CE_STATS_t *devstat = &adapter->Stats;
165
166	stats->rx_packets = devstat->ipackets;
167	stats->tx_packets = devstat->opackets;
168	stats->rx_errors = devstat->length_err + devstat->alignment_err +
169	    devstat->crc_err + devstat->code_violations + devstat->other_errors;
170	stats->tx_errors = devstat->max_pkt_error;
171	stats->multicast = devstat->multircv;
172	stats->collisions = devstat->collisions;
173
174	stats->rx_length_errors = devstat->length_err;
175	stats->rx_over_errors = devstat->rx_ov_flow;
176	stats->rx_crc_errors = devstat->crc_err;
177
178	/* NOTE: These stats don't have corresponding values in CE_STATS,
179	 * so we're going to have to update these directly from within the
180	 * TX/RX code
181	 */
182	/* stats->rx_bytes            = 20; devstat->; */
183	/* stats->tx_bytes            = 20;  devstat->; */
184	/* stats->rx_dropped          = devstat->; */
185	/* stats->tx_dropped          = devstat->; */
186
187	/*  NOTE: Not used, can't find analogous statistics */
188	/* stats->rx_frame_errors     = devstat->; */
189	/* stats->rx_fifo_errors      = devstat->; */
190	/* stats->rx_missed_errors    = devstat->; */
191
192	/* stats->tx_aborted_errors   = devstat->; */
193	/* stats->tx_carrier_errors   = devstat->; */
194	/* stats->tx_fifo_errors      = devstat->; */
195	/* stats->tx_heartbeat_errors = devstat->; */
196	/* stats->tx_window_errors    = devstat->; */
197	return stats;
198}
199
200/**
201 * et131x_open - Open the device for use.
202 * @netdev: device to be opened
203 *
204 * Returns 0 on success, errno on failure (as defined in errno.h)
205 */
206int et131x_open(struct net_device *netdev)
207{
208	int result = 0;
209	struct et131x_adapter *adapter = netdev_priv(netdev);
210
211	/* Start the timer to track NIC errors */
212	add_timer(&adapter->ErrorTimer);
213
214	/* Register our IRQ */
215	result = request_irq(netdev->irq, et131x_isr, IRQF_SHARED,
216					netdev->name, netdev);
217	if (result) {
218		dev_err(&adapter->pdev->dev, "c ould not register IRQ %d\n",
219			netdev->irq);
220		return result;
221	}
222
223	/* Enable the Tx and Rx DMA engines (if not already enabled) */
224	et131x_rx_dma_enable(adapter);
225	et131x_tx_dma_enable(adapter);
226
227	/* Enable device interrupts */
228	et131x_enable_interrupts(adapter);
229
230	adapter->Flags |= fMP_ADAPTER_INTERRUPT_IN_USE;
231
232	/* We're ready to move some data, so start the queue */
233	netif_start_queue(netdev);
234	return result;
235}
236
237/**
238 * et131x_close - Close the device
239 * @netdev: device to be closed
240 *
241 * Returns 0 on success, errno on failure (as defined in errno.h)
242 */
243int et131x_close(struct net_device *netdev)
244{
245	struct et131x_adapter *adapter = netdev_priv(netdev);
246
247	/* First thing is to stop the queue */
248	netif_stop_queue(netdev);
249
250	/* Stop the Tx and Rx DMA engines */
251	et131x_rx_dma_disable(adapter);
252	et131x_tx_dma_disable(adapter);
253
254	/* Disable device interrupts */
255	et131x_disable_interrupts(adapter);
256
257	/* Deregistering ISR */
258	adapter->Flags &= ~fMP_ADAPTER_INTERRUPT_IN_USE;
259	free_irq(netdev->irq, netdev);
260
261	/* Stop the error timer */
262	del_timer_sync(&adapter->ErrorTimer);
263	return 0;
264}
265
266/**
267 * et131x_ioctl_mii - The function which handles MII IOCTLs
268 * @netdev: device on which the query is being made
269 * @reqbuf: the request-specific data buffer
270 * @cmd: the command request code
271 *
272 * Returns 0 on success, errno on failure (as defined in errno.h)
273 */
274int et131x_ioctl_mii(struct net_device *netdev, struct ifreq *reqbuf, int cmd)
275{
276	int status = 0;
277	struct et131x_adapter *etdev = netdev_priv(netdev);
278	struct mii_ioctl_data *data = if_mii(reqbuf);
279
280	switch (cmd) {
281	case SIOCGMIIPHY:
282		data->phy_id = etdev->Stats.xcvr_addr;
283		break;
284
285	case SIOCGMIIREG:
286		if (!capable(CAP_NET_ADMIN))
287			status = -EPERM;
288		else
289			status = MiRead(etdev,
290					data->reg_num, &data->val_out);
291		break;
292
293	case SIOCSMIIREG:
294		if (!capable(CAP_NET_ADMIN))
295			status = -EPERM;
296		else
297			status = MiWrite(etdev, data->reg_num,
298					 data->val_in);
299		break;
300
301	default:
302		status = -EOPNOTSUPP;
303	}
304	return status;
305}
306
307/**
308 * et131x_ioctl - The I/O Control handler for the driver
309 * @netdev: device on which the control request is being made
310 * @reqbuf: a pointer to the IOCTL request buffer
311 * @cmd: the IOCTL command code
312 *
313 * Returns 0 on success, errno on failure (as defined in errno.h)
314 */
315int et131x_ioctl(struct net_device *netdev, struct ifreq *reqbuf, int cmd)
316{
317	int status = 0;
318
319	switch (cmd) {
320	case SIOCGMIIPHY:
321	case SIOCGMIIREG:
322	case SIOCSMIIREG:
323		status = et131x_ioctl_mii(netdev, reqbuf, cmd);
324		break;
325
326	default:
327		status = -EOPNOTSUPP;
328	}
329	return status;
330}
331
332int et131x_set_packet_filter(struct et131x_adapter *adapter)
333{
334	int status = 0;
335	uint32_t filter = adapter->PacketFilter;
336	u32 ctrl;
337	u32 pf_ctrl;
338
339	ctrl = readl(&adapter->regs->rxmac.ctrl);
340	pf_ctrl = readl(&adapter->regs->rxmac.pf_ctrl);
341
342	/* Default to disabled packet filtering.  Enable it in the individual
343	 * case statements that require the device to filter something
344	 */
345	ctrl |= 0x04;
346
347	/* Set us to be in promiscuous mode so we receive everything, this
348	 * is also true when we get a packet filter of 0
349	 */
350	if ((filter & ET131X_PACKET_TYPE_PROMISCUOUS) || filter == 0)
351		pf_ctrl &= ~7;	/* Clear filter bits */
352	else {
353		/*
354		 * Set us up with Multicast packet filtering.  Three cases are
355		 * possible - (1) we have a multi-cast list, (2) we receive ALL
356		 * multicast entries or (3) we receive none.
357		 */
358		if (filter & ET131X_PACKET_TYPE_ALL_MULTICAST)
359			pf_ctrl &= ~2;	/* Multicast filter bit */
360		else {
361			SetupDeviceForMulticast(adapter);
362			pf_ctrl |= 2;
363			ctrl &= ~0x04;
364		}
365
366		/* Set us up with Unicast packet filtering */
367		if (filter & ET131X_PACKET_TYPE_DIRECTED) {
368			SetupDeviceForUnicast(adapter);
369			pf_ctrl |= 4;
370			ctrl &= ~0x04;
371		}
372
373		/* Set us up with Broadcast packet filtering */
374		if (filter & ET131X_PACKET_TYPE_BROADCAST) {
375			pf_ctrl |= 1;	/* Broadcast filter bit */
376			ctrl &= ~0x04;
377		} else
378			pf_ctrl &= ~1;
379
380		/* Setup the receive mac configuration registers - Packet
381		 * Filter control + the enable / disable for packet filter
382		 * in the control reg.
383		 */
384		writel(pf_ctrl, &adapter->regs->rxmac.pf_ctrl);
385		writel(ctrl, &adapter->regs->rxmac.ctrl);
386	}
387	return status;
388}
389
390/**
391 * et131x_multicast - The handler to configure multicasting on the interface
392 * @netdev: a pointer to a net_device struct representing the device
393 */
394void et131x_multicast(struct net_device *netdev)
395{
396	struct et131x_adapter *adapter = netdev_priv(netdev);
397	uint32_t PacketFilter = 0;
398	unsigned long flags;
399	struct netdev_hw_addr *ha;
400	int i;
401
402	spin_lock_irqsave(&adapter->Lock, flags);
403
404	/* Before we modify the platform-independent filter flags, store them
405	 * locally. This allows us to determine if anything's changed and if
406	 * we even need to bother the hardware
407	 */
408	PacketFilter = adapter->PacketFilter;
409
410	/* Clear the 'multicast' flag locally; becuase we only have a single
411	 * flag to check multicast, and multiple multicast addresses can be
412	 * set, this is the easiest way to determine if more than one
413	 * multicast address is being set.
414	 */
415	PacketFilter &= ~ET131X_PACKET_TYPE_MULTICAST;
416
417	/* Check the net_device flags and set the device independent flags
418	 * accordingly
419	 */
420
421	if (netdev->flags & IFF_PROMISC)
422		adapter->PacketFilter |= ET131X_PACKET_TYPE_PROMISCUOUS;
423	else
424		adapter->PacketFilter &= ~ET131X_PACKET_TYPE_PROMISCUOUS;
425
426	if (netdev->flags & IFF_ALLMULTI)
427		adapter->PacketFilter |= ET131X_PACKET_TYPE_ALL_MULTICAST;
428
429	if (netdev_mc_count(netdev) > NIC_MAX_MCAST_LIST)
430		adapter->PacketFilter |= ET131X_PACKET_TYPE_ALL_MULTICAST;
431
432	if (netdev_mc_count(netdev) < 1) {
433		adapter->PacketFilter &= ~ET131X_PACKET_TYPE_ALL_MULTICAST;
434		adapter->PacketFilter &= ~ET131X_PACKET_TYPE_MULTICAST;
435	} else
436		adapter->PacketFilter |= ET131X_PACKET_TYPE_MULTICAST;
437
438	/* Set values in the private adapter struct */
439	i = 0;
440	netdev_for_each_mc_addr(ha, netdev) {
441		if (i == NIC_MAX_MCAST_LIST)
442			break;
443		memcpy(adapter->MCList[i++], ha->addr, ETH_ALEN);
444	}
445	adapter->MCAddressCount = i;
446
447	/* Are the new flags different from the previous ones? If not, then no
448	 * action is required
449	 *
450	 * NOTE - This block will always update the MCList with the hardware,
451	 *        even if the addresses aren't the same.
452	 */
453	if (PacketFilter != adapter->PacketFilter) {
454		/* Call the device's filter function */
455		et131x_set_packet_filter(adapter);
456	}
457	spin_unlock_irqrestore(&adapter->Lock, flags);
458}
459
460/**
461 * et131x_tx - The handler to tx a packet on the device
462 * @skb: data to be Tx'd
463 * @netdev: device on which data is to be Tx'd
464 *
465 * Returns 0 on success, errno on failure (as defined in errno.h)
466 */
467int et131x_tx(struct sk_buff *skb, struct net_device *netdev)
468{
469	int status = 0;
470
471	/* Save the timestamp for the TX timeout watchdog */
472	netdev->trans_start = jiffies;
473
474	/* Call the device-specific data Tx routine */
475	status = et131x_send_packets(skb, netdev);
476
477	/* Check status and manage the netif queue if necessary */
478	if (status != 0) {
479		if (status == -ENOMEM) {
480			/* Put the queue to sleep until resources are
481			 * available
482			 */
483			netif_stop_queue(netdev);
484			status = NETDEV_TX_BUSY;
485		} else {
486			status = NETDEV_TX_OK;
487		}
488	}
489	return status;
490}
491
492/**
493 * et131x_tx_timeout - Timeout handler
494 * @netdev: a pointer to a net_device struct representing the device
495 *
496 * The handler called when a Tx request times out. The timeout period is
497 * specified by the 'tx_timeo" element in the net_device structure (see
498 * et131x_alloc_device() to see how this value is set).
499 */
500void et131x_tx_timeout(struct net_device *netdev)
501{
502	struct et131x_adapter *etdev = netdev_priv(netdev);
503	struct tcb *tcb;
504	unsigned long flags;
505
506	/* Just skip this part if the adapter is doing link detection */
507	if (etdev->Flags & fMP_ADAPTER_LINK_DETECTION)
508		return;
509
510	/* Any nonrecoverable hardware error?
511	 * Checks adapter->flags for any failure in phy reading
512	 */
513	if (etdev->Flags & fMP_ADAPTER_NON_RECOVER_ERROR)
514		return;
515
516	/* Hardware failure? */
517	if (etdev->Flags & fMP_ADAPTER_HARDWARE_ERROR) {
518		dev_err(&etdev->pdev->dev, "hardware error - reset\n");
519		return;
520	}
521
522	/* Is send stuck? */
523	spin_lock_irqsave(&etdev->TCBSendQLock, flags);
524
525	tcb = etdev->tx_ring.send_head;
526
527	if (tcb != NULL) {
528		tcb->count++;
529
530		if (tcb->count > NIC_SEND_HANG_THRESHOLD) {
531			spin_unlock_irqrestore(&etdev->TCBSendQLock,
532					       flags);
533
534			dev_warn(&etdev->pdev->dev,
535				"Send stuck - reset.  tcb->WrIndex %x, Flags 0x%08x\n",
536				tcb->index,
537				tcb->flags);
538
539			et131x_close(netdev);
540			et131x_open(netdev);
541
542			return;
543		}
544	}
545
546	spin_unlock_irqrestore(&etdev->TCBSendQLock, flags);
547}
548
549/**
550 * et131x_change_mtu - The handler called to change the MTU for the device
551 * @netdev: device whose MTU is to be changed
552 * @new_mtu: the desired MTU
553 *
554 * Returns 0 on success, errno on failure (as defined in errno.h)
555 */
556int et131x_change_mtu(struct net_device *netdev, int new_mtu)
557{
558	int result = 0;
559	struct et131x_adapter *adapter = netdev_priv(netdev);
560
561	/* Make sure the requested MTU is valid */
562	if (new_mtu < 64 || new_mtu > 9216)
563		return -EINVAL;
564
565	/* Stop the netif queue */
566	netif_stop_queue(netdev);
567
568	/* Stop the Tx and Rx DMA engines */
569	et131x_rx_dma_disable(adapter);
570	et131x_tx_dma_disable(adapter);
571
572	/* Disable device interrupts */
573	et131x_disable_interrupts(adapter);
574	et131x_handle_send_interrupt(adapter);
575	et131x_handle_recv_interrupt(adapter);
576
577	/* Set the new MTU */
578	netdev->mtu = new_mtu;
579
580	/* Free Rx DMA memory */
581	et131x_adapter_memory_free(adapter);
582
583	/* Set the config parameter for Jumbo Packet support */
584	adapter->RegistryJumboPacket = new_mtu + 14;
585	et131x_soft_reset(adapter);
586
587	/* Alloc and init Rx DMA memory */
588	result = et131x_adapter_memory_alloc(adapter);
589	if (result != 0) {
590		dev_warn(&adapter->pdev->dev,
591			"Change MTU failed; couldn't re-alloc DMA memory\n");
592		return result;
593	}
594
595	et131x_init_send(adapter);
596
597	et131x_hwaddr_init(adapter);
598	memcpy(netdev->dev_addr, adapter->CurrentAddress, ETH_ALEN);
599
600	/* Init the device with the new settings */
601	et131x_adapter_setup(adapter);
602
603	/* Enable interrupts */
604	if (adapter->Flags & fMP_ADAPTER_INTERRUPT_IN_USE)
605		et131x_enable_interrupts(adapter);
606
607	/* Restart the Tx and Rx DMA engines */
608	et131x_rx_dma_enable(adapter);
609	et131x_tx_dma_enable(adapter);
610
611	/* Restart the netif queue */
612	netif_wake_queue(netdev);
613	return result;
614}
615
616/**
617 * et131x_set_mac_addr - handler to change the MAC address for the device
618 * @netdev: device whose MAC is to be changed
619 * @new_mac: the desired MAC address
620 *
621 * Returns 0 on success, errno on failure (as defined in errno.h)
622 *
623 * IMPLEMENTED BY : blux http://berndlux.de 22.01.2007 21:14
624 */
625int et131x_set_mac_addr(struct net_device *netdev, void *new_mac)
626{
627	int result = 0;
628	struct et131x_adapter *adapter = netdev_priv(netdev);
629	struct sockaddr *address = new_mac;
630
631	/* begin blux */
632
633	if (adapter == NULL)
634		return -ENODEV;
635
636	/* Make sure the requested MAC is valid */
637	if (!is_valid_ether_addr(address->sa_data))
638		return -EINVAL;
639
640	/* Stop the netif queue */
641	netif_stop_queue(netdev);
642
643	/* Stop the Tx and Rx DMA engines */
644	et131x_rx_dma_disable(adapter);
645	et131x_tx_dma_disable(adapter);
646
647	/* Disable device interrupts */
648	et131x_disable_interrupts(adapter);
649	et131x_handle_send_interrupt(adapter);
650	et131x_handle_recv_interrupt(adapter);
651
652	/* Set the new MAC */
653	/* netdev->set_mac_address  = &new_mac; */
654	/* netdev->mtu = new_mtu; */
655
656	memcpy(netdev->dev_addr, address->sa_data, netdev->addr_len);
657
658	printk(KERN_INFO "%s: Setting MAC address to %pM\n",
659			netdev->name, netdev->dev_addr);
660
661	/* Free Rx DMA memory */
662	et131x_adapter_memory_free(adapter);
663
664	/* Set the config parameter for Jumbo Packet support */
665	/* adapter->RegistryJumboPacket = new_mtu + 14; */
666	/* blux: not needet here, we'll change the MAC */
667
668	et131x_soft_reset(adapter);
669
670	/* Alloc and init Rx DMA memory */
671	result = et131x_adapter_memory_alloc(adapter);
672	if (result != 0) {
673		dev_err(&adapter->pdev->dev,
674			"Change MAC failed; couldn't re-alloc DMA memory\n");
675		return result;
676	}
677
678	et131x_init_send(adapter);
679
680	et131x_hwaddr_init(adapter);
681
682	/* Init the device with the new settings */
683	et131x_adapter_setup(adapter);
684
685	/* Enable interrupts */
686	if (adapter->Flags & fMP_ADAPTER_INTERRUPT_IN_USE)
687		et131x_enable_interrupts(adapter);
688
689	/* Restart the Tx and Rx DMA engines */
690	et131x_rx_dma_enable(adapter);
691	et131x_tx_dma_enable(adapter);
692
693	/* Restart the netif queue */
694	netif_wake_queue(netdev);
695	return result;
696}
697