> -----Original Message-----
> From: Zhang, Qi Z <qi.z.zh...@intel.com>
> Sent: Monday, April 26, 2021 9:48 AM
> To: Zhang, Yuying <yuying.zh...@intel.com>; dev@dpdk.org; Wang, Haiyue
> <haiyue.w...@intel.com>
> Cc: Yan, Zhirun <zhirun....@intel.com>; Guo, Junfeng <junfeng....@intel.com>
> Subject: RE: [PATCH v3 2/2] net/ice: refactor input set fields for switch
> filter
>
>
>
> > -----Original Message-----
> > From: Zhang, Yuying <yuying.zh...@intel.com>
> > Sent: Sunday, April 25, 2021 9:29 PM
> > To: dev@dpdk.org; Zhang, Qi Z <qi.z.zh...@intel.com>; Wang, Haiyue
> > <haiyue.w...@intel.com>
> > Cc: Yan, Zhirun <zhirun....@intel.com>; Guo, Junfeng
> > <junfeng....@intel.com>; Zhang, Yuying <yuying.zh...@intel.com>
> > Subject: [PATCH v3 2/2] net/ice: refactor input set fields for switch
> > filter
> >
> > Input set has been divided into inner and outer part to distinguish
> > different fields. However, the parse method of switch filter doesn't
> > match this update. Refactor switch filter to distingush inner and
> > outer input set in the same way as other filters.
> >
> > Signed-off-by: Yuying Zhang <yuying.zh...@intel.com>
> > ---
> > drivers/net/ice/ice_switch_filter.c | 746
> > ++++++++++++----------------
> > 1 file changed, 323 insertions(+), 423 deletions(-)
> >
> >
>
> ......
> >
> > -static uint64_t
> > -ice_switch_inset_get(const struct rte_flow_item pattern[],
> > +static bool
> > +ice_switch_parse_pattern(const struct rte_flow_item pattern[],
> > struct rte_flow_error *error,
> > struct ice_adv_lkup_elem *list,
> > uint16_t *lkups_num,
> > -enum ice_sw_tunnel_type *tun_type)
> > +enum ice_sw_tunnel_type *tun_type,
> > +const struct ice_pattern_match_item pattern_match_item)
>
> Better to parse const pointer, but not struct value
>
> const struct ice_pattern_match_item *pattern_match_item
>
> > {
> > const struct rte_flow_item *item = pattern; enum rte_flow_item_type
> > item_type; @@ -504,7 +456,9 @@ ice_switch_inset_get(const struct
> > rte_flow_item pattern[], const struct rte_flow_item_pfcp *pfcp_spec,
> > *pfcp_mask; const struct rte_flow_item_gtp *gtp_spec, *gtp_mask;
> > const struct rte_flow_item_gtp_psc *gtp_psc_spec, *gtp_psc_mask;
> > -uint64_t input_set = ICE_INSET_NONE;
> > +uint64_t outer_input_set = ICE_INSET_NONE; uint64_t inner_input_set =
> > +ICE_INSET_NONE; uint64_t *input = NULL;
>
> Why we need pointer here?
>
> Can we:
>
> if (tunnel_valid) {
> ...
> input_set = inner_input_set;
> } else {
> ...
> input_set = outer_input_set;
> }
>
We need to change the value of inner_input_set and outer_input_set
according to actual input set of the rule to be created. Pointer is used to
distinguish which one need to be changed.
> .......
> >
> > -inputset = ice_switch_inset_get
> > -(pattern, error, list, &lkups_num, &tun_type); -if ((!inputset &&
> > !ice_is_prof_rule(tun_type)) || -(inputset &
> > ~pattern_match_item->input_set_mask_o)) {
> > +if (ice_switch_parse_pattern(pattern, error, list, &lkups_num,
> > + &tun_type, *pattern_match_item) == false) {
>
> No need "==false", use ! for Boolean.
>
> > rte_flow_error_set(error, EINVAL,
> > RTE_FLOW_ERROR_TYPE_ITEM_SPEC,
> > pattern,
> > --
> > 2.25.1
>