On Fri, Oct 25, 2024 at 06:01:06PM +0100, Medvedkin, Vladimir wrote:
>    Hi Bruce,
> 
>    On 23/10/2024 17:55, Bruce Richardson wrote:
> 
> The DDP package file being loaded at init time may contain an
> alternative Tx Scheduler topology in it. Add driver option to load this
> topology at init time.
> 
> Signed-off-by: Bruce Richardson [1]<bruce.richard...@intel.com>
> ---
>  doc/guides/nics/ice.rst        | 15 +++++++++++++++
>  drivers/net/ice/base/ice_ddp.c | 20 +++++++++++++++++---
>  drivers/net/ice/base/ice_ddp.h |  4 ++--
>  drivers/net/ice/ice_ethdev.c   | 24 +++++++++++++++---------
>  drivers/net/ice/ice_ethdev.h   |  1 +
>  5 files changed, 50 insertions(+), 14 deletions(-)
> 
> 
>    <snip>
> 
> @@ -2030,19 +2032,18 @@ static int
>  parse_bool(const char *key, const char *value, void *args)
>  {
>         int *i = (int *)args;
> -       char *end;
> -       int num;
> 
> -       num = strtoul(value, &end, 10);
> -
> -       if (num != 0 && num != 1) {
> -               PMD_DRV_LOG(WARNING, "invalid value:\"%s\" for key:\"%s\", "
> -                       "value must be 0 or 1",
> +       if (value == NULL || value[0] == '\0') {
> +               PMD_DRV_LOG(WARNING, "key:\"%s\", requires a value, which 
> must b
> e 0 or 1", key);
> +               return -1;
> +       }
> +       if (value[1] != '\0' || (value[0] != '0' && value[0] != '1')) {
> +               PMD_DRV_LOG(WARNING, "invalid value:\"%s\" for key:\"%s\", 
> value
>  must be 0 or 1",
>                         value, key);
>                 return -1;
>         }
> 
> -       *i = num;
> +       *i = value[0] - '0';
> 
>    I think that instead of using char arithmetic, it would be better to:
> 
>    *i = !(value[0] == '0')
> 

Not sure it's that big a difference, however I will change it. Any
objection to removing the "!" there and doing:

*i = (value[0] == '1')

/Bruce

Reply via email to