netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@osdl.org>
To: "Greg Scott" <GregScott@InfraSupportEtc.com>
Cc: "Chuck Ebbert" <76306.1226@compuserve.com>,
	"linux-kernel" <linux-kernel@vger.kernel.org>,
	"David S. Miller" <davem@davemloft.net>, <netdev@vger.kernel.org>,
	"Bart Samwel" <bart@samwel.tk>,
	"Alan Cox" <alan@lxorguk.ukuu.org.uk>,
	"Simon Mackinlay" <smackinlay@mail.com>
Subject: Re: Router stops routing after changing MAC Address
Date: Mon, 13 Mar 2006 10:00:41 -0800	[thread overview]
Message-ID: <20060313100041.212cee08@localhost.localdomain> (raw)
In-Reply-To: <925A849792280C4E80C5461017A4B8A20321F2@mail733.InfraSupportEtc.com>

There still is a bug in the 3c59x driver.  It doesn't include any code
to handle changing the mac address.  It will work if you take the device
down, change address, then bring it up. But you shouldn't have to do that.

Also, if the driver handles setting mac address, it could have prevented
you from using a multicast address.

Something like this is needed (untested, I don't have that hardware).


--- linux-2.6/drivers/net/3c59x.c.orig	2006-03-13 09:58:25.000000000 -0800
+++ linux-2.6/drivers/net/3c59x.c	2006-03-13 09:52:47.000000000 -0800
@@ -895,6 +895,7 @@ static void dump_tx_ring(struct net_devi
 static void update_stats(void __iomem *ioaddr, struct net_device *dev);
 static struct net_device_stats *vortex_get_stats(struct net_device *dev);
 static void set_rx_mode(struct net_device *dev);
+static int set_rx_address(struct net_device *dev, void *addr);
 #ifdef CONFIG_PCI
 static int vortex_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
 #endif
@@ -1563,6 +1564,7 @@ static int __devinit vortex_probe1(struc
 #endif
 	dev->ethtool_ops = &vortex_ethtool_ops;
 	dev->set_multicast_list = set_rx_mode;
+	dev->set_mac_address = set_rx_address;
 	dev->tx_timeout = vortex_tx_timeout;
 	dev->watchdog_timeo = (watchdog * HZ) / 1000;
 #ifdef CONFIG_NET_POLL_CONTROLLER
@@ -3150,6 +3152,27 @@ static void set_rx_mode(struct net_devic
 	iowrite16(new_mode, ioaddr + EL3_CMD);
 }
 
+
+static int set_rx_address(struct net_device *dev, void *p)
+{
+	struct vortex_private *vp = netdev_priv(dev);
+	void __iomem *ioaddr = vp->ioaddr;
+	const struct sockaddr *addr = p;
+
+	if (!is_valid_ether_addr(addr->sa_data))
+		return -EADDRNOTAVAIL;
+
+	spin_lock_bh(&vp->lock);
+	memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
+
+	EL3WINDOW(2);
+	for (i = 0; i < ETH_ALEN; i++)
+		iowrite8(dev->dev_addr[i], ioaddr + i);
+	spin_unlock_bh(&vp->lock);
+	
+	return 0;
+}
+
 #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
 /* Setup the card so that it can receive frames with an 802.1q VLAN tag.
    Note that this must be done after each RxReset due to some backwards

  reply	other threads:[~2006-03-13 18:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-13 17:17 Router stops routing after changing MAC Address Greg Scott
2006-03-13 18:00 ` Stephen Hemminger [this message]
2006-03-13 20:27   ` linux-os (Dick Johnson)
2006-03-13 22:10     ` Randy.Dunlap
2006-03-14 14:16     ` Bjørn Mork
2006-03-16 16:07   ` Chris Wedgwood
2006-03-16 17:55     ` Stephen Hemminger
  -- strict thread matches above, loose matches on Subject: below --
2006-03-16 18:32 Greg Scott
2006-03-14 15:30 Greg Scott
2006-03-14 12:12 Simon Mackinlay
2006-03-13 22:15 Greg Scott
2006-03-13 22:35 ` linux-os (Dick Johnson)
2006-03-14 11:40   ` Bart Samwel
2006-03-14 12:52     ` linux-os (Dick Johnson)
2006-03-14 23:57   ` Valdis.Kletnieks
2006-03-13 20:57 Greg Scott
2006-03-13 21:39 ` linux-os (Dick Johnson)
2006-03-13 21:50   ` Rick Jones
2006-03-13 12:15 Greg Scott

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060313100041.212cee08@localhost.localdomain \
    --to=shemminger@osdl.org \
    --cc=76306.1226@compuserve.com \
    --cc=GregScott@InfraSupportEtc.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=bart@samwel.tk \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=smackinlay@mail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).