From patchwork Wed Jul 15 19:53:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chenmin Sun X-Patchwork-Id: 74087 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 92CA0A0545; Wed, 15 Jul 2020 12:57:00 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 297CC1BF5D; Wed, 15 Jul 2020 12:56:44 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 5B68F1BEE7 for ; Wed, 15 Jul 2020 12:56:40 +0200 (CEST) IronPort-SDR: Te842sgo/xm0ClcdNOHQ+215bvio8xQRFCER8HHyy/Cve3gN/D0Qfvf6xnC7QoCSYiOMXCUDVc Inx8gOF5BDcQ== X-IronPort-AV: E=McAfee;i="6000,8403,9682"; a="137249754" X-IronPort-AV: E=Sophos;i="5.75,355,1589266800"; d="scan'208";a="137249754" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jul 2020 03:56:40 -0700 IronPort-SDR: +HEe0hpITBqdysqdOXNV0qrIRjDf5deZRTlaAY9Xs4RAGKtP32dBsFZ9xYc6kDY0/WKcvY8kjt OAvYanMcIsPA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,355,1589266800"; d="scan'208";a="460026053" Received: from npg-dpdk-vpp-scm-1.sh.intel.com ([10.67.118.226]) by orsmga005.jf.intel.com with ESMTP; 15 Jul 2020 03:56:38 -0700 From: chenmin.sun@intel.com To: qi.z.zhang@intel.com, beilei.xing@intel.com, jingjing.wu@intel.com, haiyue.wang@intel.com Cc: dev@dpdk.org, chenmin.sun@intel.com Date: Thu, 16 Jul 2020 03:53:28 +0800 Message-Id: <20200715195329.34699-4-chenmin.sun@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200715195329.34699-1-chenmin.sun@intel.com> References: <20200713222321.2118-1-chenmin.sun@intel.com> <20200715195329.34699-1-chenmin.sun@intel.com> Subject: [dpdk-dev] [PATCH V4 3/4] net/i40e: move the i40e_get_outer_vlan to where it real needed X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Chenmin Sun This patch moves the fetching the device tpid to where it really needs, rather than fetching it every time when entered the functions. This is because this operation costs too many cycles and it is used only when matching the ethernet header. Signed-off-by: Chenmin Sun --- drivers/net/i40e/i40e_flow.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index 8c36f29b9..9a8bca46f 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -2047,9 +2047,6 @@ i40e_flow_parse_ethertype_pattern(struct rte_eth_dev *dev, const struct rte_flow_item_eth *eth_spec; const struct rte_flow_item_eth *eth_mask; enum rte_flow_item_type item_type; - uint16_t outer_tpid; - - outer_tpid = i40e_get_outer_vlan(dev); for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) { if (item->last) { @@ -2109,7 +2106,7 @@ i40e_flow_parse_ethertype_pattern(struct rte_eth_dev *dev, if (filter->ether_type == RTE_ETHER_TYPE_IPV4 || filter->ether_type == RTE_ETHER_TYPE_IPV6 || filter->ether_type == RTE_ETHER_TYPE_LLDP || - filter->ether_type == outer_tpid) { + filter->ether_type == i40e_get_outer_vlan(dev)) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, @@ -2611,7 +2608,6 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, uint16_t flex_size; bool cfg_flex_pit = true; bool cfg_flex_msk = true; - uint16_t outer_tpid; uint16_t ether_type; uint32_t vtc_flow_cpu; bool outer_ip = true; @@ -2620,7 +2616,6 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, memset(off_arr, 0, sizeof(off_arr)); memset(len_arr, 0, sizeof(len_arr)); memset(flex_mask, 0, I40E_FDIR_MAX_FLEX_LEN); - outer_tpid = i40e_get_outer_vlan(dev); filter->input.flow_ext.customized_pctype = false; for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) { if (item->last) { @@ -2688,7 +2683,7 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, if (next_type == RTE_FLOW_ITEM_TYPE_VLAN || ether_type == RTE_ETHER_TYPE_IPV4 || ether_type == RTE_ETHER_TYPE_IPV6 || - ether_type == outer_tpid) { + ether_type == i40e_get_outer_vlan(dev)) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, @@ -2732,7 +2727,7 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, if (ether_type == RTE_ETHER_TYPE_IPV4 || ether_type == RTE_ETHER_TYPE_IPV6 || - ether_type == outer_tpid) { + ether_type == i40e_get_outer_vlan(dev)) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item,