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 AAAC1A0C40 for ; Fri, 11 Jun 2021 09:37:15 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7BC4D410FB; Fri, 11 Jun 2021 09:37:15 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id AC4094014F for ; Fri, 11 Jun 2021 09:37:13 +0200 (CEST) IronPort-SDR: 6/AGdEgA5H2dh+WFBtLbTNowHnaNASeXKH72CO0hw57DyeQHZQF5gpWqLO+K5/sKRM9+74/qUH xPs24wQ/9KJA== X-IronPort-AV: E=McAfee;i="6200,9189,10011"; a="185171254" X-IronPort-AV: E=Sophos;i="5.83,265,1616482800"; d="scan'208";a="185171254" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2021 00:37:12 -0700 IronPort-SDR: cWHjb3Spqqi2Ahz6CtYrYZjDb5WzaP30Ih3eLT4c0m9J2tjYSDe6Ot0u3qCMJZuG08EbPHioOU gKDc7EDBtmyg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,265,1616482800"; d="scan'208";a="483169824" Received: from npg-dpdk-haiyue-1.sh.intel.com ([10.67.118.197]) by orsmga001.jf.intel.com with ESMTP; 11 Jun 2021 00:37:07 -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, haiyue.wang@intel.com, Brett Creeley , Qiming Yang Date: Fri, 11 Jun 2021 15:15:16 +0800 Message-Id: <20210611071531.48411-5-haiyue.wang@intel.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210611071531.48411-1-haiyue.wang@intel.com> References: <20210611065825.47678-1-haiyue.wang@intel.com> <20210611071531.48411-1-haiyue.wang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [PATCH 20.11 v2 04/18] net/ice/base: 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