From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 385B4C43387 for ; Wed, 26 Dec 2018 22:38:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EFDDE2054F for ; Wed, 26 Dec 2018 22:38:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1545863898; bh=kXS4obVbAaMPDKZOlsK2UmO56efBgXsCoVsVdmPCIY8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=t/yAkEHZCr38rUZSktnqMNRqVxs/nh9FVTOFvAP5mmBAnn3uPBsoE0DJ12q6rC8sl cwHq6+2kRYgXSyzMZg0bj1gAS6dK9Tzt5cJMV2fpRGm2wyTpfBLbmBJqsC2YjhwNDl SJmta+31xFUf4floA+W2v2MMKAdhapCLJfv9aNfU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728735AbeLZWiR (ORCPT ); Wed, 26 Dec 2018 17:38:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:38390 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728627AbeLZWiJ (ORCPT ); Wed, 26 Dec 2018 17:38:09 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 72E3521741; Wed, 26 Dec 2018 22:38:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1545863888; bh=kXS4obVbAaMPDKZOlsK2UmO56efBgXsCoVsVdmPCIY8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IsFgcIoepwVfIVU8zhFmLWgB9k8qMipgrHqsBFlwT9r0LXj9CG/bHKyeZeDvwXIwz qa/6MuDqsS56PuoMYfCx1kUxNulnxq4XEQq6TcDKoE4ZfBVpDWy+GIk5LDBvEEKfLR gilOOUEVOb5O/ML9DpMqSqLxoHqOsN4Tr4f/+fmo= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jason Martinsen , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org, linux-usb@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 77/97] lan78xx: Resolve issue with changing MAC address Date: Wed, 26 Dec 2018 17:35:37 -0500 Message-Id: <20181226223557.149329-77-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181226223557.149329-1-sashal@kernel.org> References: <20181226223557.149329-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jason Martinsen [ Upstream commit 15515aaaa69659c502003926a2067ee76176148a ] Current state for the lan78xx driver does not allow for changing the MAC address of the interface, without either removing the module (if you compiled it that way) or rebooting the machine. If you attempt to change the MAC address, ifconfig will show the new address, however, the system/interface will not respond to any traffic using that configuration. A few short-term options to work around this are to unload the module and reload it with the new MAC address, change the interface to "promisc", or reboot with the correct configuration to change the MAC. This patch enables the ability to change the MAC address via fairly normal means... ifdown modify entry in /etc/network/interfaces OR a similar method ifup Then test via any network communication, such as ICMP requests to gateway. My only test platform for this patch has been a raspberry pi model 3b+. Signed-off-by: Jason Martinsen ----- Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/usb/lan78xx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c index c3c9ba44e2a1..8d140495da79 100644 --- a/drivers/net/usb/lan78xx.c +++ b/drivers/net/usb/lan78xx.c @@ -2335,6 +2335,10 @@ static int lan78xx_set_mac_addr(struct net_device *netdev, void *p) ret = lan78xx_write_reg(dev, RX_ADDRL, addr_lo); ret = lan78xx_write_reg(dev, RX_ADDRH, addr_hi); + /* Added to support MAC address changes */ + ret = lan78xx_write_reg(dev, MAF_LO(0), addr_lo); + ret = lan78xx_write_reg(dev, MAF_HI(0), addr_hi | MAF_HI_VALID_); + return 0; } -- 2.19.1