Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp812973imm; Fri, 1 Jun 2018 09:58:49 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI5nokt1LTj7dlWleKSvs15CkgGKGxNSJlUAD1cbHwDP/TnIr84iADPG191vRdeQUlaABbC X-Received: by 2002:a17:902:76c9:: with SMTP id j9-v6mr423908plt.15.1527872329348; Fri, 01 Jun 2018 09:58:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527872329; cv=none; d=google.com; s=arc-20160816; b=P9orvQAoO+NxGKVZiL54bUX2WCymv2+Q9Phzkcmcj/1ZSZ53MSfsj4tEieg77Vbyh4 EbKq+YEAxBK7totYpb/vnWANHGwzPCkpzNkSZcWZpQw7JgfWU/gXqTTn/lVqWtt6/Biq Zve1n+esjv/ZM3k2wXvMnhVa4u5xPbnYghZN7WVAAW55y2nsUfkrmXi5ueiD3DDv+akF m9waB7IC0XuARAxJmj5IuLzExhvQseKlMcP9Rjr18BuUWR8DsXH8yr8h8/waNLe6dghi jHoZPkdIu5R0Olj9XBD9KoEcyALFdQZ8SJmpjCC1PAOPBx6F86JCVSNgTG4a4PUB+Yv8 SGxA== 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=k9+iTWEIgeFtjwE7ImOXdVi9wrXKE0paih8wxL26KB8=; b=GNbNcz9fHTruSI6PLa1yvooptj9LrA6CH6v/EYJjfAQ9XCQRtUgKnMhAxPsrYgBdyB NujPPGhmNow9jiH30AYuW6ypeXLUb/aJ7x5ZMo+IYZperZPo61tKLlE23/FBERqEEHiB SqKvW2NegtpzVUxY/UnW8Wq5w1Y9XytkOkj66Qsdpiock4mqdJ9fhaqNCRLicSJIGqGq nhi09SLM+FZ3CuuUmy/VIse5VF8VjHHaLnGUO8GLKT+77aN85MnWwRtbpAPqej4olbE0 BAsnuMAwI3B0Ddyulog7e0lwIrIZD68Vlzv7J+hdtxCX9nJ1nvzTjgm7c4TdLmjxsBZ7 Hlww== 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 o73-v6si40262394pfg.327.2018.06.01.09.58.35; Fri, 01 Jun 2018 09:58:49 -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 S1753665AbeFAQ5w (ORCPT + 99 others); Fri, 1 Jun 2018 12:57:52 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:8624 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752429AbeFAQxz (ORCPT ); Fri, 1 Jun 2018 12:53:55 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 5CC972E238772; Sat, 2 Jun 2018 00:53:41 +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:35 +0800 From: Salil Mehta To: CC: , , , , , , , Jian Shen Subject: [PATCH net-next 03/11] net: hns3: Add repeat address checking for setting mac address Date: Fri, 1 Jun 2018 17:52:03 +0100 Message-ID: <20180601165211.46372-4-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 Add checking for new mac address. It doesn't need to config the mac vlan table if it's already in use. Signed-off-by: Jian Shen Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 0a6876a..fe54564 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -1132,6 +1132,12 @@ static int hns3_nic_net_set_mac_address(struct net_device *netdev, void *p) if (!mac_addr || !is_valid_ether_addr((const u8 *)mac_addr->sa_data)) return -EADDRNOTAVAIL; + if (ether_addr_equal(netdev->dev_addr, mac_addr->sa_data)) { + netdev_info(netdev, "already using mac address %pM\n", + mac_addr->sa_data); + return 0; + } + ret = h->ae_algo->ops->set_mac_addr(h, mac_addr->sa_data, false); if (ret) { netdev_err(netdev, "set_mac_address fail, ret=%d!\n", ret); -- 2.7.4