DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yahui Cao <yahui.cao@intel.com>
To: Qiming Yang <qiming.yang@intel.com>, Wenzhuo Lu <wenzhuo.lu@intel.com>
Cc: dev@dpdk.org, stable@dpdk.org, Qi Zhang <qi.z.zhang@intel.com>,
	Yahui Cao <yahui.cao@intel.com>,
	Xiaolong Ye <xiaolong.ye@intel.com>
Subject: [dpdk-dev] [PATCH] net/ice: fix FDIR gtp_psc without qfi pattern issue
Date: Tue, 21 Jan 2020 21:41:13 +0800	[thread overview]
Message-ID: <20200121134113.27109-1-yahui.cao@intel.com> (raw)

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 <yahui.cao@intel.com>
---
 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
-- 
2.17.1


             reply	other threads:[~2020-01-21 13:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-21 13:41 Yahui Cao [this message]
2020-02-02  8:22 ` Ye Xiaolong
2020-02-03  2:46   ` Zhang, Qi Z
2020-02-03  3:54     ` Ye Xiaolong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200121134113.27109-1-yahui.cao@intel.com \
    --to=yahui.cao@intel.com \
    --cc=dev@dpdk.org \
    --cc=qi.z.zhang@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=stable@dpdk.org \
    --cc=wenzhuo.lu@intel.com \
    --cc=xiaolong.ye@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).