From patchwork Wed May 9 16:24:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 135308 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp5842193lji; Wed, 9 May 2018 09:26:34 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqKMFowaXDXi1viGNnEeZ90uTQ77gFE8TZ0gSxkRNOMvvkDsAbXt/WJjwLZeHjvtrcml3EM X-Received: by 2002:a17:902:4303:: with SMTP id i3-v6mr47547881pld.394.1525883194750; Wed, 09 May 2018 09:26:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525883194; cv=none; d=google.com; s=arc-20160816; b=XEeHxyXWpU1TqTVXsVyCLOYkCnChKdEZY151avmTF7xjgaBK/EcNuMJlNKTuBntGBV Rxz/8NAhlJ4SQ7UnV2EiXPQCBtatdroS75Yzyo47Mi/GOblRszvfnz0zbfMOeN2nd1ey HTpGA0cycoApx9gPkLoaz4jI/PZMiuOjEJD+kJzj8B3u6nEAUpMdlBF6UEKTx9GlhjOd h04c9SVG8CXPYo7n7NXBa/Cv/YCwOa2GiV8Brn0WRnS6uRPX2NS+EGTHrvXWMnhg96sN XieLht7aXDL6ZLZYW9hvXY/Qcsuf/SCINoLepoa7/dcgeB5uwtxJoIO+HCkT4l0vdYyJ D07Q== 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=aKA0glO01VDpZZ7EwaO53HUURfyvOTFAFh/FWMrKDzM=; b=hdoC9QJlpYXiiti1I8HUIVjMmC3q+dzuAeV5+fKc/J1URgoU9zIDW+X8EOc3WvwFjr njW76x8Ys2rxZCLvsRdJoRJ0CjWTpbWKxpwJPgyvC9I6BO9Uou9In60lMMk4CURqE4OS /q6zwuv3mYo3bFelANMryUHUEzoVXwmtCSvcg0aylST/ZRzgAQ1uoYgPxycWLRDc+Y+b JIRRug1Ff1IJfGwW/I3rYXqt9J4jX1dqO/4uvXaItQUDH5DIYBBc5Pcpal/KS9a5Pydr 9061kugRBWywCuAsiPH3xK+XRQ/qTBKTnwTFiCHgWjAFShgcBtPsDGNJfgANCXpDIjJR wm2g== 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 b6-v6si27073142plm.153.2018.05.09.09.26.34; Wed, 09 May 2018 09:26:34 -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 S965589AbeEIQ0Y (ORCPT + 29 others); Wed, 9 May 2018 12:26:24 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:7663 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965532AbeEIQ0W (ORCPT ); Wed, 9 May 2018 12:26:22 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id E49D9D63E23C5; Thu, 10 May 2018 00:26:08 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.227.234) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.361.1; Thu, 10 May 2018 00:25:59 +0800 From: Salil Mehta To: CC: , , , , , , , Yunsheng Lin Subject: [PATCH net-next 1/4] net: hns3: Fix for setting mac address when resetting Date: Wed, 9 May 2018 17:24:38 +0100 Message-ID: <20180509162441.18068-2-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180509162441.18068-1-salil.mehta@huawei.com> References: <20180509162441.18068-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: Yunsheng Lin When hns3_init_mac_addr is called during reset process, it will get the mac address from NCL_CONFIG and set it to hardware. If user has changed the mac address, then the mac address set by user is lost during resetting. This patch fixes it by not getting the mac address from NCL_CONFIG when resetting. Fixes: 424eb834a9be ("net: hns3: Unified HNS3 {VF|PF} Ethernet Driver for hip08 SoC") Signed-off-by: Yunsheng Lin Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 729bcab..a55c8f515 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -3046,13 +3046,13 @@ int hns3_uninit_all_ring(struct hns3_nic_priv *priv) } /* Set mac addr if it is configured. or leave it to the AE driver */ -static void hns3_init_mac_addr(struct net_device *netdev) +static void hns3_init_mac_addr(struct net_device *netdev, bool init) { struct hns3_nic_priv *priv = netdev_priv(netdev); struct hnae3_handle *h = priv->ae_handle; u8 mac_addr_temp[ETH_ALEN]; - if (h->ae_algo->ops->get_mac_addr) { + if (h->ae_algo->ops->get_mac_addr && init) { h->ae_algo->ops->get_mac_addr(h, mac_addr_temp); ether_addr_copy(netdev->dev_addr, mac_addr_temp); } @@ -3106,7 +3106,7 @@ static int hns3_client_init(struct hnae3_handle *handle) handle->kinfo.netdev = netdev; handle->priv = (void *)priv; - hns3_init_mac_addr(netdev); + hns3_init_mac_addr(netdev, true); hns3_set_default_feature(netdev); @@ -3353,7 +3353,7 @@ static int hns3_reset_notify_init_enet(struct hnae3_handle *handle) struct hns3_nic_priv *priv = netdev_priv(netdev); int ret; - hns3_init_mac_addr(netdev); + hns3_init_mac_addr(netdev, false); hns3_nic_set_rx_mode(netdev); hns3_recover_hw_addr(netdev);