Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp693296pxb; Tue, 5 Apr 2022 19:03:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHjXRrjPftJzvqO5eyC25ErKnoTjClnNRQ5Gkc0/D8/jKhh9/hRyhPn13i0EHLp/tcmZzi X-Received: by 2002:a17:903:110f:b0:154:c7a4:9371 with SMTP id n15-20020a170903110f00b00154c7a49371mr6406735plh.75.1649210587330; Tue, 05 Apr 2022 19:03:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649210587; cv=none; d=google.com; s=arc-20160816; b=CawEZvBAxvFjc3h91eubucJKzbzM4Cvso5uJ1JJul1vV02Vv6LwTf5uiCYzEiUvh/S nE9AXo9U+/v35R8oQ6wtUSVWEM9gO7/rwNc1gV9PI962FrnY4GjxP8Er4VWb/6ykYqHM B5dBT1fc0oBfLVMiKBazvMWd/Pz29xrhksaknz0DcCCaS8kkM0G89W8QYe0F9NvRHNcL fTU637jD8YF7H8hBLte8HwjmpEUDARL4lb3VBEMpIR2BblV+jJfSITt5fygeI7tAlFsK 8FQg4TTDs3eR1up4Dx+RirovADsBlB81p2Qyi3mK57tDVTAfT3kksA99GFFUTbpwsE4e lVEg== 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=YkYjvku6V1jTkIGRGW3YpZzIg16DjUN3DpUDnws3dxI=; b=QOT8kF9H78VM7MuE32GRr700PwKRC4w24JRqetqgIjkH0qQmQXzPTUpHm5ikOAuc2l MfO9+uCTXd/yzIsmF3tw0g3JaSIDQEaLskWcuVc3YZVFQvZeS5MRJ6xd8WVWGltNy62G aCMutdP5/5JaPe9IWDCwMZoE5fhgKmHSX1Yb6E7mcbij7uoUc6gP2lU7mLMon65zBx9h 98O+Z+UH5Zybt5CzyOcmqu6bROL5BXUgjaIAExXFdIyr2ltV3ExntlKp1Ov5d1uMUhuO fdBc8qF9KIgjOy+pls3I8yi/ZXP4lbaS5KwqiowN0CtriFLYnJk+rDUyEeYFAHHDRwJN YoHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xECi6vXA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bx7-20020a17090af48700b001bf1a231c27si3274756pjb.129.2022.04.05.19.02.49; Tue, 05 Apr 2022 19:03:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xECi6vXA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S1358555AbiDENJ1 (ORCPT + 99 others); Tue, 5 Apr 2022 09:09:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344150AbiDEJSZ (ORCPT ); Tue, 5 Apr 2022 05:18:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B6C4443D8; Tue, 5 Apr 2022 02:04:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3FBEBB81BBF; Tue, 5 Apr 2022 09:04:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 906C3C385A1; Tue, 5 Apr 2022 09:04:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649149475; bh=dVqkzsew4DEHWhEltK2MJT27ooP0p4RsSCP3QwS6HIo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xECi6vXAO1LoGWOQ+5KjNzPlYi2CtftvMLnROBm8GpRJK6ZhbRrk/+jvezIN2B+A4 E31dx36I28BJDjj8PqRAqE4AWx1FXux1g5CqnTzGtaW5XVkkzA6fRWuvNUVccfZFj/ C7iJ3zWfrp3b6go1Gt2i/5J+hjsi08Td3md05994= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jian Shen , Guangbin Huang , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 0729/1017] net: hns3: fix bug when PF set the duplicate MAC address for VFs Date: Tue, 5 Apr 2022 09:27:22 +0200 Message-Id: <20220405070415.905924838@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 [ Upstream commit ccb18f05535c96d26e2d559d402acb87700fc5a7 ] 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 Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- 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 c2a58101144e..0fc8810671dc 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -8888,12 +8888,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.34.1