Skip to contentSkip to conversation

net/ice: fix FDIR gtp_psc without qfi pattern issue

PATCH In review Yahui Cao 3 participants 4 messages Jan 21, 2020 – Feb 3, 2020 Network drivers

lore
Share & tools
lore

Yahui Cao

author
#0 lore raw

PATCH 1/1 net/ice: fix FDIR gtp_psc without qfi pattern issue

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")
---
 drivers/net/ice/ice_fdir_filter.c  | 12 ++++++++++++
 drivers/net/ice/ice_generic_flow.h |  6 ++++++
 2 files changed, 18 insertions(+)
drivers/net/ice/ice_fdir_filter.c +12 -0
index f356581d1..7517299fc 100644
@@ -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:
drivers/net/ice/ice_generic_flow.h +6 -0
index adc30ee2a..8387b5fee 100644
@@ -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
Signature · 1 line
2.17.1
#1 lore raw
Quoted 23 lines · Yahui Cao

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

---
drivers/net/ice/ice_fdir_filter.c | 12 ++++++++++++ drivers/net/ice/ice_generic_flow.h | 6 ++++++

2 files changed, 18 insertions(+)
drivers/net/ice/ice_fdir_filter.c +0 -0
index f356581d1..7517299fc 100644
@@ -1894,6 +1894,18 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad,
 
 				filter->input.gtpu_data.qfi =
 					gtp_psc_spec->qfi;

drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, · line 1906

Quoted 10 lines
drivers/net/ice/ice_fdir_filter.c +10 -0
+			} 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");

Is this a correct message for the error?

Btw, this patch can't be applied cleanly on top of latest dpdk-next-net-intel, please help rebase and send a new version.

Thanks,
Xiaolong

Quoted 23 lines
drivers/net/ice/ice_fdir_filter.c +2 -0
+					return -rte_errno;
+				}
 			}
 			break;
 		default:
drivers/net/ice/ice_generic_flow.h +6 -0
index adc30ee2a..8387b5fee 100644
@@ -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
Signature · 1 line
2.17.1
#2 lore raw

Hi Xiaolong:

	Please ignore this one, since it is covered by below patch already 
	https://patches.dpdk.org/patch/65025/ 

Thanks
Qi

Quoted 78 lines

-----Original Message-----
From: Ye, Xiaolong <[email protected]>
Sent: Sunday, February 2, 2020 4:23 PM
To: Cao, Yahui <[email protected]>
Cc: Yang, Qiming <[email protected]>; Lu, Wenzhuo <[email protected]>; [email protected]; [email protected]; Zhang, Qi Z <[email protected]>
Subject: Re: [PATCH] net/ice: fix FDIR gtp_psc without qfi pattern issue

Quoted 25 lines · Yahui Cao

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

---
drivers/net/ice/ice_fdir_filter.c | 12 ++++++++++++ drivers/net/ice/ice_generic_flow.h | 6 ++++++

2 files changed, 18 insertions(+)
drivers/net/ice/ice_fdir_filter.c +0 -0
index f356581d1..7517299fc 100644
@@ -1894,6 +1894,18 @@ ice_fdir_parse_pattern(__rte_unused struct
 ice_adapter *ad,
 
 				filter->input.gtpu_data.qfi =
 					gtp_psc_spec->qfi;

drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct · line 1907

Quoted 10 lines
drivers/net/ice/ice_fdir_filter.c +10 -0
+			} 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");

Is this a correct message for the error?

Btw, this patch can't be applied cleanly on top of latest dpdk-next-net-intel, please help rebase and send a new version.

Thanks,
Xiaolong

drivers/net/ice/ice_generic_flow.h ice_search_pattern_match_item(const struct

Quoted 11 lines
drivers/net/ice/ice_fdir_filter.c +2 -0
+					return -rte_errno;
+				}
 			}
 			break;

default:

drivers/net/ice/ice_generic_flow.h +0 -0
index adc30ee2a..8387b5fee 100644
@@ -485,4 +485,10 @@ ice_search_pattern_match_item(const struct

rte_flow_item pattern[],

Quoted 12 lines
drivers/net/ice/ice_generic_flow.h +5 -1
 		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

#3 lore raw

Got it, thanks for the info.

Thanks,
Xiaolong

Quoted 84 lines · Qi Z

Hi Xiaolong:

	Please ignore this one, since it is covered by below patch already 
	https://patches.dpdk.org/patch/65025/ 

Thanks
Qi

Quoted 78 lines

-----Original Message-----
From: Ye, Xiaolong <[email protected]>
Sent: Sunday, February 2, 2020 4:23 PM
To: Cao, Yahui <[email protected]>
Cc: Yang, Qiming <[email protected]>; Lu, Wenzhuo <[email protected]>; [email protected]; [email protected]; Zhang, Qi Z <[email protected]>
Subject: Re: [PATCH] net/ice: fix FDIR gtp_psc without qfi pattern issue

Quoted 25 lines · Yahui Cao

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

---
drivers/net/ice/ice_fdir_filter.c | 12 ++++++++++++ drivers/net/ice/ice_generic_flow.h | 6 ++++++

2 files changed, 18 insertions(+)
drivers/net/ice/ice_fdir_filter.c +0 -0
index f356581d1..7517299fc 100644
@@ -1894,6 +1894,18 @@ ice_fdir_parse_pattern(__rte_unused struct
 ice_adapter *ad,
 
 				filter->input.gtpu_data.qfi =
 					gtp_psc_spec->qfi;

drivers/net/ice/ice_fdir_filter.c ice_fdir_parse_pattern(__rte_unused struct · line 1907

Quoted 10 lines
drivers/net/ice/ice_fdir_filter.c +10 -0
+			} 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");

Is this a correct message for the error?

Btw, this patch can't be applied cleanly on top of latest dpdk-next-net-intel, please help rebase and send a new version.

Thanks,
Xiaolong

drivers/net/ice/ice_generic_flow.h ice_search_pattern_match_item(const struct

Quoted 11 lines
drivers/net/ice/ice_fdir_filter.c +2 -0
+					return -rte_errno;
+				}
 			}
 			break;

default:

drivers/net/ice/ice_generic_flow.h +0 -0
index adc30ee2a..8387b5fee 100644
@@ -485,4 +485,10 @@ ice_search_pattern_match_item(const struct

rte_flow_item pattern[],

Quoted 12 lines
drivers/net/ice/ice_generic_flow.h +5 -1
 		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