Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp207983ybh; Thu, 12 Mar 2020 00:13:14 -0700 (PDT) X-Google-Smtp-Source: ADFU+vv5zp3IbaJmyI+nCp82m/E4MQYGIpDr86MrX6cAOasM1UVFAbMQ+UTbPAaVDE1YqfkfF9Lk X-Received: by 2002:a05:6830:403d:: with SMTP id i29mr4890907ots.353.1583997194778; Thu, 12 Mar 2020 00:13:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583997194; cv=none; d=google.com; s=arc-20160816; b=Yqb8Qa4y4pTNjVUN6Hcy6Mj/+6DKr5C8C3EtWbwfopI19ryDHwfDW7VJdJSJ240Q8t Jr2zWE7UZGNDZKHp5xM52t9419oBu2pUg5/y361ZUvd3jy8zywMOYW7oN/A5N5Oj6FD0 oT1IsIivaffatb5m3f6M2YuF5NKwog/7FbqQtj1MNx5vr+3c3dOHSI62lmnFzHXH+f1V IEDxCy2Gl3GKvLyrJWFrNuriHS3KrWx4afaLPbDGvPkMxWArSRi4iGN4y6BWDI1cbHqU WTAa/Abmg20uzD2SdS0JNhCotveYAgcqwXUeX5Y8SLJ6FeU7rcMMootK4TnDuAhLHZPj Kxyg== 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=ykXA7V2PbDMsbI83rDYuIdESNhh2P9DKBdJApr8lBOQ=; b=gOq1rJ5ktxq5DYFptA2t1mrWbd8XJxOHvU/dfGq2uh1bfyrZ009vyC7/scoBEokdP/ KM+4PzeRsoaGFQneoBrkIbyel0fByyMgdA2/yFGrdrk0xhdl9OCgekX21qcW6BUOv+Rq OlgT8WYgjKfK4bSn+rirxzEtmwRJzsRbXMqVlIS2x2p1/8xYYtD6GTkTYVjXBRXZqZIa ApE1xmxK6Qsfco0lIiq9Rajg18C0CBvDQDrTHLwVHF0qUBDyUH/2xHB31bispsVPe3BO ZXE5A0HzWINB8GIw6FAtYJGJaT8hhgmNuVBjyFFv06rq2M8bfKh/RvzSaLdGTqIGmqCt 2ugw== 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 u9si2385862oia.62.2020.03.12.00.13.02; Thu, 12 Mar 2020 00:13:14 -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 S2388139AbgCLHMU (ORCPT + 99 others); Thu, 12 Mar 2020 03:12:20 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:11635 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388089AbgCLHMT (ORCPT ); Thu, 12 Mar 2020 03:12:19 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 16476B0A14B8EB317EBF; 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:06 +0800 From: Huazhong Tan To: CC: , , , , , , Jian Shen , Huazhong Tan Subject: [PATCH net 3/4] net: hns3: fix RMW issue for VLAN filter switch Date: Thu, 12 Mar 2020 15:11:05 +0800 Message-ID: <1583997066-24773-4-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 According to the user manual, the ingress and egress VLAN filter are configured at the same time. Currently, hclge_init_vlan_config() and hclge_set_vlan_spoofchk() will both change the VLAN filter switch. So it's necessary to read the old configuration before modifying it. Fixes: 22044f95faa0 ("net: hns3: add support for spoof check setting") Signed-off-by: Jian Shen Signed-off-by: Huazhong Tan --- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 6deeb96..06d0ed0 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -7745,16 +7745,27 @@ static int hclge_set_vlan_filter_ctrl(struct hclge_dev *hdev, u8 vlan_type, struct hclge_desc desc; int ret; - hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_VLAN_FILTER_CTRL, false); - + /* read current vlan filter parameter */ + hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_VLAN_FILTER_CTRL, true); req = (struct hclge_vlan_filter_ctrl_cmd *)desc.data; req->vlan_type = vlan_type; - req->vlan_fe = filter_en ? fe_type : 0; req->vf_id = vf_id; ret = hclge_cmd_send(&hdev->hw, &desc, 1); + if (ret) { + dev_err(&hdev->pdev->dev, + "failed to get vlan filter config, ret = %d.\n", ret); + return ret; + } + + /* modify and write new config parameter */ + hclge_cmd_reuse_desc(&desc, false); + req->vlan_fe = filter_en ? + (req->vlan_fe | fe_type) : (req->vlan_fe & ~fe_type); + + ret = hclge_cmd_send(&hdev->hw, &desc, 1); if (ret) - dev_err(&hdev->pdev->dev, "set vlan filter fail, ret =%d.\n", + dev_err(&hdev->pdev->dev, "failed to set vlan filter, ret = %d.\n", ret); return ret; -- 2.7.4