Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp811327imm; Fri, 1 Jun 2018 09:57:02 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIt387uF59i81kJJouXkYWl70WQIi9p8N0S9ncKzvqTxdEQWlmt8Y78sDAxMuTt6XA19DTq X-Received: by 2002:a17:902:8345:: with SMTP id z5-v6mr11582181pln.311.1527872222360; Fri, 01 Jun 2018 09:57:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527872222; cv=none; d=google.com; s=arc-20160816; b=0PxW2zPp0tYbvqiUd8x31SfaBB28J1oODfcVlOcggMpAat6dEUndKJz0O6huM8W5gV EEmNGAfgMQFL7RXSwc0fIpkiUzXKht5DYAZEVZHouQK2Ek8XfazdqScumSHsttn8UFWe +fQy/a3X98PJjfIddJVC9M/A2ogIn9+S2NQpnBA9lpE8yweQuE/QyDulKzz2tSWpQLkt C/YbGjtHMEyfe0OxgO8fmOp/WjYb6VVEbOlamODz5SJO9pGC4/6zwq2WohGYi3E7dsfr VH2T93V36Eg1T96o2CcR6npw2YdM6xGLccyTEvmajOvhPZnYBXULygQZbHNiJlcNBE3W lxXQ== 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 59-v6si5500907plp.496.2018.06.01.09.56.48; Fri, 01 Jun 2018 09:57:02 -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 S1752936AbeFAQzz (ORCPT + 99 others); Fri, 1 Jun 2018 12:55:55 -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 Content-Type: text/plain 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(+) 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; } -- 2.7.4