Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp448402pxb; Wed, 29 Sep 2021 02:44:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfQahvK/u5HjyKMnnIqVM1czlNrobwo7wMewsxuqIDpbSjorEERtCF933VJ0Z99eXaXiQ5 X-Received: by 2002:a17:906:6696:: with SMTP id z22mr6536036ejo.443.1632908665679; Wed, 29 Sep 2021 02:44:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632908665; cv=none; d=google.com; s=arc-20160816; b=avQLwdySxTqaA90N5QqUrfKtKyqrGIdnnfAbgGuTEHg9cNVjx+BiQbs7CmLXpc0PVd P2bHb87HJN+ssR1cA+avrddsZvsT3ke07f1N0g30WH6pLxntkLTBM6FwADn4IVVcNhX6 MPNpAFN88RNT3IGLXRJObnZuljZlKAL92QT1co0u/ap4FO0YCpYKavAzMIe7kiyj0iq9 /aic1x7BUiYqhAB59IirCZQkRvTNLcdczaylHIrw51XHHck3oG2s/IzUsjwGTKeWzwNn 71aVDsLo7yzplS0mDWm+ZFy0qYBBfnwHsDK+I39rta6ExtkPRlcUMipwa1EhRM8cHBf7 bZhg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=9zM6Xpzki3Rgr3HOw0C0LuWLucGPrUX5/7mfgq7T5+4=; b=x7IhtZCdxV4DkMj4U1r1E8WjZlrMSEZBEOGGf3hDgtBeCHzntKARk2UL10UeGZU9BL kkMCLiv7iYpzDSksETMcCuFURHmQkb1IJkCAkojlgoPgXx8HxOe/7TgpcWwauBPYvd70 UjEW3VXWgZV6zIS4Z5uxy3XFU1B72g/Ive+N32UqDOR/tvy0IPI3CQR5cAwGMNXFnVhR 8Mdu65KpS0Frp9BLQ2Nu1qrebIt5gWolzUDZE8N7IDOjS0p4FY2oB+a5R87X0D1eduxf 7f7+tLiPTLXMIZBIl0ee4X6cwH5NjF4IuKRWifrQR/PBFw7C4hFl30IBdaVhazPhNGHQ Z4/g== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id og49si1898510ejc.305.2021.09.29.02.44.01; Wed, 29 Sep 2021 02:44:25 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245192AbhI2JmC (ORCPT + 99 others); Wed, 29 Sep 2021 05:42:02 -0400 Received: from szxga03-in.huawei.com ([45.249.212.189]:23232 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245093AbhI2Jlv (ORCPT ); Wed, 29 Sep 2021 05:41:51 -0400 Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4HKBCn0JRjz8tYD; Wed, 29 Sep 2021 17:39:17 +0800 (CST) Received: from kwepemm600016.china.huawei.com (7.193.23.20) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Wed, 29 Sep 2021 17:40:09 +0800 Received: from localhost.localdomain (10.67.165.24) by kwepemm600016.china.huawei.com (7.193.23.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.8; Wed, 29 Sep 2021 17:40:08 +0800 From: Guangbin Huang To: , CC: , , , Subject: [PATCH net 5/8] net: hns3: fix show wrong state when add existing uc mac address Date: Wed, 29 Sep 2021 17:35:53 +0800 Message-ID: <20210929093556.9146-6-huangguangbin2@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210929093556.9146-1-huangguangbin2@huawei.com> References: <20210929093556.9146-1-huangguangbin2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm600016.china.huawei.com (7.193.23.20) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jian Shen 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 --- .../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 47fea8985861..3391244d9d3d 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -8708,15 +8708,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; } @@ -8868,7 +8861,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