From patchwork Tue Jan 21 13:41:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Cao, Yahui" X-Patchwork-Id: 65013 X-Patchwork-Delegate: xiaolong.ye@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 7F4C3A04DD; Tue, 21 Jan 2020 14:43:36 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 744891252; Tue, 21 Jan 2020 14:43:35 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id BCFBFF11; Tue, 21 Jan 2020 14:43:33 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Jan 2020 05:43:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,346,1574150400"; d="scan'208";a="227340529" Received: from dpdk-yahui-skylake.sh.intel.com ([10.67.119.16]) by orsmga003.jf.intel.com with ESMTP; 21 Jan 2020 05:43:31 -0800 From: Yahui Cao To: Qiming Yang , Wenzhuo Lu Cc: dev@dpdk.org, stable@dpdk.org, Qi Zhang , Yahui Cao , Xiaolong Ye Date: Tue, 21 Jan 2020 21:41:13 +0800 Message-Id: <20200121134113.27109-1-yahui.cao@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] net/ice: fix FDIR gtp_psc without qfi pattern issue 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" If only gtpu teid is specified, FDIR will always match the gtpu teid no matter there is gtp extension header appended or not. So forbid pattern in which gtp_psc without qfi value follows gtpu with teid value like: pattern eth / ipv4 / udp / gtpu teid is XXX / gtp_psc / end Fixes: efc16c621415 ("net/ice: support flow director GTPU tunnel") Cc: stable@dpdk.org Signed-off-by: Yahui Cao --- drivers/net/ice/ice_fdir_filter.c | 12 ++++++++++++ drivers/net/ice/ice_generic_flow.h | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c index f356581d1..7517299fc 100644 --- a/drivers/net/ice/ice_fdir_filter.c +++ b/drivers/net/ice/ice_fdir_filter.c @@ -1894,6 +1894,18 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, filter->input.gtpu_data.qfi = gtp_psc_spec->qfi; + } else { + /* forbid pattern like: + * "gtpu teid is XXX / gtp_psc / end" + */ + if (ice_flow_inset_get_field(input_set, + ICE_INSET_GTPU_TEID)) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, + item, + "Invalid GTP mask"); + return -rte_errno; + } } break; default: diff --git a/drivers/net/ice/ice_generic_flow.h b/drivers/net/ice/ice_generic_flow.h index adc30ee2a..8387b5fee 100644 --- a/drivers/net/ice/ice_generic_flow.h +++ b/drivers/net/ice/ice_generic_flow.h @@ -485,4 +485,10 @@ ice_search_pattern_match_item(const struct rte_flow_item pattern[], struct ice_pattern_match_item *array, uint32_t array_len, struct rte_flow_error *error); + +static inline int +ice_flow_inset_get_field(uint64_t input_set, uint64_t field) +{ + return (input_set & field) == field; +} #endif