[dpdk-dev] [PATCH v2 01/17] eal: add max SIMD bitwidth
Ananyev, Konstantin
konstantin.ananyev at intel.com
Mon Sep 7 00:01:47 CEST 2020
> This patch adds a max SIMD bitwidth EAL configuration. The API allows
> for an app to set this value. It can also be set using EAL argument
> --force-max-simd-bitwidth, which will lock the value and override any
> modifications made by the app.
>
> Signed-off-by: Ciara Power <ciara.power at intel.com>
>
> ---
> v2: Added to Doxygen comment for API.
> ---
> lib/librte_eal/common/eal_common_options.c | 60 ++++++++++++++++++++++
> lib/librte_eal/common/eal_internal_cfg.h | 8 +++
> lib/librte_eal/common/eal_options.h | 2 +
> lib/librte_eal/include/rte_eal.h | 32 ++++++++++++
> lib/librte_eal/rte_eal_version.map | 4 ++
> 5 files changed, 106 insertions(+)
>
> diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
> index a5426e1234..90f4e8f5c3 100644
> --- a/lib/librte_eal/common/eal_common_options.c
> +++ b/lib/librte_eal/common/eal_common_options.c
> @@ -102,6 +102,7 @@ eal_long_options[] = {
> {OPT_MATCH_ALLOCATIONS, 0, NULL, OPT_MATCH_ALLOCATIONS_NUM},
> {OPT_TELEMETRY, 0, NULL, OPT_TELEMETRY_NUM },
> {OPT_NO_TELEMETRY, 0, NULL, OPT_NO_TELEMETRY_NUM },
> + {OPT_FORCE_MAX_SIMD_BITWIDTH, 1, NULL, OPT_FORCE_MAX_SIMD_BITWIDTH_NUM},
> {0, 0, NULL, 0 }
> };
>
> @@ -1309,6 +1310,32 @@ eal_parse_iova_mode(const char *name)
> return 0;
> }
>
> +static int
> +eal_parse_simd_bitwidth(const char *arg, bool locked)
> +{
> + char *end;
> + uint16_t bitwidth;
> + int ret;
> + struct internal_config *internal_conf =
> + eal_get_internal_configuration();
> +
> + if (arg == NULL || arg[0] == '\0')
> + return -1;
> +
> + errno = 0;
> + bitwidth = strtoul(arg, &end, 0);
As I can see with that assignment you'll loose high bits set (if any).
So, --force-max-simd-bitwidth=0xf0080
wouldn't report any error, while it probably should.
Probably something like that, as abetter way:
unsigned long t;
...
t = strtoul(arg, &end, 0);
if (t > UINT16_MAX || errno != 0 || end == NULL || *end != '\0')
return -1;
ret = rte_set_max_simd_bitwidth(t);
> +
> + /* check for errors */
> + if ((errno != 0) || end == NULL || (*end != '\0'))
> + return -1;
> +
> + ret = rte_set_max_simd_bitwidth(bitwidth);
> + if (ret < 0)
> + return -1;
> + internal_conf->max_simd_bitwidth.locked = locked;
> + return 0;
> +}
> +
More information about the dev
mailing list