DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/ice: fix FDIR gtp_psc without qfi pattern issue
@ 2020-01-21 13:41 Yahui Cao
  2020-02-02  8:22 ` Ye Xiaolong
  0 siblings, 1 reply; 4+ messages in thread
From: Yahui Cao @ 2020-01-21 13:41 UTC (permalink / raw)
  To: Qiming Yang, Wenzhuo Lu; +Cc: dev, stable, Qi Zhang, Yahui Cao, Xiaolong Ye

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-02-03  3:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-21 13:41 [dpdk-dev] [PATCH] net/ice: fix FDIR gtp_psc without qfi pattern issue Yahui Cao
2020-02-02  8:22 ` Ye Xiaolong
2020-02-03  2:46   ` Zhang, Qi Z
2020-02-03  3:54     ` Ye Xiaolong

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).