> -----Original Message-----
> From: Jie Hai <haij...@huawei.com>
> 
> +static const char *
> +rss_func_to_str(enum rte_eth_hash_function func) {
> +     switch (func) {
> +     case RTE_ETH_HASH_FUNCTION_SIMPLE_XOR:
> +             return "simple_xor";
> +     case RTE_ETH_HASH_FUNCTION_TOEPLITZ:
> +             return "toeplitz";
> +     case RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ:
> +             return "symmetric_toeplitz";
> +     case RTE_ETH_HASH_FUNCTION_DEFAULT:
> +             return "default";
> +     default:
> +             return "unknown";
> +     }
> +}
> +


Instead of above function you can declare const array of strings as below to 
map hash function names.

static const char * const hf_names[] = {
        [RTE_ETH_HASH_FUNCTION_SIMPLE_XOR] = " simple_xor ",
        [RTE_ETH_HASH_FUNCTION_TOEPLITZ] = " toeplitz ",
        [RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ] = " symmetric_toeplitz ",
        [RTE_ETH_HASH_FUNCTION_DEFAULT] = "default"
};


> +                     printf("\t  -- hash algorithm : %s\n",
> +                             rss_func_to_str(rss_conf.func));
>               }
> 

And then print  as below ?
printf("\t  -- hash algorithm : %s\n", hf_names [rss_conf.func]);

Reply via email to