From bbbc39b2c2e5deb3eaa182c3ddb86aafc2ab962f Mon Sep 17 00:00:00 2001 From: Tomasz Cel Date: Thu, 7 Mar 2019 12:28:21 +0100 Subject: [PATCH] compress/isal: fix getting information about CPU This patch adds query about CPU features Fixes: 53a9baa98c36 ("compress/isal: add basic PMD ops") Cc: stable@dpdk.org Signed-off-by: Tomasz Cel Acked-by: Lee Daly --- drivers/compress/isal/isal_compress_pmd_ops.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/compress/isal/isal_compress_pmd_ops.c b/drivers/compress/isal/isal_compress_pmd_ops.c index 7b91849229..fe99959923 100644 --- a/drivers/compress/isal/isal_compress_pmd_ops.c +++ b/drivers/compress/isal/isal_compress_pmd_ops.c @@ -135,10 +135,18 @@ isal_comp_pmd_info_get(struct rte_compressdev *dev __rte_unused, { if (dev_info != NULL) { dev_info->capabilities = isal_pmd_capabilities; - dev_info->feature_flags = RTE_COMPDEV_FF_CPU_AVX512 | - RTE_COMPDEV_FF_CPU_AVX2 | - RTE_COMPDEV_FF_CPU_AVX | - RTE_COMPDEV_FF_CPU_SSE; + + /* Check CPU for supported vector instruction and set + * feature_flags + */ + if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX512F)) + dev_info->feature_flags |= RTE_COMPDEV_FF_CPU_AVX512; + else if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2)) + dev_info->feature_flags |= RTE_COMPDEV_FF_CPU_AVX2; + else if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX)) + dev_info->feature_flags |= RTE_COMPDEV_FF_CPU_AVX; + else + dev_info->feature_flags |= RTE_COMPDEV_FF_CPU_SSE; } } -- 2.20.1