]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.14.93/lan78xx-resolve-issue-with-changing-mac-address.patch
Linux 4.19.15
[thirdparty/kernel/stable-queue.git] / releases / 4.14.93 / lan78xx-resolve-issue-with-changing-mac-address.patch
1 From 80dc4a24b7ec1feb39eeb9c857d6f27f14b9f688 Mon Sep 17 00:00:00 2001
2 From: Jason Martinsen <jasonmartinsen@msn.com>
3 Date: Tue, 18 Dec 2018 05:38:22 +0000
4 Subject: lan78xx: Resolve issue with changing MAC address
5
6 [ Upstream commit 15515aaaa69659c502003926a2067ee76176148a ]
7
8 Current state for the lan78xx driver does not allow for changing the
9 MAC address of the interface, without either removing the module (if
10 you compiled it that way) or rebooting the machine. If you attempt to
11 change the MAC address, ifconfig will show the new address, however,
12 the system/interface will not respond to any traffic using that
13 configuration. A few short-term options to work around this are to
14 unload the module and reload it with the new MAC address, change the
15 interface to "promisc", or reboot with the correct configuration to
16 change the MAC.
17
18 This patch enables the ability to change the MAC address via fairly normal means...
19 ifdown <interface>
20 modify entry in /etc/network/interfaces OR a similar method
21 ifup <interface>
22 Then test via any network communication, such as ICMP requests to gateway.
23
24 My only test platform for this patch has been a raspberry pi model 3b+.
25
26 Signed-off-by: Jason Martinsen <jasonmartinsen@msn.com>
27
28 -----
29
30 Signed-off-by: David S. Miller <davem@davemloft.net>
31 Signed-off-by: Sasha Levin <sashal@kernel.org>
32 ---
33 drivers/net/usb/lan78xx.c | 4 ++++
34 1 file changed, 4 insertions(+)
35
36 diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
37 index e069b310d6a6..b62c41114e34 100644
38 --- a/drivers/net/usb/lan78xx.c
39 +++ b/drivers/net/usb/lan78xx.c
40 @@ -2212,6 +2212,10 @@ static int lan78xx_set_mac_addr(struct net_device *netdev, void *p)
41 ret = lan78xx_write_reg(dev, RX_ADDRL, addr_lo);
42 ret = lan78xx_write_reg(dev, RX_ADDRH, addr_hi);
43
44 + /* Added to support MAC address changes */
45 + ret = lan78xx_write_reg(dev, MAF_LO(0), addr_lo);
46 + ret = lan78xx_write_reg(dev, MAF_HI(0), addr_hi | MAF_HI_VALID_);
47 +
48 return 0;
49 }
50
51 --
52 2.19.1
53