From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CE9B2A0C40 for ; Fri, 11 Jun 2021 09:20:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C8E5840E78; Fri, 11 Jun 2021 09:20:03 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id C3BDA410FF for ; Fri, 11 Jun 2021 09:20:02 +0200 (CEST) IronPort-SDR: l0qDg0W91zysKQCMyuNR4LELrhaIS5XQysQF2JZbejhNbf1S2M0ft0IVJ4sITpSat3tW67CPAc l8NbOWDMGnEA== X-IronPort-AV: E=McAfee;i="6200,9189,10011"; a="291108151" X-IronPort-AV: E=Sophos;i="5.83,265,1616482800"; d="scan'208";a="291108151" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2021 00:20:02 -0700 IronPort-SDR: rhq4Q4ovErIAGtOE2j87yGM7JaG5KnMvZYCTO3HvI3uAMUfQFvS8z1n2IzqMKl6Lwfw0ieW4O3 qWeKzRqxLUZA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,265,1616482800"; d="scan'208";a="553333125" Received: from npg-dpdk-haiyue-1.sh.intel.com ([10.67.118.197]) by fmsmga001.fm.intel.com with ESMTP; 11 Jun 2021 00:19:59 -0700 From: Haiyue Wang To: stable@dpdk.org Cc: bluca@debian.org, xuemingl@nvidia.com, thomas@monjalon.net, christian.ehrhardt@canonical.com, ktraynor@redhat.com, qi.z.zhang@intel.com, Brett Creeley , Qiming Yang Date: Fri, 11 Jun 2021 14:58:11 +0800 Message-Id: <20210611065825.47678-5-haiyue.wang@intel.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210611065825.47678-1-haiyue.wang@intel.com> References: <20210611065825.47678-1-haiyue.wang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] =?utf-8?q?=5BPATCH=C2=A020=2E11_v1_04/18=5D_net/ic?= =?utf-8?q?e/base=3A_add_VLAN_TPID_for_VLAN_filters?= X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" From: Qi Zhang [ upstream commit a6b975d23c10756083357355372c4f545ddc1ebe ] Currently VLAN filters via RID4 are only based on VLAN ID. However, with incoming support for Double VLAN Mode (DVM), the driver needs to be able to support filtering on VLAN ID + VLAN TPID (i.e. 0x8100, 0x88a8, etc.). Add support for this by adding two fields to the ice_fltr_info structure. First, add the tpid_valid field so the code can determine whether or not to overwrite the default 0x8100 value for programming packets or use the tpid field. Signed-off-by: Brett Creeley Signed-off-by: Qi Zhang Acked-by: Qiming Yang --- drivers/net/ice/base/ice_switch.c | 6 ++++++ drivers/net/ice/base/ice_switch.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index e6ea04183f..8d455f5995 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -14,6 +14,7 @@ #define ICE_PPP_IPV6_PROTO_ID 0x0057 #define ICE_IPV6_ETHER_ID 0x86DD #define ICE_TCP_PROTO_ID 0x06 +#define ICE_ETH_P_8021Q 0x8100 /* Dummy ethernet header needed in the ice_aqc_sw_rules_elem * struct to configure any switch filter rules. @@ -3034,6 +3035,7 @@ ice_fill_sw_rule(struct ice_hw *hw, struct ice_fltr_info *f_info, struct ice_aqc_sw_rules_elem *s_rule, enum ice_adminq_opc opc) { u16 vlan_id = ICE_MAX_VLAN_ID + 1; + u16 vlan_tpid = ICE_ETH_P_8021Q; void *daddr = NULL; u16 eth_hdr_sz; u8 *eth_hdr; @@ -3106,6 +3108,8 @@ ice_fill_sw_rule(struct ice_hw *hw, struct ice_fltr_info *f_info, break; case ICE_SW_LKUP_VLAN: vlan_id = f_info->l_data.vlan.vlan_id; + if (f_info->l_data.vlan.tpid_valid) + vlan_tpid = f_info->l_data.vlan.tpid; if (f_info->fltr_act == ICE_FWD_TO_VSI || f_info->fltr_act == ICE_FWD_TO_VSI_LIST) { act |= ICE_SINGLE_ACT_PRUNE; @@ -3149,6 +3153,8 @@ ice_fill_sw_rule(struct ice_hw *hw, struct ice_fltr_info *f_info, if (!(vlan_id > ICE_MAX_VLAN_ID)) { off = (_FORCE_ __be16 *)(eth_hdr + ICE_ETH_VLAN_TCI_OFFSET); *off = CPU_TO_BE16(vlan_id); + off = (_FORCE_ __be16 *)(eth_hdr + ICE_ETH_ETHTYPE_OFFSET); + *off = CPU_TO_BE16(vlan_tpid); } /* Create the switch rule with the final dummy Ethernet header */ diff --git a/drivers/net/ice/base/ice_switch.h b/drivers/net/ice/base/ice_switch.h index be9b74fd4c..392eb369c7 100644 --- a/drivers/net/ice/base/ice_switch.h +++ b/drivers/net/ice/base/ice_switch.h @@ -160,6 +160,8 @@ struct ice_fltr_info { } mac_vlan; struct { u16 vlan_id; + u16 tpid; + u8 tpid_valid; } vlan; /* Set lkup_type as ICE_SW_LKUP_ETHERTYPE * if just using ethertype as filter. Set lkup_type as -- 2.32.0