Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2111447pxb; Fri, 25 Mar 2022 11:16:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJykkw13Ff0cN6t1AzhzgYElTTEP31gRXdv0YrGGpnXJ6KUxuTOeS+5cn4U/BzJqs4BBqxoL X-Received: by 2002:a05:6a00:244a:b0:4fa:ebf9:75de with SMTP id d10-20020a056a00244a00b004faebf975demr10313717pfj.73.1648232219578; Fri, 25 Mar 2022 11:16:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648232219; cv=none; d=google.com; s=arc-20160816; b=uy7YSgUau2kuXUX+Yl3/0IbBOSUR9jmGNxcRkLJmf0CsnipmAgh2iQTvKUlGWY3HZ3 W+vfw46PEulafhPGpPMjvg13iFL2u+7IDb5KcBKwQqNA82+EzTJXqb8GKfEzsWeLC3vg K3HeRyCcqVQGwZj5Vrgt7+19UPwlHm2mqIjUZDCgXk3sJwaxE/JNDkZB9F+sVtoxHpUr UO8VFjYEJdI84tpIr8t9tDp260iwAmnJ5zKmnwms+stBQxwbM9l/p+XJAPTjuEQAUaOb U46Ng3Hujx5LJmZyQiZMOB5Idz4TykfsAGjz3k33jKk5OoBMKh8cJSSPw1iNA0kMmX9U qGUw== 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=lViOmgDJUKBTA01K8sib0KdaX0PG56SzxpFyYoBBvWo=; b=Mo97WKJ7TpJWmdSS+h7zJxvsyOvM0XHLGJX8aJWt0BBs7yb+jlEQJ2bjse/YhBmZZg ihtH06YvnsALIkeqIweXLLQ2ylzglv5r+LuVQkhlV9qVVw1E+A5dJbSYHA1sfwhxoHV1 lg+EaS6dAB5bfUtGKOrwhPTPiMuoZmsdSf0kKrVchFwzs8nuk9zuQMqIYYD+gEdsVfVF BWU4aUFJx0cO4vnfA17auw2rtnXew5p9svissBX1ZLLRB5+SZjiufRvnMJLdPuDQIdjn G+Wpw84Ysblq3T4O44yiq7IfdDZaMPcMTTIj6IVdZTHMh+qMIwFldtLCApBtdsfSj36X I0Qg== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id p3-20020a170902e74300b00153b2d164c3si3422525plf.203.2022.03.25.11.16.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 11:16:59 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4CDAD11C7F6; Fri, 25 Mar 2022 10:45:41 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350276AbiCXNB4 (ORCPT + 99 others); Thu, 24 Mar 2022 09:01:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242928AbiCXNBy (ORCPT ); Thu, 24 Mar 2022 09:01:54 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5FC98FE61; Thu, 24 Mar 2022 06:00:21 -0700 (PDT) Received: from kwepemi100017.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KPQJ355c4zCrD6; Thu, 24 Mar 2022 20:58:11 +0800 (CST) Received: from kwepemm600016.china.huawei.com (7.193.23.20) by kwepemi100017.china.huawei.com (7.221.188.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Thu, 24 Mar 2022 21:00:19 +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.21; Thu, 24 Mar 2022 21:00:19 +0800 From: Guangbin Huang To: , CC: , , , , Subject: [PATCH net 1/4] net: hns3: fix bug when PF set the duplicate MAC address for VFs Date: Thu, 24 Mar 2022 20:54:47 +0800 Message-ID: <20220324125450.56417-2-huangguangbin2@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220324125450.56417-1-huangguangbin2@huawei.com> References: <20220324125450.56417-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: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600016.china.huawei.com (7.193.23.20) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jian Shen If the MAC address A is configured to vport A and then vport B. The MAC address of vport A in the hardware becomes invalid. If the address of vport A is changed to MAC address B, the driver needs to delete the MAC address A of vport A. Due to the MAC address A of vport A has become invalid in the hardware entry, so "-ENOENT" is returned. In this case, the "used_umv_size" value recorded in driver is not updated. As a result, the MAC entry status of the software is inconsistent with that of the hardware. Therefore, the driver updates the umv size even if the MAC entry cannot be found. Ensure that the software and hardware status is consistent. Fixes: ee4bcd3b7ae4 ("net: hns3: refactor the MAC address configure") Signed-off-by: Jian Shen Signed-off-by: Guangbin Huang --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 24f7afacae02..4738c8da9297 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -8429,12 +8429,11 @@ int hclge_rm_uc_addr_common(struct hclge_vport *vport, hnae3_set_bit(req.entry_type, HCLGE_MAC_VLAN_BIT0_EN_B, 0); hclge_prepare_mac_addr(&req, addr, false); ret = hclge_remove_mac_vlan_tbl(vport, &req); - if (!ret) { + if (!ret || ret == -ENOENT) { mutex_lock(&hdev->vport_lock); hclge_update_umv_space(vport, true); mutex_unlock(&hdev->vport_lock); - } else if (ret == -ENOENT) { - ret = 0; + return 0; } return ret; -- 2.33.0