Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp690766imm; Fri, 5 Oct 2018 10:06:57 -0700 (PDT) X-Google-Smtp-Source: ACcGV61dPmKQzD7cKzpuVXWGnsBtnnoszo4v/t7/PVaSKBO3UIW7tu/IcWPpRI7RoFf6ZhEvcFE4 X-Received: by 2002:a17:902:7b84:: with SMTP id w4-v6mr12179964pll.32.1538759217446; Fri, 05 Oct 2018 10:06:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538759217; cv=none; d=google.com; s=arc-20160816; b=hY6Qthml4ERRQ5JZbdAF8Tdp9ImoD0Nk4QqbyVuJCBoF8pxcTvm4wVSRfLGWkrtA12 zPzQApfFEKUug4nOu0o48tcFHfanjLqGncrsbaPJq+EWmrqMEz2K+Qs+RPd85aV4NIQv W53trt9sSEnzOXUaHw3TAiR0ZqKFpQFZWC2vHPzmUNKw0r9mgbjqFLlhX1g4aOCsFFnk pcK740SUGYbkzAyk4zFGH6wT65vpvVTJR8OIyGBR1370nKol9t0sHSqCVnfS2EMOx2bU KLTyeWZW3E+vXVOx/1+1Cp97OhN7IPIuo4T17Xnn0/N7RYYmLlUnwXRhKwmKYe6yIP2k 5etQ== 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=orIiw+jIEPuVULyYiEJEYZT/Azjs/yf160lCKgzh7jk=; b=zw3Or7Ckhq7l0UYc1KE2/KmFacaoRlygL6VVLC9goRFeVr5jTWITAFty+gErh3XWKM 7ne0248hHXmrWwjKOrRDp1EuahtiiBGX6uMqgyFhKQbAQKVWx3tLtSxRIWhaIKw5T+T2 rsUmspC7k+Ck/QOZONSH46fSTo2nsXajeqyDR9c5W/D5LBsPLdiBbHdiavmoBj9/pQFw rSYEAdnyJkzkXgRwG3UJxfzc+F6ZtXFJMru0nOeu7H6H7o6caSCHB7hNXfwGK3R3b9GI ueW22fb/10cR669e2LWGEvEm2xTg8Y+95wQxZJetrKRfrA/4KiYi9ykghyggzS8jA1Sz uSLg== 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 c89-v6si9113745pfe.60.2018.10.05.10.06.41; Fri, 05 Oct 2018 10:06:57 -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 S1729466AbeJFAEY (ORCPT + 99 others); Fri, 5 Oct 2018 20:04:24 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:53870 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728021AbeJFAEX (ORCPT ); Fri, 5 Oct 2018 20:04:23 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 40AE9F7A8140A; Sat, 6 Oct 2018 01:04:44 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.399.0; Sat, 6 Oct 2018 01:04:37 +0800 From: Salil Mehta To: CC: , , , , , , , Zhongzhu Liu , Jian Shen Subject: [PATCH net-next 5/6] net: hns3: Add egress/ingress vlan filter for revision 0x21 Date: Fri, 5 Oct 2018 18:03:28 +0100 Message-ID: <20181005170329.6512-6-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20181005170329.6512-1-salil.mehta@huawei.com> References: <20181005170329.6512-1-salil.mehta@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.202.226.54] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zhongzhu Liu In revision 0x21, hw supports both ingress and egress vlan filter. This patch adds support for it. Signed-off-by: Zhongzhu Liu Signed-off-by: Jian Shen Signed-off-by: Salil Mehta --- .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 45 +++++++++++++++++----- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index d95ea9b..ca1a936 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -5523,7 +5523,7 @@ static int hclge_do_ioctl(struct hnae3_handle *handle, struct ifreq *ifr, } static int hclge_set_vlan_filter_ctrl(struct hclge_dev *hdev, u8 vlan_type, - bool filter_en) + u8 fe_type, bool filter_en) { struct hclge_vlan_filter_ctrl_cmd *req; struct hclge_desc desc; @@ -5533,7 +5533,7 @@ static int hclge_set_vlan_filter_ctrl(struct hclge_dev *hdev, u8 vlan_type, req = (struct hclge_vlan_filter_ctrl_cmd *)desc.data; req->vlan_type = vlan_type; - req->vlan_fe = filter_en; + req->vlan_fe = filter_en ? fe_type : 0; ret = hclge_cmd_send(&hdev->hw, &desc, 1); if (ret) @@ -5545,13 +5545,30 @@ static int hclge_set_vlan_filter_ctrl(struct hclge_dev *hdev, u8 vlan_type, #define HCLGE_FILTER_TYPE_VF 0 #define HCLGE_FILTER_TYPE_PORT 1 +#define HCLGE_FILTER_FE_EGRESS_V1_B BIT(0) +#define HCLGE_FILTER_FE_NIC_INGRESS_B BIT(0) +#define HCLGE_FILTER_FE_NIC_EGRESS_B BIT(1) +#define HCLGE_FILTER_FE_ROCE_INGRESS_B BIT(2) +#define HCLGE_FILTER_FE_ROCE_EGRESS_B BIT(3) +#define HCLGE_FILTER_FE_EGRESS (HCLGE_FILTER_FE_NIC_EGRESS_B \ + | HCLGE_FILTER_FE_ROCE_EGRESS_B) +#define HCLGE_FILTER_FE_INGRESS (HCLGE_FILTER_FE_NIC_INGRESS_B \ + | HCLGE_FILTER_FE_ROCE_INGRESS_B) static void hclge_enable_vlan_filter(struct hnae3_handle *handle, bool enable) { struct hclge_vport *vport = hclge_get_vport(handle); struct hclge_dev *hdev = vport->back; - hclge_set_vlan_filter_ctrl(hdev, HCLGE_FILTER_TYPE_VF, enable); + if (hdev->pdev->revision >= 0x21) { + hclge_set_vlan_filter_ctrl(hdev, HCLGE_FILTER_TYPE_VF, + HCLGE_FILTER_FE_EGRESS, enable); + hclge_set_vlan_filter_ctrl(hdev, HCLGE_FILTER_TYPE_PORT, + HCLGE_FILTER_FE_INGRESS, enable); + } else { + hclge_set_vlan_filter_ctrl(hdev, HCLGE_FILTER_TYPE_VF, + HCLGE_FILTER_FE_EGRESS_V1_B, enable); + } } static int hclge_set_vf_vlan_common(struct hclge_dev *hdev, int vfid, @@ -5853,13 +5870,23 @@ static int hclge_init_vlan_config(struct hclge_dev *hdev) int ret; int i; - ret = hclge_set_vlan_filter_ctrl(hdev, HCLGE_FILTER_TYPE_VF, true); - if (ret) - return ret; + if (hdev->pdev->revision >= 0x21) { + ret = hclge_set_vlan_filter_ctrl(hdev, HCLGE_FILTER_TYPE_VF, + HCLGE_FILTER_FE_EGRESS, true); + if (ret) + return ret; - ret = hclge_set_vlan_filter_ctrl(hdev, HCLGE_FILTER_TYPE_PORT, true); - if (ret) - return ret; + ret = hclge_set_vlan_filter_ctrl(hdev, HCLGE_FILTER_TYPE_PORT, + HCLGE_FILTER_FE_INGRESS, true); + if (ret) + return ret; + } else { + ret = hclge_set_vlan_filter_ctrl(hdev, HCLGE_FILTER_TYPE_VF, + HCLGE_FILTER_FE_EGRESS_V1_B, + true); + if (ret) + return ret; + } hdev->vlan_type_cfg.rx_in_fst_vlan_type = HCLGE_DEF_VLAN_TYPE; hdev->vlan_type_cfg.rx_in_sec_vlan_type = HCLGE_DEF_VLAN_TYPE; -- 2.7.4