[dpdk-stable] [PATCH] net/ice: fix FDIR gtp_psc without qfi pattern issue

Yahui Cao yahui.cao at intel.com
Tue Jan 21 14:41:13 CET 2020


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 at dpdk.org

Signed-off-by: Yahui Cao <yahui.cao at 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



More information about the stable mailing list