net/ice: fix FDIR gtp_psc without qfi pattern issue
Checks
Commit Message
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(+)
Comments
On 01/21, Yahui Cao wrote:
>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");
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
>+ 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
>
Hi Xiaolong:
Please ignore this one, since it is covered by below patch already
https://patches.dpdk.org/patch/65025/
Thanks
Qi
> -----Original Message-----
> From: Ye, Xiaolong <xiaolong.ye@intel.com>
> Sent: Sunday, February 2, 2020 4:23 PM
> To: Cao, Yahui <yahui.cao@intel.com>
> Cc: Yang, Qiming <qiming.yang@intel.com>; Lu, Wenzhuo
> <wenzhuo.lu@intel.com>; dev@dpdk.org; stable@dpdk.org; Zhang, Qi Z
> <qi.z.zhang@intel.com>
> Subject: Re: [PATCH] net/ice: fix FDIR gtp_psc without qfi pattern issue
>
> On 01/21, Yahui Cao wrote:
> >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");
>
> 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
>
> >+ 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
> >
Got it, thanks for the info.
Thanks,
Xiaolong
On 02/03, Zhang, Qi Z wrote:
>Hi Xiaolong:
> Please ignore this one, since it is covered by below patch already
> https://patches.dpdk.org/patch/65025/
>Thanks
>Qi
>
>> -----Original Message-----
>> From: Ye, Xiaolong <xiaolong.ye@intel.com>
>> Sent: Sunday, February 2, 2020 4:23 PM
>> To: Cao, Yahui <yahui.cao@intel.com>
>> Cc: Yang, Qiming <qiming.yang@intel.com>; Lu, Wenzhuo
>> <wenzhuo.lu@intel.com>; dev@dpdk.org; stable@dpdk.org; Zhang, Qi Z
>> <qi.z.zhang@intel.com>
>> Subject: Re: [PATCH] net/ice: fix FDIR gtp_psc without qfi pattern issue
>>
>> On 01/21, Yahui Cao wrote:
>> >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");
>>
>> 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
>>
>> >+ 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
>> >
@@ -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:
@@ -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