Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp209112ybh; Thu, 12 Mar 2020 00:14:42 -0700 (PDT) X-Google-Smtp-Source: ADFU+vv6bLh5oygWuAvNHGXi7mNdOJUY9kkMJygNstFYr+eMTcN4c0dbdVm2XUlPQoCNg1k4FJcC X-Received: by 2002:aca:cf48:: with SMTP id f69mr1474585oig.122.1583997282140; Thu, 12 Mar 2020 00:14:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583997282; cv=none; d=google.com; s=arc-20160816; b=P1ft5IWCRbwzyl85DcLyh+8teXQ9/TUc9eAeBOMYDFsGVLYOattkk1xEuJAYI9VnpW gKfDLLy1n3+2GLg+FSzxGXTjt/TIHAidOqruph4m73SJ6e7B5wTRk784L1jPVZH1eJLR W1fxAUk91PbzfqYOzYxAO3Gj9mGnQp0pBFuKKzvE3/XzmlhYiULJufrnfrFJAd2FJSBY lp7bE9Fe9nRUJqQ6Mwt6dCqHMFTyO18vGfdyaswUbmW4/rQoJBzQsezvjN1vEeWRH4nR LKZMrVX/g6ykYBvs0JksKvg5nydKkPD1a9NQ0n5dRq9XU947TeUXdCZ4WCZWPpR2FLjP HWjA== 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; bh=0tBVHhkn2ugSB6aLwbJur5Ow6Zfaipj8tp+dmvA0l80=; b=axO0C8pF/NL/U4NxERG3hjg5tGuTxv+hkdEFQj0JrOy6GABABnPudlohEP9MfNZJfW V83lbme1g3jJYQST6b8+jZEm5l2SdOVzb78WT901ElwAAujpONqvR7lKqLO7HZTeaK8b thFNGCIzvWNzqRGgsGDJh8nHgs/DDWXyKQ1GB/VoGbjkkJYxnfYT28Xvdio7W1j9/lio ViWfa0HdZOoDaVlWk34fMtpWR+d0+6vHVsuCogRY2WGZa2TtYs3+rPIcodIzXBJHfpWh JzdkvF4Ds23aGVaDqUyp6VXDJbZ3U9yCCjxMIaQElxPhg2qAuJaM3ewuJsCLp3AdzcTN 7fMg== 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 m14si1673446otk.177.2020.03.12.00.14.30; Thu, 12 Mar 2020 00:14:42 -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 S2388094AbgCLHMQ (ORCPT + 99 others); Thu, 12 Mar 2020 03:12:16 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:11631 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388082AbgCLHMQ (ORCPT ); Thu, 12 Mar 2020 03:12:16 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 052506EFF710082B7DB4; Thu, 12 Mar 2020 15:12:14 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.487.0; Thu, 12 Mar 2020 15:12:07 +0800 From: Huazhong Tan To: CC: , , , , , , Jian Shen , Huazhong Tan Subject: [PATCH net 4/4] net: hns3: clear port base VLAN when unload PF Date: Thu, 12 Mar 2020 15:11:06 +0800 Message-ID: <1583997066-24773-5-git-send-email-tanhuazhong@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1583997066-24773-1-git-send-email-tanhuazhong@huawei.com> References: <1583997066-24773-1-git-send-email-tanhuazhong@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] 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 Currently, PF missed to clear the port base VLAN for VF when unload. In this case, the VLAN id will remain in the VLAN table. This patch fixes it. Fixes: 92f11ea177cd ("net: hns3: fix set port based VLAN issue for VF") Signed-off-by: Jian Shen Signed-off-by: Huazhong Tan --- .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 06d0ed0..d3b0cd7 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -8500,6 +8500,28 @@ static int hclge_set_vf_vlan_filter(struct hnae3_handle *handle, int vfid, } } +static void hclge_clear_vf_vlan(struct hclge_dev *hdev) +{ + struct hclge_vlan_info *vlan_info; + struct hclge_vport *vport; + int ret; + int vf; + + /* clear port base vlan for all vf */ + for (vf = HCLGE_VF_VPORT_START_NUM; vf < hdev->num_alloc_vport; vf++) { + vport = &hdev->vport[vf]; + vlan_info = &vport->port_base_vlan_cfg.vlan_info; + + ret = hclge_set_vlan_filter_hw(hdev, htons(ETH_P_8021Q), + vport->vport_id, + vlan_info->vlan_tag, true); + if (ret) + dev_err(&hdev->pdev->dev, + "failed to clear vf vlan for vf%d, ret = %d\n", + vf - HCLGE_VF_VPORT_START_NUM, ret); + } +} + int hclge_set_vlan_filter(struct hnae3_handle *handle, __be16 proto, u16 vlan_id, bool is_kill) { @@ -9909,6 +9931,7 @@ static void hclge_uninit_ae_dev(struct hnae3_ae_dev *ae_dev) struct hclge_mac *mac = &hdev->hw.mac; hclge_reset_vf_rate(hdev); + hclge_clear_vf_vlan(hdev); hclge_misc_affinity_teardown(hdev); hclge_state_uninit(hdev); -- 2.7.4