> -----Original Message-----
> From: Yigit, Ferruh <ferruh.yi...@intel.com>
> Sent: Wednesday, November 3, 2021 00:23
> To: Guo, Junfeng <junfeng....@intel.com>; Zhang, Qi Z
> <qi.z.zh...@intel.com>; Wu, Jingjing <jingjing...@intel.com>; Xing,
> Beilei <beilei.x...@intel.com>
> Cc: dev@dpdk.org; Xu, Ting <ting...@intel.com>
> Subject: Re: [PATCH v9 4/4] net/ice: enable protocol agnostic flow
> offloading in FDIR
> 
> On 11/2/2021 5:39 AM, Junfeng Guo wrote:
> > @@ -1733,6 +1862,101 @@ ice_fdir_parse_pattern(__rte_unused
> struct ice_adapter *ad,
> >                         &input_set_i : &input_set_o;
> >
> >             switch (item_type) {
> > +           case RTE_FLOW_ITEM_TYPE_RAW:
> > +                   raw_spec = item->spec;
> > +                   raw_mask = item->mask;
> > +
> > +                   if (item_num != 1)
> > +                           break;
> > +
> > +                   /* convert raw spec & mask from byte string to
> int */
> > +                   unsigned char *tmp_spec =
> > +                           (uint8_t *)(uintptr_t)raw_spec->pattern;
> > +                   unsigned char *tmp_mask =
> > +                           (uint8_t *)(uintptr_t)raw_mask->pattern;
> > +                   uint16_t udp_port = 0;
> > +                   uint16_t tmp_val = 0;
> > +                   uint8_t pkt_len = 0;
> > +                   uint8_t tmp = 0;
> > +                   int i, j;
> 
> 
> Hi Junfeng, Qi, Jingjing, Beilei,
> 
> This is causing build error with icc.
> 
> Mainly the problem is switch case doesn't provide a scope, in C they
> are just like labels. So these variables are valid for all switch statement
> and compiler complains that some cases are not initializing these
> variables.
> 
> Can you please either:
> 1- move these variables above switch
> 2- Create a scope after 'case' with '{}'
> 
> 2 can be done as:
> case RTE_FLOW_ITEM_TYPE_RAW: {
>       <...>
>       break;
> }

Sure, will enclose these code with curly brackets. Thanks for the solution!

Regards,
Junfeng Guo

Reply via email to