Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp335452pxb; Thu, 26 Aug 2021 04:27:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmNdz/i9zuv2/p0PsVnP68cE7FaZIli58P1806L3arXJ1cQIE4gt6/m7GHnqO2EsNc0KOT X-Received: by 2002:a92:cf0d:: with SMTP id c13mr2293877ilo.49.1629977236823; Thu, 26 Aug 2021 04:27:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629977236; cv=none; d=google.com; s=arc-20160816; b=KGky3G70gggivxNkGCpF430U+Epcfxjw+sShZoNO93v0Xm6olbvOuHXW5xLl8Jf2i0 V/0RJUo36xzB+vRrY/ftRCW/+2QZtpmhPD+xVbQZRklrH6uadvIr+n805h1j8luCo7V1 TQEbdO4FSQXY8WTAo628E+gvKEkBhKwrI1hJCW2moFu1IyzdMQz2E3+01cdFLkuCYh+T D1EP3UN2k2qf+qImJ9+gimq4b1pvySaM6Cgm2D7s6hVC1k3Q6yeCkAV6SGALdsbqV5+e zxrXHBVM7BeOG+zKvfifGWQgbyV9Rq8UEfWNnaX+XBTOpH7qW3Gl8/eGi2rP8D0NK90e mDyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=YpXEpOdkPDyAbcPkcbHan+vomke4UezHvpLV5R3jFnU=; b=Y0Uzug6VKmzK8t1q5aDQi1Rc+zVq6bySo/awV12QOnfaKc+QoDWvZltUs3Oy4SUQgJ UygzioCLbaCyUwMx84pH/RDI3R86H/cw/CPGfREnE7WnP47XQ18yFfAiPGdTockQ+nu2 1wb8eDLjtnJMKDu+NsmR4IV+SV7SPjy7wY3W1uoUbxLBimyiPzx3Z0ifYPOD0oAoSwmG 3tjlh9d+/fZphZ/mYVcqmCDsB3lGGlWJiTroovLIyETpnaGaFsbPzFucmJiF2S75gDL5 5ASJW6vs3mH5Myztu06oNRm45gLRqK4f1Y/gE49W1G9/xKKxg4MsK5dpJi6hrwGYTbni /k9A== 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 g7si3457708iov.41.2021.08.26.04.27.05; Thu, 26 Aug 2021 04:27:16 -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 S242289AbhHZL0s (ORCPT + 99 others); Thu, 26 Aug 2021 07:26:48 -0400 Received: from szxga03-in.huawei.com ([45.249.212.189]:15255 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242036AbhHZL0m (ORCPT ); Thu, 26 Aug 2021 07:26:42 -0400 Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4GwLB86D1qz8B0r; Thu, 26 Aug 2021 19:25:36 +0800 (CST) Received: from dggemi759-chm.china.huawei.com (10.1.198.145) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Thu, 26 Aug 2021 19:25:52 +0800 Received: from localhost.localdomain (10.67.165.24) by dggemi759-chm.china.huawei.com (10.1.198.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Thu, 26 Aug 2021 19:25:52 +0800 From: Guangbin Huang To: , CC: , , , Subject: [PATCH net 4/7] net: hns3: fix duplicate node in VLAN list Date: Thu, 26 Aug 2021 19:21:58 +0800 Message-ID: <1629976921-43438-5-git-send-email-huangguangbin2@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1629976921-43438-1-git-send-email-huangguangbin2@huawei.com> References: <1629976921-43438-1-git-send-email-huangguangbin2@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggemi759-chm.china.huawei.com (10.1.198.145) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Guojia Liao VLAN list should not be added duplicate VLAN node, otherwise it would cause "add failed" when restore VLAN from VLAN list, so this patch adds VLAN ID check before adding node into VLAN list. Fixes: c6075b193462 ("net: hns3: Record VF vlan tables") Signed-off-by: Guojia Liao Signed-off-by: Guangbin Huang --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 78408136f253..1d0fa966e55a 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -10073,7 +10073,11 @@ static int hclge_init_vlan_config(struct hclge_dev *hdev) static void hclge_add_vport_vlan_table(struct hclge_vport *vport, u16 vlan_id, bool writen_to_tbl) { - struct hclge_vport_vlan_cfg *vlan; + struct hclge_vport_vlan_cfg *vlan, *tmp; + + list_for_each_entry_safe(vlan, tmp, &vport->vlan_list, node) + if (vlan->vlan_id == vlan_id) + return; vlan = kzalloc(sizeof(*vlan), GFP_KERNEL); if (!vlan) -- 2.8.1