From patchwork Fri Jun 1 16:52:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 137564 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1179918lji; Fri, 1 Jun 2018 09:55:58 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI5uif4/wf47zWXPEbZkrJevyfVR/ENaYGO9MWZCsAiv9s7kpsPIFC5FIwIYbelol4vgYyH X-Received: by 2002:a17:902:b40f:: with SMTP id x15-v6mr12118061plr.270.1527872158745; Fri, 01 Jun 2018 09:55:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527872158; cv=none; d=google.com; s=arc-20160816; b=e66lJoYqmUeyHbWq/SeSCG2mPrFFCqgpgjqqRi2lH82o6LoKKFv6zuovnA8A3b5/3d EDV+Hx8vP+QkdfE5jLS8Dg9Lrz7bIqRDcMO/PXr0HqusrjDvFg0xOAQKhyDXNeD8w98/ 1O0T13/lFz4JwPs7FUlaTPcVCBeodDZM7bXaaoPpK0qmwipOh4grDIH0aBr52vkB3LDG S8QG7zdVIHl2LYop+yHpTXQNv7BezKv1zOs0jigvue6msdvuW/lj4nBx5Pg53f9CLGTi VPio7/03A0p2jotFFoWaj6xTf49bTRt1NSqJ5vG50cSWNpCkgMUC5PQ9gO57D3oKDOWQ YWQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=dN6P9ccTVYNAsLtJYR5nrubtM8zwNScKvN0Un4rWJrY=; b=mdakaC+pjxxJjRvkhuF06xUs5C/Fr6U8iJhrxFJpBo5mgH+LDx0DkZea/ixufUBddw SOknn7Ea/qBNaymi5AvPJ97/xrlT1DYsNlg3hKKBGVNxPUY8XY4E15t2yviRz6hNPhax M9sip6eG3CLAKWRYFzcThns7mD8fNgrHTpnl3ers4xsBXQa8mOm2nti3hrewn+h/1Yus 8ajymScTPKlamj3DAlSMKKHpOfEDEnVQtaI8B+i/tQan7QtC/Zuu9IkfKxSKxRrjR/fM +OIgWmz3nwyrCtk3STDH2MyDaG/UNoNLJPKTKPJFNE7fn1jnN1L+r7wrgcD0xXB/WThq N0+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t9-v6si4697339pgn.559.2018.06.01.09.55.58; Fri, 01 Jun 2018 09:55:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752132AbeFAQz4 (ORCPT + 30 others); Fri, 1 Jun 2018 12:55:56 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:8626 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753199AbeFAQyB (ORCPT ); Fri, 1 Jun 2018 12:54:01 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 652CD3DD09E6E; Sat, 2 Jun 2018 00:53:46 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.227.234) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.382.0; Sat, 2 Jun 2018 00:53:38 +0800 From: Salil Mehta To: CC: , , , , , , , Jian Shen Subject: [PATCH net-next 04/11] net: hns3: Fix setting mac address error Date: Fri, 1 Jun 2018 17:52:04 +0100 Message-ID: <20180601165211.46372-5-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180601165211.46372-1-salil.mehta@huawei.com> References: <20180601165211.46372-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.227.234] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jian Shen When doing function reset or insmod hns3 dirver after rmmod, the entries of mac vlan table are not cleared, which may cause init mac address failed. This patch fixes it by clearing the old mac address when doing function reset or rmmod hns3 driver. Fixes: 76ad4f0ee747 ("net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC") Signed-off-by: Jian Shen Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index fe54564..235eea1 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -3007,6 +3007,15 @@ static void hns3_init_mac_addr(struct net_device *netdev, bool init) } +static void hns3_uninit_mac_addr(struct net_device *netdev) +{ + struct hns3_nic_priv *priv = netdev_priv(netdev); + struct hnae3_handle *h = priv->ae_handle; + + if (h->ae_algo->ops->rm_uc_addr) + h->ae_algo->ops->rm_uc_addr(h, netdev->dev_addr); +} + static void hns3_nic_set_priv_ops(struct net_device *netdev) { struct hns3_nic_priv *priv = netdev_priv(netdev); @@ -3135,6 +3144,8 @@ static void hns3_client_uninit(struct hnae3_handle *handle, bool reset) priv->ring_data = NULL; + hns3_uninit_mac_addr(netdev); + free_netdev(netdev); } @@ -3451,6 +3462,8 @@ static int hns3_reset_notify_uninit_enet(struct hnae3_handle *handle) priv->ring_data = NULL; + hns3_uninit_mac_addr(netdev); + return ret; }