On 7/7/2020 6:25 AM, Jeff Guo wrote:
> Refactor hash flow by change the action parser and clean some code.
> 
> Signed-off-by: Jeff Guo <jia....@intel.com>

<...>

> @@ -333,46 +507,24 @@ ice_hash_parse_action(struct ice_pattern_match_item 
> *pattern_match_item,
>               switch (action_type) {
>               case RTE_FLOW_ACTION_TYPE_RSS:
>                       rss = action->conf;
> -                     rss_hf = rss->types;
> -
> -                     /**
> -                      * Check simultaneous use of SRC_ONLY and DST_ONLY
> -                      * of the same level.
> -                      */
> -                     rss_hf = rte_eth_rss_hf_refine(rss_hf);
> +                     rss_type = rss->types;
>  
> -                     /* Check if pattern is empty. */
> +                     /* Check hash function and save it to rss_meta. */
>                       if (pattern_match_item->pattern_list !=
> -                             pattern_empty && rss->func ==
> -                             RTE_ETH_HASH_FUNCTION_SIMPLE_XOR)
> +                         pattern_empty && rss->func ==
> +                         RTE_ETH_HASH_FUNCTION_SIMPLE_XOR) {
>                               return rte_flow_error_set(error, ENOTSUP,
>                                       RTE_FLOW_ERROR_TYPE_ACTION, action,
>                                       "Not supported flow");
> -
> -                     if ((rss_hf & ETH_RSS_ETH) && (rss_hf & ~ETH_RSS_PPPOE))
> -                             m->eth_rss_hint = ETH_RSS_ETH;
> -                     else if ((rss_hf & ETH_RSS_PPPOE) && (rss_hf & 
> ~ETH_RSS_ETH))
> -                             m->eth_rss_hint = ETH_RSS_PPPOE;
> -                     else if ((rss_hf & ETH_RSS_ETH) && (rss_hf & 
> ETH_RSS_PPPOE))
> -                             m->eth_rss_hint = ETH_RSS_ETH | ETH_RSS_PPPOE;
> -
> -                     /* Check if rss types match pattern. */
> -                     if (rss->func != RTE_ETH_HASH_FUNCTION_SIMPLE_XOR) {
> -                             if (((rss_hf & ETH_RSS_IPV4) != 
> m->eth_rss_hint) &&
> -                             ((rss_hf & ETH_RSS_NONFRAG_IPV4_UDP) != 
> m->eth_rss_hint) &&
> -                             ((rss_hf & ETH_RSS_NONFRAG_IPV4_TCP) != 
> m->eth_rss_hint) &&
> -                             ((rss_hf & ETH_RSS_NONFRAG_IPV4_SCTP) != 
> m->eth_rss_hint) &&
> -                             ((rss_hf & ETH_RSS_IPV6) != m->eth_rss_hint) &&
> -                             ((rss_hf & ETH_RSS_NONFRAG_IPV6_UDP) != 
> m->eth_rss_hint) &&
> -                             ((rss_hf & ETH_RSS_NONFRAG_IPV6_TCP) != 
> m->eth_rss_hint) &&
> -                             ((rss_hf & ETH_RSS_NONFRAG_IPV6_SCTP) != 
> m->eth_rss_hint) &&
> -                             ((rss_hf & ETH_RSS_ETH) != m->eth_rss_hint) &&
> -                             ((rss_hf & ETH_RSS_PPPOE) != m->eth_rss_hint) &&
> -                             (((rss_hf & (ETH_RSS_ETH | ETH_RSS_PPPOE)) !=
> -                                                                     
> m->eth_rss_hint)))
> -                                     return rte_flow_error_set(error,
> -                                     ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION,
> -                                     action, "Not supported RSS types");
> +                     } else if (rss->func ==
> +                                RTE_ETH_HASH_FUNCTION_SIMPLE_XOR){
> +                             ((struct rss_meta *)*meta)->hash_function =
> +                             RTE_ETH_HASH_FUNCTION_SIMPLE_XOR;
> +                             return 0;
> +                     } else if (rss->func ==
> +                                RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) {
> +                             ((struct rss_meta *)*meta)->hash_function =
> +                             RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ;
>                       }
>  
>                       if (rss->level)
> @@ -390,42 +542,38 @@ ice_hash_parse_action(struct ice_pattern_match_item 
> *pattern_match_item,
>                                       RTE_FLOW_ERROR_TYPE_ACTION, action,
>                                       "a non-NULL RSS queue is not 
> supported");
>  
> -                     /* Check hash function and save it to rss_meta. */
> -                     if (rss->func ==
> -                             RTE_ETH_HASH_FUNCTION_SIMPLE_XOR)
> -                             ((struct rss_meta *)*meta)->hash_function =
> -                             RTE_ETH_HASH_FUNCTION_SIMPLE_XOR;
> +                     /**
> +                      * Check simultaneous use of SRC_ONLY and DST_ONLY
> +                      * of the same level.
> +                      */
> +                     rss_type = rte_eth_rss_hf_refine(rss_type);
>  
> -                     if (rss->func ==
> -                             RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ)
> -                             ((struct rss_meta *)*meta)->hash_function =
> -                             RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ;
> +                     uint64_t combine_type = ETH_RSS_L2_SRC_ONLY |
> +                                     ETH_RSS_L2_DST_ONLY |
> +                                     ETH_RSS_L3_SRC_ONLY |
> +                                     ETH_RSS_L3_DST_ONLY |
> +                                     ETH_RSS_L4_SRC_ONLY |
> +                                     ETH_RSS_L4_DST_ONLY;


Declaring and initializing a varible in switch case causing warning with icc
[1], I will fix this while mergin by moving declaration out of switch.

[1]
.../dpdk/drivers/net/ice/ice_hash.c(672):
   warning #589: transfer of control bypasses initialization of:
            variable "combine_type" (declared at line 716)
                switch (action_type) {
                ^

<...>

Reply via email to