From patchwork Fri Feb 22 12:56:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 10825955 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A91BF13B5 for ; Fri, 22 Feb 2019 12:57:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 963A732497 for ; Fri, 22 Feb 2019 12:57:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A8213249A; Fri, 22 Feb 2019 12:57:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 36EC532497 for ; Fri, 22 Feb 2019 12:57:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726350AbfBVM55 (ORCPT ); Fri, 22 Feb 2019 07:57:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:38756 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725926AbfBVM55 (ORCPT ); Fri, 22 Feb 2019 07:57:57 -0500 Received: from localhost.localdomain (unknown [117.99.84.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D06BF206BB; Fri, 22 Feb 2019 12:57:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550840276; bh=MDff5Pug2bqz4fpl/JD8hmxv1UnjJ4s7A7A5RPU1N7Y=; h=From:To:Cc:Subject:Date:From; b=zVnUxDInrFA94LvwLv5S1V0+8bUCYTQL4yyEHLlvNTLyZjZ4bX82u4VyUKgCuwT9f df35ozYttCvoJ1mLt+bkyb0ygDWKIfuib4NyM7m38qyyaQK/xMTGCOwz/1tuP1gtom TmESbDjT0r9AvBsxcrcdsBmOzNz2f/iET62qNp0M= From: Vinod Koul To: "David S. Miller" Cc: linux-arm-msm@vger.kernel.org, Bjorn Andersson , Xiaofei Shen , Andrew Lunn , Vivien Didelot , Florian Fainelli , Niklas Cassel , netdev@vger.kernel.org, Vinod Koul Subject: [PATCH] net: dsa: Inherit dev addr from master Date: Fri, 22 Feb 2019 18:26:54 +0530 Message-Id: <20190222125654.12478-1-vkoul@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Xiaofei Shen When we create slave netdevice, the dev addr is inherited from master but the master dev addr maybe NULL at that time, so inherit it again while opening the slave. Signed-off-by: Xiaofei Shen Signed-off-by: Vinod Koul --- net/dsa/slave.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 8e64c4e947c6..5f95c538b58c 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -77,7 +77,9 @@ static int dsa_slave_open(struct net_device *dev) if (!(master->flags & IFF_UP)) return -ENETDOWN; - if (!ether_addr_equal(dev->dev_addr, master->dev_addr)) { + if (!is_valid_ether_addr(dev->dev_addr)) { + eth_hw_addr_inherit(dev, master); + } else if (!ether_addr_equal(dev->dev_addr, master->dev_addr)) { err = dev_uc_add(master, dev->dev_addr); if (err < 0) goto out;