From patchwork Fri May 25 18:42:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 136988 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp3946315lji; Fri, 25 May 2018 11:48:34 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoy+8UFS/WkKZNoF/7hWs+TQiD0PB27rSbtYHOhJu/G8bv686C8g8eJtrS36SswjX4p7XOX X-Received: by 2002:a17:902:7e06:: with SMTP id b6-v6mr3730577plm.151.1527274114403; Fri, 25 May 2018 11:48:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527274114; cv=none; d=google.com; s=arc-20160816; b=fpmTzGf0v3IFYSIsLIKNQlXBdFnNdGYB+oWr9VV4naHFgImCn+sNChgw1bl+Vc6hn+ Sp79jYrj0Si6uWy9FdDt842u1LE2Fwll2OB2fSr115i6aVtPCXne3//UVf6/q+Bc07TX TPbhQMlLKtJcQA2mUU5iD+gGou4YhEgRUzQTxSLLaCbji9WuOtAa3HPMUmhqBXJNqeAC OIcz2wnKwKrrfAl/k+t08fGUfWbL8+HXXd+nKOyc20pV/pAVnPx9s/LyzrNx+UEpUeRA MSx8VrTb18OP4zSdmvewvLVxxRtxWCe/zodvMET9iQ4JrySPFbn1N/jYqwX2Q0R7fe8u KBig== 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:arc-authentication-results; bh=7azRa8ixGTohyUdnXaxWErNWwxCkNYNe6OepxwcdM7w=; b=oP1+wyL0W1UMN2GBbhSk7Uiw/BE0JK02UZoVupKx6RyO6iHCW+9fo4WJIJAPVETdTK nwslAgP3driVlkpCumenn7PBQUuJer9g+j4+/LLT6TRDcgtHSch8P0F22HgJoYq2vn6L snFch33887QEm028XMrF+NVonPj13IVNkUsRtNZ7dIK6iR2vmEJ52LGbfPzQQo7RHT9q UgoCbf+FXdXI+0zA3xWo4xFvm2422ljiPjynVH9E9BFCYUDmldKEm9QzqM/HNAAF7Nms 0abPLzEC/QAynLeAvV2kCWvkjNLDweERZYQl0oU8h81JH7RaEZEAAecI5URUrSl2XDBO mhKg== 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 m1-v6si24171847pfe.79.2018.05.25.11.48.34; Fri, 25 May 2018 11:48:34 -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 S967767AbeEYSol (ORCPT + 30 others); Fri, 25 May 2018 14:44:41 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:34813 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S967453AbeEYSoj (ORCPT ); Fri, 25 May 2018 14:44:39 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id B1EA8A1DE4EF8; Sat, 26 May 2018 02:44:36 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.227.234) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.382.0; Sat, 26 May 2018 02:44:28 +0800 From: Salil Mehta To: CC: , , , , , , Subject: [PATCH net-next 02/12] net: hns3: Add support for tx_accept_tag2 and tx_accept_untag2 config Date: Fri, 25 May 2018 19:42:57 +0100 Message-ID: <20180525184307.36288-3-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180525184307.36288-1-salil.mehta@huawei.com> References: <20180525184307.36288-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.227.234] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peng Li HNS3 Hardware can support up to two VLAN tags in transmit leg, the PPP module can handle the packets based on the tag1 and tag2 config. This patch adds support for tag2 config for vlan handling Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h | 7 ++++-- .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 26 +++++++++++++++++----- .../ethernet/hisilicon/hns3/hns3pf/hclge_main.h | 6 +++-- 3 files changed, 29 insertions(+), 10 deletions(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h index ee3cbac..3fa08f7 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h @@ -704,11 +704,14 @@ struct hclge_vlan_filter_vf_cfg_cmd { u8 vf_bitmap[16]; }; -#define HCLGE_ACCEPT_TAG_B 0 -#define HCLGE_ACCEPT_UNTAG_B 1 +#define HCLGE_ACCEPT_TAG1_B 0 +#define HCLGE_ACCEPT_UNTAG1_B 1 #define HCLGE_PORT_INS_TAG1_EN_B 2 #define HCLGE_PORT_INS_TAG2_EN_B 3 #define HCLGE_CFG_NIC_ROCE_SEL_B 4 +#define HCLGE_ACCEPT_TAG2_B 5 +#define HCLGE_ACCEPT_UNTAG2_B 6 + struct hclge_vport_vtag_tx_cfg_cmd { u8 vport_vlan_cfg; u8 vf_offset; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 2f0bbb6..c0b8d5a 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -4687,10 +4687,14 @@ static int hclge_set_vlan_tx_offload_cfg(struct hclge_vport *vport) req = (struct hclge_vport_vtag_tx_cfg_cmd *)desc.data; req->def_vlan_tag1 = cpu_to_le16(vcfg->default_tag1); req->def_vlan_tag2 = cpu_to_le16(vcfg->default_tag2); - hnae_set_bit(req->vport_vlan_cfg, HCLGE_ACCEPT_TAG_B, - vcfg->accept_tag ? 1 : 0); - hnae_set_bit(req->vport_vlan_cfg, HCLGE_ACCEPT_UNTAG_B, - vcfg->accept_untag ? 1 : 0); + hnae_set_bit(req->vport_vlan_cfg, HCLGE_ACCEPT_TAG1_B, + vcfg->accept_tag1 ? 1 : 0); + hnae_set_bit(req->vport_vlan_cfg, HCLGE_ACCEPT_UNTAG1_B, + vcfg->accept_untag1 ? 1 : 0); + hnae_set_bit(req->vport_vlan_cfg, HCLGE_ACCEPT_TAG2_B, + vcfg->accept_tag2 ? 1 : 0); + hnae_set_bit(req->vport_vlan_cfg, HCLGE_ACCEPT_UNTAG2_B, + vcfg->accept_untag2 ? 1 : 0); hnae_set_bit(req->vport_vlan_cfg, HCLGE_PORT_INS_TAG1_EN_B, vcfg->insert_tag1_en ? 1 : 0); hnae_set_bit(req->vport_vlan_cfg, HCLGE_PORT_INS_TAG2_EN_B, @@ -4814,8 +4818,18 @@ static int hclge_init_vlan_config(struct hclge_dev *hdev) for (i = 0; i < hdev->num_alloc_vport; i++) { vport = &hdev->vport[i]; - vport->txvlan_cfg.accept_tag = true; - vport->txvlan_cfg.accept_untag = true; + vport->txvlan_cfg.accept_tag1 = true; + vport->txvlan_cfg.accept_untag1 = true; + + /* accept_tag2 and accept_untag2 are not supported on + * pdev revision(0x20), new revision support them. The + * value of this two fields will not return error when driver + * send command to fireware in revision(0x20). + * This two fields can not configured by user. + */ + vport->txvlan_cfg.accept_tag2 = true; + vport->txvlan_cfg.accept_untag2 = true; + vport->txvlan_cfg.insert_tag1_en = false; vport->txvlan_cfg.insert_tag2_en = false; vport->txvlan_cfg.default_tag1 = 0; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h index 93177d9..677f1e4 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h @@ -570,8 +570,10 @@ struct hclge_dev { /* VPort level vlan tag configuration for TX direction */ struct hclge_tx_vtag_cfg { - bool accept_tag; /* Whether accept tagged packet from host */ - bool accept_untag; /* Whether accept untagged packet from host */ + bool accept_tag1; /* Whether accept tag1 packet from host */ + bool accept_untag1; /* Whether accept untag1 packet from host */ + bool accept_tag2; + bool accept_untag2; bool insert_tag1_en; /* Whether insert inner vlan tag */ bool insert_tag2_en; /* Whether insert outer vlan tag */ u16 default_tag1; /* The default inner vlan tag to insert */