On Sun, Jul 19, 2015 at 11:34:23AM +0200, Balakrishna.Garapati wrote:
> Signed-off-by: Balakrishna.Garapati <[email protected]>
> ---
>  example/generator/odp_generator.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/example/generator/odp_generator.c 
> b/example/generator/odp_generator.c
> index d35f4aa..5c6c276 100644
> --- a/example/generator/odp_generator.c
> +++ b/example/generator/odp_generator.c
> @@ -633,9 +633,13 @@ int main(int argc, char *argv[])
>       if (args->appl.cpu_count)
>               num_workers = args->appl.cpu_count;
>  
> -     /* ping mode need two worker */
> -     if (args->appl.mode == APPL_MODE_PING)
> -             num_workers = 2;
> +     /* ping mode need two workers */
> +     if (args->appl.mode == APPL_MODE_PING) {
> +             if (num_workers < 2) {
> +                     EXAMPLE_ERR("Need at least two worker threads\n");
> +                     exit(EXIT_FAILURE);
> +             }
> +     }

This change looks to be allowing num_workers to be > 2 in ping mode, but
the code further down seems to completely ignore num_workers and cpumask
and forces use of CPU 0 for both send and receive threads, which seems
totally broken given that CPU 0 is likely to be a control CPU.

Apart from that the check for minimum number of workers should be done
after the call to odp_cpumask_def_worker() as the platform may not be
able to satisfy the requested number.

>  
>       /*
>        * By default CPU #0 runs Linux kernel background tasks.
> @@ -1032,6 +1036,8 @@ static void usage(char *progname)
>              "  -t, --timeout only for ping mode, wait ICMP reply timeout 
> seconds\n"
>              "  -i, --interval wait interval ms between sending each packet\n"
>              "                 default is 1000ms. 0 for flood mode\n"
> +            "  -w, --workers specify number of workers need to be assigned 
> to application\n"
> +            "                 default is to assign all\n"
>              "\n"
>              "Optional OPTIONS\n"
>              "  -h, --help       Display help and exit.\n"
> -- 
> 1.9.1
_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to