Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3989685pxb; Mon, 4 Oct 2021 14:34:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaBJqSxJ3BO18GJ9i3gFYUYqB5ao52Kwbhgzv+TbaZyjuS4JzBIFuwtqi/S/ppuvv1eauy X-Received: by 2002:a17:906:5482:: with SMTP id r2mr4524581ejo.348.1633383287051; Mon, 04 Oct 2021 14:34:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633383287; cv=none; d=google.com; s=arc-20160816; b=THReFg7CxGEQukcXNVhG20hDPJzs5gqef1zhSaf8GjbaOTgLR1pSk2eMI4fBuX1lD+ itCPwivt77lYTmlsevYJYuPD1/0BQKjFZbScJyLFAi4EBbSvtJaF7McRuCm/z2TQKegA O7VUedQfbZlXJqEIVPAD9FuAqU2qdj4f20R7lGc0PHYsRSI2/yq6jN50/ZvS9ojQtEDQ 5Xdp4Y6A5+M1fH9nX2xR3lANxyOMgq7ygVlRrnHT5dkTWl3KY2+7nk7+Gseno5X+rYs+ URUocrBUye8ZNWEATD2JG3rOV+cPMSDlmTNsE3OiebTzwOe+fvu+HLgZ1UqOvDXemhHv HdxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UqjzEqtAS9TMo7CB8oZXScn2bHzW/ihR/P7U6VQeYZQ=; b=i4C00rt0a5KC6crYls555mbRzOO9qHNlk6bwq+H8xhXbtIQpWeETPQF9UUO6DKLJBZ yOzPVhE9D3nF6Xskkvb+GNScpIq/CvPLQMyM2MfI08vNWhGHyQO50Lke2IM7GBumNT8V hgx2T+3FZhXPdZk4aaccLjB340zx0oV44noU9xS7oBIPyjSBQAOSLoNYhD/K0bXzSjgI vy5+3TCCDP+c2eWUw2JVYQkKINu/PiuPD6cEZU31JuyOZ6XzL9qlhZyF/i+eDVUIuO+L Wdz6cez5e+mP1xatGUsPo2lUKhEOdtS37SkKOmHliJBVC+yoQ/zYBSEq15cuyza2Eo4x DNEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LuZXvsD1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c14si25860171edm.165.2021.10.04.14.34.23; Mon, 04 Oct 2021 14:34:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LuZXvsD1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238279AbhJDNkN (ORCPT + 99 others); Mon, 4 Oct 2021 09:40:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:49924 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238371AbhJDNiZ (ORCPT ); Mon, 4 Oct 2021 09:38:25 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 850FC6159A; Mon, 4 Oct 2021 13:17:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633353440; bh=FZwgsMyYOtSav5zQPNH1yBIkX+5AlpRp7AQZkNa3UuQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LuZXvsD1MOOfW517UyNM3Q/w8GXStVEUtcbsTt8lGaxPyNf4vQ+DVCYEalZLokgei U5iiY1ztVa25zQLNQOIt9TCkfJBvSjbU58xlXm4KFweCmGwioTUQ6CO0ZYrgJEIeV1 zkJnALP6WyDXb6mrpENYXRyoXwgsQSD8fHxVnEhA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jian Shen , Guangbin Huang , "David S. Miller" , Sasha Levin Subject: [PATCH 5.14 128/172] net: hns3: fix show wrong state when add existing uc mac address Date: Mon, 4 Oct 2021 14:52:58 +0200 Message-Id: <20211004125049.101994260@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004125044.945314266@linuxfoundation.org> References: <20211004125044.945314266@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jian Shen [ Upstream commit 108b3c7810e14892c4a1819b1d268a2c785c087c ] Currently, if function adds an existing unicast mac address, eventhough driver will not add this address into hardware, but it will return 0 in function hclge_add_uc_addr_common(). It will cause the state of this unicast mac address is ACTIVE in driver, but it should be in TO-ADD state. To fix this problem, function hclge_add_uc_addr_common() returns -EEXIST if mac address is existing, and delete two error log to avoid printing them all the time after this modification. Fixes: 72110b567479 ("net: hns3: return 0 and print warning when hit duplicate MAC") Signed-off-by: Jian Shen Signed-off-by: Guangbin Huang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- .../hisilicon/hns3/hns3pf/hclge_main.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 90a72c79fec9..9920e76b4f41 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -8701,15 +8701,8 @@ int hclge_add_uc_addr_common(struct hclge_vport *vport, } /* check if we just hit the duplicate */ - if (!ret) { - dev_warn(&hdev->pdev->dev, "VF %u mac(%pM) exists\n", - vport->vport_id, addr); - return 0; - } - - dev_err(&hdev->pdev->dev, - "PF failed to add unicast entry(%pM) in the MAC table\n", - addr); + if (!ret) + return -EEXIST; return ret; } @@ -8861,7 +8854,13 @@ static void hclge_sync_vport_mac_list(struct hclge_vport *vport, } else { set_bit(HCLGE_VPORT_STATE_MAC_TBL_CHANGE, &vport->state); - break; + + /* If one unicast mac address is existing in hardware, + * we need to try whether other unicast mac addresses + * are new addresses that can be added. + */ + if (ret != -EEXIST) + break; } } } -- 2.33.0