aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/8139too.c
diff options
context:
space:
mode:
authorJiri Pirko <jpirko@redhat.com>2009-03-13 14:48:18 -0400
committerDavid S. Miller <davem@davemloft.net>2009-03-13 14:48:18 -0400
commitbda6a15a0d283d531b865fb7c596bb3ff258e87e (patch)
tree3627fcb0259558253443d0322884bccff790f593 /drivers/net/8139too.c
parentc048aaf4ca854fa67a3bfa9dab5b9ddc5083b3b7 (diff)
8139too: allow to set mac address on running device
Similar patch as for 8139cp posted yesterday, so the same comment: So far there was not a chance to set a mac address on running 8139too device. This is for example needed when you want to use this NIC as a bonding slave in bonding device in mode balance-alb. This simple patch allows it. Signed-off-by: Jiri Pirko <jpirko@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/8139too.c')
-rw-r--r--drivers/net/8139too.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
index 5341da604e84..29df398b7727 100644
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -640,6 +640,7 @@ static int rtl8139_start_xmit (struct sk_buff *skb,
640#ifdef CONFIG_NET_POLL_CONTROLLER 640#ifdef CONFIG_NET_POLL_CONTROLLER
641static void rtl8139_poll_controller(struct net_device *dev); 641static void rtl8139_poll_controller(struct net_device *dev);
642#endif 642#endif
643static int rtl8139_set_mac_address(struct net_device *dev, void *p);
643static int rtl8139_poll(struct napi_struct *napi, int budget); 644static int rtl8139_poll(struct napi_struct *napi, int budget);
644static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance); 645static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance);
645static int rtl8139_close (struct net_device *dev); 646static int rtl8139_close (struct net_device *dev);
@@ -917,7 +918,7 @@ static const struct net_device_ops rtl8139_netdev_ops = {
917 .ndo_stop = rtl8139_close, 918 .ndo_stop = rtl8139_close,
918 .ndo_get_stats = rtl8139_get_stats, 919 .ndo_get_stats = rtl8139_get_stats,
919 .ndo_validate_addr = eth_validate_addr, 920 .ndo_validate_addr = eth_validate_addr,
920 .ndo_set_mac_address = eth_mac_addr, 921 .ndo_set_mac_address = rtl8139_set_mac_address,
921 .ndo_start_xmit = rtl8139_start_xmit, 922 .ndo_start_xmit = rtl8139_start_xmit,
922 .ndo_set_multicast_list = rtl8139_set_rx_mode, 923 .ndo_set_multicast_list = rtl8139_set_rx_mode,
923 .ndo_do_ioctl = netdev_ioctl, 924 .ndo_do_ioctl = netdev_ioctl,
@@ -2215,6 +2216,29 @@ static void rtl8139_poll_controller(struct net_device *dev)
2215} 2216}
2216#endif 2217#endif
2217 2218
2219static int rtl8139_set_mac_address(struct net_device *dev, void *p)
2220{
2221 struct rtl8139_private *tp = netdev_priv(dev);
2222 void __iomem *ioaddr = tp->mmio_addr;
2223 struct sockaddr *addr = p;
2224
2225 if (!is_valid_ether_addr(addr->sa_data))
2226 return -EADDRNOTAVAIL;
2227
2228 memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
2229
2230 spin_lock_irq(&tp->lock);
2231
2232 RTL_W8_F(Cfg9346, Cfg9346_Unlock);
2233 RTL_W32_F(MAC0 + 0, cpu_to_le32 (*(u32 *) (dev->dev_addr + 0)));
2234 RTL_W32_F(MAC0 + 4, cpu_to_le32 (*(u32 *) (dev->dev_addr + 4)));
2235 RTL_W8_F(Cfg9346, Cfg9346_Lock);
2236
2237 spin_unlock_irq(&tp->lock);
2238
2239 return 0;
2240}
2241
2218static int rtl8139_close (struct net_device *dev) 2242static int rtl8139_close (struct net_device *dev)
2219{ 2243{
2220 struct rtl8139_private *tp = netdev_priv(dev); 2244 struct rtl8139_private *tp = netdev_priv(dev);