提交 a8ab1ec0 编写于 作者: S Stephen Hemminger 提交者: Jeff Garzik

[PATCH] sky2: set mac address fix

Using the sky2 driver with bonding can result in oopses related to
reinitializing the PHY when the MAC address is changed (which bonding
is wont to do).  This patch changes sky2_set_mac_address to take less
drastic measures.

This is analagous to the skge patch here:

	http://lkml.org/lkml/2005/9/29/399

which fixed the issue here:

	http://bugzilla.kernel.org/show_bug.cgi?id=5271Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
Signed-off-by: NStephen Hemminger <shemminger@osdl.org>
Signed-off-by: NJeff Garzik <jgarzik@pobox.com>
上级 d28d4870
...@@ -2555,19 +2555,24 @@ static struct net_device_stats *sky2_get_stats(struct net_device *dev) ...@@ -2555,19 +2555,24 @@ static struct net_device_stats *sky2_get_stats(struct net_device *dev)
static int sky2_set_mac_address(struct net_device *dev, void *p) static int sky2_set_mac_address(struct net_device *dev, void *p)
{ {
struct sky2_port *sky2 = netdev_priv(dev); struct sky2_port *sky2 = netdev_priv(dev);
struct sockaddr *addr = p; struct sky2_hw *hw = sky2->hw;
unsigned port = sky2->port;
const struct sockaddr *addr = p;
if (!is_valid_ether_addr(addr->sa_data)) if (!is_valid_ether_addr(addr->sa_data))
return -EADDRNOTAVAIL; return -EADDRNOTAVAIL;
memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN); memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
memcpy_toio(sky2->hw->regs + B2_MAC_1 + sky2->port * 8, memcpy_toio(hw->regs + B2_MAC_1 + port * 8,
dev->dev_addr, ETH_ALEN); dev->dev_addr, ETH_ALEN);
memcpy_toio(sky2->hw->regs + B2_MAC_2 + sky2->port * 8, memcpy_toio(hw->regs + B2_MAC_2 + port * 8,
dev->dev_addr, ETH_ALEN); dev->dev_addr, ETH_ALEN);
if (netif_running(dev)) /* virtual address for data */
sky2_phy_reinit(sky2); gma_set_addr(hw, port, GM_SRC_ADDR_2L, dev->dev_addr);
/* physical address: used for pause frames */
gma_set_addr(hw, port, GM_SRC_ADDR_1L, dev->dev_addr);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册