From patchwork Mon Jul 22 12:06:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaolong Ye X-Patchwork-Id: 56936 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EDD981BF43; Tue, 23 Jul 2019 06:08:48 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 324EAA3; Tue, 23 Jul 2019 06:08:47 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Jul 2019 21:08:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,297,1559545200"; d="scan'208";a="344620295" Received: from dpdk_yexl_af_xdp.sh.intel.com ([10.67.119.189]) by orsmga005.jf.intel.com with ESMTP; 22 Jul 2019 21:08:44 -0700 From: Xiaolong Ye To: Ferruh Yigit , Beilei Xing , Qi Zhang Cc: dev@dpdk.org, Xiaolong Ye , stable@dpdk.org Date: Mon, 22 Jul 2019 20:06:37 +0800 Message-Id: <20190722120639.62468-1-xiaolong.ye@intel.com> X-Mailer: git-send-email 2.17.0 Subject: [dpdk-dev] [PATCH 1/2] net/i40e: fix ether pattern rule for fdir 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" i40e FDIR doesn't allow to create flow with empty spec and mask for ethertype pattern. Without this patch, below flow would be created successfully which is unexpected. > flow create 0 ingress pattern eth / end actions drop / end Fixes: 7d83c152a207 ("net/i40e: parse flow director filter") Cc: stable@dpdk.org Cc: beilei.xing@intel.com Signed-off-by: Xiaolong Ye Acked-by: Beilei Xing --- drivers/net/i40e/i40e_flow.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index 48a6782a8..3c0af70c0 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -2442,6 +2442,7 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, uint64_t input_set = I40E_INSET_NONE; uint16_t frag_off; enum rte_flow_item_type item_type; + enum rte_flow_item_type next_type; enum rte_flow_item_type l3 = RTE_FLOW_ITEM_TYPE_END; enum rte_flow_item_type cus_proto = RTE_FLOW_ITEM_TYPE_END; uint32_t i, j; @@ -2482,6 +2483,16 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, case RTE_FLOW_ITEM_TYPE_ETH: eth_spec = item->spec; eth_mask = item->mask; + next_type = (item + 1)->type; + + if (next_type == RTE_FLOW_ITEM_TYPE_END && + (!eth_spec || !eth_mask)) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, + item, + "NULL eth spec/mask."); + return -rte_errno; + } if (eth_spec && eth_mask) { if (!rte_is_zero_ether_addr(ð_mask->src) || @@ -2494,8 +2505,6 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, } } if (eth_spec && eth_mask && eth_mask->type) { - enum rte_flow_item_type next = (item + 1)->type; - if (eth_mask->type != RTE_BE16(0xffff)) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, @@ -2506,7 +2515,7 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, ether_type = rte_be_to_cpu_16(eth_spec->type); - if (next == RTE_FLOW_ITEM_TYPE_VLAN || + if (next_type == RTE_FLOW_ITEM_TYPE_VLAN || ether_type == RTE_ETHER_TYPE_IPV4 || ether_type == RTE_ETHER_TYPE_IPV6 || ether_type == RTE_ETHER_TYPE_ARP || From patchwork Mon Jul 22 12:06:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaolong Ye X-Patchwork-Id: 56937 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9B50C1BF63; Tue, 23 Jul 2019 06:08:51 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 70A69A3; Tue, 23 Jul 2019 06:08:48 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Jul 2019 21:08:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,297,1559545200"; d="scan'208";a="344620309" Received: from dpdk_yexl_af_xdp.sh.intel.com ([10.67.119.189]) by orsmga005.jf.intel.com with ESMTP; 22 Jul 2019 21:08:46 -0700 From: Xiaolong Ye To: Ferruh Yigit , Beilei Xing , Qi Zhang Cc: dev@dpdk.org, Xiaolong Ye , stable@dpdk.org, xiaoyun.li@intel.com Date: Mon, 22 Jul 2019 20:06:38 +0800 Message-Id: <20190722120639.62468-2-xiaolong.ye@intel.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20190722120639.62468-1-xiaolong.ye@intel.com> References: <20190722120639.62468-1-xiaolong.ye@intel.com> Subject: [dpdk-dev] [PATCH 2/2] net/i40e: fix fdir rule destroy failure 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" We should tear down the fdir when the last flow is destroyed, current logic is opposite to expected behavior, this patch fixes this issue. Fixes: 2e67a7fbf3ff ("net/i40e: config flow director automatically") Cc: stable@dpdk.org Cc: xiaoyun.li@intel.com Signed-off-by: Xiaolong Ye Acked-by: Beilei Xing --- drivers/net/i40e/i40e_flow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index 3c0af70c0..c60c9e240 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -4771,7 +4771,7 @@ i40e_flow_destroy(struct rte_eth_dev *dev, &((struct i40e_fdir_filter *)flow->rule)->fdir, 0); /* If the last flow is destroyed, disable fdir. */ - if (!ret && !TAILQ_EMPTY(&pf->fdir.fdir_list)) { + if (!ret && TAILQ_EMPTY(&pf->fdir.fdir_list)) { i40e_fdir_teardown(pf); dev->data->dev_conf.fdir_conf.mode = RTE_FDIR_MODE_NONE;